Message ID | 1464752905-10347-5-git-send-email-vapier@gentoo.org |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Hi, Mike Frysinger wrote: > Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking > the set*id calls, but would call syslog() before it had called openlog(). > Move the call up earlier to fix that. Please describe what it really fixes.
On 02 Jun 2016 11:10, YOSHIFUJI Hideaki wrote: > Mike Frysinger wrote: > > Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking > > the set*id calls, but would call syslog() before it had called openlog(). > > Move the call up earlier to fix that. > > Please describe what it really fixes. i already did: you need to call openlog before calling syslog, but the code here very clearly doesn't. if you read the commit i referenced, and the all <25 lines of context here, it should be pretty obvious the code is wrong. -mike
Hi, Mike Frysinger wrote: > On 02 Jun 2016 11:10, YOSHIFUJI Hideaki wrote: >> Mike Frysinger wrote: >>> Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking >>> the set*id calls, but would call syslog() before it had called openlog(). >>> Move the call up earlier to fix that. >> >> Please describe what it really fixes. > > i already did: you need to call openlog before calling syslog, but the > code here very clearly doesn't. if you read the commit i referenced, > and the all <25 lines of context here, it should be pretty obvious the > code is wrong. > -mike > OK, applied. Thank you.
diff --git a/tftpd.c b/tftpd.c index e3af2f4..7ddc8eb 100644 --- a/tftpd.c +++ b/tftpd.c @@ -109,6 +109,8 @@ int main(int ac, char **av) register int n = 0; int on = 1; + openlog("tftpd", LOG_PID, LOG_DAEMON); + /* Sanity. If parent forgot to setuid() on us. */ if (geteuid() == 0) { if (setgid(65534)) { @@ -125,7 +127,6 @@ int main(int ac, char **av) while (ac-- > 0 && n < MAXARG) dirs[n++] = *av++; - openlog("tftpd", LOG_PID, LOG_DAEMON); if (ioctl(0, FIONBIO, &on) < 0) { syslog(LOG_ERR, "ioctl(FIONBIO): %m\n"); exit(1);
Commit d81a44625b04d487c895473aa77af13420b7afdd added support for checking the set*id calls, but would call syslog() before it had called openlog(). Move the call up earlier to fix that. Signed-off-by: Mike Frysinger <vapier@gentoo.org> --- tftpd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)