This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master
in repository 389-ds-base.
commit 63a0a59c9b09af08151831209ee6711b4363aee2
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Thu Oct 19 12:20:48 2017 -0400
Ticket 49374 - server fails to start because maxdisksize is recognized incorrectly
Bug Description: When directly editting dse.ldif, the server had a check
when setting the log maxdiskspace vs maxlogsize. If the
maxlogsize is processed first and it is higher than the
default maxdisksspace then it throw an error and the server
fails to start.
If you attempt this same operation using ldapmodify it
works as "live" updates check all the mods first, so the
order of the attributes does not matter.
Fix description: Remove the size checks from the attribute set function.
It is technically redundant since it is correctly checked
by the configdse code.
https://pagure.io/389-ds-base/issue/49374
Reviewed by: tbordaz(Thanks!)
---
ldap/servers/slapd/log.c | 60 ++++++++++++------------------------------------
1 file changed, 15 insertions(+), 45 deletions(-)
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index e16d89c..998efae 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -960,7 +960,6 @@ int
log_set_logsize(const char *attrname, char *logsize_str, int logtype, char *returntext,
int apply)
{
int rv = LDAP_SUCCESS;
- PRInt64 mdiskspace = 0; /* in bytes */
PRInt64 max_logsize; /* in bytes */
int logsize; /* in megabytes */
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
@@ -979,72 +978,43 @@ log_set_logsize(const char *attrname, char *logsize_str, int
logtype, char *retu
switch (logtype) {
case SLAPD_ACCESS_LOG:
- LOG_ACCESS_LOCK_WRITE();
- mdiskspace = loginfo.log_access_maxdiskspace;
- break;
- case SLAPD_ERROR_LOG:
- LOG_ERROR_LOCK_WRITE();
- mdiskspace = loginfo.log_error_maxdiskspace;
- break;
- case SLAPD_AUDIT_LOG:
- LOG_AUDIT_LOCK_WRITE();
- mdiskspace = loginfo.log_audit_maxdiskspace;
- break;
- case SLAPD_AUDITFAIL_LOG:
- LOG_AUDITFAIL_LOCK_WRITE();
- mdiskspace = loginfo.log_auditfail_maxdiskspace;
- break;
- default:
- PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid logtype %d", attrname, logtype);
- rv = LDAP_OPERATIONS_ERROR;
- }
-
- if ((max_logsize > mdiskspace) && (mdiskspace != -1)) {
- rv = 2;
- }
-
- switch (logtype) {
- case SLAPD_ACCESS_LOG:
- if (!rv && apply) {
+ if (apply) {
+ LOG_ACCESS_LOCK_WRITE();
loginfo.log_access_maxlogsize = max_logsize;
fe_cfg->accesslog_maxlogsize = logsize;
+ LOG_ACCESS_UNLOCK_WRITE();
}
- LOG_ACCESS_UNLOCK_WRITE();
break;
case SLAPD_ERROR_LOG:
- if (!rv && apply) {
+ if (apply) {
+ LOG_ERROR_LOCK_WRITE();
loginfo.log_error_maxlogsize = max_logsize;
fe_cfg->errorlog_maxlogsize = logsize;
+ LOG_ERROR_UNLOCK_WRITE();
}
- LOG_ERROR_UNLOCK_WRITE();
break;
case SLAPD_AUDIT_LOG:
- if (!rv && apply) {
+ if (apply) {
+ LOG_AUDIT_LOCK_WRITE();
loginfo.log_audit_maxlogsize = max_logsize;
fe_cfg->auditlog_maxlogsize = logsize;
+ LOG_AUDIT_UNLOCK_WRITE();
}
- LOG_AUDIT_UNLOCK_WRITE();
break;
case SLAPD_AUDITFAIL_LOG:
- if (!rv && apply) {
+ if (apply) {
+ LOG_AUDITFAIL_LOCK_WRITE();
loginfo.log_auditfail_maxlogsize = max_logsize;
fe_cfg->auditfaillog_maxlogsize = logsize;
+ LOG_AUDITFAIL_UNLOCK_WRITE();
}
- LOG_AUDITFAIL_UNLOCK_WRITE();
break;
default:
- rv = 1;
- }
- /* logsize is in MB */
- if (rv == 2) {
- slapi_log_err(SLAPI_LOG_ERR, "log_set_logsize",
- "Invalid value for Maximum log size:"
- "Maxlogsize:%d (MB) exceeds Maxdisksize:%ld (MB)\n",
- logsize, (long int)(mdiskspace / LOG_MB_IN_BYTES));
-
+ PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: invalid logtype %d", attrname, logtype);
rv = LDAP_OPERATIONS_ERROR;
}
+
return rv;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.