From: ivan Date: Sun, 3 Jun 2001 12:36:10 +0000 (+0000) Subject: add username-letter and username-letterfirst config files X-Git-Tag: Root-of-freeside_vpopmail_support~12 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=4d23190fe52f0c3c5071c806187a524ecfa52cdd add username-letter and username-letterfirst config files --- 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
  • textradiusprepend - 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, '.
  • usernamemin - Minimum username length (default 2);
  • usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) +
  • username-letter - The existance of this file will turn on the requirement that usernames contain at least one letter. +
  • username-letterfirst - The existance of this file will turn on the requirement that usernames start with a letter.