[Lxr-commits] CVS: lxr/scripts ContextMgr.pm, 1.4, 1.5 configure-lxr.pl, 1.14, 1.15
Brought to you by:
ajlittoz
From: Andre-Littoz <ajl...@us...> - 2013-11-07 17:38:39
|
Update of /cvsroot/lxr/lxr/scripts In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13894/scripts Modified Files: ContextMgr.pm configure-lxr.pl Log Message: scripts/ContextMgr.pm & configure-lxr.pl: add answer validation filters (see QuestionAnswer.pm) Index: ContextMgr.pm =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/ContextMgr.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ContextMgr.pm 2 Sep 2013 16:37:36 -0000 1.4 +++ ContextMgr.pm 7 Nov 2013 17:38:36 -0000 1.5 @@ -409,14 +409,14 @@ $dbname = get_user_choice ( 'Name of global SQLite database file? (e.g. /home/myself/SQL-databases/lxr' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } else { $dbname = get_user_choice ( 'Name of global database?' , -1 - , [] + , [ '^\w+$', 'invalid characters in name' ] , [ 'lxr' ] ); } @@ -461,7 +461,7 @@ $dbuser = get_user_choice ( '--- DB user name?' , -1 - , [] + , [ '^\w+$', 'invalid characters in name' ] , [ 'lxr' ] ); $dbpass = get_user_choice @@ -486,7 +486,7 @@ $dbprefix = get_user_choice ( '--- Common table prefix?' , -1 - , [] + , [ '^\w+$', 'invalid characters in prefix' ] , [ 'lxr_' ] ); }else { @@ -600,23 +600,25 @@ $primaryhost = get_user_choice ( '--- Host name or IP?' , ('H' ne $treematch) ? -1 : -2 - , [ ] + , [ '^(?i:https?:)?//', 'not an HTTP URL' + , '//[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$', 'invalid characters in URL' + ] , ('H' ne $treematch) ? [ '//localhost' ] : [ ] ); - $primaryhost =~ m!^(https?:)?//([^:]+)(?::(\d+))?!; + $primaryhost =~ m!^([^/]+)?//([^:]+?)(?::(\d+))?/?!; $scheme = $1; $hostname = $2; $port = $3; $scheme = 'http:' if !defined($1); $port = 80 if 'http:' eq $scheme && !defined($3); $port = 443 if 'https:' eq $1 && !defined($3); - if (!defined($hostname)) { - print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; - $primaryhost = undef; - next; - } +# if (!defined($hostname)) { +# print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; +# $primaryhost = undef; +# next; +# } } my $aliashost; @schemealiases = (); @@ -625,19 +627,21 @@ while ('' ne ($aliashost = get_user_choice ( '--- Alias name or IP?' , -3 - , [ ] + , [ '^(?i:https?:)?//', 'not an HTTP URL' + , '//[\w-]+(?:\.[\w-]+)*(?::\d+)?/?$' + , 'invalid characters in URL' ] , [ ] ) ) ) {; - $aliashost =~ m!^(https?:)?//([^:]+)(?::(\d+))?!; + $aliashost =~ m!^([^/]+)?//([^:]+?)(?::(\d+))?/?!; my $aliasscheme = $1; my $aliasname = $2; my $aliasport = $3; - if (!defined($aliasname)) { - print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; - next; - } +# if (!defined($aliasname)) { +# print "${VTred}ERROR:${VTnorm} invalid host name or scheme, try again ...\n"; +# next; +# } $aliasscheme = 'http:' if !defined($1); $aliasport = 80 if 'http:' eq $aliasscheme && !defined($3); $aliasport = 443 if 'https:' eq $1 && !defined($3); @@ -662,9 +666,10 @@ $virtrootbase = get_user_choice ( 'URL section name for LXR in your server?' , -1 - , [ ] + , [ '^[^\']+$', 'quotes not allowed' ] , [ '/lxr' ] ); + $virtrootbase =~ s:/+$::; # Ensure no ending slash $virtrootbase =~ s:^/*:/:; # Ensure a starting slash if ( 'E' ne $treematch && 'N' ne $treematch Index: configure-lxr.pl =================================================================== RCS file: /cvsroot/lxr/lxr/scripts/configure-lxr.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- configure-lxr.pl 2 Sep 2013 16:29:03 -0000 1.14 +++ configure-lxr.pl 7 Nov 2013 17:38:36 -0000 1.15 @@ -460,22 +460,22 @@ ); if ($search eq '%glimpse%') { $markers{'%glimpse%'} = get_user_choice - ( "--- Location? (e.g. /usr/share/glimpse-dir/glimpse)" + ( '--- Location? (e.g. /usr/share/glimpse-dir/glimpse)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); $markers{'%glimpseindex%'} = get_user_choice ( '--- Location of indexer? (e.g. /usr/share/glimpse-dir/glimpseindex)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } else { $markers{'%swish%'} = get_user_choice - ( "--- Location? (e.g. /usr/share/swish-dir/swish-e)" + ( '--- Location? (e.g. /usr/share/swish-dir/swish-e)' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } @@ -492,7 +492,7 @@ $markers{'%glimpsedirbase%'} = get_user_choice ( '--- Directory for glimpse databases?' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); } @@ -500,7 +500,7 @@ $markers{'%swishdirbase%'} = get_user_choice ( '--- Directory for swish-e databases?' , -2 - , [] + , [ '^/', 'absolute file path required' ] , [] ); if ( !defined($markers{'%glimpse%'}) |