[interchange-cvs] interchange - jon modified lib/Vend/Config.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Feb 3 15:16:49 EST 2006


User:      jon
Date:      2006-02-03 20:16:48 GMT
Modified:  lib/Vend Config.pm
Log:
Fix a bug found by Brian Miller <brian at endpoint.com>:

When reading an OrderProfile from an external config file,
for instance, etc/profiles.login or similar if there is a comment line
immediately preceding the __NAME__ identifier then the first line of the
profile is commented out. Actually any line preceding the __NAME__ line
will silently be prepended to the first line of the profile, just so
happens a comment (in some of our code) would be the likely offender.

For example:

# following profile confirms user input
__NAME__ Login
  username=required Username had better be filled in.
  password=required Password is required.
__END__

Will result in a profile structure that looks like:

# following profile confirms user input   username=required ...

And the username check will never execute.

Revision  Changes    Path
2.194     +3 -3      interchange/lib/Vend/Config.pm


rev 2.194, prev_rev 2.193
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.193
retrieving revision 2.194
diff -u -u -r2.193 -r2.194
--- Config.pm	30 Jan 2006 17:45:49 -0000	2.193
+++ Config.pm	3 Feb 2006 20:16:48 -0000	2.194
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.193 2006/01/30 17:45:49 jon Exp $
+# $Id: Config.pm,v 2.194 2006/02/03 20:16:48 jon Exp $
 #
 # Copyright (C) 2002-2006 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
 use Vend::Data;
 use Vend::Cron;
 
-$VERSION = substr(q$Revision: 2.193 $, 10);
+$VERSION = substr(q$Revision: 2.194 $, 10);
 
 my %CDname;
 my %CPname;
@@ -4522,7 +4522,7 @@
 		push @$c, (split /\s*[\r\n]+__END__[\r\n]+\s*/, readfile($_));
 	}
 	for($i = 0; $i < @$c; $i++) {
-		if($c->[$i] =~ s/(^|\n)__NAME__\s+([^\n\r]+)\r?\n//) {
+		if($c->[$i] =~ s/(^|\n)__NAME__\s+([^\n\r]+)\r?\n/$1/) {
 			my $name = $2;
 			$ref->{$name} = $i;
 		}








More information about the interchange-cvs mailing list