diff --git a/useradmin/CHANGELOG b/useradmin/CHANGELOG index 1b3994096..f6d7ff1bc 100644 --- a/useradmin/CHANGELOG +++ b/useradmin/CHANGELOG @@ -36,3 +36,4 @@ In a user batch file, # is only treated as a comment at the start of a line. ---- Changes since 1.380 ---- The real base directory for homes is now respected when batch creating users. Improved MD5 encryption auto-detection with newer PAM config files. +Batch user creation data is now better validated, and the batch form has been re-written to use the new Webmin UI library. diff --git a/useradmin/batch_exec.cgi b/useradmin/batch_exec.cgi index 40a784774..422f796cf 100755 --- a/useradmin/batch_exec.cgi +++ b/useradmin/batch_exec.cgi @@ -116,6 +116,13 @@ foreach $line (split(/[\r\n]+/, $data)) { } } + # Make sure all min/max fields are numeric + $err = &validate_batch_minmax(\%user, $lnum); + if ($err) { + print $err,"\n"; + next; + } + # Parse common fields if (!$line[1]) { print &text('batch_eline', $lnum),"\n"; @@ -646,3 +653,13 @@ foreach $g (@glist) { return @secs; } +sub validate_batch_minmax +{ +local ($user, $lnum) = @_; +foreach my $f ('min', 'max', 'warn', 'inactive', 'expire', 'change') { + $user->{$f} =~ /^(\-|\+|)\d*$/ || + return &text('batch_e'.$f, $lnum, $user->{$f}); + } +return undef; +} + diff --git a/useradmin/batch_form.cgi b/useradmin/batch_form.cgi index 625d8c3f9..c7dc18b87 100755 --- a/useradmin/batch_form.cgi +++ b/useradmin/batch_form.cgi @@ -7,82 +7,82 @@ require './user-lib.pl'; $access{'batch'} || &error($text{'batch_ecannot'}); &ui_print_header(undef, $text{'batch_title'}, ""); +# Instructions +print &ui_hidden_start($text{'batch_instr'}, "instr", 0, "batch_form.cgi"); print "$text{'batch_desc'}\n"; $pft = &passfiles_type(); print "
",$text{'batch_desc'.$pft},"
\n";
print "$text{'batch_descafter'}
\n";
print "$text{'batch_descafter2'}\n";
+print &ui_hidden_end("instr");
-print "