username-uppercase config file
authorivan <ivan>
Sun, 30 Sep 2001 20:30:09 +0000 (20:30 +0000)
committerivan <ivan>
Sun, 30 Sep 2001 20:30:09 +0000 (20:30 +0000)
FS/FS/svc_acct.pm
httemplate/docs/config.html

index 46208aa..3530001 100644 (file)
@@ -3,7 +3,7 @@ package FS::svc_acct;
 use strict;
 use vars qw( @ISA $nossh_hack $conf $dir_prefix @shells $usernamemin
              $usernamemax $passwordmin $username_letter $username_letterfirst
-             $username_noperiod
+             $username_noperiod $username_uppercase
              $shellmachine $useradd $usermod $userdel $mydomain
              $cyrus_server $cyrus_admin_user $cyrus_admin_pass
              $dirhash
@@ -57,6 +57,7 @@ $FS::UID::callback{'FS::svc_acct'} = sub {
   $username_letter = $conf->exists('username-letter');
   $username_letterfirst = $conf->exists('username-letterfirst');
   $username_noperiod = $conf->exists('username-noperiod');
+  $username_uppercase = $conf->exists('username-uppercase');
   $mydomain = $conf->config('domain');
   if ( $conf->exists('cyrus') ) {
     ($cyrus_server, $cyrus_admin_user, $cyrus_admin_pass) =
@@ -674,9 +675,15 @@ sub check {
   return $error if $error;
 
   my $ulen = $usernamemax || $self->dbdef_table->column('username')->length;
-  $recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
-    or return "Illegal username";
+  if ( $username_uppercase ) {
+    $recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/i
+      or return "Illegal username";
+  } else {
+    $recref->{username} =~ /^([a-z0-9_\-\.]{$usernamemin,$ulen})$/
+      or return "Illegal username";
+  }
   $recref->{username} = $1;
+
   if ( $username_letterfirst ) {
     $recref->{username} =~ /^[a-z]/ or return "Illegal username";
   } elsif ( $username_letter ) {
@@ -705,8 +712,12 @@ sub check {
     return "Only root can have uid 0"
       if $recref->{uid} == 0 && $recref->{username} ne 'root';
 
-    $error = $self->ut_textn('finger');
-    return $error if $error;
+#    $error = $self->ut_textn('finger');
+#    return $error if $error;
+    $self->getfield('finger') =~
+      /^([\w \t\!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\*]*)$/
+        or return "Illegal finger: ". $self->getfield('finger');
+    $self->setfield('finger', $1);
 
     $recref->{dir} =~ /^([\/\w\-]*)$/
       or return "Illegal directory";
@@ -908,7 +919,7 @@ sub ssh {
 
 =head1 VERSION
 
-$Id: svc_acct.pm,v 1.46 2001-09-19 21:06:17 ivan Exp $
+$Id: svc_acct.pm,v 1.47 2001-09-30 20:30:09 ivan Exp $
 
 =head1 BUGS
 
index 2254b32..0cafc82 100644 (file)
@@ -112,6 +112,7 @@ All further configuration files and directories are located in
   <li><a name="username-letter">username-letter</a> - The existance of this file will turn on the requirement that usernames contain at least one letter.
   <li><a name="username-letterfirst">username-letterfirst</a> - The existance of this file will turn on the requirement that usernames start with a letter.
   <li><a name="username-noperiod">username-noperiod</a> - The existance of this file will disallow periods in usernames.
+  <li><a name="username-uppercase">username-uppercase</a> - The existance of this file will allow uppercase characters in username.
    <li><a name="username_policy">username_policy</a> - This file controls the mechanism for preventing duplicate usernames in passwd/radius files exported from svc_accts.  This should be one of 'prepend domsvc' 'append domsvc' or 'append domain'
    <li><a name="vpopmailmachines">vpopmailmachines</a> - Your vpopmail pop toasters, one per line.  Each line is of the form "machinename vpopdir vpopuid vpopgid".  For example: <code>poptoaster.domain.tld /home/vpopmail 508 508</code>  Note: vpopuid and vpopgid are values taken from the vpopmail machine's /etc/passwd