From dcfa270ac1d2f55eb793c4da4bbd555903a88b09 Mon Sep 17 00:00:00 2001 From: tytso Date: Tue, 9 Aug 1994 19:13:41 +0000 Subject: [PATCH] Don't try to do a get_user_account_by_login with a username longer than 8 characters. This triggers a moira bug. index() -> strchr(). --- clients/moira/user.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/clients/moira/user.c b/clients/moira/user.c index c27c6435..ff24c176 100644 --- a/clients/moira/user.c +++ b/clients/moira/user.c @@ -20,7 +20,7 @@ */ #include -#include +#include #include #include #include @@ -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); } -- 2.45.2