admserv/cfgstuff
by Nathan Kinder
admserv/cfgstuff/httpd-2.2.conf.in | 11 -----------
1 file changed, 11 deletions(-)
New commits:
commit 8f350bfafe80a4d3946e3d73ab68e57f373dea7f
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Tue Feb 22 15:38:48 2011 -0800
Bug 493424 - remove unneeded modules for admin server apache config
This removes modules that the Admin Server doesn't use from
httpd.conf.
diff --git a/admserv/cfgstuff/httpd-2.2.conf.in b/admserv/cfgstuff/httpd-2.2.conf.in
index a5bbc63..4561f0b 100644
--- a/admserv/cfgstuff/httpd-2.2.conf.in
+++ b/admserv/cfgstuff/httpd-2.2.conf.in
@@ -123,24 +123,13 @@ LoadModule authn_file_module @moddir(a)/mod_authn_file.so
LoadModule log_config_module @moddir(a)/mod_log_config.so
LoadModule env_module @moddir(a)/mod_env.so
LoadModule mime_magic_module @moddir(a)/mod_mime_magic.so
-LoadModule expires_module @moddir(a)/mod_expires.so
-<IfDefine !OmitDeflate>
-LoadModule deflate_module @moddir(a)/mod_deflate.so
-</IfDefine>
-LoadModule headers_module @moddir(a)/mod_headers.so
LoadModule unique_id_module @moddir(a)/mod_unique_id.so
LoadModule setenvif_module @moddir(a)/mod_setenvif.so
LoadModule mime_module @moddir(a)/mod_mime.so
-LoadModule vhost_alias_module @moddir(a)/mod_vhost_alias.so
LoadModule negotiation_module @moddir(a)/mod_negotiation.so
LoadModule dir_module @moddir(a)/mod_dir.so
-LoadModule actions_module @moddir(a)/mod_actions.so
LoadModule alias_module @moddir(a)/mod_alias.so
LoadModule rewrite_module @moddir(a)/mod_rewrite.so
-LoadModule cache_module @moddir(a)/mod_cache.so
-LoadModule disk_cache_module @moddir(a)/mod_disk_cache.so
-LoadModule file_cache_module @moddir(a)/mod_file_cache.so
-LoadModule mem_cache_module @moddir(a)/mod_mem_cache.so
LoadModule cgi_module @moddir(a)/mod_cgi.so
LoadModule restartd_module @admmoddir(a)/mod_restartd.so
LoadModule nss_module @nssmoddir(a)/libmodnss.so
13 years, 1 month
admserv/cgi-src40
by Nathan Kinder
admserv/cgi-src40/ds_create.in | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit f5a1e662d95f487c0be0f5b0c949e71cb08bc616
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Tue Feb 22 13:38:04 2011 -0800
Bug 618897 - Wrong permissions when creating instance from Console
When a new DS instance is created via console, the permissions in
the config ir are not set correctly. This creates problems when
the admin server tries to manage the new instance.
The problem is that the group was not being included in the inf
data that is passed to the instance creation code. This patch
makes the ds_create CGI look up the group from adm.conf and set
it in the inf data prior to creating the instance. This results
in the same permissions one would get run creating a new instance
via setup-ds-admin.pl.
diff --git a/admserv/cgi-src40/ds_create.in b/admserv/cgi-src40/ds_create.in
index aaa4a10..c91fce4 100644
--- a/admserv/cgi-src40/ds_create.in
+++ b/admserv/cgi-src40/ds_create.in
@@ -42,6 +42,11 @@ my $start_server = $query->param('start_server');
# create inf from CGI parameters
my $inf = createInfFromCGIParams($query);
+
+# get the group from adm.conf before we create the instance
+my $admConf = getAdmConf("@instconfigdir@/admin-serv");
+$inf->{General}->{SuiteSpotGroup} = $admConf->{sysgroup};
+
# create the instance
my @errs = createDSInstance($inf);
if (@errs) {
@@ -56,7 +61,6 @@ if (@errs) {
# by the console and to be registered with the config DS - these
# are usually passed in via the CGI params, or use reasonable
# default values
-my $admConf = getAdmConf("@instconfigdir@/admin-serv");
$inf->{General}->{ConfigDirectoryLdapURL} = $query->param('ldap_url') ||
$admConf->{ldapurl};
$inf->{General}->{ConfigDirectoryAdminID} = $query->param('cfg_sspt_uid');
13 years, 1 month
Branch '389-ds-base-1.2.8' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/back-ldbm.h | 3
ldap/servers/slapd/back-ldbm/cache.c | 22 +-
ldap/servers/slapd/back-ldbm/instance.c | 1
ldap/servers/slapd/back-ldbm/ldbm_config.c | 162 +++++++++++++++++++-
ldap/servers/slapd/back-ldbm/ldbm_config.h | 3
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 81 +++++++++-
6 files changed, 254 insertions(+), 18 deletions(-)
New commits:
commit 886d2473639f8162c2737cad50fe8029f7b49b19
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 21 17:46:21 2011 -0800
Bug 450016 - RFE- Console display values in KB/MB/GB
https://bugzilla.redhat.com/show_bug.cgi?id=450016
Description: To support Console display cache sizes in KB/MB/GB,
introducing display unit configuration parameters to the server.
Entry cache: nsslapd-cachememsizeunit
DB cache: nslapd-dbcachesizeunit
Import db cache: nsslapd-import-cachesizeunit
By default, the unit is bytes. It takes, KB, MB, GB.
Also, when the entry cache is reset, it's logged in the error log.
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index adf593e..b2f0b50 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -634,6 +634,8 @@ struct ldbminfo {
int li_fat_lock; /* 608146 -- make this configurable, first */
int li_legacy_errcode; /* 615428 -- in case legacy err code is expected */
Slapi_Counter *li_global_usn_counter; /* global USN counter */
+ char *dbcache_display_unit; /* display unit for db cache */
+ char *importcache_display_unit; /* display unit for db import cache */
};
/* li_flags could store these bits defined in ../slapi-plugin.h
@@ -764,6 +766,7 @@ typedef struct ldbm_instance {
int require_index; /* set to 1 to require an index be used
* in search */
struct cache inst_dncache; /* The dn cache for this instance. */
+ char *cache_display_unit; /* display unit for client */
} ldbm_instance;
/*
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index f21cd87..5406ace 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -667,10 +667,14 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
struct backentry *eflushtemp = NULL;
if (bytes < MINCACHESIZE) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING -- Max entry cache size %lu is set; "
+ "Minimum entry cache size is %lu -- rounding up\n",
+ bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- LDAPDebug(LDAP_DEBUG_ANY,
- "WARNING -- Minimum cache size is %lu -- rounding up\n",
- MINCACHESIZE, 0, 0);
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
+ "Max entry cache size is set to %lu\n", bytes);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
@@ -1497,14 +1501,18 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
}
if (bytes < MINCACHESIZE) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING -- Max dn cache size %lu is set; "
+ "Minimum dn cache size is %lu -- rounding up\n",
+ bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- LDAPDebug(LDAP_DEBUG_ANY,
- "WARNING -- Minimum cache size is %lu -- rounding up\n",
- MINCACHESIZE, 0, 0);
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
+ "Max dn cache size is set to %lu\n", bytes);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
- LOG("entry cache size set to %lu\n", bytes, 0, 0);
+ LOG("dn cache size set to %lu\n", bytes, 0, 0);
/* check for full cache, and clear out if necessary */
if (CACHE_FULL(cache)) {
dnflush = dncache_flush(cache);
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
index da66565..daeec3b 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -71,6 +71,7 @@ int ldbm_instance_create(backend *be, char *name)
rc = -1;
goto error;
}
+ inst->cache_display_unit = slapi_ch_strdup("bytes");
/*
* initialize the dn cache
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index a1b4062..fff84d5 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -326,19 +326,28 @@ done:
return retval;
}
-static void *ldbm_config_dbcachesize_get(void *arg)
+static void *
+ldbm_config_dbcachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
return (void *) (li->li_new_dbcachesize);
}
-static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+static int
+ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
- int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
if (apply) {
/* Stop the user configuring a stupidly small cache */
/* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
@@ -358,7 +367,69 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
}
- return retval;
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_config_dbcachesizeunit_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+ return (void *)slapi_ch_strdup(li->dbcache_display_unit);
+}
+
+static int
+ldbm_config_dbcachesizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ char *val = (char *)value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_DBCACHESIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (li->dbcache_display_unit) {
+ if (strcasecmp(li->dbcache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&li->dbcache_display_unit);
+ li->dbcache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ li->dbcache_display_unit = slapi_ch_strdup(val);
+ }
+ }
+
+ return LDAP_SUCCESS;
}
static void *ldbm_config_maxpassbeforemerge_get(void *arg)
@@ -973,16 +1044,89 @@ static void *ldbm_config_import_cachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)(li->li_import_cachesize);
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
+ return (void *) (li->li_import_cachesize);
}
static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorbuf,
int phase, int apply)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
+ size_t val = (size_t) value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (apply) {
+ li->li_import_cachesize = val;
+ }
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_config_import_cachesizeunit_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
+ return (void *)slapi_ch_strdup(li->importcache_display_unit);
+}
+
+static int
+ldbm_config_import_cachesizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ char *val = (char *)value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_IMPORT_CACHESIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (li->importcache_display_unit) {
+ if (strcasecmp(li->importcache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&li->importcache_display_unit);
+ li->importcache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ li->importcache_display_unit = slapi_ch_strdup(val);
+ }
+ }
- if (apply)
- li->li_import_cachesize = (size_t)value;
return LDAP_SUCCESS;
}
@@ -1233,6 +1377,8 @@ static config_info ldbm_config[] = {
{CONFIG_MODE, CONFIG_TYPE_INT_OCTAL, "0600", &ldbm_config_mode_get, &ldbm_config_mode_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDLISTSCANLIMIT, CONFIG_TYPE_INT, "4000", &ldbm_config_allidsthreshold_get, &ldbm_config_allidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_DIRECTORY, CONFIG_TYPE_STRING, "", &ldbm_config_directory_get, &ldbm_config_directory_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE|CONFIG_FLAG_SKIP_DEFAULT_SETTING},
+ /* UNIT must be set before CONFIG_DBCACHESIZE is */
+ {CONFIG_DBCACHESIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_config_dbcachesizeunit_get, &ldbm_config_dbcachesizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBCACHESIZE, CONFIG_TYPE_SIZE_T, "10000000", &ldbm_config_dbcachesize_get, &ldbm_config_dbcachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBNCACHE, CONFIG_TYPE_INT, "0", &ldbm_config_dbncache_get, &ldbm_config_dbncache_set, CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_MAXPASSBEFOREMERGE, CONFIG_TYPE_INT, "100", &ldbm_config_maxpassbeforemerge_get, &ldbm_config_maxpassbeforemerge_set, 0},
@@ -1264,6 +1410,8 @@ static config_info ldbm_config[] = {
{CONFIG_IMPORT_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "-1", &ldbm_config_import_cache_autosize_get, &ldbm_config_import_cache_autosize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "0", &ldbm_config_cache_autosize_get, &ldbm_config_cache_autosize_set, 0},
{CONFIG_CACHE_AUTOSIZE_SPLIT, CONFIG_TYPE_INT, "50", &ldbm_config_cache_autosize_split_get, &ldbm_config_cache_autosize_split_set, 0},
+ /* UNIT must be set before CONFIG_IMPORT_CACHESIZE is */
+ {CONFIG_IMPORT_CACHESIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_config_import_cachesizeunit_get, &ldbm_config_import_cachesizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IMPORT_CACHESIZE, CONFIG_TYPE_SIZE_T, "20000000", &ldbm_config_import_cachesize_get, &ldbm_config_import_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDL_SWITCH, CONFIG_TYPE_STRING, "new", &ldbm_config_idl_get_idl_new, &ldbm_config_idl_set_tune, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_BYPASS_FILTER_TEST, CONFIG_TYPE_STRING, "on", &ldbm_config_get_bypass_filter_test, &ldbm_config_set_bypass_filter_test, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index 5ba52a6..e5c6113 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -89,12 +89,14 @@ struct config_info {
#define CONFIG_DIRECTORY "nsslapd-directory"
#define CONFIG_MODE "nsslapd-mode"
#define CONFIG_DBCACHESIZE "nsslapd-dbcachesize"
+#define CONFIG_DBCACHESIZEUNIT "nsslapd-dbcachesizeunit"
#define CONFIG_DBNCACHE "nsslapd-dbncache"
#define CONFIG_MAXPASSBEFOREMERGE "nsslapd-maxpassbeforemerge"
#define CONFIG_IMPORT_CACHE_AUTOSIZE "nsslapd-import-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE "nsslapd-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE_SPLIT "nsslapd-cache-autosize-split"
#define CONFIG_IMPORT_CACHESIZE "nsslapd-import-cachesize"
+#define CONFIG_IMPORT_CACHESIZEUNIT "nsslapd-import-cachesizeunit"
#define CONFIG_INDEX_BUFFER_SIZE "nsslapd-index-buffer-size"
#define CONFIG_EXCLUDE_FROM_EXPORT "nsslapd-exclude-from-export"
#define CONFIG_EXCLUDE_FROM_EXPORT_DEFAULT_VALUE \
@@ -146,6 +148,7 @@ struct config_info {
/* instance config options */
#define CONFIG_INSTANCE_CACHESIZE "nsslapd-cachesize"
#define CONFIG_INSTANCE_CACHEMEMSIZE "nsslapd-cachememsize"
+#define CONFIG_INSTANCE_CACHEMEMSIZEUNIT "nsslapd-cachememsizeunit"
#define CONFIG_INSTANCE_DNCACHEMEMSIZE "nsslapd-dncachememsize"
#define CONFIG_INSTANCE_SUFFIX "nsslapd-suffix"
#define CONFIG_INSTANCE_READONLY "nsslapd-readonly"
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 882f10a..7d104ce 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -111,7 +111,11 @@ static void *
ldbm_instance_config_cachememsize_get(void *arg)
{
ldbm_instance *inst = (ldbm_instance *) arg;
-
+
+ if (NULL == inst) {
+ return (void *)NULL;
+ }
+
return (void *) cache_get_max_size(&(inst->inst_cache));
}
@@ -119,16 +123,83 @@ static int
ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
{
ldbm_instance *inst = (ldbm_instance *) arg;
- int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
- /* Do whatever we can to make sure the data is ok. */
+ if (NULL == inst) {
+ return LDAP_PARAM_ERROR;
+ }
if (apply) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Instance %s: "
+ "Max entry cache size is set to %lu (bytes)\n",
+ inst->inst_name, val);
cache_set_max_size(&(inst->inst_cache), val, CACHE_TYPE_ENTRY);
}
- return retval;
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_instance_config_cachememsizeunit_get(void *arg)
+{
+ ldbm_instance *inst = (ldbm_instance *) arg;
+
+ if (NULL == inst) {
+ return (void *)NULL;
+ }
+ return (void *)slapi_ch_strdup(inst->cache_display_unit);
+}
+
+static int
+ldbm_instance_config_cachememsizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ ldbm_instance *inst = (ldbm_instance *) arg;
+ char *val = (char *)value;
+ size_t cachememsize;
+
+ if (NULL == inst) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_INSTANCE_CACHEMEMSIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (inst->cache_display_unit) {
+ if (strcasecmp(inst->cache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&inst->cache_display_unit);
+ inst->cache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ inst->cache_display_unit = slapi_ch_strdup(val);
+ }
+ }
+
+ return LDAP_SUCCESS;
}
static void *
@@ -288,6 +359,8 @@ ldbm_instance_config_require_index_set(void *arg, void *value, char *errorbuf, i
*----------------------------------------------------------------------*/
static config_info ldbm_instance_config[] = {
{CONFIG_INSTANCE_CACHESIZE, CONFIG_TYPE_LONG, "-1", &ldbm_instance_config_cachesize_get, &ldbm_instance_config_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ /* UNIT must be set before CACHEMEMSIZE is */
+ {CONFIG_INSTANCE_CACHEMEMSIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_instance_config_cachememsizeunit_get, &ldbm_instance_config_cachememsizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_SIZE_T, "10485760", &ldbm_instance_config_cachememsize_get, &ldbm_instance_config_cachememsize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_READONLY, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_readonly_get, &ldbm_instance_config_readonly_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_REQUIRE_INDEX, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_require_index_get, &ldbm_instance_config_require_index_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
13 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/back-ldbm.h | 3
ldap/servers/slapd/back-ldbm/cache.c | 22 +-
ldap/servers/slapd/back-ldbm/instance.c | 1
ldap/servers/slapd/back-ldbm/ldbm_config.c | 162 +++++++++++++++++++-
ldap/servers/slapd/back-ldbm/ldbm_config.h | 3
ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 81 +++++++++-
6 files changed, 254 insertions(+), 18 deletions(-)
New commits:
commit aef19508c4f618285116d2068655183658f564d9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 21 17:46:21 2011 -0800
Bug 450016 - RFE- Console display values in KB/MB/GB
https://bugzilla.redhat.com/show_bug.cgi?id=450016
Description: To support Console display cache sizes in KB/MB/GB,
introducing display unit configuration parameters to the server.
Entry cache: nsslapd-cachememsizeunit
DB cache: nslapd-dbcachesizeunit
Import db cache: nsslapd-import-cachesizeunit
By default, the unit is bytes. It takes, KB, MB, GB.
Also, when the entry cache is reset, it's logged in the error log.
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index adf593e..b2f0b50 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -634,6 +634,8 @@ struct ldbminfo {
int li_fat_lock; /* 608146 -- make this configurable, first */
int li_legacy_errcode; /* 615428 -- in case legacy err code is expected */
Slapi_Counter *li_global_usn_counter; /* global USN counter */
+ char *dbcache_display_unit; /* display unit for db cache */
+ char *importcache_display_unit; /* display unit for db import cache */
};
/* li_flags could store these bits defined in ../slapi-plugin.h
@@ -764,6 +766,7 @@ typedef struct ldbm_instance {
int require_index; /* set to 1 to require an index be used
* in search */
struct cache inst_dncache; /* The dn cache for this instance. */
+ char *cache_display_unit; /* display unit for client */
} ldbm_instance;
/*
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index f21cd87..5406ace 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -667,10 +667,14 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
struct backentry *eflushtemp = NULL;
if (bytes < MINCACHESIZE) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING -- Max entry cache size %lu is set; "
+ "Minimum entry cache size is %lu -- rounding up\n",
+ bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- LDAPDebug(LDAP_DEBUG_ANY,
- "WARNING -- Minimum cache size is %lu -- rounding up\n",
- MINCACHESIZE, 0, 0);
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
+ "Max entry cache size is set to %lu\n", bytes);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
@@ -1497,14 +1501,18 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
}
if (bytes < MINCACHESIZE) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING -- Max dn cache size %lu is set; "
+ "Minimum dn cache size is %lu -- rounding up\n",
+ bytes, MINCACHESIZE);
bytes = MINCACHESIZE;
- LDAPDebug(LDAP_DEBUG_ANY,
- "WARNING -- Minimum cache size is %lu -- rounding up\n",
- MINCACHESIZE, 0, 0);
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM,
+ "Max dn cache size is set to %lu\n", bytes);
}
PR_Lock(cache->c_mutex);
cache->c_maxsize = bytes;
- LOG("entry cache size set to %lu\n", bytes, 0, 0);
+ LOG("dn cache size set to %lu\n", bytes, 0, 0);
/* check for full cache, and clear out if necessary */
if (CACHE_FULL(cache)) {
dnflush = dncache_flush(cache);
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
index da66565..daeec3b 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -71,6 +71,7 @@ int ldbm_instance_create(backend *be, char *name)
rc = -1;
goto error;
}
+ inst->cache_display_unit = slapi_ch_strdup("bytes");
/*
* initialize the dn cache
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index a1b4062..fff84d5 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -326,19 +326,28 @@ done:
return retval;
}
-static void *ldbm_config_dbcachesize_get(void *arg)
+static void *
+ldbm_config_dbcachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
return (void *) (li->li_new_dbcachesize);
}
-static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+static int
+ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
- int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
if (apply) {
/* Stop the user configuring a stupidly small cache */
/* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
@@ -358,7 +367,69 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
}
- return retval;
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_config_dbcachesizeunit_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+ return (void *)slapi_ch_strdup(li->dbcache_display_unit);
+}
+
+static int
+ldbm_config_dbcachesizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ char *val = (char *)value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_DBCACHESIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (li->dbcache_display_unit) {
+ if (strcasecmp(li->dbcache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&li->dbcache_display_unit);
+ li->dbcache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ li->dbcache_display_unit = slapi_ch_strdup(val);
+ }
+ }
+
+ return LDAP_SUCCESS;
}
static void *ldbm_config_maxpassbeforemerge_get(void *arg)
@@ -973,16 +1044,89 @@ static void *ldbm_config_import_cachesize_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)(li->li_import_cachesize);
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
+ return (void *) (li->li_import_cachesize);
}
static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorbuf,
int phase, int apply)
{
struct ldbminfo *li = (struct ldbminfo *)arg;
+ size_t val = (size_t) value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (apply) {
+ li->li_import_cachesize = val;
+ }
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_config_import_cachesizeunit_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ if (NULL == li) {
+ return (void *)NULL;
+ }
+
+ return (void *)slapi_ch_strdup(li->importcache_display_unit);
+}
+
+static int
+ldbm_config_import_cachesizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ char *val = (char *)value;
+
+ if (NULL == li) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_IMPORT_CACHESIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (li->importcache_display_unit) {
+ if (strcasecmp(li->importcache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&li->importcache_display_unit);
+ li->importcache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ li->importcache_display_unit = slapi_ch_strdup(val);
+ }
+ }
- if (apply)
- li->li_import_cachesize = (size_t)value;
return LDAP_SUCCESS;
}
@@ -1233,6 +1377,8 @@ static config_info ldbm_config[] = {
{CONFIG_MODE, CONFIG_TYPE_INT_OCTAL, "0600", &ldbm_config_mode_get, &ldbm_config_mode_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDLISTSCANLIMIT, CONFIG_TYPE_INT, "4000", &ldbm_config_allidsthreshold_get, &ldbm_config_allidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_DIRECTORY, CONFIG_TYPE_STRING, "", &ldbm_config_directory_get, &ldbm_config_directory_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE|CONFIG_FLAG_SKIP_DEFAULT_SETTING},
+ /* UNIT must be set before CONFIG_DBCACHESIZE is */
+ {CONFIG_DBCACHESIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_config_dbcachesizeunit_get, &ldbm_config_dbcachesizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBCACHESIZE, CONFIG_TYPE_SIZE_T, "10000000", &ldbm_config_dbcachesize_get, &ldbm_config_dbcachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DBNCACHE, CONFIG_TYPE_INT, "0", &ldbm_config_dbncache_get, &ldbm_config_dbncache_set, CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_MAXPASSBEFOREMERGE, CONFIG_TYPE_INT, "100", &ldbm_config_maxpassbeforemerge_get, &ldbm_config_maxpassbeforemerge_set, 0},
@@ -1264,6 +1410,8 @@ static config_info ldbm_config[] = {
{CONFIG_IMPORT_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "-1", &ldbm_config_import_cache_autosize_get, &ldbm_config_import_cache_autosize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "0", &ldbm_config_cache_autosize_get, &ldbm_config_cache_autosize_set, 0},
{CONFIG_CACHE_AUTOSIZE_SPLIT, CONFIG_TYPE_INT, "50", &ldbm_config_cache_autosize_split_get, &ldbm_config_cache_autosize_split_set, 0},
+ /* UNIT must be set before CONFIG_IMPORT_CACHESIZE is */
+ {CONFIG_IMPORT_CACHESIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_config_import_cachesizeunit_get, &ldbm_config_import_cachesizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IMPORT_CACHESIZE, CONFIG_TYPE_SIZE_T, "20000000", &ldbm_config_import_cachesize_get, &ldbm_config_import_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_IDL_SWITCH, CONFIG_TYPE_STRING, "new", &ldbm_config_idl_get_idl_new, &ldbm_config_idl_set_tune, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_BYPASS_FILTER_TEST, CONFIG_TYPE_STRING, "on", &ldbm_config_get_bypass_filter_test, &ldbm_config_set_bypass_filter_test, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index 5ba52a6..e5c6113 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -89,12 +89,14 @@ struct config_info {
#define CONFIG_DIRECTORY "nsslapd-directory"
#define CONFIG_MODE "nsslapd-mode"
#define CONFIG_DBCACHESIZE "nsslapd-dbcachesize"
+#define CONFIG_DBCACHESIZEUNIT "nsslapd-dbcachesizeunit"
#define CONFIG_DBNCACHE "nsslapd-dbncache"
#define CONFIG_MAXPASSBEFOREMERGE "nsslapd-maxpassbeforemerge"
#define CONFIG_IMPORT_CACHE_AUTOSIZE "nsslapd-import-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE "nsslapd-cache-autosize"
#define CONFIG_CACHE_AUTOSIZE_SPLIT "nsslapd-cache-autosize-split"
#define CONFIG_IMPORT_CACHESIZE "nsslapd-import-cachesize"
+#define CONFIG_IMPORT_CACHESIZEUNIT "nsslapd-import-cachesizeunit"
#define CONFIG_INDEX_BUFFER_SIZE "nsslapd-index-buffer-size"
#define CONFIG_EXCLUDE_FROM_EXPORT "nsslapd-exclude-from-export"
#define CONFIG_EXCLUDE_FROM_EXPORT_DEFAULT_VALUE \
@@ -146,6 +148,7 @@ struct config_info {
/* instance config options */
#define CONFIG_INSTANCE_CACHESIZE "nsslapd-cachesize"
#define CONFIG_INSTANCE_CACHEMEMSIZE "nsslapd-cachememsize"
+#define CONFIG_INSTANCE_CACHEMEMSIZEUNIT "nsslapd-cachememsizeunit"
#define CONFIG_INSTANCE_DNCACHEMEMSIZE "nsslapd-dncachememsize"
#define CONFIG_INSTANCE_SUFFIX "nsslapd-suffix"
#define CONFIG_INSTANCE_READONLY "nsslapd-readonly"
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 882f10a..7d104ce 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -111,7 +111,11 @@ static void *
ldbm_instance_config_cachememsize_get(void *arg)
{
ldbm_instance *inst = (ldbm_instance *) arg;
-
+
+ if (NULL == inst) {
+ return (void *)NULL;
+ }
+
return (void *) cache_get_max_size(&(inst->inst_cache));
}
@@ -119,16 +123,83 @@ static int
ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, int phase, int apply)
{
ldbm_instance *inst = (ldbm_instance *) arg;
- int retval = LDAP_SUCCESS;
size_t val = (size_t) value;
- /* Do whatever we can to make sure the data is ok. */
+ if (NULL == inst) {
+ return LDAP_PARAM_ERROR;
+ }
if (apply) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY, "Instance %s: "
+ "Max entry cache size is set to %lu (bytes)\n",
+ inst->inst_name, val);
cache_set_max_size(&(inst->inst_cache), val, CACHE_TYPE_ENTRY);
}
- return retval;
+ return LDAP_SUCCESS;
+}
+
+static void *
+ldbm_instance_config_cachememsizeunit_get(void *arg)
+{
+ ldbm_instance *inst = (ldbm_instance *) arg;
+
+ if (NULL == inst) {
+ return (void *)NULL;
+ }
+ return (void *)slapi_ch_strdup(inst->cache_display_unit);
+}
+
+static int
+ldbm_instance_config_cachememsizeunit_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ ldbm_instance *inst = (ldbm_instance *) arg;
+ char *val = (char *)value;
+ size_t cachememsize;
+
+ if (NULL == inst) {
+ return LDAP_PARAM_ERROR;
+ }
+
+ if (NULL == val) {
+ val = "bytes"; /* default unit */
+ } else if ((0 == strcasecmp(val, "bytes")) ||
+ (0 == strcasecmp(val, "KB")) ||
+ (0 == strcasecmp(val, "MB")) ||
+ (0 == strcasecmp(val, "GB"))) {
+ ;
+ } else {
+ if ((0 == strncasecmp(val, "KB", 2)) || /* Kbytes */
+ (0 == strncasecmp(val, "kilo", 4))) {
+ val = "KB";
+ } else if ((0 == strncasecmp(val, "MB", 2)) || /* Mbytes */
+ (0 == strncasecmp(val, "mega", 4))) {
+ val = "MB";
+ } else if ((0 == strncasecmp(val, "GB", 2)) || /* Gbytes */
+ (0 == strncasecmp(val, "giga", 4))) {
+ val = "GB";
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "WARNING: \"%s: %s\" is not a correct unit. "
+ "Replacing it with \"bytes\".\n",
+ CONFIG_INSTANCE_CACHEMEMSIZEUNIT, val);
+ val = "bytes"; /* default unit */
+ }
+ }
+
+ if (apply) {
+ if (inst->cache_display_unit) {
+ if (strcasecmp(inst->cache_display_unit, val)) {
+ /* units do not match; replace it */
+ slapi_ch_free_string(&inst->cache_display_unit);
+ inst->cache_display_unit = slapi_ch_strdup(val);
+ }
+ } else {
+ inst->cache_display_unit = slapi_ch_strdup(val);
+ }
+ }
+
+ return LDAP_SUCCESS;
}
static void *
@@ -288,6 +359,8 @@ ldbm_instance_config_require_index_set(void *arg, void *value, char *errorbuf, i
*----------------------------------------------------------------------*/
static config_info ldbm_instance_config[] = {
{CONFIG_INSTANCE_CACHESIZE, CONFIG_TYPE_LONG, "-1", &ldbm_instance_config_cachesize_get, &ldbm_instance_config_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ /* UNIT must be set before CACHEMEMSIZE is */
+ {CONFIG_INSTANCE_CACHEMEMSIZEUNIT, CONFIG_TYPE_STRING, NULL, &ldbm_instance_config_cachememsizeunit_get, &ldbm_instance_config_cachememsizeunit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_SIZE_T, "10485760", &ldbm_instance_config_cachememsize_get, &ldbm_instance_config_cachememsize_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_READONLY, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_readonly_get, &ldbm_instance_config_readonly_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_REQUIRE_INDEX, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_require_index_get, &ldbm_instance_config_require_index_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
13 years, 1 month
VERSION.sh
by Richard Allen Megginson
VERSION.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 29a517d5a5c6fa913d2fea619d990e9274f3f3de
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Feb 22 13:12:31 2011 -0700
bump version to 1.2.9.a1 - console version to 1.2.4
bump version to 1.2.9.a1 - console version to 1.2.4
diff --git a/VERSION.sh b/VERSION.sh
index c1b0bca..e725b61 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,11 +10,11 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=2
-VERSION_MAINT=8
+VERSION_MAINT=9
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
-VERSION_PREREL=.a2
+VERSION_PREREL=.a1
# NOTES on VERSION_PREREL
# use aN for an alpha release e.g. a1, a2, etc.
# use rcN for a release candidate e.g. rc1, rc2, etc.
@@ -50,4 +50,4 @@ PACKAGE_BUGREPORT="${PACKAGE_BUGREPORT}enter_bug.cgi?product=$brand"
PACKAGE_STRING="$PACKAGE_TARNAME $PACKAGE_VERSION"
# the version of the ds console package that this directory server
# is compatible with
-CONSOLE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.3
+CONSOLE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.4
13 years, 1 month
Branch '389-ds-base-1.2.8' - VERSION.sh
by Richard Allen Megginson
VERSION.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 90d876925cb1061a15661a05d5d9e17bb50a61b0
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Feb 22 13:11:14 2011 -0700
bump version to 1.2.8.a3 - console version is 1.2.4
bump version to 1.2.8.a3 - console version is 1.2.4
diff --git a/VERSION.sh b/VERSION.sh
index c1b0bca..5c248d8 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -14,7 +14,7 @@ VERSION_MAINT=8
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
-VERSION_PREREL=.a2
+VERSION_PREREL=.a3
# NOTES on VERSION_PREREL
# use aN for an alpha release e.g. a1, a2, etc.
# use rcN for a release candidate e.g. rc1, rc2, etc.
@@ -50,4 +50,4 @@ PACKAGE_BUGREPORT="${PACKAGE_BUGREPORT}enter_bug.cgi?product=$brand"
PACKAGE_STRING="$PACKAGE_TARNAME $PACKAGE_VERSION"
# the version of the ds console package that this directory server
# is compatible with
-CONSOLE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.3
+CONSOLE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.4
13 years, 1 month
Branch '389-ds-base-1.2.8' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/modify.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
New commits:
commit a33cb58502a11a72c4602f72ee22495b03868be7
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Feb 9 14:54:29 2011 -0700
Bug 675320 - empty modify operation with repl on or lastmod off will crash server
https://bugzilla.redhat.com/show_bug.cgi?id=675320
Resolves: bug 675320
Bug Description: empty modify operation with repl on or lastmod off will crash server
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: 389-ds-base-1.2.8
Fix Description: Check the modifications after lastmod is applied, if any.
If there are still no mods to apply, just return LDAP_SUCCESS to the client
and end the modify request. This makes it so that an empty modify is
allowed, but no further processing is done to avoid code that may not deal
with mods == NULL.
I also found a problem with the way an empty modify was handled. OpenLDAP
does not return an explicit error code if there was a problem reading the
sequence of modify ops, so we have to resort to other checking. This allows
an empty modify to pass through, when using either mozldap or openldap.
Platforms tested: RHEL5 x86_64, RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 1980427b8c78e79982c056ac270c6c3b11188830)
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 756ab6b..51d9f48 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -303,12 +303,33 @@ do_modify( Slapi_PBlock *pb )
}
/* check for decoding error */
- if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) )
+ /*
+ if using mozldap - will return LBER_END_OF_SEQORSET if loop
+ completed successfully, otherwise, other value
+ if using openldap - will return LBER_DEFAULT in either case
+ if there was at least one element read, len will be -1
+ if there were no elements read (empty modify) len will be 0
+ */
+#if defined(USE_OPENLDAP)
+ if ( tag != LBER_END_OF_SEQORSET )
+ {
+ if ( ( len == 0 ) && ( 0 == smods.num_elements ) && !ignored_some_mods ) {
+ /* ok - empty modify - allow empty modifies */
+ } else if ( len != -1 ) {
+ op_shared_log_error_access (pb, "MOD", dn, "decoding error");
+ send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "decoding error", 0, NULL );
+ goto free_and_return;
+ }
+ /* else ok */
+ }
+#else
+ if ( tag != LBER_END_OF_SEQORSET )
{
op_shared_log_error_access (pb, "MOD", dn, "decoding error");
send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "decoding error", 0, NULL );
goto free_and_return;
}
+#endif
/* decode the optional controls - put them in the pblock */
if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 )
@@ -728,7 +749,14 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
if (!repl_op && !skip_modified_attrs && lastmod)
{
modify_update_last_modified_attr(pb, &smods);
- }
+ }
+
+ if (0 == slapi_mods_get_num_mods(&smods)) {
+ /* nothing to do - no mods - this is not an error - just
+ send back LDAP_SUCCESS */
+ send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
+ goto free_and_return;
+ }
/*
* Add the unhashed password pseudo-attribute before
13 years, 1 month
ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/modify.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
New commits:
commit 1980427b8c78e79982c056ac270c6c3b11188830
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Feb 9 14:54:29 2011 -0700
Bug 675320 - empty modify operation with repl on or lastmod off will crash server
https://bugzilla.redhat.com/show_bug.cgi?id=675320
Resolves: bug 675320
Bug Description: empty modify operation with repl on or lastmod off will crash server
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: master
Fix Description: Check the modifications after lastmod is applied, if any.
If there are still no mods to apply, just return LDAP_SUCCESS to the client
and end the modify request. This makes it so that an empty modify is
allowed, but no further processing is done to avoid code that may not deal
with mods == NULL.
I also found a problem with the way an empty modify was handled. OpenLDAP
does not return an explicit error code if there was a problem reading the
sequence of modify ops, so we have to resort to other checking. This allows
an empty modify to pass through, when using either mozldap or openldap.
Platforms tested: RHEL5 x86_64, RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 756ab6b..51d9f48 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -303,12 +303,33 @@ do_modify( Slapi_PBlock *pb )
}
/* check for decoding error */
- if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) )
+ /*
+ if using mozldap - will return LBER_END_OF_SEQORSET if loop
+ completed successfully, otherwise, other value
+ if using openldap - will return LBER_DEFAULT in either case
+ if there was at least one element read, len will be -1
+ if there were no elements read (empty modify) len will be 0
+ */
+#if defined(USE_OPENLDAP)
+ if ( tag != LBER_END_OF_SEQORSET )
+ {
+ if ( ( len == 0 ) && ( 0 == smods.num_elements ) && !ignored_some_mods ) {
+ /* ok - empty modify - allow empty modifies */
+ } else if ( len != -1 ) {
+ op_shared_log_error_access (pb, "MOD", dn, "decoding error");
+ send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "decoding error", 0, NULL );
+ goto free_and_return;
+ }
+ /* else ok */
+ }
+#else
+ if ( tag != LBER_END_OF_SEQORSET )
{
op_shared_log_error_access (pb, "MOD", dn, "decoding error");
send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, "decoding error", 0, NULL );
goto free_and_return;
}
+#endif
/* decode the optional controls - put them in the pblock */
if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 )
@@ -728,7 +749,14 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
if (!repl_op && !skip_modified_attrs && lastmod)
{
modify_update_last_modified_attr(pb, &smods);
- }
+ }
+
+ if (0 == slapi_mods_get_num_mods(&smods)) {
+ /* nothing to do - no mods - this is not an error - just
+ send back LDAP_SUCCESS */
+ send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
+ goto free_and_return;
+ }
/*
* Add the unhashed password pseudo-attribute before
13 years, 1 month
Branch '389-ds-base-1.2.8' - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/back-ldbm/ldbm_search.c | 8 ++++-
ldap/servers/slapd/opshared.c | 10 +++++++
ldap/servers/slapd/pagedresults.c | 40 +++++++++++++++++++++++++++++
ldap/servers/slapd/proto-slap.h | 2 +
ldap/servers/slapd/slap.h | 3 ++
5 files changed, 61 insertions(+), 2 deletions(-)
New commits:
commit 5d4895c4d6a412476f4b831e1d0654931c3934f9
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jan 13 13:44:15 2011 -0700
Bug 666076 - dirsrv crash (1.2.7.5) with multiple simple paged result searches
https://bugzilla.redhat.com/show_bug.cgi?id=666076
Resolves: bug 666076
Bug Description: dirsrv crash (1.2.7.5) with multiple simple paged result searches
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: 389-ds-base-1.2.8
Fix Description: Only allow one simple paged results search per-connection
at a time. The new function pagedresults_check_or_set_processing() will
check the flag in the connection to see if pagedresults processing is in
progress. If so, the function will return True and the search will terminate
with LDAP_UNWILLING_TO_PERFORM (as per section 3 in RFC 2696, a server is
allowed to return unwillingToPerform if there is a limit to the number of
outstanding paged search requests from a given client). The processing
flag will be reset once the search result has been sent to the client.
Since the problem is multiple threads in the same connection accessing
the pagedresults data, the workaround is to just set
nsslapd-maxthreadsperconn: 1
in cn=config in dse.ldif.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit a123b5466aae3eac4193451ac587d90ef1b61815)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 88af80f..2ca416f 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -1201,6 +1201,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
if ( !use_extension )
{
CACHE_RETURN( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
}
if(sr->sr_vlventry != NULL && !use_extension )
@@ -1239,7 +1240,6 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
curtime = current_time();
if ( tlimit != -1 && curtime > stoptime )
{
- slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
/* in case paged results, clean up the conn */
pagedresults_set_search_result(pb->pb_conn, NULL);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
@@ -1250,13 +1250,13 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
delete_search_result_set( &sr );
rc = SLAPI_FAIL_GENERAL;
+ slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
goto bail;
}
/* check lookthrough limit */
if ( llimit != -1 && sr->sr_lookthroughcount >= llimit )
{
- slapi_send_ldap_result( pb, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, nentries, urls );
/* in case paged results, clean up the conn */
pagedresults_set_search_result(pb->pb_conn, NULL);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
@@ -1267,6 +1267,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
delete_search_result_set( &sr );
rc = SLAPI_FAIL_GENERAL;
+ slapi_send_ldap_result( pb, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, nentries, urls );
goto bail;
}
@@ -1456,12 +1457,14 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
else
{
CACHE_RETURN ( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
}
}
else
{
/* Failed the filter test, and this isn't a VLV Search */
CACHE_RETURN( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
if (LDAP_UNWILLING_TO_PERFORM == filter_test) {
/* Need to catch this error to detect the vattr loop */
slapi_send_ldap_result( pb, filter_test, NULL,
@@ -1544,6 +1547,7 @@ delete_search_result_set( back_search_result_set **sr )
{
idl_free( (*sr)->sr_candidates );
}
+ memset( *sr, 0, sizeof( back_search_result_set ) );
slapi_ch_free( (void**)sr );
}
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 1f14341..b3e2c45 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -226,6 +226,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
Slapi_Backend *pr_be = NULL;
void *pr_search_result = NULL;
int pr_search_result_count = 0;
+ int pr_reset_processing = 0;
be_list[0] = NULL;
referral_list[0] = NULL;
@@ -396,6 +397,12 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
&pagesize, &curr_search_count);
if (LDAP_SUCCESS == rc) {
unsigned int opnote = SLAPI_OP_NOTE_SIMPLEPAGED;
+ if (pagedresults_check_or_set_processing(pb->pb_conn)) {
+ send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "Simple Paged Results Search already in progress on this connection", 0, NULL);
+ goto free_and_return_nolock;
+ }
+ pr_reset_processing = 1; /* need to reset after we are done with this op */
operation->o_flags |= OP_FLAG_PAGED_RESULTS;
pr_be = pagedresults_get_current_be(pb->pb_conn);
pr_search_result = pagedresults_get_search_result(pb->pb_conn);
@@ -880,6 +887,9 @@ free_and_return:
slapi_sdn_done(&sdn);
slapi_ch_free_string(&proxydn);
slapi_ch_free_string(&proxystr);
+ if (pr_reset_processing) {
+ pagedresults_reset_processing(pb->pb_conn);
+ }
}
/* Returns 1 if this processing on this entry is finished
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a1b0333..652d4e1 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -364,6 +364,7 @@ pagedresults_set_timelimit(Connection *conn, time_t timelimit)
}
/*
+ * must be called with conn->c_mutex held
* return values
* 0: not a simple paged result connection
* 1: simple paged result and successfully abandoned
@@ -385,5 +386,44 @@ pagedresults_cleanup(Connection *conn)
}
conn->c_search_result_count = 0;
conn->c_timelimit = 0;
+ conn->c_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
return rc;
}
+
+/*
+ * check to see if this connection is currently processing
+ * a pagedresults search - if it is, return True - if not,
+ * mark that it is processing, and return False
+ */
+int
+pagedresults_check_or_set_processing(Connection *conn)
+{
+ int ret = 0;
+ if (conn) {
+ PR_Lock(conn->c_mutex);
+ ret = conn->c_flags&CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ /* if ret is true, the following doesn't do anything */
+ conn->c_flags |= CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ PR_Unlock(conn->c_mutex);
+ }
+ return ret;
+}
+
+/*
+ * mark the connection as being done with pagedresults
+ * processing - returns True if it was processing,
+ * False otherwise
+ */
+int
+pagedresults_reset_processing(Connection *conn)
+{
+ int ret = 0;
+ if (conn) {
+ PR_Lock(conn->c_mutex);
+ ret = conn->c_flags&CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ /* if ret is false, the following doesn't do anything */
+ conn->c_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ PR_Unlock(conn->c_mutex);
+ }
+ return ret;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 3d22da5..7bd94d4 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1387,6 +1387,8 @@ int pagedresults_get_sort_result_code(Connection *conn);
int pagedresults_set_sort_result_code(Connection *conn, int code);
int pagedresults_set_timelimit(Connection *conn, time_t timelimit);
int pagedresults_cleanup(Connection *conn);
+int pagedresults_check_or_set_processing(Connection *conn);
+int pagedresults_reset_processing(Connection *conn);
/*
* sort.c
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 65ee8ce..ee02a26 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1409,6 +1409,9 @@ typedef struct conn {
#define CONN_FLAG_PAGEDRESULTS_UNINDEXED 128 /* If the search is unindexed,
* store the info in c_flags
*/
+#define CONN_FLAG_PAGEDRESULTS_PROCESSING 256 /* there is an operation
+ * processing a pagedresults search
+ */
#define CONN_GET_SORT_RESULT_CODE (-1)
#define START_TLS_OID "1.3.6.1.4.1.1466.20037"
13 years, 2 months
ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/back-ldbm/ldbm_search.c | 8 ++++-
ldap/servers/slapd/opshared.c | 10 +++++++
ldap/servers/slapd/pagedresults.c | 40 +++++++++++++++++++++++++++++
ldap/servers/slapd/proto-slap.h | 2 +
ldap/servers/slapd/slap.h | 3 ++
5 files changed, 61 insertions(+), 2 deletions(-)
New commits:
commit a123b5466aae3eac4193451ac587d90ef1b61815
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jan 13 13:44:15 2011 -0700
Bug 666076 - dirsrv crash (1.2.7.5) with multiple simple paged result searches
https://bugzilla.redhat.com/show_bug.cgi?id=666076
Resolves: bug 666076
Bug Description: dirsrv crash (1.2.7.5) with multiple simple paged result searches
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: master
Fix Description: Only allow one simple paged results search per-connection
at a time. The new function pagedresults_check_or_set_processing() will
check the flag in the connection to see if pagedresults processing is in
progress. If so, the function will return True and the search will terminate
with LDAP_UNWILLING_TO_PERFORM (as per section 3 in RFC 2696, a server is
allowed to return unwillingToPerform if there is a limit to the number of
outstanding paged search requests from a given client). The processing
flag will be reset once the search result has been sent to the client.
Since the problem is multiple threads in the same connection accessing
the pagedresults data, the workaround is to just set
nsslapd-maxthreadsperconn: 1
in cn=config in dse.ldif.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 88af80f..2ca416f 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -1201,6 +1201,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
if ( !use_extension )
{
CACHE_RETURN( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
}
if(sr->sr_vlventry != NULL && !use_extension )
@@ -1239,7 +1240,6 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
curtime = current_time();
if ( tlimit != -1 && curtime > stoptime )
{
- slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
/* in case paged results, clean up the conn */
pagedresults_set_search_result(pb->pb_conn, NULL);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
@@ -1250,13 +1250,13 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
delete_search_result_set( &sr );
rc = SLAPI_FAIL_GENERAL;
+ slapi_send_ldap_result( pb, LDAP_TIMELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
goto bail;
}
/* check lookthrough limit */
if ( llimit != -1 && sr->sr_lookthroughcount >= llimit )
{
- slapi_send_ldap_result( pb, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, nentries, urls );
/* in case paged results, clean up the conn */
pagedresults_set_search_result(pb->pb_conn, NULL);
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, NULL );
@@ -1267,6 +1267,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
delete_search_result_set( &sr );
rc = SLAPI_FAIL_GENERAL;
+ slapi_send_ldap_result( pb, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, nentries, urls );
goto bail;
}
@@ -1456,12 +1457,14 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
else
{
CACHE_RETURN ( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
}
}
else
{
/* Failed the filter test, and this isn't a VLV Search */
CACHE_RETURN( &inst->inst_cache, &(sr->sr_entry) );
+ sr->sr_entry = NULL;
if (LDAP_UNWILLING_TO_PERFORM == filter_test) {
/* Need to catch this error to detect the vattr loop */
slapi_send_ldap_result( pb, filter_test, NULL,
@@ -1544,6 +1547,7 @@ delete_search_result_set( back_search_result_set **sr )
{
idl_free( (*sr)->sr_candidates );
}
+ memset( *sr, 0, sizeof( back_search_result_set ) );
slapi_ch_free( (void**)sr );
}
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 1f14341..b3e2c45 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -226,6 +226,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
Slapi_Backend *pr_be = NULL;
void *pr_search_result = NULL;
int pr_search_result_count = 0;
+ int pr_reset_processing = 0;
be_list[0] = NULL;
referral_list[0] = NULL;
@@ -396,6 +397,12 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
&pagesize, &curr_search_count);
if (LDAP_SUCCESS == rc) {
unsigned int opnote = SLAPI_OP_NOTE_SIMPLEPAGED;
+ if (pagedresults_check_or_set_processing(pb->pb_conn)) {
+ send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM,
+ NULL, "Simple Paged Results Search already in progress on this connection", 0, NULL);
+ goto free_and_return_nolock;
+ }
+ pr_reset_processing = 1; /* need to reset after we are done with this op */
operation->o_flags |= OP_FLAG_PAGED_RESULTS;
pr_be = pagedresults_get_current_be(pb->pb_conn);
pr_search_result = pagedresults_get_search_result(pb->pb_conn);
@@ -880,6 +887,9 @@ free_and_return:
slapi_sdn_done(&sdn);
slapi_ch_free_string(&proxydn);
slapi_ch_free_string(&proxystr);
+ if (pr_reset_processing) {
+ pagedresults_reset_processing(pb->pb_conn);
+ }
}
/* Returns 1 if this processing on this entry is finished
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a1b0333..652d4e1 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -364,6 +364,7 @@ pagedresults_set_timelimit(Connection *conn, time_t timelimit)
}
/*
+ * must be called with conn->c_mutex held
* return values
* 0: not a simple paged result connection
* 1: simple paged result and successfully abandoned
@@ -385,5 +386,44 @@ pagedresults_cleanup(Connection *conn)
}
conn->c_search_result_count = 0;
conn->c_timelimit = 0;
+ conn->c_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
return rc;
}
+
+/*
+ * check to see if this connection is currently processing
+ * a pagedresults search - if it is, return True - if not,
+ * mark that it is processing, and return False
+ */
+int
+pagedresults_check_or_set_processing(Connection *conn)
+{
+ int ret = 0;
+ if (conn) {
+ PR_Lock(conn->c_mutex);
+ ret = conn->c_flags&CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ /* if ret is true, the following doesn't do anything */
+ conn->c_flags |= CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ PR_Unlock(conn->c_mutex);
+ }
+ return ret;
+}
+
+/*
+ * mark the connection as being done with pagedresults
+ * processing - returns True if it was processing,
+ * False otherwise
+ */
+int
+pagedresults_reset_processing(Connection *conn)
+{
+ int ret = 0;
+ if (conn) {
+ PR_Lock(conn->c_mutex);
+ ret = conn->c_flags&CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ /* if ret is false, the following doesn't do anything */
+ conn->c_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
+ PR_Unlock(conn->c_mutex);
+ }
+ return ret;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 3d22da5..7bd94d4 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1387,6 +1387,8 @@ int pagedresults_get_sort_result_code(Connection *conn);
int pagedresults_set_sort_result_code(Connection *conn, int code);
int pagedresults_set_timelimit(Connection *conn, time_t timelimit);
int pagedresults_cleanup(Connection *conn);
+int pagedresults_check_or_set_processing(Connection *conn);
+int pagedresults_reset_processing(Connection *conn);
/*
* sort.c
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 65ee8ce..ee02a26 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1409,6 +1409,9 @@ typedef struct conn {
#define CONN_FLAG_PAGEDRESULTS_UNINDEXED 128 /* If the search is unindexed,
* store the info in c_flags
*/
+#define CONN_FLAG_PAGEDRESULTS_PROCESSING 256 /* there is an operation
+ * processing a pagedresults search
+ */
#define CONN_GET_SORT_RESULT_CODE (-1)
#define START_TLS_OID "1.3.6.1.4.1.1466.20037"
13 years, 2 months