--- valuepair.c.orig	2005-11-04 15:27:46.000000000 -0500
+++ valuepair.c.JM	2005-11-04 15:34:08.000000000 -0500
@@ -284,7 +284,7 @@
 			 *	to not find it, then we succeeded.
 			 */
 			if (check_item->operator == T_OP_CMP_FALSE)
-				return 0;
+				continue;
 			else
 				return -1;
 		}
@@ -295,7 +295,10 @@
 		 */
 		if (check_item->operator == T_OP_CMP_FALSE)
 			return -1;
-
+		
+		/* no comparison needed if it exists */
+		if (check_item->operator == T_OP_CMP_TRUE) 
+			continue;
 
 		/*
 		 *	We've got to xlat the string before doing
@@ -327,14 +330,14 @@
 				radlog(L_ERR,  "Invalid operator for item %s: "
 						"reverting to '=='", check_item->name);
 				/*FALLTHRU*/
-		        case T_OP_CMP_TRUE:    /* compare always == 0 */
-		        case T_OP_CMP_FALSE:   /* compare always == 1 */
 			case T_OP_CMP_EQ:
 				if (compare != 0) result = -1;
 				break;
 
 			case T_OP_NE:
-				if (compare == 0) result = -1;
+				/* != only succeeds if NO reply values match*/
+				if (compare == 0) return -1;
+				result = -1; /*check the rest for no match */
 				break;
 
 			case T_OP_LT:
@@ -428,7 +431,9 @@
 				compare = regexec(&reg, (char *)auth_item->strvalue,
 						0, NULL, 0);
 				regfree(&reg);
-				if (compare == 0) result = -1;
+				/* !~ only succeeds if NO matches are found in reply pair */
+				if (compare == 0) return -1;
+				result = -1; /*check the rest for no match */
 				break;
 #endif
 
