diff options
author | Rich Megginson <rmeggins@redhat.com> | 2007-10-13 01:49:32 +0000 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2007-10-13 01:49:32 +0000 |
commit | 30d06808425c4962e0913b535473c0a0d557ff14 (patch) | |
tree | f3a6ad1912bed37317f757998166ccb644a339da /ldap | |
parent | f21456587bd4b0dcc23b45cd026efa4cc25496f9 (diff) | |
download | ds-30d06808425c4962e0913b535473c0a0d557ff14.tar.gz ds-30d06808425c4962e0913b535473c0a0d557ff14.tar.xz ds-30d06808425c4962e0913b535473c0a0d557ff14.zip |
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
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c index 9dbec458..827e471c 100644 --- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c +++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c @@ -569,6 +569,18 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb ) 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); |