Bug 116811 - login usernames are not case sensitive but prefs files are
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 17 Oct 2000 18:15:35 +0000 (18:15 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 17 Oct 2000 18:15:35 +0000 (18:15 +0000)
Added option to convert usernames transparently to lowercase, defaulted it
to off.  Username is converted before preferences are loaded/set and before
hooks are called.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@802 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl
config/config_default.php
src/webmail.php

index 805a497693f720ea51e9b171c4b7a47212ee4957..b118f71e4e41512ef92a8a5a453726a950e4cddf 100755 (executable)
@@ -4,7 +4,7 @@
 #
 # A simple configure script to configure squirrelmail
 ############################################################              
 #
 # A simple configure script to configure squirrelmail
 ############################################################              
-$conf_pl_version = "x61";
+$conf_pl_version = "x62";
 
 ############################################################              
 # First, lets read in the data already in there...
 
 ############################################################              
 # First, lets read in the data already in there...
@@ -304,10 +304,11 @@ while (($command ne "q") && ($command ne "Q")) {
       print "R   Return to Main Menu\n";
    } elsif ($menu == 4) {
       print $WHT."General Options\n".$NRM;
       print "R   Return to Main Menu\n";
    } elsif ($menu == 4) {
       print $WHT."General Options\n".$NRM;
-      print "1.  Default Charset      : $WHT$default_charset$NRM\n";
-      print "2.  Data Directory       : $WHT$data_dir$NRM\n";
-      print "3.  Attachment Directory : $WHT$attachment_dir$NRM\n";
-      print "4.  Default Left Size    : $WHT$default_left_size$NRM\n";
+      print "1.  Default Charset        : $WHT$default_charset$NRM\n";
+      print "2.  Data Directory         : $WHT$data_dir$NRM\n";
+      print "3.  Attachment Directory   : $WHT$attachment_dir$NRM\n";
+      print "4.  Default Left Size      : $WHT$default_left_size$NRM\n";
+      print "5.  Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n";
       print "\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 5) {
       print "\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 5) {
@@ -451,10 +452,11 @@ while (($command ne "q") && ($command ne "Q")) {
          elsif ($command == 12){ $default_unseen_notify          = command212(); }
          elsif ($command == 13){ $default_unseen_type            = command213(); }
       } elsif ($menu == 4) {
          elsif ($command == 12){ $default_unseen_notify          = command212(); }
          elsif ($command == 13){ $default_unseen_type            = command213(); }
       } elsif ($menu == 4) {
-         if    ($command == 1) { $default_charset    = command31 (); }
-         elsif ($command == 2) { $data_dir           = command33 (); }
-         elsif ($command == 3) { $attachment_dir     = command34 (); }
-         elsif ($command == 4) { $default_left_size  = command35 (); }
+         if    ($command == 1) { $default_charset          = command31 (); }
+         elsif ($command == 2) { $data_dir                 = command33 (); }
+         elsif ($command == 3) { $attachment_dir           = command34 (); }
+         elsif ($command == 4) { $default_left_size        = command35 (); }
+        elsif ($command == 5) { $force_username_lowercase = command36 (); }
       } elsif ($menu == 5) {
          if    ($command == 1) { command41 (); }
          elsif ($command == 2) { $theme_css = command42 (); }
       } elsif ($menu == 5) {
          if    ($command == 1) { command41 (); }
          elsif ($command == 2) { $theme_css = command42 (); }
@@ -1136,6 +1138,27 @@ sub command35 {
 }
 
 
 }
 
 
+sub command36 {
+   print "Some IMAP servers only have lowercase letters in the usernames\n";
+   print "but they still allow people with uppercase to log in.  This\n";
+   print "causes a problem with the user's preference files.  This option\n";
+   print "transparently changes all usernames to lowercase.";
+   print "\n";
+   
+   if ($force_username_lowercase eq "true") {
+      $default_value = "y";
+   } else {
+      $default_value = "n";
+   }
+   print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT";
+   $new_show = <STDIN>;
+   if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
+      return "true";
+   }
+   return "false";
+}
+
+
 sub command41 {
    print "\nNow we will define the themes that you wish to use.  If you have added\n";
    print "a theme of your own, just follow the instructions (?) about how to add\n";
 sub command41 {
    print "\nNow we will define the themes that you wish to use.  If you have added\n";
    print "a theme of your own, just follow the instructions (?) about how to add\n";
@@ -1500,10 +1523,11 @@ sub save_data {
    print FILE "\t\$default_unseen_type              =  $default_unseen_type;\n";
    print FILE "\n";
 
    print FILE "\t\$default_unseen_type              =  $default_unseen_type;\n";
    print FILE "\n";
 
-   print FILE "\t\$default_charset   = \"$default_charset\";\n";
-   print FILE "\t\$data_dir          = \"$data_dir\";\n";
-   print FILE "\t\$attachment_dir    = \"$attachment_dir\";\n";
-   print FILE "\t\$default_left_size =  $default_left_size;\n";
+   print FILE "\t\$default_charset          = \"$default_charset\";\n";
+   print FILE "\t\$data_dir                 = \"$data_dir\";\n";
+   print FILE "\t\$attachment_dir           = \"$attachment_dir\";\n";
+   print FILE "\t\$default_left_size        =  $default_left_size;\n";
+   print FILE "\t\$force_username_lowercase = $force_username_lowercase;\n";
 
    print FILE "\n";
 
 
    print FILE "\n";
 
index 116742c8fa0b0107e158cb73e10091a35f995d66..cce85fb35a9073d8b7fadab4b6df51288c7b77f6 100644 (file)
@@ -9,7 +9,7 @@
 //
 
     // don't change
 //
 
     // don't change
-    $config_version = "x61";
+    $config_version = "x62";
 
 //  Organization's logo picture (blank if none)
     $org_logo = "../images/sm_logo.jpg";
 
 //  Organization's logo picture (blank if none)
     $org_logo = "../images/sm_logo.jpg";
 
    $default_left_size = 200;
 
 
    $default_left_size = 200;
 
+//  Some IMAP servers allow a username (like "bob") to log in if they use
+//  uppercase in their name (like "Bob" or "BOB").  This creates extra
+//  preference files.  Toggling this option to true will transparently
+//  change all usernames to lowercase.
+
+   $force_username_lowercase = false;
+
+
 //  Themes
 //     You can define your own theme and put it in this directory.  You must
 //     call it as the example below.  You can name the theme whatever you
 //  Themes
 //     You can define your own theme and put it in this directory.  You must
 //     call it as the example below.  You can name the theme whatever you
index d0ad62b1ce3b408616e0fa2e4667949e708d28c2..66eb3af3a462623f7c599648d54b02db272fa7a4 100644 (file)
@@ -33,7 +33,6 @@
       setcookie("squirrelmail_language", $squirrelmail_language, time()+2592000);
    }
 
       setcookie("squirrelmail_language", $squirrelmail_language, time()+2592000);
    }
 
-
    include ("../config/config.php");
    include ("../functions/prefs.php");
    include ("../functions/imap.php");
    include ("../config/config.php");
    include ("../functions/prefs.php");
    include ("../functions/imap.php");
@@ -44,6 +43,9 @@
    if (!isset($strings_php))
       include ("../functions/strings.php");
 
    if (!isset($strings_php))
       include ("../functions/strings.php");
 
+   if ($force_username_lowercase)
+      $username = strtolower($username);
+
    if (!session_is_registered("user_is_logged_in") || $logged_in != 1) {
       do_hook ("login_before");
 
    if (!session_is_registered("user_is_logged_in") || $logged_in != 1) {
       do_hook ("login_before");