Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory
cvs-int.fedora.redhat.com:/tmp/cvs-serv28205/ldapserver/ldap/servers/slapd/back-ldbm
Modified Files:
ldif2ldbm.c
Log Message:
Resolves: bug 330141
Bug Description: uuid generator not initialized by import from command line
Reviewed by: nkinder (Thanks!)
Fix Description:
The unique ID generator is not initialized if import is run from the command
line. The bad effect of this is that the clock sequence and node fields are all
zeros. This could lead to duplicate unique IDs being assigned by two different
servers.
What happens is that the uuid values all look like this:
XXXXXXXX-XXXXXXXX-80000000-00000000
So the time based part is generally ok, but the clock seq and node ID part are never
initialized, hence 0's for those fields.
The fix is to initialize the unique id generator in the same manner as we do for the
server when it starts up in regular mode, except that we tell the generator to use the
single threaded (st) mode rather than the multi threaded (mt) mode.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
Index: ldif2ldbm.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/ldif2ldbm.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ldif2ldbm.c 24 Sep 2007 18:27:15 -0000 1.14
+++ ldif2ldbm.c 13 Oct 2007 01:49:32 -0000 1.15
@@ -569,6 +569,18 @@
slapi_pblock_get(pb, SLAPI_TASK_FLAGS, &task_flags);
if (task_flags & TASK_RUNNING_FROM_COMMANDLINE) {
+ /* initialize UniqueID generator - must be done once backends are started
+ and event queue is initialized but before plugins are started */
+ Slapi_DN *sdn = slapi_sdn_new_dn_byval ("cn=uniqueid
generator,cn=config");
+ int rc = uniqueIDGenInit (NULL, sdn, 0 /* use single thread mode */);
+ slapi_sdn_free (&sdn);
+ if (rc != UID_SUCCESS) {
+ LDAPDebug( LDAP_DEBUG_ANY,
+ "Fatal Error---Failed to initialize uniqueid generator; error
= %d. "
+ "Exiting now.\n", rc, 0, 0 );
+ return -1;
+ }
+
li->li_flags |= TASK_RUNNING_FROM_COMMANDLINE;
ldbm_config_load_dse_info(li);
autosize_import_cache(li);
Show replies by date