[PATCH] fix a crash bug by chown socket without group [1 Attachment]
Kouhei Sutou <kou@...
2013-03-22 14:23:57 GMT
<*>[Attachment(s) from Kouhei Sutou included below]
I attach a patch that fixes a crash.
The crash can reproduce with the following greylist.conf:
Run milter-greylist as root user:
% sudo milter-greylist
milter-greylist will be crashed.
* "socket" is not file path. (e.g. inet:XXX, unix:XXX and so on)
* "user" has only user. Group should not be included like
* Run milter-greylist as root user.
If we run milter-greylist as root user and "user"
parameter value is specified, "socket" parameter value
is chown-ed to "user" parameter value. If "socket"
parameter value is not path like "inet:30025", chown()
is always failed. And error message is logged by the
mg_log(LOG_WARNING, "%s: cannot change \"%s\""
" ownership to %s/%s: %s", argv,
conf.c_socket, pw->pw_name, gr->gr_name,
"gr->gr_name" is a problem. "gr" is NULL when "user"
parameter value doesn't have group such as "nobody".
(a) Don't chown() when "socket" parameter value has scheme
such as "inet", "inet6", "unix" and "local".
(b) Set "gr" even if "user" parameter value doesn't have
group. (The attached patch uses this solution.)
I think that we should apply both solutions but I attach
only (b) solution. Because (b) solves more effected
problem. "gr" is used other location too. (See
code around chown(conf.c_pidfile, ...).) (a) doesn't solve
So I think that (b) should be fixed at first. I will send a
patch for (a) after this patch is applied.
<*>Attachment(s) from Kouhei Sutou:
<*> 1 of 1 File(s)
Yahoo! Groups Links
<*> To visit your group on the web, go to:
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to: