diff options
author | ivan <ivan> | 1999-08-12 00:05:03 +0000 |
---|---|---|
committer | ivan <ivan> | 1999-08-12 00:05:03 +0000 |
commit | aa39234613e8148c531ad3fd0ca46ee806563f6c (patch) | |
tree | 329cc5bd66638ae6a931f413359c3e504a39355e | |
parent | cd4acd5da9225088baec070872ebec125c670981 (diff) |
configurable min/max username length, min password length, periods in usernames
-rw-r--r-- | FS/FS/svc_acct.pm | 16 | ||||
-rw-r--r-- | htdocs/docs/config.html | 3 |
2 files changed, 13 insertions, 6 deletions
diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index b2f23c933..079508b84 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1,8 +1,9 @@ package FS::svc_acct; use strict; -use vars qw(@ISA $nossh_hack $conf $dir_prefix @shells - $shellmachine @saltset @pw_set); +use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin + $usernamemax $passwordmin + $shellmachine @saltset @pw_set); use FS::Conf; use FS::Record qw( qsearchs fields ); use FS::svc_Common; @@ -18,6 +19,9 @@ $FS::UID::callback{'FS::svc_acct'} = sub { $dir_prefix = $conf->config('home'); @shells = $conf->config('shells'); $shellmachine = $conf->config('shellmachine'); + $usernamemin = $conf->config('usernamemin') || 2; + $usernamemax = $conf->config('usernamemax'); + $passwordmin = $conf->config('passwordmin') || 6; }; @saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' ); @@ -338,8 +342,8 @@ sub check { return $x unless ref($x); my $part_svc = $x; - my $ulen =$self->dbdef_table->column('username')->length; - $recref->{username} =~ /^([a-z0-9_\-]{2,$ulen})$/ + my $ulen = $usernamemax || $self->dbdef_table->column('username')->length; + $recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/ or return "Illegal username"; $recref->{username} = $1; $recref->{username} =~ /[a-z]/ or return "Illegal username"; @@ -422,7 +426,7 @@ sub check { unless ( $recref->{_password} ); #if ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([^\t\n]{4,16})$/ ) { - if ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([^\t\n]{4,8})$/ ) { + if ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([^\t\n]{$passwordmin,8})$/ ) { $recref->{_password} = $1.$3; #uncomment this to encrypt password immediately upon entry, or run #bin/crypt_pw in cron to give new users a window during which their @@ -446,7 +450,7 @@ sub check { =head1 VERSION -$Id: svc_acct.pm,v 1.1 1999-08-04 09:03:53 ivan Exp $ +$Id: svc_acct.pm,v 1.2 1999-08-12 00:05:03 ivan Exp $ =head1 BUGS diff --git a/htdocs/docs/config.html b/htdocs/docs/config.html index 7994af8f9..3d4e743c1 100644 --- a/htdocs/docs/config.html +++ b/htdocs/docs/config.html @@ -33,6 +33,7 @@ All further configuration files and directories are located in <li>invoice_from - Return address on email invoices. <li>lpr - Print command for paper invoices, for example `lpr -h'. <li>nismachines - Your NIS master (not slave master) machines, one per line. This enables export of `/etc/global/passwd' and `/etc/global/shadow'. + <li>passwordmin - Minimum password length (default 6); <li>qmailmachines - Your qmail machines, one per line. This enables export of `/var/qmail/control/virtualdomains', `/var/qmail/control/recipientmap', and `/var/qmail/control/rcpthosts'. The existance of this file (even if empty) also turns on user `.qmail-extension' file maintenance in conjunction with `shellmachine'. <li>radiusmachines - Your RADIUS authentication machines, one per line. This enables export of `/etc/raddb/users'. <li>registries - Directory which contains domain registry information. Each registry is a directory. @@ -52,6 +53,8 @@ All further configuration files and directories are located in <li>shells - Legal shells (think /etc/shells). You probably want to `cut -d: -f7 /etc/passwd | sort | uniq' initially so that importing doesn't fail with `Illegal shell' errors, then remove any special entries afterwords. A blank line specifies that an empty shell is permitted. <li>showpasswords - The existance of this file will allow unencrypted user passwords to be displayed. <li>smtpmachine - SMTP relay for Freeside's outgoing mail. + <li>usernamemin - Minimum username length (default 2); + <li>usernamemax - Maximum username length (default is the size of the SQL column, probably specified when fs-setup was run) </ul> </body> |