]> andersk Git - moira.git/commitdiff
Don't try to do a get_user_account_by_login with a username longer than 8
authortytso <tytso>
Tue, 9 Aug 1994 19:13:41 +0000 (19:13 +0000)
committertytso <tytso>
Tue, 9 Aug 1994 19:13:41 +0000 (19:13 +0000)
characters.  This triggers a moira bug.

index() -> strchr().

clients/moira/user.c

index c27c64358082b1af0e54ed62c9b9ff502eb6e76f..ff24c17664e6d80036e035d92ccee6143a93180e 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include <stdio.h>
-#include <strings.h>
+#include <string.h>
 #include <moira.h>
 #include <moira_site.h>
 #include <menu.h>
@@ -368,6 +368,14 @@ Bool name;
  *                 name2 - other name, only used in get user by first and last.
  *                         (wildcards okay).
  *     Returns: the first element of the queue containing the user info.
+ *
+ * Note: if we are checking a login name, if the length is greater
+ * than 8 characters, we immediately print a "no such user" error.
+ * This gets around a bug in Ingres, where a non-existent 8 character
+ * username returns a "no such user" error instantaneously, but a 9
+ * character username takes 5-6 minutes.  :-(  We will need to change
+ * this if we ever make a username longer than 8 characters.
+ * Unlikely, but....
  */
 
 struct qelem *
@@ -381,6 +389,11 @@ char *name1, *name2;
 
     switch(type) {
     case LOGIN:
+       if (strlen(name1) > 8) {
+           com_err(program_name, MR_USER,
+                   " when attempting to get_user_acount_by_login.");
+           return (NULL);
+        }
        args[0] = name1;
        if ( (status = do_mr_query("get_user_account_by_login", 1, args,
                                    StoreInfo, (char *) &elem)) != 0) {
@@ -997,7 +1010,7 @@ char **argv;
 {
     int stat;
 
-    if (!index(argv[KMAP_PRINCIPAL + 1], '@')) {
+    if (!strchr(argv[KMAP_PRINCIPAL + 1], '@')) {
        Put_message("Please specify a realm for the kerberos principal.");
        return(DM_NORMAL);
     }
This page took 0.040526 seconds and 5 git commands to generate.