changeset 6936:aacc69cc267b HEAD

Allocate auth_realms from auth pool instead of from data stack.
author Timo Sirainen <tss@iki.fi>
date Wed, 05 Dec 2007 17:22:21 +0200
parents 38fd7447172d
children 94e94e3b5b30
files src/auth/auth.c src/auth/auth.h src/auth/mech-digest-md5.c src/auth/mech-rpa.c
diffstat 4 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth.c	Wed Dec 05 17:19:57 2007 +0200
+++ b/src/auth/auth.c	Wed Dec 05 17:22:21 2007 +0200
@@ -239,13 +239,10 @@
 		i_fatal("No authentication mechanisms configured");
 	auth_mech_list_verify_passdb(auth);
 
-	/* get our realm - note that we allocate from data stack so
-	   this function should never be called inside I/O loop or anywhere
-	   else where t_pop() is called */
 	env = getenv("REALMS");
 	if (env == NULL)
 		env = "";
-	auth->auth_realms = t_strsplit_spaces(env, " ");
+	auth->auth_realms = p_strsplit_spaces(auth->pool, env, " ");
 
 	env = getenv("DEFAULT_REALM");
 	if (env != NULL && *env != '\0')
--- a/src/auth/auth.h	Wed Dec 05 17:19:57 2007 +0200
+++ b/src/auth/auth.h	Wed Dec 05 17:22:21 2007 +0200
@@ -37,7 +37,7 @@
 	struct auth_passdb *passdbs;
 	struct auth_userdb *userdbs;
 
-	const char *const *auth_realms;
+	char *const *auth_realms;
 	const char *default_realm;
 	const char *anonymous_username;
 	const char *username_format;
--- a/src/auth/mech-digest-md5.c	Wed Dec 05 17:19:57 2007 +0200
+++ b/src/auth/mech-digest-md5.c	Wed Dec 05 17:22:21 2007 +0200
@@ -60,7 +60,7 @@
 	struct auth *auth = request->auth_request.auth;
 	buffer_t *buf;
 	string_t *str;
-	const char *const *tmp;
+	char *const *tmp;
 	unsigned char nonce[16];
 	int i;
 	bool first_qop;
@@ -223,7 +223,7 @@
 
 static bool verify_realm(struct digest_auth_request *request, const char *realm)
 {
-	const char *const *tmp;
+	char *const *tmp;
 
 	if (*realm == '\0')
 		return TRUE;
--- a/src/auth/mech-rpa.c	Wed Dec 05 17:19:57 2007 +0200
+++ b/src/auth/mech-rpa.c	Wed Dec 05 17:22:21 2007 +0200
@@ -239,7 +239,7 @@
 rpa_verify_realm(struct rpa_auth_request *request, const char *realm)
 {
 	const char *default_realm;
-	const char *const *tmp;
+	char *const *tmp;
 
 	tmp = request->auth_request.auth->auth_realms;
 	for (; *tmp != NULL; tmp++) {
@@ -353,7 +353,7 @@
 	string_t *realms;
 	buffer_t *buf;
 	unsigned char timestamp[RPA_TIMESTAMP_LEN / 2];
-	const char *const *tmp;
+	char *const *tmp;
 
 	realms = t_str_new(64);
 	for (tmp = auth->auth_realms; *tmp != NULL; tmp++) {