This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch 389-ds-base-1.4.0
in repository 389-ds-base.
The following commit(s) were added to refs/heads/389-ds-base-1.4.0 by this push:
new 0f5d020 Issue 50536 - Audit log heading written to log after every update
0f5d020 is described below
commit 0f5d02090c7346ad84ec8c3852b2b4e35d528d32
Author: Mark Reynolds <mreynolds(a)redhat.com>
AuthorDate: Wed Aug 7 16:57:17 2019 -0400
Issue 50536 - Audit log heading written to log after every update
Bug Description: Once the audit log is rotated the log "title" is
incorrectly
written to the log after every single update. This happened
becuase when we udpated the state of the log it was applied
to a local variable, and not the log info structure itself.
Fix Description: After writting the "title", update the state of the log
using
a pointer to the log info structure.
relates:
https://pagure.io/389-ds-base/issue/50536
Reviewed by: lkrispenz(Thanks!)
---
ldap/servers/slapd/log.c | 14 +++++++-------
ldap/servers/slapd/proto-slap.h | 2 +-
src/cockpit/389-console/src/servers.html | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index 2456abf..f308a48 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2073,11 +2073,11 @@ slapd_log_audit(
int retval = LDAP_SUCCESS;
int lbackend = loginfo.log_backend; /* We copy this to make these next checks atomic
*/
- int state = 0;
+ int *state;
if (sourcelog == SLAPD_AUDIT_LOG) {
- state = loginfo.log_audit_state;
+ state = &loginfo.log_audit_state;
} else if (sourcelog == SLAPD_AUDITFAIL_LOG) {
- state = loginfo.log_auditfail_state;
+ state = &loginfo.log_auditfail_state;
} else {
/* How did we even get here! */
return 1;
@@ -2106,9 +2106,9 @@ int
slapd_log_audit_internal(
char *buffer,
int buf_len,
- int state)
+ int *state)
{
- if ((state & LOGGING_ENABLED) && (loginfo.log_audit_file != NULL)) {
+ if ((*state & LOGGING_ENABLED) && (loginfo.log_audit_file != NULL)) {
LOG_AUDIT_LOCK_WRITE();
if (log__needrotation(loginfo.log_audit_fdes,
SLAPD_AUDIT_LOG) == LOG_ROTATE) {
@@ -2122,9 +2122,9 @@ slapd_log_audit_internal(
loginfo.log_audit_rotationsyncclock +=
PR_ABS(loginfo.log_audit_rotationtime_secs);
}
}
- if (state & LOGGING_NEED_TITLE) {
+ if (*state & LOGGING_NEED_TITLE) {
log_write_title(loginfo.log_audit_fdes);
- state &= ~LOGGING_NEED_TITLE;
+ *state &= ~LOGGING_NEED_TITLE;
}
LOG_WRITE_NOW_NO_ERR(loginfo.log_audit_fdes, buffer, buf_len, 0);
LOG_AUDIT_UNLOCK_WRITE();
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index dce4243..932828d 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -787,7 +787,7 @@ int slapi_log_access(int level, char *fmt, ...)
;
#endif
int slapd_log_audit(char *buffer, int buf_len, int sourcelog);
-int slapd_log_audit_internal(char *buffer, int buf_len, int state);
+int slapd_log_audit_internal(char *buffer, int buf_len, int *state);
int slapd_log_auditfail(char *buffer, int buf_len);
int slapd_log_auditfail_internal(char *buffer, int buf_len);
void log_access_flush(void);
diff --git a/src/cockpit/389-console/src/servers.html
b/src/cockpit/389-console/src/servers.html
index 8f40883..820c29c 100644
--- a/src/cockpit/389-console/src/servers.html
+++ b/src/cockpit/389-console/src/servers.html
@@ -519,7 +519,7 @@
<label for="nsslapd-accesslog-logrotationtime"
class="ds-config-sub-label" title="Access log rotation time settings
(nsslapd-accesslog-logrotationtime).">Create New Log
Every...</label><input
class="ds-input" type="text"
id="nsslapd-accesslog-logrotationtime" size="40"/> <select
class="btn btn-default dropdown"
id="nsslapd-accesslog-logrotationtimeunit">
<option>minute</option>
- <option>hours</option>
+ <option>hour</option>
<option>day</option>
<option>week</option>
<option>month</option>
@@ -608,7 +608,7 @@
<label for="nsslapd-auditlog-logrotationtime"
class="ds-config-sub-label" title="Audit log rotation time settings
(nsslapd-auditlog-logrotationtime).">Create New Log
Every...</label><input
class="ds-input" type="text"
id="nsslapd-auditlog-logrotationtime" size="40"/> <select
class="btn btn-default dropdown"
id="nsslapd-auditlog-logrotationtimeunit">
<option>minute</option>
- <option>hours</option>
+ <option>hour</option>
<option>day</option>
<option>week</option>
<option>month</option>
@@ -667,7 +667,7 @@
<label for="nsslapd-auditfaillog-logrotationtime"
class="ds-config-sub-label" title="Audit failure log rotation time settings
(nsslapd-auditlog-logrotationtime).">Create New Log
Every...</label><input
class="ds-input" type="text"
id="nsslapd-auditfaillog-logrotationtime" size="40"/> <select
class="btn btn-default dropdown"
id="nsslapd-auditfaillog-logrotationtimeunit">
<option>minute</option>
- <option>hours</option>
+ <option>hour</option>
<option>day</option>
<option>week</option>
<option>month</option>
@@ -724,7 +724,7 @@
<label for="nsslapd-errorlog-logrotationtime"
class="ds-config-sub-label" title="Errors log rotation time settings
(nsslapd-errorlog-logrotationtime).">Create New Log
Every...</label><input
class="ds-input" type="text"
id="nsslapd-errorlog-logrotationtime" size="40"/> <select
class="btn btn-default dropdown"
id="nsslapd-errorlog-logrotationtimeunit">
<option>minute</option>
- <option>hours</option>
+ <option>hour</option>
<option>day</option>
<option>week</option>
<option>month</option>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.