about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2014-09-03 16:03:28 +0200
committerAlexander Barton <alex@barton.de>2014-09-11 22:04:31 +0200
commitbf2eae3249cd7890c0189dfcf1a50b0e40e199b2 (patch)
tree71dbdb7a391f55411a6965ffead283cc1b67235e
parentffad2da835e26a1a457d4f4a16acf6797d4cc71e (diff)
downloadngircd-bf2eae3249cd7890c0189dfcf1a50b0e40e199b2.tar.gz
ngircd-bf2eae3249cd7890c0189dfcf1a50b0e40e199b2.zip
Allow longer usernames for authentication
-rw-r--r--src/ngircd/client.c10
-rw-r--r--src/ngircd/client.h5
-rw-r--r--src/ngircd/defines.h4
3 files changed, 8 insertions, 11 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 9795662e..07d448fd 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -427,7 +427,7 @@ Client_SetOrigUser(CLIENT UNUSED *Client, const char UNUSED *User)
 	assert(Client != NULL);
 	assert(User != NULL);
 
-#if defined(PAM) && defined(IDENTAUTH)
+#if defined(PAM)
 	strlcpy(Client->orig_user, User, sizeof(Client->orig_user));
 #endif
 } /* Client_SetOrigUser */
@@ -731,15 +731,7 @@ Client_User( CLIENT *Client )
  */
 GLOBAL char *
 Client_OrigUser(CLIENT *Client) {
-#ifndef IDENTAUTH
-	char *user = Client->user;
-
-	if (user[0] == '~')
-		user++;
-	return user;
-#else
 	return Client->orig_user;
-#endif
 } /* Client_OrigUser */
 
 #endif
diff --git a/src/ngircd/client.h b/src/ngircd/client.h
index c6fcec07..4185d217 100644
--- a/src/ngircd/client.h
+++ b/src/ngircd/client.h
@@ -52,8 +52,9 @@ typedef struct _CLIENT
 	char *cloaked;			/* cloaked hostname of the client */
 	char *ipa_text;			/* textual representaton of IP address */
 	char user[CLIENT_USER_LEN];	/* user name ("login") */
-#if defined(PAM) && defined(IDENTAUTH)
-	char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */
+#if defined(PAM)
+	char orig_user[CLIENT_AUTHUSER_LEN];
+					/* original user name supplied by USER command */
 #endif
 	char info[CLIENT_INFO_LEN];	/* long user name (user) / info text (server) */
 	char modes[CLIENT_MODE_LEN];	/* client modes */
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index a140c9d1..456c4c93 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -109,6 +109,10 @@
 #else
 # define CLIENT_USER_LEN 10
 #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). */
 #define CLIENT_NAME_LEN 32