ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/repl5_inc_protocol.c | 14 ++++++
ldap/servers/plugins/replication/repl5_protocol.c | 38 +++++++++++-------
ldap/servers/plugins/replication/repl5_tot_protocol.c | 18 ++++++++
3 files changed, 56 insertions(+), 14 deletions(-)
New commits:
commit 04a0bd9ada0b3dd8efae67b63421dfa31e15b051
Author: Noriko Hosoi <nhosoi(a)jiji.sjc.redhat.com>
Date: Sun Mar 21 17:13:18 2010 -0700
548533 - memory leak in Repl_5_Inc_Protocol_new
https://bugzilla.redhat.com/show_bug.cgi?id=548533
Description: repl5_inc_delete and repl5_tot_delete to release the
incremental and total update protocol were not implemented. This
fix implemented them. Also, it fixed a leak of connection in
private_protocol_factory.
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 4e733de..d999d3b 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -511,7 +511,21 @@ static void
repl5_inc_delete(Private_Repl_Protocol **prpp)
{
/* First, stop the protocol if it isn't already stopped */
+ if (!(*prpp)->stopped) {
+ (*prpp)->stopped = 1;
+ (*prpp)->stop(*prpp);
+ }
/* Then, delete all resources used by the protocol */
+ if ((*prpp)->lock) {
+ PR_DestroyLock((*prpp)->lock);
+ (*prpp)->lock = NULL;
+ }
+ if ((*prpp)->cvar) {
+ PR_DestroyCondVar((*prpp)->cvar);
+ (*prpp)->cvar = NULL;
+ }
+ slapi_ch_free((void **)&(*prpp)->private);
+ slapi_ch_free((void **)prpp);
}
/* helper function */
diff --git a/ldap/servers/plugins/replication/repl5_protocol.c b/ldap/servers/plugins/replication/repl5_protocol.c
index efb3271..31f6072 100644
--- a/ldap/servers/plugins/replication/repl5_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_protocol.c
@@ -109,11 +109,7 @@ prot_new(Repl_Agmt *agmt, int protocol_state)
goto loser;
}
rp->agmt = agmt;
- /* now done in private_protocol_factory
- if ((rp->conn = conn_new(agmt)) == NULL)
- {
- goto loser;
- } */
+ rp->conn = NULL;
/* Acquire the local replica object */
replarea_sdn = agmt_get_replarea(agmt);
rp->replica_object = replica_get_replica_from_dn(replarea_sdn);
@@ -585,20 +581,36 @@ private_protocol_factory(Repl_Protocol *rp, int type)
switch (type)
{
case PROTOCOL_5_INCREMENTAL:
- if ((rp->conn = conn_new(rp->agmt)) != NULL)
- prp = Repl_5_Inc_Protocol_new(rp);
+ if (NULL == rp->conn) {
+ rp->conn = conn_new(rp->agmt);
+ }
+ if (NULL != rp->conn) {
+ prp = Repl_5_Inc_Protocol_new(rp);
+ }
break;
case PROTOCOL_5_TOTAL:
- if ((rp->conn = conn_new(rp->agmt)) != NULL)
- prp = Repl_5_Tot_Protocol_new(rp);
+ if (NULL == rp->conn) {
+ rp->conn = conn_new(rp->agmt);
+ }
+ if (NULL != rp->conn) {
+ prp = Repl_5_Tot_Protocol_new(rp);
+ }
break;
case PROTOCOL_WINDOWS_INCREMENTAL:
- if ((rp->conn = windows_conn_new(rp->agmt)) != NULL)
- prp = Windows_Inc_Protocol_new(rp);
+ if (NULL == rp->conn) {
+ rp->conn = windows_conn_new(rp->agmt);
+ }
+ if (NULL != rp->conn) {
+ prp = Windows_Inc_Protocol_new(rp);
+ }
break;
case PROTOCOL_WINDOWS_TOTAL:
- if ((rp->conn = windows_conn_new(rp->agmt)) != NULL)
- prp = Windows_Tot_Protocol_new(rp);
+ if (NULL == rp->conn) {
+ rp->conn = windows_conn_new(rp->agmt);
+ }
+ if (NULL != rp->conn) {
+ prp = Windows_Tot_Protocol_new(rp);
+ }
break;
}
return prp;
diff --git a/ldap/servers/plugins/replication/repl5_tot_protocol.c b/ldap/servers/plugins/replication/repl5_tot_protocol.c
index 11c8255..7bd6e25 100644
--- a/ldap/servers/plugins/replication/repl5_tot_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_tot_protocol.c
@@ -584,8 +584,24 @@ loser:
}
static void
-repl5_tot_delete(Private_Repl_Protocol **prp)
+repl5_tot_delete(Private_Repl_Protocol **prpp)
{
+ /* First, stop the protocol if it isn't already stopped */
+ if (!(*prpp)->stopped) {
+ (*prpp)->stopped = 1;
+ (*prpp)->stop(*prpp);
+ }
+ /* Then, delete all resources used by the protocol */
+ if ((*prpp)->lock) {
+ PR_DestroyLock((*prpp)->lock);
+ (*prpp)->lock = NULL;
+ }
+ if ((*prpp)->cvar) {
+ PR_DestroyCondVar((*prpp)->cvar);
+ (*prpp)->cvar = NULL;
+ }
+ slapi_ch_free((void **)&(*prpp)->private);
+ slapi_ch_free((void **)prpp);
}
static
14 years, 1 month
Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/import.c | 12 ++++++++++++
ldap/servers/slapd/task.c | 8 ++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
New commits:
commit 02514d67c9929406b2b57792f0954c934f7d8464
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 19 10:24:32 2010 -0700
515805 - Stop "initialize Database" crashes the server
https://bugzilla.redhat.com/show_bug.cgi?id=515805
Fix Description:
SLAPI_TASK_CANCELLED could be set in task_modify any time by
users' modifying nsTaskCancel value to TRUE. Then the following
slapi_task_status_changed destroys the task, which is called
even via a simple logging call slapi_task_log_status. After the
task is destroyed, any task related calls such as another
slapi_task_log_status or slapi_task_finish crashes the server.
This fix changes the behaviour to destroy the task only when
task_state is SLAPI_TASK_FINISHED. Once SLAPI_TASK_CANCELLED
is set to task_state, changing the state to SLAPI_TASK_FINISHED
by calling slapi_task_finish is the responsibility of the task
application (e.g., import). Until then, it is guranteed that
the task is available.
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 7606739..df0fa5d 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1075,6 +1075,7 @@ int import_main_offline(void *arg)
int finished = 0;
int status = 0;
int verbose = 1;
+ int aborted = 0;
ImportWorkerInfo *producer = NULL;
if (job->task)
@@ -1193,6 +1194,7 @@ int import_main_offline(void *arg)
*/
import_set_abort_flag_all(job, 1);
import_log_notice(job, "Import threads aborted.");
+ aborted = 1;
goto error;
}
@@ -1294,6 +1296,16 @@ error:
/* If we fail, the database is now in a mess, so we delete it */
import_log_notice(job, "Closing files...");
cache_clear(&job->inst->inst_cache);
+ if (aborted) {
+ /* If aborted, it's safer to rebuild the cache. */
+ cache_destroy_please(&job->inst->inst_cache);
+ /* initialize the entry cache */
+ if (! cache_init(&(inst->inst_cache), DEFAULT_CACHE_SIZE,
+ DEFAULT_CACHE_ENTRIES)) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "import_main_offline: "
+ "cache_init failed. Server should be restarted.\n");
+ }
+ }
if (0 != ret) {
dblayer_delete_instance_dir(be);
dblayer_instance_close(job->inst->inst_be);
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index 67109b2..733618f 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -309,8 +309,11 @@ void slapi_task_status_changed(Slapi_Task *task)
for (i = 0; i < cur; i++)
slapi_ch_free((void **)&modlist[i].mod_values);
- if (((task->task_state == SLAPI_TASK_FINISHED) ||
- (task->task_state == SLAPI_TASK_CANCELLED)) &&
+ /*
+ * Removed (task->task_state == SLAPI_TASK_CANCELLED) from
+ * task_state checking to fix bz 515805.
+ */
+ if ((task->task_state == SLAPI_TASK_FINISHED) &&
!(task->task_flags & SLAPI_TASK_DESTROYING)) {
Slapi_PBlock *pb = slapi_pblock_new();
Slapi_Entry *e;
@@ -664,6 +667,7 @@ static void task_generic_destructor(Slapi_Task *task)
}
if (task->task_log_lock) {
PR_DestroyLock(task->task_log_lock);
+ task->task_log_lock = NULL;
}
task->task_log = task->task_status = NULL;
}
14 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/import.c | 22 ++++++++++++++++++++++
ldap/servers/slapd/task.c | 8 ++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
New commits:
commit 6236bb36b7afddceb41528f31f604f8940a752f2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Mar 18 11:52:17 2010 -0700
515805 - Stop "initialize Database" crashes the server
https://bugzilla.redhat.com/show_bug.cgi?id=515805
Fix Description:
SLAPI_TASK_CANCELLED could be set in task_modify any time by
users' modifying nsTaskCancel value to TRUE. Then the following
slapi_task_status_changed destroys the task, which is called
even via a simple logging call slapi_task_log_status. After the
task is destroyed, any task related calls such as another
slapi_task_log_status or slapi_task_finish crashes the server.
This fix changes the behaviour to destroy the task only when
task_state is SLAPI_TASK_FINISHED. Once SLAPI_TASK_CANCELLED
is set to task_state, changing the state to SLAPI_TASK_FINISHED
by calling slapi_task_finish is the responsibility of the task
application (e.g., import). Until then, it is guranteed that
the task is available.
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index bd44275..9939b65 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -1076,6 +1076,7 @@ int import_main_offline(void *arg)
int finished = 0;
int status = 0;
int verbose = 1;
+ int aborted = 0;
ImportWorkerInfo *producer = NULL;
if (job->task)
@@ -1194,6 +1195,7 @@ int import_main_offline(void *arg)
*/
import_set_abort_flag_all(job, 1);
import_log_notice(job, "Import threads aborted.");
+ aborted = 1;
goto error;
}
@@ -1301,6 +1303,26 @@ error:
if (entryrdn_get_switch()) {
cache_clear(&job->inst->inst_dncache, CACHE_TYPE_DN);
}
+ if (aborted) {
+ /* If aborted, it's safer to rebuild the caches. */
+ cache_destroy_please(&job->inst->inst_cache, CACHE_TYPE_ENTRY);
+ if (entryrdn_get_switch()) { /* subtree-rename: on */
+ cache_destroy_please(&job->inst->inst_dncache, CACHE_TYPE_DN);
+ }
+ /* initialize the entry cache */
+ if (! cache_init(&(inst->inst_cache), DEFAULT_CACHE_SIZE,
+ DEFAULT_CACHE_ENTRIES, CACHE_TYPE_ENTRY)) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "import_main_offline: "
+ "cache_init failed. Server should be restarted.\n");
+ }
+
+ /* initialize the dn cache */
+ if (! cache_init(&(inst->inst_dncache), DEFAULT_DNCACHE_SIZE,
+ DEFAULT_DNCACHE_MAXCOUNT, CACHE_TYPE_DN)) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "import_main_offline: "
+ "dn cache_init failed. Server should be restarted.\n");
+ }
+ }
if (0 != ret) {
dblayer_delete_instance_dir(be);
dblayer_instance_close(job->inst->inst_be);
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index 67109b2..733618f 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -309,8 +309,11 @@ void slapi_task_status_changed(Slapi_Task *task)
for (i = 0; i < cur; i++)
slapi_ch_free((void **)&modlist[i].mod_values);
- if (((task->task_state == SLAPI_TASK_FINISHED) ||
- (task->task_state == SLAPI_TASK_CANCELLED)) &&
+ /*
+ * Removed (task->task_state == SLAPI_TASK_CANCELLED) from
+ * task_state checking to fix bz 515805.
+ */
+ if ((task->task_state == SLAPI_TASK_FINISHED) &&
!(task->task_flags & SLAPI_TASK_DESTROYING)) {
Slapi_PBlock *pb = slapi_pblock_new();
Slapi_Entry *e;
@@ -664,6 +667,7 @@ static void task_generic_destructor(Slapi_Task *task)
}
if (task->task_log_lock) {
PR_DestroyLock(task->task_log_lock);
+ task->task_log_lock = NULL;
}
task->task_log = task->task_status = NULL;
}
14 years, 1 month
esc/mac/Tokend-35209 Info-tokend__Upgraded_.plist, 1.1, 1.2
by Jack Magne
Author: jmagne
Update of /cvs/dirsec/esc/mac/Tokend-35209
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv17335
Added Files:
Info-tokend__Upgraded_.plist
Log Message:
Add needed plist file.
Index: Info-tokend__Upgraded_.plist
===================================================================
RCS file: Info-tokend__Upgraded_.plist
diff -N Info-tokend__Upgraded_.plist
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Info-tokend__Upgraded_.plist 18 Mar 2010 22:22:25 -0000 1.2
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict/>
+</plist>
14 years, 1 month
mod_nss nss.conf.in,1.10,1.11
by Rob Crittenden
Author: rcritten
Update of /cvs/dirsec/mod_nss
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20786
Modified Files:
nss.conf.in
Log Message:
Add TLS renegotiation options to the configuration file
Index: nss.conf.in
===================================================================
RCS file: /cvs/dirsec/mod_nss/nss.conf.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- nss.conf.in 20 Oct 2006 15:23:39 -0000 1.10
+++ nss.conf.in 18 Mar 2010 18:34:46 -0000 1.11
@@ -64,6 +64,17 @@
#NSSRandomSeed startup file:/dev/random 512
#NSSRandomSeed startup file:/dev/urandom 512
+#
+# TLS Negotiation configuration under RFC 5746
+#
+# Only renegotiate if the peer's hello bears the TLS renegotiation_info
+# extension. Default off.
+NSSRenegotiation off
+
+# Peer must send Signaling Cipher Suite Value (SCSV) or
+# Renegotiation Info (RI) extension in ALL handshakes. Default: off
+NSSRequireSafeNegotiation off
+
##
## SSL Virtual Host Context
##
14 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/modrdn.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit d06cce8da19faba2a8d664c28123cda5808610c9
Author: Endi S. Dewata <edewata(a)redhat.com>
Date: Wed Mar 17 16:05:53 2010 -0500
Bug 573375 - MODRDN operation not logged
https://bugzilla.redhat.com/show_bug.cgi?id=573375
Resolves: bug 573375
Bug Description: MODRDN operation not logged
Fix Description: The slapi_log_access() should be invoked using
LDAP_DEBUG_STATS, LDAP_DEBUG_STATS2, or LDAP_DEBUG_ARGS level.
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 7873c80..b70377a 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -352,7 +352,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
{
if ( !internal_op )
{
- slapi_log_access(SLAPI_LOG_ARGS,
+ slapi_log_access(LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
pb->pb_conn->c_connid,
pb->pb_op->o_opid,
@@ -362,7 +362,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
}
else
{
- slapi_log_access(SLAPI_LOG_ARGS,
+ slapi_log_access(LDAP_DEBUG_ARGS,
"conn=%s op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"\n",
LOG_INTERNAL_OP_CON_ID,
LOG_INTERNAL_OP_OP_ID,
14 years, 1 month
console/src/com/netscape/management/client/console Console.java, 1.16, 1.17
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/console/src/com/netscape/management/client/console
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32522/src/com/netscape/management/client/console
Modified Files:
Console.java
Log Message:
Bug 521108 - Customer is unable to add a new Role within RHDS 8.1.0.
https://bugzilla.redhat.com/show_bug.cgi?id=521108
Fix Description:
The console uses resource editor extensions which are registered under
cn=ResourceEditorExtension, ou=1.1, ou=admin, ou=Global Preferences,
ou=example.com, o=NetscapeRoot in the admin server. Some extensions are
provided by idm-console-framework, but some others are provided by
389-ds-console.
Currently the console will load all extensions during console initialization.
However, when a user uses the console for the first time it doesn't have the
389-ds-console jar file yet. The jar file will only be downloaded when the user
clicks the server node, but at that point the console will not try to load the
extensions again.
This problem can be reproduced by removing ~/.389-console/jars folder and then
restarting the console.
The patch will change the behaviour such that during initialization the console
will only load the extensions from idm-console-framework (without @ sign). When
the user clicks on the server node it will load the extensions from the
389-ds-console jar file (ending with @ + jar file name) .
Note: Committing the change on behalf of Endi Sukma Dewata (edewata(a)redhat.com).
Index: Console.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/console/Console.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Console.java 12 Feb 2010 16:53:00 -0000 1.16
+++ Console.java 17 Mar 2010 17:37:51 -0000 1.17
@@ -868,6 +868,7 @@
while (eValues.hasMoreElements()) {
String sJarClassName =
(String) eValues.nextElement();
+ if (sJarClassName.indexOf("@") >= 0) continue;
Class c = ClassLoaderUtil.getClass(
_info, sJarClassName);
@@ -889,6 +890,7 @@
while (deleteClasses.hasMoreElements()) {
String jarClassname = (String)
deleteClasses.nextElement();
+ if (jarClassname.indexOf("@") >= 0) continue;
Class c = ClassLoaderUtil.getClass(
_info, jarClassname);
if (c != null) {
14 years, 1 month
console/src/com/netscape/management/client/topology ServerNode.java, 1.5, 1.6
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/console/src/com/netscape/management/client/topology
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32522/src/com/netscape/management/client/topology
Modified Files:
ServerNode.java
Log Message:
Bug 521108 - Customer is unable to add a new Role within RHDS 8.1.0.
https://bugzilla.redhat.com/show_bug.cgi?id=521108
Fix Description:
The console uses resource editor extensions which are registered under
cn=ResourceEditorExtension, ou=1.1, ou=admin, ou=Global Preferences,
ou=example.com, o=NetscapeRoot in the admin server. Some extensions are
provided by idm-console-framework, but some others are provided by
389-ds-console.
Currently the console will load all extensions during console initialization.
However, when a user uses the console for the first time it doesn't have the
389-ds-console jar file yet. The jar file will only be downloaded when the user
clicks the server node, but at that point the console will not try to load the
extensions again.
This problem can be reproduced by removing ~/.389-console/jars folder and then
restarting the console.
The patch will change the behaviour such that during initialization the console
will only load the extensions from idm-console-framework (without @ sign). When
the user clicks on the server node it will load the extensions from the
389-ds-console jar file (ending with @ + jar file name) .
Note: Committing the change on behalf of Endi Sukma Dewata (edewata(a)redhat.com).
Index: ServerNode.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/topology/ServerNode.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ServerNode.java 29 Jan 2009 21:23:59 -0000 1.5
+++ ServerNode.java 17 Mar 2010 17:37:51 -0000 1.6
@@ -31,6 +31,7 @@
import com.netscape.management.client.console.*;
import com.netscape.management.client.components.*;
import com.netscape.management.client.ace.*;
+import com.netscape.management.client.ug.*;
import com.netscape.management.client.util.*;
import netscape.ldap.*;
import netscape.ldap.controls.*;
@@ -1288,6 +1289,7 @@
}
}
so.initialize(ci);
+ loadResourceEditorExtension(ci, jarName);
if (so instanceof ResourceObject)
{
((ResourceObject) so).setName(serverID);
@@ -1308,6 +1310,111 @@
}
}
+ public void loadResourceEditorExtension(ConsoleInfo ci, String jarName) {
+
+ LDAPConnection ldc = ci.getLDAPConnection();
+ if (ldc == null) return;
+
+ String ldapLocation = "";
+ LDAPSearchConstraints cons;
+ LDAPSearchResults result;
+ LDAPAttribute attribute;
+
+ try {
+ cons = ldc.getSearchConstraints();
+ cons.setBatchSize(1);
+ // then get the resource editor extension
+ ldapLocation = "cn=ResourceEditorExtension,"+
+ LDAPUtil.getAdminGlobalParameterEntry();
+ result = ldc.search(ldapLocation,
+ LDAPConnection.SCOPE_ONE, "(Objectclass=nsAdminResourceEditorExtension)",
+ null, false, cons);
+ Hashtable hResourceEditorExtension = ResourceEditor.getResourceEditorExtension();
+ Hashtable deleteResourceEditorExtension = ResourceEditor.getDeleteResourceEditorExtension();
+
+ if (result != null) {
+ while (result.hasMoreElements()) {
+ LDAPEntry ExtensionEntry;
+ try {
+ ExtensionEntry = (LDAPEntry) result.next();
+ } catch (Exception e) {
+ // ldap exception
+ continue;
+ }
+
+ attribute = ExtensionEntry.getAttribute("cn",
+ LDAPUtil.getLDAPAttributeLocale());
+ Enumeration eValues = attribute.getStringValues();
+ String sCN = "";
+ while (eValues.hasMoreElements()) {
+ sCN = (String) eValues.nextElement(); // Take the first CN
+ break;
+ }
+
+ attribute =
+ ExtensionEntry.getAttribute("nsClassname",
+ LDAPUtil.getLDAPAttributeLocale());
+ if (attribute != null) {
+ eValues = attribute.getStringValues();
+
+ Vector vClass = (Vector)hResourceEditorExtension.get(
+ sCN.toLowerCase());
+ if (vClass == null) {
+ vClass = new Vector();
+ hResourceEditorExtension.put(
+ sCN.toLowerCase(), vClass);
+ }
+
+ while (eValues.hasMoreElements()) {
+ String sJarClassName =
+ (String) eValues.nextElement();
+ if (!sJarClassName.endsWith("@"+jarName)) continue;
+
+ Class c = ClassLoaderUtil.getClass(
+ ci, sJarClassName);
+
+ if (c != null) {
+ vClass.addElement(c);
+ }
+ }
+ }
+
+ attribute =
+ ExtensionEntry.getAttribute("nsDeleteClassname",
+ LDAPUtil.getLDAPAttributeLocale());
+ if (attribute != null) {
+ Enumeration deleteClasses =
+ attribute.getStringValues();
+
+ Vector deleteClassesVector = (Vector)deleteResourceEditorExtension.get(
+ sCN.toLowerCase());
+ if (deleteClassesVector == null) {
+ deleteClassesVector = new Vector();
+ deleteResourceEditorExtension.put(
+ sCN.toLowerCase(), deleteClassesVector);
+ }
+
+ while (deleteClasses.hasMoreElements()) {
+ String jarClassname = (String)
+ deleteClasses.nextElement();
+ if (!jarClassname.endsWith("@"+jarName)) continue;
+
+ Class c = ClassLoaderUtil.getClass(
+ ci, jarClassname);
+ if (c != null) {
+ deleteClassesVector.addElement(c);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ catch (LDAPException e) {
+ Debug.println("Console: Cannot open "+ldapLocation);
+ }
+ }
+
/**
* Inner class for opening a server console in a separate thread.
*/
14 years, 1 month
Branch 'Directory_Server_8_2_Branch' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/slap.h | 2 ++
ldap/servers/slapd/task.c | 21 +++++++++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
New commits:
commit f4cce0c2e74bad7e12baeac993b0dc5e1ad55e6c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Mar 16 16:45:33 2010 -0700
573896 - initializing subtree with invalid syntax crashes ns-slapd
https://bugzilla.redhat.com/show_bug.cgi?id=573896
Description: When an import is executed using a task mechanism,
slapi_task_log_notice is called for logging, where task_log field
points the memory storing the log messages. If multiple log
messages were logged by multiple worker threads simultaneously,
there was a chance that the address of the log message was switched
by realloc while the other threads were accessing the old address.
This patch introduces task_log_lock per task to protect task_log.
Note: slapi_ch_malloc and its friends never return NULL. They rather
exits. Thus, to avoid the confusion which may look leaking the
lock, I eliminated 2 error returns from slapi_task_log_notice.
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 9a860e9..062d669 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1359,6 +1359,8 @@ struct slapi_task {
TaskCallbackFn cancel; /* task has been cancelled by user */
TaskCallbackFn destructor; /* task entry is being destroyed */
int task_refcount;
+ PRLock *task_log_lock; /* To protect task_log to be realloced if
+ it's in use */
} slapi_task;
/* End of interface to support online tasks **********************************/
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index 3324dea..67109b2 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -228,6 +228,9 @@ void slapi_task_log_notice(Slapi_Task *task, char *format, ...)
PR_vsnprintf(buffer, LOG_BUFFER, format, ap);
va_end(ap);
+ if (task->task_log_lock) {
+ PR_Lock(task->task_log_lock);
+ }
len = 2 + strlen(buffer) + (task->task_log ? strlen(task->task_log) : 0);
if ((len > MAX_SCROLLBACK_BUFFER) && task->task_log) {
size_t i;
@@ -241,8 +244,6 @@ void slapi_task_log_notice(Slapi_Task *task, char *format, ...)
i++;
len = strlen(task->task_log) - i + 2 + strlen(buffer);
newbuf = (char *)slapi_ch_malloc(len);
- if (! newbuf)
- return; /* out of memory? */
strcpy(newbuf, task->task_log + i);
slapi_ch_free((void **)&task->task_log);
task->task_log = newbuf;
@@ -253,13 +254,14 @@ void slapi_task_log_notice(Slapi_Task *task, char *format, ...)
} else {
task->task_log = (char *)slapi_ch_realloc(task->task_log, len);
}
- if (! task->task_log)
- return; /* out of memory? */
}
if (task->task_log[0])
strcat(task->task_log, "\n");
strcat(task->task_log, buffer);
+ if (task->task_log_lock) {
+ PR_Unlock(task->task_log_lock);
+ }
slapi_task_status_changed(task);
}
@@ -278,7 +280,13 @@ void slapi_task_status_changed(Slapi_Task *task)
return;
}
+ if (task->task_log_lock) {
+ PR_Lock(task->task_log_lock);
+ }
NEXTMOD(TASK_LOG_NAME, task->task_log);
+ if (task->task_log_lock) {
+ PR_Unlock(task->task_log_lock);
+ }
NEXTMOD(TASK_STATUS_NAME, task->task_status);
sprintf(s1, "%d", task->task_exitcode);
sprintf(s2, "%d", task->task_progress);
@@ -505,6 +513,8 @@ new_task(const char *dn)
slapi_config_register_callback(SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, dn,
LDAP_SCOPE_SUBTREE, "(objectclass=*)", task_deny, NULL);
#endif
+ /* To protect task_log to be realloced if it's in use */
+ task->task_log_lock = PR_NewLock();
return task;
}
@@ -652,6 +662,9 @@ static void task_generic_destructor(Slapi_Task *task)
if (task->task_status) {
slapi_ch_free((void **)&task->task_status);
}
+ if (task->task_log_lock) {
+ PR_DestroyLock(task->task_log_lock);
+ }
task->task_log = task->task_status = NULL;
}
14 years, 1 month