|
|
dc8c34 |
From f44463a52bfb01c7dcc3ff46f9b43da18f3d178a Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Rich Megginson <rmeggins@redhat.com>
|
|
|
dc8c34 |
Date: Fri, 26 Jul 2013 08:36:29 -0600
|
|
|
dc8c34 |
Subject: [PATCH 157/225] Ticket 47427 - Overflow in
|
|
|
dc8c34 |
nsslapd-disk-monitoring-threshold
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description: If you directory try and set the threshold to -2,
|
|
|
dc8c34 |
the server allows it, but it should be rejected.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: With PR_snprintf and other NSPR formatting functions,
|
|
|
dc8c34 |
%lld must be used with LONG_MAX, instead of %ld which
|
|
|
dc8c34 |
must be used with regular printf.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47427
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: mreynolds (Thanks!)
|
|
|
dc8c34 |
(cherry picked from commit 5df006bd765163279f14cfbb0a136c15c69bed5b)
|
|
|
dc8c34 |
(cherry picked from commit 0b5fede023836b8b41a31c0106775767f306d21d)
|
|
|
dc8c34 |
(cherry picked from commit b8c921f201929ec15974f2ccbe36af5caf74c74c)
|
|
|
dc8c34 |
(cherry picked from commit 874f40e7e775b7f71b50bd5c775da45d3f7dc888)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/libglobs.c | 31 ++++++++++++++++---------------
|
|
|
dc8c34 |
1 file changed, 16 insertions(+), 15 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
|
|
|
dc8c34 |
index 930fd72..0fc9022 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/libglobs.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/libglobs.c
|
|
|
dc8c34 |
@@ -679,8 +679,8 @@ static struct config_get_and_set {
|
|
|
dc8c34 |
(ConfigGetFunc)config_get_disk_monitoring},
|
|
|
dc8c34 |
{CONFIG_DISK_THRESHOLD, config_set_disk_threshold,
|
|
|
dc8c34 |
NULL, 0,
|
|
|
dc8c34 |
- (void**)&global_slapdFrontendConfig.disk_threshold, CONFIG_LONG,
|
|
|
dc8c34 |
- (ConfigGetFunc)config_get_disk_threshold},
|
|
|
dc8c34 |
+ (void**)&global_slapdFrontendConfig.disk_threshold,
|
|
|
dc8c34 |
+ CONFIG_LONG, (ConfigGetFunc)config_get_disk_threshold},
|
|
|
dc8c34 |
{CONFIG_DISK_GRACE_PERIOD, config_set_disk_grace_period,
|
|
|
dc8c34 |
NULL, 0,
|
|
|
dc8c34 |
(void**)&global_slapdFrontendConfig.disk_grace_period,
|
|
|
dc8c34 |
@@ -1255,9 +1255,10 @@ config_set_disk_threshold( const char *attrname, char *value, char *errorbuf, in
|
|
|
dc8c34 |
errno = 0;
|
|
|
dc8c34 |
threshold = strtoll(value, &endp, 10);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if ( *endp != '\0' || threshold < 4096 || errno == ERANGE ) {
|
|
|
dc8c34 |
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lld",
|
|
|
dc8c34 |
- attrname, value, (long long int)LONG_MAX );
|
|
|
dc8c34 |
+ if ( *endp != '\0' || threshold <= 4096 || errno == ERANGE ) {
|
|
|
dc8c34 |
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
+ "%s: \"%s\" is invalid, threshold must be greater than 4096 and less then %lld",
|
|
|
dc8c34 |
+ attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -1754,7 +1755,7 @@ config_set_sizelimit( const char *attrname, char *value, char *errorbuf, int app
|
|
|
dc8c34 |
sizelimit = strtol(value, &endp, 10);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || sizelimit < -1 ) {
|
|
|
dc8c34 |
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, sizelimit must range from -1 to %ld",
|
|
|
dc8c34 |
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, sizelimit must range from -1 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -1798,7 +1799,7 @@ config_set_pagedsizelimit( const char *attrname, char *value, char *errorbuf, in
|
|
|
dc8c34 |
pagedsizelimit = strtol(value, &endp, 10);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || pagedsizelimit < -1 ) {
|
|
|
dc8c34 |
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %ld",
|
|
|
dc8c34 |
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: \"%s\" is invalid, pagedsizelimit must range from -1 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -2561,7 +2562,7 @@ config_set_pw_gracelimit( const char *attrname, char *value, char *errorbuf, int
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || gracelimit < 0 ) {
|
|
|
dc8c34 |
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
- "password grace limit \"%s\" is invalid, password grace limit must range from 0 to %ld",
|
|
|
dc8c34 |
+ "password grace limit \"%s\" is invalid, password grace limit must range from 0 to %lld",
|
|
|
dc8c34 |
value , LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -3276,7 +3277,7 @@ config_set_ioblocktimeout( const char *attrname, char *value, char *errorbuf, in
|
|
|
dc8c34 |
nValue = strtol(value, &endp, 10);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || nValue < 0 ) {
|
|
|
dc8c34 |
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", I/O block timeout must range from 0 to %ld",
|
|
|
dc8c34 |
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", I/O block timeout must range from 0 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -3318,7 +3319,7 @@ config_set_idletimeout( const char *attrname, char *value, char *errorbuf, int a
|
|
|
dc8c34 |
nValue = strtol(value, &endp, 10);
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if (*endp != '\0' || errno == ERANGE || nValue < 0 ) {
|
|
|
dc8c34 |
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", idle timeout must range from 0 to %ld",
|
|
|
dc8c34 |
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", idle timeout must range from 0 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -3421,7 +3422,7 @@ config_set_timelimit( const char *attrname, char *value, char *errorbuf, int app
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || nVal < -1 ) {
|
|
|
dc8c34 |
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
- "%s: invalid value \"%s\", time limit must range from -1 to %ld",
|
|
|
dc8c34 |
+ "%s: invalid value \"%s\", time limit must range from -1 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -3617,7 +3618,7 @@ config_set_pw_warning( const char *attrname, char *value, char *errorbuf, int ap
|
|
|
dc8c34 |
if (errno == ERANGE || sec < 0) {
|
|
|
dc8c34 |
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
"%s: password warning age \"%s\" is invalid, password warning "
|
|
|
dc8c34 |
- "age must range from 0 to %ld seconds",
|
|
|
dc8c34 |
+ "age must range from 0 to %lld seconds",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
@@ -3648,7 +3649,7 @@ config_set_errorlog_level( const char *attrname, char *value, char *errorbuf, in
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
|
|
|
dc8c34 |
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: error log level \"%s\" is invalid,"
|
|
|
dc8c34 |
- " error log level must range from 0 to %ld", attrname, value, LONG_MAX );
|
|
|
dc8c34 |
+ " error log level must range from 0 to %lld", attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -3686,7 +3687,7 @@ config_set_accesslog_level( const char *attrname, char *value, char *errorbuf, i
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if ( *endp != '\0' || errno == ERANGE || level < 0 ) {
|
|
|
dc8c34 |
PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: access log level \"%s\" is invalid,"
|
|
|
dc8c34 |
- " access log level must range from 0 to %ld", attrname, value, LONG_MAX );
|
|
|
dc8c34 |
+ " access log level must range from 0 to %lld", attrname, value, LONG_MAX );
|
|
|
dc8c34 |
retVal = LDAP_OPERATIONS_ERROR;
|
|
|
dc8c34 |
return retVal;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
@@ -5050,7 +5051,7 @@ config_set_maxsasliosize( const char *attrname, char *value, char *errorbuf, int
|
|
|
dc8c34 |
|
|
|
dc8c34 |
if (retVal != LDAP_SUCCESS) {
|
|
|
dc8c34 |
PR_snprintf(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
dc8c34 |
- "%s: \"%s\" is invalid. Value must range from -1 to %ld",
|
|
|
dc8c34 |
+ "%s: \"%s\" is invalid. Value must range from -1 to %lld",
|
|
|
dc8c34 |
attrname, value, LONG_MAX );
|
|
|
dc8c34 |
} else if (apply) {
|
|
|
dc8c34 |
CFG_LOCK_WRITE(slapdFrontendConfig);
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|