Branch '389-ds-base-1.3.0' - 2 commits - VERSION.sh ldap/servers
by Noriko Hosoi
VERSION.sh | 2 +-
ldap/servers/slapd/pw.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit d8da32fc252bfb515c16c1436332a3f918242b99
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Feb 13 15:27:53 2013 -0800
bump version to 1.3.0.3
diff --git a/VERSION.sh b/VERSION.sh
index 852013d..6391f34 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=3
-VERSION_MAINT=0.2
+VERSION_MAINT=0.3
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
commit 4dcf155d2b25c15d52a6336790f2e82acb37228e
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Feb 13 14:13:56 2013 -0800
Ticket #584 - Existence of an entry is not checked when its password is to be deleted
Bug description: When attempting to delete a password from an
entry, a password syntax checking api check_pw_syntax_ext missed
a check if the target entry exists or not. Note: add and replace
checks it and handles the case correctly.
Fix description: In this patch the check is added to the delete
case, as well.
Reviewed by Rich (Thank you!!)
(cherry picked from commit d559d4665b18702b51161a25737b62799d8ef430)
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 9135a52..b01fb2b 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -777,7 +777,7 @@ int
check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
char **old_pw, Slapi_Entry *e, int mod_op, Slapi_Mods *smods)
{
- Slapi_Attr *attr;
+ Slapi_Attr *attr;
int i, pwresponse_req = 0;
int is_replication = 0;
int internal_op = 0;
@@ -794,6 +794,12 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
* PASS == 0.
*/
if (LDAP_MOD_DELETE == (mod_op & LDAP_MOD_OP)) {
+ /* check if the entry exists or not */
+ e = get_entry(pb, dn);
+ if (e == NULL) {
+ return -1;
+ }
+ slapi_entry_free(e);
return 0;
}
if (NULL == vals) {
11 years, 2 months
2 commits - VERSION.sh ldap/servers
by Noriko Hosoi
VERSION.sh | 4 ++--
ldap/servers/slapd/pw.c | 8 +++++++-
2 files changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 1a1db0fff81f1cec7aaeeeefd1dc3422e9ab3079
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Feb 13 14:45:00 2013 -0800
bump version to 1.3.1.pre.a1
diff --git a/VERSION.sh b/VERSION.sh
index d786b37..d9ddd32 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=3
-VERSION_MAINT=0
+VERSION_MAINT=1
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
-VERSION_PREREL=.rc1
+VERSION_PREREL=.pre.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.
commit d559d4665b18702b51161a25737b62799d8ef430
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Wed Feb 13 14:13:56 2013 -0800
Ticket #584 - Existence of an entry is not checked when its password is to be deleted
Bug description: When attempting to delete a password from an
entry, a password syntax checking api check_pw_syntax_ext missed
a check if the target entry exists or not. Note: add and replace
checks it and handles the case correctly.
Fix description: In this patch the check is added to the delete
case, as well.
Reviewed by Rich (Thank you!!)
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 671a230..b95a19d 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -770,7 +770,7 @@ int
check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
char **old_pw, Slapi_Entry *e, int mod_op, Slapi_Mods *smods)
{
- Slapi_Attr *attr;
+ Slapi_Attr *attr;
int i, pwresponse_req = 0;
int is_replication = 0;
int internal_op = 0;
@@ -787,6 +787,12 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
* PASS == 0.
*/
if (LDAP_MOD_DELETE == (mod_op & LDAP_MOD_OP)) {
+ /* check if the entry exists or not */
+ e = get_entry(pb, dn);
+ if (e == NULL) {
+ return -1;
+ }
+ slapi_entry_free(e);
return 0;
}
if (NULL == vals) {
11 years, 2 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/config.c | 32 ++++-----------------
ldap/servers/slapd/dse.c | 60 ++++++++++++++++++++++++++--------------
ldap/servers/slapd/proto-slap.h | 1
3 files changed, 47 insertions(+), 46 deletions(-)
New commits:
commit 8254669f07a189ad16f9d6c71a7eb9c94b061448
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Fri Nov 23 11:15:52 2012 +0100
Ticket 518 - dse.ldif is 0 length after server kill or machine kill
Bug Description: If a machine is powered off while slapd is running, dse.ldif can have 0 bytes and
server doesn't start even if a dse.ldif.tmp or dse.ldif.bak exists
Fix Description: I see no way to prevent a 0 byte ldif in case of a machine crash from slapd code,
but the server should try all avaialble backup dse.ldif files to be able to start,
https://fedorahosted.org/389/ticket/518
Reviewed by: RichM (Thanks)
(cherry picked from commit b3ca9eec5d50c2ca503582e55b6681b9b3ad6ad3)
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index d97a575..3edc24b 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -165,6 +165,7 @@ slapd_bootstrap_config(const char *configdir)
char *buf = 0;
char *lastp = 0;
char *entrystr = 0;
+ char tmpfile[MAXPATHLEN+1];
if (NULL == configdir) {
slapi_log_error(SLAPI_LOG_FATAL,
@@ -173,33 +174,14 @@ slapd_bootstrap_config(const char *configdir)
}
PR_snprintf(configfile, sizeof(configfile), "%s/%s", configdir,
CONFIG_FILENAME);
- if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
- {
- /* the "real" file does not exist; see if there is a tmpfile */
- char tmpfile[MAXPATHLEN+1];
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The configuration file %s does not exist\n", configfile);
- PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.tmp", configdir,
+ PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.tmp", configdir,
CONFIG_FILENAME);
- if ( PR_GetFileInfo( tmpfile, &prfinfo ) == PR_SUCCESS ) {
- rc = PR_Rename(tmpfile, configfile);
- if (rc == PR_SUCCESS) {
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The configuration file %s was restored from backup %s\n",
- configfile, tmpfile);
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The configuration file %s was not restored from backup %s, error %d\n",
- configfile, tmpfile, rc);
- return rc; /* Fail */
- }
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, "config",
- "The backup configuration file %s does not exist, either.\n",
- tmpfile);
- return rc; /* Fail */
- }
+ if ( (rc = dse_check_file(configfile, tmpfile)) == 0 ) {
+ PR_snprintf(tmpfile, sizeof(tmpfile), "%s/%s.bak", configdir,
+ CONFIG_FILENAME);
+ rc = dse_check_file(configfile, tmpfile);
}
+
if ( (rc = PR_GetFileInfo( configfile, &prfinfo )) != PR_SUCCESS )
{
PRErrorCode prerr = PR_GetError();
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 8cf3916..efa64ff 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -651,6 +651,40 @@ dse_updateNumSubOfParent(struct dse *pdse, const Slapi_DN *child, int op)
slapi_sdn_done(&parent);
}
+/* check if a file is valid, or if a provided backup file can be used.
+ * there is no way to determine if the file contents is usable, the only
+ * checks that can be done is that the file exists and that it is not size 0
+ */
+int
+dse_check_file(char *filename, char *backupname)
+{
+ int rc= 0; /* Fail */
+ PRFileInfo prfinfo;
+
+ if (PR_GetFileInfo( filename, &prfinfo ) == PR_SUCCESS) {
+ if ( prfinfo.size > 0)
+ return (1);
+ else {
+ rc = PR_Delete (filename);
+ }
+ }
+
+ if (backupname)
+ rc = PR_Rename (backupname, filename);
+ else
+ return (0);
+
+ if ( PR_GetFileInfo( filename, &prfinfo ) == PR_SUCCESS && prfinfo.size > 0 ) {
+ slapi_log_error(SLAPI_LOG_FATAL, "dse",
+ "The configuration file %s was restored from backup %s\n", filename, backupname);
+ return (1);
+ } else {
+ slapi_log_error(SLAPI_LOG_FATAL, "dse",
+ "The configuration file %s was not restored from backup %s, error %d\n",
+ filename, backupname, rc);
+ return (0);
+ }
+}
static int
dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
int primary_file )
@@ -669,27 +703,11 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
if ( (NULL != pdse) && (NULL != filename) )
{
- if ( (rc = PR_GetFileInfo( filename, &prfinfo )) != PR_SUCCESS )
- {
- /* the "real" file does not exist; see if there is a tmpfile */
- if ( pdse->dse_tmpfile &&
- PR_GetFileInfo( pdse->dse_tmpfile, &prfinfo ) == PR_SUCCESS ) {
- rc = PR_Rename(pdse->dse_tmpfile, filename);
- if (rc == PR_SUCCESS) {
- slapi_log_error(SLAPI_LOG_FATAL, "dse",
- "The configuration file %s was restored from backup %s\n",
- filename, pdse->dse_tmpfile);
- rc = 1;
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, "dse",
- "The configuration file %s was not restored from backup %s, error %d\n",
- filename, pdse->dse_tmpfile, rc);
- rc = 0;
- }
- } else {
- rc = 0; /* fail */
- }
- }
+ /* check if the "real" file exists and cam be used, if not try tmp as backup */
+ rc = dse_check_file(filename, pdse->dse_tmpfile);
+ if (!rc)
+ rc = dse_check_file(filename, pdse->dse_fileback);
+
if ( (rc = PR_GetFileInfo( filename, &prfinfo )) != PR_SUCCESS )
{
slapi_log_error(SLAPI_LOG_FATAL, "dse",
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 2289efa..bdcef9a 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -654,6 +654,7 @@ struct dse *dse_new( char *filename, char *tmpfilename, char *backfilename, char
struct dse *dse_new_with_filelist(char *filename, char *tmpfilename, char *backfilename, char *startokfilename, const char *configdir, char **filelist);
int dse_deletedse(Slapi_PBlock *pb);
int dse_destroy(struct dse *pdse);
+int dse_check_file(char *filename, char *backupname);
int dse_read_file(struct dse *pdse, Slapi_PBlock *pb);
int dse_bind( Slapi_PBlock *pb );
int dse_unbind( Slapi_PBlock *pb );
11 years, 2 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/posix-winsync/posix-group-task.c | 21 ++++++++++--------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 586e244e2844ceb3c54afa3a363da99aa3d3d696
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Mon Feb 11 14:49:14 2013 -0800
Ticket #579 - Error messages encountered when using POSIX winsync
Bug description: posix_group_fix_memberuid_callback registered by
posixWinsyncCreateMemberOfTask calls an internal modify function
even if there are no attributes to fix up. The attempt fails as
expected, but it logs cryptic errors in the error log:
- slapi_modify_internal_set_pb: NULL parameter
- allow_operation: component identity is NULL
Fix description: This patch skips calling the fix up internal
modify if there is no attributes to fix up.
https://fedorahosted.org/389/ticket/579
Reviewed by Rich (Thank you!!)
(cherry picked from commit 74423d2eaef50949fd96ded8a2251834663e95e8)
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-task.c b/ldap/servers/plugins/posix-winsync/posix-group-task.c
index 92ac342..1d9135d 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-task.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c
@@ -250,6 +250,7 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
char *dn = slapi_entry_get_dn(e);
Slapi_DN *sdn = slapi_entry_get_sdn(e);
+ LDAPMod **mods = NULL;
/* Clean out memberuids and dsonlymemberuids without a valid referant */
rc = slapi_entry_attr_find(e, "memberuid", &muid_attr);
@@ -380,17 +381,19 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
}
}
- Slapi_PBlock *mod_pb = slapi_pblock_new();
+ mods = slapi_mods_get_ldapmods_passout(smods);
+ if (mods) {
+ Slapi_PBlock *mod_pb = NULL;
+ mod_pb = slapi_pblock_new();
+ slapi_modify_internal_set_pb_ext(mod_pb, sdn, mods, 0, 0,
+ posix_winsync_get_plugin_identity(), 0);
- slapi_modify_internal_set_pb_ext(mod_pb, sdn, slapi_mods_get_ldapmods_passout(smods), 0, 0,
- posix_winsync_get_plugin_identity(), 0);
-
- slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
- slapi_modify_internal_pb(mod_pb);
-
- slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
- slapi_pblock_destroy(mod_pb);
+ slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
+ slapi_modify_internal_pb(mod_pb);
+ slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
+ slapi_pblock_destroy(mod_pb);
+ }
slapi_mods_free(&smods);
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
11 years, 2 months
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/posix-winsync/posix-group-task.c | 21 ++++++++++--------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 74423d2eaef50949fd96ded8a2251834663e95e8
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Mon Feb 11 14:49:14 2013 -0800
Ticket #579 - Error messages encountered when using POSIX winsync
Bug description: posix_group_fix_memberuid_callback registered by
posixWinsyncCreateMemberOfTask calls an internal modify function
even if there are no attributes to fix up. The attempt fails as
expected, but it logs cryptic errors in the error log:
- slapi_modify_internal_set_pb: NULL parameter
- allow_operation: component identity is NULL
Fix description: This patch skips calling the fix up internal
modify if there is no attributes to fix up.
https://fedorahosted.org/389/ticket/579
Reviewed by Rich (Thank you!!)
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-task.c b/ldap/servers/plugins/posix-winsync/posix-group-task.c
index 8d9d8ac..2cb9a31 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-task.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-task.c
@@ -249,6 +249,7 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
char *dn = slapi_entry_get_dn(e);
Slapi_DN *sdn = slapi_entry_get_sdn(e);
+ LDAPMod **mods = NULL;
/* Clean out memberuids and dsonlymemberuids without a valid referant */
rc = slapi_entry_attr_find(e, "memberuid", &muid_attr);
@@ -379,17 +380,19 @@ posix_group_fix_memberuid_callback(Slapi_Entry *e, void *callback_data)
}
}
- Slapi_PBlock *mod_pb = slapi_pblock_new();
+ mods = slapi_mods_get_ldapmods_passout(smods);
+ if (mods) {
+ Slapi_PBlock *mod_pb = NULL;
+ mod_pb = slapi_pblock_new();
+ slapi_modify_internal_set_pb_ext(mod_pb, sdn, mods, 0, 0,
+ posix_winsync_get_plugin_identity(), 0);
- slapi_modify_internal_set_pb_ext(mod_pb, sdn, slapi_mods_get_ldapmods_passout(smods), 0, 0,
- posix_winsync_get_plugin_identity(), 0);
-
- slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
- slapi_modify_internal_pb(mod_pb);
-
- slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
- slapi_pblock_destroy(mod_pb);
+ slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);
+ slapi_modify_internal_pb(mod_pb);
+ slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
+ slapi_pblock_destroy(mod_pb);
+ }
slapi_mods_free(&smods);
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
11 years, 2 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/dna/dna.c | 78 ++++++++++++++++++++++++++++-------------
1 file changed, 54 insertions(+), 24 deletions(-)
New commits:
commit abe4a086e73be2c22fac9a1640d88a8d6b302674
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Fri Feb 8 12:13:14 2013 -0800
Ticket #576 - DNA: use event queue for config update only at the start up
https://fedorahosted.org/389/ticket/576
Bug description: DNA config updates were always put into the
event queue and executed in 30 seconds, which increased a chance
to conflict with the ordinary modify operations and cause db
deadlocks.
Fix description: The 30 seconds delay is necessary at the start-
up time when MMR is configured to guarantee the shared config is
logged in the changelog. This patch leaves the behaviour of the
config update at the start-up as it is; the rest won't be queued
but updated immediately.
Reviewed by Rich (Thank you!!)
(cherry picked from commit 7c11ed17796ba8b17afa5758fcfdf1c937b54ef4)
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 36dd936..6babe23 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -93,6 +93,7 @@
#define DNA_SHARED_CFG_DN "dnaSharedCfgDN"
/* Shared Config */
+#define DNA_SHAREDCONFIG "dnaSharedConfig"
#define DNA_REMAINING "dnaRemainingValues"
#define DNA_THRESHOLD "dnaThreshold"
#define DNA_HOSTNAME "dnaHostname"
@@ -219,7 +220,7 @@ static int dna_be_txn_preop_init(Slapi_PBlock *pb);
* Local operation functions
*
*/
-static int dna_load_plugin_config();
+static int dna_load_plugin_config(int use_eventq);
static int dna_parse_config_entry(Slapi_Entry * e, int apply);
static void dna_delete_config();
static void dna_free_config_entry(struct configEntry ** entry);
@@ -571,7 +572,7 @@ dna_start(Slapi_PBlock * pb)
slapi_ch_calloc(1, sizeof(struct configEntry));
PR_INIT_CLIST(dna_global_config);
- if (dna_load_plugin_config() != DNA_SUCCESS) {
+ if (dna_load_plugin_config(1/* use eventq */) != DNA_SUCCESS) {
slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
"dna_start: unable to load plug-in configuration\n");
return DNA_FAILURE;
@@ -639,7 +640,7 @@ done:
* ------ cn=etc etc
*/
static int
-dna_load_plugin_config()
+dna_load_plugin_config(int use_eventq)
{
int status = DNA_SUCCESS;
int result;
@@ -649,7 +650,8 @@ dna_load_plugin_config()
Slapi_Entry **entries = NULL;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
- "--> dna_load_plugin_config\n");
+ "--> dna_load_plugin_config %s\n",
+ use_eventq?"using event queue":"");
dna_write_lock();
dna_delete_config();
@@ -681,13 +683,18 @@ dna_load_plugin_config()
dna_parse_config_entry(entries[i], 1);
}
- /* Setup an event to update the shared config 30
- * seconds from now. We need to do this since
- * performing the operation at this point when
- * starting up would cause the change to not
- * get changelogged. */
- time(&now);
- slapi_eq_once(dna_update_config_event, NULL, now + 30);
+ if (use_eventq) {
+ /* Setup an event to update the shared config 30
+ * seconds from now. We need to do this since
+ * performing the operation at this point when
+ * starting up would cause the change to not
+ * get changelogged. */
+ time(&now);
+ slapi_eq_once(dna_update_config_event, NULL, now + 30);
+ } else {
+ int nolock = 1; /* no need to lock since dna write lock is held. */
+ dna_update_config_event(0, &nolock);
+ }
cleanup:
slapi_free_search_results_internal(search_pb);
@@ -1240,9 +1247,15 @@ dna_update_config_event(time_t event_time, void *arg)
Slapi_PBlock *pb = NULL;
struct configEntry *config_entry = NULL;
PRCList *list = NULL;
+ int nolock = 0;
- /* Get read lock to prevent config changes */
- dna_read_lock();
+ if (arg) {
+ nolock = *(int *)arg;
+ }
+ if (!nolock) {
+ /* Get read lock to prevent config changes */
+ dna_read_lock();
+ }
/* Bail out if the plug-in close function was just called. */
if (!g_plugin_started) {
@@ -1287,7 +1300,9 @@ dna_update_config_event(time_t event_time, void *arg)
}
bail:
- dna_unlock();
+ if (!nolock) {
+ dna_unlock();
+ }
slapi_pblock_destroy(pb);
}
@@ -2161,7 +2176,7 @@ dna_update_shared_config(struct configEntry * config_entry)
slapi_entry_init_ext(e, sdn, NULL); /* sdn is copied into e */
slapi_sdn_free(&sdn);
- slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, "dnaSharedConfig");
+ slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, DNA_SHAREDCONFIG);
slapi_entry_add_string(e, DNA_HOSTNAME, hostname);
slapi_entry_add_string(e, DNA_PORTNUM, portnum);
if (secureportnum) {
@@ -2770,6 +2785,7 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
char **generated_types = NULL;
PRUint64 setval = 0;
int i;
+ int issharedconfig = 0;
/* Bail out if the plug-in close function was just called. */
if (!g_plugin_started) {
@@ -2787,7 +2803,12 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
* We also check if we need to get the next range of values, and grab them.
* We do this here so we don't have to do it in the be_txn_preop.
*/
- dna_read_lock();
+ /* Has write lock for config entries. */
+ issharedconfig = slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+ DNA_SHAREDCONFIG);
+ if (!issharedconfig) {
+ dna_read_lock();
+ }
if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
list = PR_LIST_HEAD(dna_global_config);
@@ -2945,7 +2966,9 @@ next:
}
}
- dna_unlock();
+ if (!issharedconfig) {
+ dna_unlock();
+ }
slapi_ch_array_free(generated_types);
bail:
@@ -3314,7 +3337,7 @@ dna_pre_op(Slapi_PBlock * pb, int modtype)
ret = _dna_pre_op_add(pb, test_e, &errstr);
} else {
if((ret = _dna_pre_op_modify(pb, test_e, smods, &errstr))){
- slapi_mods_free(&smods);
+ slapi_mods_free(&smods);
}
}
if (ret) {
@@ -3404,6 +3427,7 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
char *type = NULL;
int numvals, e_numvals = 0;
int i, len, ret = 0;
+ int issharedconfig = 0;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"--> dna_be_txn_pre_op\n");
@@ -3439,7 +3463,12 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
slapi_mods_init_passin(smods, mods);
}
- dna_read_lock();
+ /* Has write lock for config entries. */
+ issharedconfig = slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+ DNA_SHAREDCONFIG);
+ if (!issharedconfig) {
+ dna_read_lock();
+ }
if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
list = PR_LIST_HEAD(dna_global_config);
@@ -3449,7 +3478,7 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
/* Did we already service all of these configured types? */
if (dna_list_contains_types(generated_types, config_entry->types)) {
- goto next;
+ goto next;
}
/* is the entry in scope? */
@@ -3626,12 +3655,13 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
} else if (types_to_generate) {
slapi_ch_free((void **)&types_to_generate);
}
- next:
+next:
list = PR_NEXT_LINK(list);
}
}
- dna_unlock();
-
+ if (!issharedconfig) {
+ dna_unlock();
+ }
bail:
if (LDAP_CHANGETYPE_MODIFY == modtype) {
@@ -3669,7 +3699,7 @@ static int dna_config_check_post_op(Slapi_PBlock * pb)
if (!slapi_op_internal(pb)) { /* If internal, no need to check. */
if ((dn = dna_get_dn(pb))) {
if (dna_dn_is_config(dn)) {
- dna_load_plugin_config();
+ dna_load_plugin_config(0);
}
}
}
11 years, 2 months
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/dna/dna.c | 78 ++++++++++++++++++++++++++++-------------
1 file changed, 54 insertions(+), 24 deletions(-)
New commits:
commit 7c11ed17796ba8b17afa5758fcfdf1c937b54ef4
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Fri Feb 8 12:13:14 2013 -0800
Ticket #576 - DNA: use event queue for config update only at the start up
https://fedorahosted.org/389/ticket/576
Bug description: DNA config updates were always put into the
event queue and executed in 30 seconds, which increased a chance
to conflict with the ordinary modify operations and cause db
deadlocks.
Fix description: The 30 seconds delay is necessary at the start-
up time when MMR is configured to guarantee the shared config is
logged in the changelog. This patch leaves the behaviour of the
config update at the start-up as it is; the rest won't be queued
but updated immediately.
Reviewed by Rich (Thank you!!)
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 36dd936..6babe23 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -93,6 +93,7 @@
#define DNA_SHARED_CFG_DN "dnaSharedCfgDN"
/* Shared Config */
+#define DNA_SHAREDCONFIG "dnaSharedConfig"
#define DNA_REMAINING "dnaRemainingValues"
#define DNA_THRESHOLD "dnaThreshold"
#define DNA_HOSTNAME "dnaHostname"
@@ -219,7 +220,7 @@ static int dna_be_txn_preop_init(Slapi_PBlock *pb);
* Local operation functions
*
*/
-static int dna_load_plugin_config();
+static int dna_load_plugin_config(int use_eventq);
static int dna_parse_config_entry(Slapi_Entry * e, int apply);
static void dna_delete_config();
static void dna_free_config_entry(struct configEntry ** entry);
@@ -571,7 +572,7 @@ dna_start(Slapi_PBlock * pb)
slapi_ch_calloc(1, sizeof(struct configEntry));
PR_INIT_CLIST(dna_global_config);
- if (dna_load_plugin_config() != DNA_SUCCESS) {
+ if (dna_load_plugin_config(1/* use eventq */) != DNA_SUCCESS) {
slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
"dna_start: unable to load plug-in configuration\n");
return DNA_FAILURE;
@@ -639,7 +640,7 @@ done:
* ------ cn=etc etc
*/
static int
-dna_load_plugin_config()
+dna_load_plugin_config(int use_eventq)
{
int status = DNA_SUCCESS;
int result;
@@ -649,7 +650,8 @@ dna_load_plugin_config()
Slapi_Entry **entries = NULL;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
- "--> dna_load_plugin_config\n");
+ "--> dna_load_plugin_config %s\n",
+ use_eventq?"using event queue":"");
dna_write_lock();
dna_delete_config();
@@ -681,13 +683,18 @@ dna_load_plugin_config()
dna_parse_config_entry(entries[i], 1);
}
- /* Setup an event to update the shared config 30
- * seconds from now. We need to do this since
- * performing the operation at this point when
- * starting up would cause the change to not
- * get changelogged. */
- time(&now);
- slapi_eq_once(dna_update_config_event, NULL, now + 30);
+ if (use_eventq) {
+ /* Setup an event to update the shared config 30
+ * seconds from now. We need to do this since
+ * performing the operation at this point when
+ * starting up would cause the change to not
+ * get changelogged. */
+ time(&now);
+ slapi_eq_once(dna_update_config_event, NULL, now + 30);
+ } else {
+ int nolock = 1; /* no need to lock since dna write lock is held. */
+ dna_update_config_event(0, &nolock);
+ }
cleanup:
slapi_free_search_results_internal(search_pb);
@@ -1240,9 +1247,15 @@ dna_update_config_event(time_t event_time, void *arg)
Slapi_PBlock *pb = NULL;
struct configEntry *config_entry = NULL;
PRCList *list = NULL;
+ int nolock = 0;
- /* Get read lock to prevent config changes */
- dna_read_lock();
+ if (arg) {
+ nolock = *(int *)arg;
+ }
+ if (!nolock) {
+ /* Get read lock to prevent config changes */
+ dna_read_lock();
+ }
/* Bail out if the plug-in close function was just called. */
if (!g_plugin_started) {
@@ -1287,7 +1300,9 @@ dna_update_config_event(time_t event_time, void *arg)
}
bail:
- dna_unlock();
+ if (!nolock) {
+ dna_unlock();
+ }
slapi_pblock_destroy(pb);
}
@@ -2161,7 +2176,7 @@ dna_update_shared_config(struct configEntry * config_entry)
slapi_entry_init_ext(e, sdn, NULL); /* sdn is copied into e */
slapi_sdn_free(&sdn);
- slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, "dnaSharedConfig");
+ slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, DNA_SHAREDCONFIG);
slapi_entry_add_string(e, DNA_HOSTNAME, hostname);
slapi_entry_add_string(e, DNA_PORTNUM, portnum);
if (secureportnum) {
@@ -2770,6 +2785,7 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
char **generated_types = NULL;
PRUint64 setval = 0;
int i;
+ int issharedconfig = 0;
/* Bail out if the plug-in close function was just called. */
if (!g_plugin_started) {
@@ -2787,7 +2803,12 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
* We also check if we need to get the next range of values, and grab them.
* We do this here so we don't have to do it in the be_txn_preop.
*/
- dna_read_lock();
+ /* Has write lock for config entries. */
+ issharedconfig = slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+ DNA_SHAREDCONFIG);
+ if (!issharedconfig) {
+ dna_read_lock();
+ }
if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
list = PR_LIST_HEAD(dna_global_config);
@@ -2945,7 +2966,9 @@ next:
}
}
- dna_unlock();
+ if (!issharedconfig) {
+ dna_unlock();
+ }
slapi_ch_array_free(generated_types);
bail:
@@ -3314,7 +3337,7 @@ dna_pre_op(Slapi_PBlock * pb, int modtype)
ret = _dna_pre_op_add(pb, test_e, &errstr);
} else {
if((ret = _dna_pre_op_modify(pb, test_e, smods, &errstr))){
- slapi_mods_free(&smods);
+ slapi_mods_free(&smods);
}
}
if (ret) {
@@ -3404,6 +3427,7 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
char *type = NULL;
int numvals, e_numvals = 0;
int i, len, ret = 0;
+ int issharedconfig = 0;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"--> dna_be_txn_pre_op\n");
@@ -3439,7 +3463,12 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
slapi_mods_init_passin(smods, mods);
}
- dna_read_lock();
+ /* Has write lock for config entries. */
+ issharedconfig = slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+ DNA_SHAREDCONFIG);
+ if (!issharedconfig) {
+ dna_read_lock();
+ }
if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
list = PR_LIST_HEAD(dna_global_config);
@@ -3449,7 +3478,7 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
/* Did we already service all of these configured types? */
if (dna_list_contains_types(generated_types, config_entry->types)) {
- goto next;
+ goto next;
}
/* is the entry in scope? */
@@ -3626,12 +3655,13 @@ static int dna_be_txn_pre_op(Slapi_PBlock *pb, int modtype)
} else if (types_to_generate) {
slapi_ch_free((void **)&types_to_generate);
}
- next:
+next:
list = PR_NEXT_LINK(list);
}
}
- dna_unlock();
-
+ if (!issharedconfig) {
+ dna_unlock();
+ }
bail:
if (LDAP_CHANGETYPE_MODIFY == modtype) {
@@ -3669,7 +3699,7 @@ static int dna_config_check_post_op(Slapi_PBlock * pb)
if (!slapi_op_internal(pb)) { /* If internal, no need to check. */
if ((dn = dna_get_dn(pb))) {
if (dna_dn_is_config(dn)) {
- dna_load_plugin_config();
+ dna_load_plugin_config(0);
}
}
}
11 years, 2 months
Branch '389-ds-base-1.2.11' - 3 commits - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/chainingdb/cb_instance.c | 192 ++++++++++++--------------
ldap/servers/slapd/add.c | 2
ldap/servers/slapd/attr.c | 95 ++++--------
ldap/servers/slapd/entrywsi.c | 2
ldap/servers/slapd/opshared.c | 1
ldap/servers/slapd/slap.h | 1
6 files changed, 128 insertions(+), 165 deletions(-)
New commits:
commit c73fc8354153106bb5ab3470a45d58a26aec0f59
Author: Mark Reynolds <mareynol(a)redhat.com>
Date: Fri May 11 13:00:50 2012 -0400
Ticket 367 - Invalid chaining config triggers a disk full error and shutdown
Bug Description: If you use the root DN for the chaining bind DN a error -2 (LDAP_LOCAL_ERROR)
is returned from the callback. This is the same error code for SLAPI_FAIL_DISKFULL.
Once the error -2 is retuned, the server thinks we are out of disk space and the
instance is shutdown.
Fix Description: Return -1, instead of -2(LDAP_LOCAL_ERROR)
https://fedorahosted.org/389/ticket/367
Note: also did a little code cleanup with indentation
Reviewed by:
(cherry picked from commit dc379838f8e4cfd2c736e8c2fb8366fb3b4f73d4)
diff --git a/ldap/servers/plugins/chainingdb/cb_instance.c b/ldap/servers/plugins/chainingdb/cb_instance.c
index 9a33916..8fb694a 100644
--- a/ldap/servers/plugins/chainingdb/cb_instance.c
+++ b/ldap/servers/plugins/chainingdb/cb_instance.c
@@ -511,15 +511,15 @@ int cb_instance_modify_config_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
*/
int
-cb_parse_instance_config_entry(cb_backend * cb, Slapi_Entry * e) {
-
- int rc =LDAP_SUCCESS;
- Slapi_Attr *attr = NULL;
- Slapi_Value *sval;
- const struct berval *attrValue;
- cb_backend_instance *inst=NULL;
- char *instname;
- char retmsg[CB_BUFSIZE];
+cb_parse_instance_config_entry(cb_backend * cb, Slapi_Entry * e)
+{
+ cb_backend_instance *inst = NULL;
+ Slapi_Attr *attr = NULL;
+ Slapi_Value *sval;
+ const struct berval *attrValue;
+ char *instname;
+ char retmsg[CB_BUFSIZE];
+ int rc = LDAP_SUCCESS;
CB_ASSERT(e!=NULL);
@@ -529,17 +529,17 @@ cb_parse_instance_config_entry(cb_backend * cb, Slapi_Entry * e) {
*/
if ( 0 == slapi_entry_attr_find( e, CB_CONFIG_INSTNAME, &attr )) {
- slapi_attr_first_value(attr, &sval);
- attrValue = slapi_value_get_berval(sval);
- instname=attrValue->bv_val;
+ slapi_attr_first_value(attr, &sval);
+ attrValue = slapi_value_get_berval(sval);
+ instname = attrValue->bv_val;
} else {
slapi_log_error( SLAPI_LOG_PLUGIN, CB_PLUGIN_SUBSYSTEM,
"Malformed backend instance (<%s> missing)>\n", CB_CONFIG_INSTNAME);
- return LDAP_LOCAL_ERROR;
+ return -1;
}
- /* Allocate a new backend internal data structure */
- inst = cb_instance_alloc(cb,instname,slapi_entry_get_dn(e));
+ /* Allocate a new backend internal data structure */
+ inst = cb_instance_alloc(cb,instname,slapi_entry_get_dn(e));
/* Emulate a add config entry to configure */
/* this backend instance. */
@@ -556,99 +556,96 @@ cb_parse_instance_config_entry(cb_backend * cb, Slapi_Entry * e) {
*/
static int
-cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int phase, int apply) {
-
- int rc =LDAP_SUCCESS;
- Slapi_Attr *attr = NULL;
- Slapi_Value *sval;
- struct berval * bval;
- int using_def_connlifetime,i;
- char err_buf[SLAPI_DSE_RETURNTEXT_SIZE];
- int urlfound=0;
- char *rootdn;
+cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int phase, int apply)
+{
+ Slapi_Attr *attr = NULL;
+ Slapi_Value *sval;
+ Slapi_DN *suffix;
+ struct berval *bval;
+ char err_buf[SLAPI_DSE_RETURNTEXT_SIZE];
+ char *attr_name = NULL;
+ char *rootdn;
+ int using_def_connlifetime, i;
+ int urlfound = 0;
+ int rc = LDAP_SUCCESS;
using_def_connlifetime=1;
- for (slapi_entry_first_attr(e, &attr); attr; slapi_entry_next_attr(e, attr, &attr)) {
- char * attr_name=NULL;
- slapi_attr_get_type(attr, &attr_name);
+ for (slapi_entry_first_attr(e, &attr); attr; slapi_entry_next_attr(e, attr, &attr)) {
+ attr_name = NULL;
+ slapi_attr_get_type(attr, &attr_name);
if ( !strcasecmp ( attr_name, CB_CONFIG_SUFFIX )) {
if (apply && ( inst->inst_be != NULL )) {
- Slapi_DN *suffix;
suffix = slapi_sdn_new();
- i = slapi_attr_first_value(attr, &sval);
- while (i != -1 ) {
- bval = (struct berval *) slapi_value_get_berval(sval);
- slapi_sdn_set_dn_byref(suffix, bval->bv_val);
-
- if (!slapi_be_issuffix(inst->inst_be, suffix)) {
- slapi_be_addsuffix(inst->inst_be, suffix);
- }
- i = slapi_attr_next_value(attr, i, &sval);
- }
+ i = slapi_attr_first_value(attr, &sval);
+ while (i != -1 ) {
+ bval = (struct berval *) slapi_value_get_berval(sval);
+ slapi_sdn_set_dn_byref(suffix, bval->bv_val);
+
+ if (!slapi_be_issuffix(inst->inst_be, suffix)) {
+ slapi_be_addsuffix(inst->inst_be, suffix);
+ }
+ i = slapi_attr_next_value(attr, i, &sval);
+ }
slapi_sdn_free(&suffix);
}
- continue;
- } else
- if ( !strcasecmp ( attr_name, CB_CONFIG_CHAINING_COMPONENTS )) {
-
- if (apply) {
- slapi_rwlock_wrlock(inst->rwl_config_lock);
- i = slapi_attr_first_value(attr, &sval);
+ continue;
+ } else if ( !strcasecmp ( attr_name, CB_CONFIG_CHAINING_COMPONENTS )) {
+ if (apply) {
+ slapi_rwlock_wrlock(inst->rwl_config_lock);
+ i = slapi_attr_first_value(attr, &sval);
charray_free(inst->chaining_components);
inst->chaining_components=NULL;
- while (i != -1 ) {
- bval = (struct berval *) slapi_value_get_berval(sval);
+ while (i != -1 ) {
+ bval = (struct berval *) slapi_value_get_berval(sval);
charray_add(&inst->chaining_components,
- slapi_dn_normalize(slapi_ch_strdup(bval->bv_val)));
- i = slapi_attr_next_value(attr, i, &sval);
- }
- slapi_rwlock_unlock(inst->rwl_config_lock);
- }
- continue;
- } else
- if ( !strcasecmp ( attr_name, CB_CONFIG_ILLEGAL_ATTRS )) {
-
- if (apply) {
- slapi_rwlock_wrlock(inst->rwl_config_lock);
- i = slapi_attr_first_value(attr, &sval);
+ slapi_dn_normalize(slapi_ch_strdup(bval->bv_val)));
+ i = slapi_attr_next_value(attr, i, &sval);
+ }
+ slapi_rwlock_unlock(inst->rwl_config_lock);
+ }
+ continue;
+ } else if ( !strcasecmp ( attr_name, CB_CONFIG_ILLEGAL_ATTRS )) {
+ if (apply) {
+ slapi_rwlock_wrlock(inst->rwl_config_lock);
+ i = slapi_attr_first_value(attr, &sval);
charray_free(inst->illegal_attributes);
inst->illegal_attributes=NULL;
- while (i != -1 ) {
- bval = (struct berval *) slapi_value_get_berval(sval);
+ while (i != -1 ) {
+ bval = (struct berval *) slapi_value_get_berval(sval);
charray_add(&inst->illegal_attributes,
- slapi_ch_strdup(bval->bv_val));
- i = slapi_attr_next_value(attr, i, &sval);
- }
- slapi_rwlock_unlock(inst->rwl_config_lock);
- }
- continue;
+ slapi_ch_strdup(bval->bv_val));
+ i = slapi_attr_next_value(attr, i, &sval);
+ }
+ slapi_rwlock_unlock(inst->rwl_config_lock);
+ }
+ continue;
}
if ( !strcasecmp ( attr_name, CB_CONFIG_HOSTURL )) {
urlfound=1;
}
-
- /* We are assuming that each of these attributes are to have
- * only one value. If they have more than one value, like
- * the nsslapd-suffix attribute, then they need to be
- * handled differently. */
+ /*
+ * We are assuming that each of these attributes are to have
+ * only one value. If they have more than one value, like
+ * the nsslapd-suffix attribute, then they need to be
+ * handled differently.
+ */
- slapi_attr_first_value(attr, &sval);
- bval = (struct berval *) slapi_value_get_berval(sval);
-
- if (cb_instance_config_set((void *) inst, attr_name,
+ slapi_attr_first_value(attr, &sval);
+ bval = (struct berval *) slapi_value_get_berval(sval);
+
+ if (cb_instance_config_set((void *) inst, attr_name,
cb_the_instance_config, bval, err_buf, phase, apply ) != LDAP_SUCCESS) {
- slapi_log_error( SLAPI_LOG_FATAL,
- CB_PLUGIN_SUBSYSTEM,"Error with config attribute %s : %s\n",
+ slapi_log_error( SLAPI_LOG_FATAL, CB_PLUGIN_SUBSYSTEM,"Error with config attribute %s : %s\n",
attr_name, err_buf);
- rc=LDAP_LOCAL_ERROR;
- break;
- }
- if ( !strcasecmp ( attr_name, CB_CONFIG_CONNLIFETIME )) {
+ rc = -1;
+ break;
+ }
+ if ( !strcasecmp ( attr_name, CB_CONFIG_CONNLIFETIME )) {
using_def_connlifetime=0;
}
}
@@ -661,20 +658,17 @@ cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int
if (LDAP_SUCCESS == rc) {
if (!urlfound) {
- slapi_log_error( SLAPI_LOG_FATAL, CB_PLUGIN_SUBSYSTEM,
- "Malformed backend instance entry. Mandatory attr <%s> missing\n",
- CB_CONFIG_HOSTURL);
- rc= LDAP_LOCAL_ERROR;
+ slapi_log_error( SLAPI_LOG_FATAL, CB_PLUGIN_SUBSYSTEM,
+ "Malformed backend instance entry. Mandatory attr <%s> missing\n",CB_CONFIG_HOSTURL);
+ rc = -1;
}
if (apply ) {
- if ( using_def_connlifetime &&
- strchr( inst->pool->hostname, ' ' ) != NULL ) {
-
- cb_instance_config_set((void *)inst, CB_CONFIG_CONNLIFETIME,
- cb_the_instance_config, NULL /* use default */, err_buf,
+ if ( using_def_connlifetime && strchr( inst->pool->hostname, ' ' ) != NULL ) {
+ cb_instance_config_set((void *)inst, CB_CONFIG_CONNLIFETIME,
+ cb_the_instance_config, NULL /* use default */, err_buf,
CB_CONFIG_PHASE_INITIALIZATION, 1 );
- }
+ }
}
}
@@ -683,15 +677,13 @@ cb_instance_config_initialize(cb_backend_instance * inst, Slapi_Entry * e , int
** It is forbidden to use directory manager as proxy user
** due to a bug in the acl check
*/
-
- rootdn=cb_get_rootdn();
+ rootdn = cb_get_rootdn();
if (inst->impersonate && inst->pool && inst->pool->binddn &&
!strcmp(inst->pool->binddn,rootdn)) { /* UTF8 aware */
- slapi_log_error( SLAPI_LOG_FATAL,
- CB_PLUGIN_SUBSYSTEM,"Error with config attribute %s (%s: forbidden value)\n",
- CB_CONFIG_BINDUSER, rootdn);
- rc=LDAP_LOCAL_ERROR;
+ slapi_log_error( SLAPI_LOG_FATAL, CB_PLUGIN_SUBSYSTEM,
+ "Error with config attribute %s (%s: forbidden value)\n", CB_CONFIG_BINDUSER, rootdn);
+ rc= -1;
}
slapi_ch_free((void **)&rootdn);
@@ -1494,7 +1486,7 @@ struct berval *bval, char *err_buf, int phase, int apply_mod)
int use_default;
int int_val;
long long_val;
- int retval=LDAP_LOCAL_ERROR;
+ int retval = -1;
config = cb_get_config_info(config_array, attr_name);
if (NULL == config) {
commit 5c0193233288c30522b63cae0fd86c9299751588
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Tue Feb 5 14:56:12 2013 -0800
Ticket 570 - DS returns error 20 when replacing values of a multi-valued attribute (only when replication is enabled)
Bug Description: When replacing an attr value "SOME_VALUE" with "some_value", and replication
is enabled, an error 20(type or value exists) is incorrectly returned.
Fix Description: For replace operations we were doing a bit-by-bit comparison. Ignoring the syntax
of the attribute. The fix was to remove this bit-by-bit check that is no longer
necessary with the current code base.
https://fedorahosted.org/389/ticket/570
Reviewed by: ?
(cherry picked and fixed conflicts from commit 1c3bf98303c04323542251f1c564c8bdc4e8cc67)
diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c
index 2dc2a80..87dfe1e 100644
--- a/ldap/servers/slapd/attr.c
+++ b/ldap/servers/slapd/attr.c
@@ -534,76 +534,45 @@ slapi_attr_flag_is_set( const Slapi_Attr *a, unsigned long flag )
int
slapi_attr_value_cmp( const Slapi_Attr *a, const struct berval *v1, const struct berval *v2 )
{
- int retVal;
+ Slapi_Attr a2 = *a;
+ struct ava ava;
+ Slapi_Value *cvals[2];
+ Slapi_Value tmpcval;
- if ( a->a_flags & SLAPI_ATTR_FLAG_CMP_BITBYBIT )
- {
- int cmplen = ( v1->bv_len <= v2->bv_len ? v1->bv_len : v2->bv_len );
- retVal = memcmp(v1->bv_val, v2->bv_val, cmplen);
- if ( retVal == 0 && v1->bv_len < v2->bv_len )
- {
- retVal = -1;
- }
- else if ( retVal == 0 && v1->bv_len > v2->bv_len )
- {
- retVal = 1;
- }
- }
- else
- {
- Slapi_Attr a2;
- struct ava ava;
- Slapi_Value *cvals[2];
- Slapi_Value tmpcval;
-
- a2 = *a;
- cvals[0] = &tmpcval;
- cvals[0]->v_csnset = NULL;
- cvals[0]->bv = *v1;
- cvals[0]->v_flags = 0;
- cvals[1] = NULL;
- a2.a_present_values.va = cvals; /* JCM - PUKE */
- ava.ava_type = a->a_type;
- ava.ava_value = *v2;
- ava.ava_private = NULL;
- retVal = plugin_call_syntax_filter_ava(&a2, LDAP_FILTER_EQUALITY, &ava);
- }
- return retVal;
+ cvals[0] = &tmpcval;
+ cvals[0]->v_csnset = NULL;
+ cvals[0]->bv = *v1;
+ cvals[0]->v_flags = 0;
+ cvals[1] = NULL;
+ a2.a_present_values.va = cvals; /* JCM - PUKE */
+ ava.ava_type = a->a_type;
+ ava.ava_value = *v2;
+ ava.ava_private = NULL;
+
+ return( plugin_call_syntax_filter_ava(&a2, LDAP_FILTER_EQUALITY, &ava));
}
int
slapi_attr_value_cmp_ext(const Slapi_Attr *a, Slapi_Value *v1, Slapi_Value *v2)
{
- int retVal;
- const struct berval *bv2 = slapi_value_get_berval(v2);
+ struct ava ava;
+ Slapi_Attr a2 = *a;
+ Slapi_Value *cvals[2];
+ unsigned long v2_flags = v2->v_flags;
+ const struct berval *bv2 = slapi_value_get_berval(v2);
+
+ cvals[0] = v1;
+ cvals[1] = NULL;
+ a2.a_present_values.va = cvals;
+ ava.ava_type = a->a_type;
+ ava.ava_value = *bv2;
+ if (v2_flags) {
+ ava.ava_private = &v2_flags;
+ } else {
+ ava.ava_private = NULL;
+ }
- if ( a->a_flags & SLAPI_ATTR_FLAG_CMP_BITBYBIT )
- {
- const struct berval *bv1 = slapi_value_get_berval(v1);
- return slapi_attr_value_cmp(a, bv1, bv2);
- }
- else
- {
- Slapi_Attr a2;
- struct ava ava;
- Slapi_Value *cvals[2];
- unsigned long v2_flags = v2->v_flags;
-
- a2 = *a;
- cvals[0] = v1;
- cvals[1] = NULL;
- a2.a_present_values.va = cvals; /* JCM - PUKE */
-
- ava.ava_type = a->a_type;
- ava.ava_value = *bv2;
- if (v2_flags) {
- ava.ava_private = &v2_flags;
- } else {
- ava.ava_private = NULL;
- }
- retVal = plugin_call_syntax_filter_ava(&a2, LDAP_FILTER_EQUALITY, &ava);
- }
- return retVal;
+ return (plugin_call_syntax_filter_ava(&a2, LDAP_FILTER_EQUALITY, &ava));
}
/*
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 0419864..971e9e3 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -709,7 +709,7 @@ entry_replace_present_values_wsi(Slapi_Entry *e, const char *type, struct berval
* slapi_entry_add_values() returns LDAP_SUCCESS and so the
* attribute remains deleted (which is the correct outcome).
*/
- return( entry_add_present_values_wsi( e, type, vals, csn, urp, SLAPI_ATTR_FLAG_CMP_BITBYBIT ));
+ return( entry_add_present_values_wsi( e, type, vals, csn, urp, 0));
}
/*
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index e3cbc72..eea025a 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -510,7 +510,6 @@ typedef struct asyntaxinfo {
if any */
#define SLAPI_ATTR_FLAG_NOLOCKING 0x0020 /* the init code doesn't lock the
tables */
-#define SLAPI_ATTR_FLAG_CMP_BITBYBIT 0x4000 /* do memcmp, not syntax cmp */
#define SLAPI_ATTR_FLAG_KEEP 0x8000 /* keep when replacing all */
/* This is the type of the function passed into attr_syntax_enumerate_attrs */
commit 39d4108d254d44e0d7b5ea9de5ce75cea7aa7f63
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Tue Feb 5 13:53:11 2013 -0800
Bug 906005 - Valgrind reports memleak in modify_update_last_modified_attr
Fix description: plugin_get_dn returns plugin_dn, which is supposed
to be freed by the caller. This patch adds the free function to
modify_update_last_modified_attr, add_created_attrs and
add_internal_modifiersname.
(cherry picked from commit d895373022b93282da6310a12b2c82ea56b28d7a)
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 3206d5b..44a9aa2 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -789,6 +789,7 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
}
slapi_entry_attr_replace(e, "internalCreatorsName", bvals);
slapi_entry_attr_replace(e, "internalModifiersName", bvals);
+ slapi_ch_free_string(&plugin_dn);
/* Grab the thread data(binddn) */
slapi_td_get_dn(&binddn);
@@ -1014,6 +1015,7 @@ add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e)
plugin_dn = plugin_get_dn (plugin);
if(plugin_dn){
slapi_entry_attr_set_charptr(e, "internalModifiersname", plugin_dn);
+ slapi_ch_free_string(&plugin_dn);
}
}
}
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 485763e..fabe8a4 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -178,6 +178,7 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
}
slapi_mods_add_modbvps(smods, LDAP_MOD_REPLACE | LDAP_MOD_BVALUES,
"internalModifiersName", bvals);
+ slapi_ch_free_string(&plugin_dn);
/* Grab the thread data(binddn) */
slapi_td_get_dn(&binddn);
11 years, 3 months
Branch '389-ds-base-1.2.11' - ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/60upgradeschemafiles.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit dbef082f71a15c0e2fa98833b822efab4771f8a3
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Tue Feb 5 10:52:03 2013 -0800
Ticket #572 - PamConfig schema not updated during upgrade
Bug description: PAM passthrough schema was not upgraded in the
upgrade from 389-ds-base-1.2.10.2 to 389-ds-base-1.2.11.15.
Fix description: This patch adds 60pam-plugin.ldif to the upgrade
schema file list.
Reviewed by Nathan (Thank you!!)
(cherry picked from commit ac6b2c94bb32fc47870a56e8f7fc109ea81a3f47)
diff --git a/ldap/admin/src/scripts/60upgradeschemafiles.pl b/ldap/admin/src/scripts/60upgradeschemafiles.pl
index c308716..1208f4d 100644
--- a/ldap/admin/src/scripts/60upgradeschemafiles.pl
+++ b/ldap/admin/src/scripts/60upgradeschemafiles.pl
@@ -11,7 +11,7 @@ sub runinst {
# these schema files are obsolete, or we want to replace
# them with newer versions
- my @toremove = qw(00core.ldif 01core389.ldif 01common.ldif 02common.ldif 05rfc2247.ldif 05rfc4523.ldif 05rfc4524.ldif 06inetorgperson.ldif 10presence.ldif 28pilot.ldif 30ns-common.ldif 50ns-directory.ldif 60mozilla.ldif 60sudo.ldif);
+ my @toremove = qw(00core.ldif 01core389.ldif 01common.ldif 02common.ldif 05rfc2247.ldif 05rfc4523.ldif 05rfc4524.ldif 06inetorgperson.ldif 10presence.ldif 28pilot.ldif 30ns-common.ldif 50ns-directory.ldif 60mozilla.ldif 60pam-plugin.ldif 60sudo.ldif);
# these hashes will be used to check for obsolete schema
# in 99user.ldif
11 years, 3 months
ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/60upgradeschemafiles.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit ac6b2c94bb32fc47870a56e8f7fc109ea81a3f47
Author: Noriko Hosoi <nhosoi(a)totoro.usersys.redhat.com>
Date: Tue Feb 5 10:52:03 2013 -0800
Ticket #572 - PamConfig schema not updated during upgrade
Bug description: PAM passthrough schema was not upgraded in the
upgrade from 389-ds-base-1.2.10.2 to 389-ds-base-1.2.11.15.
Fix description: This patch adds 60pam-plugin.ldif to the upgrade
schema file list.
Reviewed by Nathan (Thank you!!)
diff --git a/ldap/admin/src/scripts/60upgradeschemafiles.pl b/ldap/admin/src/scripts/60upgradeschemafiles.pl
index c308716..1208f4d 100644
--- a/ldap/admin/src/scripts/60upgradeschemafiles.pl
+++ b/ldap/admin/src/scripts/60upgradeschemafiles.pl
@@ -11,7 +11,7 @@ sub runinst {
# these schema files are obsolete, or we want to replace
# them with newer versions
- my @toremove = qw(00core.ldif 01core389.ldif 01common.ldif 02common.ldif 05rfc2247.ldif 05rfc4523.ldif 05rfc4524.ldif 06inetorgperson.ldif 10presence.ldif 28pilot.ldif 30ns-common.ldif 50ns-directory.ldif 60mozilla.ldif 60sudo.ldif);
+ my @toremove = qw(00core.ldif 01core389.ldif 01common.ldif 02common.ldif 05rfc2247.ldif 05rfc4523.ldif 05rfc4524.ldif 06inetorgperson.ldif 10presence.ldif 28pilot.ldif 30ns-common.ldif 50ns-directory.ldif 60mozilla.ldif 60pam-plugin.ldif 60sudo.ldif);
# these hashes will be used to check for obsolete schema
# in 99user.ldif
11 years, 3 months