[dovecot-cvs] dovecot/src/master login-process.c,1.64,1.65

cras at dovecot.org cras at dovecot.org
Sat Sep 24 15:25:34 EEST 2005


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv3837/master

Modified Files:
	login-process.c 
Log Message:
Several fixes to make running from inetd working again



Index: login-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/login-process.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- login-process.c	14 May 2005 20:32:06 -0000	1.64
+++ login-process.c	24 Sep 2005 12:25:32 -0000	1.65
@@ -192,13 +192,13 @@
 		i_error("login: Server name wasn't sent");
 	else {
 		name = t_strndup(buf, len);
-		proto = strchr(buf, '/');
+		proto = strchr(name, '/');
 		if (proto == NULL) {
-			i_error("login: Missing protocol from server name '%s'",
-				name);
-			return FALSE;
+			proto = name;
+			name = "default";
+		} else {
+			name = t_strdup_until(name, proto++);
 		}
-		name = t_strdup_until(buf, proto++);
 
 		if (strcmp(proto, "imap") == 0)
 			protocol = MAIL_PROTOCOL_IMAP;
@@ -632,7 +632,7 @@
 {
 	extern char **environ;
 	char **env;
-	size_t len;
+	ssize_t len;
 	int ret = 0;
 
 	/* this will clear our environment. luckily we don't need it. */
@@ -641,13 +641,23 @@
 	for (env = environ; *env != NULL; env++) {
 		len = strlen(*env);
 
-		if (o_stream_send(p->output, *env, len) != (ssize_t)len ||
+		if (o_stream_send(p->output, *env, len) != len ||
 		    o_stream_send(p->output, "\n", 1) != 1) {
 			ret = -1;
 			break;
 		}
 	}
 
+	if (!p->group->set->login_chroot) {
+		/* if we're not chrooting, we need to tell login process
+		   where its base directory is */
+		const char *str = t_strdup_printf("LOGIN_DIR=%s\n",
+						  p->group->set->login_dir);
+		len = strlen(str);
+		if (o_stream_send(p->output, str, len) != len)
+			ret = -1;
+	}
+
 	if (ret == 0 && o_stream_send(p->output, "\n", 1) != 1)
 		ret = -1;
 



More information about the dovecot-cvs mailing list