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

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Feb 3 15:17:41 EST 2006


User:      jon
Date:      2006-02-03 20:17:41 GMT
Modified:  lib/Vend Tag: STABLE_5_4-branch 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
No                   revision



No                   revision



2.188.2.2 +3 -3      interchange/lib/Vend/Config.pm


rev 2.188.2.2, prev_rev 2.188.2.1
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.188.2.1
retrieving revision 2.188.2.2
diff -u -u -r2.188.2.1 -r2.188.2.2
--- Config.pm	29 Nov 2005 20:28:35 -0000	2.188.2.1
+++ Config.pm	3 Feb 2006 20:17:40 -0000	2.188.2.2
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.188.2.1 2005/11/29 20:28:35 mheins Exp $
+# $Id: Config.pm,v 2.188.2.2 2006/02/03 20:17:40 jon Exp $
 #
 # Copyright (C) 2002-2005 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -52,7 +52,7 @@
 use Vend::Data;
 use Vend::Cron;
 
-$VERSION = substr(q$Revision: 2.188.2.1 $, 10);
+$VERSION = substr(q$Revision: 2.188.2.2 $, 10);
 
 my %CDname;
 my %CPname;
@@ -4517,7 +4517,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