add password-noampersand and password-noexlamation config files, patch from Stephpen...
authorivan <ivan>
Fri, 26 Nov 2004 06:50:13 +0000 (06:50 +0000)
committerivan <ivan>
Fri, 26 Nov 2004 06:50:13 +0000 (06:50 +0000)
FS/FS/Conf.pm
FS/FS/svc_acct.pm

index d676d4e..cfc4207 100644 (file)
@@ -637,6 +637,20 @@ httemplate/docs/config.html
   },
 
   {
+    'key' => 'password-noampersand',
+    'section' => 'password',
+    'description' => 'Disallow ampersands in passwords',
+    'type' => 'checkbox',
+  },
+
+  {
+    'key' => 'password-noexclamation',
+    'section' => 'password',
+    'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
+    'type' => 'checkbox',
+  },
+
+  {
     'key'         => 'qmailmachines',
     'section'     => 'deprecated',
     'description' => '<b>DEPRECATED</b>, add <i>qmail</i> and <i>shellcommands</i> <a href="../browse/part_export.cgi">exports</a> instead.  This option used to export `/var/qmail/control/virtualdomains\', `/var/qmail/control/recipientmap\', and `/var/qmail/control/rcpthosts\'.  Setting this option (even if empty) also turns on user `.qmail-extension\' file maintenance in conjunction with the <b>shellmachine</b> option.',
index 28ef949..1e30a0f 100644 (file)
@@ -7,6 +7,7 @@ use vars qw( @ISA $DEBUG $me $conf
              $username_ampersand $username_letter $username_letterfirst
              $username_noperiod $username_nounderscore $username_nodash
              $username_uppercase
+             $password_noampersand $password_noexclamation
              $welcome_template $welcome_from $welcome_subject $welcome_mimetype
              $smtpmachine
              $radius_password $radius_ip
@@ -55,6 +56,8 @@ $FS::UID::callback{'FS::svc_acct'} = sub {
   $username_nodash = $conf->exists('username-nodash');
   $username_uppercase = $conf->exists('username-uppercase');
   $username_ampersand = $conf->exists('username-ampersand');
+  $password_noampersand = $conf->exists('password-noexclamation');
+  $password_noexclamation = $conf->exists('password-noexclamation');
   $dirhash = $conf->config('dirhash') || 0;
   if ( $conf->exists('welcome_email') ) {
     $welcome_template = new Text::Template (
@@ -683,6 +686,12 @@ sub check {
   unless ( $username_ampersand ) {
     $recref->{username} =~ /\&/ and return gettext('illegal_username');
   }
+  if ( $password_noampersand ) {
+    $recref->{_password} =~ /\&/ and return gettext('illegal_password');
+  }
+  if ( $password_noexclamation ) {
+    $recref->{_password} =~ /\!/ and return gettext('illegal_password');
+  }
 
   $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
   $recref->{popnum} = $1;