Summary: logrotation time of -1 causes hang
https://bugzilla.redhat.com/show_bug.cgi?id=304161
Someone set nsslapd-auditlog-logrotationtime to -1, and when log rotation time
comes around we spin forever here in log.c:
while (loginfo.log_audit_rotationsyncclock <= loginfo.log_au
dit_ctime) {
loginfo.log_audit_rotationsyncclock += loginfo.log_audit
_rotationtime_secs;
}
(gdb) print loginfo.log_audit_rotationsyncclock
$7 = -1
(gdb) print loginfo.log_audit_ctime
$8 = 1190782632
(gdb) print loginfo.log_audit_rotationtime_secs
$9 = -86400
-1 is obviously not a valid configuration but if someone is bored they could add
some boundary checking there.
------- Additional Comments From nhosoi@redhat.com 2007-10-03 15:07 EST -------
Created an attachment (id=214931)
--> (https://bugzilla.redhat.com/attachment.cgi?id=214931&action=view)
cvs diff ldapserver/ldap/servers/slapd/log.c
Thank you, Ulf, for finding out an interesting bug!
It's not good to wait forever in the while loops...
Change description:
1. slapd_log_audit_proc, slapd_log_error_proc_internal, and log_flush_buffer:
use absolute value of rotationtime_secs to calculate the rotationsyncclock.
2. when the result of "atoi" for nsslapd-XXX-logrotationtime is 0 due to the
invalid setting, logrotation time is reset to -1 (no rotation).
3. if nsslapd-XXX-logrotationtime and nsslapd-XXX-logexpirationtime is large
(near MAXINT) and calculated rotationtime_secs and/or exptime_secs is
overflown, set MAXINT to the sec value.
Thanks,
--noriko