[dovecot-cvs] dovecot/src/master auth-process.c,1.22,1.23 settings.c,1.40,1.41 settings.h,1.21,1.22

cras at procontrol.fi cras at procontrol.fi
Sun Jan 5 17:19:52 EET 2003


Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv2361/src/master

Modified Files:
	auth-process.c settings.c settings.h 
Log Message:
Initial support for Cyrus SASL 2 library. I couldn't get it to work yet
though :)



Index: auth-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- auth-process.c	5 Jan 2003 13:09:53 -0000	1.22
+++ auth-process.c	5 Jan 2003 15:19:50 -0000	1.23
@@ -254,11 +254,13 @@
 
 	/* set other environment */
 	env_put(t_strconcat("AUTH_PROCESS=", dec2str(getpid()), NULL));
-	env_put(t_strconcat("METHODS=", config->methods, NULL));
+	env_put(t_strconcat("MECHANISMS=", config->mechanisms, NULL));
 	env_put(t_strconcat("REALMS=", config->realms, NULL));
 	env_put(t_strconcat("USERINFO=", config->userinfo, NULL));
-	env_put(t_strconcat("USERINFO_ARGS=", config->userinfo_args,
-				    NULL));
+	env_put(t_strconcat("USERINFO_ARGS=", config->userinfo_args, NULL));
+
+	if (config->use_cyrus_sasl)
+		env_put("USE_CYRUS_SASL=1");
 
 	restrict_process_size(config->process_size);
 

Index: settings.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/settings.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- settings.c	5 Jan 2003 13:09:53 -0000	1.40
+++ settings.c	5 Jan 2003 15:19:50 -0000	1.41
@@ -170,6 +170,18 @@
 	set_login_gid = pw->pw_gid;
 }
 
+static const char *get_bool(const char *value, int *result)
+{
+	if (strcasecmp(value, "yes") == 0)
+		*result = TRUE;
+	else if (strcasecmp(value, "no") == 0)
+		*result = FALSE;
+	else
+		return t_strconcat("Invalid boolean: ", value, NULL);
+
+	return NULL;
+}
+
 static void auth_settings_verify(void)
 {
 	struct auth_config *auth;
@@ -328,7 +340,7 @@
 static void auth_config_free(struct auth_config *auth)
 {
 	i_free(auth->name);
-	i_free(auth->methods);
+	i_free(auth->mechanisms);
 	i_free(auth->realms);
 	i_free(auth->userinfo);
 	i_free(auth->userinfo_args);
@@ -366,8 +378,10 @@
 		return "Authentication process name not defined yet";
 
 	/* check the easy string values first */
-	if (strcmp(key, "auth_methods") == 0)
-		ptr = &auth->methods;
+	if (strcmp(key, "auth_mechanisms") == 0)
+		ptr = &auth->mechanisms;
+	else if (strcmp(key, "auth_methods") == 0) /* backwards compatibility */
+		ptr = &auth->mechanisms;
 	else if (strcmp(key, "auth_realms") == 0)
 		ptr = &auth->realms;
 	else if (strcmp(key, "auth_executable") == 0)
@@ -400,6 +414,9 @@
 		return NULL;
 	}
 
+	if (strcmp(key, "auth_cyrus_sasl") == 0)
+		return get_bool(value, &auth->use_cyrus_sasl);
+
 	if (strcmp(key, "auth_count") == 0) {
 		int num;
 
@@ -445,14 +462,7 @@
 							   value, NULL);
 				break;
 			case SET_BOOL:
-				if (strcasecmp(value, "yes") == 0)
-					*((int *) set->ptr) = TRUE;
-				else if (strcasecmp(value, "no") == 0)
-					*((int *) set->ptr) = FALSE;
-				else
-					return t_strconcat("Invalid boolean: ",
-							   value, NULL);
-				break;
+				return get_bool(value, set->ptr);
 			}
 			return NULL;
 		}

Index: settings.h
===================================================================
RCS file: /home/cvs/dovecot/src/master/settings.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- settings.h	5 Jan 2003 13:09:53 -0000	1.21
+++ settings.h	5 Jan 2003 15:19:50 -0000	1.22
@@ -64,12 +64,14 @@
 	struct auth_config *next;
 
 	char *name;
-	char *methods;
+	char *mechanisms;
 	char *realms;
 	char *userinfo, *userinfo_args;
 	char *executable;
 	char *user;
 	char *chroot;
+
+	int use_cyrus_sasl;
 
 	unsigned int count;
 	unsigned int process_size;




More information about the dovecot-cvs mailing list