summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2001-06-03 12:36:10 +0000
committerivan <ivan>2001-06-03 12:36:10 +0000
commit4d23190fe52f0c3c5071c806187a524ecfa52cdd (patch)
treef60405bcd9bf812b003615c75f2fb3929b35cacd
parent6bad87c25d14ca38162948f44a8379c8040ca50a (diff)
add username-letter and username-letterfirst config files
-rw-r--r--FS/FS/svc_acct.pm12
-rw-r--r--htdocs/docs/config.html2
2 files changed, 11 insertions, 3 deletions
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm
index 774b8d0ee..0e0c88541 100644
--- a/FS/FS/svc_acct.pm
+++ b/FS/FS/svc_acct.pm
@@ -2,7 +2,7 @@ package FS::svc_acct;
use strict;
use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin
- $usernamemax $passwordmin
+ $usernamemax $passwordmin $username_letter $username_letterfirst
$shellmachine $useradd $usermod $userdel
@saltset @pw_set);
use Carp;
@@ -46,6 +46,8 @@ $FS::UID::callback{'FS::svc_acct'} = sub {
'rm -rf $old_dir'.
')';
}
+ $username_letter = $conf->exists('username-letter');
+ $username_letterfirst = $conf->exists('username-letterfirst');
};
@saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
@@ -381,7 +383,11 @@ sub check {
$recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
or return "Illegal username";
$recref->{username} = $1;
- $recref->{username} =~ /[a-z]/ or return "Illegal username";
+ if ( $username_letterfirst ) {
+ $recref->{username} =~ /^[a-z]/ or return "Illegal username";
+ } elsif ( $username_letter ) {
+ $recref->{username} =~ /[a-z]/ or return "Illegal username";
+ }
$recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
@@ -536,7 +542,7 @@ sub radius_check {
=head1 VERSION
-$Id: svc_acct.pm,v 1.16 2001-06-03 11:37:08 ivan Exp $
+$Id: svc_acct.pm,v 1.17 2001-06-03 12:36:10 ivan Exp $
=head1 BUGS
diff --git a/htdocs/docs/config.html b/htdocs/docs/config.html
index b255ce30e..49be7200b 100644
--- a/htdocs/docs/config.html
+++ b/htdocs/docs/config.html
@@ -99,6 +99,8 @@ All further configuration files and directories are located in
<li><a name="textradiusprepend">textradiusprepend</a> - The contents of this file will be prepended to the first line of a user's RADIUS entry in text exports. If necessary, usually `Auth-Type = Local, '.
<li><a name="usernamemin">usernamemin</a> - Minimum username length (default 2);
<li><a name="usernamemax">usernamemax</a> - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run)
+ <li><a name="usernamemax">username-letter</a> - The existance of this file will turn on the requirement that usernames contain at least one letter.
+ <li><a name="usernamemax">username-letterfirst</a> - The existance of this file will turn on the requirement that usernames start with a letter.
</ul>
</body>