summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2007-09-17 22:48:10 +0000
committerNathan Kinder <nkinder@redhat.com>2007-09-17 22:48:10 +0000
commite02f8cc443a65c313c07ee1dc9742dcb33e1010d (patch)
tree61deeb023164b8548c8a28f239536598587b5159
parente1486990a0a112e43f7c17132a9dd620b4987604 (diff)
Resolves: 293541
Summary: Allow server to start if descriptor related attributes are set too high.
-rw-r--r--ldap/servers/slapd/configdse.c22
-rw-r--r--ldap/servers/slapd/libglobs.c27
2 files changed, 34 insertions, 15 deletions
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index f640964a..d8151a3c 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -294,9 +294,25 @@ load_config_dse(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *ret
if (attr_name)
{
retval = config_set(attr_name, values, returntext, 1 /* force apply */);
- if ((retval != LDAP_SUCCESS) &&
- slapi_attr_flag_is_set(attr, SLAPI_ATTR_FLAG_OPATTR))
- retval = LDAP_SUCCESS; /* ignore attempts to modify operational attrs */
+ if ((strcasecmp(attr_name, CONFIG_MAXDESCRIPTORS_ATTRIBUTE) == 0) ||
+ (strcasecmp(attr_name, CONFIG_RESERVEDESCRIPTORS_ATTRIBUTE) == 0) ||
+ (strcasecmp(attr_name, CONFIG_CONNTABLESIZE_ATTRIBUTE) == 0)) {
+ /* We should not treat an LDAP_UNWILLING_TO_PERFORM as fatal for
+ * the these config attributes. This error is returned when
+ * the value we are trying to set is higher than the current
+ * process limit. The set function will auto-adjust the runtime
+ * value to the current process limit when this happens. We want
+ * to allow the server to still start in this case. */
+ if (retval == LDAP_UNWILLING_TO_PERFORM) {
+ slapi_log_error (SLAPI_LOG_FATAL, NULL, "Config Warning: - %s\n", returntext);
+ retval = LDAP_SUCCESS;
+ }
+ } else {
+ if ((retval != LDAP_SUCCESS) &&
+ slapi_attr_flag_is_set(attr, SLAPI_ATTR_FLAG_OPATTR)) {
+ retval = LDAP_SUCCESS; /* ignore attempts to modify operational attrs */
+ }
+ }
}
if (values)
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index f91d1551..9d3e05bc 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -552,27 +552,27 @@ static struct config_get_and_set {
/* parameterizing lock dir */
{CONFIG_LOCKDIR_ATTRIBUTE, config_set_lockdir,
NULL, 0,
- (void**)&global_slapdFrontendConfig.lockdir, CONFIG_STRING, config_get_lockdir},
+ (void**)&global_slapdFrontendConfig.lockdir, CONFIG_STRING, (ConfigGetFunc)config_get_lockdir},
/* parameterizing tmp dir */
{CONFIG_TMPDIR_ATTRIBUTE, config_set_tmpdir,
NULL, 0,
- (void**)&global_slapdFrontendConfig.tmpdir, CONFIG_STRING, config_get_tmpdir},
+ (void**)&global_slapdFrontendConfig.tmpdir, CONFIG_STRING, (ConfigGetFunc)config_get_tmpdir},
/* parameterizing cert dir */
{CONFIG_CERTDIR_ATTRIBUTE, config_set_certdir,
NULL, 0,
- (void**)&global_slapdFrontendConfig.certdir, CONFIG_STRING, config_get_certdir},
+ (void**)&global_slapdFrontendConfig.certdir, CONFIG_STRING, (ConfigGetFunc)config_get_certdir},
/* parameterizing ldif dir */
{CONFIG_LDIFDIR_ATTRIBUTE, config_set_ldifdir,
NULL, 0,
- (void**)&global_slapdFrontendConfig.ldifdir, CONFIG_STRING, config_get_ldifdir},
+ (void**)&global_slapdFrontendConfig.ldifdir, CONFIG_STRING, (ConfigGetFunc)config_get_ldifdir},
/* parameterizing bak dir */
{CONFIG_BAKDIR_ATTRIBUTE, config_set_bakdir,
NULL, 0,
- (void**)&global_slapdFrontendConfig.bakdir, CONFIG_STRING, config_get_bakdir},
+ (void**)&global_slapdFrontendConfig.bakdir, CONFIG_STRING, (ConfigGetFunc)config_get_bakdir},
/* parameterizing sasl plugin path */
{CONFIG_SASLPATH_ATTRIBUTE, config_set_saslpath,
NULL, 0,
- (void**)&global_slapdFrontendConfig.saslpath, CONFIG_STRING, config_get_saslpath},
+ (void**)&global_slapdFrontendConfig.saslpath, CONFIG_STRING, (ConfigGetFunc)config_get_saslpath},
{CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274,
NULL, 0,
(void**)&global_slapdFrontendConfig.rewrite_rfc1274, CONFIG_ON_OFF, NULL},
@@ -2655,8 +2655,9 @@ config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, in
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum file descriptors must range from 1 to %d (the current process limit)",
- attrname, value, maxVal );
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", maximum "
+ "file descriptors must range from 1 to %d (the current process limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal, maxVal);
if ( nValue > maxVal ) {
nValue = maxVal;
retVal = LDAP_UNWILLING_TO_PERFORM;
@@ -2707,8 +2708,9 @@ config_set_conntablesize( const char *attrname, char *value, char *errorbuf, int
#elif !defined(AIX)
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table size must range from 1 to %d"
- " (the current process maxdescriptors limit)", attrname, value, maxVal );
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", connection table "
+ "size must range from 1 to %d (the current process maxdescriptors limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal );
if ( nValue > maxVal) {
nValue = maxVal;
retVal = LDAP_UNWILLING_TO_PERFORM;
@@ -2753,8 +2755,9 @@ config_set_reservedescriptors( const char *attrname, char *value, char *errorbuf
nValue = strtol(value, &endp, 10);
if ( *endp != '\0' || errno == ERANGE || nValue < 1 || nValue > maxVal ) {
- PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", reserved file descriptors must range from 1 to %d"
- " (the current process maxdescriptors limit)", attrname, value, maxVal );
+ PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "%s: invalid value \"%s\", reserved file "
+ "descriptors must range from 1 to %d (the current process maxdescriptors limit). "
+ "Server will use a setting of %d.", attrname, value, maxVal, maxVal );
if ( nValue > maxVal) {
nValue = maxVal;
retVal = LDAP_UNWILLING_TO_PERFORM;