[Dovecot] login: Missing protocol from server name 'imap'
Magnus Holmgren
holmgren at lysator.liu.se
Sun Feb 20 00:28:03 EET 2005
Magnus Holmgren wrote:
> Peter Franck wrote:
>
>> I also tried the 0.99 and hacking login-process.c, with no success.
>> It seems to expect a slash delimited string like 'name/protocol' and
>> it just gets "imap" there, but I didn't figure out where this string
>> comes from or what it ought to be.
>>
> IIRTCC, the string comes from login-common/main.c:master_connect(),
> which is called from login-common/main.c:main(), where it's constructed
> by taking the filename component of the executable ("imap-login") and
> removing the part after the hyphen (yielding "imap"). Since the filename
> component can't contain a slash, this looks like a slight oversight when
> changing the the configuration format.
>
> You can use the --group= parameter to give imap-login what the master
> process wants ("default/imap", I guess).
>
Attaching suggested patch. With it, the default server name ("default")
is assumed by the master process if the string sent by the login process
doesn't contain any slash. If you have multiple server blocks in your
configuration (undocumented feature as of yet, it appears!), you still
need to add --group=<server>/<protocol> to the parameters of
imap-login/pop3-login in your inetd/xinetd configuration.
(You could for example have different configurations for different
interfaces, if I understand it correctly.)
Two comments on the patch: The first change is because I suspect buf
isn't null-terminated. The last deletion (of "name = ...") is because I
believe that line to be superfluous.
--
Magnus Holmgren
holmgren at lysator.liu.se
-------------- next part --------------
--- src/master/login-process.c.orig 2005-02-19 22:24:16.000000000 +0100
+++ src/master/login-process.c 2005-02-19 22:56:00.000000000 +0100
@@ -192,13 +192,14 @@
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";
}
- name = t_strdup_until(buf, proto++);
+ else {
+ *proto++ = '\0';
+ }
if (strcmp(proto, "imap") == 0)
protocol = MAIL_PROTOCOL_IMAP;
More information about the dovecot
mailing list