From 717e56f20cd1e697c94d307ceeae65ccc04d7280 Mon Sep 17 00:00:00 2001 From: aland Date: Thu, 24 Aug 2006 23:49:47 +0000 Subject: [PATCH] In pairmove(), do NOT blindly move all of the attributes over if *to == NULL. We still have to pay attention to the operators. If the operators are comparison ones, then do NOT move them to the "*to" list, as they're not needed. --- src/lib/valuepair.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c index bb33edb..6e2b681 100644 --- a/src/lib/valuepair.c +++ b/src/lib/valuepair.c @@ -298,12 +298,6 @@ void pairmove(VALUE_PAIR **to, VALUE_PAIR **from) VALUE_PAIR *found; int has_password = 0; - if (*to == NULL) { - *to = *from; - *from = NULL; - return; - } - /* * First, see if there are any passwords here, and * point "tailto" to the end of the "to" list. @@ -321,6 +315,7 @@ void pairmove(VALUE_PAIR **to, VALUE_PAIR **from) */ for(i = *from; i; i = next) { next = i->next; + /* * If there was a password in the "to" list, * do not move any other password from the @@ -332,6 +327,28 @@ void pairmove(VALUE_PAIR **to, VALUE_PAIR **from) tailfrom = i; continue; } + + switch (i->operator) { + /* + * These are COMPARISON attributes + * from a check list, and are not + * supposed to be copied! + */ + case T_OP_NE: + case T_OP_GE: + case T_OP_GT: + case T_OP_LE: + case T_OP_LT: + case T_OP_CMP_TRUE: + case T_OP_CMP_FALSE: + case T_OP_CMP_EQ: + tailfrom = i; + continue; + + default: + break; + } + /* * If the attribute is already present in "to", * do not move it from "from" to "to". We make -- 2.1.4