ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/libglobs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 5724e02c7f30ef1130764c79b30edd04954663a7
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 11 10:58:07 2013 -0600
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Fix build warning caused by previous commit.
https://fedorahosted.org/389/ticket/47427
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index c1f92ee..5219f8c 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1679,7 +1679,7 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
10 years, 9 months
Branch '389-ds-base-1.3.0' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/libglobs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit b95142f08de7e3b7f66a395640709b80e7735bfd
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jul 11 10:58:07 2013 -0600
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Fix build warning caused by previous commit.
https://fedorahosted.org/389/ticket/47427
(cherry picked from commit 5724e02c7f30ef1130764c79b30edd04954663a7)
(cherry picked from commit 1b7135cc79114a41be147d6bac7f4353207623f1)
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index f2b0ab8..f25c0ff 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1597,7 +1597,7 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
10 years, 9 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Ludwig Krispenz
ldap/servers/plugins/acl/acl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit d9448c07fbadfcb8f31b238687919786d8ee9f9b
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue Jul 9 16:11:12 2013 +0200
Ticket 47399 - RHDS denies MODRDN access if ACI list contains any DENY rule
Bug Description: if there is a deny rule targeting a specific attribute it also
denies the modrdn operation
Fix Description: only apply deny rules to modrdn if no target attr exists
https://fedorahosted.org/389/ticket/47339
Reviewed by: Rich, thanks
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 46add7f..764d15b 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2640,12 +2640,15 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
;
} else if (aci_right & SLAPI_ACL_WRITE &&
(aci->aci_type & ACI_TARGET_ATTR) &&
- !(c_attrEval)) {
+ !(c_attrEval) &&
+ (aci->aci_type & ACI_HAS_ALLOW_RULE)) {
/* We need to handle modrdn operation. Modrdn doesn't
** change any attrs but changes the RDN and so (attr=NULL).
** Here we found an acl which has a targetattr but
** the resource doesn't need one. In that case, we should
** consider this acl.
+ ** the opposite is true if it is a deny rule, only a deny without
+ ** any targetattr should deny modrdn
** default: matches = ACL_TRUE;
*/
;
10 years, 9 months
Branch '389-ds-base-1.3.0' - ldap/servers
by Ludwig Krispenz
ldap/servers/plugins/acl/acl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit a71ea8c2e6fa19e1c14587ac8100342d2bdd97dd
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue Jul 9 16:11:12 2013 +0200
Ticket 47399 - RHDS denies MODRDN access if ACI list contains any DENY rule
Bug Description: if there is a deny rule targeting a specific attribute it also
denies the modrdn operation
Fix Description: only apply deny rules to modrdn if no target attr exists
https://fedorahosted.org/389/ticket/47339
Reviewed by: Rich, thanks
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 61750fc..1ae925b 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2640,12 +2640,15 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
;
} else if (aci_right & SLAPI_ACL_WRITE &&
(aci->aci_type & ACI_TARGET_ATTR) &&
- !(c_attrEval)) {
+ !(c_attrEval) &&
+ (aci->aci_type & ACI_HAS_ALLOW_RULE)) {
/* We need to handle modrdn operation. Modrdn doesn't
** change any attrs but changes the RDN and so (attr=NULL).
** Here we found an acl which has a targetattr but
** the resource doesn't need one. In that case, we should
** consider this acl.
+ ** the opposite is true if it is a deny rule, only a deny without
+ ** any targetattr should deny modrdn
** default: matches = ACL_TRUE;
*/
;
10 years, 9 months
ldap/servers
by Ludwig Krispenz
ldap/servers/plugins/acl/acl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit fe0491c49fdb180f1bd291ba78148da7c58b5e90
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue Jul 9 16:11:12 2013 +0200
Ticket 47399 - RHDS denies MODRDN access if ACI list contains any DENY rule
Bug Description: if there is a deny rule targeting a specific attribute it also
denies the modrdn operation
Fix Description: only apply deny rules to modrdn if no target attr exists
https://fedorahosted.org/389/ticket/47339
Reviewed by: Rich, thanks
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index e001aea..08d8daa 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -2640,12 +2640,15 @@ acl__resource_match_aci( Acl_PBlock *aclpb, aci_t *aci, int skip_attrEval, int *
;
} else if (aci_right & SLAPI_ACL_WRITE &&
(aci->aci_type & ACI_TARGET_ATTR) &&
- !(c_attrEval)) {
+ !(c_attrEval) &&
+ (aci->aci_type & ACI_HAS_ALLOW_RULE)) {
/* We need to handle modrdn operation. Modrdn doesn't
** change any attrs but changes the RDN and so (attr=NULL).
** Here we found an acl which has a targetattr but
** the resource doesn't need one. In that case, we should
** consider this acl.
+ ** the opposite is true if it is a deny rule, only a deny without
+ ** any targetattr should deny modrdn
** default: matches = ACL_TRUE;
*/
;
10 years, 9 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/daemon.c | 48 ++++++++++++++++++++--------------------
ldap/servers/slapd/libglobs.c | 12 +++++-----
ldap/servers/slapd/proto-slap.h | 2 -
ldap/servers/slapd/slap.h | 2 -
4 files changed, 33 insertions(+), 31 deletions(-)
New commits:
commit 8b95375701e6258a8a140c6e8078d2eb83159170
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Jul 10 15:41:47 2013 -0400
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Changed the data type to PRUint64 from int, and improved the config
validation, and logging.
https://fedorahosted.org/389/ticket/47427
Reviewed by: richm & nhosoi(Thanks!!)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index a392398..6d8a7af 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -639,16 +639,16 @@ disk_mon_get_dirs(char ***list, int logs_critical){
* directory.
*/
char *
-disk_mon_check_diskspace(char **dirs, PRInt64 threshold, PRInt64 *disk_space)
+disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
{
#ifdef LINUX
struct statfs buf;
#else
struct statvfs buf;
#endif
- PRInt64 worst_disk_space = threshold;
- PRInt64 freeBytes = 0;
- PRInt64 blockSize = 0;
+ PRUint64 worst_disk_space = threshold;
+ PRUint64 freeBytes = 0;
+ PRUint64 blockSize = 0;
char *worst_dir = NULL;
int hit_threshold = 0;
int i = 0;
@@ -705,10 +705,10 @@ disk_monitoring_thread(void *nothing)
char errorbuf[BUFSIZ];
char **dirs = NULL;
char *dirstr = NULL;
- PRInt64 previous_mark = 0;
- PRInt64 disk_space = 0;
- PRInt64 threshold = 0;
- PRInt64 halfway = 0;
+ PRUint64 previous_mark = 0;
+ PRUint64 disk_space = 0;
+ PRUint64 threshold = 0;
+ PRUint64 halfway = 0;
time_t start = 0;
time_t now = 0;
int deleted_rotated_logs = 0;
@@ -790,7 +790,7 @@ disk_monitoring_thread(void *nothing)
* Check if we are already critical
*/
if(disk_space < 4096){ /* 4 k */
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb. "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb. "
"Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
return;
@@ -800,7 +800,7 @@ disk_monitoring_thread(void *nothing)
* if logging is not critical
*/
if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %d Kb, "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
"temporarily setting error loglevel to zero.\n", dirstr,
(disk_space / 1024), 0);
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
@@ -812,11 +812,11 @@ disk_monitoring_thread(void *nothing)
* access/audit logs, log another error, and continue.
*/
if(!logs_disabled && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
- config_set_accesslog_enabled(LOGGING_OFF);
- config_set_auditlog_enabled(LOGGING_OFF);
- logs_disabled = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
+ config_set_accesslog_enabled(LOGGING_OFF);
+ config_set_auditlog_enabled(LOGGING_OFF);
+ logs_disabled = 1;
continue;
}
/*
@@ -824,17 +824,17 @@ disk_monitoring_thread(void *nothing)
* access/audit logging, then delete the rotated logs, log another error, and continue.
*/
if(!deleted_rotated_logs && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
- log__delete_rotated_logs();
- deleted_rotated_logs = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
+ log__delete_rotated_logs();
+ deleted_rotated_logs = 1;
continue;
}
/*
* Ok, we've done what we can, log a message if we continue to lose available disk space
*/
if(disk_space < previous_mark){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
dirstr, (disk_space / 1024), 0);
}
/*
@@ -846,7 +846,7 @@ disk_monitoring_thread(void *nothing)
*
*/
if(disk_space < halfway){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%d bytes). "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes). "
"Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
dirstr, threshold, (grace_period / 60));
time(&start);
@@ -868,7 +868,7 @@ disk_monitoring_thread(void *nothing)
/*
* Excellent, we are back to acceptable levels, reset everything...
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%d bytes). Aborting"
+ LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%" NSPRIu64 " bytes). Aborting"
" shutdown, and restoring the log settings.\n",disk_space,0,0);
if(logs_disabled && using_accesslog){
config_set_accesslog_enabled(LOGGING_ON);
@@ -888,7 +888,7 @@ disk_monitoring_thread(void *nothing)
/*
* Disk space is critical, log an error, and shut it down now!
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb."
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
" Signaling slapd for shutdown...\n", dirstr, (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
return;
@@ -905,7 +905,7 @@ disk_monitoring_thread(void *nothing)
/*
* If disk space was freed up we would of detected in the above while loop. So shut it down.
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%d Kb). Signaling slapd for shutdown...\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%" NSPRIu64 " Kb). Signaling slapd for shutdown...\n",
(disk_space / 1024), 0, 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index dab5275..e3f3b93 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1240,17 +1240,19 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
int retVal = LDAP_SUCCESS;
- long threshold = 0;
+ PRUint64 threshold = 0;
char *endp = NULL;
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
- threshold = strtol(value, &endp, 10);
+ errno = 0;
+ threshold = strtoll(value, &endp, 10);
- if ( *endp != '\0' || threshold < 2048 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 2048 and less then %ld",
+ if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
@@ -3797,7 +3799,7 @@ config_get_disk_grace_period(){
return retVal;
}
-long
+PRUint64
config_get_disk_threshold(){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
long retVal;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index fec7ee5..a5d4d3f 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -544,7 +544,7 @@ void config_set_accesslog_enabled(int value);
void config_set_auditlog_enabled(int value);
int config_get_accesslog_logging_enabled();
int config_get_disk_monitoring();
-long config_get_disk_threshold();
+PRUint64 config_get_disk_threshold();
int config_get_disk_grace_period();
int config_get_disk_logging_critical();
int config_get_sasl_maxbufsize();
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index f1dbbec..eaa1fee 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2247,7 +2247,7 @@ typedef struct _slapdFrontendConfig {
/* disk monitoring */
int disk_monitoring;
- int disk_threshold;
+ PRUint64 disk_threshold;
int disk_grace_period;
int disk_logging_critical;
} slapdFrontendConfig_t;
10 years, 9 months
Branch '389-ds-base-1.3.0' - 2 commits - ldap/servers
by Mark Reynolds
ldap/servers/slapd/daemon.c | 48 ++++++++++++++++++++--------------------
ldap/servers/slapd/libglobs.c | 12 +++++-----
ldap/servers/slapd/proto-slap.h | 2 -
ldap/servers/slapd/slap.h | 2 -
4 files changed, 33 insertions(+), 31 deletions(-)
New commits:
commit 3f7ca8b349719b0e6eb06071c4ede3e6271ae6dc
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Jul 10 15:57:36 2013 -0400
Ticket 47427 - Fix error in slap.h from cherry-pick
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 3a83c8b..5d2ae10 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2278,7 +2278,7 @@ typedef struct _slapdFrontendConfig {
int sasl_max_bufsize; /* The max receive buffer size for SASL */
/* disk monitoring */
- slapi_onoff_t disk_monitoring;
+ int disk_monitoring;
PRUint64 disk_threshold;
int disk_grace_period;
int disk_logging_critical;
commit e1eb377a2792a40f8d9b9933daa2d475d8544065
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Jul 10 15:41:47 2013 -0400
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Changed the data type to PRUint64 from int, and improved the config
validation, and logging.
https://fedorahosted.org/389/ticket/47427
Reviewed by: richm & nhosoi(Thanks!!)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 3cce290..dec830d 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -641,16 +641,16 @@ disk_mon_get_dirs(char ***list, int logs_critical){
* directory.
*/
char *
-disk_mon_check_diskspace(char **dirs, PRInt64 threshold, PRInt64 *disk_space)
+disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
{
#ifdef LINUX
struct statfs buf;
#else
struct statvfs buf;
#endif
- PRInt64 worst_disk_space = threshold;
- PRInt64 freeBytes = 0;
- PRInt64 blockSize = 0;
+ PRUint64 worst_disk_space = threshold;
+ PRUint64 freeBytes = 0;
+ PRUint64 blockSize = 0;
char *worst_dir = NULL;
int hit_threshold = 0;
int i = 0;
@@ -707,10 +707,10 @@ disk_monitoring_thread(void *nothing)
char errorbuf[BUFSIZ];
char **dirs = NULL;
char *dirstr = NULL;
- PRInt64 previous_mark = 0;
- PRInt64 disk_space = 0;
- PRInt64 threshold = 0;
- PRInt64 halfway = 0;
+ PRUint64 previous_mark = 0;
+ PRUint64 disk_space = 0;
+ PRUint64 threshold = 0;
+ PRUint64 halfway = 0;
time_t start = 0;
time_t now = 0;
int deleted_rotated_logs = 0;
@@ -792,7 +792,7 @@ disk_monitoring_thread(void *nothing)
* Check if we are already critical
*/
if(disk_space < 4096){ /* 4 k */
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb. "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb. "
"Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
return;
@@ -802,7 +802,7 @@ disk_monitoring_thread(void *nothing)
* if logging is not critical
*/
if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %d Kb, "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
"temporarily setting error loglevel to zero.\n", dirstr,
(disk_space / 1024), 0);
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
@@ -814,11 +814,11 @@ disk_monitoring_thread(void *nothing)
* access/audit logs, log another error, and continue.
*/
if(!logs_disabled && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
- config_set_accesslog_enabled(LOGGING_OFF);
- config_set_auditlog_enabled(LOGGING_OFF);
- logs_disabled = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
+ config_set_accesslog_enabled(LOGGING_OFF);
+ config_set_auditlog_enabled(LOGGING_OFF);
+ logs_disabled = 1;
continue;
}
/*
@@ -826,17 +826,17 @@ disk_monitoring_thread(void *nothing)
* access/audit logging, then delete the rotated logs, log another error, and continue.
*/
if(!deleted_rotated_logs && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
- log__delete_rotated_logs();
- deleted_rotated_logs = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
+ log__delete_rotated_logs();
+ deleted_rotated_logs = 1;
continue;
}
/*
* Ok, we've done what we can, log a message if we continue to lose available disk space
*/
if(disk_space < previous_mark){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
dirstr, (disk_space / 1024), 0);
}
/*
@@ -848,7 +848,7 @@ disk_monitoring_thread(void *nothing)
*
*/
if(disk_space < halfway){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%d bytes). "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes). "
"Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
dirstr, threshold, (grace_period / 60));
time(&start);
@@ -870,7 +870,7 @@ disk_monitoring_thread(void *nothing)
/*
* Excellent, we are back to acceptable levels, reset everything...
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%d bytes). Aborting"
+ LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%" NSPRIu64 " bytes). Aborting"
" shutdown, and restoring the log settings.\n",disk_space,0,0);
if(logs_disabled && using_accesslog){
config_set_accesslog_enabled(LOGGING_ON);
@@ -890,7 +890,7 @@ disk_monitoring_thread(void *nothing)
/*
* Disk space is critical, log an error, and shut it down now!
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb."
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
" Signaling slapd for shutdown...\n", dirstr, (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
return;
@@ -907,7 +907,7 @@ disk_monitoring_thread(void *nothing)
/*
* If disk space was freed up we would of detected in the above while loop. So shut it down.
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%d Kb). Signaling slapd for shutdown...\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%" NSPRIu64 " Kb). Signaling slapd for shutdown...\n",
(disk_space / 1024), 0, 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 7b2de68..f2b0ab8 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1585,17 +1585,19 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
int retVal = LDAP_SUCCESS;
- long threshold = 0;
+ PRUint64 threshold = 0;
char *endp = NULL;
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
- threshold = strtol(value, &endp, 10);
+ errno = 0;
+ threshold = strtoll(value, &endp, 10);
- if ( *endp != '\0' || threshold < 2048 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 2048 and less then %ld",
+ if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
@@ -4196,7 +4198,7 @@ config_get_disk_grace_period(){
return retVal;
}
-long
+PRUint64
config_get_disk_threshold(){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
long retVal;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 50f399a..2e000bd 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -547,7 +547,7 @@ void config_set_accesslog_enabled(int value);
void config_set_auditlog_enabled(int value);
int config_get_accesslog_logging_enabled();
int config_get_disk_monitoring();
-long config_get_disk_threshold();
+PRUint64 config_get_disk_threshold();
int config_get_disk_grace_period();
int config_get_disk_logging_critical();
int config_get_ndn_cache_count();
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index fb4c5ac..3a83c8b 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2278,8 +2278,8 @@ typedef struct _slapdFrontendConfig {
int sasl_max_bufsize; /* The max receive buffer size for SASL */
/* disk monitoring */
- int disk_monitoring;
- int disk_threshold;
+ slapi_onoff_t disk_monitoring;
+ PRUint64 disk_threshold;
int disk_grace_period;
int disk_logging_critical;
10 years, 9 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Mark Reynolds
ldap/servers/slapd/daemon.c | 48 ++++++++++++++++++++--------------------
ldap/servers/slapd/libglobs.c | 12 +++++-----
ldap/servers/slapd/proto-slap.h | 2 -
ldap/servers/slapd/slap.h | 2 -
4 files changed, 33 insertions(+), 31 deletions(-)
New commits:
commit aee7b9d0852e8c217c26c29aa22ef766a8e4b7d7
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Jul 10 15:41:47 2013 -0400
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Changed the data type to PRUint64 from int, and improved the config
validation, and logging.
https://fedorahosted.org/389/ticket/47427
Reviewed by: richm & nhosoi(Thanks!!)
(cherry picked from commit 6a0ed40b25a6dd4aaf3774a70199e8842499b42d)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index a745b6d..5a1705d 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -641,16 +641,16 @@ disk_mon_get_dirs(char ***list, int logs_critical){
* directory.
*/
char *
-disk_mon_check_diskspace(char **dirs, PRInt64 threshold, PRInt64 *disk_space)
+disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
{
#ifdef LINUX
struct statfs buf;
#else
struct statvfs buf;
#endif
- PRInt64 worst_disk_space = threshold;
- PRInt64 freeBytes = 0;
- PRInt64 blockSize = 0;
+ PRUint64 worst_disk_space = threshold;
+ PRUint64 freeBytes = 0;
+ PRUint64 blockSize = 0;
char *worst_dir = NULL;
int hit_threshold = 0;
int i = 0;
@@ -707,10 +707,10 @@ disk_monitoring_thread(void *nothing)
char errorbuf[BUFSIZ];
char **dirs = NULL;
char *dirstr = NULL;
- PRInt64 previous_mark = 0;
- PRInt64 disk_space = 0;
- PRInt64 threshold = 0;
- PRInt64 halfway = 0;
+ PRUint64 previous_mark = 0;
+ PRUint64 disk_space = 0;
+ PRUint64 threshold = 0;
+ PRUint64 halfway = 0;
time_t start = 0;
time_t now = 0;
int deleted_rotated_logs = 0;
@@ -792,7 +792,7 @@ disk_monitoring_thread(void *nothing)
* Check if we are already critical
*/
if(disk_space < 4096){ /* 4 k */
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb. "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb. "
"Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
return;
@@ -802,7 +802,7 @@ disk_monitoring_thread(void *nothing)
* if logging is not critical
*/
if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %d Kb, "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
"temporarily setting error loglevel to zero.\n", dirstr,
(disk_space / 1024), 0);
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
@@ -814,11 +814,11 @@ disk_monitoring_thread(void *nothing)
* access/audit logs, log another error, and continue.
*/
if(!logs_disabled && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
- config_set_accesslog_enabled(LOGGING_OFF);
- config_set_auditlog_enabled(LOGGING_OFF);
- logs_disabled = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
+ config_set_accesslog_enabled(LOGGING_OFF);
+ config_set_auditlog_enabled(LOGGING_OFF);
+ logs_disabled = 1;
continue;
}
/*
@@ -826,17 +826,17 @@ disk_monitoring_thread(void *nothing)
* access/audit logging, then delete the rotated logs, log another error, and continue.
*/
if(!deleted_rotated_logs && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
- log__delete_rotated_logs();
- deleted_rotated_logs = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
+ log__delete_rotated_logs();
+ deleted_rotated_logs = 1;
continue;
}
/*
* Ok, we've done what we can, log a message if we continue to lose available disk space
*/
if(disk_space < previous_mark){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
dirstr, (disk_space / 1024), 0);
}
/*
@@ -848,7 +848,7 @@ disk_monitoring_thread(void *nothing)
*
*/
if(disk_space < halfway){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%d bytes). "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes). "
"Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
dirstr, threshold, (grace_period / 60));
time(&start);
@@ -870,7 +870,7 @@ disk_monitoring_thread(void *nothing)
/*
* Excellent, we are back to acceptable levels, reset everything...
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%d bytes). Aborting"
+ LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%" NSPRIu64 " bytes). Aborting"
" shutdown, and restoring the log settings.\n",disk_space,0,0);
if(logs_disabled && using_accesslog){
config_set_accesslog_enabled(LOGGING_ON);
@@ -890,7 +890,7 @@ disk_monitoring_thread(void *nothing)
/*
* Disk space is critical, log an error, and shut it down now!
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb."
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
" Signaling slapd for shutdown...\n", dirstr, (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
return;
@@ -907,7 +907,7 @@ disk_monitoring_thread(void *nothing)
/*
* If disk space was freed up we would of detected in the above while loop. So shut it down.
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%d Kb). Signaling slapd for shutdown...\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%" NSPRIu64 " Kb). Signaling slapd for shutdown...\n",
(disk_space / 1024), 0, 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index dbdf5c2..c294eea 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1650,17 +1650,19 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
int retVal = LDAP_SUCCESS;
- long threshold = 0;
+ PRUint64 threshold = 0;
char *endp = NULL;
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
- threshold = strtol(value, &endp, 10);
+ errno = 0;
+ threshold = strtoll(value, &endp, 10);
- if ( *endp != '\0' || threshold < 2048 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 2048 and less then %ld",
+ if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
@@ -4320,7 +4322,7 @@ config_get_disk_grace_period(){
return retVal;
}
-long
+PRUint64
config_get_disk_threshold(){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
long retVal;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index ad4b87a..52d5aee 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -553,7 +553,7 @@ void config_set_accesslog_enabled(int value);
void config_set_auditlog_enabled(int value);
int config_get_accesslog_logging_enabled();
int config_get_disk_monitoring();
-long config_get_disk_threshold();
+PRUint64 config_get_disk_threshold();
int config_get_disk_grace_period();
int config_get_disk_logging_critical();
int config_get_ndn_cache_count();
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 1420316..7e38d26 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2314,7 +2314,7 @@ typedef struct _slapdFrontendConfig {
/* disk monitoring */
slapi_onoff_t disk_monitoring;
- int disk_threshold;
+ PRUint64 disk_threshold;
int disk_grace_period;
slapi_onoff_t disk_logging_critical;
10 years, 9 months
ldap/servers
by Mark Reynolds
ldap/servers/slapd/daemon.c | 48 ++++++++++++++++++++--------------------
ldap/servers/slapd/libglobs.c | 12 +++++-----
ldap/servers/slapd/proto-slap.h | 2 -
ldap/servers/slapd/slap.h | 2 -
4 files changed, 33 insertions(+), 31 deletions(-)
New commits:
commit 6a0ed40b25a6dd4aaf3774a70199e8842499b42d
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed Jul 10 15:41:47 2013 -0400
Ticket 47427 - Overflow in nsslapd-disk-monitoring-threshold
Bug Description: The threshold setting was being stored as an "int" instead
of a PRUint64. Config setting validation was also incomplete.
Fix Description: Changed the data type to PRUint64 from int, and improved the config
validation, and logging.
https://fedorahosted.org/389/ticket/47427
Reviewed by: richm & nhosoi(Thanks!!)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 817fea7..a14cf35 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -641,16 +641,16 @@ disk_mon_get_dirs(char ***list, int logs_critical){
* directory.
*/
char *
-disk_mon_check_diskspace(char **dirs, PRInt64 threshold, PRInt64 *disk_space)
+disk_mon_check_diskspace(char **dirs, PRUint64 threshold, PRUint64 *disk_space)
{
#ifdef LINUX
struct statfs buf;
#else
struct statvfs buf;
#endif
- PRInt64 worst_disk_space = threshold;
- PRInt64 freeBytes = 0;
- PRInt64 blockSize = 0;
+ PRUint64 worst_disk_space = threshold;
+ PRUint64 freeBytes = 0;
+ PRUint64 blockSize = 0;
char *worst_dir = NULL;
int hit_threshold = 0;
int i = 0;
@@ -707,10 +707,10 @@ disk_monitoring_thread(void *nothing)
char errorbuf[BUFSIZ];
char **dirs = NULL;
char *dirstr = NULL;
- PRInt64 previous_mark = 0;
- PRInt64 disk_space = 0;
- PRInt64 threshold = 0;
- PRInt64 halfway = 0;
+ PRUint64 previous_mark = 0;
+ PRUint64 disk_space = 0;
+ PRUint64 threshold = 0;
+ PRUint64 halfway = 0;
time_t start = 0;
time_t now = 0;
int deleted_rotated_logs = 0;
@@ -792,7 +792,7 @@ disk_monitoring_thread(void *nothing)
* Check if we are already critical
*/
if(disk_space < 4096){ /* 4 k */
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb. "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb. "
"Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
return;
@@ -802,7 +802,7 @@ disk_monitoring_thread(void *nothing)
* if logging is not critical
*/
if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %d Kb, "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
"temporarily setting error loglevel to zero.\n", dirstr,
(disk_space / 1024), 0);
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
@@ -814,11 +814,11 @@ disk_monitoring_thread(void *nothing)
* access/audit logs, log another error, and continue.
*/
if(!logs_disabled && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
- config_set_accesslog_enabled(LOGGING_OFF);
- config_set_auditlog_enabled(LOGGING_OFF);
- logs_disabled = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
+ config_set_accesslog_enabled(LOGGING_OFF);
+ config_set_auditlog_enabled(LOGGING_OFF);
+ logs_disabled = 1;
continue;
}
/*
@@ -826,17 +826,17 @@ disk_monitoring_thread(void *nothing)
* access/audit logging, then delete the rotated logs, log another error, and continue.
*/
if(!deleted_rotated_logs && !logging_critical){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb, "
- "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
- log__delete_rotated_logs();
- deleted_rotated_logs = 1;
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+ "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
+ log__delete_rotated_logs();
+ deleted_rotated_logs = 1;
continue;
}
/*
* Ok, we've done what we can, log a message if we continue to lose available disk space
*/
if(disk_space < previous_mark){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %d Kb\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
dirstr, (disk_space / 1024), 0);
}
/*
@@ -848,7 +848,7 @@ disk_monitoring_thread(void *nothing)
*
*/
if(disk_space < halfway){
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%d bytes). "
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes). "
"Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
dirstr, threshold, (grace_period / 60));
time(&start);
@@ -870,7 +870,7 @@ disk_monitoring_thread(void *nothing)
/*
* Excellent, we are back to acceptable levels, reset everything...
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%d bytes). Aborting"
+ LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%" NSPRIu64 " bytes). Aborting"
" shutdown, and restoring the log settings.\n",disk_space,0,0);
if(logs_disabled && using_accesslog){
config_set_accesslog_enabled(LOGGING_ON);
@@ -890,7 +890,7 @@ disk_monitoring_thread(void *nothing)
/*
* Disk space is critical, log an error, and shut it down now!
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %d Kb."
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
" Signaling slapd for shutdown...\n", dirstr, (disk_space / 1024), 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
return;
@@ -907,7 +907,7 @@ disk_monitoring_thread(void *nothing)
/*
* If disk space was freed up we would of detected in the above while loop. So shut it down.
*/
- LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%d Kb). Signaling slapd for shutdown...\n",
+ LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%" NSPRIu64 " Kb). Signaling slapd for shutdown...\n",
(disk_space / 1024), 0, 0);
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 12a1e03..c1f92ee 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1667,17 +1667,19 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
int retVal = LDAP_SUCCESS;
- long threshold = 0;
+ PRUint64 threshold = 0;
char *endp = NULL;
if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
return LDAP_OPERATIONS_ERROR;
}
- threshold = strtol(value, &endp, 10);
+ errno = 0;
+ threshold = strtoll(value, &endp, 10);
- if ( *endp != '\0' || threshold < 2048 ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 2048 and less then %ld",
+ if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %llu",
attrname, value, LONG_MAX );
retVal = LDAP_OPERATIONS_ERROR;
return retVal;
@@ -4370,7 +4372,7 @@ config_get_disk_grace_period(){
return retVal;
}
-long
+PRUint64
config_get_disk_threshold(){
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
long retVal;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 447d7d5..25663d2 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -554,7 +554,7 @@ void config_set_accesslog_enabled(int value);
void config_set_auditlog_enabled(int value);
int config_get_accesslog_logging_enabled();
int config_get_disk_monitoring();
-long config_get_disk_threshold();
+PRUint64 config_get_disk_threshold();
int config_get_disk_grace_period();
int config_get_disk_logging_critical();
int config_get_ndn_cache_count();
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index f836b16..fff4646 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2327,7 +2327,7 @@ typedef struct _slapdFrontendConfig {
/* disk monitoring */
slapi_onoff_t disk_monitoring;
- int disk_threshold;
+ PRUint64 disk_threshold;
int disk_grace_period;
slapi_onoff_t disk_logging_critical;
10 years, 9 months
Branch '389-ds-base-1.3.1' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/connection.c | 1 +
ldap/servers/slapd/daemon.c | 7 +++++++
ldap/servers/slapd/proto-slap.h | 1 +
3 files changed, 9 insertions(+)
New commits:
commit ed26da0722a23a50fb286e8bc57ec4fea8dde4a2
Author: Matthew Via <matthew.via(a)mailtrust.com>
Date: Wed Jul 10 11:30:57 2013 -0600
Ticket #47428 - Memory leak in 389-ds-base 1.2.11.15
https://fedorahosted.org/389/ticket/47428
Reviewed by: rmeggins
Branch: 389-ds-base-1.3.1
Fix Description: Call ber_sockbuf_remove_io to remove our openldap io layer
from the connection c_sb and free the data associated with it.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit df93b03da12c22d18a4153105f687671e52efdd5)
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 866731d..63bf847 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -203,6 +203,7 @@ connection_cleanup(Connection *conn)
/* destroy any sasl context */
sasl_dispose((sasl_conn_t**)&conn->c_sasl_conn);
/* PAGED_RESULTS */
+ handle_closed_connection(conn); /* Clean up sockbufs */
pagedresults_cleanup(conn, 0 /* do not need to lock inside */);
/* free the connection socket buffer */
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 6c8792f..a745b6d 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2593,6 +2593,13 @@ bail:
#endif /* ENABLE_AUTOBIND */
#endif /* ENABLE_LDAPI */
+void
+handle_closed_connection(Connection *conn)
+{
+ ber_sockbuf_remove_io(conn->c_sb, &openldap_sockbuf_io,
+ LBER_SBIOD_LEVEL_PROVIDER);
+}
+
/* NOTE: this routine is not reentrant */
static int
handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local)
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 2b973be..ad4b87a 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1405,6 +1405,7 @@ int sasl_io_setup(Connection *c);
/*
* daemon.c
*/
+void handle_closed_connection(Connection *);
#ifndef LINUX
void slapd_do_nothing(int);
#endif
10 years, 9 months