Allow longer usernames for authentication

This commit is contained in:
Alexander Barton 2014-09-03 16:03:28 +02:00
parent ffad2da835
commit bf2eae3249
3 changed files with 8 additions and 11 deletions

View File

@ -427,7 +427,7 @@ Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User)
assert(Client != NULL); assert(Client != NULL);
assert(User != NULL); assert(User != NULL);
#if defined(PAM) && defined(IDENTAUTH) #if defined(PAM)
strlcpy(Client->orig_user, User, sizeof(Client->orig_user)); strlcpy(Client->orig_user, User, sizeof(Client->orig_user));
#endif #endif
} /* Client_SetOrigUser */ } /* Client_SetOrigUser */
@ -731,15 +731,7 @@ Client_User( CLIENT *Client )
*/ */
GLOBAL char * GLOBAL char *
Client_OrigUser(CLIENT *Client) { Client_OrigUser(CLIENT *Client) {
#ifndef IDENTAUTH
char *user = Client->user;
if (user[0] == '~')
user++;
return user;
#else
return Client->orig_user; return Client->orig_user;
#endif
} /* Client_OrigUser */ } /* Client_OrigUser */
#endif #endif

View File

@ -52,8 +52,9 @@ typedef struct _CLIENT
char *cloaked; /* cloaked hostname of the client */ char *cloaked; /* cloaked hostname of the client */
char *ipa_text; /* textual representaton of IP address */ char *ipa_text; /* textual representaton of IP address */
char user[CLIENT_USER_LEN]; /* user name ("login") */ char user[CLIENT_USER_LEN]; /* user name ("login") */
#if defined(PAM) && defined(IDENTAUTH) #if defined(PAM)
char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */ char orig_user[CLIENT_AUTHUSER_LEN];
/* original user name supplied by USER command */
#endif #endif
char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */
char modes[CLIENT_MODE_LEN]; /* client modes */ char modes[CLIENT_MODE_LEN]; /* client modes */

View File

@ -109,6 +109,10 @@
#else #else
# define CLIENT_USER_LEN 10 # define CLIENT_USER_LEN 10
#endif #endif
/** Max. length of user names saved for authentication (used by PAM) */
#ifdef PAM
# define CLIENT_AUTHUSER_LEN 64
#endif
/** Max. length of "real names" (including NULL). */ /** Max. length of "real names" (including NULL). */
#define CLIENT_NAME_LEN 32 #define CLIENT_NAME_LEN 32