It appears that a bug in 2.1.22 was introduced in src/varstring.c, revision 
298, function ExtractInnerVarString. Subversion info:

Revision 298
Modified Mon Jan 8 16:08:10 2007 UTC (3 weeks, 2 days ago) by mark 
varstring expansion patch

In the second chunk of that change, while formatting an if conditional the 
logic was changed, replacing '!=' with '==' (possibly a copy and paste 
error). This breaks parsing in my setup since I use bash variable expansion 
in ExecResult statements (ie "${var:-foo}') and the ':' and '-' characters 
are incorrectly flagged as illegal cfengine characters.

I'm assuming this change was unintentional. If so, there may also be a logic 
error in this section of code, allowing illegal chars to pass through the 
test. I'm guessing the test should look more like:

if (isalnum((int)*sp) || 
    ((*sp != '_') &&
     (*sp != '[') && (*sp != ']') &&
     (*sp != '$') &&
     (*sp != '.')))

Unfortunately I don't have the time to look at/test it in more depth. I've 
attached a simple patch that changes the '==' back to '!=', reverting to the 
previous (2.1.21) behavior.
-JayKim

-- 
GO MOLI

Jason Kim
Senior Network Systems Engineer
CoVibe TECH
580 Village Boulevard, Suite 110
West Palm Beach, Florida 33409
tel: 561.459.1673
fax: 561.616.5509
[EMAIL PROTECTED]

THE INFORMATION CONTAINED IN THIS TRANSMISSION MAY CONTAIN PRIVILEGED OR 
CONFIDENTIAL INFORMATION INTENDED ONLY FOR USE OF THE INDIVIDUAL OR ENTITY 
NAMED ABOVE.  IF THE READER OF THIS MESSAGE IS NOT THE INTENDED RECIPIENT, 
YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION, DISTRIBUTION, OR COPYING OF 
THIS COMMUNICATION IS STRICTLY PROHIBITED.  IF YOU HAVE RECEIVED THIS 
TRANSMISSION IN ERROR, DO NOT READ IT.  PLEASE IMMEDIATELY REPLY TO THE 
SENDER THAT YOU HAVE RECEIVED THIS COMMUNICATION IN ERROR.  THEN DELETE IT.  
THANK YOU.
Index: src/varstring.c
===================================================================
--- src/varstring.c	(revision 327)
+++ src/varstring.c	(working copy)
@@ -255,10 +255,10 @@
           
       default:
           if (isalnum((int)*sp)
-              || (*sp == '_')
-              || (*sp == '[') || (*sp == ']')
-              || (*sp == '$')
-              || (*sp == '.'))
+              || (*sp != '_')
+              || (*sp != '[') || (*sp != ']')
+              || (*sp != '$')
+              || (*sp != '.'))
              {
              }
           else
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to