fix bug where user could log in to RADIUS with uppercase usernameand avoid bandwidth...
authorivan <ivan>
Thu, 23 Aug 2007 08:23:29 +0000 (08:23 +0000)
committerivan <ivan>
Thu, 23 Aug 2007 08:23:29 +0000 (08:23 +0000)
FS/FS/Conf.pm
FS/FS/part_export/sqlradius.pm

index e1fa051..0d37fea 100644 (file)
@@ -1099,7 +1099,7 @@ httemplate/docs/config.html
   {
     'key'         => 'username-uppercase',
     'section'     => 'username',
-    'description' => 'Allow uppercase characters in usernames',
+    'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
     'type'        => 'checkbox',
   },
 
index 2615a16..fec4949 100644 (file)
@@ -626,6 +626,8 @@ sub usage_sessions {
 sub update_svc_acct {
   my $self = shift;
 
+  my $conf = new FS::Conf;
+
   my $dbh = sqlradius_connect( map $self->option($_),
                                    qw( datasrc username password ) );
 
@@ -650,7 +652,10 @@ sub update_svc_acct {
          "$RadAcctId ($UserName\@$Realm for ${AcctSessionTime}s"
       if $DEBUG;
 
+    $UserName = lc($UserName) unless $conf->exists('username-uppercase');
+
     my %search = ( 'username' => $UserName );
+
     my $extra_sql = '';
     if ( ref($self) =~ /withdomain/ ) { #well...
       $extra_sql = " AND '$Realm' = ( SELECT domain FROM svc_domain