From: Rob H. <for...@us...> - 2003-08-24 18:43:35
|
Update of /cvsroot/sandweb/sandweb/bin In directory sc8-pr-cvs1:/tmp/cvs-serv13700/bin Modified Files: sandweb.cgi sandweb-admin Log Message: integrated Unix support, you can configure between unix and flatfile auth_type in sandweb.cfg sandweb-admin still needs to be run to create the user directory, but it won't ask for a password if you're a "unix" user. Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.365 retrieving revision 1.366 diff -U2 -r1.365 -r1.366 --- sandweb.cgi 21 Aug 2003 02:19:58 -0000 1.365 +++ sandweb.cgi 24 Aug 2003 18:43:32 -0000 1.366 @@ -709,24 +709,40 @@ my $salt = rand(0xffffffff); - my $content = $ui->get_menu( - MENU => 'login', - PROGNAME => "$progname", - #SALT => $salt, - ); + print $cgi->header; - #my $javascript = $ui->get_javascript( - # SCRIPT => 'md5', - #); + if ($config->{'system'}->{'auth_type'} eq 'flatfile') { + my $content = $ui->get_menu( + MENU => 'login_md5', + PROGNAME => "$progname", + SALT => $salt, + ); + + my $javascript = $ui->get_javascript( + SCRIPT => 'md5', + ); + $ui->print_screen( + TITLE => 'SandWeb : login', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'login', + FOOTER => '', + CONTENT => $content, + JAVASCRIPT => $javascript, + MESSAGE => $message, + ); + } else { + my $content = $ui->get_menu( + MENU => 'login', + PROGNAME => "$progname", + ); + $ui->print_screen( + TITLE => 'SandWeb : login', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'login', + FOOTER => '', + CONTENT => $content, + MESSAGE => $message, + ); + } - print $cgi->header; - $ui->print_screen( - TITLE => 'SandWeb : login', - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => 'login', - FOOTER => '', - CONTENT => $content, - #JAVASCRIPT => $javascript, - MESSAGE => $message, - ); exit 0; } Index: sandweb-admin =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb-admin,v retrieving revision 1.16 retrieving revision 1.17 diff -U2 -r1.16 -r1.17 --- sandweb-admin 12 Jan 2003 11:12:08 -0000 1.16 +++ sandweb-admin 24 Aug 2003 18:43:32 -0000 1.17 @@ -131,29 +131,29 @@ } - # get password - print "Enter password for $name: "; - system("stty", "-echo"); - my $tmp = <STDIN>; - system("stty", "sane"); - print "\n"; - chomp ($tmp); - if ($tmp) { - #encrypt passwd -# my $salt = substr($tmp, 0, 2); -# $enc_pwd = crypt($tmp, $salt); - $enc_pwd = md5_hex($tmp); + if ($config->{'system'}->{'auth_type'} eq 'flatfile'){ + # get password + print "Enter password for $name: "; + system("stty", "-echo"); + my $tmp = <STDIN>; + system("stty", "sane"); + print "\n"; + chomp ($tmp); + if ($tmp) { + #encrypt passwd + $enc_pwd = md5_hex($tmp); + } + else { + fexit('24', "error: no password entered, aborting."); + } + + $max_uid++; + open(PW, ">>$passwd_file") or + fexit('26', "Unable to open $passwd_file : $!"); + print PW "$name:$max_uid:$enc_pwd\n"; + close PW; } - else { - fexit('24', "error: no password entered, aborting."); - } - - $max_uid++; - open(PW, ">>$passwd_file") or - fexit('26', "Unable to open $passwd_file : $!"); - print PW "$name:$max_uid:$enc_pwd\n"; - close PW; - # added user's sandbox dir + # add user's sandbox dir system('mkdir', "$users_dir/$name"); if ($?) { |