commit_id
string | repo
string | commit_message
string | diff
string | label
int64 |
---|---|---|---|---|
ce8b4ca7c0027a3c87e5e4dc669a42b8665d1a4a
|
389ds/389-ds-base
|
Issue 50753 - Dumping the changelog to a file doesn't work
Description: Pass the logging object to the code branch where
-i CHANGELOG_FILE is not specified, so -o OUTPUT_FILE works
correctly in that case too.
https://pagure.io/389-ds-base/issue/50753
Reviewed by: mreynolds (Thanks!)
|
commit ce8b4ca7c0027a3c87e5e4dc669a42b8665d1a4a
Author: Simon Pichugin <[email protected]>
Date: Tue Dec 3 23:27:51 2019 +0100
Issue 50753 - Dumping the changelog to a file doesn't work
Description: Pass the logging object to the code branch where
-i CHANGELOG_FILE is not specified, so -o OUTPUT_FILE works
correctly in that case too.
https://pagure.io/389-ds-base/issue/50753
Reviewed by: mreynolds (Thanks!)
diff --git a/src/lib389/lib389/cli_conf/replication.py b/src/lib389/lib389/cli_conf/replication.py
index 58bbd13dd..47f530ab3 100644
--- a/src/lib389/lib389/cli_conf/replication.py
+++ b/src/lib389/lib389/cli_conf/replication.py
@@ -1000,7 +1000,8 @@ def dump_cl(inst, basedn, log, args):
if not args.changelog_ldif:
replicas.process_and_dump_changelog(replica_roots=args.replica_roots,
csn_only=args.csn_only,
- preserve_ldif_done=args.preserve_ldif_done)
+ preserve_ldif_done=args.preserve_ldif_done,
+ log=log)
else:
try:
assert os.path.exists(args.changelog_ldif)
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index 9b84d8f7e..9ba97ff26 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -1648,7 +1648,7 @@ class Replicas(DSLdapObjects):
replica._populate_suffix()
return replica
- def process_and_dump_changelog(self, replica_roots=[], csn_only=False, preserve_ldif_done=False):
+ def process_and_dump_changelog(self, replica_roots=[], csn_only=False, preserve_ldif_done=False, log=None):
"""Dump and decode Directory Server replication change log
:param replica_roots: Replica suffixes that need to be processed
@@ -1657,6 +1657,9 @@ class Replicas(DSLdapObjects):
:type csn_only: bool
"""
+ if log is None:
+ log = self._log
+
repl_roots = []
try:
cl = Changelog5(self._instance)
@@ -1677,7 +1680,7 @@ class Replicas(DSLdapObjects):
got_ldif = False
current_time = time.time()
replica = self.get(repl_root)
- self._log.info(f"# Replica Root: {repl_root}")
+ log.info(f"# Replica Root: {repl_root}")
replica.replace("nsDS5Task", 'CL2LDIF')
# Decode the dumped changelog
@@ -1687,7 +1690,7 @@ class Replicas(DSLdapObjects):
if os.path.getmtime(file_path) < current_time:
continue
got_ldif = True
- cl_ldif = ChangelogLDIF(file_path, self._log)
+ cl_ldif = ChangelogLDIF(file_path, log)
if csn_only:
cl_ldif.grep_csn()
@@ -1700,7 +1703,7 @@ class Replicas(DSLdapObjects):
os.remove(file_path)
if not got_ldif:
- self._log.info("LDIF file: Not found")
+ log.info("LDIF file: Not found")
class BootstrapReplicationManager(DSLdapObject):
| 0 |
172c60a26a54a18d9716abadde82ba27d25a79f9
|
389ds/389-ds-base
|
Ticket 49789 - backout original fix as it caused a regression in FreeIPA
Description: This change broke FreeIPA, so for now we need to back it out
https://pagure.io/389-ds-base/issue/49789
|
commit 172c60a26a54a18d9716abadde82ba27d25a79f9
Author: Mark Reynolds <[email protected]>
Date: Wed Jul 18 12:01:53 2018 -0400
Ticket 49789 - backout original fix as it caused a regression in FreeIPA
Description: This change broke FreeIPA, so for now we need to back it out
https://pagure.io/389-ds-base/issue/49789
diff --git a/dirsrvtests/tests/suites/password/regression_test.py b/dirsrvtests/tests/suites/password/regression_test.py
index 3e40350d2..7e7d20690 100644
--- a/dirsrvtests/tests/suites/password/regression_test.py
+++ b/dirsrvtests/tests/suites/password/regression_test.py
@@ -36,23 +36,6 @@ TEST_PASSWORDS += ['CNpwtest1ZZZZ', 'ZZZZZCNpwtest1',
TEST_PASSWORDS2 = (
'CN12pwtest31', 'SN3pwtest231', 'UID1pwtest123', '[email protected]', '2GN1pwtest123', 'People123')
-def _check_unhashed_userpw(inst, user_dn, is_present=False):
- """Check if unhashed#user#password attribute is present of not in the changelog"""
- unhashed_pwd_attribute = 'unhashed#user#password'
-
- changelog_dbdir = os.path.join(os.path.dirname(inst.dbdir), DEFAULT_CHANGELOG_DB)
- for dbfile in os.listdir(changelog_dbdir):
- if dbfile.endswith('.db'):
- changelog_dbfile = os.path.join(changelog_dbdir, dbfile)
- log.info('Changelog dbfile file exist: {}'.format(changelog_dbfile))
- log.info('Running dbscan -f to check {} attr'.format(unhashed_pwd_attribute))
- dbscanOut = inst.dbscan(DEFAULT_CHANGELOG_DB, changelog_dbfile)
- for entry in dbscanOut.split(b'dbid: '):
- if ensure_bytes('operation: modify') in entry and ensure_bytes(user_dn) in entry and ensure_bytes('userPassword') in entry:
- if is_present:
- assert ensure_bytes(unhashed_pwd_attribute) in entry
- else:
- assert ensure_bytes(unhashed_pwd_attribute) not in entry
@pytest.fixture(scope="module")
def passw_policy(topo, request):
@@ -208,105 +191,6 @@ def test_global_vs_local(topo, passw_policy, test_user, user_pasw):
conn.unbind_s()
test_user.set('userPassword', PASSWORD)
[email protected]
-def test_unhashed_pw_switch(topo_master):
- """Check that nsslapd-unhashed-pw-switch works corrently
-
- :id: e5aba180-d174-424d-92b0-14fe7bb0b92a
- :setup: Master Instance
- :steps:
- 1. A Master is created, enable retrocl (not used here)
- 2. create a set of users
- 3. update userpassword of user1 and check that unhashed#user#password is not logged (default)
- 4. udpate userpassword of user2 and check that unhashed#user#password is not logged ('nolog')
- 5. udpate userpassword of user3 and check that unhashed#user#password is logged ('on')
- :expectedresults:
- 1. Success
- 2. Success
- 3 Success (unhashed#user#password is not logged in the replication changelog)
- 4. Success (unhashed#user#password is not logged in the replication changelog)
- 5. Success (unhashed#user#password is logged in the replication changelog)
- """
- MAX_USERS = 10
- PEOPLE_DN = ("ou=people," + DEFAULT_SUFFIX)
-
- inst = topo_master.ms["master1"]
- inst.modify_s("cn=Retro Changelog Plugin,cn=plugins,cn=config",
- [(ldap.MOD_REPLACE, 'nsslapd-changelogmaxage', b'2m'),
- (ldap.MOD_REPLACE, 'nsslapd-changelog-trim-interval', b"5s"),
- (ldap.MOD_REPLACE, 'nsslapd-logAccess', b'on')])
- inst.config.loglevel(vals=[256 + 4], service='access')
- inst.restart()
- # If you need any test suite initialization,
- # please, write additional fixture for that (including finalizer).
- # Topology for suites are predefined in lib389/topologies.py.
-
- # enable dynamic plugins, memberof and retro cl plugin
- #
- log.info('Enable plugins...')
- try:
- inst.modify_s(DN_CONFIG,
- [(ldap.MOD_REPLACE,
- 'nsslapd-dynamic-plugins',
- b'on')])
- except ldap.LDAPError as e:
- ldap.error('Failed to enable dynamic plugins! ' + e.message['desc'])
- assert False
-
- #topology_st.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
- inst.plugins.enable(name=PLUGIN_RETRO_CHANGELOG)
- #topology_st.standalone.modify_s("cn=changelog,cn=ldbm database,cn=plugins,cn=config", [(ldap.MOD_REPLACE, 'nsslapd-cachememsize', str(100000))])
- inst.restart()
-
- log.info('create users and group...')
- for idx in range(1, MAX_USERS):
- try:
- USER_DN = ("uid=member%d,%s" % (idx, PEOPLE_DN))
- inst.add_s(Entry((USER_DN,
- {'objectclass': 'top extensibleObject'.split(),
- 'uid': 'member%d' % (idx)})))
- except ldap.LDAPError as e:
- log.fatal('Failed to add user (%s): error %s' % (USER_DN, e.message['desc']))
- assert False
-
- # Check default is that unhashed#user#password is not logged
- user = "uid=member1,%s" % (PEOPLE_DN)
- inst.modify_s(user, [(ldap.MOD_REPLACE,
- 'userpassword',
- PASSWORD.encode())])
- inst.stop()
- _check_unhashed_userpw(inst, user, is_present=False)
-
- # Check with nolog that unhashed#user#password is not logged
- inst.modify_s(DN_CONFIG,
- [(ldap.MOD_REPLACE,
- 'nsslapd-unhashed-pw-switch',
- b'nolog')])
- inst.restart()
- user = "uid=member2,%s" % (PEOPLE_DN)
- inst.modify_s(user, [(ldap.MOD_REPLACE,
- 'userpassword',
- PASSWORD.encode())])
- inst.stop()
- _check_unhashed_userpw(inst, user, is_present=False)
-
- # Check with value 'on' that unhashed#user#password is logged
- inst.modify_s(DN_CONFIG,
- [(ldap.MOD_REPLACE,
- 'nsslapd-unhashed-pw-switch',
- b'on')])
- inst.restart()
- user = "uid=member3,%s" % (PEOPLE_DN)
- inst.modify_s(user, [(ldap.MOD_REPLACE,
- 'userpassword',
- PASSWORD.encode())])
- inst.stop()
- _check_unhashed_userpw(inst, user, is_present=True)
-
- if DEBUGGING:
- # Add debugging steps(if any)...
- pass
-
if __name__ == '__main__':
# Run isolated
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 4f12c641e..3ddab4531 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -295,8 +295,8 @@ typedef void (*VFPV)(); /* takes undefined arguments */
#define SLAPD_DEFAULT_VALIDATE_CERT SLAPD_VALIDATE_CERT_WARN
#define SLAPD_DEFAULT_VALIDATE_CERT_STR "warn"
-#define SLAPD_DEFAULT_UNHASHED_PW_SWITCH SLAPD_UNHASHED_PW_OFF
-#define SLAPD_DEFAULT_UNHASHED_PW_SWITCH_STR "off"
+#define SLAPD_DEFAULT_UNHASHED_PW_SWITCH SLAPD_UNHASHED_PW_ON
+#define SLAPD_DEFAULT_UNHASHED_PW_SWITCH_STR "on"
#define SLAPD_DEFAULT_LDAPI_SEARCH_BASE "dc=example,dc=com"
#define SLAPD_DEFAULT_LDAPI_AUTO_DN "cn=peercred,cn=external,cn=auth"
| 0 |
a4b81c0ae59a4246d2d44790efea093a62fc972c
|
389ds/389-ds-base
|
Ticket #47384 - Plugin library path validation
Bug description: ldapmodify could replace the plugin path with
an invalid path.
Fix description: This patch adds the validation code to dse
callback. If modify operation is requested for a plugin entry,
the registered callback check_plugin_path is called and check
the given plugin path.
This patch also has made get_plugin_name public as slapi_get_
plugin_name. Now, the following plugin paths are allowed:
/path/to/lib<plugin>.so, /path/to/lib<plugin>,
lib<plugin>.so, lib<plugin>
https://fedorahosted.org/389/ticket/47384
Reviewed by Rich (Thanks!!)
|
commit a4b81c0ae59a4246d2d44790efea093a62fc972c
Author: Noriko Hosoi <[email protected]>
Date: Thu Jun 27 15:48:30 2013 -0700
Ticket #47384 - Plugin library path validation
Bug description: ldapmodify could replace the plugin path with
an invalid path.
Fix description: This patch adds the validation code to dse
callback. If modify operation is requested for a plugin entry,
the registered callback check_plugin_path is called and check
the given plugin path.
This patch also has made get_plugin_name public as slapi_get_
plugin_name. Now, the following plugin paths are allowed:
/path/to/lib<plugin>.so, /path/to/lib<plugin>,
lib<plugin>.so, lib<plugin>
https://fedorahosted.org/389/ticket/47384
Reviewed by Rich (Thanks!!)
diff --git a/ldap/servers/slapd/dynalib.c b/ldap/servers/slapd/dynalib.c
index 58481a800..044853715 100644
--- a/ldap/servers/slapd/dynalib.c
+++ b/ldap/servers/slapd/dynalib.c
@@ -58,13 +58,6 @@ static struct dynalib {
static void symload_report_error( const char *libpath, char *symbol, char *plugin,
int libopen );
-/* construct a full path and name of a plugin
- very similar to PR_GetLibraryName except that function inserts
- the string "lib" at the beginning of name, making that function
- unsuitable for constructing plugin names
-*/
-static char *get_plugin_name(const char *dir, const char *name);
-
static void free_plugin_name(char *name)
{
PR_smprintf_free(name);
@@ -114,7 +107,11 @@ sym_load_with_flags( char *libpath, char *symbol, char *plugin, int report_error
}
if (PR_SUCCESS != PR_Access(libpath, PR_ACCESS_READ_OK)) {
- libSpec.value.pathname = get_plugin_name(PLUGINDIR, libpath);
+ if (strncmp(libpath, PLUGINDIR, strlen(PLUGINDIR))) {
+ libSpec.value.pathname = slapi_get_plugin_name(PLUGINDIR, libpath);
+ } else {
+ libSpec.value.pathname = slapi_get_plugin_name(NULL, libpath);
+ }
/* then just handle that failure case with symload_report_error below */
}
@@ -123,7 +120,7 @@ sym_load_with_flags( char *libpath, char *symbol, char *plugin, int report_error
symload_report_error( libSpec.value.pathname, symbol, plugin, 0 /* lib not open */ );
}
if (libSpec.value.pathname != libpath) {
- free_plugin_name((char *)libSpec.value.pathname); /* cast ok - allocated by get_plugin_name */
+ free_plugin_name((char *)libSpec.value.pathname); /* cast ok - allocated by slapi_get_plugin_name */
}
return( NULL );
}
@@ -171,35 +168,3 @@ symload_report_error( const char *libpath, char *symbol, char *plugin, int libop
libpath, plugin, 0 );
}
}
-
-/* PR_GetLibraryName does almost everything we need, and unfortunately
- a little bit more - it adds "lib" to be beginning of the library
- name if the library name does not end with the current platform
- DLL suffix - so
- foo.so -> /path/foo.so
- libfoo.so -> /path/libfoo.so
- BUT
- foo -> /path/libfoo.so
- libfoo -> /path/liblibfoo.so
-*/
-static char *
-get_plugin_name(const char *path, const char *lib)
-{
- const char *libstr = "/lib";
- size_t libstrlen = 4;
- char *fullname = PR_GetLibraryName(path, lib);
- char *ptr = PL_strrstr(fullname, lib);
-
- /* see if /lib was added */
- if (ptr && ((ptr - fullname) >= libstrlen)) {
- /* ptr is at the libname in fullname, and there is something before it */
- ptr -= libstrlen; /* ptr now points at the "/" in "/lib" if it is there */
- if (0 == PL_strncmp(ptr, libstr, libstrlen)) {
- /* just copy the remainder of the string on top of here */
- ptr++; /* ptr now points at the "l" in "/lib" - keep the "/" */
- memmove(ptr, ptr+3, strlen(ptr+3)+1);
- }
- }
-
- return fullname;
-}
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
index 5434c7500..ab6ee629e 100644
--- a/ldap/servers/slapd/fedse.c
+++ b/ldap/servers/slapd/fedse.c
@@ -1551,6 +1551,8 @@ static const char *easter_egg_photos[NUM_EASTER_EGG_PHOTOS + 1];
static struct dse *pfedse= NULL;
+static int check_plugin_path(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
+
static void
internal_add_helper(Slapi_Entry *e, int dont_write_file)
{
@@ -1786,6 +1788,7 @@ setup_internal_backends(char *configdir)
Slapi_Backend *be;
Slapi_DN encryption;
Slapi_DN saslmapping;
+ Slapi_DN plugins;
slapi_sdn_init_ndn_byref(&monitor,"cn=monitor");
slapi_sdn_init_ndn_byref(&counters,"cn=counters,cn=monitor");
@@ -1794,6 +1797,7 @@ setup_internal_backends(char *configdir)
slapi_sdn_init_ndn_byref(&encryption,"cn=encryption,cn=config");
slapi_sdn_init_ndn_byref(&saslmapping,"cn=mapping,cn=sasl,cn=config");
+ slapi_sdn_init_ndn_byref(&plugins,"cn=plugins,cn=config");
/* Search */
dse_register_callback(pfedse,SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,&config,LDAP_SCOPE_BASE,"(objectclass=*)",read_config_dse,NULL);
@@ -1809,6 +1813,7 @@ setup_internal_backends(char *configdir)
dse_register_callback(pfedse,SLAPI_OPERATION_MODIFY,DSE_FLAG_POSTOP,&config,LDAP_SCOPE_BASE,"(objectclass=*)",postop_modify_config_dse,NULL);
dse_register_callback(pfedse,SLAPI_OPERATION_MODIFY,DSE_FLAG_PREOP,&root,LDAP_SCOPE_BASE,"(objectclass=*)",modify_root_dse,NULL);
dse_register_callback(pfedse,SLAPI_OPERATION_MODIFY,DSE_FLAG_PREOP,&saslmapping,LDAP_SCOPE_SUBTREE,"(objectclass=nsSaslMapping)",sasl_map_config_modify,NULL);
+ dse_register_callback(pfedse,SLAPI_OPERATION_MODIFY,DSE_FLAG_PREOP,&plugins,LDAP_SCOPE_SUBTREE,"(objectclass=nsSlapdPlugin)",check_plugin_path,NULL);
/* Delete */
dse_register_callback(pfedse,SLAPI_OPERATION_DELETE,DSE_FLAG_PREOP,&config,LDAP_SCOPE_BASE,"(objectclass=*)",dont_allow_that,NULL);
@@ -1839,6 +1844,7 @@ setup_internal_backends(char *configdir)
slapi_sdn_done(&snmp);
slapi_sdn_done(&root);
slapi_sdn_done(&saslmapping);
+ slapi_sdn_done(&plugins);
} else {
slapi_log_error( SLAPI_LOG_FATAL, "dse",
"Please edit the file to correct the reported problems"
@@ -1903,3 +1909,47 @@ int fedse_create_startOK(char *filename, char *startokfilename, const char *con
return rc;
}
+
+static int
+check_plugin_path(Slapi_PBlock *pb,
+ Slapi_Entry* entryBefore,
+ Slapi_Entry* e,
+ int *returncode,
+ char *returntext,
+ void *arg)
+{
+ /* check for invalid nsslapd-pluginPath */
+ char **vals = slapi_entry_attr_get_charray (e, ATTR_PLUGIN_PATH);
+ int plugindir_len = sizeof(PLUGINDIR)-1;
+ int j = 0;
+ int rc = SLAPI_DSE_CALLBACK_OK;
+ for (j = 0; vals && vals[j]; j++) {
+ char *full_path = NULL;
+ char *resolved_path = NULL;
+ char *res = NULL;
+
+ if ( *vals[j] == '/' ) { /* absolute path */
+ full_path = slapi_get_plugin_name(NULL, vals[j]);
+ } else { /* relative path */
+ full_path = slapi_get_plugin_name(PLUGINDIR, vals[j]);
+ }
+ resolved_path = slapi_ch_malloc(strlen(full_path) + 1);
+ res = realpath( full_path, resolved_path );
+ if (res) {
+ if (strncmp(PLUGINDIR, resolved_path, plugindir_len) != 0) {
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
+ returntext = "Invalid plugin path";
+ rc = SLAPI_DSE_CALLBACK_ERROR;
+ }
+ } else {
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
+ returntext = "Invalid plugin path";
+ rc = SLAPI_DSE_CALLBACK_ERROR;
+ }
+ slapi_ch_free_string(&full_path);
+ slapi_ch_free_string(&resolved_path);
+ }
+ slapi_ch_array_free(vals);
+
+ return rc;
+}
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index d1e90de46..9a66f2aaf 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -7495,6 +7495,16 @@ int slapi_eq_cancel(Slapi_Eq_Context ctx);
*/
void *slapi_eq_get_arg (Slapi_Eq_Context ctx);
+/**
+ * Construct a full path and name of a plugin.
+ *
+ * \param dir The Directory where the plugin is located.
+ * \param name The name of the plugin.
+ *
+ * \return absolute path of the plugin. Caller is responsible to free it.
+ */
+char *slapi_get_plugin_name(const char *dir, const char *name);
+
#ifdef __cplusplus
}
#endif
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 653914b04..fb92867d2 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1395,3 +1395,42 @@ slapi_str_to_u64(const char *s)
(v6 << 36) | (v7 << 32) | (v8 << 28) | (v9 << 24) | (v10 << 20) | (v11 << 16) |
(v12 << 12) | (v13 << 8) | (v14 << 4) | v15;
}
+
+/* PR_GetLibraryName does almost everything we need, and unfortunately
+ a little bit more - it adds "lib" to be beginning of the library
+ name if the library name does not end with the current platform
+ DLL suffix - so
+ foo.so -> /path/foo.so
+ libfoo.so -> /path/libfoo.so
+ BUT
+ foo -> /path/libfoo.so
+ libfoo -> /path/liblibfoo.so
+ /path/libfoo -> lib/path/libfoo.so
+*/
+char *
+slapi_get_plugin_name(const char *path, const char *lib)
+{
+ const char *libstr = "/lib";
+ size_t libstrlen = 4;
+ char *fullname = PR_GetLibraryName(path, lib);
+ char *ptr = PL_strrstr(fullname, lib);
+
+ /* see if /lib was added */
+ if (ptr && ((ptr - fullname) >= libstrlen)) {
+ /* ptr is at the libname in fullname, and there is something before it */
+ ptr -= libstrlen; /* ptr now points at the "/" in "/lib" if it is there */
+ if (0 == PL_strncmp(ptr, libstr, libstrlen)) {
+ /* just copy the remainder of the string on top of here */
+ ptr++; /* ptr now points at the "l" in "/lib" - keep the "/" */
+ memmove(ptr, ptr+3, strlen(ptr+3)+1);
+ }
+ } else if ((NULL == path) && (0 == strncmp(fullname, "lib", 3))) {
+ /*
+ * case: /path/libfoo -> lib/path/libfoo.so
+ * remove "lib".
+ */
+ memmove(fullname, fullname+3, strlen(fullname)-2);
+ }
+
+ return fullname;
+}
| 0 |
82147465a713d7e337bb57802e6b8eceac37ca3b
|
389ds/389-ds-base
|
Issue 6838 - lib389/replica.py is using nonexistent datetime.UTC in Python 3.9
Bug Description:
389-ds-base-2.x is supposed to be used with Python 3.9.
But lib389/replica.py is using `datetime.UTC`, which is an alias
to `datetime.timezone.utc` was added only in Python 3.11.
Fix Description:
Use `datetime.timezone.utc` instead.
Fixes: https://github.com/389ds/389-ds-base/issues/6838
Reviewed by: @mreynolds389 (Thanks!)
|
commit 82147465a713d7e337bb57802e6b8eceac37ca3b
Author: Viktor Ashirov <[email protected]>
Date: Tue Jul 1 12:44:04 2025 +0200
Issue 6838 - lib389/replica.py is using nonexistent datetime.UTC in Python 3.9
Bug Description:
389-ds-base-2.x is supposed to be used with Python 3.9.
But lib389/replica.py is using `datetime.UTC`, which is an alias
to `datetime.timezone.utc` was added only in Python 3.11.
Fix Description:
Use `datetime.timezone.utc` instead.
Fixes: https://github.com/389ds/389-ds-base/issues/6838
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index 18ce1b1d5..59be00a33 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -917,7 +917,7 @@ class RUV(object):
ValueError("Wrong CSN value was supplied")
timestamp = int(csn[:8], 16)
- time_str = datetime.datetime.fromtimestamp(timestamp, datetime.UTC).strftime('%Y-%m-%d %H:%M:%S')
+ time_str = datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S')
# We are parsing shorter CSN which contains only timestamp
if len(csn) == 8:
return time_str
| 0 |
8a88106ba1d49818ab36548303d16a156e921afd
|
389ds/389-ds-base
|
Bug 690584 - #10643 hash_rootpw - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10643 hash_rootpw - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: store the pointer returned by pw_val2scheme and free it
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit 8a88106ba1d49818ab36548303d16a156e921afd
Author: Rich Megginson <[email protected]>
Date: Fri Mar 25 10:40:30 2011 -0600
Bug 690584 - #10643 hash_rootpw - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10643 hash_rootpw - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: store the pointer returned by pw_val2scheme and free it
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index ca580fb85..2eafcf617 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -1241,7 +1241,9 @@ hash_rootpw (LDAPMod **mods)
for (j = 0; mod->mod_bvalues[j] != NULL; j++) {
char *val = mod->mod_bvalues[j]->bv_val;
char *hashedval = NULL;
- if (pw_val2scheme (val, NULL, 0)) {
+ struct pw_scheme *pws = pw_val2scheme (val, NULL, 0);
+ if (pws) {
+ free_pw_scheme(pws);
/* Value is pre-hashed, no work to do for this value */
continue;
} else if (! slapd_nss_is_initialized() ) {
| 0 |
dcffae86c99557bd90fd84cf7b6bf4f96371d2e4
|
389ds/389-ds-base
|
Issue 6822 - Backend creation cleanup and Database UI tab error handling (#6823)
Description: Add rollback functionality when mapping tree creation fails
during backend creation to prevent orphaned backends.
Improve error handling in Database, Replication and Monitoring UI tabs
to gracefully handle backend get-tree command failures.
Fixes: https://github.com/389ds/389-ds-base/issues/6822
Reviewed by: @mreynolds389 (Thanks!)
|
commit dcffae86c99557bd90fd84cf7b6bf4f96371d2e4
Author: Simon Pichugin <[email protected]>
Date: Fri Jun 27 18:43:39 2025 -0700
Issue 6822 - Backend creation cleanup and Database UI tab error handling (#6823)
Description: Add rollback functionality when mapping tree creation fails
during backend creation to prevent orphaned backends.
Improve error handling in Database, Replication and Monitoring UI tabs
to gracefully handle backend get-tree command failures.
Fixes: https://github.com/389ds/389-ds-base/issues/6822
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/src/cockpit/389-console/src/database.jsx b/src/cockpit/389-console/src/database.jsx
index c0c4be414..276125dfc 100644
--- a/src/cockpit/389-console/src/database.jsx
+++ b/src/cockpit/389-console/src/database.jsx
@@ -478,6 +478,59 @@ export class Database extends React.Component {
}
loadSuffixTree(fullReset) {
+ const treeData = [
+ {
+ name: _("Global Database Configuration"),
+ icon: <CogIcon />,
+ id: "dbconfig",
+ },
+ {
+ name: _("Chaining Configuration"),
+ icon: <ExternalLinkAltIcon />,
+ id: "chaining-config",
+ },
+ {
+ name: _("Backups & LDIFs"),
+ icon: <CopyIcon />,
+ id: "backups",
+ },
+ {
+ name: _("Password Policies"),
+ id: "pwp",
+ icon: <KeyIcon />,
+ children: [
+ {
+ name: _("Global Policy"),
+ icon: <HomeIcon />,
+ id: "pwpolicy",
+ },
+ {
+ name: _("Local Policies"),
+ icon: <UsersIcon />,
+ id: "localpwpolicy",
+ },
+ ],
+ defaultExpanded: true
+ },
+ {
+ name: _("Suffixes"),
+ icon: <CatalogIcon />,
+ id: "suffixes-tree",
+ children: [],
+ defaultExpanded: true,
+ action: (
+ <Button
+ onClick={this.handleShowSuffixModal}
+ variant="plain"
+ aria-label="Create new suffix"
+ title={_("Create new suffix")}
+ >
+ <PlusIcon />
+ </Button>
+ ),
+ }
+ ];
+
const cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
"backend", "get-tree",
@@ -491,58 +544,20 @@ export class Database extends React.Component {
suffixData = JSON.parse(content);
this.processTree(suffixData);
}
- const treeData = [
- {
- name: _("Global Database Configuration"),
- icon: <CogIcon />,
- id: "dbconfig",
- },
- {
- name: _("Chaining Configuration"),
- icon: <ExternalLinkAltIcon />,
- id: "chaining-config",
- },
- {
- name: _("Backups & LDIFs"),
- icon: <CopyIcon />,
- id: "backups",
- },
- {
- name: _("Password Policies"),
- id: "pwp",
- icon: <KeyIcon />,
- children: [
- {
- name: _("Global Policy"),
- icon: <HomeIcon />,
- id: "pwpolicy",
- },
- {
- name: _("Local Policies"),
- icon: <UsersIcon />,
- id: "localpwpolicy",
- },
- ],
- defaultExpanded: true
- },
- {
- name: _("Suffixes"),
- icon: <CatalogIcon />,
- id: "suffixes-tree",
- children: suffixData,
- defaultExpanded: true,
- action: (
- <Button
- onClick={this.handleShowSuffixModal}
- variant="plain"
- aria-label="Create new suffix"
- title={_("Create new suffix")}
- >
- <PlusIcon />
- </Button>
- ),
- }
- ];
+
+ let current_node = this.state.node_name;
+ if (fullReset) {
+ current_node = DB_CONFIG;
+ }
+
+ treeData[4].children = suffixData; // suffixes node
+ this.setState(() => ({
+ nodes: treeData,
+ node_name: current_node,
+ }), this.loadAttrs);
+ })
+ .fail(err => {
+ // Handle backend get-tree failure gracefully
let current_node = this.state.node_name;
if (fullReset) {
current_node = DB_CONFIG;
diff --git a/src/cockpit/389-console/src/monitor.jsx b/src/cockpit/389-console/src/monitor.jsx
index ad48d1f87..91a8e3e37 100644
--- a/src/cockpit/389-console/src/monitor.jsx
+++ b/src/cockpit/389-console/src/monitor.jsx
@@ -200,6 +200,84 @@ export class Monitor extends React.Component {
}
loadSuffixTree(fullReset) {
+ const basicData = [
+ {
+ name: _("Server Statistics"),
+ icon: <ClusterIcon />,
+ id: "server-monitor",
+ type: "server",
+ },
+ {
+ name: _("Replication"),
+ icon: <TopologyIcon />,
+ id: "replication-monitor",
+ type: "replication",
+ defaultExpanded: true,
+ children: [
+ {
+ name: _("Synchronization Report"),
+ icon: <MonitoringIcon />,
+ id: "sync-report",
+ item: "sync-report",
+ type: "repl-mon",
+ },
+ {
+ name: _("Log Analysis"),
+ icon: <MonitoringIcon />,
+ id: "log-analysis",
+ item: "log-analysis",
+ type: "repl-mon",
+ }
+ ],
+ },
+ {
+ name: _("Database"),
+ icon: <DatabaseIcon />,
+ id: "database-monitor",
+ type: "database",
+ children: [], // Will be populated with treeData on success
+ defaultExpanded: true,
+ },
+ {
+ name: _("Logging"),
+ icon: <CatalogIcon />,
+ id: "log-monitor",
+ defaultExpanded: true,
+ children: [
+ {
+ name: _("Access Log"),
+ icon: <BookIcon size="sm" />,
+ id: "access-log-monitor",
+ type: "log",
+ },
+ {
+ name: _("Audit Log"),
+ icon: <BookIcon size="sm" />,
+ id: "audit-log-monitor",
+ type: "log",
+ },
+ {
+ name: _("Audit Failure Log"),
+ icon: <BookIcon size="sm" />,
+ id: "auditfail-log-monitor",
+ type: "log",
+ },
+ {
+ name: _("Errors Log"),
+ icon: <BookIcon size="sm" />,
+ id: "error-log-monitor",
+ type: "log",
+ },
+ {
+ name: _("Security Log"),
+ icon: <BookIcon size="sm" />,
+ id: "security-log-monitor",
+ type: "log",
+ },
+ ]
+ },
+ ];
+
const cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
"backend", "get-tree",
@@ -210,83 +288,7 @@ export class Monitor extends React.Component {
.done(content => {
const treeData = JSON.parse(content);
this.processTree(treeData);
- const basicData = [
- {
- name: _("Server Statistics"),
- icon: <ClusterIcon />,
- id: "server-monitor",
- type: "server",
- },
- {
- name: _("Replication"),
- icon: <TopologyIcon />,
- id: "replication-monitor",
- type: "replication",
- defaultExpanded: true,
- children: [
- {
- name: _("Synchronization Report"),
- icon: <MonitoringIcon />,
- id: "sync-report",
- item: "sync-report",
- type: "repl-mon",
- },
- {
- name: _("Log Analysis"),
- icon: <MonitoringIcon />,
- id: "log-analysis",
- item: "log-analysis",
- type: "repl-mon",
- }
- ],
- },
- {
- name: _("Database"),
- icon: <DatabaseIcon />,
- id: "database-monitor",
- type: "database",
- children: [],
- defaultExpanded: true,
- },
- {
- name: _("Logging"),
- icon: <CatalogIcon />,
- id: "log-monitor",
- defaultExpanded: true,
- children: [
- {
- name: _("Access Log"),
- icon: <BookIcon size="sm" />,
- id: "access-log-monitor",
- type: "log",
- },
- {
- name: _("Audit Log"),
- icon: <BookIcon size="sm" />,
- id: "audit-log-monitor",
- type: "log",
- },
- {
- name: _("Audit Failure Log"),
- icon: <BookIcon size="sm" />,
- id: "auditfail-log-monitor",
- type: "log",
- },
- {
- name: _("Errors Log"),
- icon: <BookIcon size="sm" />,
- id: "error-log-monitor",
- type: "log",
- },
- {
- name: _("Security Log"),
- icon: <BookIcon size="sm" />,
- id: "security-log-monitor",
- type: "log",
- },
- ]
- },
- ];
+
let current_node = this.state.node_name;
let type = this.state.node_type;
if (fullReset) {
@@ -296,6 +298,22 @@ export class Monitor extends React.Component {
basicData[2].children = treeData; // database node
this.processReplSuffixes(basicData[1].children);
+ this.setState(() => ({
+ nodes: basicData,
+ node_name: current_node,
+ node_type: type,
+ }), this.update_tree_nodes);
+ })
+ .fail(err => {
+ // Handle backend get-tree failure gracefully
+ let current_node = this.state.node_name;
+ let type = this.state.node_type;
+ if (fullReset) {
+ current_node = "server-monitor";
+ type = "server";
+ }
+ this.processReplSuffixes(basicData[1].children);
+
this.setState(() => ({
nodes: basicData,
node_name: current_node,
diff --git a/src/cockpit/389-console/src/replication.jsx b/src/cockpit/389-console/src/replication.jsx
index fa492fd2a..aa535bfc7 100644
--- a/src/cockpit/389-console/src/replication.jsx
+++ b/src/cockpit/389-console/src/replication.jsx
@@ -177,6 +177,16 @@ export class Replication extends React.Component {
loaded: false
});
+ const basicData = [
+ {
+ name: _("Suffixes"),
+ icon: <TopologyIcon />,
+ id: "repl-suffixes",
+ children: [],
+ defaultExpanded: true
+ }
+ ];
+
const cmd = [
"dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
"backend", "get-tree",
@@ -199,15 +209,7 @@ export class Replication extends React.Component {
}
}
}
- const basicData = [
- {
- name: _("Suffixes"),
- icon: <TopologyIcon />,
- id: "repl-suffixes",
- children: [],
- defaultExpanded: true
- }
- ];
+
let current_node = this.state.node_name;
let current_type = this.state.node_type;
let replicated = this.state.node_replicated;
@@ -258,6 +260,19 @@ export class Replication extends React.Component {
}
basicData[0].children = treeData;
+ this.setState({
+ nodes: basicData,
+ node_name: current_node,
+ node_type: current_type,
+ node_replicated: replicated,
+ }, () => { this.update_tree_nodes() });
+ })
+ .fail(err => {
+ // Handle backend get-tree failure gracefully
+ let current_node = this.state.node_name;
+ let current_type = this.state.node_type;
+ let replicated = this.state.node_replicated;
+
this.setState({
nodes: basicData,
node_name: current_node,
@@ -905,18 +920,18 @@ export class Replication extends React.Component {
disableTree: false
});
});
- })
- .fail(err => {
- const errMsg = JSON.parse(err);
- this.props.addNotification(
- "error",
- cockpit.format(_("Error loading replication agreements configuration - $0"), errMsg.desc)
- );
- this.setState({
- suffixLoading: false,
- disableTree: false
+ })
+ .fail(err => {
+ const errMsg = JSON.parse(err);
+ this.props.addNotification(
+ "error",
+ cockpit.format(_("Error loading replication agreements configuration - $0"), errMsg.desc)
+ );
+ this.setState({
+ suffixLoading: false,
+ disableTree: false
+ });
});
- });
})
.fail(err => {
// changelog failure
diff --git a/src/lib389/lib389/backend.py b/src/lib389/lib389/backend.py
index 1d000ed66..53f15b6b0 100644
--- a/src/lib389/lib389/backend.py
+++ b/src/lib389/lib389/backend.py
@@ -694,24 +694,32 @@ class Backend(DSLdapObject):
parent_suffix = properties.pop('parent', False)
# Okay, now try to make the backend.
- super(Backend, self).create(dn, properties, basedn)
+ backend_obj = super(Backend, self).create(dn, properties, basedn)
# We check if the mapping tree exists in create, so do this *after*
if create_mapping_tree is True:
- properties = {
+ mapping_tree_properties = {
'cn': self._nprops_stash['nsslapd-suffix'],
'nsslapd-state': 'backend',
'nsslapd-backend': self._nprops_stash['cn'],
}
if parent_suffix:
# This is a subsuffix, set the parent suffix
- properties['nsslapd-parent-suffix'] = parent_suffix
- self._mts.create(properties=properties)
+ mapping_tree_properties['nsslapd-parent-suffix'] = parent_suffix
+
+ try:
+ self._mts.create(properties=mapping_tree_properties)
+ except Exception as e:
+ try:
+ backend_obj.delete()
+ except Exception as cleanup_error:
+ self._instance.log.error(f"Failed to cleanup backend after mapping tree creation failure: {cleanup_error}")
+ raise e
# We can't create the sample entries unless a mapping tree was installed.
if sample_entries is not False and create_mapping_tree is True:
self.create_sample_entries(sample_entries)
- return self
+ return backend_obj
def delete(self):
"""Deletes the backend, it's mapping tree and all related indices.
| 0 |
a0113b19cbe6f37774b639cbf4a644ab4944465f
|
389ds/389-ds-base
|
Issue 51118 - UI - improve modal validation when creating an instance
Description: Do not enable the "create" button until all the fields are
valid (DN's, port numbers, passwords, etc).
Improve layout and handling of optional database settings.
Add a json argument to dscreate so the UI can report any
failure text. Also improve error reporting in dscreate.
relates: https://pagure.io/389-ds-base/issue/51118
Reviewed by: firstyear & spichugi(Thanks!!)
Improve validation error messages
Fix allowed characters
|
commit a0113b19cbe6f37774b639cbf4a644ab4944465f
Author: Mark Reynolds <[email protected]>
Date: Fri May 29 13:42:43 2020 -0400
Issue 51118 - UI - improve modal validation when creating an instance
Description: Do not enable the "create" button until all the fields are
valid (DN's, port numbers, passwords, etc).
Improve layout and handling of optional database settings.
Add a json argument to dscreate so the UI can report any
failure text. Also improve error reporting in dscreate.
relates: https://pagure.io/389-ds-base/issue/51118
Reviewed by: firstyear & spichugi(Thanks!!)
Improve validation error messages
Fix allowed characters
diff --git a/src/cockpit/389-console/src/ds.jsx b/src/cockpit/389-console/src/ds.jsx
index 53aa5cb79..691a6f265 100644
--- a/src/cockpit/389-console/src/ds.jsx
+++ b/src/cockpit/389-console/src/ds.jsx
@@ -1,16 +1,15 @@
import cockpit from "cockpit";
import React from "react";
-import PropTypes from "prop-types";
import { Plugins } from "./plugins.jsx";
import { Database } from "./database.jsx";
import { Monitor } from "./monitor.jsx";
import { Schema } from "./schema.jsx";
import { Replication } from "./replication.jsx";
import { Server } from "./server.jsx";
-import { ConfirmPopup, DoubleConfirmModal, NotificationController } from "./lib/notifications.jsx";
-import { BackupTable } from "./lib/database/databaseTables.jsx";
-import { BackupModal, RestoreModal, DeleteBackupModal } from "./lib/database/backups.jsx";
-import { log_cmd, bad_file_name } from "./lib/tools.jsx";
+import { DoubleConfirmModal, NotificationController } from "./lib/notifications.jsx";
+import { ManageBackupsModal, SchemaReloadModal, CreateInstanceModal } from "./dsModals.jsx";
+import { log_cmd } from "./lib/tools.jsx";
+
import {
Nav,
NavItem,
@@ -20,18 +19,7 @@ import {
TabContent,
TabPane,
ProgressBar,
- FormControl,
- FormGroup,
- ControlLabel,
- Radio,
- Form,
- noop,
- Checkbox,
Spinner,
- Row,
- Modal,
- Icon,
- Col,
Button
} from "patternfly-react";
import "./css/ds.css";
@@ -722,1175 +710,4 @@ export class DSInstance extends React.Component {
}
}
-class CreateInstanceModal extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- createServerId: "",
- createPort: 389,
- createSecurePort: 636,
- createDM: "cn=Directory Manager",
- createDMPassword: "",
- createDMPasswordConfirm: "",
- createDBSuffix: "",
- createDBName: "",
- createTLSCert: true,
- createInitDB: "noInit",
- loadingCreate: false
- };
-
- this.handleFieldChange = this.handleFieldChange.bind(this);
- this.createInstance = this.createInstance.bind(this);
- }
-
- handleFieldChange(e) {
- let value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
- if (e.target.type === "number") {
- if (e.target.value) {
- value = parseInt(e.target.value);
- } else {
- value = 1;
- }
- }
- this.setState({
- [e.target.id]: value
- });
- }
-
- createInstance() {
- const {
- createServerId,
- createPort,
- createSecurePort,
- createDM,
- createDMPassword,
- createDMPasswordConfirm,
- createDBSuffix,
- createDBName,
- createTLSCert,
- createInitDB
- } = this.state;
- const { closeHandler, addNotification, loadInstanceList } = this.props;
-
- let setup_inf =
- "[general]\n" +
- "config_version = 2\n" +
- "full_machine_name = FQDN\n\n" +
- "[slapd]\n" +
- "user = dirsrv\n" +
- "group = dirsrv\n" +
- "instance_name = INST_NAME\n" +
- "port = PORT\n" +
- "root_dn = ROOTDN\n" +
- "root_password = ROOTPW\n" +
- "secure_port = SECURE_PORT\n" +
- "self_sign_cert = SELF_SIGN\n";
-
- // Server ID
- let newServerId = createServerId;
- if (newServerId === "") {
- addNotification("warning", "Instance Name is required.");
- return;
- }
- newServerId = newServerId.replace(/^slapd-/i, ""); // strip "slapd-"
- if (newServerId === "admin") {
- addNotification("warning", "Instance Name 'admin' is reserved, please choose a different name");
- return;
- }
- if (newServerId.length > 80) {
- addNotification(
- "warning",
- "Instance name is too long, it must not exceed 80 characters"
- );
- return;
- }
- if (newServerId.match(/^[#%:A-Za-z0-9_-]+$/g)) {
- setup_inf = setup_inf.replace("INST_NAME", newServerId);
- } else {
- addNotification(
- "warning",
- "Instance name can only contain letters, numbers, and: # % : - _"
- );
- return;
- }
-
- // Port
- if (createPort < 1 || createPort > 65535) {
- addNotification("warning", "Port must be a number between 1 and 65534!");
- return;
- } else {
- setup_inf = setup_inf.replace("PORT", createPort);
- }
-
- // Secure Port
- if (createSecurePort < 1 || createSecurePort > 65535) {
- addNotification("warning", "Secure Port must be a number between 1 and 65534!");
- return;
- } else {
- setup_inf = setup_inf.replace("SECURE_PORT", createSecurePort);
- }
-
- // Root DN
- if (createDM === "") {
- addNotification("warning", "You must provide a Directory Manager DN");
- return;
- } else {
- setup_inf = setup_inf.replace("ROOTDN", createDM);
- }
-
- // Setup Self-Signed Certs
- if (createTLSCert) {
- setup_inf = setup_inf.replace("SELF_SIGN", "True");
- } else {
- setup_inf = setup_inf.replace("SELF_SIGN", "False");
- }
-
- // Root DN password
- if (createDMPassword != createDMPasswordConfirm) {
- addNotification("warning", "Directory Manager passwords do not match!");
- return;
- } else if (createDMPassword == "") {
- addNotification("warning", "Directory Manager password can not be empty!");
- return;
- } else if (createDMPassword.length < 8) {
- addNotification(
- "warning",
- "Directory Manager password must have at least 8 characters"
- );
- return;
- } else {
- setup_inf = setup_inf.replace("ROOTPW", createDMPassword);
- }
-
- // Backend/Suffix
- if (
- (createDBName != "" && createDBSuffix == "") ||
- (createDBName == "" && createDBSuffix != "")
- ) {
- if (createDBName == "") {
- addNotification(
- "warning",
- "If you specify a backend suffix, you must also specify a backend name"
- );
- return;
- } else {
- addNotification(
- "warning",
- "If you specify a backend name, you must also specify a backend suffix"
- );
- return;
- }
- }
- if (createDBName != "") {
- // We definitely have a backend name and suffix, next validate the suffix is a DN
- let dn_regex = new RegExp("^([A-Za-z]+=.*)");
- if (dn_regex.test(createDBSuffix)) {
- // It's valid, add it
- setup_inf += "\n[backend-" + createDBName + "]\nsuffix = " + createDBSuffix + "\n";
- } else {
- // Not a valid DN
- addNotification("warning", "Invalid DN for Backend Suffix");
- return;
- }
-
- if (createInitDB === "createSample") {
- setup_inf += "\nsample_entries = yes\n";
- }
- if (createInitDB === "createSuffix") {
- setup_inf += "\ncreate_suffix_entry = yes\n";
- }
- }
-
- /*
- * Here are steps we take to create the instance
- *
- * [1] Get FQDN Name for nsslapd-localhost setting in setup file
- * [2] Create a file for the inf setup parameters
- * [3] Set strict permissions on that file
- * [4] Populate the new setup file with settings (including cleartext password)
- * [5] Create the instance
- * [6] Remove setup file
- */
- this.setState({
- loadingCreate: true
- });
- cockpit
-
- .spawn(["hostnamectl", "status", "--static"], { superuser: true, err: "message" })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.setState({
- loadingCreate: false
- });
- addNotification("error", `Failed to get hostname!", ${errMsg.desc}`);
- })
- .done(data => {
- /*
- * We have FQDN, so set the hostname in inf file, and create the setup file
- */
- setup_inf = setup_inf.replace("FQDN", data);
- let setup_file = "/tmp/389-setup-" + new Date().getTime() + ".inf";
- let rm_cmd = ["rm", setup_file];
- let create_file_cmd = ["touch", setup_file];
- cockpit
- .spawn(create_file_cmd, { superuser: true, err: "message" })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.setState({
- loadingCreate: false
- });
- addNotification(
- "error",
- `Failed to create installation file!" ${errMsg.desc}`
- );
- })
- .done(_ => {
- /*
- * We have our new setup file, now set permissions on that setup file before we add sensitive data
- */
- let chmod_cmd = ["chmod", "600", setup_file];
- cockpit
- .spawn(chmod_cmd, { superuser: true, err: "message" })
- .fail(err => {
- let errMsg = JSON.parse(err);
- cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
- this.setState({
- loadingCreate: false
- });
- addNotification(
- "error",
- `Failed to set permission on setup file ${setup_file}: ${
- errMsg.desc
- }`
- );
- })
- .done(_ => {
- /*
- * Success we have our setup file and it has the correct permissions.
- * Now populate the setup file...
- */
- let cmd = [
- "/bin/sh",
- "-c",
- '/usr/bin/echo -e "' + setup_inf + '" >> ' + setup_file
- ];
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.setState({
- loadingCreate: false
- });
- addNotification(
- "error",
- `Failed to populate installation file! ${errMsg.desc}`
- );
- })
- .done(_ => {
- /*
- * Next, create the instance...
- */
- let cmd = ["dscreate", "from-file", setup_file];
- cockpit
- .spawn(cmd, {
- superuser: true,
- err: "message"
- })
- .fail(_ => {
- cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
- this.setState({
- loadingCreate: false
- });
- addNotification(
- "error",
- "Failed to create instance!"
- );
- })
- .done(_ => {
- // Success!!! Now cleanup everything up...
- cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
- this.setState({
- loadingCreate: false
- });
-
- loadInstanceList(createServerId);
- addNotification(
- "success",
- `Successfully created instance: slapd-${createServerId}`
- );
- closeHandler();
- });
- });
- });
- });
- });
- }
-
- render() {
- const { showModal, closeHandler } = this.props;
-
- const {
- loadingCreate,
- createServerId,
- createPort,
- createSecurePort,
- createDM,
- createDMPassword,
- createDMPasswordConfirm,
- createDBSuffix,
- createDBName,
- createTLSCert,
- createInitDB
- } = this.state;
-
- let createSpinner = "";
- if (loadingCreate) {
- createSpinner = (
- <Row>
- <div className="ds-margin-top-lg ds-modal-spinner">
- <Spinner loading inline size="lg" />
- Creating instance...
- </div>
- </Row>
- );
- }
-
- return (
- <Modal show={showModal} onHide={closeHandler}>
- <div className="ds-no-horizontal-scrollbar">
- <Modal.Header>
- <button
- className="close"
- onClick={closeHandler}
- aria-hidden="true"
- aria-label="Close"
- >
- <Icon type="pf" name="close" />
- </button>
- <Modal.Title className="ds-center">Create New Server Instance</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form horizontal>
- <FormGroup controlId="createServerId">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="The instance name, this is what gets appended to 'slapi-'. The instance name can only contain letters, numbers, and: # % : - _"
- >
- Instance Name
- </Col>
- <Col sm={7}>
- <FormControl
- id="createServerId"
- type="text"
- placeholder="Your_Instance_Name"
- value={createServerId}
- onChange={this.handleFieldChange}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createPort">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="The server port number"
- >
- Port
- </Col>
- <Col sm={7}>
- <FormControl
- type="number"
- min="0"
- max="65535"
- value={createPort}
- onChange={this.handleFieldChange}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createSecurePort">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="The secure port number for TLS connections"
- >
- Secure Port
- </Col>
- <Col sm={7}>
- <FormControl
- type="number"
- min="0"
- max="65535"
- value={createSecurePort}
- onChange={this.handleFieldChange}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createTLSCert">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="Create a self-signed certificate database"
- >
- Create Self-Signed TLS Certificate
- </Col>
- <Col sm={7}>
- <Checkbox
- id="createTLSCert"
- checked={createTLSCert}
- onChange={this.handleFieldChange}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createDM">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="The DN for the unrestricted user"
- >
- Directory Manager DN
- </Col>
- <Col sm={7}>
- <FormControl
- type="text"
- id="createDM"
- onChange={this.handleFieldChange}
- value={createDM}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createDMPassword">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="Directory Manager password."
- >
- Directory Manager Password
- </Col>
- <Col sm={7}>
- <FormControl
- id="createDMPassword"
- type="password"
- placeholder="Enter password"
- onChange={this.handleFieldChange}
- value={createDMPassword}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createDMPasswordConfirm">
- <Col componentClass={ControlLabel} sm={5} title="Confirm password.">
- Confirm Password
- </Col>
- <Col sm={7}>
- <FormControl
- id="createDMPasswordConfirm"
- type="password"
- placeholder="Confirm password"
- onChange={this.handleFieldChange}
- value={createDMPasswordConfirm}
- />
- </Col>
- </FormGroup>
- <hr />
- <h5 className="ds-center">Optional Database Settings</h5>
- <FormGroup className="ds-margin-top-lg" controlId="createDBSuffix">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="Database suffix, like 'dc=example,dc=com'. The suffix must be a valid LDAP Distiguished Name (DN)"
- >
- Database Suffix
- </Col>
- <Col sm={7}>
- <FormControl
- type="text"
- id="createDBSuffix"
- placeholder="e.g. dc=example,dc=com"
- onChange={this.handleFieldChange}
- value={createDBSuffix}
- />
- </Col>
- </FormGroup>
- <FormGroup controlId="createDBName">
- <Col
- componentClass={ControlLabel}
- sm={5}
- title="The name for the backend database, like 'userroot'. The name can be a combination of alphanumeric characters, dashes (-), and underscores (_). No other characters are allowed, and the name must be unique across all backends."
- >
- Database Name
- </Col>
- <Col sm={7}>
- <FormControl
- type="text"
- id="createDBName"
- placeholder="e.g. userRoot"
- onChange={this.handleFieldChange}
- value={createDBName}
- />
- </Col>
- </FormGroup>
- <FormGroup
- key="createInitDBn"
- controlId="createInitDBn"
- disabled={false}
- >
- <Col smOffset={5} sm={7}>
- <Radio
- id="createInitDB"
- value="noInit"
- name="noInit"
- inline
- checked={createInitDB === "noInit"}
- onChange={this.handleFieldChange}
- >
- Do Not Initialize Database
- </Radio>
- </Col>
- </FormGroup>
- <FormGroup
- key="createInitDBs"
- controlId="createInitDBs"
- disabled={false}
- >
- <Col smOffset={5} sm={7}>
- <Radio
- id="createInitDB"
- value="createSuffix"
- name="createSuffix"
- inline
- checked={createInitDB === "createSuffix"}
- onChange={this.handleFieldChange}
- >
- Create Suffix Entry
- </Radio>
- </Col>
- </FormGroup>
- <FormGroup
- key="createInitDBp"
- controlId="createInitDBp"
- disabled={false}
- >
- <Col smOffset={5} sm={7}>
- <Radio
- id="createInitDB"
- value="createSample"
- name="createSample"
- inline
- checked={createInitDB === "createSample"}
- onChange={this.handleFieldChange}
- >
- Create Suffix Entry And Add Sample Entries
- </Radio>
- </Col>
- </FormGroup>
- </Form>
- {createSpinner}
- </Modal.Body>
- <Modal.Footer>
- <Button bsStyle="default" className="btn-cancel" onClick={closeHandler}>
- Cancel
- </Button>
- <Button bsStyle="primary" onClick={this.createInstance}>
- Create Instance
- </Button>
- </Modal.Footer>
- </div>
- </Modal>
- );
- }
-}
-
-CreateInstanceModal.propTypes = {
- showModal: PropTypes.bool,
- closeHandler: PropTypes.func,
- addNotification: PropTypes.func,
- loadInstanceList: PropTypes.func
-};
-
-CreateInstanceModal.defaultProps = {
- showModal: false,
- closeHandler: noop,
- addNotification: noop,
- loadInstanceList: noop
-};
-
-export class SchemaReloadModal extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- reloadSchemaDir: "",
- loadingSchemaTask: false
- };
-
- this.reloadSchema = this.reloadSchema.bind(this);
- this.handleFieldChange = this.handleFieldChange.bind(this);
- }
-
- handleFieldChange(e) {
- this.setState({
- [e.target.id]: e.target.value
- });
- }
-
- reloadSchema(e) {
- const { addNotification, serverId, closeHandler } = this.props;
- const { reloadSchemaDir } = this.state;
-
- this.setState({
- loadingSchemaTask: true
- });
-
- let cmd = ["dsconf", "-j", serverId, "schema", "reload", "--wait"];
- if (reloadSchemaDir !== "") {
- cmd = [...cmd, "--schemadir", reloadSchemaDir];
- }
- log_cmd("reloadSchemaDir", "Reload schema files", cmd);
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .done(data => {
- addNotification("success", "Successfully reloaded schema");
- this.setState({
- loadingSchemaTask: false
- });
- closeHandler();
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- addNotification("error", `Failed to reload schema files - ${errMsg.desc}`);
- closeHandler();
- });
- }
-
- render() {
- const { loadingSchemaTask, reloadSchemaDir } = this.state;
- const { showModal, closeHandler } = this.props;
-
- let spinner = "";
- if (loadingSchemaTask) {
- spinner = (
- <Row>
- <div className="ds-margin-top ds-modal-spinner">
- <Spinner loading inline size="md" />
- Reloading schema files...
- </div>
- </Row>
- );
- }
-
- return (
- <Modal show={showModal} onHide={closeHandler}>
- <div className="ds-no-horizontal-scrollbar">
- <Modal.Header>
- <button
- className="close"
- onClick={closeHandler}
- aria-hidden="true"
- aria-label="Close"
- >
- <Icon type="pf" name="close" />
- </button>
- <Modal.Title>Reload Schema Files</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <Form horizontal autoComplete="off">
- <Row title="The name of the database link.">
- <Col sm={3}>
- <ControlLabel>Schema File Directory:</ControlLabel>
- </Col>
- <Col sm={9}>
- <FormControl
- type="text"
- id="reloadSchemaDir"
- value={reloadSchemaDir}
- onChange={this.handleFieldChange}
- />
- </Col>
- </Row>
- {spinner}
- </Form>
- </Modal.Body>
- <Modal.Footer>
- <Button bsStyle="default" className="btn-cancel" onClick={closeHandler}>
- Cancel
- </Button>
- <Button bsStyle="primary" onClick={this.reloadSchema}>
- Reload Schema
- </Button>
- </Modal.Footer>
- </div>
- </Modal>
- );
- }
-}
-
-SchemaReloadModal.propTypes = {
- showModal: PropTypes.bool,
- closeHandler: PropTypes.func,
- addNotification: PropTypes.func,
- serverId: PropTypes.string
-};
-
-SchemaReloadModal.defaultProps = {
- showModal: false,
- closeHandler: noop,
- addNotification: noop,
- serverId: ""
-};
-
-class ManageBackupsModal extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- activeKey: 1,
- showConfirmBackupDelete: false,
- showConfirmBackup: false,
- showConfirmRestore: false,
- showConfirmRestoreReplace: false,
- showConfirmLDIFReplace: false,
- showRestoreSpinningModal: false,
- showDelBackupSpinningModal: false,
- showBackupModal: false,
- backupSpinning: false,
- backupName: "",
- deleteBackup: "",
- errObj: {}
- };
-
- this.handleNavSelect = this.handleNavSelect.bind(this);
- this.handleChange = this.handleChange.bind(this);
-
- // Backups
- this.doBackup = this.doBackup.bind(this);
- this.deleteBackup = this.deleteBackup.bind(this);
- this.restoreBackup = this.restoreBackup.bind(this);
- this.showConfirmRestore = this.showConfirmRestore.bind(this);
- this.closeConfirmRestore = this.closeConfirmRestore.bind(this);
- this.showConfirmBackup = this.showConfirmBackup.bind(this);
- this.closeConfirmBackup = this.closeConfirmBackup.bind(this);
- this.showConfirmBackupDelete = this.showConfirmBackupDelete.bind(this);
- this.closeConfirmBackupDelete = this.closeConfirmBackupDelete.bind(this);
- this.showBackupModal = this.showBackupModal.bind(this);
- this.closeBackupModal = this.closeBackupModal.bind(this);
- this.showRestoreSpinningModal = this.showRestoreSpinningModal.bind(this);
- this.closeRestoreSpinningModal = this.closeRestoreSpinningModal.bind(this);
- this.showDelBackupSpinningModal = this.showDelBackupSpinningModal.bind(this);
- this.closeDelBackupSpinningModal = this.closeDelBackupSpinningModal.bind(this);
- this.validateBackup = this.validateBackup.bind(this);
- this.closeConfirmRestoreReplace = this.closeConfirmRestoreReplace.bind(this);
- }
-
- closeExportModal() {
- this.setState({
- showExportModal: false
- });
- }
-
- showDelBackupSpinningModal() {
- this.setState({
- showDelBackupSpinningModal: true
- });
- }
-
- closeDelBackupSpinningModal() {
- this.setState({
- showDelBackupSpinningModal: false
- });
- }
-
- showRestoreSpinningModal() {
- this.setState({
- showRestoreSpinningModal: true
- });
- }
-
- closeRestoreSpinningModal() {
- this.setState({
- showRestoreSpinningModal: false
- });
- }
-
- showBackupModal() {
- this.setState({
- showBackupModal: true,
- backupSpinning: false,
- backupName: ""
- });
- }
-
- closeBackupModal() {
- this.setState({
- showBackupModal: false
- });
- }
-
- showConfirmBackup(item) {
- // call deleteLDIF
- this.setState({
- showConfirmBackup: true,
- backupName: item.name
- });
- }
-
- closeConfirmBackup() {
- // call importLDIF
- this.setState({
- showConfirmBackup: false
- });
- }
-
- showConfirmRestore(item) {
- this.setState({
- showConfirmRestore: true,
- backupName: item.name
- });
- }
-
- closeConfirmRestore() {
- // call importLDIF
- this.setState({
- showConfirmRestore: false
- });
- }
-
- showConfirmBackupDelete(item) {
- // calls deleteBackup
- this.setState({
- showConfirmBackupDelete: true,
- backupName: item.name
- });
- }
-
- closeConfirmBackupDelete() {
- // call importLDIF
- this.setState({
- showConfirmBackupDelete: false
- });
- }
-
- closeConfirmRestoreReplace() {
- this.setState({
- showConfirmRestoreReplace: false
- });
- }
-
- validateBackup() {
- for (let i = 0; i < this.props.backups.length; i++) {
- if (this.state.backupName == this.props.backups[i]["name"]) {
- this.setState({
- showConfirmRestoreReplace: true
- });
- return;
- }
- }
- this.doBackup();
- }
-
- doBackup() {
- this.setState({
- backupSpinning: true
- });
-
- let cmd = ["dsctl", "-j", this.props.serverId, "status"];
- cockpit
- .spawn(cmd, { superuser: true })
- .done(status_data => {
- let status_json = JSON.parse(status_data);
- if (status_json.running == true) {
- let cmd = [
- "dsconf",
- "-j",
- "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
- "backup",
- "create"
- ];
- if (this.state.backupName != "") {
- if (bad_file_name(this.state.backupName)) {
- this.props.addNotification(
- "warning",
- `Backup name should not be a path. All backups are stored in the server's backup directory`
- );
- return;
- }
- cmd.push(this.state.backupName);
- }
-
- log_cmd("doBackup", "Add backup task online", cmd);
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .done(content => {
- this.props.reload();
- this.closeBackupModal();
- this.props.addNotification("success", `Server has been backed up`);
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.props.reload();
- this.closeBackupModal();
- this.props.addNotification(
- "error",
- `Failure backing up server - ${errMsg.desc}`
- );
- });
- } else {
- const cmd = ["dsctl", "-j", this.props.serverId, "db2bak"];
- if (this.state.backupName != "") {
- if (bad_file_name(this.state.backupName)) {
- this.props.addNotification(
- "warning",
- `Backup name should not be a path. All backups are stored in the server's backup directory`
- );
- return;
- }
- cmd.push(this.state.backupName);
- }
- log_cmd("doBackup", "Doing backup of the server offline", cmd);
- cockpit
- .spawn(cmd, { superuser: true })
- .done(content => {
- this.props.reload();
- this.closeBackupModal();
- this.props.addNotification("success", `Server has been backed up`);
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.props.reload();
- this.closeBackupModal();
- this.props.addNotification(
- "error",
- `Failure backing up server - ${errMsg.desc}`
- );
- });
- }
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- console.log("Failed to check the server status", errMsg.desc);
- });
- }
-
- restoreBackup() {
- this.showRestoreSpinningModal();
- let cmd = ["dsctl", "-j", this.props.serverId, "status"];
- cockpit
- .spawn(cmd, { superuser: true })
- .done(status_data => {
- let status_json = JSON.parse(status_data);
- if (status_json.running == true) {
- const cmd = [
- "dsconf",
- "-j",
- "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
- "backup",
- "restore",
- this.state.backupName
- ];
- log_cmd("restoreBackup", "Restoring server online", cmd);
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .done(content => {
- this.closeRestoreSpinningModal();
- this.props.addNotification("success", `Server has been restored`);
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.closeRestoreSpinningModal();
- this.props.addNotification(
- "error",
- `Failure restoring up server - ${errMsg.desc}`
- );
- });
- } else {
- const cmd = [
- "dsctl",
- "-j",
- this.props.serverId,
- "bak2db",
- this.state.backupName
- ];
- log_cmd("restoreBackup", "Restoring server offline", cmd);
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .done(content => {
- this.closeRestoreSpinningModal();
- this.props.addNotification("success", `Server has been restored`);
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.closeRestoreSpinningModal();
- this.props.addNotification(
- "error",
- `Failure restoring up server - ${errMsg.desc}`
- );
- });
- }
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- console.log("Failed to check the server status", errMsg.desc);
- });
- }
-
- deleteBackup(e) {
- // Show confirmation
- this.showDelBackupSpinningModal();
-
- const cmd = [
- "dsctl",
- "-j",
- this.props.serverId,
- "backups",
- "--delete",
- this.state.backupName
- ];
- log_cmd("deleteBackup", "Deleting backup", cmd);
- cockpit
- .spawn(cmd, { superuser: true, err: "message" })
- .done(content => {
- this.props.reload();
- this.closeDelBackupSpinningModal();
- this.props.addNotification("success", `Backup was successfully deleted`);
- })
- .fail(err => {
- let errMsg = JSON.parse(err);
- this.props.reload();
- this.closeDelBackupSpinningModal();
- this.props.addNotification("error", `Failure deleting backup - ${errMsg.desc}`);
- });
- }
-
- handleNavSelect(key) {
- this.setState({ activeKey: key });
- }
-
- handleChange(e) {
- const value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
- let valueErr = false;
- let errObj = this.state.errObj;
- if (value == "") {
- valueErr = true;
- }
- errObj[e.target.id] = valueErr;
- this.setState({
- [e.target.id]: value,
- errObj: errObj
- });
- }
-
- render() {
- const { showModal, closeHandler, backups, reload, loadingBackup } = this.props;
-
- let backupSpinner = "";
- if (loadingBackup) {
- backupSpinner = (
- <Row>
- <div className="ds-margin-top-lg ds-modal-spinner">
- <Spinner loading inline size="lg" />
- Creating instance...
- </div>
- </Row>
- );
- }
-
- return (
- <div>
- <Modal show={showModal} onHide={closeHandler}>
- <div className="ds-no-horizontal-scrollbar">
- <Modal.Header>
- <button
- className="close"
- onClick={closeHandler}
- aria-hidden="true"
- aria-label="Close"
- >
- <Icon type="pf" name="close" />
- </button>
- <Modal.Title>Manage Backups</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <div className="ds-margin-top-xlg">
- <BackupTable
- rows={backups}
- confirmRestore={this.showConfirmRestore}
- confirmDelete={this.showConfirmBackupDelete}
- />
- </div>
- {backupSpinner}
- </Modal.Body>
- <Modal.Footer>
- <Button
- bsStyle="primary"
- onClick={this.showBackupModal}
- className="ds-margin-top"
- >
- Create Backup
- </Button>
- <Button
- bsStyle="default"
- onClick={reload}
- className="ds-left-margin ds-margin-top"
- >
- Refresh Backups
- </Button>
- </Modal.Footer>
- </div>
- </Modal>
- <BackupModal
- showModal={this.state.showBackupModal}
- closeHandler={this.closeBackupModal}
- handleChange={this.handleChange}
- saveHandler={this.validateBackup}
- spinning={this.state.backupSpinning}
- error={this.state.errObj}
- />
- <RestoreModal
- showModal={this.state.showRestoreSpinningModal}
- closeHandler={this.closeRestoreSpinningModal}
- msg={this.state.backupName}
- />
- <DeleteBackupModal
- showModal={this.state.showDelBackupSpinningModal}
- closeHandler={this.closeDelBackupSpinningModal}
- msg={this.state.backupName}
- />
- <ConfirmPopup
- showModal={this.state.showConfirmRestore}
- closeHandler={this.closeConfirmRestore}
- actionFunc={this.restoreBackup}
- actionParam={this.state.backupName}
- msg="Are you sure you want to restore this backup?"
- msgContent={this.state.backupName}
- />
- <ConfirmPopup
- showModal={this.state.showConfirmBackupDelete}
- closeHandler={this.closeConfirmBackupDelete}
- actionFunc={this.deleteBackup}
- actionParam={this.state.backupName}
- msg="Are you sure you want to delete this backup?"
- msgContent={this.state.backupName}
- />
- <ConfirmPopup
- showModal={this.state.showConfirmRestoreReplace}
- closeHandler={this.closeConfirmRestoreReplace}
- actionFunc={this.doBackup}
- msg="Replace Existing Backup"
- msgContent="A backup already eixsts with the same name, do you want to replace it?"
- />
- </div>
- );
- }
-}
-
-ManageBackupsModal.propTypes = {
- showModal: PropTypes.bool,
- closeHandler: PropTypes.func,
- addNotification: PropTypes.func,
- serverId: PropTypes.string
-};
-
-ManageBackupsModal.defaultProps = {
- showModal: false,
- closeHandler: noop,
- addNotification: noop,
- serverId: ""
-};
-
export default DSInstance;
diff --git a/src/cockpit/389-console/src/dsModals.jsx b/src/cockpit/389-console/src/dsModals.jsx
new file mode 100644
index 000000000..8f59e0844
--- /dev/null
+++ b/src/cockpit/389-console/src/dsModals.jsx
@@ -0,0 +1,1356 @@
+import cockpit from "cockpit";
+import React from "react";
+import PropTypes from "prop-types";
+import { ConfirmPopup } from "./lib/notifications.jsx";
+import { BackupTable } from "./lib/database/databaseTables.jsx";
+import { BackupModal, RestoreModal, DeleteBackupModal } from "./lib/database/backups.jsx";
+import { log_cmd, bad_file_name, valid_dn, valid_port } from "./lib/tools.jsx";
+
+import {
+ FormControl,
+ FormGroup,
+ ControlLabel,
+ Form,
+ noop,
+ Checkbox,
+ Spinner,
+ Row,
+ Modal,
+ Icon,
+ Col,
+ Button
+} from "patternfly-react";
+import "./css/ds.css";
+
+export class CreateInstanceModal extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ createServerId: "",
+ createPort: 389,
+ createSecurePort: 636,
+ createDM: "cn=Directory Manager",
+ createDMPassword: "",
+ createDMPasswordConfirm: "",
+ createDBCheckbox: false,
+ createDBSuffix: "",
+ createDBName: "",
+ createTLSCert: true,
+ createInitDB: "noInit",
+ loadingCreate: false,
+ createOK: false,
+ modalMsg: "",
+ errObj: {},
+ };
+
+ this.handleFieldChange = this.handleFieldChange.bind(this);
+ this.createInstance = this.createInstance.bind(this);
+ this.validInstName = this.validInstName.bind(this);
+ this.validRootDN = this.validRootDN.bind(this);
+ this.resetModal = this.resetModal.bind(this);
+ }
+
+ componentDidMount() {
+ this.resetModal();
+ }
+
+ resetModal() {
+ this.setState({
+ createServerId: "",
+ createPort: 389,
+ createSecurePort: 636,
+ createDM: "cn=Directory Manager",
+ createDMPassword: "",
+ createDMPasswordConfirm: "",
+ createDBCheckbox: false,
+ createDBSuffix: "",
+ createDBName: "",
+ createTLSCert: true,
+ createInitDB: "noInit",
+ loadingCreate: false,
+ createOK: false,
+ modalMsg: "",
+ errObj: {
+ createServerId: true,
+ createDMPassword: true,
+ createDMPasswordConfirm: true,
+ createDBSuffix: false,
+ createDBName: false,
+ },
+ });
+ }
+
+ validInstName(name) {
+ return /^[\w@_:-]*$/.test(name);
+ }
+
+ validRootDN(dn) {
+ // Validate a DN for Directory Manager. We have to be stricter than
+ // valid_dn() and only allow stand ascii characters for the value
+ if (dn.endsWith(",")) {
+ return false;
+ }
+ // Check that the attr is only letters [A-Za-z]+ and the value is standard
+ // ascii [ -~]+ that it does not start with a space \\S
+ let dn_regex = new RegExp("^([A-Za-z]+=\\S[ -~]+$)");
+ let result = dn_regex.test(dn);
+ return result;
+ }
+
+ handleFieldChange(e) {
+ let value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
+ let target_id = e.target.id;
+ let valueErr = false;
+ let errObj = this.state.errObj;
+ let all_good = true;
+ let modal_msg = "";
+
+ errObj[target_id] = valueErr;
+ if (target_id == 'createServerId') {
+ if (value == "") {
+ all_good = false;
+ errObj['createServerId'] = true;
+ } else if (value > 80) {
+ all_good = false;
+ errObj['createServerId'] = true;
+ modal_msg = "Instance name must be less than 80 characters";
+ } else if (!this.validInstName(value)) {
+ all_good = false;
+ errObj['createServerId'] = true;
+ modal_msg = "Instance name can only contain letters, numbers, and these 4 characters: - @ : _";
+ }
+ } else if (this.state.createServerId == "") {
+ all_good = false;
+ errObj['createServerId'] = true;
+ } else if (!this.validInstName(this.state.createServerId)) {
+ all_good = false;
+ errObj['createServerId'] = true;
+ modal_msg = "Not all required fields have values";
+ }
+ if (target_id == 'createPort') {
+ if (value == "") {
+ all_good = false;
+ errObj['createPort'] = true;
+ } else if (!valid_port(value)) {
+ all_good = false;
+ errObj['createPort'] = true;
+ modal_msg = "Invalid Port number. The port must be between 1 and 65534";
+ }
+ } else if (this.state.createPort == "") {
+ all_good = false;
+ errObj['createPort'] = true;
+ } else if (!valid_port(this.state.createPort)) {
+ all_good = false;
+ errObj['createPort'] = true;
+ modal_msg = "Invalid Port number. The port must be between 1 and 65534";
+ }
+ if (target_id == 'createSecurePort') {
+ if (value == "") {
+ all_good = false;
+ errObj['createSecurePort'] = true;
+ } else if (!valid_port(value)) {
+ all_good = false;
+ errObj['createSecurePort'] = true;
+ modal_msg = "Invalid Secure Port number. Port must be between 1 and 65534";
+ }
+ } else if (this.state.createSecurePort == "") {
+ all_good = false;
+ errObj['createSecurePort'] = true;
+ }
+ if (target_id == 'createDM') {
+ if (value == "") {
+ all_good = false;
+ errObj['createDM'] = true;
+ }
+ if (!this.validRootDN(value)) {
+ all_good = false;
+ errObj['createDM'] = true;
+ modal_msg = "Invalid DN for Directory Manager";
+ }
+ } else if (this.state.createDM == "") {
+ all_good = false;
+ errObj['createDM'] = true;
+ } else if (!this.validRootDN(this.state.createDM)) {
+ all_good = false;
+ errObj['createDM'] = true;
+ modal_msg = "Invalid DN for Directory Manager";
+ }
+ if (e.target.id == 'createDMPassword') {
+ if (value == "") {
+ all_good = false;
+ errObj['createDMPassword'] = true;
+ } else if (value != this.state.createDMPasswordConfirm) {
+ all_good = false;
+ errObj['createDMPassword'] = true;
+ errObj['createDMPasswordConfirm'] = true;
+ modal_msg = "Passwords Do Not Match";
+ } else if (value.length < 8) {
+ all_good = false;
+ errObj['createDMPassword'] = true;
+ modal_msg = "Directory Manager password must be at least 8 characters long";
+ } else {
+ errObj['createDMPassword'] = false;
+ errObj['createDMPasswordConfirm'] = false;
+ }
+ } else if (this.state.createDMPassword == "") {
+ all_good = false;
+ errObj['createDMPasswordConfirm'] = true;
+ }
+ if (e.target.id == 'createDMPasswordConfirm') {
+ if (value == "") {
+ all_good = false;
+ errObj['createDMPasswordConfirm'] = true;
+ } else if (value != this.state.createDMPassword) {
+ all_good = false;
+ errObj['createDMPassword'] = true;
+ errObj['createDMPasswordConfirm'] = true;
+ modal_msg = "Passwords Do Not Match";
+ } else if (value.length < 8) {
+ all_good = false;
+ errObj['createDMPasswordConfirm'] = true;
+ modal_msg = "Directory Manager password must be at least 8 characters long";
+ } else {
+ errObj['createDMPassword'] = false;
+ errObj['createDMPasswordConfirm'] = false;
+ }
+ } else if (this.state.createDMPasswordConfirm == "") {
+ all_good = false;
+ errObj['createDMPasswordConfirm'] = true;
+ }
+
+ // Optional settings
+ if (target_id == 'createDBCheckbox') {
+ if (!value) {
+ errObj['createDBSuffix'] = false;
+ errObj['createDBName'] = false;
+ } else {
+ if (this.state.createDBSuffix == "") {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ } else if (!valid_dn(this.state.createDBSuffix)) {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ modal_msg = "Invalid DN for suffix";
+ }
+ if (this.state.createDBName == "") {
+ all_good = false;
+ errObj['createDBName'] = true;
+ } else if (!valid_dn(this.state.createDBName)) {
+ all_good = false;
+ errObj['createDBName'] = true;
+ modal_msg = "Invalid name for database";
+ }
+ }
+ } else if (this.state.createDBCheckbox) {
+ if (target_id == 'createDBSuffix') {
+ if (value == "") {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ } else if (!valid_dn(value)) {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ modal_msg = "Invalid DN for suffix";
+ }
+ } else if (this.state.createDBSuffix == "") {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ } else if (!valid_dn(this.state.createDBSuffix)) {
+ all_good = false;
+ errObj['createDBSuffix'] = true;
+ modal_msg = "Invalid DN for suffix";
+ }
+ if (target_id == 'createDBName') {
+ if (value == "") {
+ all_good = false;
+ errObj['createDBName'] = true;
+ } else if (/\s/.test(value)) {
+ // name has some kind of white space character
+ all_good = false;
+ errObj['createDBName'] = true;
+ modal_msg = "Database name can not contain any spaces";
+ }
+ } else if (this.state.createDBName == "") {
+ all_good = false;
+ errObj['createDBName'] = true;
+ } else if (/\s/.test(this.state.createDBName)) {
+ all_good = false;
+ errObj['createDBName'] = true;
+ modal_msg = "Invalid database name";
+ }
+ } else {
+ errObj['createDBSuffix'] = false;
+ errObj['createDBName'] = false;
+ }
+
+ this.setState({
+ [target_id]: value,
+ errObj: errObj,
+ createOK: all_good,
+ modalMsg: modal_msg,
+ });
+ }
+
+ createInstance() {
+ const {
+ createServerId,
+ createPort,
+ createSecurePort,
+ createDM,
+ createDMPassword,
+ createDBSuffix,
+ createDBName,
+ createTLSCert,
+ createInitDB,
+ createDBCheckbox
+ } = this.state;
+ const { closeHandler, addNotification, loadInstanceList } = this.props;
+
+ let setup_inf =
+ "[general]\n" +
+ "config_version = 2\n" +
+ "full_machine_name = FQDN\n\n" +
+ "[slapd]\n" +
+ "user = dirsrv\n" +
+ "group = dirsrv\n" +
+ "instance_name = INST_NAME\n" +
+ "port = PORT\n" +
+ "root_dn = ROOTDN\n" +
+ "root_password = ROOTPW\n" +
+ "secure_port = SECURE_PORT\n" +
+ "self_sign_cert = SELF_SIGN\n";
+
+ // Server ID
+ let newServerId = createServerId;
+ newServerId = newServerId.replace(/^slapd-/i, ""); // strip "slapd-"
+ setup_inf = setup_inf.replace("INST_NAME", newServerId);
+ setup_inf = setup_inf.replace("PORT", createPort);
+ setup_inf = setup_inf.replace("SECURE_PORT", createSecurePort);
+ setup_inf = setup_inf.replace("ROOTDN", createDM);
+ setup_inf = setup_inf.replace("ROOTPW", createDMPassword);
+ // Setup Self-Signed Certs
+ if (createTLSCert) {
+ setup_inf = setup_inf.replace("SELF_SIGN", "True");
+ } else {
+ setup_inf = setup_inf.replace("SELF_SIGN", "False");
+ }
+
+ if (createDBCheckbox) {
+ setup_inf += "\n[backend-" + createDBName + "]\nsuffix = " + createDBSuffix + "\n";
+ if (createInitDB === "createSample") {
+ setup_inf += "sample_entries = yes\n";
+ }
+ if (createInitDB === "createSuffix") {
+ setup_inf += "create_suffix_entry = yes\n";
+ }
+ }
+
+ /*
+ * Here are steps we take to create the instance
+ *
+ * [1] Get FQDN Name for nsslapd-localhost setting in setup file
+ * [2] Create a file for the inf setup parameters
+ * [3] Set strict permissions on that file
+ * [4] Populate the new setup file with settings (including cleartext password)
+ * [5] Create the instance
+ * [6] Remove setup file
+ */
+ this.setState({
+ loadingCreate: true
+ });
+ cockpit
+ .spawn(["hostnamectl", "status", "--static"], { superuser: true, err: "message" })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.setState({
+ loadingCreate: false
+ });
+ addNotification("error", `Failed to get hostname!", ${errMsg.desc}`);
+ })
+ .done(data => {
+ /*
+ * We have FQDN, so set the hostname in inf file, and create the setup file
+ */
+ setup_inf = setup_inf.replace("FQDN", data);
+ let setup_file = "/tmp/389-setup-" + new Date().getTime() + ".inf";
+ let rm_cmd = ["rm", setup_file];
+ let create_file_cmd = ["touch", setup_file];
+ log_cmd("createInstance", "Setting FQDN...", create_file_cmd);
+ cockpit
+ .spawn(create_file_cmd, { superuser: true, err: "message" })
+ .fail(err => {
+ this.setState({
+ loadingCreate: false
+ });
+ addNotification(
+ "error",
+ `Failed to create installation file!" ${err.message}`
+ );
+ })
+ .done(_ => {
+ /*
+ * We have our new setup file, now set permissions on that setup file before we add sensitive data
+ */
+ let chmod_cmd = ["chmod", "600", setup_file];
+ log_cmd("createInstance", "Setting initial INF file permissions...", chmod_cmd);
+ cockpit
+ .spawn(chmod_cmd, { superuser: true, err: "message" })
+ .fail(err => {
+ cockpit.spawn(rm_cmd, { superuser: true, err: "message" }); // Remove Inf file with clear text password
+ this.setState({
+ loadingCreate: false
+ });
+ addNotification(
+ "error",
+ `Failed to set permissions on setup file ${setup_file}: ${err.message}`
+ );
+ })
+ .done(_ => {
+ /*
+ * Success we have our setup file and it has the correct permissions.
+ * Now populate the setup file...
+ */
+ let cmd = [
+ "/bin/sh",
+ "-c",
+ '/usr/bin/echo -e "' + setup_inf + '" >> ' + setup_file
+ ];
+ // Do not log inf file as it contains the DM password
+ log_cmd("createInstance", "Apply changes to INF file...", "");
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .fail(err => {
+ this.setState({
+ loadingCreate: false
+ });
+ addNotification(
+ "error",
+ `Failed to populate installation file! ${err.message}`
+ );
+ })
+ .done(_ => {
+ /*
+ * Next, create the instance...
+ */
+ let cmd = ["dscreate", "-j", "from-file", setup_file];
+ log_cmd("createInstance", "Creating instance...", cmd);
+ cockpit
+ .spawn(cmd, {
+ superuser: true,
+ err: "message"
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
+ this.setState({
+ loadingCreate: false
+ });
+ addNotification(
+ "error",
+ `${errMsg.desc}`
+ );
+ })
+ .done(_ => {
+ // Success!!! Now cleanup everything up...
+ log_cmd("createInstance", "Instance creation compelete, clean everything up...", rm_cmd);
+ cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
+ this.setState({
+ loadingCreate: false
+ });
+
+ loadInstanceList(createServerId);
+ addNotification(
+ "success",
+ `Successfully created instance: slapd-${createServerId}`
+ );
+ closeHandler();
+ this.resetModal();
+ });
+ });
+ });
+ });
+ });
+ }
+
+ render() {
+ const { showModal, closeHandler } = this.props;
+
+ const {
+ loadingCreate,
+ createServerId,
+ createPort,
+ createSecurePort,
+ createDM,
+ createDMPassword,
+ createDMPasswordConfirm,
+ createDBCheckbox,
+ createDBSuffix,
+ createDBName,
+ createTLSCert,
+ createInitDB,
+ createOK,
+ modalMsg,
+ errObj,
+ } = this.state;
+ let errMsgClass = "";
+ let errMsg = "";
+ let createSpinner = "";
+ if (loadingCreate) {
+ createSpinner = (
+ <Row>
+ <div className="ds-margin-top-lg ds-modal-spinner">
+ <Spinner loading inline size="lg" />
+ Creating instance...
+ </div>
+ </Row>
+ );
+ }
+
+ if (modalMsg == "") {
+ // No errors, but to keep the modal nice and stable during input
+ // field validation we need "invisible" text to keep the modal form
+ // from jumping up and down.
+ errMsgClass = "ds-clear-text";
+ errMsg = "no errors";
+ } else {
+ // We have error text to report
+ errMsgClass = "ds-modal-error";
+ errMsg = modalMsg;
+ }
+
+ return (
+ <Modal show={showModal} onHide={closeHandler}>
+ <div className="ds-no-horizontal-scrollbar">
+ <Modal.Header>
+ <button
+ className="close"
+ onClick={closeHandler}
+ aria-hidden="true"
+ aria-label="Close"
+ >
+ <Icon type="pf" name="close" />
+ </button>
+ <Modal.Title className="ds-center">Create New Server Instance</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <Form horizontal>
+ <Row>
+ <Col className="ds-center" sm={12}>
+ <p className={errMsgClass}>{errMsg}</p>
+ </Col>
+ </Row>
+ <FormGroup controlId="createServerId" className="ds-margin-top-lg">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="The instance name, this is what gets appended to 'slapi-'. The instance name can only contain letters, numbers, and: # @ : - _"
+ >
+ Instance Name
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ id="createServerId"
+ type="text"
+ placeholder="Your_Instance_Name"
+ value={createServerId}
+ onChange={this.handleFieldChange}
+ className={errObj.createServerId ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createPort">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="The server port number"
+ >
+ Port
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ id="createPort"
+ type="number"
+ min="0"
+ max="65535"
+ value={createPort}
+ onChange={this.handleFieldChange}
+ className={errObj.createPort ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createSecurePort">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="The secure port number for TLS connections"
+ >
+ Secure Port
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ id="createSecurePort"
+ type="number"
+ min="0"
+ max="65535"
+ value={createSecurePort}
+ onChange={this.handleFieldChange}
+ className={errObj.createSecurePort ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createTLSCert">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="Create a self-signed certificate database"
+ >
+ Create Self-Signed TLS Certificate
+ </Col>
+ <Col sm={7}>
+ <Checkbox
+ id="createTLSCert"
+ checked={createTLSCert}
+ onChange={this.handleFieldChange}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createDM">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="The DN for the unrestricted user"
+ >
+ Directory Manager DN
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ type="text"
+ id="createDM"
+ onChange={this.handleFieldChange}
+ value={createDM}
+ className={errObj.createDM ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createDMPassword">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="Directory Manager password."
+ >
+ Directory Manager Password
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ id="createDMPassword"
+ type="password"
+ placeholder="Enter password"
+ onChange={this.handleFieldChange}
+ value={createDMPassword}
+ className={errObj.createDMPassword ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createDMPasswordConfirm">
+ <Col componentClass={ControlLabel} sm={5} title="Confirm password.">
+ Confirm Password
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ id="createDMPasswordConfirm"
+ type="password"
+ placeholder="Confirm password"
+ onChange={this.handleFieldChange}
+ value={createDMPasswordConfirm}
+ className={errObj.createDMPasswordConfirm ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <hr />
+ <FormGroup controlId="createDBCheckbox">
+ <Col componentClass={ControlLabel} sm={5} title="Confirm password.">
+ <Checkbox
+ id="createDBCheckbox"
+ checked={createDBCheckbox}
+ onChange={this.handleFieldChange}
+ >
+ Create Database
+ </Checkbox>
+ </Col>
+ </FormGroup>
+ <FormGroup className="ds-margin-top-lg" controlId="createDBSuffix">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="Database suffix, like 'dc=example,dc=com'. The suffix must be a valid LDAP Distiguished Name (DN)"
+ >
+ Database Suffix
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ type="text"
+ id="createDBSuffix"
+ placeholder="e.g. dc=example,dc=com"
+ onChange={this.handleFieldChange}
+ value={createDBSuffix}
+ disabled={!createDBCheckbox}
+ className={errObj.createDBSuffix ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup controlId="createDBName">
+ <Col
+ componentClass={ControlLabel}
+ sm={5}
+ title="The name for the backend database, like 'userroot'. The name can be a combination of alphanumeric characters, dashes (-), and underscores (_). No other characters are allowed, and the name must be unique across all backends."
+ >
+ Database Name
+ </Col>
+ <Col sm={7}>
+ <FormControl
+ type="text"
+ id="createDBName"
+ placeholder="e.g. userRoot"
+ onChange={this.handleFieldChange}
+ value={createDBName}
+ disabled={!createDBCheckbox}
+ className={errObj.createDBName ? "ds-input-bad" : ""}
+ />
+ </Col>
+ </FormGroup>
+ <FormGroup
+ key="createInitDB"
+ controlId="createInitDB"
+ >
+ <Col componentClass={ControlLabel} sm={5}>
+ Database Initialization
+ </Col>
+ <Col sm={7}>
+ <select
+ className="btn btn-default dropdown"
+ id="createInitDB"
+ onChange={this.handleFieldChange}
+ disabled={!createDBCheckbox}
+ value={createInitDB}
+ >
+ <option value="noInit">Do Not Initialize Database</option>
+ <option value="createSuffix">Create Suffix Entry</option>
+ <option value="createSample">Create Sample Entries</option>
+ </select>
+ </Col>
+ </FormGroup>
+ </Form>
+ {createSpinner}
+ </Modal.Body>
+ <Modal.Footer>
+ <Button bsStyle="default" className="btn-cancel" onClick={closeHandler}>
+ Cancel
+ </Button>
+ <Button
+ bsStyle="primary"
+ onClick={this.createInstance}
+ disabled={!createOK}
+ >
+ Create Instance
+ </Button>
+ </Modal.Footer>
+ </div>
+ </Modal>
+ );
+ }
+}
+
+export class SchemaReloadModal extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ reloadSchemaDir: "",
+ loadingSchemaTask: false
+ };
+
+ this.reloadSchema = this.reloadSchema.bind(this);
+ this.handleFieldChange = this.handleFieldChange.bind(this);
+ }
+
+ handleFieldChange(e) {
+ this.setState({
+ [e.target.id]: e.target.value
+ });
+ }
+
+ reloadSchema(e) {
+ const { addNotification, serverId, closeHandler } = this.props;
+ const { reloadSchemaDir } = this.state;
+
+ this.setState({
+ loadingSchemaTask: true
+ });
+
+ let cmd = ["dsconf", "-j", serverId, "schema", "reload", "--wait"];
+ if (reloadSchemaDir !== "") {
+ cmd = [...cmd, "--schemadir", reloadSchemaDir];
+ }
+ log_cmd("reloadSchemaDir", "Reload schema files", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .done(data => {
+ addNotification("success", "Successfully reloaded schema");
+ this.setState({
+ loadingSchemaTask: false
+ });
+ closeHandler();
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ addNotification("error", `Failed to reload schema files - ${errMsg.desc}`);
+ closeHandler();
+ });
+ }
+
+ render() {
+ const { loadingSchemaTask, reloadSchemaDir } = this.state;
+ const { showModal, closeHandler } = this.props;
+
+ let spinner = "";
+ if (loadingSchemaTask) {
+ spinner = (
+ <Row>
+ <div className="ds-margin-top ds-modal-spinner">
+ <Spinner loading inline size="md" />
+ Reloading schema files...
+ </div>
+ </Row>
+ );
+ }
+
+ return (
+ <Modal show={showModal} onHide={closeHandler}>
+ <div className="ds-no-horizontal-scrollbar">
+ <Modal.Header>
+ <button
+ className="close"
+ onClick={closeHandler}
+ aria-hidden="true"
+ aria-label="Close"
+ >
+ <Icon type="pf" name="close" />
+ </button>
+ <Modal.Title>Reload Schema Files</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <Form horizontal autoComplete="off">
+ <Row title="The name of the database link.">
+ <Col sm={3}>
+ <ControlLabel>Schema File Directory:</ControlLabel>
+ </Col>
+ <Col sm={9}>
+ <FormControl
+ type="text"
+ id="reloadSchemaDir"
+ value={reloadSchemaDir}
+ onChange={this.handleFieldChange}
+ />
+ </Col>
+ </Row>
+ {spinner}
+ </Form>
+ </Modal.Body>
+ <Modal.Footer>
+ <Button bsStyle="default" className="btn-cancel" onClick={closeHandler}>
+ Cancel
+ </Button>
+ <Button bsStyle="primary" onClick={this.reloadSchema}>
+ Reload Schema
+ </Button>
+ </Modal.Footer>
+ </div>
+ </Modal>
+ );
+ }
+}
+
+export class ManageBackupsModal extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ activeKey: 1,
+ showConfirmBackupDelete: false,
+ showConfirmBackup: false,
+ showConfirmRestore: false,
+ showConfirmRestoreReplace: false,
+ showConfirmLDIFReplace: false,
+ showRestoreSpinningModal: false,
+ showDelBackupSpinningModal: false,
+ showBackupModal: false,
+ backupSpinning: false,
+ backupName: "",
+ deleteBackup: "",
+ errObj: {}
+ };
+
+ this.handleNavSelect = this.handleNavSelect.bind(this);
+ this.handleChange = this.handleChange.bind(this);
+
+ // Backups
+ this.doBackup = this.doBackup.bind(this);
+ this.deleteBackup = this.deleteBackup.bind(this);
+ this.restoreBackup = this.restoreBackup.bind(this);
+ this.showConfirmRestore = this.showConfirmRestore.bind(this);
+ this.closeConfirmRestore = this.closeConfirmRestore.bind(this);
+ this.showConfirmBackup = this.showConfirmBackup.bind(this);
+ this.closeConfirmBackup = this.closeConfirmBackup.bind(this);
+ this.showConfirmBackupDelete = this.showConfirmBackupDelete.bind(this);
+ this.closeConfirmBackupDelete = this.closeConfirmBackupDelete.bind(this);
+ this.showBackupModal = this.showBackupModal.bind(this);
+ this.closeBackupModal = this.closeBackupModal.bind(this);
+ this.showRestoreSpinningModal = this.showRestoreSpinningModal.bind(this);
+ this.closeRestoreSpinningModal = this.closeRestoreSpinningModal.bind(this);
+ this.showDelBackupSpinningModal = this.showDelBackupSpinningModal.bind(this);
+ this.closeDelBackupSpinningModal = this.closeDelBackupSpinningModal.bind(this);
+ this.validateBackup = this.validateBackup.bind(this);
+ this.closeConfirmRestoreReplace = this.closeConfirmRestoreReplace.bind(this);
+ }
+
+ closeExportModal() {
+ this.setState({
+ showExportModal: false
+ });
+ }
+
+ showDelBackupSpinningModal() {
+ this.setState({
+ showDelBackupSpinningModal: true
+ });
+ }
+
+ closeDelBackupSpinningModal() {
+ this.setState({
+ showDelBackupSpinningModal: false
+ });
+ }
+
+ showRestoreSpinningModal() {
+ this.setState({
+ showRestoreSpinningModal: true
+ });
+ }
+
+ closeRestoreSpinningModal() {
+ this.setState({
+ showRestoreSpinningModal: false
+ });
+ }
+
+ showBackupModal() {
+ this.setState({
+ showBackupModal: true,
+ backupSpinning: false,
+ backupName: ""
+ });
+ }
+
+ closeBackupModal() {
+ this.setState({
+ showBackupModal: false
+ });
+ }
+
+ showConfirmBackup(item) {
+ // call deleteLDIF
+ this.setState({
+ showConfirmBackup: true,
+ backupName: item.name
+ });
+ }
+
+ closeConfirmBackup() {
+ // call importLDIF
+ this.setState({
+ showConfirmBackup: false
+ });
+ }
+
+ showConfirmRestore(item) {
+ this.setState({
+ showConfirmRestore: true,
+ backupName: item.name
+ });
+ }
+
+ closeConfirmRestore() {
+ // call importLDIF
+ this.setState({
+ showConfirmRestore: false
+ });
+ }
+
+ showConfirmBackupDelete(item) {
+ // calls deleteBackup
+ this.setState({
+ showConfirmBackupDelete: true,
+ backupName: item.name
+ });
+ }
+
+ closeConfirmBackupDelete() {
+ // call importLDIF
+ this.setState({
+ showConfirmBackupDelete: false
+ });
+ }
+
+ closeConfirmRestoreReplace() {
+ this.setState({
+ showConfirmRestoreReplace: false
+ });
+ }
+
+ validateBackup() {
+ for (let i = 0; i < this.props.backups.length; i++) {
+ if (this.state.backupName == this.props.backups[i]["name"]) {
+ this.setState({
+ showConfirmRestoreReplace: true
+ });
+ return;
+ }
+ }
+ this.doBackup();
+ }
+
+ doBackup() {
+ this.setState({
+ backupSpinning: true
+ });
+
+ let cmd = ["dsctl", "-j", this.props.serverId, "status"];
+ cockpit
+ .spawn(cmd, { superuser: true })
+ .done(status_data => {
+ let status_json = JSON.parse(status_data);
+ if (status_json.running == true) {
+ let cmd = [
+ "dsconf",
+ "-j",
+ "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
+ "backup",
+ "create"
+ ];
+ if (this.state.backupName != "") {
+ if (bad_file_name(this.state.backupName)) {
+ this.props.addNotification(
+ "warning",
+ `Backup name should not be a path. All backups are stored in the server's backup directory`
+ );
+ return;
+ }
+ cmd.push(this.state.backupName);
+ }
+
+ log_cmd("doBackup", "Add backup task online", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .done(content => {
+ this.props.reload();
+ this.closeBackupModal();
+ this.props.addNotification("success", `Server has been backed up`);
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.props.reload();
+ this.closeBackupModal();
+ this.props.addNotification(
+ "error",
+ `Failure backing up server - ${errMsg.desc}`
+ );
+ });
+ } else {
+ const cmd = ["dsctl", "-j", this.props.serverId, "db2bak"];
+ if (this.state.backupName != "") {
+ if (bad_file_name(this.state.backupName)) {
+ this.props.addNotification(
+ "warning",
+ `Backup name should not be a path. All backups are stored in the server's backup directory`
+ );
+ return;
+ }
+ cmd.push(this.state.backupName);
+ }
+ log_cmd("doBackup", "Doing backup of the server offline", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true })
+ .done(content => {
+ this.props.reload();
+ this.closeBackupModal();
+ this.props.addNotification("success", `Server has been backed up`);
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.props.reload();
+ this.closeBackupModal();
+ this.props.addNotification(
+ "error",
+ `Failure backing up server - ${errMsg.desc}`
+ );
+ });
+ }
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ console.log("Failed to check the server status", errMsg.desc);
+ });
+ }
+
+ restoreBackup() {
+ this.showRestoreSpinningModal();
+ let cmd = ["dsctl", "-j", this.props.serverId, "status"];
+ cockpit
+ .spawn(cmd, { superuser: true })
+ .done(status_data => {
+ let status_json = JSON.parse(status_data);
+ if (status_json.running == true) {
+ const cmd = [
+ "dsconf",
+ "-j",
+ "ldapi://%2fvar%2frun%2fslapd-" + this.props.serverId + ".socket",
+ "backup",
+ "restore",
+ this.state.backupName
+ ];
+ log_cmd("restoreBackup", "Restoring server online", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .done(content => {
+ this.closeRestoreSpinningModal();
+ this.props.addNotification("success", `Server has been restored`);
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.closeRestoreSpinningModal();
+ this.props.addNotification(
+ "error",
+ `Failure restoring up server - ${errMsg.desc}`
+ );
+ });
+ } else {
+ const cmd = [
+ "dsctl",
+ "-j",
+ this.props.serverId,
+ "bak2db",
+ this.state.backupName
+ ];
+ log_cmd("restoreBackup", "Restoring server offline", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .done(content => {
+ this.closeRestoreSpinningModal();
+ this.props.addNotification("success", `Server has been restored`);
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.closeRestoreSpinningModal();
+ this.props.addNotification(
+ "error",
+ `Failure restoring up server - ${errMsg.desc}`
+ );
+ });
+ }
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ console.log("Failed to check the server status", errMsg.desc);
+ });
+ }
+
+ deleteBackup(e) {
+ // Show confirmation
+ this.showDelBackupSpinningModal();
+
+ const cmd = [
+ "dsctl",
+ "-j",
+ this.props.serverId,
+ "backups",
+ "--delete",
+ this.state.backupName
+ ];
+ log_cmd("deleteBackup", "Deleting backup", cmd);
+ cockpit
+ .spawn(cmd, { superuser: true, err: "message" })
+ .done(content => {
+ this.props.reload();
+ this.closeDelBackupSpinningModal();
+ this.props.addNotification("success", `Backup was successfully deleted`);
+ })
+ .fail(err => {
+ let errMsg = JSON.parse(err);
+ this.props.reload();
+ this.closeDelBackupSpinningModal();
+ this.props.addNotification("error", `Failure deleting backup - ${errMsg.desc}`);
+ });
+ }
+
+ handleNavSelect(key) {
+ this.setState({ activeKey: key });
+ }
+
+ handleChange(e) {
+ const value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
+ let valueErr = false;
+ let errObj = this.state.errObj;
+ if (value == "") {
+ valueErr = true;
+ }
+ errObj[e.target.id] = valueErr;
+ this.setState({
+ [e.target.id]: value,
+ errObj: errObj
+ });
+ }
+
+ render() {
+ const { showModal, closeHandler, backups, reload, loadingBackup } = this.props;
+
+ let backupSpinner = "";
+ if (loadingBackup) {
+ backupSpinner = (
+ <Row>
+ <div className="ds-margin-top-lg ds-modal-spinner">
+ <Spinner loading inline size="lg" />
+ Creating instance...
+ </div>
+ </Row>
+ );
+ }
+
+ return (
+ <div>
+ <Modal show={showModal} onHide={closeHandler}>
+ <div className="ds-no-horizontal-scrollbar">
+ <Modal.Header>
+ <button
+ className="close"
+ onClick={closeHandler}
+ aria-hidden="true"
+ aria-label="Close"
+ >
+ <Icon type="pf" name="close" />
+ </button>
+ <Modal.Title>Manage Backups</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <div className="ds-margin-top-xlg">
+ <BackupTable
+ rows={backups}
+ confirmRestore={this.showConfirmRestore}
+ confirmDelete={this.showConfirmBackupDelete}
+ />
+ </div>
+ {backupSpinner}
+ </Modal.Body>
+ <Modal.Footer>
+ <Button
+ bsStyle="primary"
+ onClick={this.showBackupModal}
+ className="ds-margin-top"
+ >
+ Create Backup
+ </Button>
+ <Button
+ bsStyle="default"
+ onClick={reload}
+ className="ds-left-margin ds-margin-top"
+ >
+ Refresh Backups
+ </Button>
+ </Modal.Footer>
+ </div>
+ </Modal>
+ <BackupModal
+ showModal={this.state.showBackupModal}
+ closeHandler={this.closeBackupModal}
+ handleChange={this.handleChange}
+ saveHandler={this.validateBackup}
+ spinning={this.state.backupSpinning}
+ error={this.state.errObj}
+ />
+ <RestoreModal
+ showModal={this.state.showRestoreSpinningModal}
+ closeHandler={this.closeRestoreSpinningModal}
+ msg={this.state.backupName}
+ />
+ <DeleteBackupModal
+ showModal={this.state.showDelBackupSpinningModal}
+ closeHandler={this.closeDelBackupSpinningModal}
+ msg={this.state.backupName}
+ />
+ <ConfirmPopup
+ showModal={this.state.showConfirmRestore}
+ closeHandler={this.closeConfirmRestore}
+ actionFunc={this.restoreBackup}
+ actionParam={this.state.backupName}
+ msg="Are you sure you want to restore this backup?"
+ msgContent={this.state.backupName}
+ />
+ <ConfirmPopup
+ showModal={this.state.showConfirmBackupDelete}
+ closeHandler={this.closeConfirmBackupDelete}
+ actionFunc={this.deleteBackup}
+ actionParam={this.state.backupName}
+ msg="Are you sure you want to delete this backup?"
+ msgContent={this.state.backupName}
+ />
+ <ConfirmPopup
+ showModal={this.state.showConfirmRestoreReplace}
+ closeHandler={this.closeConfirmRestoreReplace}
+ actionFunc={this.doBackup}
+ msg="Replace Existing Backup"
+ msgContent="A backup already eixsts with the same name, do you want to replace it?"
+ />
+ </div>
+ );
+ }
+}
+
+// Proptyes and defaults
+
+CreateInstanceModal.propTypes = {
+ showModal: PropTypes.bool,
+ closeHandler: PropTypes.func,
+ addNotification: PropTypes.func,
+ loadInstanceList: PropTypes.func
+};
+
+CreateInstanceModal.defaultProps = {
+ showModal: false,
+ closeHandler: noop,
+ addNotification: noop,
+ loadInstanceList: noop
+};
+
+SchemaReloadModal.propTypes = {
+ showModal: PropTypes.bool,
+ closeHandler: PropTypes.func,
+ addNotification: PropTypes.func,
+ serverId: PropTypes.string
+};
+
+SchemaReloadModal.defaultProps = {
+ showModal: false,
+ closeHandler: noop,
+ addNotification: noop,
+ serverId: ""
+};
+
+ManageBackupsModal.propTypes = {
+ showModal: PropTypes.bool,
+ closeHandler: PropTypes.func,
+ addNotification: PropTypes.func,
+ serverId: PropTypes.string
+};
+
+ManageBackupsModal.defaultProps = {
+ showModal: false,
+ closeHandler: noop,
+ addNotification: noop,
+ serverId: ""
+};
diff --git a/src/cockpit/389-console/src/lib/server/ldapi.jsx b/src/cockpit/389-console/src/lib/server/ldapi.jsx
index c004e639f..ab6da3789 100644
--- a/src/cockpit/389-console/src/lib/server/ldapi.jsx
+++ b/src/cockpit/389-console/src/lib/server/ldapi.jsx
@@ -200,7 +200,6 @@ export class ServerLDAPI extends React.Component {
type="text"
value={this.state['nsslapd-ldapientrysearchbase']}
onChange={this.handleChange}
-
/>
</Col>
</Row>
diff --git a/src/cockpit/389-console/src/lib/tools.jsx b/src/cockpit/389-console/src/lib/tools.jsx
index ea51c7353..1a41058f2 100644
--- a/src/cockpit/389-console/src/lib/tools.jsx
+++ b/src/cockpit/389-console/src/lib/tools.jsx
@@ -148,7 +148,7 @@ export function valid_dn(dn) {
if (dn.endsWith(",")) {
return false;
}
- let dn_regex = new RegExp("^([A-Za-z]+=.*)");
+ let dn_regex = new RegExp("^([A-Za-z])+=\\S.*");
let result = dn_regex.test(dn);
return result;
}
diff --git a/src/lib389/cli/dscreate b/src/lib389/cli/dscreate
index b9c5b48ea..083c30c87 100755
--- a/src/lib389/cli/dscreate
+++ b/src/lib389/cli/dscreate
@@ -1,7 +1,7 @@
#!/usr/bin/python3
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2018 Red Hat, Inc.
+# Copyright (C) 2020 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -11,9 +11,9 @@
# PYTHON_ARGCOMPLETE_OK
import argparse, argcomplete
-import logging
import sys
import signal
+import json
from lib389 import DirSrv
from lib389.cli_ctl import instance as cli_instance
from lib389.cli_base import setup_script_logger
@@ -23,6 +23,9 @@ parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose',
help="Display verbose operation tracing during command execution",
action='store_true', default=False, dest='verbose')
+parser.add_argument('-j', '--json',
+ help="Return the result as a json message",
+ action='store_true', default=False, dest='json')
subparsers = parser.add_subparsers(help="action")
fromfile_parser = subparsers.add_parser('from-file', help="Create an instance of Directory Server from an inf answer file")
@@ -76,7 +79,10 @@ if __name__ == '__main__':
except Exception as e:
log.debug(e, exc_info=True)
msg = format_error_to_dict(e)
- log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
+ if args and args.json:
+ sys.stderr.write(json.dumps(msg))
+ else:
+ log.error("Error: %s" % " - ".join(str(val) for val in msg.values()))
result = False
# Done!
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index f5fc5495d..06d904390 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -573,7 +573,7 @@ class SetupDs(object):
assert_c(slapd['instance_name'] != 'admin', "Server identifier \"admin\" is reserved, please choose a different identifier")
# Check that valid characters are used
- safe = re.compile(r'^[#%:\w@_-]+$').search
+ safe = re.compile(r'^[:\w@_-]+$').search
assert_c(bool(safe(slapd['instance_name'])), "Server identifier has invalid characters, please choose a different value")
# Check if the instance exists or not.
@@ -670,11 +670,10 @@ class SetupDs(object):
self._install_ds(general, slapd, backends)
except ValueError as e:
if DEBUGGING is False:
- self.log.fatal("Error: " + str(e) + ", removing incomplete installation...")
self._remove_failed_install(slapd['instance_name'])
else:
- self.log.fatal("Error: " + str(e) + ", preserving incomplete installation for analysis...")
- raise ValueError("Instance creation failed!")
+ self.log.fatal(f"Error: {str(e)}, preserving incomplete installation for analysis...")
+ raise ValueError(f"Instance creation failed! {str(e)}")
# Call the child api to do anything it needs.
self._install(extra)
| 0 |
8c30b05985b71760aea6d2e413ed096e17c8ded0
|
389ds/389-ds-base
|
Bug 659131 - Incorrect RDN values added with multi-valued RDN
When changes were made to allow 389 to use the OpenLDAP client
libraries, a wrapper function was made around the MozLDAP
ldap_explode_rdn() function. Unfortuantely, this wrapper was
calling ldap_explode_dn() when buitl against MozLDAP instead of
calling ldap_explode_rdn(). This would cause a multi-valued RDN
to not be exploded into individual elements. This would cause us
to add incorrect RDN values to a newly added entry that had a
multi-valued RDN.
|
commit 8c30b05985b71760aea6d2e413ed096e17c8ded0
Author: Nathan Kinder <[email protected]>
Date: Thu Jan 6 11:46:50 2011 -0800
Bug 659131 - Incorrect RDN values added with multi-valued RDN
When changes were made to allow 389 to use the OpenLDAP client
libraries, a wrapper function was made around the MozLDAP
ldap_explode_rdn() function. Unfortuantely, this wrapper was
calling ldap_explode_dn() when buitl against MozLDAP instead of
calling ldap_explode_rdn(). This would cause a multi-valued RDN
to not be exploded into individual elements. This would cause us
to add incorrect RDN values to a newly added entry that had a
multi-valued RDN.
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 7103fc7c3..11fe4fbf3 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -1097,7 +1097,7 @@ slapi_ldap_explode_rdn(const char *rdn, int notypes)
#if defined(USE_OPENLDAP)
return mozldap_ldap_explode_rdn(rdn, notypes);
#else
- return ldap_explode_dn(rdn, notypes);
+ return ldap_explode_rdn(rdn, notypes);
#endif
}
| 0 |
b44e8f4f2f5b399698e97e47e6fd211932e96719
|
389ds/389-ds-base
|
Bug 623118 - Simplepaged results going in infinite loop
if a sub suffix exists in the domain
https://bugzilla.redhat.com/show_bug.cgi?id=623118
Description: When paging is done on a backend, and if there are
more sub backends to be searched and paged, simple paged code is
supposed to set the next backend to connection->c_current_be.
The setting was missing.
|
commit b44e8f4f2f5b399698e97e47e6fd211932e96719
Author: Noriko Hosoi <[email protected]>
Date: Wed Aug 11 17:06:41 2010 -0700
Bug 623118 - Simplepaged results going in infinite loop
if a sub suffix exists in the domain
https://bugzilla.redhat.com/show_bug.cgi?id=623118
Description: When paging is done on a backend, and if there are
more sub backends to be searched and paged, simple paged code is
supposed to set the next backend to connection->c_current_be.
The setting was missing.
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 4701edf6f..531aa9b1f 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -574,6 +574,10 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
curr_search_count = -1;
} else {
curr_search_count = pnentries;
+ /* no more entries, but at least another backend */
+ if (pagedresults_set_current_be(pb->pb_conn, next_be) < 0) {
+ goto free_and_return;
+ }
}
estimate = 0;
} else {
| 0 |
65e04b8d72fa0ebe8a4c8475c6bc26ac831f984f
|
389ds/389-ds-base
|
Bug 455489 - Address compiler warnings about strict-aliasing rules
https://bugzilla.redhat.com/show_bug.cgi?id=455489
Resolves: bug 455489
Bug description: Address compiler warnings about strict-aliasing rules
Fix description: The codes that generate strict-aliasing warnings have
been changed.
Reviewed by: rmeggins (and pushed by)
|
commit 65e04b8d72fa0ebe8a4c8475c6bc26ac831f984f
Author: Endi S. Dewata <[email protected]>
Date: Sun Mar 21 23:15:56 2010 -0500
Bug 455489 - Address compiler warnings about strict-aliasing rules
https://bugzilla.redhat.com/show_bug.cgi?id=455489
Resolves: bug 455489
Bug description: Address compiler warnings about strict-aliasing rules
Fix description: The codes that generate strict-aliasing warnings have
been changed.
Reviewed by: rmeggins (and pushed by)
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index b468d3288..b4ec5e454 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -4548,6 +4548,7 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
char csnStr [CSN_STRSIZE];
struct berval **vals;
DB_TXN *txnid = NULL;
+ char *buff;
if ((purge && file->purgeRUV == NULL) || (!purge && file->maxRUV == NULL))
return CL5_SUCCESS;
@@ -4565,7 +4566,8 @@ static int _cl5WriteRUV (CL5DBFile *file, PRBool purge)
key.size = CSN_STRSIZE;
- rc = _cl5WriteBervals (vals, (char**)&data.data, &data.size);
+ rc = _cl5WriteBervals (vals, &buff, &data.size);
+ data.data = buff;
ber_bvecfree(vals);
if (rc != CL5_SUCCESS)
{
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 89a3c793e..dbeae6541 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -5796,9 +5796,9 @@ config_set_entry(Slapi_Entry *e)
if (needs_free && value) { /* assumes memory allocated by slapi_ch_Xalloc */
if (CONFIG_CHARRAY == cgas->config_var_type) {
- charray_free(*((char ***)value));
+ charray_free((char **)*value);
} else if (CONFIG_SPECIAL_REFERRALLIST == cgas->config_var_type) {
- ber_bvecfree(*((struct berval ***)value));
+ ber_bvecfree((struct berval **)*value);
} else if ((CONFIG_CONSTANT_INT != cgas->config_var_type) && /* do not free constants */
(CONFIG_CONSTANT_STRING != cgas->config_var_type)) {
slapi_ch_free(value);
| 0 |
1f9000f7d1399ba3305adcc4bfe4591434c77f15
|
389ds/389-ds-base
|
Issue 5124 - dscontainer fails to create an instance
Bug Description:
After 5f05bc7af82edf4690c0dce0ceaab8ac328b70a6 dscontainer fails to
create an intance, because it tries to write PID file to /run instead
of /run/dirsrv as was previously.
Fix Description:
Change pid_file in defaults.inf back to /run/dirsrv/slapd-{instance_name}.pid
Fixes: https://github.com/389ds/389-ds-base/issues/5124
Reviewed by: @mreynolds389, @droideck (Thanks!)
|
commit 1f9000f7d1399ba3305adcc4bfe4591434c77f15
Author: Viktor Ashirov <[email protected]>
Date: Thu Jan 20 11:42:59 2022 +0100
Issue 5124 - dscontainer fails to create an instance
Bug Description:
After 5f05bc7af82edf4690c0dce0ceaab8ac328b70a6 dscontainer fails to
create an intance, because it tries to write PID file to /run instead
of /run/dirsrv as was previously.
Fix Description:
Change pid_file in defaults.inf back to /run/dirsrv/slapd-{instance_name}.pid
Fixes: https://github.com/389ds/389-ds-base/issues/5124
Reviewed by: @mreynolds389, @droideck (Thanks!)
diff --git a/ldap/admin/src/defaults.inf.in b/ldap/admin/src/defaults.inf.in
index 28f908bcd..8eeefca06 100644
--- a/ldap/admin/src/defaults.inf.in
+++ b/ldap/admin/src/defaults.inf.in
@@ -37,7 +37,7 @@ local_state_dir = @localstatedir@
run_dir = @localrundir@/dirsrv
# This is the expected location of ldapi.
ldapi = @localrundir@/slapd-{instance_name}.socket
-pid_file = @localrundir@/slapd-{instance_name}.pid
+pid_file = @localrundir@/dirsrv/slapd-{instance_name}.pid
ldapi_listen = on
ldapi_autobind = on
inst_dir = @serverdir@/slapd-{instance_name}
| 0 |
7753988c84b919b6986371f5a6a162ad70bc12b9
|
389ds/389-ds-base
|
Issue 4709 - Fix double free in dbscan
Description: Fix double free in dbscan - in main()
relates: https://github.com/389ds/389-ds-base/pull/4709
Reviewed by: tbordaz, spichugi, progier(Thanks!!!)
|
commit 7753988c84b919b6986371f5a6a162ad70bc12b9
Author: Mark Reynolds <[email protected]>
Date: Fri Jun 11 14:31:51 2021 -0400
Issue 4709 - Fix double free in dbscan
Description: Fix double free in dbscan - in main()
relates: https://github.com/389ds/389-ds-base/pull/4709
Reviewed by: tbordaz, spichugi, progier(Thanks!!!)
diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c
index 47d636870..8345e90bd 100644
--- a/ldap/servers/slapd/tools/dbscan.c
+++ b/ldap/servers/slapd/tools/dbscan.c
@@ -1,5 +1,5 @@
/** BEGIN COPYRIGHT BLOCK
- * Copyright (C) 2005 Red Hat, Inc.
+ * Copyright (C) 2021 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
@@ -123,7 +123,7 @@ long ind_cnt = 0;
long allids_cnt = 0;
long other_cnt = 0;
-Slapi_Backend *be = NULL; /* Pseudo backend used to interact with db */
+static Slapi_Backend *be = NULL; /* Pseudo backend used to interact with db */
/** db_printf - functioning same as printf but a place for manipluating output.
*/
@@ -1288,12 +1288,6 @@ main(int argc, char **argv)
}
done:
- if (key.data) {
- free(key.data);
- }
- if (data.data) {
- free(data.data);
- }
dblayer_value_free(be, &key);
dblayer_value_free(be, &data);
dblayer_cursor_op(&cursor, DBI_OP_CLOSE, NULL, NULL);
| 0 |
48a9d16a43d38af1292a1f306d23243702286608
|
389ds/389-ds-base
|
Ticket 48026 - fix invalid write for friendly attribute names
Bug Description: When the friendly attribute names are read from the config
entry they are stored in an inproperly sized char pointer.
Fix Description: The attr_friendly char pointer needs one additional byte to
account for the final trailing space that is appended.
https://fedorahosted.org/389/ticket/48026
Reviewed by: nhosoi(Thanks!)
|
commit 48a9d16a43d38af1292a1f306d23243702286608
Author: Mark Reynolds <[email protected]>
Date: Tue May 12 10:43:26 2015 -0400
Ticket 48026 - fix invalid write for friendly attribute names
Bug Description: When the friendly attribute names are read from the config
entry they are stored in an inproperly sized char pointer.
Fix Description: The attr_friendly char pointer needs one additional byte to
account for the final trailing space that is appended.
https://fedorahosted.org/389/ticket/48026
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c
index 5b57828fe..85f3d9e62 100644
--- a/ldap/servers/plugins/uiduniq/uid.c
+++ b/ldap/servers/plugins/uiduniq/uid.c
@@ -395,7 +395,7 @@ uniqueness_entry_to_config(Slapi_PBlock *pb, Slapi_Entry *config_entry)
for (i = 0; tmp_config->attrs && (tmp_config->attrs)[i]; i++) {
attrLen += strlen((tmp_config->attrs)[i]) + 1;
}
- tmp_config->attr_friendly = (char *) slapi_ch_calloc(attrLen, sizeof(char));
+ tmp_config->attr_friendly = (char *) slapi_ch_calloc(attrLen + 1, sizeof(char));
fp = tmp_config->attr_friendly;
for (i = 0; tmp_config->attrs && (tmp_config->attrs)[i]; i++) {
strcpy(fp, (tmp_config->attrs)[i] );
| 0 |
6b5b8b7df36690807ceb06185be3c2abdf19e166
|
389ds/389-ds-base
|
bump version to 1.3.5.11
|
commit 6b5b8b7df36690807ceb06185be3c2abdf19e166
Author: Noriko Hosoi <[email protected]>
Date: Fri Jul 15 10:52:02 2016 -0700
bump version to 1.3.5.11
diff --git a/VERSION.sh b/VERSION.sh
index 818869cfd..fb72bed58 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=5.10
+VERSION_MAINT=5.11
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=`date -u +%Y%m%d%H%M%S`
| 0 |
76561dba969d39ef6f792adb0338c9ccdfa7c04e
|
389ds/389-ds-base
|
Bug 690882 - (cov#10571) Incorrect sizeof use in uuid code
It looks like the caller wanted to clear out the uuid struct if
there was a problem creating the NSS context. The problem is that
the memset at line 341 is only clearing out the local pointer to
the struct. This local pointer is never seen by the caller and the
struct retains whetever it previously held in memory. We need to
clear out the contents of the struct itself instead of just
clearing the address held by the local pointer.
|
commit 76561dba969d39ef6f792adb0338c9ccdfa7c04e
Author: Nathan Kinder <[email protected]>
Date: Fri Mar 25 10:00:37 2011 -0700
Bug 690882 - (cov#10571) Incorrect sizeof use in uuid code
It looks like the caller wanted to clear out the uuid struct if
there was a problem creating the NSS context. The problem is that
the memset at line 341 is only clearing out the local pointer to
the struct. This local pointer is never seen by the caller and the
struct retains whetever it previously held in memory. We need to
clear out the contents of the struct itself instead of just
clearing the address held by the local pointer.
diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c
index 5e26be262..c19648f9f 100644
--- a/ldap/servers/slapd/uuid.c
+++ b/ldap/servers/slapd/uuid.c
@@ -338,7 +338,7 @@ void uuid_create_from_name(guid_t * uuid, /* resulting UUID */
PK11_DestroyContext(c, PR_TRUE);
}
else { /* Probably desesperate but at least deterministic... */
- memset(&uuid, 0, sizeof(uuid));
+ memset(uuid, 0, sizeof(*uuid));
}
}
| 0 |
6eb1a456411c2a6ab1064190bc0564cbcc2bb854
|
389ds/389-ds-base
|
Ticket 49009 - args debug logging must be more restrictive
Bug Description: turning on args debugging logs all attribute value, including #unhashed#
Fix Description: filter unhashed attrs
https://fedorahosted.org/389/ticket/49009
Reviewed by: MarkR, thanks
|
commit 6eb1a456411c2a6ab1064190bc0564cbcc2bb854
Author: Ludwig Krispenz <[email protected]>
Date: Fri Oct 14 13:58:08 2016 +0200
Ticket 49009 - args debug logging must be more restrictive
Bug Description: turning on args debugging logs all attribute value, including #unhashed#
Fix Description: filter unhashed attrs
https://fedorahosted.org/389/ticket/49009
Reviewed by: MarkR, thanks
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 415c610ef..3d0723c2e 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -3661,6 +3661,7 @@ entry_apply_mod( Slapi_Entry *e, const LDAPMod *mod )
if((strcasecmp(mod->mod_type,"objectclass") == 0)
&& (strncasecmp((const char *)mod->mod_bvalues[i]->bv_val,"ldapsubentry",mod->mod_bvalues[i]->bv_len) == 0))
sawsubentry=PR_TRUE;
+ if (0==strcasecmp(PSEUDO_ATTR_UNHASHEDUSERPASSWORD,mod->mod_type)) continue;
slapi_log_err(SLAPI_LOG_ARGS, "entry_apply_mod", "%s: %s\n", mod->mod_type, mod->mod_bvalues[i]->bv_val);
}
bvcnt = i;
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 2d6620d12..da58cb279 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -957,6 +957,7 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN *csn, int urp)
for ( i = 0;
mod->mod_bvalues != NULL && mod->mod_bvalues[i] != NULL;
i++ ) {
+ if (0==strcasecmp(PSEUDO_ATTR_UNHASHEDUSERPASSWORD,mod->mod_type)) continue;
slapi_log_err(SLAPI_LOG_ARGS, "entry_apply_mod_wsi", "%s: %s\n",
mod->mod_type, mod->mod_bvalues[i]->bv_val);
}
| 0 |
ecc399335cb5331527439641d9001036cc2cc271
|
389ds/389-ds-base
|
Ticket 10 - Use after free
Bug Description: Coverity and ASAN detected use after frees related to the
reuse of the pin object.
Fix Description: This corrects the behaviours that would cause the use
after free to occur
https://pagure.io/svrcore/issue/10
Author: wibrown
Review by: nhosoi (Thanks!)
|
commit ecc399335cb5331527439641d9001036cc2cc271
Author: William Brown <[email protected]>
Date: Tue Apr 12 14:29:19 2016 +1000
Ticket 10 - Use after free
Bug Description: Coverity and ASAN detected use after frees related to the
reuse of the pin object.
Fix Description: This corrects the behaviours that would cause the use
after free to occur
https://pagure.io/svrcore/issue/10
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/examples/svrcore_driver.c b/examples/svrcore_driver.c
index 44a02d658..2b6703e6b 100644
--- a/examples/svrcore_driver.c
+++ b/examples/svrcore_driver.c
@@ -62,7 +62,7 @@ svrcore_systemd_get_token()
// Should set a password into &pw
// Cleanup
- SVRCORE_DestroySystemdPinObj(StdPinObj);
+ SVRCORE_DestroyRegisteredPinObj();
return 0;
}
@@ -71,21 +71,21 @@ int
svrcore_stdsystemd_setup()
{
PRErrorCode errorCode;
- SVRCOREStdSystemdPinObj *StdPinObj;
+ SVRCOREStdSystemdPinObj *StdSysPinObj;
char *filename = "/tmp/pin.txt";
- StdPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();
+ StdSysPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();
- if (StdPinObj) {
+ if (StdSysPinObj) {
// This means it's already registered?
return 0;
}
- if (SVRCORE_CreateStdSystemdPinObj(&StdPinObj, filename, PR_FALSE, PR_TRUE, 60) != SVRCORE_Success) {
+ if (SVRCORE_CreateStdSystemdPinObj(&StdSysPinObj, filename, PR_FALSE, PR_TRUE, 60) != SVRCORE_Success) {
errorCode = PR_GetError();
printf("Unable to create std systemd pin %d\n", errorCode);
return -1;
}
- SVRCORE_RegisterPinObj((SVRCOREPinObj *)StdPinObj);
+ SVRCORE_RegisterPinObj((SVRCOREPinObj *)StdSysPinObj);
return 0;
}
@@ -94,17 +94,17 @@ svrcore_stdsystemd_get_token()
{
//Actually get the password
// Get the pinobj
- SVRCOREStdSystemdPinObj *StdPinObj;
+ SVRCOREStdSystemdPinObj *StdSysPinObj;
char *pw = NULL;
char *token = NULL;
SVRCOREError err = SVRCORE_Success;
- StdPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();
+ StdSysPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();
// Are we interactive?
// SVRCORE_SetStdPinInteractive((SVRCOREStdPinObj *) StdPinObj , PR_TRUE);
// what is token?
token = "internal (software)";
- pw = SVRCORE_GetPin( (SVRCOREPinObj *)StdPinObj, token , PR_FALSE);
+ pw = SVRCORE_GetPin( (SVRCOREPinObj *)StdSysPinObj, token , PR_FALSE);
if ( err != SVRCORE_Success || pw == NULL) {
printf("Couldn't get pin %d \n", err);
} else {
@@ -114,7 +114,7 @@ svrcore_stdsystemd_get_token()
// Should set a password into &pw
// Cleanup
- SVRCORE_DestroyStdSystemdPinObj(StdPinObj);
+ SVRCORE_DestroyRegisteredPinObj();
return 0;
}
diff --git a/src/pin.c b/src/pin.c
index acfc15147..718768e73 100644
--- a/src/pin.c
+++ b/src/pin.c
@@ -68,3 +68,12 @@ SVRCORE_GetRegisteredPinObj(void)
{
return pinObj;
}
+
+void
+SVRCORE_DestroyRegisteredPinObj(void)
+{
+ if (pinObj) {
+ pinObj->methods->destroyObj(pinObj);
+ }
+ pinObj = 0;
+}
diff --git a/src/pk11.c b/src/pk11.c
index ebc7f167c..0634732ed 100644
--- a/src/pk11.c
+++ b/src/pk11.c
@@ -274,9 +274,11 @@ SVRCORE_Pk11StoreGetPin(char **out, SVRCOREPk11PinStore *store)
if (rv)
{
err = SVRCORE_System_Error;
- memset(plain, 0, store->length);
- free(plain);
- plain = 0;
+ if (plain) {
+ memset(plain, 0, store->length);
+ free(plain);
+ plain = 0;
+ }
}
*out = (char *)plain;
diff --git a/src/std-systemd.c b/src/std-systemd.c
index de62110c2..cffc11d47 100644
--- a/src/std-systemd.c
+++ b/src/std-systemd.c
@@ -138,13 +138,14 @@ SVRCORE_CreateStdSystemdPinObj(
obj->top = top;
} while(0);
+ *out = obj;
+
if (err != SVRCORE_Success)
{
SVRCORE_DestroyStdSystemdPinObj(obj);
+ *out = NULL;
}
- *out = obj;
-
return err;
#endif // win32
#else // systemd
diff --git a/src/std.c b/src/std.c
index a9064edcd..d1acfd8cf 100644
--- a/src/std.c
+++ b/src/std.c
@@ -89,12 +89,14 @@ SVRCORE_CreateStdPinObj(
obj->top = top;
} while(0);
+ *out = obj;
+
if (err != SVRCORE_Success)
{
SVRCORE_DestroyStdPinObj(obj);
+ *out = NULL;
}
- *out = obj;
return err;
}
diff --git a/src/svrcore.h b/src/svrcore.h
index 1efdbdd9a..ec91174a3 100644
--- a/src/svrcore.h
+++ b/src/svrcore.h
@@ -104,6 +104,13 @@ SVRCORE_RegisterPinObj(SVRCOREPinObj *obj);
SVRCOREPinObj *
SVRCORE_GetRegisteredPinObj(void);
+/*
+ * SVRCORE_DestroyRegisteredPinObj - Destroys (frees) the currently registered
+ * pin object, and zeros the pointer. This way a new object can be created
+ */
+void
+SVRCORE_DestroyRegisteredPinObj(void);
+
/* ------------------------------------------------------------ */
/*
* SVRCOREStdPinObj - implementation of SVRCOREPinObj that
| 0 |
d610a501a09bd0e1f4ace0c010bcc1c448a1fea3
|
389ds/389-ds-base
|
Fix processing of base-64 encoded data
|
commit d610a501a09bd0e1f4ace0c010bcc1c448a1fea3
Author: David Boreham <[email protected]>
Date: Thu Apr 14 15:21:39 2005 +0000
Fix processing of base-64 encoded data
diff --git a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/OperationAdd.java b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/OperationAdd.java
index 823ee23af..b92af251b 100644
--- a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/OperationAdd.java
+++ b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/OperationAdd.java
@@ -32,7 +32,7 @@ public class OperationAdd extends GenericOperation {
attr = attr.getNextSibling();
String attrName = nl.item(i).getAttributes().getNamedItem("name").getNodeValue();
- String attrValue;
+ byte[] attrValue;
if (nl.item(i).getFirstChild().getNodeType() == Node.ELEMENT_NODE)
attrValue = ParseValue.parseValueFromNode( nl.item(i).getFirstChild() );
diff --git a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ParseValue.java b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ParseValue.java
index b1173b6ba..2c8359fd5 100644
--- a/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ParseValue.java
+++ b/ldap/clients/dsmlgw/src/com/netscape/dsml/gateway/ParseValue.java
@@ -14,8 +14,8 @@ public class ParseValue {
public ParseValue() {
}
- public static String parseValueFromNode(org.w3c.dom.Node n) {
- String ret = null;
+ public static byte[] parseValueFromNode(org.w3c.dom.Node n) {
+ byte[] ret = null;
// <xsd:union memberTypes="xsd:string xsd:base64Binary xsd:anyURI"/>
org.w3c.dom.Node type = n.getAttributes().getNamedItem("xsi:type");
@@ -23,9 +23,10 @@ public class ParseValue {
// This value is encoded in base64. decode it.
sun.misc.BASE64Decoder bd = new sun.misc.BASE64Decoder();
try {
- ret = new String( bd.decodeBuffer( n.getFirstChild().getNodeValue() ) ) ;
+ ret = bd.decodeBuffer( n.getFirstChild().getNodeValue() ) ;
}
catch (org.w3c.dom.DOMException de) {
+ ret = "".getBytes();
}
catch (Exception e) {
// couldn't decode auth info
@@ -33,7 +34,7 @@ public class ParseValue {
} else {
// anyURI is unsupported.
- ret = new String(n.getFirstChild().getNodeValue());
+ ret = new String(n.getFirstChild().getNodeValue()).getBytes();
}
return ret;
| 0 |
a880fddc192414d6283ea6832491b7349e5471dc
|
389ds/389-ds-base
|
Issue 4504 - insure that repl_monitor_test use ldapi (for RHEL) - fix merge issue (#4533)
|
commit a880fddc192414d6283ea6832491b7349e5471dc
Author: progier389 <[email protected]>
Date: Tue Jan 12 17:45:41 2021 +0100
Issue 4504 - insure that repl_monitor_test use ldapi (for RHEL) - fix merge issue (#4533)
diff --git a/dirsrvtests/tests/suites/clu/repl_monitor_test.py b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
index b2cb840b3..caf6a9099 100644
--- a/dirsrvtests/tests/suites/clu/repl_monitor_test.py
+++ b/dirsrvtests/tests/suites/clu/repl_monitor_test.py
@@ -9,6 +9,7 @@
import time
import subprocess
import pytest
+import re
from lib389.cli_conf.replication import get_repl_monitor_info
from lib389.tasks import *
@@ -69,6 +70,25 @@ def check_value_in_log_and_reset(content_list, second_list=None, single_value=No
log.info('Reset log file')
f.truncate(0)
+def get_hostnames_from_log(port1, port2):
+ # Get the supplier host names as displayed in replication monitor output
+ with open(LOG_FILE, 'r') as logfile:
+ logtext = logfile.read()
+ # search for Supplier :hostname:port
+ # and use \D to insure there is no more number is after
+ # the matched port (i.e that 10 is not matching 101)
+ regexp = '(Supplier: )([^:]*)(:' + str(port1) + '\D)'
+ match=re.search(regexp, logtext)
+ host_m1 = 'localhost.localdomain'
+ if (match is not None):
+ host_m1 = match.group(2)
+ # Same for master 2
+ regexp = '(Supplier: )([^:]*)(:' + str(port2) + '\D)'
+ match=re.search(regexp, logtext)
+ host_m2 = 'localhost.localdomain'
+ if (match is not None):
+ host_m2 = match.group(2)
+ return (host_m1, host_m2)
@pytest.mark.ds50545
@pytest.mark.bz1739718
@@ -177,20 +197,9 @@ def test_dsconf_replication_monitor(topology_m2, set_log_file):
'001',
m1.host + ':' + str(m1.port)]
- dsrc_content = '[repl-monitor-connections]\n' \
- 'connection1 = ' + m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
- 'connection2 = ' + m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
- '\n' \
- '[repl-monitor-aliases]\n' \
- 'M1 = ' + m1.host + ':' + str(m1.port) + '\n' \
- 'M2 = ' + m2.host + ':' + str(m2.port)
-
connections = [m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM,
m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM]
- aliases = ['M1=' + m1.host + ':' + str(m1.port),
- 'M2=' + m2.host + ':' + str(m2.port)]
-
args = FakeArgs()
args.connections = connections
args.aliases = None
@@ -198,8 +207,24 @@ def test_dsconf_replication_monitor(topology_m2, set_log_file):
log.info('Run replication monitor with connections option')
get_repl_monitor_info(m1, DEFAULT_SUFFIX, log, args)
+ (host_m1, host_m2) = get_hostnames_from_log(m1.port, m2.port)
check_value_in_log_and_reset(content_list, connection_content, error_list=error_list)
+ # Prepare the data for next tests
+ aliases = ['M1=' + host_m1 + ':' + str(m1.port),
+ 'M2=' + host_m2 + ':' + str(m2.port)]
+
+ alias_content = ['Supplier: M1 (' + host_m1 + ':' + str(m1.port) + ')',
+ 'Supplier: M2 (' + host_m2 + ':' + str(m2.port) + ')']
+
+ dsrc_content = '[repl-monitor-connections]\n' \
+ 'connection1 = ' + m1.host + ':' + str(m1.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
+ 'connection2 = ' + m2.host + ':' + str(m2.port) + ':' + DN_DM + ':' + PW_DM + '\n' \
+ '\n' \
+ '[repl-monitor-aliases]\n' \
+ 'M1 = ' + host_m1 + ':' + str(m1.port) + '\n' \
+ 'M2 = ' + host_m2 + ':' + str(m2.port)
+
log.info('Run replication monitor with aliases option')
args.aliases = aliases
get_repl_monitor_info(m1, DEFAULT_SUFFIX, log, args)
| 0 |
f66b608d3880b251a35c32c0d6eeb2a6c23dea2b
|
389ds/389-ds-base
|
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11826 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_search() ds/ldap/servers/slapd/back-ldbm/ldbm_search.c
Comment:
On this path, the condition "abandoned" cannot be true.
504 return ldbm_back_search_cleanup(pb, li, sort_control,
505 (abandoned?-1:LDAP_PROTOCOL_ERROR),
506 "Sort Response Control", -1,
507 &basesdn, &vlv_request_control);
Line 505 should be
505 LDAP_PROTOCOL_ERROR,
|
commit f66b608d3880b251a35c32c0d6eeb2a6c23dea2b
Author: Noriko Hosoi <[email protected]>
Date: Wed Jul 7 18:19:28 2010 -0700
610281 - fix coverity Defect Type: Control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=610281
11826 DEADCODE Triaged Unassigned Bug Minor Fix Required
ldbm_back_search() ds/ldap/servers/slapd/back-ldbm/ldbm_search.c
Comment:
On this path, the condition "abandoned" cannot be true.
504 return ldbm_back_search_cleanup(pb, li, sort_control,
505 (abandoned?-1:LDAP_PROTOCOL_ERROR),
506 "Sort Response Control", -1,
507 &basesdn, &vlv_request_control);
Line 505 should be
505 LDAP_PROTOCOL_ERROR,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 9a4925f66..72ceeb710 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -502,7 +502,7 @@ ldbm_back_search( Slapi_PBlock *pb )
sort_make_sort_response_control( pb, LDAP_SUCCESS, NULL ))
{
return ldbm_back_search_cleanup(pb, li, sort_control,
- (abandoned?-1:LDAP_PROTOCOL_ERROR),
+ LDAP_PROTOCOL_ERROR,
"Sort Response Control", -1,
&basesdn, &vlv_request_control);
}
| 0 |
8bc4544728f8b7ebc8785b27f8261eec2aaa059d
|
389ds/389-ds-base
|
Bug 613056 - fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
https://bugzilla.redhat.com/show_bug.cgi?id=613056
Resolves: bug 613056
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
Fix description: Catch possible NULL pointer in roles_cache_change_notify().
|
commit 8bc4544728f8b7ebc8785b27f8261eec2aaa059d
Author: Endi S. Dewata <[email protected]>
Date: Fri Jul 9 20:21:29 2010 -0500
Bug 613056 - fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
https://bugzilla.redhat.com/show_bug.cgi?id=613056
Resolves: bug 613056
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11892 - 11939
Fix description: Catch possible NULL pointer in roles_cache_change_notify().
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c
index b7de265f6..07d22d0c3 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -801,7 +801,7 @@ void roles_cache_change_notify(Slapi_PBlock *pb)
/* Don't update local cache when remote entries are updated */
slapi_pblock_get( pb, SLAPI_BACKEND, &be );
- if ( ( be!=NULL ) &&
+ if ( ( be==NULL ) ||
( slapi_be_is_flag_set(be,SLAPI_BE_FLAG_REMOTE_DATA)) )
{
return;
| 0 |
07b5532ee820ddffa0e0251f999b29c2268352d9
|
389ds/389-ds-base
|
Ticket 50134 - fixup-memberof.pl does not respect protocol requested
Bug Description:
fixup-memberof.pl tries with StartTLS even though LDAP was specified.
Fix Description:
Fix protocol assignment to $info, probably missed during a previous code porting.
https://pagure.io/389-ds-base/issue/50134
Author: mhonek
Review by: mreynolds, firstyear (thanks!)
|
commit 07b5532ee820ddffa0e0251f999b29c2268352d9
Author: Matúš Honěk <[email protected]>
Date: Mon Jan 7 13:25:14 2019 +0100
Ticket 50134 - fixup-memberof.pl does not respect protocol requested
Bug Description:
fixup-memberof.pl tries with StartTLS even though LDAP was specified.
Fix Description:
Fix protocol assignment to $info, probably missed during a previous code porting.
https://pagure.io/389-ds-base/issue/50134
Author: mhonek
Review by: mreynolds, firstyear (thanks!)
diff --git a/ldap/admin/src/scripts/fixup-memberof.pl.in b/ldap/admin/src/scripts/fixup-memberof.pl.in
index 167ed7fbf..2e6745021 100644
--- a/ldap/admin/src/scripts/fixup-memberof.pl.in
+++ b/ldap/admin/src/scripts/fixup-memberof.pl.in
@@ -77,7 +77,7 @@ while ($i <= $#ARGV)
($servid, $confdir) = DSUtil::get_server_id($servid, "@initconfigdir@");
%info = DSUtil::get_info($confdir, $host, $port, $rootdn);
$info{rootdnpw} = DSUtil::get_password_from_file($passwd, $passwdfile);
-$info[9] = $protocol;
+$info{protocol} = $protocol;
if ($verbose == 1){
$info{args} = "-v -a";
} else {
| 0 |
4f5f6bb54e2939de83aa3569d2b24d2ff809b69f
|
389ds/389-ds-base
|
Ticket 49813 - Revised interactive installer
Description:
Removed some advanced settings from the install questions.
Moved the signal handlers to non-verbose runs.
Fixed some mixed case issues.
Added option for sample entries.
Added "interactive" argument, and restored "fromfile"
from "install".
https://pagure.io/389-ds-base/issue/49813
Reviewed by: mmuehlfeldrh & spichugi(Thanks!!)
|
commit 4f5f6bb54e2939de83aa3569d2b24d2ff809b69f
Author: Mark Reynolds <[email protected]>
Date: Mon Jul 9 12:55:26 2018 -0400
Ticket 49813 - Revised interactive installer
Description:
Removed some advanced settings from the install questions.
Moved the signal handlers to non-verbose runs.
Fixed some mixed case issues.
Added option for sample entries.
Added "interactive" argument, and restored "fromfile"
from "install".
https://pagure.io/389-ds-base/issue/49813
Reviewed by: mmuehlfeldrh & spichugi(Thanks!!)
diff --git a/docker/389ds_poc/Dockerfile b/docker/389ds_poc/Dockerfile
index 24fcdb3d0..216e1de68 100644
--- a/docker/389ds_poc/Dockerfile
+++ b/docker/389ds_poc/Dockerfile
@@ -33,7 +33,7 @@ RUN dnf install -y 389-ds-base/dist/rpms/*389*.rpm && \
# Create the example setup inf. It's valid for containers!
# Build the instance from the new installer tools.
-RUN /usr/sbin/dscreate create-template > /root/ds-setup.inf && /usr/sbin/dscreate -v install /root/ds-setup.inf --containerised
+RUN /usr/sbin/dscreate create-template > /root/ds-setup.inf && /usr/sbin/dscreate -v fromfile /root/ds-setup.inf --containerised
# Finally add the volumes, they will inherit the contents of these directories.
VOLUME /etc/dirsrv
diff --git a/src/cockpit/389-console/index.html b/src/cockpit/389-console/index.html
index 90f2949a8..211693baa 100644
--- a/src/cockpit/389-console/index.html
+++ b/src/cockpit/389-console/index.html
@@ -417,14 +417,6 @@
<label for="create-inst-secureport" class="ds-config-label" title="The secure port number for TLS connections">
Secure Port</label><input class="ds-input" type="text" value="636" id="create-inst-secureport" required />
</div>
- <div>
- <label for="create-inst-user" class="ds-config-label" title="Server user that the server runs as">
- Server User</label><input class="ds-input" value="dirsrv" type="text" id="create-inst-user" required />
- </div>
- <div>
- <label for="create-inst-group" class="ds-config-label" title="Server group that the server runs as">
- Server Group</label><input class="ds-input" value="dirsrv" type="text" id="create-inst-group" required />
- </div>
<div>
<label for="create-inst-rootdn" class="ds-config-label" title="The DN for the unrestricted user">
Directory Manager DN</label><input class="ds-input" value="cn=Directory Manager" type="text" id="create-inst-rootdn" required />
@@ -447,12 +439,16 @@
class="ds-input" type="text" id="backend-suffix">
</div>
<div>
- <p></p>
+ <label for="create-sample-entries" class="ds-config-label" title="Create sample entries in the suffix">Create Sample Entries </label><input
+ type="checkbox" class="ds-input ds-config-checkbox" id="create-sample-entries">
+ </div>
+ <hr>
+ <div>
<input type="checkbox" class="ds-config-checkbox" id="create-inst-tls" checked><label
for="create-inst-tls" class="ds-label" title="Create a self-signed certificate database">Create Self Signed Certificate DB</label>
</div>
<div id="create-inst-spinner" class="ds-center" hidden>
- <p></p>
+ <hr>
<p><span class="spinner spinner-xs spinner-inline"></span> Creating instance...</p>
</div>
</div>
diff --git a/src/cockpit/389-console/js/servers.js b/src/cockpit/389-console/js/servers.js
index 81dd944a2..c5ae83701 100644
--- a/src/cockpit/389-console/js/servers.js
+++ b/src/cockpit/389-console/js/servers.js
@@ -37,8 +37,8 @@ var create_full_template =
"config_dir = /etc/dirsrv/slapd-{instance_name}\n" +
"data_dir = /usr/share\n" +
"db_dir = /var/lib/dirsrv/slapd-{instance_name}/db\n" +
- "user = USER\n" +
- "group = GROUP\n" +
+ "user = dirsrv\n" +
+ "group = dirsrv\n" +
"initconfig_dir = /etc/sysconfig\n" +
"inst_dir = /usr/lib64/dirsrv/slapd-{instance_name}\n" +
"instance_name = localhost\n" +
@@ -64,8 +64,8 @@ var create_inf_template =
"config_version = 2\n" +
"full_machine_name = FQDN\n\n" +
"[slapd]\n" +
- "user = USER\n" +
- "group = GROUP\n" +
+ "user = dirsrv\n" +
+ "group = dirsrv\n" +
"instance_name = INST_NAME\n" +
"port = PORT\n" +
"root_dn = ROOTDN\n" +
@@ -153,12 +153,11 @@ function clear_inst_form() {
$("#create-inst-port").val("389");
$("#create-inst-secureport").val("636");
$("#create-inst-rootdn").val("cn=Directory Manager");
- $("#create-inst-user").val("dirsrv");
- $("#create-inst-group").val("dirsrv");
$("#rootdn-pw").val("");
$("#rootdn-pw-confirm").val("");
$("#backend-suffix").val("");
$("#backend-name").val("");
+ $("#create-sample-entries").prop('checked', false);
$("#create-inst-tls").prop('checked', true);
clear_inst_input();
}
@@ -1111,24 +1110,6 @@ $(document).ready( function() {
setup_inf = setup_inf.replace('SECURE_PORT', secure_port);
}
- // DS User
- var server_user = $("#create-inst-user").val();
- if (server_user == ""){
- report_err($("#create-inst-user"), 'You must provide the server user name');
- return;
- } else {
- setup_inf = setup_inf.replace('USER', server_user);
- }
-
- // DS Group
- var server_group = $("#create-inst-group").val();
- if (server_group == ""){
- report_err($("#create-inst-group"), 'You must provide the server group name');
- return;
- } else {
- setup_inf = setup_inf.replace('GROUP', server_group);
- }
-
// Root DN
var server_rootdn = $("#create-inst-rootdn").val();
if (server_rootdn == ""){
@@ -1182,6 +1163,11 @@ $(document).ready( function() {
report_err($("#backend-suffix"), 'Invalid DN for Backend Suffix');
return;
}
+ if ( $("#create-sample-entries").is(":checked") ) {
+ setup_inf += '\nsample_entries = yes\n';
+ } else {
+ setup_inf += '\nsample_entries = no\n';
+ }
}
/*
@@ -1231,7 +1217,7 @@ $(document).ready( function() {
/*
* Next, create the instance...
*/
- cmd = [DSCREATE, 'install', setup_file];
+ cmd = [DSCREATE, 'fromfile', setup_file];
cockpit.spawn(cmd, { superuser: true, "err": "message", "environ": [ENV] }).fail(function(ex) {
// Failed to create the new instance!
cockpit.spawn(rm_cmd, { superuser: true }); // Remove Inf file with clear text password
diff --git a/src/lib389/cli/dsconf b/src/lib389/cli/dsconf
index 5b56b7ac4..9cf89b3e5 100755
--- a/src/lib389/cli/dsconf
+++ b/src/lib389/cli/dsconf
@@ -86,8 +86,6 @@ def signal_handler(signal, frame):
print('\n\nExiting...')
sys.exit(0)
-signal.signal(signal.SIGINT, signal_handler)
-
if __name__ == '__main__':
@@ -115,6 +113,9 @@ if __name__ == '__main__':
parser.print_help()
sys.exit(1)
+ if not args.verbose:
+ signal.signal(signal.SIGINT, signal_handler)
+
# Connect
# We don't need a basedn, because the config objects derive it properly
inst = None
diff --git a/src/lib389/cli/dscreate b/src/lib389/cli/dscreate
index 17708d053..dca37c0b0 100755
--- a/src/lib389/cli/dscreate
+++ b/src/lib389/cli/dscreate
@@ -25,13 +25,16 @@ parser.add_argument('-v', '--verbose',
action='store_true', default=False, dest='verbose')
subparsers = parser.add_subparsers(help="action")
-install_parser = subparsers.add_parser('install', help="Create an instance of Directory Server from an inf answer file")
-install_parser.add_argument('file', nargs="?", default=None, help="Inf file to use with prepared answers. You can generate an example of this with 'dscreate create-template'")
-install_parser.add_argument('-n', '--dryrun', help="Validate system and configurations only. Do not alter the system.",
- action='store_true', default=False)
-install_parser.add_argument('-c', '--containerised', help="Indicate to the installer that this is running in a container. Used to disable systemd native components, even if they are installed.",
- action='store_true', default=False)
-install_parser.set_defaults(func=cli_instance.instance_create)
+fromfile_parser = subparsers.add_parser('fromfile', help="Create an instance of Directory Server from an inf answer file")
+fromfile_parser.add_argument('file', help="Inf file to use with prepared answers. You can generate an example of this with 'dscreate create-template'")
+fromfile_parser.add_argument('-n', '--dryrun', help="Validate system and configurations only. Do not alter the system.",
+ action='store_true', default=False)
+fromfile_parser.add_argument('-c', '--containerised', help="Indicate to the installer that this is running in a container. Used to disable systemd native components, even if they are installed.",
+ action='store_true', default=False)
+fromfile_parser.set_defaults(func=cli_instance.instance_create)
+
+interactive_parser = subparsers.add_parser('interactive', help="Start interactive installer for Directory Server installation")
+interactive_parser.set_defaults(func=cli_instance.instance_create_interactive)
template_parser = subparsers.add_parser('create-template', help="Display an example inf answer file, or provide a file name to write it to disk.")
template_parser.add_argument('template_file', nargs="?", default=None, help="Write example template to this file")
@@ -43,8 +46,6 @@ def signal_handler(signal, frame):
print('\n\nExiting interactive installation...')
sys.exit(0)
-signal.signal(signal.SIGINT, signal_handler)
-
if __name__ == '__main__':
args = parser.parse_args()
@@ -64,6 +65,9 @@ if __name__ == '__main__':
parser.print_help()
sys.exit(1)
+ if not args.verbose:
+ signal.signal(signal.SIGINT, signal_handler)
+
inst = DirSrv(verbose=args.verbose)
result = False
diff --git a/src/lib389/cli/dsctl b/src/lib389/cli/dsctl
index f5e8943dc..69a028ec9 100755
--- a/src/lib389/cli/dsctl
+++ b/src/lib389/cli/dsctl
@@ -48,8 +48,6 @@ def signal_handler(signal, frame):
print('\n\nExiting...')
sys.exit(0)
-signal.signal(signal.SIGINT, signal_handler)
-
if __name__ == '__main__':
args = parser.parse_args()
@@ -80,6 +78,7 @@ if __name__ == '__main__':
if args.verbose:
insts = inst.list(serverid=args.instance)
else:
+ signal.signal(signal.SIGINT, signal_handler)
try:
insts = inst.list(serverid=args.instance)
except PermissionError:
diff --git a/src/lib389/cli/dsidm b/src/lib389/cli/dsidm
index a856a7685..c65f6a8c2 100755
--- a/src/lib389/cli/dsidm
+++ b/src/lib389/cli/dsidm
@@ -71,9 +71,6 @@ def signal_handler(signal, frame):
print('\n\nExiting...')
sys.exit(0)
-signal.signal(signal.SIGINT, signal_handler)
-
-
if __name__ == '__main__':
@@ -105,6 +102,10 @@ if __name__ == '__main__':
if dsrc_inst['basedn'] is None:
log.error("Must provide a basedn!")
+ sys.ext(1)
+
+ if not args.verbose:
+ signal.signal(signal.SIGINT, signal_handler)
ldapurl = args.instance
diff --git a/src/lib389/lib389/cli_ctl/instance.py b/src/lib389/lib389/cli_ctl/instance.py
index fe8e039f1..bd5d37daf 100644
--- a/src/lib389/lib389/cli_ctl/instance.py
+++ b/src/lib389/lib389/cli_ctl/instance.py
@@ -52,14 +52,17 @@ def instance_status(inst, log, args):
log.info("Instance is not running")
+def instance_create_interactive(inst, log, args):
+ sd = SetupDs(args.verbose, False, log, False)
+ return sd.create_from_cli()
+
+
def instance_create(inst, log, args):
if args.containerised:
log.debug("Containerised features requested.")
+
sd = SetupDs(args.verbose, args.dryrun, log, args.containerised)
- if args.file is None:
- # Interactive installer
- return sd.create_from_cli()
- elif sd.create_from_inf(args.file):
+ if sd.create_from_inf(args.file):
# print("Sucessfully created instance")
return True
else:
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index 04cad30d6..b1a5cbeed 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -37,9 +37,9 @@ def get_port(port, default_port, secure=False):
# Get the port number for the interactive installer and validate it
while 1:
if secure:
- val = input('\nEnter Secure Port Number [{}]: '.format(default_port))
+ val = input('\nEnter secure port number [{}]: '.format(default_port))
else:
- val = input('\nEnter Port Number [{}]: '.format(default_port))
+ val = input('\nEnter port number [{}]: '.format(default_port))
if val != "" or default_port == "":
# Validate port is number and in a valid range
@@ -239,12 +239,12 @@ class SetupDs(object):
'schema_dir': ds_paths.schema_dir}
# Start asking questions, beginning with the hostname...
- val = input('\nEnter System\'s Hostname [{}]: '.format(general['full_machine_name']))
+ val = input('\nEnter system\'s hostname [{}]: '.format(general['full_machine_name']))
if val != "":
general['full_machine_name'] = val
# Strict host name checking
- msg = ("\nUse strict hostname verification (set to \"off\" if using GSSAPI behind a load balancer) [on]: ")
+ msg = ("\nUse strict hostname verification (set to \"no\" if using GSSAPI behind a load balancer) [yes]: ")
while 1:
val = input(msg)
if val != "":
@@ -261,65 +261,10 @@ class SetupDs(object):
else:
break
- # Get and check user
- while 1:
- val = input('\nSystem user the server will run as [{}]: '.format(slapd['user']))
- if val != "":
- # Check is user exists
- try:
- pwd.getpwnam(val)
- except KeyError:
- print("User \"{}\" does not exist, please choose an existing user".format(val))
- continue
- slapd['user'] = val
- else:
- # Use default, but double check dirsrv exists...
- try:
- pwd.getpwnam(slapd['user'])
- except KeyError:
- print("User \"{}\" does not exist, please choose an existing user".format(val))
- continue
- break
-
- # Get and check the group
- while 1:
- val = input('\nSystem group the server will belong to [{}]: '.format(slapd['group']))
- if val != "":
- # Check is user exists
- try:
- grp.getgrnam(val)
- except KeyError:
- print("Group \"{}\" does not exist, please choose an existing group".format(val))
- continue
- slapd['group'] = val
- else:
- # Use default, but double check dirsrv exists...
- try:
- grp.getgrnam(slapd['user'])
- except KeyError:
- print("Group \"{}\" does not exist, please choose an existing group".format(val))
- continue
- break
-
- # Prefix
- while 1:
- val = input('\nInstallation prefix [{}]: '.format(slapd['prefix']))
- if val != "":
- if not val.startswith('/'):
- print("Not a valid path\n")
- continue
- if not os.path.isdir(val):
- print("Prefix directory does not exist")
- continue
- slapd['prefix'] = val
- break
- else:
- break
-
# Instance name - adjust defaults once set
while 1:
slapd['instance_name'] = general['full_machine_name'].split('.', 1)[0]
- val = input('\nEnter The Server\'s Indentifer Name [{}]: '.format(slapd['instance_name']))
+ val = input('\nEnter the instance name [{}]: '.format(slapd['instance_name']))
if val != "":
if ' ' in val:
print("Server identifier can not contain a space")
@@ -335,10 +280,7 @@ class SetupDs(object):
continue
# Check if server id is taken
- if slapd['prefix'] != "/usr":
- inst_dir = slapd['prefix'] + slapd['config_dir'] + "/" + val
- else:
- inst_dir = slapd['config_dir'] + "/" + val
+ inst_dir = slapd['config_dir'] + "/" + val
if os.path.isdir(inst_dir):
print("Server identifier \"{}\" is already taken, please choose a new name".format(val))
continue
@@ -370,17 +312,9 @@ class SetupDs(object):
port = get_port(slapd['port'], "")
slapd['port'] = port
- # Secure Port
- if not socket_check_open('::1', slapd['secure_port']):
- port = get_port(slapd['secure_port'], slapd['secure_port'], secure=True)
- else:
- # Port 636 is already taken, pick another port
- port = get_port(slapd['secure_port'], "", secure=True)
- slapd['secure_port'] = port
-
# Self-Signed Cert DB
while 1:
- val = input('\nCreate Self-Signed Certificate Database [yes]: ')
+ val = input('\nCreate self-signed certificate database [yes]: ')
if val != "":
if val.lower() == 'no' or val.lower() == "n":
slapd['self_sign_cert'] = False
@@ -395,6 +329,15 @@ class SetupDs(object):
# use default
break
+ # Secure Port (only if using self signed cert)
+ if slapd['self_sign_cert']:
+ if not socket_check_open('::1', slapd['secure_port']):
+ port = get_port(slapd['secure_port'], slapd['secure_port'], secure=True)
+ else:
+ # Port 636 is already taken, pick another port
+ port = get_port(slapd['secure_port'], "", secure=True)
+ slapd['secure_port'] = port
+
# Root DN
while 1:
val = input('\nEnter Directory Manager DN [{}]: '.format(slapd['root_dn']))
@@ -412,12 +355,12 @@ class SetupDs(object):
# Root DN Password
while 1:
- rootpw1 = getpass.getpass('\nEnter Directory Manager Password: ')
+ rootpw1 = getpass.getpass('\nEnter the Directory Manager password: ')
if rootpw1 == '':
print('Password can not be empty')
continue
- rootpw2 = getpass.getpass('Confirm Directory Manager Password: ')
+ rootpw2 = getpass.getpass('Confirm the Directory Manager Password: ')
if rootpw1 != rootpw2:
print('Passwords do not match')
continue
@@ -454,6 +397,22 @@ class SetupDs(object):
backend['suffix'] = suffix
break
+ # Add sample entries?
+ while 1:
+ val = input("\nCreate sample entries in the suffix [no]: ".format(suffix))
+ if val != "":
+ if val.lower() == "no" or val.lower() == "n":
+ break
+ if val.lower() == "yes" or val.lower() == "y":
+ backend['sample_entries'] = INSTALL_LATEST_CONFIG
+ break
+
+ # Unknown value
+ print ("Value \"{}\" is invalid, please use \"yes\" or \"no\"".format(val))
+ continue
+ else:
+ break
+
# Are you ready?
while 1:
val = input('\nAre you ready to install? [no]: ')
@@ -476,8 +435,7 @@ class SetupDs(object):
Will trigger a create from the settings stored in inf_path
"""
# Get the inf file
- if self.verbose:
- self.log.info("Using inf from %s", inf_path)
+ self.log.debug("Using inf from %s" % inf_path)
if not os.path.isfile(inf_path):
self.log.error("%s is not a valid file path", inf_path)
return False
@@ -489,9 +447,7 @@ class SetupDs(object):
self.log.error("Exception %s occured", e)
return False
- if self.verbose:
- self.log.info("Configuration %s", config.sections())
-
+ self.log.debug("Configuration %s" % config.sections())
(general, slapd, backends) = self._validate_ds_config(config)
# Actually do the setup now.
@@ -502,8 +458,7 @@ class SetupDs(object):
def _prepare_ds(self, general, slapd, backends):
assert_c(general['defaults'] is not None, "Configuration defaults in section [general] not found")
- if self.verbose:
- self.log.info("PASSED: using config settings %s", general['defaults'])
+ self.log.debug("PASSED: using config settings %s" % general['defaults'])
# Validate our arguments.
assert_c(slapd['user'] is not None, "Configuration user in section [slapd] not found")
# check the user exists
@@ -516,22 +471,19 @@ class SetupDs(object):
# Check that we are running as this user / group, or that we are root.
assert_c(os.geteuid() == 0 or getpass.getuser() == slapd['user'], "Not running as user root or %s, may not have permission to continue" % slapd['user'])
- if self.verbose:
- self.log.info("PASSED: user / group checking")
+ self.log.debug("PASSED: user / group checking")
assert_c(general['full_machine_name'] is not None, "Configuration full_machine_name in section [general] not found")
assert_c(general['strict_host_checking'] is not None, "Configuration strict_host_checking in section [general] not found")
if general['strict_host_checking'] is True:
# Check it resolves with dns
assert_c(socket.gethostbyname(general['full_machine_name']), "Strict hostname check failed. Check your DNS records for %s" % general['full_machine_name'])
- if self.verbose:
- self.log.info("PASSED: Hostname strict checking")
+ self.log.debug("PASSED: Hostname strict checking")
assert_c(slapd['prefix'] is not None, "Configuration prefix in section [slapd] not found")
if (slapd['prefix'] != ""):
assert_c(os.path.exists(slapd['prefix']), "Prefix location '%s' not found" % slapd['prefix'])
- if self.verbose:
- self.log.info("PASSED: prefix checking")
+ self.log.debug("PASSED: prefix checking")
# We need to know the prefix before we can do the instance checks
assert_c(slapd['instance_name'] is not None, "Configuration instance_name in section [slapd] not found")
@@ -544,8 +496,7 @@ class SetupDs(object):
insts = ds.list(serverid=slapd['instance_name'])
assert_c(len(insts) == 0, "Another instance named '%s' may already exist" % slapd['instance_name'])
- if self.verbose:
- self.log.info("PASSED: instance checking")
+ self.log.debug("PASSED: instance checking")
assert_c(slapd['root_dn'] is not None, "Configuration root_dn in section [slapd] not found")
# Assert this is a valid DN
@@ -571,17 +522,15 @@ class SetupDs(object):
self._raw_secure_password = password_generate()
self._secure_password = password_hash(self._raw_secure_password, bin_dir=slapd['bin_dir'])
- if self.verbose:
- self.log.info("INFO: temp root password set to %s", self._raw_secure_password)
- self.log.info("PASSED: root user checking")
+ self.log.debug("INFO: temp root password set to %s" % self._raw_secure_password)
+ self.log.debug("PASSED: root user checking")
assert_c(slapd['port'] is not None, "Configuration port in section [slapd] not found")
assert_c(socket_check_open('::1', slapd['port']) is False, "port %s is already in use" % slapd['port'])
# We enable secure port by default.
assert_c(slapd['secure_port'] is not None, "Configuration secure_port in section [slapd] not found")
assert_c(socket_check_open('::1', slapd['secure_port']) is False, "secure_port %s is already in use" % slapd['secure_port'])
- if self.verbose:
- self.log.info("PASSED: network avaliability checking")
+ self.log.debug("PASSED: network avaliability checking")
# Make assert_cions of the paths?
@@ -685,7 +634,8 @@ class SetupDs(object):
# Should create the symlink we need, but without starting it.
subprocess.check_call(["/usr/bin/systemctl",
"enable",
- "dirsrv@%s" % slapd['instance_name']], stderr=subprocess.DEVNULL)
+ "dirsrv@%s" % slapd['instance_name']])
+
# Else we need to detect other init scripts?
# Bind sockets to our type?
@@ -789,8 +739,8 @@ class SetupDs(object):
base_config_inst.apply_config(install=True)
# Setup TLS with the instance.
- ds_instance.config.set('nsslapd-secureport', '%s' % slapd['secure_port'])
if slapd['self_sign_cert']:
+ ds_instance.config.set('nsslapd-secureport', '%s' % slapd['secure_port'])
ds_instance.config.set('nsslapd-security', 'on')
# Create the backends as listed
| 0 |
fb0c84b1eb557e85d4ca4df1bbce7976fe1fb50b
|
389ds/389-ds-base
|
additional fix for 49287: handle readonly replica
check if replicaid is readonly replica id and if ruv element for replicaid can be found
reviewed by:
|
commit fb0c84b1eb557e85d4ca4df1bbce7976fe1fb50b
Author: Ludwig Krispenz <[email protected]>
Date: Tue Jul 25 13:46:14 2017 +0200
additional fix for 49287: handle readonly replica
check if replicaid is readonly replica id and if ruv element for replicaid can be found
reviewed by:
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index 99b14be8d..ea351e8f7 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -1581,14 +1581,23 @@ ruv_cancel_csn_inprogress(void *repl, RUV *ruv, const CSN *csn, ReplicaId local_
if (csn_primary(repl, csn, prim_csn)) {
/* the prim csn is cancelled, lets remove all dependent csns */
/* for the primary replica we can have modifications for two RIDS:
- * - the local RID for direct or internal operations
- * - a remote RID if the primary csn is for a replciated op.
- */
+ * - the local RID for direct or internal operations
+ * - a remote RID if the primary csn is for a replciated op.
+ */
ReplicaId prim_rid = csn_get_replicaid(csn);
- repl_ruv = ruvGetReplica(ruv, local_rid);
+ repl_ruv = ruvGetReplica(ruv, prim_rid);
+ if (!repl_ruv) {
+ rc = RUV_NOTFOUND;
+ goto done;
+ }
rc = csnplRemoveAll(repl_ruv->csnpl, prim_csn);
- if (prim_rid != local_rid) {
- repl_ruv = ruvGetReplica(ruv, prim_rid);
+
+ if (prim_rid != local_rid && local_rid != READ_ONLY_REPLICA_ID) {
+ repl_ruv = ruvGetReplica(ruv, local_rid);
+ if (!repl_ruv) {
+ rc = RUV_NOTFOUND;
+ goto done;
+ }
rc = csnplRemoveAll(repl_ruv->csnpl, prim_csn);
}
| 0 |
54112e4c4867bf7b1d9dcf928155dc4160304464
|
389ds/389-ds-base
|
Ticket 433 - multiple bugs in start-dirsrv, stop-dirsrv, restart-dirsrv scripts
Description: Need to use error_reserved_serverid in DSCreate.pm, and fix inconsistent
quoting in error_reserved_serverid
Reviewed by: richm(Thanks!)
https://fedorahosted.org/389/ticket/433
|
commit 54112e4c4867bf7b1d9dcf928155dc4160304464
Author: Mark Reynolds <[email protected]>
Date: Wed Jan 30 10:28:14 2013 -0500
Ticket 433 - multiple bugs in start-dirsrv, stop-dirsrv, restart-dirsrv scripts
Description: Need to use error_reserved_serverid in DSCreate.pm, and fix inconsistent
quoting in error_reserved_serverid
Reviewed by: richm(Thanks!)
https://fedorahosted.org/389/ticket/433
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index a3b8fe76e..46ca5788e 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -123,7 +123,7 @@ sub sanityCheckParams {
}
if($inf->{slapd}->{ServerIdentifier} eq "admin"){
- return ('error_invalid_serverid - "admin" is reserved for the Admininstration Server, please choose a different server identifier');
+ return ('error_reserved_serverid' ,"admin");
} elsif (!isValidServerID($inf->{slapd}->{ServerIdentifier})) {
return ('error_invalid_serverid', $inf->{slapd}->{ServerIdentifier});
} elsif (-d $inf->{slapd}->{config_dir}) {
diff --git a/ldap/admin/src/scripts/setup-ds.res.in b/ldap/admin/src/scripts/setup-ds.res.in
index 401722ee9..ddda771a2 100644
--- a/ldap/admin/src/scripts/setup-ds.res.in
+++ b/ldap/admin/src/scripts/setup-ds.res.in
@@ -105,7 +105,7 @@ program, or low port restriction. Please choose another value for\
ServerPort. Error: $!\n
error_invalid_serverid = The ServerIdentifier '%s' contains invalid characters. It must\
contain only alphanumeric characters and the following: #%:@_-\n\n
-error_reserved_serverid = The ServerIdentifier '%s" is reserved for the Administration Server, please choose a different server identifier.\n
+error_reserved_serverid = The ServerIdentifier '%s' is reserved for the Administration Server, please choose a different server identifier.\n
error_opening_scripttmpl = Could not open the script template file '%s'. Error: %s\n
error_creating_directory = Could not create directory '%s'. Error: %s\n
error_chowning_directory = Could not change ownership of directory '%s' to userid '%s': Error: %s\n
| 0 |
a3d3e1a93ab2d7dbac96c79f4a1794f3ddebad81
|
389ds/389-ds-base
|
Ticket 49601 - Replace HAVE_SYSTEMD define with WITH_SYSTEMD in svrcore
Bug Description: As former configure of svrcore is not used after the
merge of svrcore, and the svrcore's --with-systemd configure flag
handling seems to not have been merged to the 389-ds-core configure,
and configuring svrcore --with-systemd defines HAVE_SYSTEMD which is
different from define WITH_SYSTEMD used in 389-ds-base, the systemd
support in svrcore is not effectively turned on when compiling
389-ds-base with --with-systemd.
Fix Description: Use the very same define as 389-ds-base
uses (WITH_SYSTEMD) instead of the former one of svrcore, which is
obviously inheritted into the svrcore code as well, thus effectively
selecting a code to be compiled based on the --with-systemd configure
flag.
https://pagure.io/389-ds-base/issue/49601
Author: mhonek
Review by: mreynolds, spichugi
|
commit a3d3e1a93ab2d7dbac96c79f4a1794f3ddebad81
Author: Matúš Honěk <[email protected]>
Date: Mon Mar 26 14:05:51 2018 +0200
Ticket 49601 - Replace HAVE_SYSTEMD define with WITH_SYSTEMD in svrcore
Bug Description: As former configure of svrcore is not used after the
merge of svrcore, and the svrcore's --with-systemd configure flag
handling seems to not have been merged to the 389-ds-core configure,
and configuring svrcore --with-systemd defines HAVE_SYSTEMD which is
different from define WITH_SYSTEMD used in 389-ds-base, the systemd
support in svrcore is not effectively turned on when compiling
389-ds-base with --with-systemd.
Fix Description: Use the very same define as 389-ds-base
uses (WITH_SYSTEMD) instead of the former one of svrcore, which is
obviously inheritted into the svrcore code as well, thus effectively
selecting a code to be compiled based on the --with-systemd configure
flag.
https://pagure.io/389-ds-base/issue/49601
Author: mhonek
Review by: mreynolds, spichugi
diff --git a/src/svrcore/m4/systemd.m4 b/src/svrcore/m4/systemd.m4
index 6052acbda..3a22dd918 100644
--- a/src/svrcore/m4/systemd.m4
+++ b/src/svrcore/m4/systemd.m4
@@ -27,7 +27,7 @@ if test "$with_systemd" = yes; then
if test -n "$PKG_CONFIG"; then
if $PKG_CONFIG --exists systemd; then
AC_MSG_CHECKING([systemd found, enabling.])
- SYSTEMD_CFLAGS="-DHAVE_SYSTEMD"
+ SYSTEMD_CFLAGS="-DWITH_SYSTEMD"
else
AC_MSG_CHECKING([systemd not found, disabling.])
SYSTEMD_CFLAGS=""
diff --git a/src/svrcore/src/std-systemd.c b/src/svrcore/src/std-systemd.c
index c1f8ba8dc..b4310dfef 100644
--- a/src/svrcore/src/std-systemd.c
+++ b/src/svrcore/src/std-systemd.c
@@ -48,7 +48,7 @@ SVRCORE_CreateStdSystemdPinObj(
const char *filename, PRBool cachePINs,
PRBool systemdPINs, uint64_t timeout)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
SVRCOREError err = SVRCORE_Success;
SVRCOREStdSystemdPinObj *obj = 0;
@@ -155,7 +155,7 @@ void
SVRCORE_DestroyStdSystemdPinObj(
SVRCOREStdSystemdPinObj *obj)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
if (!obj) return;
if (obj->user) SVRCORE_DestroyUserPinObj(obj->user);
@@ -174,7 +174,7 @@ SVRCORE_DestroyStdSystemdPinObj(
void
SVRCORE_SetStdSystemdPinInteractive(SVRCOREStdSystemdPinObj *obj, PRBool i)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
SVRCORE_SetUserPinInteractive(obj->user, i);
#endif // Systemd
}
@@ -187,7 +187,7 @@ SVRCOREError
SVRCORE_StdSystemdPinGetPin(char **pin, SVRCOREStdSystemdPinObj *obj,
const char *tokenName)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
#ifdef DEBUG
printf("std-systemd:stdsystem-getpin() -> starting \n");
#endif
diff --git a/src/svrcore/src/systemd-ask-pass.c b/src/svrcore/src/systemd-ask-pass.c
index ea598d72a..8d1c89616 100644
--- a/src/svrcore/src/systemd-ask-pass.c
+++ b/src/svrcore/src/systemd-ask-pass.c
@@ -49,7 +49,7 @@ static const struct SVRCOREPinMethods vtable;
SVRCOREError
SVRCORE_CreateSystemdPinObj(SVRCORESystemdPinObj **out, uint64_t timeout)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
SVRCOREError err = SVRCORE_Success;
SVRCORESystemdPinObj *obj = NULL;
@@ -83,7 +83,7 @@ SVRCORE_CreateSystemdPinObj(SVRCORESystemdPinObj **out, uint64_t timeout)
#endif // Systemd
}
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
SVRCOREError
_create_socket(char **path, int *sfd)
{
@@ -162,7 +162,7 @@ out:
static char *
getPin(SVRCOREPinObj *obj, const char *tokenName, PRBool retry)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
SVRCORESystemdPinObj *sobj = (SVRCORESystemdPinObj *)obj;
SVRCOREError err = SVRCORE_Success;
char *tbuf = malloc(PASS_MAX);
@@ -450,7 +450,7 @@ out:
void
SVRCORE_DestroySystemdPinObj(SVRCORESystemdPinObj *obj)
{
-#ifdef HAVE_SYSTEMD
+#ifdef WITH_SYSTEMD
if (obj) {
free(obj);
}
| 0 |
a78448611711c34ca5f1bfdc6b084cd81fedcf88
|
389ds/389-ds-base
|
Ticket #47320 - put conn on work_q not poll list if conn has buffered more_data
Description: Additional change to
commit ed88c40218c3fb8944618927e7865d74bc922c02
to fix the self-deadlock.
Replacing bind_credentials_set with bind_credentials_set_nolock
in handle_handshake_done. The handle_handshake_done is only
called from connection_read_operation, where lock on c_mutex
is already obtained. Thus, the replacement is safe.
https://fedorahosted.org/389/ticket/47320
|
commit a78448611711c34ca5f1bfdc6b084cd81fedcf88
Author: Noriko Hosoi <[email protected]>
Date: Tue Apr 30 10:12:48 2013 -0700
Ticket #47320 - put conn on work_q not poll list if conn has buffered more_data
Description: Additional change to
commit ed88c40218c3fb8944618927e7865d74bc922c02
to fix the self-deadlock.
Replacing bind_credentials_set with bind_credentials_set_nolock
in handle_handshake_done. The handle_handshake_done is only
called from connection_read_operation, where lock on c_mutex
is already obtained. Thus, the replacement is safe.
https://fedorahosted.org/389/ticket/47320
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 4976406a2..7075acdcf 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -539,7 +539,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
* Associate the new credentials with the connection. Note that
* clientDN and clientCert may be NULL.
*/
- bind_credentials_set( conn, SLAPD_AUTH_SSL, clientDN,
+ bind_credentials_set_nolock( conn, SLAPD_AUTH_SSL, clientDN,
SLAPD_AUTH_SSL, clientDN, clientCert , NULL);
done:
slapi_ch_free_string(&subject);
| 0 |
6df837c47df9218260fc334b94e9c0a78feaa5cf
|
389ds/389-ds-base
|
Ticket 49086 - public api compatability test for SDN changes.
Bug Description: In order to resolve the SDN premangaling issue, we need to
assert that as we change the pblock and operation code we do not violate our
api behaviours.
Fix Description: This adds a set of initial tests to assert the behaviours of
the plugin v3 api via the pblock, and partially via the internal operation
api. With this set of tests, changes to the pblock structures and pointers can
be asserted to "behave the same way", which means we will keep the public api
working for existing plugins.
https://fedorahosted.org/389/ticket/49086
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit 6df837c47df9218260fc334b94e9c0a78feaa5cf
Author: William Brown <[email protected]>
Date: Wed Feb 8 13:29:59 2017 +1000
Ticket 49086 - public api compatability test for SDN changes.
Bug Description: In order to resolve the SDN premangaling issue, we need to
assert that as we change the pblock and operation code we do not violate our
api behaviours.
Fix Description: This adds a set of initial tests to assert the behaviours of
the plugin v3 api via the pblock, and partially via the internal operation
api. With this set of tests, changes to the pblock structures and pointers can
be asserted to "behave the same way", which means we will keep the public api
working for existing plugins.
https://fedorahosted.org/389/ticket/49086
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 7c7ab0adf..112b8f102 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1843,10 +1843,14 @@ check_PROGRAMS = test_slapd
test_slapd_SOURCES = test/main.c \
test/libslapd/test.c \
- test/libslapd/pblock/analytics.c
+ test/libslapd/pblock/analytics.c \
+ test/libslapd/pblock/v3_compat.c \
+ test/libslapd/operation/v3_compat.c
test_slapd_LDADD = libslapd.la
test_slapd_LDFLAGS = $(AM_CPPFLAGS) $(CMOCKA_LINKS)
-test_slapd_CPPFLAGS = $(AM_CPPFLAGS) @nspr_inc@
+### WARNING: Slap.h needs cert.h, which requires the -I/lib/ldaputil!!!
+### WARNING: Slap.h pulls ssl.h, which requires nss!!!!
+test_slapd_CPPFLAGS = $(AM_CPPFLAGS) @nspr_inc@ @nss_inc@ -I$(srcdir)/include/ldaputil
diff --git a/test/libslapd/operation/v3_compat.c b/test/libslapd/operation/v3_compat.c
new file mode 100644
index 000000000..c69a670f6
--- /dev/null
+++ b/test/libslapd/operation/v3_compat.c
@@ -0,0 +1,53 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "../../test_slapd.h"
+
+/* This is somewhat internal to the server! Thus the slap.h */
+/* WARNING: Slap.h needs cert.h, which requires the -I/lib/ldaputil!!! */
+/* It also pulls in nspr! Bad! */
+
+#include <slap.h>
+
+/*
+ * Assert that the compatability requirements of the plugin V3 pblock API
+ * are upheld.
+ *
+ * This is for checking the operation type maintains a correct interface.
+ */
+
+void
+test_libslapd_operation_v3c_target_spec(void **state __attribute__((unused))) {
+ /* Will we need to test PB / op interactions? */
+ /* Test the operation of the target spec is maintained. */
+ Slapi_Operation *op = slapi_operation_new(SLAPI_OP_FLAG_INTERNAL);
+ Slapi_DN *test_a_sdn = slapi_sdn_new_dn_byval("cn=a,cn=test");
+ Slapi_DN *a_sdn = NULL;
+ Slapi_DN *b_sdn = NULL;
+
+ /* Create an SDN */
+ /* Set it. */
+ operation_set_target_spec(op, test_a_sdn);
+ /* Assert the pointers are different because target_spec DUPS */
+ a_sdn = operation_get_target_spec(op);
+ assert_ptr_not_equal(a_sdn, test_a_sdn);
+ assert_int_equal(slapi_sdn_compare(a_sdn, test_a_sdn), 0);
+
+ /* Set a new SDN */
+ operation_set_target_spec_str(op, "cn=b,cn=test");
+ /* Assert the old SDN is there, as we don't free on set */
+ b_sdn = operation_get_target_spec(op);
+ assert_ptr_not_equal(b_sdn, a_sdn);
+ assert_ptr_not_equal(b_sdn, test_a_sdn);
+ assert_int_not_equal(slapi_sdn_compare(a_sdn, b_sdn), 0);
+
+ /* free everything */
+ slapi_sdn_free(&test_a_sdn);
+ slapi_sdn_free(&a_sdn);
+ slapi_sdn_free(&b_sdn);
+}
diff --git a/test/libslapd/pblock/v3_compat.c b/test/libslapd/pblock/v3_compat.c
new file mode 100644
index 000000000..66c167c13
--- /dev/null
+++ b/test/libslapd/pblock/v3_compat.c
@@ -0,0 +1,204 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "../../test_slapd.h"
+#include <string.h>
+
+/*
+ * Assert that the compatability requirements of the plugin V3 pblock API
+ * are upheld.
+ *
+ * This will be critical in the migration to V4 so that refactors can guarantee
+ * we are not altering code behaviours.
+ */
+
+
+void
+test_libslapd_pblock_v3c_target_dn(void **state __attribute__((unused))) {
+ /* Create a pblock */
+ Slapi_PBlock *pb = slapi_pblock_new();
+ Slapi_Operation *op = slapi_operation_new(SLAPI_OP_FLAG_INTERNAL);
+ slapi_pblock_init(pb);
+
+ char *dn = NULL;
+ char *test_dn = "cn=Directory Manager";
+ Slapi_DN *sdn = NULL;
+
+ /* SLAPI_TARGET_DN */
+ /* Check that with no operation we get -1 */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn), -1);
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_TARGET_DN, &dn), -1);
+
+ /* Add the operation */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_OPERATION, op), 0);
+
+ /* Check that with a null target_address we get NULL */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn), 0);
+ assert_null(dn);
+
+ /* Set a DN */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_TARGET_DN, test_dn), 0);
+ /* Check it was set */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_DN, &dn), 0);
+ assert_int_equal(strcmp(dn, test_dn), 0);
+ /* Check that TARGET_SDN is not null now */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn), 0);
+ assert_non_null(sdn);
+
+ /* Assert we did not influence ORIGINAL_TARGET_DN or UNIQUEID */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET_DN, &dn), 0);
+ assert_null(dn);
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_UNIQUEID, &dn), 0);
+ assert_null(dn);
+
+ /* A property we cannot easily test is that setting a new DN frees the
+ * OLD sdn. But, we can test in SDN that setting via SDN does NOT free.
+ *
+ * The only effective way to test this would be to crash sadly.
+ */
+
+ /* It works! */
+ slapi_pblock_destroy(pb);
+}
+
+
+void
+test_libslapd_pblock_v3c_target_sdn(void **state __attribute__((unused))) {
+ /* SLAPI_TARGET_SDN */
+ Slapi_PBlock *pb = slapi_pblock_new();
+ Slapi_Operation *op = slapi_operation_new(SLAPI_OP_FLAG_INTERNAL);
+ slapi_pblock_init(pb);
+
+ char *dn = NULL;
+ Slapi_DN *sdn = NULL;
+ Slapi_DN *test_a_sdn = NULL;
+ Slapi_DN *test_b_sdn = NULL;
+
+ /* Check our aliases - once we assert these are the same
+ * we can then extend to say that these behaviours hold for all these
+ * pblock aliases.
+ */
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_ADD_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_BIND_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_COMPARE_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_DELETE_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_MODIFY_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_MODRDN_TARGET_SDN);
+ assert_int_equal(SLAPI_TARGET_SDN, SLAPI_SEARCH_TARGET_SDN);
+
+ /* Check that with no operation we get -1 */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn), -1);
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_TARGET_SDN, sdn), -1);
+ /* Add the operation */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_OPERATION, op), 0);
+
+ /* Check that with a null target_address we get NULL */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn), 0);
+ assert_null(sdn);
+
+ /* Create and SDN and set it. */
+ test_a_sdn = slapi_sdn_new_dn_byval("cn=a,cn=test");
+ test_b_sdn = slapi_sdn_new_dn_byval("cn=b,cn=test");
+
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_TARGET_SDN, test_a_sdn), 0);
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn), 0);
+ /* Assert we get it back, not a dup, the real pointer */
+ assert_ptr_equal(test_a_sdn, sdn);
+ assert_int_equal(slapi_sdn_compare(sdn, test_a_sdn), 0);
+
+ /* Make a new one, and assert we haven't freed the previous. */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_TARGET_SDN, test_b_sdn), 0);
+ assert_int_equal(slapi_sdn_compare(sdn, test_a_sdn), 0);
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn), 0);
+ /* Assert we get it back, not a dup, the real pointer */
+ assert_ptr_equal(test_b_sdn, sdn);
+ assert_int_equal(slapi_sdn_compare(sdn, test_b_sdn), 0);
+ assert_int_not_equal(slapi_sdn_compare(sdn, test_a_sdn), 0);
+
+ /* Assert we did not influence ORIGINAL_TARGET_DN or UNIQUEID */
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_ORIGINAL_TARGET_DN, &dn), 0);
+ assert_null(dn);
+ assert_int_equal(slapi_pblock_get(pb, SLAPI_TARGET_UNIQUEID, &dn), 0);
+ assert_null(dn);
+
+ /* Free everything ourselves! */
+ slapi_sdn_free(&test_a_sdn);
+ slapi_sdn_free(&test_b_sdn);
+
+ /* It works! */
+ slapi_pblock_destroy(pb);
+}
+
+/* nf here means "no implicit free". For now implies no dup */
+void
+_test_libslapi_pblock_v3c_generic_nf_char(Slapi_PBlock *pb, int type, int *conflicts) {
+ /* We have to accept a valid PB, because some tests require operations etc. */
+ char *out = NULL;
+ char *test_a_in = slapi_ch_strdup("some awesome value");
+ char *test_b_in = slapi_ch_strdup("some other value");
+
+ /* Check we start nulled. */
+ assert_int_equal(slapi_pblock_get(pb, type, &out), 0);
+ assert_null(out);
+ /* Now, set a value into the pblock. */
+ assert_int_equal(slapi_pblock_set(pb, type, test_a_in), 0);
+ assert_int_equal(slapi_pblock_get(pb, type, &out), 0);
+ assert_ptr_equal(test_a_in, out);
+ assert_int_equal(strcmp(out, test_a_in), 0);
+
+ /* Test another value, and does not free a. */
+ assert_int_equal(slapi_pblock_set(pb, type, test_b_in), 0);
+ assert_int_equal(slapi_pblock_get(pb, type, &out), 0);
+ assert_ptr_equal(test_b_in, out);
+ assert_int_equal(strcmp(out, test_b_in), 0);
+ assert_int_not_equal(strcmp(out, test_a_in), 0);
+
+ /* conflicts takes a null terminated array of values that we want to assert we do not influence */
+ for (size_t i = 0; conflicts[i] != 0; i++) {
+ assert_int_equal(slapi_pblock_get(pb, conflicts[i], &out), 0);
+ assert_null(out);
+ }
+
+ slapi_ch_free_string(&test_a_in);
+ slapi_ch_free_string(&test_b_in);
+}
+
+void
+test_libslapd_pblock_v3c_original_target_dn(void **state __attribute__((unused))) {
+ /* SLAPI_ORIGINAL_TARGET_DN */
+ Slapi_PBlock *pb = slapi_pblock_new();
+ Slapi_Operation *op = slapi_operation_new(SLAPI_OP_FLAG_INTERNAL);
+ int conflicts[] = {SLAPI_TARGET_UNIQUEID, SLAPI_TARGET_SDN, 0};
+ slapi_pblock_init(pb);
+
+ /* Add the operation */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_OPERATION, op), 0);
+ /* Run the generic char * tests */
+ _test_libslapi_pblock_v3c_generic_nf_char(pb, SLAPI_ORIGINAL_TARGET_DN, conflicts);
+
+ /* It works! */
+ slapi_pblock_destroy(pb);
+}
+
+void
+test_libslapd_pblock_v3c_target_uniqueid(void **state __attribute__((unused))) {
+ /* SLAPI_TARGET_UNIQUEID */
+ Slapi_PBlock *pb = slapi_pblock_new();
+ Slapi_Operation *op = slapi_operation_new(SLAPI_OP_FLAG_INTERNAL);
+ int conflicts[] = {SLAPI_ORIGINAL_TARGET_DN, SLAPI_TARGET_SDN, 0};
+ slapi_pblock_init(pb);
+
+ /* Add the operation */
+ assert_int_equal(slapi_pblock_set(pb, SLAPI_OPERATION, op), 0);
+ /* Run the generic char * tests */
+ _test_libslapi_pblock_v3c_generic_nf_char(pb, SLAPI_TARGET_UNIQUEID, conflicts);
+
+ /* It works! */
+ slapi_pblock_destroy(pb);
+}
+
diff --git a/test/libslapd/test.c b/test/libslapd/test.c
index 62831c6fb..37d554311 100644
--- a/test/libslapd/test.c
+++ b/test/libslapd/test.c
@@ -19,6 +19,11 @@ run_libslapd_tests (void) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_libslapd_hello),
cmocka_unit_test(test_libslapd_pblock_analytics),
+ cmocka_unit_test(test_libslapd_pblock_v3c_target_dn),
+ cmocka_unit_test(test_libslapd_pblock_v3c_target_sdn),
+ cmocka_unit_test(test_libslapd_pblock_v3c_original_target_dn),
+ cmocka_unit_test(test_libslapd_pblock_v3c_target_uniqueid),
+ cmocka_unit_test(test_libslapd_operation_v3c_target_spec),
};
return cmocka_run_group_tests(tests, NULL, NULL);
}
diff --git a/test/test_slapd.h b/test/test_slapd.h
index 1f35b7f1a..02eefddd7 100644
--- a/test/test_slapd.h
+++ b/test/test_slapd.h
@@ -28,4 +28,13 @@ void test_libslapd_hello(void **state);
/* libslapd-pblock-analytics */
void test_libslapd_pblock_analytics(void **state);
+/* libslapd-pblock-v3_compat */
+void test_libslapd_pblock_v3c_target_dn(void **state);
+void test_libslapd_pblock_v3c_target_sdn(void **state);
+void test_libslapd_pblock_v3c_original_target_dn(void **state);
+void test_libslapd_pblock_v3c_target_uniqueid(void **state);
+
+/* libslapd-operation-v3_compat */
+void test_libslapd_operation_v3c_target_spec(void **state);
+
| 0 |
dbb5ef5dae65aeab87c3287d6bac946d9e71f5aa
|
389ds/389-ds-base
|
Ticket #47728 - compilation failed with ' incomplete struct/union/enum' if not set USE_POSIX_RWLOCKS
Description:
1) Slapi_RWLock is typedef'ed as follows without defining "struct slapi_rwlock".
ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
else
typedef struct slapi_rwlock Slapi_RWLock;
endif
According to the wrapper layer slapi2nspr.c, the "else" of USE_POSIX_RWLOCKS
is supposed to handle PRRWLock. This patch replaces "struct slapi_rwlock"
with PRRWLock*.
2) In slapi_entry_size and pw_get_ext_size, the size of Slapi_RWLock is
added to the each object size. Unfortunately, the size of PRRWLock is not
provided by NSPR. This patch adds an API slapi_rwlock_get_size, in which
if not USE_POSIX_RWLOCKS, a rough estimate of the PRRWLock size is calculated
and returned. Note: "if USE_POSIX_RWLOCKS" is the default case and in the
case, the size is accurate.
https://fedorahosted.org/389/ticket/47728
Reviewed by [email protected] (Thank you, Mark!!)
|
commit dbb5ef5dae65aeab87c3287d6bac946d9e71f5aa
Author: Noriko Hosoi <[email protected]>
Date: Tue Feb 10 15:37:14 2015 -0800
Ticket #47728 - compilation failed with ' incomplete struct/union/enum' if not set USE_POSIX_RWLOCKS
Description:
1) Slapi_RWLock is typedef'ed as follows without defining "struct slapi_rwlock".
ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
else
typedef struct slapi_rwlock Slapi_RWLock;
endif
According to the wrapper layer slapi2nspr.c, the "else" of USE_POSIX_RWLOCKS
is supposed to handle PRRWLock. This patch replaces "struct slapi_rwlock"
with PRRWLock*.
2) In slapi_entry_size and pw_get_ext_size, the size of Slapi_RWLock is
added to the each object size. Unfortunately, the size of PRRWLock is not
provided by NSPR. This patch adds an API slapi_rwlock_get_size, in which
if not USE_POSIX_RWLOCKS, a rough estimate of the PRRWLock size is calculated
and returned. Note: "if USE_POSIX_RWLOCKS" is the default case and in the
case, the size is accurate.
https://fedorahosted.org/389/ticket/47728
Reviewed by [email protected] (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 203c742ab..981a02d95 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2094,7 +2094,7 @@ slapi_entry_size(Slapi_Entry *e)
if (e->e_uniqueid) size += strlen(e->e_uniqueid) + 1;
if (e->e_dncsnset) size += csnset_size(e->e_dncsnset);
if (e->e_maxcsn) size += sizeof( CSN );
- if (e->e_virtual_lock) size += sizeof(Slapi_RWLock);
+ if (e->e_virtual_lock) size += slapi_rwlock_get_size();
/* Slapi_DN and RDN are included in Slapi_Entry */
size += (slapi_sdn_get_size(&e->e_sdn) - sizeof(Slapi_DN));
size += (slapi_rdn_get_size(&e->e_srdn) - sizeof(Slapi_RDN));
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 43a11c797..c781adc78 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -2782,7 +2782,7 @@ pw_get_ext_size(Slapi_Entry *entry, size_t *size)
return LDAP_SUCCESS;
}
*size += sizeof(struct slapi_pw_entry_ext);
- *size += sizeof(Slapi_RWLock);
+ *size += slapi_rwlock_get_size();
if (LDAP_SUCCESS == slapi_pw_get_entry_ext(entry, &pw_entry_values)) {
Slapi_Value *cvalue;
int idx = valuearray_first_value(pw_entry_values, &cvalue);
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 41dd2c812..1148b3e97 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6100,7 +6100,7 @@ typedef struct slapi_condvar Slapi_CondVar;
#ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
#else
-typedef struct slapi_rwlock Slapi_RWLock;
+typedef PRRWLock Slapi_RWLock;
#endif
Slapi_Mutex *slapi_new_mutex( void );
void slapi_destroy_mutex( Slapi_Mutex *mutex );
@@ -6169,6 +6169,12 @@ int slapi_rwlock_wrlock( Slapi_RWLock *rwlock );
*/
int slapi_rwlock_unlock( Slapi_RWLock *rwlock );
+/**
+ * Get the size of Slapi_RWLock
+ *
+ * \return the size of Slapi_RWLock
+ */
+int slapi_rwlock_get_size();
/*
* thread-safe LDAP connections
diff --git a/ldap/servers/slapd/slapi2nspr.c b/ldap/servers/slapd/slapi2nspr.c
index c73498946..44b6d8e5c 100644
--- a/ldap/servers/slapd/slapi2nspr.c
+++ b/ldap/servers/slapd/slapi2nspr.c
@@ -289,3 +289,17 @@ slapi_rwlock_unlock( Slapi_RWLock *rwlock )
return ret;
}
+int
+slapi_rwlock_get_size()
+{
+#ifdef USE_POSIX_RWLOCKS
+ return sizeof(pthread_rwlock_t);
+#else
+ /*
+ * NSPR does not provide the size of PRRWLock.
+ * This is a rough estimate to maintain the entry size sane.
+ */
+ return sizeof("slapi_rwlock") + sizeof(void *) * 6;
+#endif
+}
+
| 0 |
f98310cc0440005be6803c133c3a32579638ed58
|
389ds/389-ds-base
|
bump version to 1.2.11.a1
|
commit f98310cc0440005be6803c133c3a32579638ed58
Author: Rich Megginson <[email protected]>
Date: Mon Feb 13 13:43:57 2012 -0700
bump version to 1.2.11.a1
diff --git a/VERSION.sh b/VERSION.sh
index 2cf2ac112..ca25d1c4a 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=10
+VERSION_MAINT=11
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
-VERSION_PREREL=.rc2
+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.
| 0 |
cb209be7ca39b9064e7ce2c89a94715c258cd72b
|
389ds/389-ds-base
|
Ticket #548 - CI test: added test cases for ticket 548
Description: RFE: Allow AD password sync to update shadowLastChange
https://fedorahosted.org/389/ticket/548
Reviwed by [email protected] and [email protected] (Thank you, Simon and William!)
|
commit cb209be7ca39b9064e7ce2c89a94715c258cd72b
Author: Noriko Hosoi <[email protected]>
Date: Mon Oct 19 15:14:18 2015 -0700
Ticket #548 - CI test: added test cases for ticket 548
Description: RFE: Allow AD password sync to update shadowLastChange
https://fedorahosted.org/389/ticket/548
Reviwed by [email protected] and [email protected] (Thank you, Simon and William!)
diff --git a/dirsrvtests/tickets/ticket548_test.py b/dirsrvtests/tickets/ticket548_test.py
new file mode 100644
index 000000000..030ff4f08
--- /dev/null
+++ b/dirsrvtests/tickets/ticket548_test.py
@@ -0,0 +1,339 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from lib389.utils import *
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+# Assuming DEFAULT_SUFFIX is "dc=example,dc=com", otherwise it does not work... :(
+SUBTREE_CONTAINER = 'cn=nsPwPolicyContainer,' + DEFAULT_SUFFIX
+SUBTREE_PWPDN = 'cn=nsPwPolicyEntry,' + DEFAULT_SUFFIX
+SUBTREE_PWP = 'cn=cn\3DnsPwPolicyEntry\2Cdc\3Dexample\2Cdc\3Dcom,' + SUBTREE_CONTAINER
+SUBTREE_COS_TMPLDN = 'cn=nsPwTemplateEntry,' + DEFAULT_SUFFIX
+SUBTREE_COS_TMPL = 'cn=cn\3DnsPwTemplateEntry\2Cdc\3Dexample\2Cdc\3Dcom,' + SUBTREE_CONTAINER
+SUBTREE_COS_DEF = 'cn=nsPwPolicy_CoS,' + DEFAULT_SUFFIX
+
+USER1_DN = 'uid=user1,' + DEFAULT_SUFFIX
+USER2_DN = 'uid=user2,' + DEFAULT_SUFFIX
+USER3_DN = 'uid=user3,' + DEFAULT_SUFFIX
+USER_PW = 'password'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ global installation_prefix
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ # Creating standalone instance ...
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_instance[SER_CREATION_SUFFIX] = DEFAULT_SUFFIX
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ standalone.delete()
+ standalone.create()
+ standalone.open()
+
+ # Delete each instance in the end
+ def fin():
+ standalone.delete()
+ request.addfinalizer(fin)
+
+ # Clear out the tmp dir
+ standalone.clearTmpDir(__file__)
+
+ return TopologyStandalone(standalone)
+
+
+def set_global_pwpolicy(topology):
+ log.info(" +++++ Enable global password policy +++++\n")
+ # Enable password policy
+ try:
+ topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-pwpolicy-local', 'on')])
+ except ldap.LDAPError as e:
+ log.error('Failed to set pwpolicy-local: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Set global password Min Age -- 1 day\n")
+ try:
+ topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'passwordMinAge', '86400')])
+ except ldap.LDAPError as e:
+ log.error('Failed to set passwordMinAge: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Set global password Max Age -- 10 days\n")
+ try:
+ topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'passwordMaxAge', '864000')])
+ except ldap.LDAPError as e:
+ log.error('Failed to set passwordMaxAge: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Set global password Warning -- 3 days\n")
+ try:
+ topology.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'passwordWarning', '259200')])
+ except ldap.LDAPError as e:
+ log.error('Failed to set passwordWarning: error ' + e.message['desc'])
+ assert False
+
+
+def set_subtree_pwpolicy(topology):
+ log.info(" +++++ Enable subtree level password policy +++++\n")
+ log.info(" Add the container")
+ try:
+ topology.standalone.add_s(Entry((SUBTREE_CONTAINER, {'objectclass': 'top nsContainer'.split(),
+ 'cn': 'nsPwPolicyContainer'})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add subtree container: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Add the password policy subentry {passwordMustChange: on, passwordMinAge: 2, passwordMaxAge: 20, passwordWarning: 6}")
+ try:
+ topology.standalone.add_s(Entry((SUBTREE_PWP, {'objectclass': 'top ldapsubentry passwordpolicy'.split(),
+ 'cn': SUBTREE_PWPDN,
+ 'passwordMustChange': 'on',
+ 'passwordExp': 'on',
+ 'passwordMinAge': '172800',
+ 'passwordMaxAge': '1728000',
+ 'passwordWarning': '518400',
+ 'passwordChange': 'on',
+ 'passwordStorageScheme': 'clear'})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add passwordpolicy: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Add the COS template")
+ try:
+ topology.standalone.add_s(Entry((SUBTREE_COS_TMPL, {'objectclass': 'top ldapsubentry costemplate extensibleObject'.split(),
+ 'cn': SUBTREE_PWPDN,
+ 'cosPriority': '1',
+ 'cn': SUBTREE_COS_TMPLDN,
+ 'pwdpolicysubentry': SUBTREE_PWP})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add COS template: error ' + e.message['desc'])
+ assert False
+
+ log.info(" Add the COS definition")
+ try:
+ topology.standalone.add_s(Entry((SUBTREE_COS_DEF, {'objectclass': 'top ldapsubentry cosSuperDefinition cosPointerDefinition'.split(),
+ 'cn': SUBTREE_PWPDN,
+ 'costemplatedn': SUBTREE_COS_TMPL,
+ 'cosAttribute': 'pwdpolicysubentry default operational-default'})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add COS def: error ' + e.message['desc'])
+ assert False
+
+ time.sleep(1)
+
+
+def update_passwd(topology, user, passwd, newpasswd):
+ log.info(" Bind as {%s,%s}" % (user, passwd))
+ topology.standalone.simple_bind_s(user, passwd)
+ try:
+ topology.standalone.modify_s(user, [(ldap.MOD_REPLACE, 'userpassword', newpasswd)])
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to update the password ' + cpw + ' of user ' + user + ': error ' + e.message['desc'])
+ assert False
+
+ time.sleep(1)
+
+
+def check_shadow_attr_value(entry, attr_type, expected, dn):
+ if entry.hasAttr(attr_type):
+ actual = entry.getValue(attr_type)
+ if int(actual) == expected:
+ log.info('%s of entry %s has expected value %s' % (attr_type, dn, actual))
+ assert True
+ else:
+ log.fatal('%s %s of entry %s does not have expected value %s' % (attr_type, actual, dn, expected))
+ assert False
+ else:
+ log.fatal('entry %s does not have %s attr' % (dn, attr_type))
+ assert False
+
+
+def test_ticket548_test_with_no_policy(topology):
+ """
+ Check shadowAccount under no password policy
+ """
+ log.info("Case 1. No password policy")
+
+ log.info("Bind as %s" % DN_DM)
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ log.info('Add an entry' + USER1_DN)
+ try:
+ topology.standalone.add_s(Entry((USER1_DN, {'objectclass': "top person organizationalPerson inetOrgPerson shadowAccount".split(),
+ 'sn': '1',
+ 'cn': 'user 1',
+ 'uid': 'user1',
+ 'givenname': 'user',
+ 'mail': '[email protected]',
+ 'userpassword': USER_PW})))
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to add user' + USER1_DN + ': error ' + e.message['desc'])
+ assert False
+
+ edate = int(time.time() / (60 * 60 * 24))
+ log.info('Search entry %s' % USER1_DN)
+
+ log.info("Bind as %s" % USER1_DN)
+ topology.standalone.simple_bind_s(USER1_DN, USER_PW)
+ entry = topology.standalone.getEntry(USER1_DN, ldap.SCOPE_BASE, "(objectclass=*)", ['shadowLastChange'])
+ check_shadow_attr_value(entry, 'shadowLastChange', edate, USER1_DN)
+
+ log.info("Check shadowAccount with no policy was successfully verified.")
+
+
+def test_ticket548_test_global_policy(topology):
+ """
+ Check shadowAccount with global password policy
+ """
+
+ log.info("Case 2. Check shadowAccount with global password policy")
+
+ log.info("Bind as %s" % DN_DM)
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ set_global_pwpolicy(topology)
+
+ log.info('Add an entry' + USER2_DN)
+ try:
+ topology.standalone.add_s(Entry((USER2_DN, {'objectclass': "top person organizationalPerson inetOrgPerson shadowAccount".split(),
+ 'sn': '2',
+ 'cn': 'user 2',
+ 'uid': 'user2',
+ 'givenname': 'user',
+ 'mail': '[email protected]',
+ 'userpassword': USER_PW})))
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to add user' + USER2_DN + ': error ' + e.message['desc'])
+ assert False
+
+ log.info("Bind as %s" % USER2_DN)
+ topology.standalone.simple_bind_s(USER2_DN, USER_PW)
+
+ edate = int(time.time() / (60 * 60 * 24))
+ log.info('Search entry %s' % USER2_DN)
+ entry = topology.standalone.getEntry(USER2_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ check_shadow_attr_value(entry, 'shadowLastChange', edate, USER2_DN)
+
+ # passwordMinAge -- 1 day
+ check_shadow_attr_value(entry, 'shadowMin', 1, USER2_DN)
+
+ # passwordMaxAge -- 10 days
+ check_shadow_attr_value(entry, 'shadowMax', 10, USER2_DN)
+
+ # passwordWarning -- 3 days
+ check_shadow_attr_value(entry, 'shadowWarning', 3, USER2_DN)
+
+ log.info("Check shadowAccount with global policy was successfully verified.")
+
+
+def test_ticket548_test_subtree_policy(topology):
+ """
+ Check shadowAccount with subtree level password policy
+ """
+
+ log.info("Case 3. Check shadowAccount with subtree level password policy")
+
+ log.info("Bind as %s" % DN_DM)
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ set_subtree_pwpolicy(topology)
+
+ log.info('Add an entry' + USER3_DN)
+ try:
+ topology.standalone.add_s(Entry((USER3_DN, {'objectclass': "top person organizationalPerson inetOrgPerson shadowAccount".split(),
+ 'sn': '3',
+ 'cn': 'user 3',
+ 'uid': 'user3',
+ 'givenname': 'user',
+ 'mail': '[email protected]',
+ 'userpassword': USER_PW})))
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to add user' + USER3_DN + ': error ' + e.message['desc'])
+ assert False
+
+ log.info('Search entry %s' % USER3_DN)
+ entry0 = topology.standalone.getEntry(USER3_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+
+ log.info('Expecting shadowLastChange 0 since passwordMustChange is on')
+ check_shadow_attr_value(entry0, 'shadowLastChange', 0, USER3_DN)
+
+ # passwordMinAge -- 2 day
+ check_shadow_attr_value(entry0, 'shadowMin', 2, USER3_DN)
+
+ # passwordMaxAge -- 20 days
+ check_shadow_attr_value(entry0, 'shadowMax', 20, USER3_DN)
+
+ # passwordWarning -- 6 days
+ check_shadow_attr_value(entry0, 'shadowWarning', 6, USER3_DN)
+
+ log.info("Bind as %s" % USER3_DN)
+ topology.standalone.simple_bind_s(USER3_DN, USER_PW)
+
+ log.info('Search entry %s' % USER3_DN)
+ try:
+ entry1 = topology.standalone.getEntry(USER3_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ except ldap.UNWILLING_TO_PERFORM:
+ log.info('test_ticket548: Search by' + USER3_DN + ' failed by UNWILLING_TO_PERFORM as expected')
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to serch user' + USER3_DN + ' by self: error ' + e.message['desc'])
+ assert False
+
+ log.info("Bind as %s and updating the password with a new one" % USER3_DN)
+ topology.standalone.simple_bind_s(USER3_DN, USER_PW)
+
+ newpasswd = USER_PW + '0'
+ update_passwd(topology, USER3_DN, USER_PW, newpasswd)
+
+ log.info("Re-bind as %s with new password" % USER3_DN)
+ topology.standalone.simple_bind_s(USER3_DN, newpasswd)
+
+ try:
+ entry2 = topology.standalone.getEntry(USER3_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ except ldap.LDAPError as e:
+ log.fatal('test_ticket548: Failed to serch user' + USER3_DN + ' by self: error ' + e.message['desc'])
+ assert False
+
+ edate = int(time.time() / (60 * 60 * 24))
+
+ log.info('Expecting shadowLastChange %d once userPassword is updated', edate)
+ check_shadow_attr_value(entry2, 'shadowLastChange', edate, USER3_DN)
+
+ log.info("Check shadowAccount with subtree level policy was successfully verified.")
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
| 0 |
100785aae13a423f1c4522fccc8a753f60695bda
|
389ds/389-ds-base
|
Bug 622628 - fix coverity Defect Type: Integer handling issues
https://bugzilla.redhat.com/show_bug.cgi?id=622628
Comment:
There is a suspicious implicit sign extension. Instead of direct
bit shifting, use ntohl to decode buffer length.
|
commit 100785aae13a423f1c4522fccc8a753f60695bda
Author: Noriko Hosoi <[email protected]>
Date: Wed Aug 11 09:55:37 2010 -0700
Bug 622628 - fix coverity Defect Type: Integer handling issues
https://bugzilla.redhat.com/show_bug.cgi?id=622628
Comment:
There is a suspicious implicit sign extension. Instead of direct
bit shifting, use ntohl to decode buffer length.
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index b831a8601..4bf81cc9f 100644
--- a/ldap/servers/slapd/sasl_io.c
+++ b/ldap/servers/slapd/sasl_io.c
@@ -44,6 +44,7 @@
#include "slapi-plugin.h"
#include "fe.h"
#include <sasl.h>
+#include <arpa/inet.h>
/*
* I/O Shim Layer for SASL Encryption
@@ -204,7 +205,7 @@ static PRInt32
sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt32 *err)
{
PRInt32 ret = 0;
- unsigned char buffer[4];
+ unsigned char buffer[sizeof(PRInt32)];
size_t packet_length = 0;
size_t saslio_limit;
sasl_io_private *sp = sasl_get_io_private(fd);
@@ -242,8 +243,8 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
return -1;
}
if (ret == sizeof(buffer)) {
- /* Decode the length (could use ntohl here ??) */
- packet_length = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
+ /* Decode the length */
+ packet_length = ntohl(*(uint32_t *)buffer);
/* add length itself (for Cyrus SASL library) */
packet_length += 4;
| 0 |
0bcf4f075f6ac857d60464f4d259374a9929ab2b
|
389ds/389-ds-base
|
Resolves: bug 447614
Bug Description: Lack of manpages
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: This adds man pages for the command line utilities. The configure.ac diffs were a little bit tricky - apparently, mandir is not set to a correct default value, so we have to make sure we set a reasonable default value it if the user has not set it (e.g. rpmbuild will override it with --mandir=something).
Platforms tested: Fedora 8, Fedora 9
Flag Day: no
Doc impact: no
|
commit 0bcf4f075f6ac857d60464f4d259374a9929ab2b
Author: Rich Megginson <[email protected]>
Date: Tue Jul 15 15:50:56 2008 +0000
Resolves: bug 447614
Bug Description: Lack of manpages
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: This adds man pages for the command line utilities. The configure.ac diffs were a little bit tricky - apparently, mandir is not set to a correct default value, so we have to make sure we set a reasonable default value it if the user has not set it (e.g. rpmbuild will override it with --mandir=something).
Platforms tested: Fedora 8, Fedora 9
Flag Day: no
Doc impact: no
diff --git a/Makefile.am b/Makefile.am
index 01ab2a53a..d5e85ae42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,7 +39,7 @@ endif
# Linker Flags
#------------------------
NSPR_LINK = @nspr_lib@ -lplc4 -lplds4 -lnspr4
-NSS_LINK = @nss_lib@ -lssl3 -lnss3 -lsoftokn3
+NSS_LINK = @nss_lib@ -lssl3 -lnss3
LDAPSDK_LINK = @ldapsdk_lib@ -lssldap60 -lprldap60 -lldap60 -lldif60
DB_LINK = @db_lib@ -ldb-@db_libver@
SASL_LINK = @sasl_lib@ -lsasl2
@@ -59,7 +59,32 @@ LIBCRUN=@LIBCRUN@
#------------------------
BUILT_SOURCES = dirver.h dberrstrs.h
-CLEANFILES = dirver.h dberrstrs.h ns-slapd.properties
+CLEANFILES = dirver.h dberrstrs.h ns-slapd.properties \
+ ldap/admin/src/scripts/dscreate.map \
+ ldap/admin/src/scripts/DSCreate.pm ldap/admin/src/scripts/DSMigration.pm \
+ ldap/admin/src/scripts/dsorgentries.map ldap/admin/src/scripts/migrate-ds.pl \
+ ldap/admin/src/scripts/Migration.pm ldap/admin/src/scripts/SetupDialogs.pm \
+ ldap/admin/src/scripts/setup-ds.pl ldap/admin/src/scripts/setup-ds.res \
+ ldap/admin/src/scripts/Setup.pm ldap/admin/src/scripts/template-bak2db \
+ ldap/admin/src/scripts/template-bak2db.pl ldap/admin/src/scripts/template-db2bak \
+ ldap/admin/src/scripts/template-db2bak.pl ldap/admin/src/scripts/template-db2index \
+ ldap/admin/src/scripts/template-db2index.pl ldap/admin/src/scripts/template-db2ldif \
+ ldap/admin/src/scripts/template-db2ldif.pl ldap/admin/src/scripts/template-dbverify \
+ ldap/admin/src/scripts/template-ldif2db ldap/admin/src/scripts/template-ldif2db.pl \
+ ldap/admin/src/scripts/template-ldif2ldap ldap/admin/src/scripts/template-monitor \
+ ldap/admin/src/scripts/template-ns-accountstatus.pl ldap/admin/src/scripts/template-ns-activate.pl \
+ ldap/admin/src/scripts/template-ns-inactivate.pl ldap/admin/src/scripts/template-ns-newpwpolicy.pl \
+ ldap/admin/src/scripts/template-restart-slapd ldap/admin/src/scripts/template-restoreconfig \
+ ldap/admin/src/scripts/template-saveconfig ldap/admin/src/scripts/template-start-slapd \
+ ldap/admin/src/scripts/template-stop-slapd ldap/admin/src/scripts/template-suffix2instance \
+ ldap/admin/src/scripts/template-upgradedb ldap/admin/src/scripts/template-verify-db.pl \
+ ldap/admin/src/scripts/template-vlvindex ldap/admin/src/scripts/Util.pm \
+ ldap/ldif/template-baseacis.ldif ldap/ldif/template-bitwise.ldif ldap/ldif/template-country.ldif \
+ ldap/ldif/template-dnaplugin.ldif ldap/ldif/template-domain.ldif ldap/ldif/template-dse.ldif \
+ ldap/ldif/template-ldapi-autobind.ldif ldap/ldif/template-ldapi-default.ldif \
+ ldap/ldif/template-ldapi.ldif ldap/ldif/template-locality.ldif ldap/ldif/template-org.ldif \
+ ldap/ldif/template-orgunit.ldif ldap/ldif/template-pampta.ldif ldap/ldif/template-sasl.ldif \
+ ldap/ldif/template-state.ldif ldap/ldif/template-suffix-db.ldif
dirver.h: Makefile
perl $(srcdir)/dirver.pl -v "$(VERSION)" -o dirver.h
@@ -262,6 +287,27 @@ mib_DATA = ldap/servers/snmp/RFC-1215.txt \
ldap/servers/snmp/RFC1155-SMI.txt \
ldap/servers/snmp/SNMPv2-SMI.txt
+#------------------------
+# man pages
+#------------------------
+dist_man_MANS = man/man1/dbscan.1 \
+ man/man1/cl-dump.1 \
+ man/man1/dbgen.pl.1 \
+ man/man1/dsktune.1 \
+ man/man1/infadd.1 \
+ man/man1/ldap-agent.1 \
+ man/man1/ldclt.1 \
+ man/man1/ldif.1 \
+ man/man1/logconv.pl.1 \
+ man/man1/migratecred.1 \
+ man/man1/mmldif.1 \
+ man/man1/pwdhash.1 \
+ man/man1/repl-monitor.1 \
+ man/man1/rsearch.1 \
+ man/man8/migrate-ds.pl.8 \
+ man/man8/ns-slapd.8 \
+ man/man8/setup-ds.pl.8
+
#////////////////////////////////////////////////////////////////
#
# Server Strings
diff --git a/Makefile.in b/Makefile.in
index 4175ce4eb..34abe71f0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -47,10 +47,10 @@ bin_PROGRAMS = dbscan-bin$(EXEEXT) dsktune-bin$(EXEEXT) \
pwdhash-bin$(EXEEXT) rsearch-bin$(EXEEXT)
noinst_PROGRAMS = makstrdb$(EXEEXT)
@SOLARIS_TRUE@am__append_1 = ldap/servers/slapd/tools/ldclt/opCheck.c
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure compile config.guess config.sub \
- depcomp install-sh ltmain.sh missing
+DIST_COMMON = $(am__configure_deps) $(dist_man_MANS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(top_srcdir)/configure compile \
+ config.guess config.sub depcomp install-sh ltmain.sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/fhs.m4 $(top_srcdir)/m4/nspr.m4 \
@@ -95,7 +95,8 @@ am__installdirs = "$(DESTDIR)$(serverdir)" \
"$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(initdir)" "$(DESTDIR)$(initconfigdir)" \
"$(DESTDIR)$(perldir)" "$(DESTDIR)$(sbindir)" \
- "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" \
+ "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(man1dir)" \
+ "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(configdir)" \
"$(DESTDIR)$(infdir)" "$(DESTDIR)$(mibdir)" \
"$(DESTDIR)$(propertydir)" "$(DESTDIR)$(propertydir)" \
"$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"
@@ -775,6 +776,10 @@ DIST_SOURCES = $(libavl_a_SOURCES) $(libldaputil_a_SOURCES) \
$(makstrdb_SOURCES) $(migratecred_bin_SOURCES) \
$(mmldif_bin_SOURCES) $(am__ns_slapd_SOURCES_DIST) \
$(pwdhash_bin_SOURCES) $(rsearch_bin_SOURCES)
+man1dir = $(mandir)/man1
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(dist_man_MANS)
configDATA_INSTALL = $(INSTALL_DATA)
infDATA_INSTALL = $(INSTALL_DATA)
mibDATA_INSTALL = $(INSTALL_DATA)
@@ -862,6 +867,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOLARIS_FALSE = @SOLARIS_FALSE@
@@ -1017,7 +1023,7 @@ PLUGIN_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
# Linker Flags
#------------------------
NSPR_LINK = @nspr_lib@ -lplc4 -lplds4 -lnspr4
-NSS_LINK = @nss_lib@ -lssl3 -lnss3 -lsoftokn3
+NSS_LINK = @nss_lib@ -lssl3 -lnss3
LDAPSDK_LINK = @ldapsdk_lib@ -lssldap60 -lprldap60 -lldap60 -lldif60
DB_LINK = @db_lib@ -ldb-@db_libver@
SASL_LINK = @sasl_lib@ -lsasl2
@@ -1030,7 +1036,33 @@ PAM_LINK = -lpam
# Generated Sources
#------------------------
BUILT_SOURCES = dirver.h dberrstrs.h
-CLEANFILES = dirver.h dberrstrs.h ns-slapd.properties
+CLEANFILES = dirver.h dberrstrs.h ns-slapd.properties \
+ ldap/admin/src/scripts/dscreate.map \
+ ldap/admin/src/scripts/DSCreate.pm ldap/admin/src/scripts/DSMigration.pm \
+ ldap/admin/src/scripts/dsorgentries.map ldap/admin/src/scripts/migrate-ds.pl \
+ ldap/admin/src/scripts/Migration.pm ldap/admin/src/scripts/SetupDialogs.pm \
+ ldap/admin/src/scripts/setup-ds.pl ldap/admin/src/scripts/setup-ds.res \
+ ldap/admin/src/scripts/Setup.pm ldap/admin/src/scripts/template-bak2db \
+ ldap/admin/src/scripts/template-bak2db.pl ldap/admin/src/scripts/template-db2bak \
+ ldap/admin/src/scripts/template-db2bak.pl ldap/admin/src/scripts/template-db2index \
+ ldap/admin/src/scripts/template-db2index.pl ldap/admin/src/scripts/template-db2ldif \
+ ldap/admin/src/scripts/template-db2ldif.pl ldap/admin/src/scripts/template-dbverify \
+ ldap/admin/src/scripts/template-ldif2db ldap/admin/src/scripts/template-ldif2db.pl \
+ ldap/admin/src/scripts/template-ldif2ldap ldap/admin/src/scripts/template-monitor \
+ ldap/admin/src/scripts/template-ns-accountstatus.pl ldap/admin/src/scripts/template-ns-activate.pl \
+ ldap/admin/src/scripts/template-ns-inactivate.pl ldap/admin/src/scripts/template-ns-newpwpolicy.pl \
+ ldap/admin/src/scripts/template-restart-slapd ldap/admin/src/scripts/template-restoreconfig \
+ ldap/admin/src/scripts/template-saveconfig ldap/admin/src/scripts/template-start-slapd \
+ ldap/admin/src/scripts/template-stop-slapd ldap/admin/src/scripts/template-suffix2instance \
+ ldap/admin/src/scripts/template-upgradedb ldap/admin/src/scripts/template-verify-db.pl \
+ ldap/admin/src/scripts/template-vlvindex ldap/admin/src/scripts/Util.pm \
+ ldap/ldif/template-baseacis.ldif ldap/ldif/template-bitwise.ldif ldap/ldif/template-country.ldif \
+ ldap/ldif/template-dnaplugin.ldif ldap/ldif/template-domain.ldif ldap/ldif/template-dse.ldif \
+ ldap/ldif/template-ldapi-autobind.ldif ldap/ldif/template-ldapi-default.ldif \
+ ldap/ldif/template-ldapi.ldif ldap/ldif/template-locality.ldif ldap/ldif/template-org.ldif \
+ ldap/ldif/template-orgunit.ldif ldap/ldif/template-pampta.ldif ldap/ldif/template-sasl.ldif \
+ ldap/ldif/template-state.ldif ldap/ldif/template-suffix-db.ldif
+
taskdir = $(datadir)@scripttemplatedir@
server_LTLIBRARIES = libslapd.la libns-dshttpd.la
@@ -1187,6 +1219,28 @@ mib_DATA = ldap/servers/snmp/RFC-1215.txt \
ldap/servers/snmp/SNMPv2-SMI.txt
+#------------------------
+# man pages
+#------------------------
+dist_man_MANS = man/man1/dbscan.1 \
+ man/man1/cl-dump.1 \
+ man/man1/dbgen.pl.1 \
+ man/man1/dsktune.1 \
+ man/man1/infadd.1 \
+ man/man1/ldap-agent.1 \
+ man/man1/ldclt.1 \
+ man/man1/ldif.1 \
+ man/man1/logconv.pl.1 \
+ man/man1/migratecred.1 \
+ man/man1/mmldif.1 \
+ man/man1/pwdhash.1 \
+ man/man1/repl-monitor.1 \
+ man/man1/rsearch.1 \
+ man/man8/migrate-ds.pl.8 \
+ man/man8/ns-slapd.8 \
+ man/man8/setup-ds.pl.8
+
+
#////////////////////////////////////////////////////////////////
#
# Server Strings
@@ -8705,6 +8759,96 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man8: $(man8_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)"
+ @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.8*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 8*) ;; \
+ *) ext='8' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
+ done
+uninstall-man8:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.8*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 8*) ;; \
+ *) ext='8' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
+ done
install-configDATA: $(config_DATA)
@$(NORMAL_INSTALL)
test -z "$(configdir)" || $(mkdir_p) "$(DESTDIR)$(configdir)"
@@ -8876,7 +9020,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/m4
+ $(mkdir_p) $(distdir)/m4 $(distdir)/man/man1 $(distdir)/man/man8
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@@ -9004,9 +9148,9 @@ check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) \
- $(DATA) config.h
+ $(MANS) $(DATA) config.h
installdirs:
- for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(initconfigdir)" "$(DESTDIR)$(perldir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(infdir)" "$(DESTDIR)$(mibdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
+ for dir in "$(DESTDIR)$(serverdir)" "$(DESTDIR)$(serverplugindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(initdir)" "$(DESTDIR)$(initconfigdir)" "$(DESTDIR)$(perldir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(taskdir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(infdir)" "$(DESTDIR)$(mibdir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(propertydir)" "$(DESTDIR)$(sampledatadir)" "$(DESTDIR)$(schemadir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -9135,9 +9279,10 @@ info: info-am
info-am:
install-data-am: install-configDATA install-infDATA \
- install-initSCRIPTS install-initconfigSCRIPTS install-mibDATA \
- install-nodist_propertyDATA install-perlSCRIPTS \
- install-propertyDATA install-sampledataDATA install-schemaDATA \
+ install-initSCRIPTS install-initconfigSCRIPTS install-man \
+ install-mibDATA install-nodist_propertyDATA \
+ install-perlSCRIPTS install-propertyDATA \
+ install-sampledataDATA install-schemaDATA \
install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
install-taskSCRIPTS
@@ -9146,7 +9291,7 @@ install-exec-am: install-binPROGRAMS install-binSCRIPTS \
install-info: install-info-am
-install-man:
+install-man: install-man1 install-man8
installcheck-am:
@@ -9173,13 +9318,15 @@ ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-configDATA uninstall-infDATA uninstall-info-am \
uninstall-initSCRIPTS uninstall-initconfigSCRIPTS \
- uninstall-mibDATA uninstall-nodist_propertyDATA \
+ uninstall-man uninstall-mibDATA uninstall-nodist_propertyDATA \
uninstall-perlSCRIPTS uninstall-propertyDATA \
uninstall-sampledataDATA uninstall-sbinPROGRAMS \
uninstall-sbinSCRIPTS uninstall-schemaDATA \
uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
uninstall-taskSCRIPTS
+uninstall-man: uninstall-man1 uninstall-man8
+
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \
@@ -9193,10 +9340,10 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
install-data install-data-am install-exec install-exec-am \
install-infDATA install-info install-info-am \
install-initSCRIPTS install-initconfigSCRIPTS install-man \
- install-mibDATA install-nodist_propertyDATA \
- install-perlSCRIPTS install-propertyDATA \
- install-sampledataDATA install-sbinPROGRAMS \
- install-sbinSCRIPTS install-schemaDATA \
+ install-man1 install-man8 install-mibDATA \
+ install-nodist_propertyDATA install-perlSCRIPTS \
+ install-propertyDATA install-sampledataDATA \
+ install-sbinPROGRAMS install-sbinSCRIPTS install-schemaDATA \
install-serverLTLIBRARIES install-serverpluginLTLIBRARIES \
install-strip install-taskSCRIPTS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
@@ -9205,12 +9352,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-configDATA uninstall-infDATA uninstall-info-am \
uninstall-initSCRIPTS uninstall-initconfigSCRIPTS \
- uninstall-mibDATA uninstall-nodist_propertyDATA \
- uninstall-perlSCRIPTS uninstall-propertyDATA \
- uninstall-sampledataDATA uninstall-sbinPROGRAMS \
- uninstall-sbinSCRIPTS uninstall-schemaDATA \
- uninstall-serverLTLIBRARIES uninstall-serverpluginLTLIBRARIES \
- uninstall-taskSCRIPTS
+ uninstall-man uninstall-man1 uninstall-man8 uninstall-mibDATA \
+ uninstall-nodist_propertyDATA uninstall-perlSCRIPTS \
+ uninstall-propertyDATA uninstall-sampledataDATA \
+ uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS \
+ uninstall-schemaDATA uninstall-serverLTLIBRARIES \
+ uninstall-serverpluginLTLIBRARIES uninstall-taskSCRIPTS
dirver.h: Makefile
diff --git a/aclocal.m4 b/aclocal.m4
index 9064efa9b..c7c1c6fbc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1578,10 +1578,27 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -4288,6 +4305,9 @@ CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
# Is the compiler the GNU C compiler?
with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -4421,11 +4441,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -4437,7 +4457,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -4517,7 +4537,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -6353,6 +6373,7 @@ do
done
done
done
+IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
@@ -6385,6 +6406,7 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
done
])
SED=$lt_cv_path_SED
+AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
diff --git a/configure b/configure
index a5343d810..efb97ac84 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for dirsrv 1.1.1.
+# Generated by GNU Autoconf 2.59 for dirsrv 1.1.2.
#
# Report bugs to <http://bugzilla.redhat.com/>.
#
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='dirsrv'
PACKAGE_TARNAME='dirsrv'
-PACKAGE_VERSION='1.1.1'
-PACKAGE_STRING='dirsrv 1.1.1'
+PACKAGE_VERSION='1.1.2'
+PACKAGE_STRING='dirsrv 1.1.2'
PACKAGE_BUGREPORT='http://bugzilla.redhat.com/'
# Factoring default headers for most tests.
@@ -465,7 +465,7 @@ ac_includes_default="\
#endif"
ac_default_prefix=/opt/$PACKAGE_NAME
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs BUNDLE_TRUE BUNDLE_FALSE enable_pam_passthru_TRUE enable_pam_passthru_FALSE enable_dna_TRUE enable_dna_FALSE enable_ldapi_TRUE enable_ldapi_FALSE enable_autobind_TRUE enable_autobind_FALSE enable_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir mibdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec initconfigdir HPUX_TRUE HPUX_FALSE SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG PACKAGE_BASE_VERSION nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir sasl_path svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link brand capbrand vendor LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dirsrv 1.1.1 to adapt to many kinds of systems.
+\`configure' configures dirsrv 1.1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1020,7 +1020,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dirsrv 1.1.1:";;
+ short | recursive ) echo "Configuration of dirsrv 1.1.2:";;
esac
cat <<\_ACEOF
@@ -1203,7 +1203,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-dirsrv configure 1.1.1
+dirsrv configure 1.1.2
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1217,7 +1217,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dirsrv $as_me 1.1.1, which was
+It was created by dirsrv $as_me 1.1.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1863,7 +1863,7 @@ fi
# Define the identity of the package.
PACKAGE='dirsrv'
- VERSION='1.1.1'
+ VERSION='1.1.2'
cat >>confdefs.h <<_ACEOF
@@ -3838,6 +3838,7 @@ do
done
done
done
+IFS=$as_save_IFS
lt_ac_max=0
lt_ac_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
@@ -3872,6 +3873,7 @@ done
fi
SED=$lt_cv_path_SED
+
echo "$as_me:$LINENO: result: $SED" >&5
echo "${ECHO_T}$SED" >&6
@@ -4312,7 +4314,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4315 "configure"' > conftest.$ac_ext
+ echo '#line 4317 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5447,7 +5449,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:5450:" \
+echo "$as_me:5452:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6510,11 +6512,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6513: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6515: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6517: \$? = $ac_status" >&5
+ echo "$as_me:6519: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -6778,11 +6780,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6781: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6783: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6785: \$? = $ac_status" >&5
+ echo "$as_me:6787: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -6882,11 +6884,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6885: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6887: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6889: \$? = $ac_status" >&5
+ echo "$as_me:6891: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8347,10 +8349,31 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '#line 8356 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -9227,7 +9250,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9230 "configure"
+#line 9253 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9327,7 +9350,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9330 "configure"
+#line 9353 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9658,6 +9681,9 @@ CC=$lt_compiler
# Is the compiler the GNU C compiler?
with_gcc=$GCC
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -9791,11 +9817,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_predep_objects
+predep_objects=\`echo $lt_predep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_postdep_objects
+postdep_objects=\`echo $lt_postdep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -9807,7 +9833,7 @@ postdeps=$lt_postdeps
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path
+compiler_lib_search_path=\`echo $lt_compiler_lib_search_path | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -9887,7 +9913,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$link_all_deplibs
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -11667,11 +11693,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11670: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11696: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11674: \$? = $ac_status" >&5
+ echo "$as_me:11700: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -11771,11 +11797,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:11774: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11800: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11778: \$? = $ac_status" >&5
+ echo "$as_me:11804: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12303,10 +12329,31 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '#line 12336 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -12690,6 +12737,9 @@ CC=$lt_compiler_CXX
# Is the compiler the GNU C compiler?
with_gcc=$GCC_CXX
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -12823,11 +12873,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_predep_objects_CXX
+predep_objects=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_postdep_objects_CXX
+postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -12839,7 +12889,7 @@ postdeps=$lt_postdeps_CXX
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -12919,7 +12969,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$link_all_deplibs_CXX
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -13341,11 +13391,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13344: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13394: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13348: \$? = $ac_status" >&5
+ echo "$as_me:13398: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13445,11 +13495,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13448: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13498: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13452: \$? = $ac_status" >&5
+ echo "$as_me:13502: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -14890,10 +14940,31 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '#line 14947 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -15277,6 +15348,9 @@ CC=$lt_compiler_F77
# Is the compiler the GNU C compiler?
with_gcc=$GCC_F77
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -15410,11 +15484,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_predep_objects_F77
+predep_objects=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_postdep_objects_F77
+postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -15426,7 +15500,7 @@ postdeps=$lt_postdeps_F77
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_F77
+compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -15506,7 +15580,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$link_all_deplibs_F77
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -15648,11 +15722,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15651: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15725: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15655: \$? = $ac_status" >&5
+ echo "$as_me:15729: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -15916,11 +15990,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:15919: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15993: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15923: \$? = $ac_status" >&5
+ echo "$as_me:15997: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16020,11 +16094,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16023: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16097: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16027: \$? = $ac_status" >&5
+ echo "$as_me:16101: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17485,10 +17559,31 @@ linux*)
# before this can be enabled.
hardcode_into_libs=yes
+ # find out which ABI we are using
+ libsuff=
+ case "$host_cpu" in
+ x86_64*|s390x*|powerpc64*)
+ echo '#line 17566 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *64-bit*)
+ libsuff=64
+ sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+ esac
+
# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra"
fi
# We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -17872,6 +17967,9 @@ CC=$lt_compiler_GCJ
# Is the compiler the GNU C compiler?
with_gcc=$GCC_GCJ
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -18005,11 +18103,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_predep_objects_GCJ
+predep_objects=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_postdep_objects_GCJ
+postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -18021,7 +18119,7 @@ postdeps=$lt_postdeps_GCJ
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -18101,7 +18199,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$link_all_deplibs_GCJ
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -18353,6 +18451,9 @@ CC=$lt_compiler_RC
# Is the compiler the GNU C compiler?
with_gcc=$GCC_RC
+gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\`
+gcc_ver=\`gcc -dumpversion\`
+
# An ERE matcher.
EGREP=$lt_EGREP
@@ -18486,11 +18587,11 @@ striplib=$lt_striplib
# Dependencies to place before the objects being linked to create a
# shared library.
-predep_objects=$lt_predep_objects_RC
+predep_objects=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place after the objects being linked to create a
# shared library.
-postdep_objects=$lt_postdep_objects_RC
+postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Dependencies to place before the objects being linked to create a
# shared library.
@@ -18502,7 +18603,7 @@ postdeps=$lt_postdeps_RC
# The library search path used internally by the compiler when linking
# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Method to check whether dependent libraries are shared objects.
deplibs_check_method=$lt_deplibs_check_method
@@ -18582,7 +18683,7 @@ variables_saved_for_relink="$variables_saved_for_relink"
link_all_deplibs=$link_all_deplibs_RC
# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\`
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
@@ -23126,6 +23227,12 @@ else
perldir=/$PACKAGE_NAME/perl
fi
+# if mandir is the default value, override it
+# otherwise, the user must have set it - just use it
+if test X"$mandir" = X'${prefix}/man' ; then
+ mandir='$(datadir)/man'
+fi
+
# Shared paths for all layouts
# relative to sysconfdir
configdir=/$PACKAGE_NAME/config
@@ -23150,6 +23257,7 @@ defaultgroup=nobody
+
# check for --with-instconfigdir
echo "$as_me:$LINENO: checking for --with-instconfigdir" >&5
echo $ECHO_N "checking for --with-instconfigdir... $ECHO_C" >&6
@@ -25687,7 +25795,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by dirsrv $as_me 1.1.1, which was
+This file was extended by dirsrv $as_me 1.1.2, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25750,7 +25858,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-dirsrv config.status 1.1.1
+dirsrv config.status 1.1.2
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -26003,6 +26111,7 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@CCDEPMODE@,$CCDEPMODE,;t t
s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@SED@,$SED,;t t
s,@EGREP@,$EGREP,;t t
s,@LN_S@,$LN_S,;t t
s,@ECHO@,$ECHO,;t t
diff --git a/configure.ac b/configure.ac
index d37556c89..a6ca01926 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
# This version is the version returned by ns-slapd -v
-AC_INIT([dirsrv], [1.1.1], [http://bugzilla.redhat.com/])
+AC_INIT([dirsrv], [1.1.2], [http://bugzilla.redhat.com/])
# AC_CONFIG_HEADER must be called right after AC_INIT.
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])
@@ -214,6 +214,12 @@ else
perldir=/$PACKAGE_NAME/perl
fi
+# if mandir is the default value, override it
+# otherwise, the user must have set it - just use it
+if test X"$mandir" = X'${prefix}/man' ; then
+ mandir='$(datadir)/man'
+fi
+
# Shared paths for all layouts
# relative to sysconfdir
configdir=/$PACKAGE_NAME/config
@@ -234,6 +240,7 @@ AC_SUBST(scripttemplatedir)
AC_SUBST(perldir)
AC_SUBST(infdir)
AC_SUBST(mibdir)
+AC_SUBST(mandir)
AC_SUBST(defaultuser)
AC_SUBST(defaultgroup)
diff --git a/man/man1/cl-dump.1 b/man/man1/cl-dump.1
new file mode 100644
index 000000000..4cf450b78
--- /dev/null
+++ b/man/man1/cl-dump.1
@@ -0,0 +1,96 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH CL-DUMP 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+cl-dump \- Dump and decode Directory Server replication change log
+.SH SYNOPSIS
+.B cl\-dump
+[\fI-h host\fR] [\fI-p port\fR] [\fI-D bind-dn\fR] -w bind-password | -P bind-cert
+ [\fI-r replica-roots\fR] [\fI-o output-file\fR] [\fI-c\fR] [\fI-v\fR]
+
+.PP
+.B cl\-dump
+\-i changelog\-ldif\-file\-with\-base64encoding [\fI\-o output\-file\fR] [\fI\-c\fR]
+.PP
+.SH DESCRIPTION
+Dump and decode Directory Server replication change log
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below.
+.TP
+.B \-c
+Dump and interpret CSN only. This option can be used with or
+without -i option.
+.TP
+.B \-D bind\-dn
+Directory server's bind DN. Default to "cn=Directory Manager" if
+the option is omitted.
+.TP
+.B \-h host
+Directory server's host. Default to the server where the script
+is running.
+.TP
+.B \-i changelog\-ldif\-file\-with\-base64encoding
+If you already have a ldif-like changelog, but the changes
+in that file are encoded, you may use this option to
+decode that ldif-like changelog.
+.TP
+.B \-o output\-file
+Path name for the final result. Default to STDOUT if omitted.
+.TP
+.B \-p port
+Directory server's port. Default to 389.
+.TP
+.B \-P bind\-cert
+Pathname of binding certificate DB
+.TP
+.B \-r replica\-roots
+Specify replica roots whose changelog you want to dump. The replica
+roots may be seperated by comma. All the replica roots would be
+dumped if the option is omitted.
+.TP
+.B \-v
+Print the version of this script.
+.TP
+.B \-w bind\-password
+Password for the bind DN
+.SH RESTRICTIONS
+If you are not using \-i option, the script should be run when the server
+is running, and from where the server's changelog directory is accessible.
+.br
+.SH SEE ALSO
+.BR repl-monitor (1)
+.br
+.SH AUTHOR
+cl-dump was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/dbgen.pl.1 b/man/man1/dbgen.pl.1
new file mode 100644
index 000000000..49cf8ee9e
--- /dev/null
+++ b/man/man1/dbgen.pl.1
@@ -0,0 +1,84 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH DBGEN.PL 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+dbgen.pl \- Random LDIF database creator
+.SH SYNOPSIS
+.B dbgen.pl
+[\fIOPTIONS\fR] -o output_file -n number
+.SH DESCRIPTION
+Random LDIF database creator. Used to generate large LDIF files
+for use in testing the Directory Server.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-v
+Verbose output
+.TP
+.B \-q
+Quiet output
+.TP
+.B \-s suffix
+LDAP suffix. Default is 'dc=example,dc=com'
+.TP
+.B \-c CN naming style
+Naming style for RDN's. Default is UID
+.TP
+.B \-O organizationalPersons
+Organizationalpersons objectClass. Default is inetOrgPerson.
+.TP
+.B \-p piranha style ACI
+Piranha style aci. Default is barracua
+.TP
+.B \-r seed
+Seed number for random number generator
+.TP
+.B \-g
+Print extra entries for orgchart
+.TP
+.B \-x
+Suppress printing of the preamble
+.TP
+.B \-y
+Suppress printing of Organizational Units
+.TP
+.B \-l
+Location of directory containing data files, default is /usr/share/dirsrv/data
+.TP
+.B \-n number
+Number of entries to be generated
+.br
+.SH AUTHOR
+dbgen.pl was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/dbscan.1 b/man/man1/dbscan.1
new file mode 100644
index 000000000..e23ae273d
--- /dev/null
+++ b/man/man1/dbscan.1
@@ -0,0 +1,106 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH DBSCAN 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+dbscan \- scans a Directory Server database index file and dumps the contents
+.SH SYNOPSIS
+.B dbscan
+\fB-f <filename>\fR [\fI-R\fR] [\fI-t <size>\fR]
+[\fI-K <entry_id>\fR] [\fI-k <key>\fR] [\fI-l <size>\fR]
+[\fI-G <n>\fR] [\fI-n\fR] [\fI-r\fR] [\fI-s\fR]
+.PP
+.SH DESCRIPTION
+Scans a Directory Server database index file and dumps the contents.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \fB\-f\fR <filename>
+specify db file
+.TP
+.B \fB\-R\fR
+dump as raw data
+.TP
+.B \fB\-t\fR <size>
+entry truncate size (bytes)
+.IP
+entry file options:
+.TP
+.B \fB\-K\fR <entry_id>
+lookup only a specific entry id
+index file options:
+.TP
+.B \fB\-k\fR <key>
+lookup only a specific key
+.TP
+.B \fB\-l\fR <size>
+max length of dumped id list
+(default 4096; 40 bytes <= size <= 1048576 bytes)
+.TP
+.B \fB\-G\fR <n>
+only display index entries with more than <n> ids
+.TP
+.B \fB\-n\fR
+display ID list lengths
+.TP
+.B \fB\-r\fR
+display the conents of ID list
+.TP
+.B \fB\-s\fR
+Summary of index counts
+.IP
+.SH USAGE
+Sample usages:
+.TP
+Dump the entry file:
+.B
+dbscan \fB\-f\fR id2entry.db4
+.TP
+Display index keys in cn.db4:
+.B dbscan \fB\-f\fR cn.db4
+.TP
+Display index keys and the count of entries having the key in mail.db4:
+.B
+dbscan \fB\-r\fR \fB\-f\fR mail.db4
+.TP
+Display index keys and the IDs having more than 20 IDs in sn.db4:
+.B
+dbscan \fB\-r\fR \fB\-G\fR 20 \fB\-f\fR sn.db4
+.TP
+Display summary of objectclass.db4:
+.B
+dbscan \fB\-f\fR objectclass.db4
+.br
+.SH AUTHOR
+dbscan was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/dsktune.1 b/man/man1/dsktune.1
new file mode 100644
index 000000000..c3ecb7668
--- /dev/null
+++ b/man/man1/dsktune.1
@@ -0,0 +1,64 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH DSKTUNE 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+dsktune \- reports memory, network, and file system tuning settings
+which can affect the performance of the Directory Server
+.SH SYNOPSIS
+.B dsktune
+[\fI-q\fR] [\fI-c\fR] [\fI-D\fR] [\fI-v\fR] [\fI-i installdir\fR]
+.SH DESCRIPTION
+Reports memory, network, and file system tuning settings
+which can affect the performance of the Directory Server
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \fB\-q\fR
+dsktune only reports essential settings
+.TP
+.B \fB\-c\fR
+dsktune only reports tuning information for client machines
+.TP
+.B \fB\-D\fR
+dsktune also reports the commands executed
+.TP
+.B \fB\-v\fR
+dsktune only reports its release version date
+.TP
+.B \fB\-i installdir\fR
+specify alternate server installation directory
+.br
+.SH AUTHOR
+dsktune was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/infadd.1 b/man/man1/infadd.1
new file mode 100644
index 000000000..4f349bf43
--- /dev/null
+++ b/man/man1/infadd.1
@@ -0,0 +1,82 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH INFADD 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+infadd \- infinite additions to LDAP server
+.SH SYNOPSIS
+.B infadd
+\fI-s suffix -u bindDN -w password \fR[\fIoptions\fR]
+.SH DESCRIPTION
+infadd is used
+to measure performance of the add operation. It can
+span multiple threads in order to test the performance
+under heavy locking.
+.PP
+.SH OPTIONS
+.TP
+.B \-h hostname
+hostname (default: localhost)
+.TP
+.B \-p port
+port (default: 389)
+.TP
+.B \-t threads
+number of threads to spin (default: 1)
+.TP
+.B \-d
+use TCP no\-delay
+.TP
+.B \-q
+quiet mode (no status updates)
+.TP
+.B \-v
+verbose mode (give per\-thread statistics)
+.TP
+.B \-I num
+first uid (default: 0)
+.TP
+.B \-l count
+limit count; stops when the total count exceeds <count>
+.TP
+.B \-i msec
+sample interval in milliseconds (default: 10000)
+.TP
+.B \-R size
+generate <size> random names instead of using data files
+.TP
+.B \-z size
+add binary blob of average size of <size> bytes
+.PP
+.SH SEE ALSO
+.BR rsearch (1)
+.br
+.SH AUTHOR
+infadd was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/ldap-agent.1 b/man/man1/ldap-agent.1
new file mode 100644
index 000000000..cba23d389
--- /dev/null
+++ b/man/man1/ldap-agent.1
@@ -0,0 +1,59 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH LDAP-AGENT 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+ldap-agent \- SNMP agent for Directory Server
+.SH SYNOPSIS
+.B ldap-agent
+.RI [\fI-D\fR] <configuration-file>
+.SH DESCRIPTION
+ldap-agent is an SNMP subagent for Directory Server
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+.TP
+.B \-D
+Enable debugging
+.TP
+.B <configfile>
+Configuration file for the ldap agent
+.SH SEE ALSO
+.BR snmpd(8)
+.br
+.SH USAGE
+Sample usage:
+.TP
+.B ldap-agent /etc/dirsrv/config/ldap-agent.conf
+.br
+.SH AUTHOR
+ldap\-agent was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/ldclt.1 b/man/man1/ldclt.1
new file mode 100644
index 000000000..5aaf501d5
--- /dev/null
+++ b/man/man1/ldclt.1
@@ -0,0 +1,232 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH LDCLT 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+ldclt \- load test program for LDAP
+.SH SYNOPSYS
+.B ldclt
+[\fI\-qQvV\fR] [\fI\-E <max errors>\fR]
+[\fI\-b <base DN>\fR] [\fI\-h <host>\fR] [\fI\-p <port>\fR] [\fI\-t <timeout>\fR]
+[\fI\-D <bind DN>\fR] [\fI\-w <passwd>\fR] [\fI\-o <SASL option>\fR]
+[\fI\-e <execParams>\fR] [\fI\-a <max pending>\fR]
+[\fI\-n <nb threads>\fR] [\fI\-i <nb times>\fR] [\fI\-N <nb samples>\fR]
+[\fI\-I <err number>\fR] [\fI\-T <total>\fR]
+[\fI\-r <low> \-R <high>\fR]
+[\fI\-f <filter>\fR] [\fI\-s <scope>\fR]
+[\fI\-S <slave>\fR] [\fI\-P<master port>\fR]
+[\fI\-W <waitsec>\fR] [\fI\-Z <certfile>\fR]
+.PP
+.SH DESCRIPTION
+This tool is a LDAP client targeted to validate the reliability of
+the product under a wide variety of stress conditions.
+.PP
+.SH OPTIONS
+The valid options are:
+.TP
+.B \fB\-a\fR
+Asynchronous mode, with max pending operations.
+.TP
+.B \fB\-b\fR
+Give the base DN to use. Default "o=sun,c=us".
+.TP
+.B \fB\-D\fR
+Bind DN. See \fB\-w\fR
+.TP
+.B \fB\-E\fR
+Max errors allowed. Default 1000.
+.TP
+.B \fB\-f\fR
+Filter for searches.
+.TP
+.B \fB\-h\fR
+Host to connect. Default "localhost".
+.TP
+.B \fB\-i\fR
+Number of times inactivity allowed. Default 3 (30 seconds)
+.TP
+\fB\-I\fR
+Ignore errors (cf. \fB\-E\fR). Default none.
+.TP
+.B \fB\-n\fR
+Number of threads. Default 10.
+.TP
+.B \fB\-N\fR
+Number of samples (10 seconds each). Default infinite.
+.TP
+.B \fB\-o\fR
+SASL Option.
+.TP
+.B \fB\-p\fR
+Server port. Default 389.
+.TP
+.B \fB\-P\fR
+Master port (to check replication). Default 16000.
+.TP
+.B \fB\-q\fR
+Quiet mode. See option \fB\-I\fR.
+.TP
+.B \fB\-Q\fR
+Super quiet mode.
+.TP
+.B \fB\-r\fR
+Range's low value.
+.TP
+.B \fB\-R\fR
+Range's high value.
+.TP
+.B \fB\-s\fR
+Scope. May be base, subtree or one. Default subtree.
+.TP
+.B \fB\-S\fR
+Slave to check.
+.TP
+.B \fB\-t\fR
+LDAP operations timeout. Default 30 seconds.
+.TP
+.B \fB\-T\fR
+Total number of operations per thread. Default infinite.
+.TP
+.B \fB\-v\fR
+Verbose.
+.TP
+.B \fB\-V\fR
+Very verbose.
+.TP
+.B \fB\-w\fR
+Bind passwd. See \fB\-D\fR.
+.TP
+.B \fB\-W\fR
+Wait between two operations. Default 0 seconds.
+.TP
+.B \fB\-Z\fR
+certfile. Turn on SSL and use certfile as the certificate DB
+.TP
+.B \fB\-e\fR
+Execution parameters:
+.IP
+\fBadd\fR ldap_add() entries.
+.br
+\fBappend\fR entries to the genldif file.
+.br
+\fBascii\fR ascii 7\-bits strings.
+.br
+\fBattreplace=name:mask\fR replace attribute of existing entry.
+.br
+\fBattrlist=name:name:name\fR specify list of attribs to retrieve
+.br
+\fBattrsonly=0|1\fR ldap_search() parameter. Set 0 to read values.
+.br
+\fBbindeach\fR ldap_bind() for each operation.
+.br
+\fBbindonly\fR only bind/unbind, no other operation is performed.
+.br
+\fBclose\fR will close() the fd, rather than ldap_unbind().
+.br
+\fBcltcertname=name\fR name of the SSL client certificate
+.br
+\fBcommoncounter\fR all threads share the same counter.
+.br
+\fBcounteach\fR count each operation not only successful ones.
+.br
+\fBdelete\fR ldap_delete() entries.
+.br
+\fBdontsleeponserverdown\fR will loop very fast if server down.
+.br
+\fBemailPerson\fR objectclass=emailPerson (\fB\-e\fR add only).
+.br
+\fBesearch\fR exact search.
+.br
+\fBgenldif=filename\fR generates a ldif file
+.br
+\fBimagesdir=path\fR specify where are the images.
+.br
+\fBincr\fR incremental values.
+.br
+\fBinetOrgPerson\fR objectclass=inetOrgPerson (\fB\-e\fR add only).
+.br
+\fBkeydbfile=file\fR filename of the key database
+.br
+\fBkeydbpin=password\fR password for accessing the key database
+.br
+\fBnoglobalstats\fR don't print periodical global statistics
+.br
+\fBnoloop\fR does not loop the incremental numbers.
+.br
+\fBobject=filename\fR build object from input file
+.br
+\fBperson\fR objectclass=person (\fB\-e\fR add only).
+.br
+\fBrandom\fR random filters, etc...
+.br
+\fBrandomattrlist=name:name:name\fR random select attrib in the list
+.br
+\fBrandombase\fR random base DN.
+.br
+\fBrandombaselow=value\fR low value for random generator.
+.br
+\fBrandombasehigh=value\fR high value for random generator.
+.br
+\fBrandombinddn\fR random bind DN.
+.br
+\fBrandombinddnfromfile=fine\fR retrieve bind DN & passwd from file
+.br
+\fBrandombinddnlow=value\fR low value for random generator.
+.br
+\fBrandombinddnhigh=value\fR high value for random generator.
+.br
+\fBrdn=attrname:value\fR alternate for \fB\-f\fR.
+.br
+\fBreferral=on|off|rebind\fR change referral behaviour.
+.br
+\fBscalab01\fR activates scalab01 scenario.
+.br
+\fBscalab01_cnxduration\fR maximum connection duration.
+.br
+\fBscalab01_maxcnxnb\fR modem pool size.
+.br
+\fBscalab01_wait\fR sleep() between 2 attempts to connect.
+.br
+\fBsmoothshutdown\fR main thread waits till the worker threads exit.
+.br
+\fBstring\fR create random strings rather than random numbers.
+.br
+\fBv2\fR ldap v2.
+.br
+\fBwithnewparent\fR rename with newparent specified as argument.
+.br
+\fBrandomauthid\fR random SASL Authid.
+.br
+\fBrandomauthidlow=value\fR low value for random SASL Authid.
+.br
+\fBrandomauthidhigh=value\fR high value for random SASL Authid.
+.PP
+.SH AUTHOR
+ldclt was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/ldif.1 b/man/man1/ldif.1
new file mode 100644
index 000000000..183e2438f
--- /dev/null
+++ b/man/man1/ldif.1
@@ -0,0 +1,55 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH LDIF 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+ldif \- manipulates an LDIF stream by adding a column with the
+defined attribute type
+.SH SYNOPSIS
+.B ldif
+[\fI-b\fR] attrtype
+.SH DESCRIPTION
+Manipulates an LDIF stream by adding a column with the
+defined attribute type
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-b
+Output base64 binary format
+.SH USAGE
+.TP
+.B
+ldif dn < /tmp/ldif
+.SH AUTHOR
+ldif was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/logconv.pl.1 b/man/man1/logconv.pl.1
new file mode 100644
index 000000000..378a0f05d
--- /dev/null
+++ b/man/man1/logconv.pl.1
@@ -0,0 +1,118 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH LOGCONV.PL 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+logconv.pl \- analyzes Directory Server access log files
+.SH SYNOPSIS
+.B logconv.pl
+[\fI\-h\fR] [\fI\-d <rootDN>\fR] [\fI\-s <size limit>\fR] [\fI\-v\fR] [\fI\-V\fR]
+[\fI\-S <start time>\fR] [\fI\-E <end time>\fR]
+[\fI\-efcibaltnxgju\fR] [\fI access log ... ... \fR]
+.PP
+.SH DESCRIPTION
+Analyzes Directory Server access log files for specific information defined on the command
+line
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \fB\-h\fR
+help/usage
+.TP
+.B \fB\-d\fR <Directory Managers DN>
+DEFAULT \-> cn=directory manager
+.TP
+.B \fB\-s\fR <Number of results to return per category>
+DEFAULT \-> 20
+.TP
+.B \fB\-X\fR <IP address to exclude from connection stats>
+E.g. Load balancers
+.TP
+.B \fB\-v\fR show version of tool
+Print version of the tool
+.TP
+.B \fB\-S\fR <time to begin analyzing logfile from>
+Time to begin analyzing logile from
+E.g. [28/Mar/2002:13:14:22 \fB\-0800]\fR
+.TP
+.B \fB\-E\fR <time to stop analyzing logfile>
+Time to stop analyzing logile from
+E.g. [28/Mar/2002:13:24:62 \fB\-0800]\fR
+.TP
+\fB\-V\fR <enable verbose output \- includes all stats listed below>
+Verbose output
+.TP
+.B \fB\-[efcibaltnxgju]\fR
+.br
+\fBe\fR Error Code stats
+.br
+\fBf\fR Failed Login Stats
+.br
+\fBc\fR Connection Code Stats
+.br
+\fBi\fR Client Stats
+.br
+\fBb\fR Bind Stats
+.br
+\fBa\fR Search Base Stats
+.br
+\fBl\fR Search Filter Stats
+.br
+\fBt\fR Etime Stats
+.br
+\fBn\fR Nentries Stats
+.br
+\fBx\fR Extended Operations
+.br
+\fBr\fR Most Requested Attribute Stats
+.br
+\fBg\fR Abandoned Operation Stats
+.br
+\fBj\fR Recommendations
+.br
+\fBu\fR Unindexed Search Stats
+.br
+\fBy\fR Connection Latency Stats
+.br
+\fBp\fR Open Connection ID Stats
+.PP
+.SH USAGE
+Examples:
+.IP
+logconv.pl \fB\-s\fR 10 \fB\-V\fR access
+.IP
+logconv.pl \fB\-d\fR "cn=directory manager" /export/server4/slapd\-host/logs/access*
+.IP
+logconv.pl \fB\-s\fR 50 \fB\-ibgju\fR access*
+.IP
+logconv.pl \fB\-S\fR "[28/Mar/2002:13:14:22 \fB\-0800]\fR" \fB\-E\fR "[28/Mar/2002:13:50:05 \fB\-0800]\fR" \fB\-e\fR access
+.br
+.SH AUTHOR
+logconv.pl was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/migratecred.1 b/man/man1/migratecred.1
new file mode 100644
index 000000000..0071b1f1d
--- /dev/null
+++ b/man/man1/migratecred.1
@@ -0,0 +1,65 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH MIGRATECRED 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+migratecred \- Migrate credentials from one instance of Directory Server
+to another
+.SH SYNOPSIS
+.B migratecred
+-o OldInstancePath -n NewInstancePath -c OldCredential [\fI-p NewPluginPath\fR]
+.SH DESCRIPTION
+migratecred migrates credentials from one Directory Server instance to the other.
+
+New plugin path defaults to [\fBlibdir\fP/dirsrv/plugins] if not given
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+\fBmigratecred\fP is a program that migrates credentials used for
+replication and chaining - that is, the password used by the server
+to perform the simple BIND operation for server to server communications.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-o OldInstancePath
+Path to the source instance
+.TP
+.B \-n NewInstancePath
+Path to the destination instance
+.TP
+.B \-c OldCredential
+Old credential
+.TP
+.B \-p NewPluginPath
+New plugin path (of the new instance)
+.br
+.SH AUTHOR
+migratecred was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/mmldif.1 b/man/man1/mmldif.1
new file mode 100644
index 000000000..43a987387
--- /dev/null
+++ b/man/man1/mmldif.1
@@ -0,0 +1,61 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH MMLDIF 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+mmldif \- mmldif util
+.SH SYNOPSIS
+.B mmldif
+[-c] [-D] [-o out.ldif] in1.ldif in2.ldif ...
+
+.SH DESCRIPTION
+This manual page documents briefly the
+.B mmldif
+command.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-c
+Write a change file (.delta) for each input file
+.TP
+.B \-D
+Print debugging information
+.TP
+.B \-o
+Write authoritative data to this file
+.SH SEE ALSO
+.BR ldif (1)
+.br
+.SH AUTHOR
+mmldif was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/pwdhash.1 b/man/man1/pwdhash.1
new file mode 100644
index 000000000..d5c832120
--- /dev/null
+++ b/man/man1/pwdhash.1
@@ -0,0 +1,62 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH PWDHASH 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+pwdhash \- Generator of password hashes
+.SH SYNOPSIS
+.B pwdhash
+[\fI-D config-dir\fR] [\fI-H\fR] [\fI-s scheme | -c comparepwd\fR] password
+.PP
+.SH DESCRIPTION
+Generates password hashes which can also be used in LDIF password fields.
+This uses the Directory Server password generator.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-H
+Show summary of options.
+.TP
+.B \-s scheme
+Password scheme to be used (e.g. MD5, SHA1, SHA256, SHA512,
+SSHA, SSHA256, SSHA512)
+.TP
+.B \-c comparepassword
+Password to be compared against
+.TP
+.B \-D configdir
+Takes the password schema directly from the ns-slapd configuration
+.br
+.SH AUTHOR
+dbscan was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/repl-monitor.1 b/man/man1/repl-monitor.1
new file mode 100644
index 000000000..79ea73d5e
--- /dev/null
+++ b/man/man1/repl-monitor.1
@@ -0,0 +1,69 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH REPL-MONITOR 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+repl-monitor \- Directory Server replication monitor
+.SH SYNOPSIS
+.B repl-monitor
+-f configuration-file [\fI-h host\fR] [\fI-p port\fR] [\fI-r\fR]
+[\fI-u refresh-url\fR] [\fI-t refresh-interval\fR] [\fI-v\fR]
+
+.SH DESCRIPTION
+Outputs the status of all of the configured Directory Servers
+participating in replication. The servers to query for status
+are specified in the configuration file.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-h host
+Hostname of DS server
+.TP
+.B \-p port
+TCP port
+.TP
+.B \-f configuration\-file
+Configuration file
+.TP
+.B \-r
+Removes extra HTML tags
+.TP
+.B \-u refresh\-url
+Refresh url
+.TP
+.B \-t refresh\-interval
+Refresh interval
+.br
+.SH AUTHOR
+repl-monitor was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man1/rsearch.1 b/man/man1/rsearch.1
new file mode 100644
index 000000000..b829be2e0
--- /dev/null
+++ b/man/man1/rsearch.1
@@ -0,0 +1,138 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH RSEARCH 1 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+rsearch \- Stress test an LDAP server with search operations
+.SH SYNOPSIS
+.B rsearch
+\fB\-D\fR binddn \fB\-w\fR bindpw \fB\-s\fR suffix \fB\-f\fR filter [\fIoptions\fR]
+.PP
+.SH DESCRIPTION
+Stress tests an LDAP server with search operations.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-H
+print Usage (this message)
+.TP
+.B \fB\-h\fR host
+ldap server host (default: localhost)
+.TP
+.B \fB\-p\fR port
+ldap server port (default: 389)
+.TP
+.B \fB\-S\fR scope
+search SCOPE [0,1,or 2] (default: 2)
+.TP
+.B \fB\-b\fR
+bind before every operation
+.TP
+.B \fB\-u\fR
+don't unbind \fB\-\-\fR just close the connection
+.TP
+.B \fB\-L\fR
+set linger \fB\-\-\fR connection discarded when closed
+.TP
+.B \fB\-N\fR
+No operation \fB\-\-\fR just bind (ignore mdc)
+.TP
+.B \fB\-v\fR
+verbose
+.TP
+.B \fB\-y\fR
+nodelay
+.TP
+.B \fB\-q\fR
+quiet
+.TP
+.B \fB\-l\fR
+logging
+.TP
+.B \fB\-m\fR
+operaton: modify non\-indexed attr (description). \fB\-B\fR required
+.TP
+.B \fB\-M\fR
+operaton: modify indexed attr (telephonenumber). \fB\-B\fR required
+.TP
+.B \fB\-d\fR
+operaton: delete. \fB\-B\fR required
+.TP
+.B \fB\-c\fR
+operaton: compare. \fB\-B\fR required
+.TP
+.B \fB\-i\fR file
+name file; used for the search filter
+.TP
+.B \fB\-B\fR file
+[DN and] UID file (use '\-B \e?' to see the format)
+.TP
+.B \fB\-A\fR attrs
+list of attributes for search request
+.TP
+.B \fB\-a\fR file
+list of attributes for search request in a file
+.HP
+.B \fB\-\-\fR (use '\-a \e?' to see the format ; \fB\-a\fR & \fB\-A\fR are mutually exclusive)
+.PP
+.TP
+.B \fB\-n\fR number
+(reserved for future use)
+.TP
+.B \fB\-o\fR number
+Search time limit, in seconds; (default: 30; no time limit: 0)
+.TP
+.B \fB\-j\fR number
+sample interval, in seconds (default: 10)
+.TP
+.B \fB\-t\fR number
+threads (default: 1)
+.TP
+.B \fB\-T\fR number
+Time limit, in seconds; cmd stops when exceeds <number>
+.TP
+.B \fB\-V\fR
+show running average
+.TP
+.B \fB\-C\fR num
+take num samples, then stop
+.TP
+.B \fB\-R\fR num
+drop connection & reconnect every num searches
+.TP
+.B \fB\-x\fR
+Use \fB\-B\fR file for binding; ignored if \fB\-B\fR is not given
+.br
+.SH AUTHOR
+rsearch was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man8/migrate-ds.pl.8 b/man/man8/migrate-ds.pl.8
new file mode 100644
index 000000000..b3a53ece7
--- /dev/null
+++ b/man/man8/migrate-ds.pl.8
@@ -0,0 +1,155 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH MIGRATE-DS.PL 8 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+migrate\-ds.pl \- Directory Server Migration script
+.SH SYNOPSIS
+.B migrate\-ds.pl
+[\-\-options] \fB\-\-\fR [args]
+.SH DESCRIPTION
+Directory Server Migration script - migrates Directory Server from
+older releases to the current release.
+.PP
+This script will copy instances (data and configuration) from the old
+server root directory to their new FHS locations. This script does a
+copy only \- the data in the old instances will be left untouched. The
+old instances must be shutdown first to ensure that the databases are
+copied safely. During migration your migrated instances will be started.
+.PP
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \fB\-\-help\fR
+This message
+.TP
+.B \fB\-\-version\fR
+Print the version and exit
+.TP
+.B \fB\-\-debug\fR
+Turn on debugging
+.TP
+.B \fB\-\-oldsroot\fR
+The old server root directory to migrate from
+.TP
+.B \fB\-\-actualsroot\fR This is the old location of the old server root.
+.TP
+.B \fB\-\-silent\fR
+Use silent setup \- no user input
+.TP
+.B \fB\-\-file\fR=\fIname\fR
+Use the file 'name' in .inf format to supply the
+default answers
+.TP
+.B \fB\-\-keepcache\fR
+Do not delete the temporary .inf file generated by
+this program
+.TP
+.B \fB\-\-logfile\fR
+Log migration messages to this file \- otherwise, a temp
+file will be used
+.TP
+.B \fB\-\-instance\fR
+By default, all directory server instances will be
+migrated. You can use this argument to specify one
+or more (e.g. \fB\-i\fR slapd\-foo \fB\-i\fR slapd\-bar) if you do
+not want to migrate all of them.
+.TP
+.B \fB\-\-cross\fR
+See below.
+.PP
+For all options, you can also use the short name e.g. \fB\-h\fR, \fB\-d\fR, etc.
+For the \fB\-d\fR argument, specifying it more than once will increase the
+debug level e.g. \fB\-ddddd\fR
+.PP
+args:
+You can supply default .inf data in this format:
+.IP
+section.param=value
+.PP
+e.g.
+.IP
+General.FullMachineName=foo.example.com
+.PP
+or
+.IP
+"slapd.Suffix=dc=example, dc=com"
+.PP
+Values passed in this manner will override values in an .inf file
+given with the \fB\-f\fR argument.
+.PP
+actualsroot:
+This is used when you must migrate from one machine to another. The
+usual case is that you have mounted the old server root on a different
+root directory, either via a network mount, or by copying a tarball
+made using a relative directory on the source machine to the
+destination machine and untarring it.
+.PP
+For example: machineA is a 32bit machine, and you want to migrate your
+servers to a new 64bit machine. Lets assume your old server root on
+machineA was /opt/myds, and your new machine also wants to use a
+server root of /opt/myds. There are a couple of different ways to
+proceed. Either make a tarball of opt/myds from machineA using a
+relative path (i.e. NOT /opt/myds) or use NFS to mount
+machineA:/opt/myds on a different mount point
+(e.g. machineB:/migration/opt/myds).
+.PP
+If you do this, you should give the old "real" server root (/opt/myds)
+as the \fB\-\-actualsroot\fR argument, and use /migration/opt/myds for the
+\fB\-\-oldsroot\fR argument. That is, the oldsroot is the physical location of
+the files on disk. The actualsroot is the old value of the server root
+on the source machine.
+.PP
+cross:
+Also known as crossplatform, or 'c', or 'x'.
+This is when the source machine is a different architecture than the
+destination machine. In this case, only certain data will be available
+for migration. Changelog information will not be migrated, and replicas
+will need to be reinitialized (if migrating masters or hubs). This type
+of migration requires that all of your old databases have been dumped
+to LDIF format, and the LDIF file must be in the default database directory
+(usually /opt/fedora\-ds/slapd\-instance/db), and the LDIF file must have
+the same name as the database instance directory, with a ".ldif". For
+example, if you have
+.IP
+/opt/fedora\-ds/slapd\-instance/db/userRoot/ and
+/opt/fedora\-ds/slapd\-instance/db/NetscapeRoot/
+.PP
+you must first use db2ldif to export these databases to LDIF e.g.
+.IP
+cd /opt/fedora\-ds/slapd\-instance
+\&./db2ldif \fB\-n\fR userRoot \fB\-a\fR /opt/fedora\-ds/slapd\-instance/db/userRoot.ldif and
+\&./db2ldif \fB\-n\fR NetscapeRoot \fB\-a\fR /opt/fedora\-ds/slapd\-instance/db/NetscapeRoot.ldif
+.PP
+Then you must somehow make your old server root directory available on
+the destination machine, either by creating a tar archive on the source
+and copying it to the destination, or by network mounting the source
+directory on the destination machine.
+.br
+.SH AUTHOR
+migrate-ds.pl was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man8/ns-slapd.8 b/man/man8/ns-slapd.8
new file mode 100644
index 000000000..cf471ea71
--- /dev/null
+++ b/man/man8/ns-slapd.8
@@ -0,0 +1,60 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH NS-SLAPD 8 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+ns-slapd \- The main Directory Server daemon
+.SH SYNOPSIS
+.B ns-slapd
+-D configdir [\fI-d debuglevel\fR] [\fI-i pidlogfile\fR] [\fI-v\fR] [\fI-V\fR]
+.SH DESCRIPTION
+ns-slapd launches the LDAP Directory Server
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \-v
+Show version of program.
+.TP
+.B \-D configdir
+Specifies the configuration directory pointing at the instance
+to be started (e.g. /etc/dirsrv/slapd-localhost)
+.TP
+.B \-d debuglevel
+Specifies the debuglevel to be used
+.TP
+.B \-i pidlogfile
+Specifies file where the pid of the process will be stored
+.br
+.SH AUTHOR
+ns-slapd was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2001 Sun Microsystems, Inc. Used by permission.
+.br
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
diff --git a/man/man8/setup-ds.pl.8 b/man/man8/setup-ds.pl.8
new file mode 100644
index 000000000..62c12bbca
--- /dev/null
+++ b/man/man8/setup-ds.pl.8
@@ -0,0 +1,89 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH SETUP-DS.PL 8 "May 18, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh disable hyphenation
+.\" .hy enable hyphenation
+.\" .ad l left justify
+.\" .ad b justify to both left and right margins
+.\" .nf disable filling
+.\" .fi enable filling
+.\" .br insert line break
+.\" .sp <n> insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+setup\-ds.pl \- Set up an instance of Directory Server
+.SH SYNOPSIS
+.B setup-ds.pl
+[\fI--options\fR] \fI-- \fR[\fIargs\fR]
+.SH DESCRIPTION
+Set up a Directory Server instance. Creates the configuration
+files for an instance of Directory Server based on a few parameters
+like the hostname, port number, and directory manager information.
+Can be run in interactive mode with different levels of verbosity, or
+in silent mode with parameters supplied in a .inf format file or
+on the command line.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
+.\" respectively.
+.SH OPTIONS
+A summary of options is included below:
+.TP
+.B \fB\-\-help\fR
+This message
+.TP
+.B \fB\-\-version\fR
+Print the version and exit
+.TP
+.B \fB\-\-debug\fR
+Turn on debugging
+.TP
+.B \fB\-\-silent\fR
+Use silent setup \- no user input
+.TP
+.B \fB\-\-file\fR=\fIname\fR
+Use the file 'name' in .inf format to supply the default answers
+.TP
+.B \fB\-\-keepcache\fR
+Do not delete the temporary .inf file generated by this program
+.TP
+.B \fB\-\-logfile\fR
+Log setup messages to this file \- otherwise, a temp file will be used
+.PP
+For all options, you can also use the short name e.g. \fB\-h\fR, \fB\-d\fR, etc. For the \fB\-d\fR argument,
+specifying it more than once will increase the debug level e.g. \fB\-ddddd\fR
+.PP
+args:
+You can supply default .inf data in this format:
+.IP
+section.param=value
+.PP
+e.g.
+.IP
+General.FullMachineName=foo.example.com
+.PP
+or
+.IP
+"slapd.Suffix=dc=example, dc=com"
+.PP
+Values passed in this manner will override values in an .inf file given with the \fB\-f\fR argument.
+.br
+.SH AUTHOR
+setup-ds.pl was written by the Fedora Directory Server Project.
+.SH "REPORTING BUGS"
+Report bugs to http://bugzilla.redhat.com.
+.SH COPYRIGHT
+Copyright \(co 2008 Red Hat, Inc.
+.br
+This manual page was written by Michele Baldessari <[email protected]>,
+for the Debian project (but may be used by others).
+.br
+This is free software. You may redistribute copies of it under the terms of
+the Directory Server license found in the LICENSE file of this
+software distribution. This license is essentially the GNU General Public
+License version 2 with an exception for plug-in distribution.
| 0 |
d5c8d88338a3806bd38af793927ac30ec302585f
|
389ds/389-ds-base
|
Resolves: #464854
Summary: ldapsearch with size limit (-z) doesn't work with OR filter and range search
Description:
SIZELIMIT is checked in index_range_read to eliminate the unnecessary data
retrieval. But when the filter contains a range search which is connected by
AND, then we should not do sizelimit. There was a bug in the function which
sets is_and. The flag should have been cleared only when the function set it
to 1. Instead, it was cleared each time the function is called. It let
index_range_read stop reading when it reaches sizelimit even though it should
not have.
|
commit d5c8d88338a3806bd38af793927ac30ec302585f
Author: Noriko Hosoi <[email protected]>
Date: Fri Jan 9 21:33:39 2009 +0000
Resolves: #464854
Summary: ldapsearch with size limit (-z) doesn't work with OR filter and range search
Description:
SIZELIMIT is checked in index_range_read to eliminate the unnecessary data
retrieval. But when the filter contains a range search which is connected by
AND, then we should not do sizelimit. There was a bug in the function which
sets is_and. The flag should have been cleared only when the function set it
to 1. Instead, it was cleared each time the function is called. It let
index_range_read stop reading when it reaches sizelimit even though it should
not have.
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index 42d416259..413d01f40 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -672,9 +672,17 @@ list_candidates(
}
if (ftype == LDAP_FILTER_AND && f_count > 1)
{
- is_and = 1;
+ slapi_pblock_get(pb, SLAPI_SEARCH_IS_AND, &is_and);
+ if (is_and) {
+ /* Outer candidates function already set IS_AND.
+ * So, this function does not touch it. */
+ is_and = 0;
+ } else {
+ /* Outer candidates function hasn't set IS_AND */
+ is_and = 1;
+ slapi_pblock_set(pb, SLAPI_SEARCH_IS_AND, &is_and);
+ }
}
- slapi_pblock_set(pb, SLAPI_SEARCH_IS_AND, &is_and);
if (le_count != 1 || ge_count != 1 || f_count != 2)
{
is_bounded_range = 0;
@@ -789,8 +797,15 @@ list_candidates(
LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
out:
- is_and = 0;
- slapi_pblock_set(pb, SLAPI_SEARCH_IS_AND, &is_and);
+ if (is_and) {
+ /*
+ * Sets IS_AND back to 0 only when this function set 1.
+ * The info of the outer (&...) needs to be passed to the
+ * descendent *_candidates functions called recursively.
+ */
+ is_and = 0;
+ slapi_pblock_set(pb, SLAPI_SEARCH_IS_AND, &is_and);
+ }
slapi_ch_free_string(&tpairs[0]);
slapi_ch_bvfree(&vpairs[0]);
slapi_ch_free_string(&tpairs[1]);
| 0 |
3ca89e3105789dd5fc7d6bdbbcbb1102995c7030
|
389ds/389-ds-base
|
Issue 49731 - undo db_home_dir under /dev/shm/dirsrv for now
Bug Description: There are several issues with using /dec/shm/disrv/
for the db home directory. Cantainers have issues,
and system reboots can cause issues too.
Fix Description: Using just /dev/shm/slapd-INST solves all the permission
issues, but that requires a new selinux label, so
for now we will just set the db home directory to the
database directory (effectively disabling the change).
relates: https://pagure.io/389-ds-base/issue/49731
Reviewed by: firstyear & tbordaz(Thanks!)
|
commit 3ca89e3105789dd5fc7d6bdbbcbb1102995c7030
Author: Mark Reynolds <[email protected]>
Date: Tue Apr 21 14:48:11 2020 -0400
Issue 49731 - undo db_home_dir under /dev/shm/dirsrv for now
Bug Description: There are several issues with using /dec/shm/disrv/
for the db home directory. Cantainers have issues,
and system reboots can cause issues too.
Fix Description: Using just /dev/shm/slapd-INST solves all the permission
issues, but that requires a new selinux label, so
for now we will just set the db home directory to the
database directory (effectively disabling the change).
relates: https://pagure.io/389-ds-base/issue/49731
Reviewed by: firstyear & tbordaz(Thanks!)
diff --git a/ldap/admin/src/defaults.inf.in b/ldap/admin/src/defaults.inf.in
index 23ea09dfa..2f630f9c1 100644
--- a/ldap/admin/src/defaults.inf.in
+++ b/ldap/admin/src/defaults.inf.in
@@ -58,7 +58,7 @@ access_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/access
audit_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/audit
error_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/errors
db_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/db
-db_home_dir = /dev/shm/dirsrv/slapd-{instance_name}
+db_home_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/db
backup_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/bak
ldif_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/ldif
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index e563528a0..b4f31ff87 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -471,7 +471,7 @@ slapi_escape_filter_value(char *filter_str, int len)
void
replace_char(char *str, char c, char c2)
{
- for (size_t i = 0; (str != NULL) && (str[i] != NULL); i++) {
+ for (size_t i = 0; (str != NULL) && (str[i] != '\0'); i++) {
if (c == str[i]) {
str[i] = c2;
}
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index d63373292..b9f85489b 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -431,7 +431,6 @@ popd
mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname}
mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname}
mkdir -p $RPM_BUILD_ROOT/var/lock/%{pkgname}
-mkdir -p $RPM_BUILD_ROOT/dev/shm/%{pkgname}
# for systemd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/%{groupname}.wants
@@ -637,7 +636,6 @@ exit 0
%{_prefix}/lib/sysctl.d/*
%dir %{_localstatedir}/lib/%{pkgname}
%dir %{_localstatedir}/log/%{pkgname}
-%dir /dev/shm/%{pkgname}
%ghost %dir %{_localstatedir}/lock/%{pkgname}
%exclude %{_sbindir}/ldap-agent*
%exclude %{_mandir}/man1/ldap-agent.1.gz
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index bc514c7be..803992275 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -747,7 +747,7 @@ class SetupDs(object):
# Create all the needed paths
# we should only need to make bak_dir, cert_dir, config_dir, db_dir, ldif_dir, lock_dir, log_dir, run_dir?
- for path in ('backup_dir', 'cert_dir', 'db_dir', 'db_home_dir', 'ldif_dir', 'lock_dir', 'log_dir', 'run_dir'):
+ for path in ('backup_dir', 'cert_dir', 'db_dir', 'ldif_dir', 'lock_dir', 'log_dir', 'run_dir'):
self.log.debug("ACTION: creating %s", slapd[path])
try:
os.umask(0o007) # For parent dirs that get created -> sets 770 for perms
@@ -868,7 +868,7 @@ class SetupDs(object):
# Do selinux fixups
if general['selinux']:
selinux_paths = ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
- 'db_home_dir', 'ldif_dir', 'lock_dir', 'log_dir',
+ 'ldif_dir', 'lock_dir', 'log_dir',
'run_dir', 'schema_dir', 'tmp_dir')
for path in selinux_paths:
selinux_restorecon(slapd[path])
| 0 |
ca62e232f4eb03812cf0884e31c8a0ba9016f44d
|
389ds/389-ds-base
|
--macros seems not to work - using --define to define our macro on the command line
|
commit ca62e232f4eb03812cf0884e31c8a0ba9016f44d
Author: Rich Megginson <[email protected]>
Date: Thu Mar 31 23:36:29 2005 +0000
--macros seems not to work - using --define to define our macro on the command line
diff --git a/builddsrpm.sh b/builddsrpm.sh
index b4f74ae1b..0532efc7b 100755
--- a/builddsrpm.sh
+++ b/builddsrpm.sh
@@ -49,11 +49,6 @@ tar cfh - $flavor-ds-$VERSION | gzip > $flavor-ds-$VERSION.tar.gz
rm -rf $flavor-ds-$VERSION
cd $rootdir
-macrosfile=/tmp/macros.$$
-trap "rm -f $macrosfile" 0 1 2 3 15
-
-echo "%_topdir $rootdir" > $macrosfile
-
echo "Executing rpmbuild . . ."
-rpmbuild --macros=$macrosfile -ba $flavor-ds.spec
+rpmbuild --define "_topdir $rootdir" -ba $flavor-ds.spec
echo "Finished doing rpmbuild $flavor-ds.spec"
| 0 |
de38261387552f2a73f05a04a7082d26069750a2
|
389ds/389-ds-base
|
Resolves: #428764
Summary: memory leaks in extensible filter code
Description: applying the patch provided by Ulf Weltman
1) type is not consumed in attrlist_merge
2) although dnattrs is a linked list, only the first item was released.
Test case filter: "(ou:dn:=groups)"
|
commit de38261387552f2a73f05a04a7082d26069750a2
Author: Noriko Hosoi <[email protected]>
Date: Fri Apr 18 20:20:22 2008 +0000
Resolves: #428764
Summary: memory leaks in extensible filter code
Description: applying the patch provided by Ulf Weltman
1) type is not consumed in attrlist_merge
2) although dnattrs is a linked list, only the first item was released.
Test case filter: "(ou:dn:=groups)"
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index 317c4f247..1e7ab8bbd 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -441,6 +441,7 @@ dn2attrs(const char *dn)
bv.bv_len = strlen(val);
bvec[0] = &bv;
attrlist_merge (&dnAttrs, type, bvec);
+ slapi_ch_free_string( &type );
}
}
ldap_value_free (avas);
@@ -505,7 +506,7 @@ test_extensible_filter(
/* B) Also check the DN attributes for the attribute value */
Slapi_Attr* dnattrs= dn2attrs(slapi_entry_get_dn_const(e));
rc= test_ava_filter( callers_pb, e, dnattrs, &a, LDAP_FILTER_EQUALITY, 0 /* Don't Verify Access */ , 0 /* don't just verify access */, access_check_done );
- slapi_attr_free( &dnattrs );
+ attrlist_free( dnattrs );
}
}
else
@@ -520,7 +521,7 @@ test_extensible_filter(
/* D & F) Also check the DN attributes for the attribute value */
Slapi_Attr* dnattrs= dn2attrs(slapi_entry_get_dn_const(e));
mrf->mrf_match (mrf->mrf_object, e, dnattrs);
- slapi_attr_free( &dnattrs );
+ attrlist_free( dnattrs );
}
}
}
@@ -573,7 +574,7 @@ test_extensible_filter(
/* B) Also check the DN attributes for the attribute value */
Slapi_Attr* dnattrs= dn2attrs(slapi_entry_get_dn_const(e));
rc= test_ava_filter( callers_pb, e, dnattrs, &a, LDAP_FILTER_EQUALITY, 0 /* Don't Verify Access */ , 0 /* don't just verify access */, access_check_done );
- slapi_attr_free( &dnattrs );
+ attrlist_free( dnattrs );
}
}
else
@@ -588,7 +589,7 @@ test_extensible_filter(
/* D & F) Also check the DN attributes for the attribute value */
Slapi_Attr* dnattrs= dn2attrs(slapi_entry_get_dn_const(e));
mrf->mrf_match (mrf->mrf_object, e, dnattrs);
- slapi_attr_free( &dnattrs );
+ attrlist_free( dnattrs );
}
}
}
| 0 |
337c6c4965f484e1de020f16e905a9ac4be78590
|
389ds/389-ds-base
|
Fixed the solaris build (log.h); fixed an inappropriate comment
|
commit 337c6c4965f484e1de020f16e905a9ac4be78590
Author: Noriko Hosoi <[email protected]>
Date: Sun Dec 4 01:54:37 2005 +0000
Fixed the solaris build (log.h); fixed an inappropriate comment
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index c5a772e5b..effeae757 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2491,7 +2491,7 @@ log__fix_rotationinfof(char *pathname)
loginfo.log_audit_logchain = NULL;
break;
}
- /* read the directory entries into an ascii sorted avl tree */
+ /* read the directory entries into a linked list */
for (dirent = PR_ReadDir(dirptr, dirflags); dirent ;
dirent = PR_ReadDir(dirptr, dirflags)) {
if (0 == strcmp(log_type, dirent->name)) {
diff --git a/ldap/servers/slapd/log.h b/ldap/servers/slapd/log.h
index 1b40fcc9f..24ec4ab10 100644
--- a/ldap/servers/slapd/log.h
+++ b/ldap/servers/slapd/log.h
@@ -43,8 +43,10 @@
*
*************************************************************************/
#include <stdio.h>
+#ifdef LINUX
#define _XOPEN_SOURCE /* glibc2 needs this */
#define __USE_XOPEN
+#endif
#include <time.h>
#include <stdarg.h>
#include <sys/types.h>
| 0 |
05c0a45f9657a8e5cdaf08747655031347ae0695
|
389ds/389-ds-base
|
Issue 5294: Report Portal 5 is not processing an XML file with (#5358)
Bug Description: Test parameters exceeding 1024 char.
Fix Description: changes made to the wrong line, correction is been made.
Relates: https://github.com/389ds/389-ds-base/issues/5294
Review by: @droideck
|
commit 05c0a45f9657a8e5cdaf08747655031347ae0695
Author: Akshay Adhikari <[email protected]>
Date: Tue Jun 28 23:27:25 2022 +0530
Issue 5294: Report Portal 5 is not processing an XML file with (#5358)
Bug Description: Test parameters exceeding 1024 char.
Fix Description: changes made to the wrong line, correction is been made.
Relates: https://github.com/389ds/389-ds-base/issues/5294
Review by: @droideck
diff --git a/dirsrvtests/tests/suites/filter/large_filter_test.py b/dirsrvtests/tests/suites/filter/large_filter_test.py
index 65bf41bbc..6663c7c0f 100644
--- a/dirsrvtests/tests/suites/filter/large_filter_test.py
+++ b/dirsrvtests/tests/suites/filter/large_filter_test.py
@@ -139,8 +139,8 @@ FILTERS = ['(&(objectClass=person)(|(manager=uid=fmcdonnagh,dc=anuj,dc=com)'
@pytest.mark.bz772777
[email protected]("real_value", FILTERS)
-def test_large_filter(topo, _create_entries, real_value, ids=FILTERS):
[email protected]("real_value", FILTERS, ids=["test_large_filter1", "test_large_filter2"])
+def test_large_filter(topo, _create_entries, real_value):
"""Exercise large eq filter with dn syntax attributes
:id: abe3e6de-9ecc-11e8-adf0-8c16451d917b
| 0 |
b84669f83f6eb14e3e5f12f8ec741957b7ba6a50
|
389ds/389-ds-base
|
Ticket 49421 - Implement password hash upgrade on bind.
Bug Description: As time goes on, password hash mechanisms
change and need to become more resistant to brute force and
other attacks. However long lived, and service passwords do
not change frequently - and in fact, frequent password changes
is a security anti-pattern which is now discouraged.
As a result, it's important to be able to improve the
cryptographic strength and resitance of our passwords for
users as time goes on.
Fix Description: We can implement this because during a bind
operation we have short amount of access to the plaintext
password - we then use that to upgrade the content of the
hash. This builds on Emanuel's proof of concept to improve the
testing of the feature, as well as to avoid updating clear/crypt
due to potential application integrations.
https://pagure.io/389-ds-base/issue/49421
Author: Emanuel Rietveld <https://pagure.io/user/codehotter>
William Brown <[email protected]>
Review by: mreynolds, mhonek (Thanks!)
|
commit b84669f83f6eb14e3e5f12f8ec741957b7ba6a50
Author: William Brown <[email protected]>
Date: Tue Jun 18 15:59:14 2019 +0200
Ticket 49421 - Implement password hash upgrade on bind.
Bug Description: As time goes on, password hash mechanisms
change and need to become more resistant to brute force and
other attacks. However long lived, and service passwords do
not change frequently - and in fact, frequent password changes
is a security anti-pattern which is now discouraged.
As a result, it's important to be able to improve the
cryptographic strength and resitance of our passwords for
users as time goes on.
Fix Description: We can implement this because during a bind
operation we have short amount of access to the plaintext
password - we then use that to upgrade the content of the
hash. This builds on Emanuel's proof of concept to improve the
testing of the feature, as well as to avoid updating clear/crypt
due to potential application integrations.
https://pagure.io/389-ds-base/issue/49421
Author: Emanuel Rietveld <https://pagure.io/user/codehotter>
William Brown <[email protected]>
Review by: mreynolds, mhonek (Thanks!)
diff --git a/dirsrvtests/tests/suites/password/pwd_upgrade_on_bind.py b/dirsrvtests/tests/suites/password/pwd_upgrade_on_bind.py
new file mode 100644
index 000000000..e826e6ecb
--- /dev/null
+++ b/dirsrvtests/tests/suites/password/pwd_upgrade_on_bind.py
@@ -0,0 +1,140 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2019 William Brown <[email protected]>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import ldap
+import pytest
+from lib389.topologies import topology_st
+from lib389.idm.user import UserAccounts
+from lib389._constants import (DEFAULT_SUFFIX, PASSWORD)
+
+def test_password_hash_on_upgrade(topology_st):
+ """If a legacy password hash is present, assert that on a correct bind
+ the hash is "upgraded" to the latest-and-greatest hash format on the
+ server.
+
+ Assert also that password FAILURE does not alter the password.
+
+ :id: 42cf99e6-454d-46f5-8f1c-8bb699864a07
+ :setup: Single instance
+ :steps: 1. Set a password hash in SSHA256, and hash to pbkdf2 statically
+ 2. Test a faulty bind
+ 3. Assert the PW is SSHA256
+ 4. Test a correct bind
+ 5. Assert the PW is PBKDF2
+ :expectedresults:
+ 1. Successfully set the values
+ 2. The bind fails
+ 3. The PW is SSHA256
+ 4. The bind succeeds
+ 5. The PW is PBKDF2
+ """
+ # Make sure the server is set to pkbdf
+ topology_st.standalone.config.set('passwordStorageScheme', 'PBKDF2_SHA256')
+ topology_st.standalone.config.set('nsslapd-allow-hashed-passwords', 'on')
+ topology_st.standalone.config.set('nsslapd-enable-upgrade-hash', 'on')
+
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
+ user = users.create_test_user()
+ # Static version of "password" in SSHA256.
+ user.set('userPassword', "{SSHA256}9eliEQgjfc4Fcj1IXZtc/ne1GRF+OIjz/NfSTX4f7HByGMQrWHLMLA==")
+ # Attempt to bind with incorrect password.
+ with pytest.raises(ldap.INVALID_CREDENTIALS):
+ badconn = user.bind('badpassword')
+ # Check the pw is SSHA256
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('{SSHA256}')
+
+ # Bind with correct.
+ conn = user.bind(PASSWORD)
+ # Check the pw is now PBKDF2!
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('{PBKDF2_SHA256}')
+
+def test_password_hash_on_upgrade_clearcrypt(topology_st):
+ """In some deploymentes, some passwords MAY be in clear or crypt which have
+ specific possible application integrations allowing the read value to be
+ processed by other entities. We avoid upgrading these two, to prevent
+ breaking these integrations.
+
+ :id: 27712492-a4bf-4ea9-977b-b4850ddfb628
+ :setup: Single instance
+ :steps: 1. Set a password hash in CLEAR, and hash to pbkdf2 statically
+ 2. Test a correct bind
+ 3. Assert the PW is CLEAR
+ 4. Set the password to CRYPT
+ 5. Test a correct bind
+ 6. Assert the PW is CLEAR
+ :expectedresults:
+ 1. Successfully set the values
+ 2. The bind succeeds
+ 3. The PW is CLEAR
+ 4. The set succeeds
+ 4. The bind succeeds
+ 5. The PW is CRYPT
+ """
+ # Make sure the server is set to pkbdf
+ topology_st.standalone.config.set('nsslapd-allow-hashed-passwords', 'on')
+ topology_st.standalone.config.set('nsslapd-enable-upgrade-hash', 'on')
+
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
+ user = users.create_test_user(1001)
+
+ topology_st.standalone.config.set('passwordStorageScheme', 'CLEAR')
+ user.set('userPassword', "password")
+ topology_st.standalone.config.set('passwordStorageScheme', 'PBKDF2_SHA256')
+
+ conn = user.bind(PASSWORD)
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('password')
+
+ user.set('userPassword', "{crypt}I0S3Ry62CSoFg")
+ conn = user.bind(PASSWORD)
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('{crypt}')
+
+def test_password_hash_on_upgrade_disable(topology_st):
+ """If a legacy password hash is present, assert that on a correct bind
+ the hash is "upgraded" to the latest-and-greatest hash format on the
+ server. But some people may not like this, so test that we can disable
+ the feature too!
+
+ :id: ed315145-a3d1-4f17-b04c-73d3638e7ade
+ :setup: Single instance
+ :steps: 1. Set a password hash in SSHA256, and hash to pbkdf2 statically
+ 2. Test a faulty bind
+ 3. Assert the PW is SSHA256
+ 4. Test a correct bind
+ 5. Assert the PW is SSHA256
+ :expectedresults:
+ 1. Successfully set the values
+ 2. The bind fails
+ 3. The PW is SSHA256
+ 4. The bind succeeds
+ 5. The PW is SSHA256
+ """
+ # Make sure the server is set to pkbdf
+ topology_st.standalone.config.set('passwordStorageScheme', 'PBKDF2_SHA256')
+ topology_st.standalone.config.set('nsslapd-allow-hashed-passwords', 'on')
+ topology_st.standalone.config.set('nsslapd-enable-upgrade-hash', 'off')
+
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
+ user = users.create_test_user(1002)
+ # Static version of "password" in SSHA256.
+ user.set('userPassword', "{SSHA256}9eliEQgjfc4Fcj1IXZtc/ne1GRF+OIjz/NfSTX4f7HByGMQrWHLMLA==")
+ # Attempt to bind with incorrect password.
+ with pytest.raises(ldap.INVALID_CREDENTIALS):
+ badconn = user.bind('badpassword')
+ # Check the pw is SSHA256
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('{SSHA256}')
+
+ # Bind with correct.
+ conn = user.bind(PASSWORD)
+ # Check the pw is NOT upgraded!
+ up = user.get_attr_val_utf8('userPassword')
+ assert up.startswith('{SSHA256}')
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index d2a89ba4f..1532f367e 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -763,7 +763,13 @@ do_bind(Slapi_PBlock *pb)
}
}
- update_pw_encoding(pb, bind_target_entry, sdn, cred.bv_val);
+ /*
+ * If required, update the pw hash to the "current setting" on bind
+ * if it was successful.
+ */
+ if (config_get_enable_upgrade_hash()) {
+ update_pw_encoding(pb, bind_target_entry, sdn, cred.bv_val);
+ }
bind_credentials_set(pb_conn, authtype,
slapi_ch_strdup(slapi_sdn_get_ndn(sdn)),
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 81df130ce..7131ab029 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -249,6 +249,7 @@ slapi_int_t init_malloc_mmap_threshold;
#endif
slapi_onoff_t init_extract_pem;
slapi_onoff_t init_ignore_vattrs;
+slapi_onoff_t init_enable_upgrade_hash;
static int
isInt(ConfigVarType type)
@@ -1232,8 +1233,11 @@ static struct config_get_and_set
NULL, 0,
(void **)&global_slapdFrontendConfig.tls_check_crl,
CONFIG_SPECIAL_TLS_CHECK_CRL, (ConfigGetFunc)config_get_tls_check_crl,
- "none" /* Allow reset to this value */}
-
+ "none" /* Allow reset to this value */},
+ {CONFIG_ENABLE_UPGRADE_HASH, config_set_enable_upgrade_hash,
+ NULL, 0,
+ (void **)&global_slapdFrontendConfig.enable_upgrade_hash,
+ CONFIG_ON_OFF, (ConfigGetFunc)config_get_enable_upgrade_hash, &init_enable_upgrade_hash}
/* End config */
};
@@ -1751,6 +1755,18 @@ FrontendConfig_init(void)
#endif
init_extract_pem = cfg->extract_pem = LDAP_ON;
+ /*
+ * Default upgrade hash to on - this is an important security step, meaning that old
+ * or legacy hashes are upgraded on bind. It means we are proactive in securing accounts
+ * that may have infrequent on no password changes (which is current best practice in
+ * computer security).
+ *
+ * A risk is that some accounts may use clear/crypt for other application integrations
+ * where the hash is "read" from the account. To avoid this, these two hashes are NEVER
+ * upgraded - in other words, "ON" means only MD5, SHA*, are upgraded to the "current"
+ * scheme set in cn=config
+ */
+ init_enable_upgrade_hash = cfg->enable_upgrade_hash = LDAP_ON;
/* Done, unlock! */
CFG_UNLOCK_WRITE(cfg);
@@ -7589,6 +7605,30 @@ config_set_enable_nunc_stans(const char *attrname, char *value, char *errorbuf,
return retVal;
}
+int32_t
+config_get_enable_upgrade_hash()
+{
+ int32_t retVal;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ CFG_LOCK_READ(slapdFrontendConfig);
+ retVal = slapdFrontendConfig->enable_upgrade_hash;
+ CFG_UNLOCK_READ(slapdFrontendConfig);
+
+ return retVal;
+}
+
+int32_t
+config_set_enable_upgrade_hash(const char *attrname, char *value, char *errorbuf, int32_t apply)
+{
+ int32_t retVal = LDAP_SUCCESS;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+ retVal = config_set_onoff(attrname, value,
+ &(slapdFrontendConfig->enable_upgrade_hash),
+ errorbuf, apply);
+ return retVal;
+}
+
static char *
config_initvalue_to_onoff(struct config_get_and_set *cgas, char *initvalbuf, size_t initvalbufsize)
{
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index b3167b8fb..2fa413609 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -588,6 +588,9 @@ int config_get_malloc_mmap_threshold(void);
int config_get_maxsimplepaged_per_conn(void);
int config_get_extract_pem(void);
+int32_t config_get_enable_upgrade_hash(void);
+int32_t config_set_enable_upgrade_hash(const char *attrname, char *value, char *errorbuf, int apply);
+
int is_abspath(const char *);
char *rel2abspath(char *);
char *rel2abspath_ext(char *, char *);
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index a618b2a52..2d2c985a7 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -661,6 +661,13 @@ update_pw_info(Slapi_PBlock *pb, char *old_pw)
"Param error - no password entry/target dn/operation\n");
return -1;
}
+
+ /* If we have been requested to skip updating this data, check now */
+ if (slapi_operation_is_flag_set(operation, OP_FLAG_ACTION_SKIP_PWDPOLICY)) {
+ /* No action required! */
+ return 0;
+ }
+
internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
target_dn = slapi_sdn_get_ndn(sdn);
pwpolicy = new_passwdPolicy(pb, target_dn);
@@ -3255,7 +3262,7 @@ add_shadow_ext_password_attrs(Slapi_PBlock *pb, Slapi_Entry **e)
* success ( 0 )
* operationsError ( -1 ),
*/
-int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, char *cleartextpassword) {
+int32_t update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, char *cleartextpassword) {
char *dn = (char *)slapi_sdn_get_ndn(sdn);
Slapi_Attr *pw = NULL;
Slapi_Value **password_values = NULL;
@@ -3264,10 +3271,13 @@ int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, cha
Slapi_Mods smods;
char *hashed_val = NULL;
Slapi_PBlock *pb = NULL;
- int res = 0;
+ int32_t res = 0;
slapi_mods_init(&smods, 0);
+ /*
+ * Does the entry have a pw?
+ */
if (e == NULL || slapi_entry_attr_find(e, SLAPI_USERPWD_ATTR, &pw) != 0 || pw == NULL) {
slapi_log_err(SLAPI_LOG_WARNING,
"update_pw_encoding", "Could not read password attribute on '%s'\n",
@@ -3292,6 +3302,9 @@ int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, cha
goto free_and_return;
}
+ /*
+ * Get the current system pw policy.
+ */
pwpolicy = new_passwdPolicy(orig_pb, dn);
if (pwpolicy == NULL || pwpolicy->pw_storagescheme == NULL) {
slapi_log_err(SLAPI_LOG_WARNING,
@@ -3301,11 +3314,26 @@ int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, cha
goto free_and_return;
}
+ /*
+ * If the scheme is the same as current, do nothing!
+ */
curpwsp = pw_val2scheme((char *)slapi_value_get_string(password_values[0]), NULL, 1);
if (curpwsp != NULL && strcmp(curpwsp->pws_name, pwpolicy->pw_storagescheme->pws_name) == 0) {
res = 0; // Nothing to do
goto free_and_return;
}
+ /*
+ * If the scheme is clear or crypt, we also do nothing to prevent breaking some application
+ * integrations. See pwdstorage.h
+ */
+ if (strcmp(curpwsp->pws_name, "CLEAR") == 0 || strcmp(curpwsp->pws_name, "CRYPT") == 0) {
+ res = 0; // Nothing to do
+ goto free_and_return;
+ }
+
+ /*
+ * We are commited to upgrading the hash content now!
+ */
hashed_val = slapi_encode_ext(NULL, NULL, cleartextpassword, pwpolicy->pw_storagescheme->pws_name);
if (hashed_val == NULL) {
@@ -3329,7 +3357,7 @@ int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, cha
NULL, /* UniqueID */
pw_get_componentID(), /* PluginID */
OP_FLAG_SKIP_MODIFIED_ATTRS &
- OP_FLAG_REPLICATED); /* Flags */
+ OP_FLAG_ACTION_SKIP_PWDPOLICY); /* Flags */
slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &res);
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index e691ea9e4..7f3a056f8 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2198,6 +2198,7 @@ typedef struct _slapdEntryPoints
#define CONFIG_MODDN_ACI_ATTRIBUTE "nsslapd-moddn-aci"
#define CONFIG_GLOBAL_BACKEND_LOCK "nsslapd-global-backend-lock"
#define CONFIG_ENABLE_NUNC_STANS "nsslapd-enable-nunc-stans"
+#define CONFIG_ENABLE_UPGRADE_HASH "nsslapd-enable-upgrade-hash"
#define CONFIG_CONFIG_ATTRIBUTE "nsslapd-config"
#define CONFIG_INSTDIR_ATTRIBUTE "nsslapd-instancedir"
#define CONFIG_SCHEMADIR_ATTRIBUTE "nsslapd-schemadir"
@@ -2531,6 +2532,7 @@ typedef struct _slapdFrontendConfig
int malloc_mmap_threshold; /* mallopt M_MMAP_THRESHOLD */
#endif
slapi_onoff_t extract_pem; /* If "on", export key/cert as pem files */
+ slapi_onoff_t enable_upgrade_hash; /* If on, upgrade hashes for PW at bind */
} slapdFrontendConfig_t;
/* possible values for slapdFrontendConfig_t.schemareplace */
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index d26397d19..c54bb981c 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5385,8 +5385,6 @@ int slapi_value_find(void *plugin, struct berval **vals, struct berval *v);
*/
#define SLAPI_USERPWD_ATTR "userpassword"
int slapi_pw_find_sv(Slapi_Value **vals, const Slapi_Value *v);
-int update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, char *cleartextpassword);
-
/* value encoding encoding */
/* checks if the value is encoded with any known algorithm*/
int slapi_is_encoded(char *value);
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 416100268..66493dc40 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -426,6 +426,9 @@ char *slapi_filter_to_string_internal(const struct slapi_filter *f, char *buf, s
#define OP_FLAG_BULK_IMPORT 0x800000 /* operation is bulk import */
#define OP_FLAG_NOOP 0x01000000 /* operation results from urp and
* should be ignored */
+#define OP_FLAG_ACTION_SKIP_PWDPOLICY 0x02000000 /* Skip applying pw policy rules to the password
+ * change operation, as it's from an upgrade on
+ * bind rather than a normal password change */
/* reverse search states */
#define REV_STARTED 1
@@ -803,6 +806,9 @@ void task_cleanup(void);
int pw_rever_encode(Slapi_Value **vals, char *attr_name);
int pw_rever_decode(char *cipher, char **plain, const char *attr_name);
+int32_t update_pw_encoding(Slapi_PBlock *orig_pb, Slapi_Entry *e, Slapi_DN *sdn, char *cleartextpassword);
+
+
/* config routines */
int slapi_config_get_readonly(void);
| 0 |
42221a161fd0b288b0d7be2d95e940660e015dbe
|
389ds/389-ds-base
|
Ticket 47541 - Replication of the schema may overwrite consumer 'attributetypes' even
if consumer definition is a superset
Bug Description: Need to check consumer attributetypes to make sure it doesn't get
overwritten if it is a superset.
Fix Description: First, extended the attribute syntax struct to make it a double
linked list. This allows us to easily look through all the attributeTypes.
Then check for supersets by looking at single vs multi-valued, and
syntax oid's. Matching rules are not being evalauated at this time.
https://fedorahosted.org/389/ticket/47541
Reveiwed by: rmeggins(Thanks!)
|
commit 42221a161fd0b288b0d7be2d95e940660e015dbe
Author: Mark Reynolds <[email protected]>
Date: Thu Nov 7 12:41:41 2013 -0500
Ticket 47541 - Replication of the schema may overwrite consumer 'attributetypes' even
if consumer definition is a superset
Bug Description: Need to check consumer attributetypes to make sure it doesn't get
overwritten if it is a superset.
Fix Description: First, extended the attribute syntax struct to make it a double
linked list. This allows us to easily look through all the attributeTypes.
Then check for supersets by looking at single vs multi-valued, and
syntax oid's. Matching rules are not being evalauated at this time.
https://fedorahosted.org/389/ticket/47541
Reveiwed by: rmeggins(Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index 4bd14a8c3..0e49b9459 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -98,7 +98,7 @@ typedef struct repl_connection
/*** from proto-slap.h ***/
int schema_objectclasses_superset_check(struct berval **remote_schema, char *type);
-
+int schema_attributetypes_superset_check(struct berval **remote_schema, char *type);
/* Controls we add on every outbound operation */
static LDAPControl manageDSAITControl = {LDAP_CONTROL_MANAGEDSAIT, {0, ""}, '\0'};
@@ -1579,33 +1579,57 @@ conn_push_schema(Repl_Connection *conn, CSN **remotecsn)
/* Need to free the remote_schema_csn_bervals */
ber_bvecfree(remote_schema_csn_bervals);
}
- if (return_value != CONN_SCHEMA_NO_UPDATE_NEEDED) {
- struct berval **remote_schema_objectclasses_bervals;
- /* before pushing the schema do some checking */
-
- /* First objectclasses */
- return_value = conn_read_entry_attribute(conn, "cn=schema", "objectclasses", &remote_schema_objectclasses_bervals);
- if (return_value == CONN_OPERATION_SUCCESS) {
- /* Check if the consumer objectclasses are a superset of the local supplier schema */
- if (schema_objectclasses_superset_check(remote_schema_objectclasses_bervals, OC_SUPPLIER)) {
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "Schema %s must not be overwritten (set replication log for additional info)\n",
- agmt_get_long_name(conn->agmt));
- return_value = CONN_OPERATION_FAILED;
- }
- } else {
- slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
- "%s: Fail to retrieve the remote schema objectclasses\n",
- agmt_get_long_name(conn->agmt));
- }
-
- /* In case of success, possibly log a message */
- if (return_value == CONN_OPERATION_SUCCESS) {
- slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
- "Schema checking successful: ok to push the schema (%s)\n", agmt_get_long_name(conn->agmt));
- }
- }
-
+ if (return_value != CONN_SCHEMA_NO_UPDATE_NEEDED) {
+ struct berval **remote_schema_objectclasses_bervals = NULL;
+ struct berval **remote_schema_attributetypes_bervals = NULL;
+ /* before pushing the schema do some checking */
+
+ /* First objectclasses */
+ return_value = conn_read_entry_attribute(conn, "cn=schema", "objectclasses",
+ &remote_schema_objectclasses_bervals);
+ if (return_value == CONN_OPERATION_SUCCESS) {
+ /* Check if the consumer objectclasses are a superset of the local supplier schema */
+ if (schema_objectclasses_superset_check(remote_schema_objectclasses_bervals, OC_SUPPLIER)) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Schema %s must not be overwritten (set replication log for additional info)\n",
+ agmt_get_long_name(conn->agmt));
+ return_value = CONN_OPERATION_FAILED;
+ }
+ if(remote_schema_objectclasses_bervals){
+ ber_bvecfree(remote_schema_objectclasses_bervals);
+ }
+ } else {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Fail to retrieve the remote schema objectclasses\n",
+ agmt_get_long_name(conn->agmt));
+ }
+ if (return_value == CONN_OPERATION_SUCCESS) {
+ /* Next attribute types */
+ return_value = conn_read_entry_attribute(conn, "cn=schema", "attributetypes",
+ &remote_schema_attributetypes_bervals);
+ if (return_value == CONN_OPERATION_SUCCESS) {
+ /* Check if the consumer attributes are a superset of the local supplier schema */
+ if (schema_attributetypes_superset_check(remote_schema_attributetypes_bervals, OC_SUPPLIER)) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "Schema %s must not be overwritten (set replication log for additional info)\n",
+ agmt_get_long_name(conn->agmt));
+ return_value = CONN_OPERATION_FAILED;
+ }
+ if(remote_schema_attributetypes_bervals){
+ ber_bvecfree(remote_schema_attributetypes_bervals);
+ }
+ } else {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+ "%s: Fail to retrieve the remote schema attribute types\n",
+ agmt_get_long_name(conn->agmt));
+ }
+ }
+ /* In case of success, possibly log a message */
+ if (return_value == CONN_OPERATION_SUCCESS) {
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "Schema checking successful: ok to push the schema (%s)\n", agmt_get_long_name(conn->agmt));
+ }
+ }
}
}
}
diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c
index 6386fbee1..885d02a7e 100644
--- a/ldap/servers/slapd/attrsyntax.c
+++ b/ldap/servers/slapd/attrsyntax.c
@@ -58,6 +58,9 @@ static PLHashTable *oid2asi = NULL;
static Slapi_RWLock *oid2asi_lock = NULL;
static PLHashTable *internalasi = NULL;
+/* global attribute linked list */
+static asyntaxinfo *global_at = NULL;
+
/*
* This hashtable maps the name or alias of the attribute to the
* syntax info structure for that attribute. An attribute type has as
@@ -82,12 +85,20 @@ static void attr_syntax_delete_no_lock( struct asyntaxinfo *asip,
PRBool remove_from_oid_table );
static struct asyntaxinfo *attr_syntax_get_by_oid_locking_optional( const
char *oid, PRBool use_lock);
+static void attr_syntax_insert( struct asyntaxinfo *asip );
+static void attr_syntax_remove( struct asyntaxinfo *asip );
#ifdef ATTR_LDAP_DEBUG
static void attr_syntax_print();
#endif
static int attr_syntax_init(void);
+struct asyntaxinfo *
+attr_syntax_get_global_at()
+{
+ return global_at;
+}
+
void
attr_syntax_read_lock(void)
{
@@ -202,13 +213,14 @@ attr_syntax_free( struct asyntaxinfo *a )
PR_ASSERT( a->asi_refcnt == 0 );
cool_charray_free( a->asi_aliases );
- slapi_ch_free( (void**)&a->asi_name );
- slapi_ch_free( (void **)&a->asi_desc );
- slapi_ch_free( (void **)&a->asi_oid );
- slapi_ch_free( (void **)&a->asi_superior );
- slapi_ch_free( (void **)&a->asi_mr_equality );
- slapi_ch_free( (void **)&a->asi_mr_ordering );
- slapi_ch_free( (void **)&a->asi_mr_substring );
+ slapi_ch_free_string(&a->asi_name );
+ slapi_ch_free_string(&a->asi_desc );
+ slapi_ch_free_string(&a->asi_oid );
+ slapi_ch_free_string(&a->asi_superior );
+ slapi_ch_free_string(&a->asi_mr_equality );
+ slapi_ch_free_string(&a->asi_mr_ordering );
+ slapi_ch_free_string(&a->asi_mr_substring );
+ slapi_ch_free_string(&a->asi_syntax_oid);
schema_free_extensions(a->asi_extensions);
slapi_ch_free( (void **) &a );
}
@@ -380,6 +392,7 @@ attr_syntax_return_locking_optional(struct asyntaxinfo *asi, PRBool use_lock)
}
/* ref count is 0 and it's flagged for
* deletion, so it's safe to free now */
+ attr_syntax_remove(asi);
attr_syntax_free(asi);
if(use_lock) {
AS_UNLOCK_WRITE(name2asi_lock);
@@ -411,6 +424,9 @@ attr_syntax_add_by_name(struct asyntaxinfo *a, int lock)
AS_LOCK_WRITE(name2asi_lock);
}
+ /* insert the attr into the global linked list */
+ attr_syntax_insert(a);
+
PL_HashTableAdd(name2asi, a->asi_name, a);
if ( a->asi_aliases != NULL ) {
int i;
@@ -475,6 +491,7 @@ attr_syntax_delete_no_lock( struct asyntaxinfo *asi,
* then to call return. The last return will then take care of
* the free. The only way this free would happen here is if
* you return the syntax before calling delete. */
+ attr_syntax_remove(asi);
attr_syntax_free(asi);
}
}
@@ -764,10 +781,46 @@ attr_syntax_dup( struct asyntaxinfo *a )
newas->asi_mr_eq_plugin = a->asi_mr_eq_plugin;
newas->asi_mr_ord_plugin = a->asi_mr_ord_plugin;
newas->asi_mr_sub_plugin = a->asi_mr_sub_plugin;
+ newas->asi_syntax_oid = slapi_ch_strdup(a->asi_syntax_oid);
+ newas->asi_next = NULL;
+ newas->asi_prev = NULL;
return( newas );
}
+static void
+attr_syntax_insert(struct asyntaxinfo *asip )
+{
+ /* Insert at top of list */
+ asip->asi_prev = NULL;
+ asip->asi_next = global_at;
+ if(global_at){
+ global_at->asi_prev = asip;
+ global_at = asip;
+ } else {
+ global_at = asip;
+ }
+}
+
+static void
+attr_syntax_remove(struct asyntaxinfo *asip )
+{
+ struct asyntaxinfo *prev, *next;
+
+ prev = asip->asi_prev;
+ next = asip->asi_next;
+ if(prev){
+ prev->asi_next = next;
+ if(next){
+ next->asi_prev = prev;
+ }
+ } else {
+ if(next){
+ next->asi_prev = NULL;
+ }
+ global_at = next;
+ }
+}
/*
* Add a new attribute type to the schema.
@@ -918,6 +971,7 @@ attr_syntax_create(
a.asi_mr_substring = (char*)mr_substring;
a.asi_extensions = extensions;
a.asi_plugin = plugin_syntax_find( attr_syntax );
+ a.asi_syntax_oid = (char *)attr_syntax ;
a.asi_syntaxlength = syntaxlength;
/* ideally, we would report an error and fail to start if there was some problem
with the matching rule - but since this functionality is new, and we might
@@ -1503,3 +1557,21 @@ slapi_reload_internal_attr_syntax()
attr_syntax_enumerate_attrs_ext(internalasi, attr_syntax_internal_asi_add, NULL);
return rc;
}
+
+/*
+ * See if the attribute at1 is in the list of at2. Change by name, and oid(if necessary).
+ */
+struct asyntaxinfo *
+attr_syntax_find(struct asyntaxinfo *at1, struct asyntaxinfo *at2)
+{
+ struct asyntaxinfo *asi;
+
+ for(asi = at2; asi != NULL; asi = asi->asi_next){
+ if(strcasecmp(at1->asi_name, asi->asi_name) == 0 || strcmp(at1->asi_oid, asi->asi_oid) == 0){
+ /* found it */
+ return asi;
+ }
+ }
+
+ return NULL;
+}
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index a2908d6ec..944876cbb 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -2031,7 +2031,6 @@ slapi_log_error_ext(int severity, char *subsystem, char *fmt, va_list varg1, va_
int
slapi_is_loglevel_set ( const int loglevel )
{
-
return (
#ifdef _WIN32
*module_ldap_debug
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 6539f9582..9487bf70d 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -136,6 +136,8 @@ struct asyntaxinfo *attr_syntax_get_by_oid ( const char *oid );
struct asyntaxinfo *attr_syntax_get_by_name ( const char *name );
struct asyntaxinfo *attr_syntax_get_by_name_with_default ( const char *name );
struct asyntaxinfo *attr_syntax_get_by_name_locking_optional ( const char *name, PRBool use_lock );
+struct asyntaxinfo *attr_syntax_get_global_at();
+struct asyntaxinfo *attr_syntax_find(struct asyntaxinfo *at1, struct asyntaxinfo *at2);
/*
* Call attr_syntax_return() when you are done using a value returned
* by attr_syntax_get_by_oid() or attr_syntax_get_by_name().
@@ -1002,6 +1004,7 @@ int slapi_reload_schema_files(char *schemadir);
void schema_free_extensions(schemaext *extensions);
schemaext *schema_copy_extensions(schemaext *extensions);
int schema_objectclasses_superset_check(struct berval **remote_schema, char *type);
+int schema_attributypes_superset_check(struct berval **remote_schema, char *type);
/*
* schemaparse.c
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 6fdb99fa2..1e677c974 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -145,6 +145,9 @@ static void schema_create_errormsg( char *errorbuf, size_t errorbufsize,
#else
;
#endif
+static int schema_at_superset_check(struct asyntaxinfo *at_list1, struct asyntaxinfo *at_list2, char *message);
+static int schema_at_superset_check_syntax_oids(char *oid1, char *oid2);
+static int schema_at_superset_check_mr(struct asyntaxinfo *a1, struct asyntaxinfo *a2, char *info);
static int parse_at_str(const char *input, struct asyntaxinfo **asipp, char *errorbuf, size_t errorbufsize,
PRUint32 schema_flags, int is_user_defined, int schema_ds4x_compat, int is_remote);
static int extension_is_user_defined( schemaext *extensions );
@@ -1889,13 +1892,34 @@ modify_schema_dse (Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry *entr
rc = SLAPI_DSE_CALLBACK_ERROR;
} else {
if (strcasecmp (mods[i]->mod_type, "attributetypes") == 0) {
- /*
- * Replace all attribute types
- */
- *returncode = schema_replace_attributes( pb, mods[i], returntext,
- SLAPI_DSE_RETURNTEXT_SIZE );
+ if (is_replicated_operation) {
+ /*
+ * before accepting the schema checks if the local consumer schema is not
+ * a superset of the supplier schema
+ */
+ if (schema_attributetypes_superset_check(mods[i]->mod_bvalues, OC_CONSUMER)) {
+ schema_create_errormsg( returntext, SLAPI_DSE_RETURNTEXT_SIZE,
+ schema_errprefix_generic, mods[i]->mod_type,
+ "Replace is not possible, local consumer schema is a superset of the supplier" );
+ slapi_log_error(SLAPI_LOG_FATAL, "schema",
+ "Local %s must not be overwritten (set replication log for additional info)\n",
+ mods[i]->mod_type);
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
+ } else {
+ /*
+ * Replace all attributes
+ */
+ *returncode = schema_replace_attributes( pb, mods[i], returntext,
+ SLAPI_DSE_RETURNTEXT_SIZE );
+ }
+ } else {
+ /*
+ * Replace all objectclasses
+ */
+ *returncode = schema_replace_attributes( pb, mods[i], returntext,
+ SLAPI_DSE_RETURNTEXT_SIZE );
+ }
} else if (strcasecmp (mods[i]->mod_type, "objectclasses") == 0) {
-
if (is_replicated_operation) {
/* before accepting the schema checks if the local consumer schema is not
* a superset of the supplier schema
@@ -5870,6 +5894,7 @@ static int
schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, char *message) {
struct objclass *oc_1, *oc_2;
char *description;
+ int debug_logging = 0;
int rc, i, j;
int found;
@@ -5882,6 +5907,11 @@ schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, c
/* by default assum oc_list1 == oc_list2 */
rc = 0;
+ /* Are we doing replication logging */
+ if(slapi_is_loglevel_set(SLAPI_LOG_REPL)){
+ debug_logging = 1;
+ }
+
/* Check if all objectclass in oc_list1
* - exists in oc_list2
* - required attributes are also required in oc_2
@@ -5903,8 +5933,12 @@ schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, c
/* The oc_1 objectclasses is supperset */
rc = 1;
-
- continue; /* we continue to check all the objectclass */
+ if(debug_logging){
+ /* we continue to check all the objectclasses so we log what is wrong */
+ continue;
+ } else {
+ break;
+ }
}
/* First check the MUST */
@@ -5933,8 +5967,12 @@ schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, c
/* The oc_1 objectclasses is supperset */
rc = 1;
-
- continue; /* we continue to check all attributes */
+ if(debug_logging){
+ /* we continue to check all attributes so we log what is wrong */
+ continue;
+ } else {
+ break;
+ }
}
}
}
@@ -5963,10 +6001,14 @@ schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, c
oc_1->oc_name,
description);
- /* The oc_1 objectclasses is supperset */
+ /* The oc_1 objectclasses is superset */
rc = 1;
-
- continue; /* we continue to check all attributes */
+ if(debug_logging){
+ /* we continue to check all attributes so we log what is wrong */
+ continue;
+ } else {
+ break;
+ }
}
}
}
@@ -5975,6 +6017,385 @@ schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, c
return rc;
}
+static int
+schema_at_superset_check(struct asyntaxinfo *at_list1, struct asyntaxinfo *at_list2, char *message)
+{
+ struct asyntaxinfo *at_1, *at_2;
+ char *info = NULL;
+ int debug_logging = 0;
+ int found = 0;
+ int rc = 0;
+
+ if(at_list1 == NULL || at_list2 == NULL){
+ return 0;
+ }
+
+ /* Are we doing replication logging */
+ if(slapi_is_loglevel_set(SLAPI_LOG_REPL)){
+ debug_logging = 1;
+ }
+
+ for (at_1 = at_list1; at_1 != NULL; at_1 = at_1->asi_next){
+
+ /* check if at_1 exists in at_list2 */
+ if((at_2 = attr_syntax_find(at_1, at_list2))){
+ /*
+ * Check for single vs. multi value
+ */
+ if(!(at_1->asi_flags & SLAPI_ATTR_FLAG_SINGLE) && (at_2->asi_flags & SLAPI_ATTR_FLAG_SINGLE)){
+ /* at_list 1 is a superset */
+ rc = 1;
+ if(debug_logging){
+ slapi_log_error(SLAPI_LOG_REPL, "schema", "%s schema attribute [%s] is not "
+ "\"single-valued\" \n",message, at_1->asi_name);
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ /*
+ * Check the syntaxes
+ */
+ if(schema_at_superset_check_syntax_oids(at_1->asi_syntax_oid, at_2->asi_syntax_oid)){
+ /* at_list 1 is a superset */
+ rc = 1;
+ if(debug_logging){
+ slapi_log_error(SLAPI_LOG_REPL, "schema", "%s schema attribute [%s] syntax "
+ "can not be overwritten\n",message, at_1->asi_name);
+ continue;
+ } else {
+ break;
+ }
+ }
+ /*
+ * Check some matching rules - not finished yet...
+ *
+ if(schema_at_superset_check_mr(at_1, at_2, info)){
+ rc = 1;
+ if(debug_logging){
+ slapi_log_error(SLAPI_LOG_REPL, "schema", "%s schema attribute [%s] matching "
+ "rule can not be overwritten\n",message, at_1->asi_name);
+ continue;
+ } else {
+ break;
+ }
+ }
+ */
+ } else {
+ rc = 1;
+ if(debug_logging){
+ /* we continue to check all attributes so we log what is wrong */
+ slapi_log_error(SLAPI_LOG_REPL, "schema", "Fail to retrieve in the %s schema [%s or %s]\n",
+ message, at_1->asi_name, at_1->asi_oid);
+ continue;
+ } else {
+ break;
+ }
+ }
+ }
+
+
+ return rc;
+}
+
+/*
+ * Return 1 if a1's matching rules are superset(not to be overwritten). If just one of
+ * the matching rules should not be overwritten, even if one should, we can not allow it.
+ */
+static int
+schema_at_superset_check_mr(struct asyntaxinfo *a1, struct asyntaxinfo *a2, char *info)
+{
+ char *a1_mrtype[3] = { a1->asi_mr_equality, a1->asi_mr_substring, a1->asi_mr_ordering };
+ char *a2_mrtype[3] = { a2->asi_mr_equality, a2->asi_mr_substring, a2->asi_mr_ordering };
+ int rc = 0, i;
+
+ /*
+ * Loop over the three matching rule types
+ */
+ for(i = 0; i < 3; i++){
+ if(a1_mrtype[i]){
+ if(a2_mrtype[i]){
+ /*
+ * Future action item - determine matching rule precedence:
+ *
+ ces
+ "caseExactIA5Match", "1.3.6.1.4.1.1466.109.114.1"
+ "caseExactMatch", "2.5.13.5"
+ "caseExactOrderingMatch", "2.5.13.6"
+ "caseExactSubstringsMatch", "2.5.13.7"
+ "caseExactIA5SubstringsMatch", "2.16.840.1.113730.3.3.1"
+
+ cis
+ "generalizedTimeMatch", "2.5.13.27"
+ "generalizedTimeOrderingMatch", "2.5.13.28"
+ "booleanMatch", "2.5.13.13"
+ "caseIgnoreIA5Match", "1.3.6.1.4.1.1466.109.114.2"
+ "caseIgnoreIA5SubstringsMatch", "1.3.6.1.4.1.1466.109.114.3"
+ "caseIgnoreListMatch", "2.5.13.11"
+ "caseIgnoreListSubstringsMatch", "2.5.13.12"
+ "caseIgnoreMatch", "2.5.13.2" -------------------------------
+ "caseIgnoreOrderingMatch", "2.5.13.3" -----------------------> can have lang options
+ "caseIgnoreSubstringsMatch", "2.5.13.4" --------------------- (as seen in the console)!
+ "directoryStringFirstComponentMatch", "2.5.13.31"
+ "objectIdentifierMatch", "2.5.13.0"
+ "objectIdentifierFirstComponentMatch", "2.5.13.30"
+
+ bitstring
+ "bitStringMatch", "2.5.13.16","2.16.840.1.113730.3.3.1"
+
+ bin
+ "octetStringMatch", "2.5.13.17"
+ "octetStringOrderingMatch", "2.5.13.18"
+
+ DN
+ "distinguishedNameMatch", "2.5.13.1"
+
+ Int
+ "integerMatch", "2.5.13.14"
+ "integerOrderingMatch", "2.5.13.15"
+ "integerFirstComponentMatch", "2.5.13.29"
+
+ NameAndOptUID
+ "uniqueMemberMatch", "2.5.13.23"
+
+ NumericString
+ "numericStringMatch", "2.5.13.8"
+ "numericStringOrderingMatch", "2.5.13.9"
+ "numericStringSubstringsMatch", "2.5.13.10"
+
+ Telephone
+ "telephoneNumberMatch", "2.5.13.20"
+ "telephoneNumberSubstringsMatch", "2.5.13.21"
+ */
+ }
+ }
+ }
+
+ return rc;
+}
+
+/*
+ * Return 1 if oid1 is a superset(oid1 is not to be overwritten)
+ */
+static int
+schema_at_superset_check_syntax_oids(char *oid1, char *oid2)
+{
+ if(oid1 == NULL && oid2 == NULL){
+ return 0;
+ } else if (oid2 == NULL){
+ return 0;
+ } else if (oid1 == NULL){
+ return 1;
+ }
+
+ if(strcmp(oid1, BINARY_SYNTAX_OID) == 0){
+ if(strcmp(oid2, BINARY_SYNTAX_OID) &&
+ strcmp(oid2, INTEGER_SYNTAX_OID) &&
+ strcmp(oid2, NUMERICSTRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, FACSIMILE_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, TELEPHONE_SYNTAX_OID) &&
+ strcmp(oid2, TELETEXTERMID_SYNTAX_OID) &&
+ strcmp(oid2, TELEXNUMBER_SYNTAX_OID))
+
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, BITSTRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, BINARY_SYNTAX_OID) &&
+ strcmp(oid2, BITSTRING_SYNTAX_OID) &&
+ strcmp(oid2, INTEGER_SYNTAX_OID) &&
+ strcmp(oid2, NUMERICSTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID) &&
+ strcmp(oid2, FACSIMILE_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, TELEPHONE_SYNTAX_OID) &&
+ strcmp(oid2, TELETEXTERMID_SYNTAX_OID) &&
+ strcmp(oid2, TELEXNUMBER_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, BOOLEAN_SYNTAX_OID) == 0){
+ if(strcmp(oid2, BOOLEAN_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, COUNTRYSTRING_SYNTAX_OID) ==0){
+ if(strcmp(oid2, COUNTRYSTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, DN_SYNTAX_OID) == 0){
+ if(strcmp(oid2, DN_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) )
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, DELIVERYMETHOD_SYNTAX_OID) ==0){
+ if(strcmp(oid2, DELIVERYMETHOD_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, DIRSTRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID)){
+ return 1;
+ }
+ } else if(strcmp(oid1, ENHANCEDGUIDE_SYNTAX_OID) == 0){
+ if(strcmp(oid2, ENHANCEDGUIDE_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, IA5STRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, IA5STRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, INTEGER_SYNTAX_OID) == 0){
+ if(strcmp(oid2, INTEGER_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, NUMERICSTRING_SYNTAX_OID) &&
+ strcmp(oid2, TELEPHONE_SYNTAX_OID) &&
+ strcmp(oid2, TELETEXTERMID_SYNTAX_OID) &&
+ strcmp(oid2, TELEXNUMBER_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID) )
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, JPEG_SYNTAX_OID) == 0){
+ if(strcmp(oid2, JPEG_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, NAMEANDOPTIONALUID_SYNTAX_OID) == 0){
+ if(strcmp(oid2, NAMEANDOPTIONALUID_SYNTAX_OID) &&
+ strcmp(oid2, NAMEANDOPTIONALUID_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, NUMERICSTRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, NUMERICSTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, OID_SYNTAX_OID) == 0){
+ if(strcmp(oid2, OID_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if (strcmp(oid1, OCTETSTRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, OCTETSTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, POSTALADDRESS_SYNTAX_OID) ==0){
+ if(strcmp(oid2, POSTALADDRESS_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, PRINTABLESTRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, TELEPHONE_SYNTAX_OID) == 0){
+ if(strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, TELEPHONE_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, TELETEXTERMID_SYNTAX_OID) == 0){
+ if(strcmp(oid2, TELETEXTERMID_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if(strcmp(oid1, TELEXNUMBER_SYNTAX_OID) == 0){
+ if(strcmp(oid2, TELEXNUMBER_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ } else if (strcmp(oid1, SPACE_INSENSITIVE_STRING_SYNTAX_OID) == 0){
+ if(strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, PRINTABLESTRING_SYNTAX_OID) &&
+ strcmp(oid2, DIRSTRING_SYNTAX_OID) &&
+ strcmp(oid2, SPACE_INSENSITIVE_STRING_SYNTAX_OID) &&
+ strcmp(oid2, IA5STRING_SYNTAX_OID))
+ {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static void
schema_oclist_free(struct objclass *oc_list)
{
@@ -5986,8 +6407,20 @@ schema_oclist_free(struct objclass *oc_list)
}
}
-static
-struct objclass *schema_berval_to_oclist(struct berval **oc_berval) {
+static void
+schema_atlist_free(struct asyntaxinfo *at_list)
+{
+ struct asyntaxinfo *at, *at_next;
+
+ for (at = at_list; at != NULL; at = at_next) {
+ at_next = at->asi_next;
+ attr_syntax_free(at);
+ }
+}
+
+static struct objclass *
+schema_berval_to_oclist(struct berval **oc_berval)
+{
struct objclass *oc, *oc_list, *oc_tail;
char errorbuf[BUFSIZ];
int schema_ds4x_compat, rc;
@@ -6027,8 +6460,43 @@ struct objclass *schema_berval_to_oclist(struct berval **oc_berval) {
return oc_list;
}
+static struct asyntaxinfo *
+schema_berval_to_atlist(struct berval **at_berval)
+{
+ struct asyntaxinfo *at, *head = NULL, *prev, *at_list = NULL;
+ char errorbuf[BUFSIZ];
+ int schema_ds4x_compat, rc = 0, i;
+
+ schema_ds4x_compat = config_get_ds4_compatible_schema();
+
+ if (at_berval != NULL) {
+ for (i = 0; at_berval[i] != NULL; i++) {
+ /* parse the objectclass value */
+ rc = parse_at_str(at_berval[i]->bv_val, &at, errorbuf, sizeof (errorbuf),
+ DSE_SCHEMA_NO_CHECK | DSE_SCHEMA_USE_PRIV_SCHEMA, 0, schema_ds4x_compat, 0);
+ if(rc){
+ attr_syntax_free(at);
+ break;
+ }
+ if(!head){
+ head = at_list = at;
+ } else {
+ at_list->asi_next = at;
+ at->asi_prev = at_list;
+ at_list = at;
+ }
+ }
+ }
+ if (rc) {
+ schema_atlist_free(head);
+ }
+
+ return head;
+}
+
int
-schema_objectclasses_superset_check(struct berval **remote_schema, char *type) {
+schema_objectclasses_superset_check(struct berval **remote_schema, char *type)
+{
int rc;
struct objclass *remote_oc_list;
@@ -6072,3 +6540,45 @@ schema_objectclasses_superset_check(struct berval **remote_schema, char *type) {
}
return rc;
}
+
+int
+schema_attributetypes_superset_check(struct berval **remote_schema, char *type)
+{
+ struct asyntaxinfo *remote_at_list = NULL;
+ int rc = 0;
+
+ if (remote_schema != NULL) {
+ /* First build an attribute list from the remote schema */
+ if ((remote_at_list = schema_berval_to_atlist(remote_schema)) == NULL) {
+ rc = 1;
+ return rc;
+ }
+
+ /*
+ * Check that for each object from the remote schema
+ * - MUST attributes are also MUST in local schema
+ * - ALLOWED attributes are also ALLOWED in local schema
+ */
+ if (remote_at_list) {
+ attr_syntax_read_lock();
+ if (strcmp(type, OC_SUPPLIER) == 0) {
+ /*
+ * Check if the remote_at_list from a consumer are or not
+ * a superset of the attributetypes of the local supplier schema
+ */
+ rc = schema_at_superset_check(remote_at_list, attr_syntax_get_global_at(), "local supplier" );
+ } else {
+ /*
+ * Check if the attributeypes of the local consumer schema are or not
+ * a superset of the remote_at_list from a supplier
+ */
+ rc = schema_at_superset_check(attr_syntax_get_global_at(), remote_at_list, "remote supplier");
+ }
+ attr_syntax_unlock_read();
+ }
+
+ /* Free the remote schema list */
+ schema_atlist_free(remote_at_list);
+ }
+ return rc;
+}
diff --git a/ldap/servers/slapd/schemaparse.c b/ldap/servers/slapd/schemaparse.c
index eb68f88e4..9636be54e 100644
--- a/ldap/servers/slapd/schemaparse.c
+++ b/ldap/servers/slapd/schemaparse.c
@@ -51,15 +51,11 @@
/* global_oc and global_schema_csn are both protected by oc locks */
struct objclass *global_oc;
CSN *global_schema_csn = NULL; /* Timestamp for last update CSN. NULL = epoch */
+static Slapi_RWLock *oc_lock = NULL;
static int is_duplicate( char *target, char **list, int list_max );
static void normalize_list( char **list );
-
-
-/* R/W lock used to protect the global objclass linked list. */
-static Slapi_RWLock *oc_lock = NULL;
-
/*
* The oc_init_lock_callonce structure is used by NSPR to ensure
* that oc_init_lock() is called at most once.
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index ffee4333f..3513cfd7c 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -517,6 +517,7 @@ typedef struct asyntaxinfo {
char *asi_mr_substring; /* substring matching rule */
schemaext *asi_extensions; /* schema extensions (X-ORIGIN, X-?????, ...) */
struct slapdplugin *asi_plugin; /* syntax */
+ char *asi_syntax_oid; /* syntax oid */
unsigned long asi_flags; /* SLAPI_ATTR_FLAG_... */
int asi_syntaxlength; /* length associated w/syntax */
int asi_refcnt; /* outstanding references */
@@ -524,6 +525,8 @@ typedef struct asyntaxinfo {
struct slapdplugin *asi_mr_eq_plugin; /* EQUALITY matching rule plugin */
struct slapdplugin *asi_mr_sub_plugin; /* SUBSTR matching rule plugin */
struct slapdplugin *asi_mr_ord_plugin; /* ORDERING matching rule plugin */
+ struct asyntaxinfo *asi_next;
+ struct asyntaxinfo *asi_prev;
} asyntaxinfo;
/*
| 0 |
53f921816bde65797f0c7af776c943823c4d002a
|
389ds/389-ds-base
|
Issue 51192 - Add option to reject internal unindexed searches
Bug Description: Some plugins can perform unindexed searches, and under the
right conditions this can cause problems like exhausting DB locks.
The setting "nsslapd-require-index" does not apply to internal
searches, so there is no way to prevent these searches from
occuring.
Fix Description: Add a new database setting "nsslapd-require-internalop-index"
that rejects an internal unindexed searches.
Also found during testing that when the RI plugin fails that
it does not set the proper result error code.
relates: https://pagure.io/389-ds-base/issue/51192
Reviewed by: firstyear, spichugi & tbordaz (Thanks!!!)
|
commit 53f921816bde65797f0c7af776c943823c4d002a
Author: Mark Reynolds <[email protected]>
Date: Mon Jun 29 17:43:07 2020 -0400
Issue 51192 - Add option to reject internal unindexed searches
Bug Description: Some plugins can perform unindexed searches, and under the
right conditions this can cause problems like exhausting DB locks.
The setting "nsslapd-require-index" does not apply to internal
searches, so there is no way to prevent these searches from
occuring.
Fix Description: Add a new database setting "nsslapd-require-internalop-index"
that rejects an internal unindexed searches.
Also found during testing that when the RI plugin fails that
it does not set the proper result error code.
relates: https://pagure.io/389-ds-base/issue/51192
Reviewed by: firstyear, spichugi & tbordaz (Thanks!!!)
diff --git a/dirsrvtests/tests/suites/config/config_test.py b/dirsrvtests/tests/suites/config/config_test.py
index 567059b09..38d1ed9ac 100644
--- a/dirsrvtests/tests/suites/config/config_test.py
+++ b/dirsrvtests/tests/suites/config/config_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2016 Red Hat, Inc.
+# Copyright (C) 2020 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -12,13 +12,15 @@ import pytest
from lib389.tasks import *
from lib389.topologies import topology_m2, topology_st as topo
from lib389.utils import *
-from lib389._constants import DN_CONFIG, DEFAULT_SUFFIX
+from lib389._constants import DN_CONFIG, DEFAULT_SUFFIX, DEFAULT_BENAME
from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
+from lib389.idm.group import Groups
from lib389.backend import *
from lib389.config import LDBMConfig, BDB_LDBMConfig
from lib389.cos import CosPointerDefinitions, CosTemplates
from lib389.backend import Backends
from lib389.monitor import MonitorLDBM
+from lib389.plugins import ReferentialIntegrityPlugin
pytestmark = pytest.mark.tier0
@@ -458,6 +460,97 @@ def test_ndn_cache_enabled(topo):
topo.standalone.config.set('nsslapd-ndn-cache-max-size', 'invalid_value')
+def test_require_index(topo):
+ """Test nsslapd-ignore-virtual-attrs configuration attribute
+
+ :id: fb6e31f2-acc2-4e75-a195-5c356faeb803
+ :setup: Standalone instance
+ :steps:
+ 1. Set "nsslapd-require-index" to "on"
+ 2. Test an unindexed search is rejected
+ :expectedresults:
+ 1. Success
+ 2. Success
+ """
+
+ # Set the config
+ be_insts = Backends(topo.standalone).list()
+ for be in be_insts:
+ if be.get_attr_val_utf8_l('nsslapd-suffix') == DEFAULT_SUFFIX:
+ be.set('nsslapd-require-index', 'on')
+
+ db_cfg = DatabaseConfig(topo.standalone)
+ db_cfg.set([('nsslapd-idlistscanlimit', '100')])
+
+ users = UserAccounts(topo.standalone, DEFAULT_SUFFIX)
+ for i in range(101):
+ users.create_test_user(uid=i)
+
+ # Issue unindexed search,a nd make sure it is rejected
+ raw_objects = DSLdapObjects(topo.standalone, basedn=DEFAULT_SUFFIX)
+ with pytest.raises(ldap.UNWILLING_TO_PERFORM):
+ raw_objects.filter("(description=test*)")
+
+
+
[email protected](ds_is_older('1.4.2'), reason="The config setting only exists in 1.4.2 and higher")
+def test_require_internal_index(topo):
+ """Test nsslapd-ignore-virtual-attrs configuration attribute
+
+ :id: 22b94f30-59e3-4f27-89a1-c4f4be036f7f
+ :setup: Standalone instance
+ :steps:
+ 1. Set "nsslapd-require-internalop-index" to "on"
+ 2. Enable RI plugin, and configure it to use an attribute that is not indexed
+ 3. Create a user and add it a group
+ 4. Deleting user should be rejected as the RI plugin issues an
+ unindexed internal search
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ """
+ # Set the config
+ be_insts = Backends(topo.standalone).list()
+ for be in be_insts:
+ if be.get_attr_val_utf8_l('nsslapd-suffix') == DEFAULT_SUFFIX:
+ be.set('nsslapd-require-index', 'off')
+ be.set('nsslapd-require-internalop-index', 'on')
+
+ # Configure RI plugin
+ rip = ReferentialIntegrityPlugin(topo.standalone)
+ rip.set('referint-membership-attr', 'description')
+ rip.enable()
+
+ # Create a bunch of users
+ db_cfg = DatabaseConfig(topo.standalone)
+ db_cfg.set([('nsslapd-idlistscanlimit', '100')])
+ users = UserAccounts(topo.standalone, DEFAULT_SUFFIX)
+ for i in range(102, 202):
+ users.create_test_user(uid=i)
+
+ # Create user and group
+ user = users.create(properties={
+ 'uid': 'indexuser',
+ 'cn' : 'indexuser',
+ 'sn' : 'user',
+ 'uidNumber' : '1010',
+ 'gidNumber' : '2010',
+ 'homeDirectory' : '/home/indexuser'
+ })
+ groups = Groups(topo.standalone, DEFAULT_SUFFIX)
+ group = groups.create(properties={'cn': 'group',
+ 'member': user.dn})
+
+ # Restart the server
+ topo.standalone.restart()
+
+ # Deletion of user should be rejected
+ with pytest.raises(ldap.UNWILLING_TO_PERFORM):
+ user.delete()
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
index 731997630..eb4b089fb 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -49,7 +49,7 @@ int referint_postop_del(Slapi_PBlock *pb);
int referint_postop_modrdn(Slapi_PBlock *pb);
int referint_postop_start(Slapi_PBlock *pb);
int referint_postop_close(Slapi_PBlock *pb);
-int update_integrity(Slapi_DN *sDN, char *newrDN, Slapi_DN *newsuperior);
+int update_integrity(Slapi_DN *sDN, char *newrDN, Slapi_DN *newsuperior, Slapi_PBlock *pb);
int GetNextLine(char *dest, int size_dest, PRFileDesc *stream);
int my_fgetc(PRFileDesc *stream);
void referint_thread_func(void *arg);
@@ -611,7 +611,7 @@ referint_postop_del(Slapi_PBlock *pb)
} else if (delay == 0) { /* no delay */
/* call function to update references to entry */
if (referint_sdn_in_entry_scope(sdn)) {
- rc = update_integrity(sdn, NULL, NULL);
+ rc = update_integrity(sdn, NULL, NULL, pb);
}
} else {
/* write the entry to integrity log */
@@ -663,7 +663,7 @@ referint_postop_modrdn(Slapi_PBlock *pb)
/* call function to update references to entry */
if (!plugin_EntryScope && !plugin_ExcludeEntryScope) {
/* no scope defined, default always process referint */
- rc = update_integrity(sdn, newrdn, newsuperior);
+ rc = update_integrity(sdn, newrdn, newsuperior, pb);
} else {
const char *newsuperiordn = slapi_sdn_get_dn(newsuperior);
if ((newsuperiordn == NULL && referint_sdn_in_entry_scope(sdn)) ||
@@ -672,10 +672,10 @@ referint_postop_modrdn(Slapi_PBlock *pb)
* It is a modrdn inside the scope or into the scope,
* process normal modrdn
*/
- rc = update_integrity(sdn, newrdn, newsuperior);
+ rc = update_integrity(sdn, newrdn, newsuperior, pb);
} else if (referint_sdn_in_entry_scope(sdn)) {
/* the entry is moved out of scope, treat as delete */
- rc = update_integrity(sdn, NULL, NULL);
+ rc = update_integrity(sdn, NULL, NULL, pb);
}
}
} else {
@@ -1067,7 +1067,8 @@ bail:
int
update_integrity(Slapi_DN *origSDN,
char *newrDN,
- Slapi_DN *newsuperior)
+ Slapi_DN *newsuperior,
+ Slapi_PBlock *pb)
{
Slapi_PBlock *search_result_pb = NULL;
Slapi_PBlock *mod_pb = slapi_pblock_new();
@@ -1181,6 +1182,10 @@ update_integrity(Slapi_DN *origSDN,
* We're using backend transactions,
* so we need to stop on failure.
*/
+ if (pb) {
+ /* Set the error code of the failure */
+ slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
+ }
rc = SLAPI_PLUGIN_FAILURE;
goto free_and_return;
} else {
@@ -1196,8 +1201,11 @@ update_integrity(Slapi_DN *origSDN,
"update_integrity - Search (base=%s filter=%s) returned "
"error %d\n",
search_base, filter, search_result);
- rc = SLAPI_PLUGIN_FAILURE;
slapi_free_search_results_internal(search_result_pb);
+ if (pb) {
+ slapi_pblock_set(pb, SLAPI_RESULT_CODE, &search_result);
+ }
+ rc = SLAPI_PLUGIN_FAILURE;
goto free_and_return;
}
}
@@ -1432,7 +1440,7 @@ referint_thread_func(void *arg __attribute__((unused)))
}
}
- update_integrity(sdn, tmprdn, tmpsuperior);
+ update_integrity(sdn, tmprdn, tmpsuperior, NULL);
slapi_sdn_free(&sdn);
slapi_ch_free_string(&tmprdn);
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 9d78ad778..e325d2518 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -755,6 +755,7 @@ typedef struct ldbm_instance
char *inst_dataversion; /* The user data version tag. Used by replication. */
void *inst_db; /* implementation specific instance data */
int require_index; /* set to 1 to require an index be used in search */
+ int require_internalop_index; /* set to 1 to require an index be used in an internal search */
struct cache inst_dncache; /* The dn cache for this instance. */
} ldbm_instance;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index fdf8f6e7b..58e64799c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -135,6 +135,7 @@ struct config_info
#define CONFIG_INSTANCE_DIR "nsslapd-directory"
#define CONFIG_INSTANCE_REQUIRE_INDEX "nsslapd-require-index"
+#define CONFIG_INSTANCE_REQUIRE_INTERNALOP_INDEX "nsslapd-require-internalop-index"
#define CONFIG_USE_LEGACY_ERRORCODE "nsslapd-do-not-use-vlv-error"
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 628ac905e..36ec11202 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -247,6 +247,14 @@ ldbm_instance_config_require_index_get(void *arg)
return (void *)((uintptr_t)inst->require_index);
}
+static void *
+ldbm_instance_config_require_internalop_index_get(void *arg)
+{
+ ldbm_instance *inst = (ldbm_instance *)arg;
+
+ return (void *)((uintptr_t)inst->require_internalop_index);
+}
+
static int
ldbm_instance_config_readonly_set(void *arg,
void *value,
@@ -299,6 +307,24 @@ ldbm_instance_config_require_index_set(void *arg,
}
+static int
+ldbm_instance_config_require_internalop_index_set(void *arg,
+ void *value,
+ char *errorbuf __attribute__((unused)),
+ int phase __attribute__((unused)),
+ int apply)
+{
+ ldbm_instance *inst = (ldbm_instance *)arg;
+
+ if (!apply) {
+ return LDAP_SUCCESS;
+ }
+
+ inst->require_internalop_index = (int)((uintptr_t)value);
+
+ return LDAP_SUCCESS;
+}
+
/*------------------------------------------------------------------------
* ldbm instance configuration array
*----------------------------------------------------------------------*/
@@ -307,6 +333,7 @@ static config_info ldbm_instance_config[] = {
{CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_UINT64, DEFAULT_CACHE_SIZE_STR, &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},
+ {CONFIG_INSTANCE_REQUIRE_INTERNALOP_INDEX, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_require_internalop_index_get, &ldbm_instance_config_require_internalop_index_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_INSTANCE_DNCACHEMEMSIZE, CONFIG_TYPE_UINT64, DEFAULT_DNCACHE_SIZE_STR, &ldbm_instance_config_dncachememsize_get, &ldbm_instance_config_dncachememsize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{NULL, 0, NULL, NULL, NULL, 0}};
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 723571415..1a7b510d4 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -834,6 +834,7 @@ ldbm_back_search(Slapi_PBlock *pb)
if (NULL != candidates && ALLIDS(candidates)) {
unsigned int opnote;
int ri = 0;
+ int rii = 0;
int pr_idx = -1;
Connection *pb_conn = NULL;
Operation *pb_op = NULL;
@@ -849,23 +850,20 @@ ldbm_back_search(Slapi_PBlock *pb)
int32_t op_nested_count;
/*
- * Return error if nsslapd-require-index is set and
- * this is not an internal operation.
- * We hope the plugins know what they are doing!
+ * Return error if require index is set
*/
- if (!internal_op) {
-
- PR_Lock(inst->inst_config_mutex);
- ri = inst->require_index;
- PR_Unlock(inst->inst_config_mutex);
-
- if (ri) {
- idl_free(&candidates);
- candidates = idl_alloc(0);
- tmp_err = LDAP_UNWILLING_TO_PERFORM;
- tmp_desc = "Search is not indexed";
- }
+ PR_Lock(inst->inst_config_mutex);
+ ri = inst->require_index;
+ rii = inst->require_internalop_index;
+ PR_Unlock(inst->inst_config_mutex);
+
+ if ((internal_op && rii) || (!internal_op && ri)) {
+ idl_free(&candidates);
+ candidates = idl_alloc(0);
+ tmp_err = LDAP_UNWILLING_TO_PERFORM;
+ tmp_desc = "Search is not indexed";
}
+
/*
* When an search is fully unindexed we need to log the
* details as these kinds of searches can cause issues with bdb db
| 0 |
d7876a2acf9eda84b17ed1f164e472825688184a
|
389ds/389-ds-base
|
Ticket #406 - Impossible to rename entry (modrdn) with Attribute Uniqueness plugin enabled
https://fedorahosted.org/389/ticket/406
Resolves: Ticket #406
Bug Description: Impossible to rename entry (modrdn) with Attribute Uniqueness plugin enabled
Reviewed by: mreynolds (Thanks!)
Branch: master
Fix Description: Convert attribute uniqueness to use Slapi_DN* instead of
char *. Also found that op_shared_search was always freeing the passed
in SEARCH_TARGET_SDN, so made that conditional.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 832a52d81b8ccc89e765c8cd2e3be801a11db0f4)
|
commit d7876a2acf9eda84b17ed1f164e472825688184a
Author: Rich Megginson <[email protected]>
Date: Thu Jul 12 19:56:55 2012 -0600
Ticket #406 - Impossible to rename entry (modrdn) with Attribute Uniqueness plugin enabled
https://fedorahosted.org/389/ticket/406
Resolves: Ticket #406
Bug Description: Impossible to rename entry (modrdn) with Attribute Uniqueness plugin enabled
Reviewed by: mreynolds (Thanks!)
Branch: master
Fix Description: Convert attribute uniqueness to use Slapi_DN* instead of
char *. Also found that op_shared_search was always freeing the passed
in SEARCH_TARGET_SDN, so made that conditional.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
(cherry picked from commit 832a52d81b8ccc89e765c8cd2e3be801a11db0f4)
diff --git a/ldap/servers/plugins/uiduniq/plugin-utils.h b/ldap/servers/plugins/uiduniq/plugin-utils.h
index 5cdd95b64..0fe65b3d2 100644
--- a/ldap/servers/plugins/uiduniq/plugin-utils.h
+++ b/ldap/servers/plugins/uiduniq/plugin-utils.h
@@ -86,11 +86,11 @@
#define END } while(0);
int op_error(int internal_error);
-Slapi_PBlock *readPblockAndEntry( const char *baseDN, const char *filter,
+Slapi_PBlock *readPblockAndEntry( Slapi_DN *baseDN, const char *filter,
char *attrs[] );
int entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e,
const char *objectClass);
-Slapi_PBlock *dnHasObjectClass( const char *baseDN, const char *objectClass );
+Slapi_PBlock *dnHasObjectClass( Slapi_DN *baseDN, const char *objectClass );
Slapi_PBlock *dnHasAttribute( const char *baseDN, const char *attrName );
#endif /* _PLUGIN_UTILS_H_ */
diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c
index bc915239b..ebe6b634d 100644
--- a/ldap/servers/plugins/uiduniq/uid.c
+++ b/ldap/servers/plugins/uiduniq/uid.c
@@ -69,8 +69,8 @@ int ldap_quote_filter_value(
int *outLen);
-static int search_one_berval(const char *baseDN, const char *attrName,
- const struct berval *value, const char *requiredObjectClass, const char *target);
+static int search_one_berval(Slapi_DN *baseDN, const char *attrName,
+ const struct berval *value, const char *requiredObjectClass, Slapi_DN *target);
/*
* ISSUES:
@@ -224,16 +224,16 @@ create_filter(const char *attribute, const struct berval *value, const char *req
* LDAP_OPERATIONS_ERROR - a server failure.
*/
static int
-search(const char *baseDN, const char *attrName, Slapi_Attr *attr,
+search(Slapi_DN *baseDN, const char *attrName, Slapi_Attr *attr,
struct berval **values, const char *requiredObjectClass,
- const char *target)
+ Slapi_DN *target)
{
int result;
#ifdef DEBUG
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name,
- "SEARCH baseDN=%s attr=%s target=%s\n", baseDN, attrName,
- target?target:"None");
+ "SEARCH baseDN=%s attr=%s target=%s\n", slapi_sdn_get_dn(baseDN), attrName,
+ target?slapi_sdn_get_dn(target):"None");
#endif
result = LDAP_SUCCESS;
@@ -282,9 +282,9 @@ search(const char *baseDN, const char *attrName, Slapi_Attr *attr,
static int
-search_one_berval(const char *baseDN, const char *attrName,
+search_one_berval(Slapi_DN *baseDN, const char *attrName,
const struct berval *value, const char *requiredObjectClass,
- const char *target)
+ Slapi_DN *target)
{
int result;
char *filter;
@@ -317,7 +317,7 @@ search_one_berval(const char *baseDN, const char *attrName,
spb = slapi_pblock_new();
if (!spb) { result = uid_op_error(2); break; }
- slapi_search_internal_set_pb(spb, baseDN, LDAP_SCOPE_SUBTREE,
+ slapi_search_internal_set_pb_ext(spb, baseDN, LDAP_SCOPE_SUBTREE,
filter, attrs, 0 /* attrs only */, NULL, NULL, plugin_identity, 0 /* actions */);
slapi_search_internal_pb(spb);
@@ -340,18 +340,16 @@ search_one_berval(const char *baseDN, const char *attrName,
*/
for(;*entries;entries++)
{
- char *ndn = slapi_entry_get_ndn(*entries); /* get the normalized dn */
-
#ifdef DEBUG
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name,
- "SEARCH entry dn=%s\n", ndn);
+ "SEARCH entry dn=%s\n", slapi_entry_get_dn(*entries));
#endif
/*
* It is a Constraint Violation if any entry is found, unless
* the entry is the target entry (if any).
*/
- if (!target || strcmp(ndn, target) != 0)
+ if (!target || slapi_sdn_compare(slapi_entry_get_sdn(*entries), target) != 0)
{
result = LDAP_CONSTRAINT_VIOLATION;
break;
@@ -394,7 +392,7 @@ search_one_berval(const char *baseDN, const char *attrName,
static int
searchAllSubtrees(int argc, char *argv[], const char *attrName,
Slapi_Attr *attr, struct berval **values, const char *requiredObjectClass,
- const char *dn)
+ Slapi_DN *dn)
{
int result = LDAP_SUCCESS;
@@ -404,13 +402,17 @@ searchAllSubtrees(int argc, char *argv[], const char *attrName,
*/
for(;argc > 0;argc--,argv++)
{
+ Slapi_DN *sufdn = slapi_sdn_new_dn_byref(*argv);
/*
* The DN should already be normalized, so we don't have to
* worry about that here.
*/
- if (slapi_dn_issuffix(dn, *argv)) {
- result = search(*argv, attrName, attr, values, requiredObjectClass, dn);
+ if (slapi_sdn_issuffix(dn, sufdn)) {
+ result = search(sufdn, attrName, attr, values, requiredObjectClass, dn);
+ slapi_sdn_free(&sufdn);
if (result) break;
+ } else {
+ slapi_sdn_free(&sufdn);
}
}
return result;
@@ -497,27 +499,35 @@ getArguments(Slapi_PBlock *pb, char **attrName, char **markerObjectClass,
* LDAP_OPERATIONS_ERROR - a server failure.
*/
static int
-findSubtreeAndSearch(char *parentDN, const char *attrName, Slapi_Attr *attr,
- struct berval **values, const char *requiredObjectClass, const char *target,
+findSubtreeAndSearch(Slapi_DN *parentDN, const char *attrName, Slapi_Attr *attr,
+ struct berval **values, const char *requiredObjectClass, Slapi_DN *target,
const char *markerObjectClass)
{
int result = LDAP_SUCCESS;
Slapi_PBlock *spb = NULL;
+ Slapi_DN *curpar = slapi_sdn_new();
+ Slapi_DN *newpar = NULL;
- while (NULL != (parentDN = slapi_dn_parent(parentDN)))
+ slapi_sdn_get_parent(parentDN, curpar);
+ while ((curpar != NULL) && (slapi_sdn_get_dn(curpar) != NULL))
{
- if ((spb = dnHasObjectClass(parentDN, markerObjectClass)))
+ if ((spb = dnHasObjectClass(curpar, markerObjectClass)))
{
freePblock(spb);
/*
* Do the search. There is no entry that is allowed
* to have the attribute already.
*/
- result = search(parentDN, attrName, attr, values, requiredObjectClass,
+ result = search(curpar, attrName, attr, values, requiredObjectClass,
target);
break;
}
+ newpar = slapi_sdn_new();
+ slapi_sdn_copy(curpar, newpar);
+ slapi_sdn_get_parent(newpar, curpar);
+ slapi_sdn_free(&newpar);
}
+ slapi_sdn_free(&curpar);
return result;
}
@@ -547,7 +557,6 @@ preop_add(Slapi_PBlock *pb)
int err;
char *markerObjectClass = NULL;
char *requiredObjectClass = NULL;
- const char *dn = NULL;
Slapi_DN *sdn = NULL;
int isupdatedn;
Slapi_Entry *e;
@@ -593,10 +602,8 @@ preop_add(Slapi_PBlock *pb)
err = slapi_pblock_get(pb, SLAPI_ADD_TARGET_SDN, &sdn);
if (err) { result = uid_op_error(51); break; }
- dn = slapi_sdn_get_dn(sdn);
-
#ifdef DEBUG
- slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name, "ADD target=%s\n", dn);
+ slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name, "ADD target=%s\n", slapi_sdn_get_dn(sdn));
#endif
/*
@@ -629,14 +636,14 @@ preop_add(Slapi_PBlock *pb)
if (NULL != markerObjectClass)
{
/* Subtree defined by location of marker object class */
- result = findSubtreeAndSearch((char *)dn, attrName, attr, NULL,
- requiredObjectClass, dn,
+ result = findSubtreeAndSearch(sdn, attrName, attr, NULL,
+ requiredObjectClass, sdn,
markerObjectClass);
} else
{
/* Subtrees listed on invocation line */
result = searchAllSubtrees(argc, argv, attrName, attr, NULL,
- requiredObjectClass, dn);
+ requiredObjectClass, sdn);
}
END
@@ -703,7 +710,6 @@ preop_modify(Slapi_PBlock *pb)
int modcount = 0;
int ii;
LDAPMod *mod;
- const char *dn = NULL;
Slapi_DN *sdn = NULL;
int isupdatedn;
int argc;
@@ -775,12 +781,11 @@ preop_modify(Slapi_PBlock *pb)
err = slapi_pblock_get(pb, SLAPI_MODIFY_TARGET_SDN, &sdn);
if (err) { result = uid_op_error(11); break; }
- dn = slapi_sdn_get_dn(sdn);
/*
* Check if it has the required object class
*/
if (requiredObjectClass &&
- !(spb = dnHasObjectClass(dn, requiredObjectClass))) {
+ !(spb = dnHasObjectClass(sdn, requiredObjectClass))) {
break;
}
@@ -798,14 +803,14 @@ preop_modify(Slapi_PBlock *pb)
if (NULL != markerObjectClass)
{
/* Subtree defined by location of marker object class */
- result = findSubtreeAndSearch((char *)dn, attrName, NULL,
+ result = findSubtreeAndSearch(sdn, attrName, NULL,
mod->mod_bvalues, requiredObjectClass,
- dn, markerObjectClass);
+ sdn, markerObjectClass);
} else
{
/* Subtrees listed on invocation line */
result = searchAllSubtrees(argc, argv, attrName, NULL,
- mod->mod_bvalues, requiredObjectClass, dn);
+ mod->mod_bvalues, requiredObjectClass, sdn);
}
}
END
@@ -947,7 +952,7 @@ preop_modrdn(Slapi_PBlock *pb)
/* Apply the rename operation to the dummy entry. */
/* slapi_entry_rename does not expect rdn normalized */
- err = slapi_entry_rename(e, rdn, deloldrdn, slapi_sdn_get_dn(superior));
+ err = slapi_entry_rename(e, rdn, deloldrdn, superior);
if (err != LDAP_SUCCESS) { result = uid_op_error(36); break; }
/*
@@ -970,14 +975,14 @@ preop_modrdn(Slapi_PBlock *pb)
if (NULL != markerObjectClass)
{
/* Subtree defined by location of marker object class */
- result = findSubtreeAndSearch(slapi_entry_get_dn(e), attrName, attr, NULL,
- requiredObjectClass, dn,
+ result = findSubtreeAndSearch(slapi_entry_get_sdn(e), attrName, attr, NULL,
+ requiredObjectClass, sdn,
markerObjectClass);
} else
{
/* Subtrees listed on invocation line */
result = searchAllSubtrees(argc, argv, attrName, attr, NULL,
- requiredObjectClass, dn);
+ requiredObjectClass, sdn);
}
END
/* Clean-up */
diff --git a/ldap/servers/plugins/uiduniq/utils.c b/ldap/servers/plugins/uiduniq/utils.c
index 49660897b..7b1fd967c 100644
--- a/ldap/servers/plugins/uiduniq/utils.c
+++ b/ldap/servers/plugins/uiduniq/utils.c
@@ -81,7 +81,7 @@ op_error(int internal_error) {
* A pblock containing the entry, or NULL
*/
Slapi_PBlock *
-readPblockAndEntry( const char *baseDN, const char *filter,
+readPblockAndEntry( Slapi_DN *baseDN, const char *filter,
char *attrs[] ) {
Slapi_PBlock *spb = NULL;
@@ -89,7 +89,7 @@ readPblockAndEntry( const char *baseDN, const char *filter,
int sres;
/* Perform the search - the new pblock needs to be freed */
- spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE,
+ spb = slapi_search_internal(slapi_sdn_get_dn(baseDN), LDAP_SCOPE_BASE,
(char *)filter, NULL, attrs, 0);
if ( !spb ) {
op_error(20);
@@ -150,7 +150,7 @@ entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e,
* A pblock containing the entry, or NULL
*/
Slapi_PBlock *
-dnHasObjectClass( const char *baseDN, const char *objectClass ) {
+dnHasObjectClass( Slapi_DN *baseDN, const char *objectClass ) {
char *filter = NULL;
Slapi_PBlock *spb = NULL;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 4f756fa28..97eac2b59 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -1396,10 +1396,6 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
inst = (ldbm_instance *) be->be_instance_info;
- if (NULL == basesdn) {
- basesdn = slapi_sdn_new_normdn_byref(base);
- slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, basesdn);
- }
/* Return to the cache the entry we handed out last time */
/* If we are using the extension, the front end will tell
* us when to do this so we don't do it now */
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 57b7d6e2f..429a74826 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -3177,16 +3177,16 @@ slapi_entry_has_children(const Slapi_Entry *entry)
* Renames an entry to simulate a MODRDN operation
*/
int
-slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const char *newsuperior)
+slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, Slapi_DN *newsuperior)
{
int err = LDAP_SUCCESS;
- char *newdn = NULL;
- char *olddn = NULL;
- Slapi_RDN *oldrdn = NULL;
+ Slapi_DN *olddn = NULL;
Slapi_Mods *smods = NULL;
+ Slapi_DN newsrdn;
LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_entry_rename\n", 0, 0, 0 );
+ slapi_sdn_init(&newsrdn);
/* Check if entry or newrdn are NULL. */
if (!e || !newrdn) {
err = LDAP_PARAM_ERROR;
@@ -3194,7 +3194,7 @@ slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const c
}
/* Get the old DN. */
- olddn = slapi_entry_get_dn(e);
+ olddn = slapi_entry_get_sdn(e);
/* If deleteoldrdn, find old RDN values and remove them from the entry. */
if (deleteoldrdn) {
@@ -3202,8 +3202,7 @@ slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const c
char * val = NULL;
int num_rdns = 0;
int i = 0;
-
- oldrdn = slapi_rdn_new_dn(olddn);
+ Slapi_RDN *oldrdn = slapi_rdn_new_sdn(olddn);
/* Create mods based on the number of rdn elements. */
num_rdns = slapi_rdn_get_num_components(oldrdn);
@@ -3216,6 +3215,7 @@ slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const c
slapi_mods_add(smods, LDAP_MOD_DELETE, type, strlen(val), val);
}
}
+ slapi_rdn_free(&oldrdn);
/* Apply the mods to the entry. */
if ((err = slapi_entry_apply_mods(e, slapi_mods_get_ldapmods_byref(smods))) != LDAP_SUCCESS) {
@@ -3231,29 +3231,32 @@ slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const c
/* Build new DN. If newsuperior is set, just use "newrdn,newsuperior". If
* newsuperior is not set, need to add newrdn to old superior. */
+ slapi_sdn_init_dn_byref(&newsrdn, newrdn);
if (newsuperior) {
- newdn = slapi_create_dn_string("%s,%s", newrdn, newsuperior);
+ slapi_sdn_set_parent(&newsrdn, newsuperior);
} else {
- char *oldsuperior = NULL;
-
- oldsuperior = slapi_dn_parent(olddn);
- newdn = slapi_create_dn_string("%s,%s", newrdn, oldsuperior);
+ Slapi_DN oldparent;
- slapi_ch_free_string(&oldsuperior);
+ slapi_sdn_init(&oldparent);
+ slapi_sdn_get_parent(olddn, &oldparent);
+ slapi_sdn_set_parent(&newsrdn, &oldparent);
+ slapi_sdn_done(&oldparent);
}
/* Set the new DN in the entry. This hands off the memory used by newdn to the entry. */
- slapi_entry_set_normdn(e, newdn);
+ slapi_entry_set_sdn(e, &newsrdn);
/* Set the RDN in the entry. */
- slapi_entry_set_rdn(e, newdn);
+ /* note - there isn't a slapi_entry_set_rdn_from_sdn function */
+ slapi_rdn_done(slapi_entry_get_srdn(e));
+ slapi_rdn_init_all_sdn(slapi_entry_get_srdn(e),&newsrdn);
/* Add RDN values to entry. */
err = slapi_entry_add_rdn_values(e);
done:
- slapi_rdn_free(&oldrdn);
slapi_mods_free(&smods);
+ slapi_sdn_done(&newsrdn);
LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_entry_rename\n", 0, 0, 0 );
return err;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 83d32ce1f..019fe20b0 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -270,6 +270,8 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
void *pr_search_result = NULL;
int pr_reset_processing = 0;
int pr_idx = -1;
+ Slapi_DN *orig_sdn = NULL;
+ int free_sdn = 0;
be_list[0] = NULL;
referral_list[0] = NULL;
@@ -281,6 +283,11 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if (NULL == sdn) {
sdn = slapi_sdn_new_dn_byval(base);
slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, sdn);
+ free_sdn = 1;
+ } else {
+ /* save it so we can restore it later - may have to replace it internally
+ e.g. for onelevel and subtree searches, but need to restore it */
+ orig_sdn = sdn;
}
normbase = slapi_sdn_get_dn(sdn);
@@ -727,10 +734,13 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
int tmp_scope = LDAP_SCOPE_BASE;
slapi_pblock_set(pb, SLAPI_SEARCH_SCOPE, &tmp_scope);
- slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
- slapi_sdn_free(&sdn);
+ if (free_sdn) {
+ slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
+ slapi_sdn_free(&sdn);
+ }
sdn = slapi_sdn_dup(be_suffix);
slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, (void *)sdn);
+ free_sdn = 1;
}
else if (slapi_sdn_issuffix(basesdn, be_suffix))
{
@@ -751,10 +761,13 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
{
if (slapi_sdn_issuffix(be_suffix, basesdn))
{
- slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
- slapi_sdn_free(&sdn);
+ if (free_sdn) {
+ slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
+ slapi_sdn_free(&sdn);
+ }
sdn = slapi_sdn_dup(be_suffix);
slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, (void *)sdn);
+ free_sdn = 1;
}
}
}
@@ -970,11 +983,13 @@ free_and_return:
free_and_return_nolock:
slapi_pblock_set(pb, SLAPI_PLUGIN_OPRETURN, &rc);
index_subsys_filter_decoders_done(pb);
-
- slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
- slapi_sdn_free(&sdn);
+
+ if (free_sdn) {
+ slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
+ slapi_sdn_free(&sdn);
+ }
slapi_sdn_free(&basesdn);
- slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, NULL);
+ slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, orig_sdn);
slapi_ch_free_string(&proxydn);
slapi_ch_free_string(&proxystr);
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 252b626a7..7652306c6 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -2067,7 +2067,7 @@ int slapi_entry_apply_mod(Slapi_Entry *e, LDAPMod *mod);
* \return \c LDAP_SUCCESS if the rename was successful, otherwise an LDAP error
* is returned.
*/
-int slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, const char *newsuperior);
+int slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, Slapi_DN *newsuperior);
/*------------------------
| 0 |
8516b5541140fdfb590bfb1be2996ee58322ecc6
|
389ds/389-ds-base
|
Ticket 47510 - Additional mozldap failures with Repl Sync
Brought over all the Repl Sync openldap #defines.
https://fedorahosted.org/389/ticket/47510
|
commit 8516b5541140fdfb590bfb1be2996ee58322ecc6
Author: Mark Reynolds <[email protected]>
Date: Thu Oct 3 15:36:01 2013 -0400
Ticket 47510 - Additional mozldap failures with Repl Sync
Brought over all the Repl Sync openldap #defines.
https://fedorahosted.org/389/ticket/47510
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index d1333e2c0..1ed92fa34 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -396,6 +396,7 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
#endif
#ifndef LDAP_SYNC_OID
+/* LDAP Content Synchronization Operation -- RFC 4533 */
#define LDAP_SYNC_OID "1.3.6.1.4.1.4203.1.9.1"
#define LDAP_CONTROL_SYNC LDAP_SYNC_OID ".1"
#define LDAP_CONTROL_SYNC_STATE LDAP_SYNC_OID ".2"
@@ -405,6 +406,21 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
#define LDAP_TAG_SYNC_REFRESH_DELETE ((ber_tag_t) 0xa1U)
#define LDAP_TAG_SYNC_REFRESH_PRESENT ((ber_tag_t) 0xa2U)
#define LDAP_TAG_SYNC_ID_SET ((ber_tag_t) 0xa3U)
+#define LDAP_SYNC_NONE 0x00
+#define LDAP_SYNC_REFRESH_ONLY 0x01
+#define LDAP_SYNC_RESERVED 0x02
+#define LDAP_SYNC_REFRESH_AND_PERSIST 0x03
+#define LDAP_SYNC_REFRESH_PRESENTS 0
+#define LDAP_SYNC_REFRESH_DELETES 1
+#define LDAP_TAG_SYNC_COOKIE ((ber_tag_t) 0x04U)
+#define LDAP_TAG_REFRESHDELETES ((ber_tag_t) 0x01U)
+#define LDAP_TAG_REFRESHDONE ((ber_tag_t) 0x01U)
+#define LDAP_TAG_RELOAD_HINT ((ber_tag_t) 0x01U)
+#define LDAP_SYNC_PRESENT 0
+#define LDAP_SYNC_ADD 1
+#define LDAP_SYNC_MODIFY 2
+#define LDAP_SYNC_DELETE 3
+#define LDAP_SYNC_NEW_COOKIE 4
#endif
#ifndef LDAP_REQ_BIND
| 0 |
3bb3ca2e8214b2124192e377fbe624096da4d116
|
389ds/389-ds-base
|
Issue 6878 - Prevent repeated disconnect logs during shutdown (#6879)
Description: Avoid logging non-active initialized connections via CONN in disconnect_server_nomutex_ext by adding a check to skip invalid conn=0 with invalid sockets, preventing excessive repeated messages.
Update ds_logs_test.py by adding test_no_repeated_disconnect_messages to verify the fix.
Fixes: https://github.com/389ds/389-ds-base/issues/6878
Reviewed by: @mreynolds389 (Thanks!)
|
commit 3bb3ca2e8214b2124192e377fbe624096da4d116
Author: Simon Pichugin <[email protected]>
Date: Fri Jul 18 18:50:33 2025 -0700
Issue 6878 - Prevent repeated disconnect logs during shutdown (#6879)
Description: Avoid logging non-active initialized connections via CONN in disconnect_server_nomutex_ext by adding a check to skip invalid conn=0 with invalid sockets, preventing excessive repeated messages.
Update ds_logs_test.py by adding test_no_repeated_disconnect_messages to verify the fix.
Fixes: https://github.com/389ds/389-ds-base/issues/6878
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py b/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
index 209d63b5d..6fd790c18 100644
--- a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
+++ b/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
@@ -24,7 +24,7 @@ from lib389.plugins import AutoMembershipPlugin, ReferentialIntegrityPlugin, Aut
from lib389.idm.user import UserAccounts, UserAccount
from lib389.idm.group import Groups
from lib389.idm.organizationalunit import OrganizationalUnits
-from lib389._constants import DEFAULT_SUFFIX, LOG_ACCESS_LEVEL, PASSWORD
+from lib389._constants import DEFAULT_SUFFIX, LOG_ACCESS_LEVEL, PASSWORD, ErrorLog
from lib389.utils import ds_is_older, ds_is_newer
from lib389.config import RSA
from lib389.dseldif import DSEldif
@@ -1410,6 +1410,55 @@ def test_errorlog_buffering(topology_st, request):
assert inst.ds_error_log.match(".*slapd_daemon - slapd started.*")
+def test_no_repeated_disconnect_messages(topology_st):
+ """Test that there are no repeated "Not setting conn 0 to be disconnected: socket is invalid" messages on restart
+
+ :id: 72b5e1ce-2db8-458f-b2cd-0a0b6525f51f
+ :setup: Standalone Instance
+ :steps:
+ 1. Set error log level to CONNECTION
+ 2. Clear existing error logs
+ 3. Restart the server with 30 second timeout
+ 4. Check error log for repeated disconnect messages
+ 5. Verify there are no more than 10 occurrences of the disconnect message
+ :expectedresults:
+ 1. Error log level should be set successfully
+ 2. Error logs should be cleared
+ 3. Server should restart successfully within 30 seconds
+ 4. Error log should be accessible
+ 5. There should be no more than 10 repeated disconnect messages
+ """
+
+ inst = topology_st.standalone
+
+ log.info('Set error log level to CONNECTION')
+ inst.config.loglevel([ErrorLog.CONNECT])
+ current_level = inst.config.get_attr_val_int('nsslapd-errorlog-level')
+ log.info(f'Error log level set to: {current_level}')
+
+ log.info('Clear existing error logs')
+ inst.deleteErrorLogs()
+
+ log.info('Restart the server with 30 second timeout')
+ inst.restart(timeout=30)
+
+ log.info('Check error log for repeated disconnect messages')
+ disconnect_message = "Not setting conn 0 to be disconnected: socket is invalid"
+
+ # Count occurrences of the disconnect message
+ error_log_lines = inst.ds_error_log.readlines()
+ disconnect_count = 0
+
+ for line in error_log_lines:
+ if disconnect_message in line:
+ disconnect_count += 1
+
+ log.info(f'Found {disconnect_count} occurrences of disconnect message')
+
+ log.info('Verify there are no more than 10 occurrences')
+ assert disconnect_count <= 10, f"Found {disconnect_count} repeated disconnect messages, expected <= 10"
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 9f3c374cf..b3ca2e773 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -2556,12 +2556,15 @@ disconnect_server_nomutex_ext(Connection *conn, PRUint64 opconnid, int opid, PRE
}
}
} else {
- slapi_log_err(SLAPI_LOG_CONNS, "disconnect_server_nomutex_ext",
- "Not setting conn %d to be disconnected: %s\n",
- conn->c_sd,
- (conn->c_sd == SLAPD_INVALID_SOCKET) ? "socket is invalid" :
- ((conn->c_connid != opconnid) ? "conn id does not match op conn id" :
- ((conn->c_flags & CONN_FLAG_CLOSING) ? "conn is closing" : "unknown")));
+ /* We avoid logging an invalid conn=0 connection as it is not a real connection. */
+ if (!(conn->c_sd == SLAPD_INVALID_SOCKET && conn->c_connid == 0)) {
+ slapi_log_err(SLAPI_LOG_CONNS, "disconnect_server_nomutex_ext",
+ "Not setting conn %d to be disconnected: %s\n",
+ conn->c_sd,
+ (conn->c_sd == SLAPD_INVALID_SOCKET) ? "socket is invalid" :
+ ((conn->c_connid != opconnid) ? "conn id does not match op conn id" :
+ ((conn->c_flags & CONN_FLAG_CLOSING) ? "conn is closing" : "unknown")));
+ }
}
}
| 0 |
90d847426bf64cb5f2f2fd957f928be01d0500f8
|
389ds/389-ds-base
|
Issue 5170 - RFE - Filter optimiser (#5171)
Bug Description: This introduces a query optimiser to 389-ds.
A query optimiser helps our backend process queries in a manner
that is more efficient by reducing IO events, and returning
the correct results quicker. This is needed as most applications
are not aware of the internals of how we execute a query internally
- nor should they need to know. As an example, queries commonly
produced by SSSD are suboptimial and cause high latency and IO, but
this optimiser can resolve the majority of these issues which
generally improves all server throughput.
Fix Description: The optimiser works by attempting to produce
"the smallest candidate set" first. Having a smaller candidate
set earlier means that we can be below the filter test threshold
which shortcuts and can evaluate the remaining filter assertions
on the partial candidate set, rather than loading more expensive
and larger indexes. This also allows us to "fail fast" by
promoting "unlikely" candidates earlier which may end up
having a zero-length so that again, we don't load larger indexes.
A number of other changes were made and resolved in this change:
* Issue: The onelevel filter (not related to the
optimiser ...) works be injecting a parentid field check
to the filter that is used in the search. If the user
does not have access to read this field, then one level
searches fail
* Fix: Split the filter by "intent" and "as
executed". We can filter test on as executed without check
of the ACI, but we also check the filter as executed to
ensure that only valid entries matching the proper semantics
are returned
* Fix: Duplicate the filter for optimisation instead
and free it in the search path, leaving the pblock filter as
the "query as intended".
* Issue: In some cases, the filter test shortcut was
applied, but with a specially crafted query, this could trigger
the return prematurely giving incorrect results as the filter
test was NOT bubbled up correctly.
* Fix: Flag in the sr that the filter test MUST be
applied in certain shortcut cases.
fixes: https://github.com/389ds/389-ds-base/issues/5170
Author: William Brown <[email protected]>
Review by: @tbordaz, @mreynolds389
|
commit 90d847426bf64cb5f2f2fd957f928be01d0500f8
Author: Firstyear <[email protected]>
Date: Thu May 5 11:40:26 2022 +1000
Issue 5170 - RFE - Filter optimiser (#5171)
Bug Description: This introduces a query optimiser to 389-ds.
A query optimiser helps our backend process queries in a manner
that is more efficient by reducing IO events, and returning
the correct results quicker. This is needed as most applications
are not aware of the internals of how we execute a query internally
- nor should they need to know. As an example, queries commonly
produced by SSSD are suboptimial and cause high latency and IO, but
this optimiser can resolve the majority of these issues which
generally improves all server throughput.
Fix Description: The optimiser works by attempting to produce
"the smallest candidate set" first. Having a smaller candidate
set earlier means that we can be below the filter test threshold
which shortcuts and can evaluate the remaining filter assertions
on the partial candidate set, rather than loading more expensive
and larger indexes. This also allows us to "fail fast" by
promoting "unlikely" candidates earlier which may end up
having a zero-length so that again, we don't load larger indexes.
A number of other changes were made and resolved in this change:
* Issue: The onelevel filter (not related to the
optimiser ...) works be injecting a parentid field check
to the filter that is used in the search. If the user
does not have access to read this field, then one level
searches fail
* Fix: Split the filter by "intent" and "as
executed". We can filter test on as executed without check
of the ACI, but we also check the filter as executed to
ensure that only valid entries matching the proper semantics
are returned
* Fix: Duplicate the filter for optimisation instead
and free it in the search path, leaving the pblock filter as
the "query as intended".
* Issue: In some cases, the filter test shortcut was
applied, but with a specially crafted query, this could trigger
the return prematurely giving incorrect results as the filter
test was NOT bubbled up correctly.
* Fix: Flag in the sr that the filter test MUST be
applied in certain shortcut cases.
fixes: https://github.com/389ds/389-ds-base/issues/5170
Author: William Brown <[email protected]>
Review by: @tbordaz, @mreynolds389
diff --git a/Makefile.am b/Makefile.am
index 330e4d5a1..7d538bf1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1947,6 +1947,7 @@ TESTS = test_slapd
test_slapd_SOURCES = test/main.c \
test/libslapd/test.c \
test/libslapd/counters/atomic.c \
+ test/libslapd/filter/optimise.c \
test/libslapd/pblock/analytics.c \
test/libslapd/pblock/v3_compat.c \
test/libslapd/schema/filter_validate.c \
diff --git a/dirsrvtests/tests/suites/filter/filter_onelevel_aci_test.py b/dirsrvtests/tests/suites/filter/filter_onelevel_aci_test.py
new file mode 100644
index 000000000..af9d5ef75
--- /dev/null
+++ b/dirsrvtests/tests/suites/filter/filter_onelevel_aci_test.py
@@ -0,0 +1,49 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2022 William Brown <[email protected]>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ----
+
+import pytest, os, ldap
+
+from lib389._constants import DEFAULT_SUFFIX
+from lib389.topologies import topology_st
+
+from lib389.idm.account import Anonymous
+from lib389.idm.user import UserAccount, UserAccounts
+
+pytestmark = pytest.mark.tier0
+
+def test_search_attr(topology_st):
+ """Test filter can search attributes
+
+ :id: 99104b2d-fe12-40d7-b977-a04fa184cfac
+ :setup: Standalone instance
+ :steps:
+ 1. Add test entry
+ 2. Search with onelevel
+ :expectedresults:
+ 1. Success
+ 2. Success
+ """
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
+ user = users.create_test_user(uid=1000)
+
+ # Bind as anonymous
+ conn = Anonymous(topology_st.standalone).bind()
+ anon_users = UserAccounts(conn, DEFAULT_SUFFIX)
+ # Subtree, works.
+ res1 = anon_users.filter("(uid=test_user_1000)", scope=ldap.SCOPE_SUBTREE, strict=True)
+ assert len(res1) == 1
+
+ # Search with a one-level search.
+ # This previously hit a case with filter optimisation in how parent id values were added.
+ res2 = anon_users.filter("(uid=test_user_1000)", scope=ldap.SCOPE_ONELEVEL, strict=True)
+ # We must get at least one result!
+ assert len(res2) == 1
+
+if __name__ == "__main__":
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s -v %s" % CURRENT_FILE)
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 4e5159d5d..cd2258df2 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -803,7 +803,7 @@ typedef struct _back_search_result_set
int sr_current_sizelimit; /* Current sizelimit */
Slapi_Filter *sr_norm_filter; /* search filter pre-normalized */
} back_search_result_set;
-#define SR_FLAG_CAN_SKIP_FILTER_TEST 1 /* If set in sr_flags, means that we can safely skip the filter test */
+#define SR_FLAG_MUST_APPLY_FILTER_TEST 1 /* If set in sr_flags, means that we MUST apply the filter test */
#include "proto-back-ldbm.h"
#include "ldbm_config.h"
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index 8a79848c3..7c1cf5bae 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -701,6 +701,9 @@ list_candidates(
struct berval *vpairs[2] = {NULL, NULL};
int is_and = 0;
IDListSet *idl_set = NULL;
+ back_search_result_set *sr = NULL;
+
+ slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
slapi_log_err(SLAPI_LOG_TRACE, "list_candidates", "=> 0x%x\n", ftype);
@@ -891,6 +894,7 @@ list_candidates(
* and allids - we should not process anymore, and fallback to full
* table scan at this point.
*/
+ sr->sr_flags |= SR_FLAG_MUST_APPLY_FILTER_TEST;
goto apply_set_op;
}
@@ -899,11 +903,12 @@ list_candidates(
* If we encounter a zero length idl, we bail now because this can never
* result in a meaningful result besides zero.
*/
+ sr->sr_flags |= SR_FLAG_MUST_APPLY_FILTER_TEST;
goto apply_set_op;
}
}
-/*
+ /*
* Do the idl_set operation if required.
* these are far more efficient than the iterative union and
* intersections we previously used.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 61790d049..68751bbd9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -2164,8 +2164,13 @@ moddn_get_children(back_txn *ptxn,
* being moved */
strcpy(filterstr, "objectclass=*");
filter = slapi_str2filter(filterstr);
+ /*
+ * We used to set managedSAIT here, but because the subtree create
+ * referral step is now in build_candidate_list, we can trust the filter
+ * we provide here is exactly as we provide it IE no referrals involved.
+ */
candidates = subtree_candidates(pb, be, slapi_sdn_get_ndn(dn_parentdn),
- parententry, filter, 1 /* ManageDSAIT */,
+ parententry, filter,
NULL /* allids_before_scopingp */, &err);
slapi_filter_free(filter, 1);
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 431bfaebe..d669622c0 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -31,7 +31,7 @@
/* prototypes */
static int build_candidate_list(Slapi_PBlock *pb, backend *be, struct backentry *e, const char *base, int scope, int *lookup_returned_allidsp, IDList **candidates);
static IDList *base_candidates(Slapi_PBlock *pb, struct backentry *e);
-static IDList *onelevel_candidates(Slapi_PBlock *pb, backend *be, const char *base, struct backentry *e, Slapi_Filter *filter, int managedsait, int *lookup_returned_allidsp, int *err);
+static IDList *onelevel_candidates(Slapi_PBlock *pb, backend *be, const char *base, Slapi_Filter *filter, int *lookup_returned_allidsp, int *err);
static back_search_result_set *new_search_result_set(IDList *idl, int vlv, int lookthroughlimit);
static void delete_search_result_set(Slapi_PBlock *pb, back_search_result_set **sr);
static int can_skip_filter_test(Slapi_PBlock *pb, struct slapi_filter *f, int scope, IDList *idl);
@@ -922,18 +922,20 @@ ldbm_back_search(Slapi_PBlock *pb)
tmp_desc = "Filter is not set";
goto bail;
}
- if (can_skip_filter_test(pb, filter, scope, candidates)) {
- sr->sr_flags |= SR_FLAG_CAN_SKIP_FILTER_TEST;
+ if (can_skip_filter_test(pb, filter, scope, candidates) == 0) {
+ sr->sr_flags |= SR_FLAG_MUST_APPLY_FILTER_TEST;
}
}
/* if we need to perform the filter test, pre-digest the filter to
speed up the filter test */
- if (!(sr->sr_flags & SR_FLAG_CAN_SKIP_FILTER_TEST) ||
+ if ((sr->sr_flags & SR_FLAG_MUST_APPLY_FILTER_TEST) ||
li->li_filter_bypass_check) {
int rc = 0, filt_errs = 0;
Slapi_Filter *filter = NULL;
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_search", "Applying Filter Test\n");
+
slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &filter);
if (NULL == filter) {
tmp_err = LDAP_OPERATIONS_ERROR;
@@ -956,6 +958,8 @@ ldbm_back_search(Slapi_PBlock *pb)
tmp_desc = "Could not compile regex for filter matching";
}
}
+ } else {
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_search", "Skipped Filter Test\n");
}
bail:
/* Fix for bugid #394184, SD, 05 Jul 00 */
@@ -981,8 +985,10 @@ build_candidate_list(Slapi_PBlock *pb, backend *be, struct backentry *e, const c
struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private;
int managedsait = 0;
Slapi_Filter *filter = NULL;
+ Slapi_Filter *filter_exec = NULL;
int err = 0;
int r = 0;
+ char logbuf[1024] = {0};
slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &filter);
if (NULL == filter) {
@@ -999,13 +1005,35 @@ build_candidate_list(Slapi_PBlock *pb, backend *be, struct backentry *e, const c
break;
case LDAP_SCOPE_ONELEVEL:
- *candidates = onelevel_candidates(pb, be, base, e, filter, managedsait,
- lookup_returned_allidsp, &err);
+ /* Now optimise the filter for use */
+ slapi_filter_optimise(filter);
+ /* modify the filter to be: (&(|(originalfilter)(objectclass=referral))(parentid=idofbase)) */
+ filter_exec = create_onelevel_filter(filter, e, managedsait);
+
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_search", "Optimised ONE filter to - %s\n",
+ slapi_filter_to_string(filter_exec, logbuf, sizeof(logbuf)));
+
+ *candidates = onelevel_candidates(pb, be, base, filter_exec, lookup_returned_allidsp, &err);
+
+ slapi_pblock_set(pb, SLAPI_SEARCH_FILTER, filter_exec);
+ slapi_pblock_set(pb, SLAPI_SEARCH_FILTER_INTENDED, filter);
+
break;
case LDAP_SCOPE_SUBTREE:
- *candidates = subtree_candidates(pb, be, base, e, filter, managedsait,
- lookup_returned_allidsp, &err);
+ /* Now optimise the filter for use */
+ slapi_filter_optimise(filter);
+ /* make (|(originalfilter)(objectclass=referral)) */
+ filter_exec = create_subtree_filter(filter, managedsait);
+
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_search", "Optimised SUB filter to - %s\n",
+ slapi_filter_to_string(filter_exec, logbuf, sizeof(logbuf)));
+
+ *candidates = subtree_candidates(pb, be, base, e, filter_exec, lookup_returned_allidsp, &err);
+
+ slapi_pblock_set(pb, SLAPI_SEARCH_FILTER, filter_exec);
+ slapi_pblock_set(pb, SLAPI_SEARCH_FILTER_INTENDED, filter);
+
break;
default:
@@ -1064,15 +1092,15 @@ base_candidates(Slapi_PBlock *pb __attribute__((unused)), struct backentry *e)
* non-recursively when done with the returned filter.
*/
static Slapi_Filter *
-create_referral_filter(Slapi_Filter *filter, Slapi_Filter **focref, Slapi_Filter **forr)
+create_referral_filter(Slapi_Filter *filter)
{
char *buf = slapi_ch_strdup("objectclass=referral");
- *focref = slapi_str2filter(buf);
- *forr = slapi_filter_join(LDAP_FILTER_OR, filter, *focref);
+ Slapi_Filter *focref = slapi_str2filter(buf);
+ Slapi_Filter *forr = slapi_filter_join(LDAP_FILTER_OR, filter, focref);
slapi_ch_free((void **)&buf);
- return *forr;
+ return forr;
}
/*
@@ -1086,20 +1114,20 @@ create_referral_filter(Slapi_Filter *filter, Slapi_Filter **focref, Slapi_Filter
* This function is exported for the VLV code to use.
*/
Slapi_Filter *
-create_onelevel_filter(Slapi_Filter *filter, const struct backentry *baseEntry, int managedsait, Slapi_Filter **fid2kids, Slapi_Filter **focref, Slapi_Filter **fand, Slapi_Filter **forr)
+create_onelevel_filter(Slapi_Filter *filter, const struct backentry *baseEntry, int managedsait)
{
Slapi_Filter *ftop = filter;
char buf[40];
if (!managedsait) {
- ftop = create_referral_filter(filter, focref, forr);
+ ftop = create_referral_filter(filter);
}
sprintf(buf, "parentid=%lu", (u_long)(baseEntry != NULL ? baseEntry->ep_id : 0));
- *fid2kids = slapi_str2filter(buf);
- *fand = slapi_filter_join(LDAP_FILTER_AND, ftop, *fid2kids);
+ Slapi_Filter *fid2kids = slapi_str2filter(buf);
+ Slapi_Filter *fand = slapi_filter_join(LDAP_FILTER_AND, ftop, fid2kids);
- return *fand;
+ return fand;
}
/*
@@ -1110,38 +1138,16 @@ onelevel_candidates(
Slapi_PBlock *pb,
backend *be,
const char *base,
- struct backentry *e,
Slapi_Filter *filter,
- int managedsait,
int *lookup_returned_allidsp,
int *err)
{
- Slapi_Filter *fid2kids = NULL;
- Slapi_Filter *focref = NULL;
- Slapi_Filter *fand = NULL;
- Slapi_Filter *forr = NULL;
- Slapi_Filter *ftop = NULL;
IDList *candidates;
- /*
- * modify the filter to be something like this:
- *
- * (&(parentid=idofbase)(|(originalfilter)(objectclass=referral)))
- */
-
- ftop = create_onelevel_filter(filter, e, managedsait, &fid2kids, &focref, &fand, &forr);
-
- /* from here, it's just like subtree_candidates */
- candidates = filter_candidates(pb, be, base, ftop, NULL, 0, err);
+ candidates = filter_candidates(pb, be, base, filter, NULL, 0, err);
*lookup_returned_allidsp = slapi_be_is_flag_set(be, SLAPI_BE_FLAG_DONT_BYPASS_FILTERTEST);
- /* free up just the filter stuff we allocated above */
- slapi_filter_free(fid2kids, 0);
- slapi_filter_free(fand, 0);
- slapi_filter_free(forr, 0);
- slapi_filter_free(focref, 0);
-
return (candidates);
}
@@ -1156,12 +1162,12 @@ onelevel_candidates(
* This function is exported for the VLV code to use.
*/
Slapi_Filter *
-create_subtree_filter(Slapi_Filter *filter, int managedsait, Slapi_Filter **focref, Slapi_Filter **forr)
+create_subtree_filter(Slapi_Filter *filter, int managedsait)
{
Slapi_Filter *ftop = filter;
if (!managedsait) {
- ftop = create_referral_filter(filter, focref, forr);
+ ftop = create_referral_filter(filter);
}
return ftop;
@@ -1178,13 +1184,9 @@ subtree_candidates(
const char *base,
const struct backentry *e,
Slapi_Filter *filter,
- int managedsait,
int *allids_before_scopingp,
int *err)
{
- Slapi_Filter *focref = NULL;
- Slapi_Filter *forr = NULL;
- Slapi_Filter *ftop = NULL;
IDList *candidates;
PRBool has_tombstone_filter;
int isroot = 0;
@@ -1193,13 +1195,8 @@ subtree_candidates(
Operation *op = NULL;
PRBool is_bulk_import = PR_FALSE;
- /* make (|(originalfilter)(objectclass=referral)) */
- ftop = create_subtree_filter(filter, managedsait, &focref, &forr);
-
/* Fetch a candidate list for the original filter */
- candidates = filter_candidates_ext(pb, be, base, ftop, NULL, 0, err, allidslimit);
- slapi_filter_free(forr, 0);
- slapi_filter_free(focref, 0);
+ candidates = filter_candidates_ext(pb, be, base, filter, NULL, 0, err, allidslimit);
/* set 'allids before scoping' flag */
if (NULL != allids_before_scopingp) {
@@ -1406,6 +1403,7 @@ ldbm_back_next_search_entry(Slapi_PBlock *pb)
int managedsait;
Slapi_Attr *attr;
Slapi_Filter *filter;
+ Slapi_Filter *filter_intent;
back_search_result_set *sr;
ID id;
struct backentry *e;
@@ -1439,6 +1437,7 @@ ldbm_back_next_search_entry(Slapi_PBlock *pb)
slapi_pblock_get(pb, SLAPI_SEARCH_SCOPE, &scope);
slapi_pblock_get(pb, SLAPI_MANAGEDSAIT, &managedsait);
slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &filter);
+ slapi_pblock_get(pb, SLAPI_SEARCH_FILTER_INTENDED, &filter_intent);
slapi_pblock_get(pb, SLAPI_NENTRIES, &nentries);
slapi_pblock_get(pb, SLAPI_SEARCH_SIZELIMIT, &slimit);
slapi_pblock_get(pb, SLAPI_SEARCH_TIMELIMIT, &tlimit);
@@ -1711,34 +1710,52 @@ ldbm_back_next_search_entry(Slapi_PBlock *pb)
filter_test = 0;
}
}
- if (filter_test == 0) {
- /* check if the entry matches the filter, and passes the ACL check */
- filter_test = -1;
- if (0 != (sr->sr_flags & SR_FLAG_CAN_SKIP_FILTER_TEST)) {
- /* Since we do access control checking in the filter test (?Why?) we need to check access now */
- slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry",
- "Bypassing filter test\n");
- if (ACL_CHECK_FLAG) {
- filter_test = slapi_vattr_filter_test_ext(pb, e->ep_entry, filter, ACL_CHECK_FLAG, 1 /* Only perform access checking, thank you */);
- } else {
- filter_test = 0;
- }
- if (li->li_filter_bypass_check) {
- int ft_rc;
-
- slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry", "Checking bypass\n");
- ft_rc = slapi_vattr_filter_test(pb, e->ep_entry, filter,
- ACL_CHECK_FLAG);
- if (filter_test != ft_rc) {
- /* Oops ! This means that we thought we could bypass the filter test, but noooo... */
- slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry",
- "Filter bypass ERROR on entry %s\n", backentry_get_ndn(e));
- filter_test = ft_rc; /* Fix the error */
- }
- }
+
+ /* it's a regular entry, check if it matches the filter, and passes the ACL check */
+ /*
+ * Remember, MUST_APPLY is set during a shortcut condition from the IDL backend,
+ * which means we can NOT ignore it! When it's 0, we assume that IDL fully resolved
+ * which means we then check the ACL only, we have a decision about if we do the
+ * test based on the configuration.
+ */
+ if (0 == (sr->sr_flags & SR_FLAG_MUST_APPLY_FILTER_TEST)) {
+ /*
+ * Since we do access control checking in the filter test we need to check access now
+ * This checks access to the filter as INTENDED by the user - not the query that
+ * we have messed with internally - remember, our internal changes are safe!
+ */
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry",
+ "Bypassing filter test\n");
+ if (ACL_CHECK_FLAG) {
+ filter_test = slapi_vattr_filter_test_ext(pb, e->ep_entry, filter_intent, ACL_CHECK_FLAG, 1 /* Only perform access checking, thank you */);
} else {
- /* Old-style case---we need to do a filter test */
- filter_test = slapi_vattr_filter_test(pb, e->ep_entry, filter, ACL_CHECK_FLAG);
+ filter_test = 0;
+ }
+
+ /* If we don't check this, we could stomp the filter_test aci denied result. */
+ if (filter_test == 0 && li->li_filter_bypass_check) {
+ slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry", "Checking bypass\n");
+ filter_test = slapi_vattr_filter_test(pb, e->ep_entry, filter, 0);
+ if (filter_test != 0) {
+ /* Oops ! This means that we thought we could bypass the filter test, but noooo... */
+ slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry",
+ "Filter bypass ERROR on entry %s\n", backentry_get_ndn(e));
+ }
+ }
+ } else {
+ /* MUST APPLY - This occurs when we have a partial candidate set */
+ /*
+ * IMPORTANT - there is a large and important difference between "filter as intended"
+ * and filter as executed. The filter as executed is what we optimised to, and this
+ * can importantly include items like parentid in a one level search. The filter as
+ * intended however is what the user ASKED for. We shouldn't penalise the user because
+ * we mucked with their filter, so we check the ACI with the "filter as intended", but
+ * we need to STILL apply the filter test with "as executed" in case of a test threshold
+ * shortcut (lest we accidentally prevent the user seeing what they wanted ....)
+ */
+ filter_test = slapi_vattr_filter_test_ext(pb, e->ep_entry, filter_intent, ACL_CHECK_FLAG, 1 /* Only perform access checking, thank you */);
+ if (filter_test == 0) {
+ filter_test = slapi_vattr_filter_test(pb, e->ep_entry, filter, 0);
}
}
}
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 1bcda6f0b..4d32a3f3b 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -521,9 +521,9 @@ int indexfile_primary_modifyall(backend *be, LDAPMod **mods_to_perform, char **i
/*
* ldbm_search.c
*/
-Slapi_Filter *create_onelevel_filter(Slapi_Filter *filter, const struct backentry *e, int managedsait, Slapi_Filter **fid2kids, Slapi_Filter **focref, Slapi_Filter **fand, Slapi_Filter **forr);
-Slapi_Filter *create_subtree_filter(Slapi_Filter *filter, int managedsait, Slapi_Filter **focref, Slapi_Filter **forr);
-IDList *subtree_candidates(Slapi_PBlock *pb, backend *be, const char *base, const struct backentry *e, Slapi_Filter *filter, int managedsait, int *allids_before_scopingp, int *err);
+Slapi_Filter *create_onelevel_filter(Slapi_Filter *filter, const struct backentry *e, int managedsait);
+Slapi_Filter *create_subtree_filter(Slapi_Filter *filter, int managedsait);
+IDList *subtree_candidates(Slapi_PBlock *pb, backend *be, const char *base, const struct backentry *e, Slapi_Filter *filter, int *allids_before_scopingp, int *err);
void search_set_tune(struct ldbminfo *li, int val);
int search_get_tune(struct ldbminfo *li);
int compute_lookthrough_limit(Slapi_PBlock *pb, struct ldbminfo *li);
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index b78afdfa5..924ff6325 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -92,13 +92,8 @@ vlvSearch_reinit(struct vlvSearch *p, const struct backentry *base)
p->vlv_slapifilter = slapi_str2filter(p->vlv_filter);
filter_normalize(p->vlv_slapifilter);
/* make (&(parentid=idofbase)(|(originalfilter)(objectclass=referral))) */
- {
- Slapi_Filter *fid2kids = NULL;
- Slapi_Filter *focref = NULL;
- Slapi_Filter *fand = NULL;
- Slapi_Filter *forr = NULL;
- p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, base, 0 /* managedsait */, &fid2kids, &focref, &fand, &forr);
- }
+ p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, base, 0 /* managedsait */);
+ slapi_filter_optimise(p->vlv_slapifilter);
}
/*
@@ -174,22 +169,16 @@ vlvSearch_init(struct vlvSearch *p, Slapi_PBlock *pb, const Slapi_Entry *e, ldbm
/* make (&(parentid=idofbase)(|(originalfilter)(objectclass=referral))) */
{
- Slapi_Filter *fid2kids = NULL;
- Slapi_Filter *focref = NULL;
- Slapi_Filter *fand = NULL;
- Slapi_Filter *forr = NULL;
- p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, e, 0 /* managedsait */, &fid2kids, &focref, &fand, &forr);
- /* jcm: fid2kids, focref, fand, and forr get freed when we free p->vlv_slapifilter */
+ p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, e, 0 /* managedsait */);
+ slapi_filter_optimise(p->vlv_slapifilter);
CACHE_RETURN(&inst->inst_cache, &e);
}
} break;
case LDAP_SCOPE_SUBTREE: {
/* make (|(originalfilter)(objectclass=referral))) */
/* No need for scope-filter since we apply a scope test before the filter test */
- Slapi_Filter *focref = NULL;
- Slapi_Filter *forr = NULL;
- p->vlv_slapifilter = create_subtree_filter(p->vlv_slapifilter, 0 /* managedsait */, &focref, &forr);
- /* jcm: focref and forr get freed when we free p->vlv_slapifilter */
+ p->vlv_slapifilter = create_subtree_filter(p->vlv_slapifilter, 0 /* managedsait */);
+ slapi_filter_optimise(p->vlv_slapifilter);
} break;
}
}
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index bf2cdebee..4bfb518cd 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -1660,6 +1660,12 @@ dse_search(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, basesdn);
}
slapi_sdn_free(&old_repl_sdn);
+ /*
+ * Now optimise the filter for use: note that unlike ldbm_search,
+ * because we don't change the outer filter container, we don't need
+ * to set back into pb.
+ */
+ slapi_filter_optimise(filter);
switch (scope) {
case LDAP_SCOPE_BASE: {
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 6dcf04557..6451ec549 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -29,7 +29,6 @@ static int get_extensible_filter(BerElement *ber, mr_filter_t *);
static int get_filter_internal(Connection *conn, BerElement *ber, struct slapi_filter **filt, char **fstr, int maxdepth, int curdepth, int *subentry_dont_rewrite, int *has_tombstone_filter, int *has_ruv_filter);
static int tombstone_check_filter(Slapi_Filter *f);
static int ruv_check_filter(Slapi_Filter *f);
-static void filter_optimize(Slapi_Filter *f);
/*
@@ -78,7 +77,12 @@ get_filter(Connection *conn, BerElement *ber, int scope, struct slapi_filter **f
slapi_filter_to_string(*filt, logbuf, logbufsize));
}
- filter_optimize(*filt);
+ /*
+ * Filter optimise has been moved to the onelevel/subtree candidate dispatch.
+ * this is because they inject referrals or other business, that we can optimise
+ * and improve.
+ */
+ /* filter_optimize(*filt); */
if (NULL != logbuf) {
slapi_log_err(SLAPI_LOG_DEBUG, "get_filter", " after optimize: %s\n",
@@ -873,19 +877,22 @@ slapi_filter_join_ex(int ftype, struct slapi_filter *f1, struct slapi_filter *f2
if (add_to->f_list->f_choice == LDAP_FILTER_NOT) {
add_this->f_next = add_to->f_list;
add_to->f_list = add_this;
- filter_compute_hash(add_to);
- return_this = add_to;
} else {
/* find end of list, add the filter */
for (fjoin = add_to->f_list; fjoin != NULL; fjoin = fjoin->f_next) {
if (fjoin->f_next == NULL) {
fjoin->f_next = add_this;
- filter_compute_hash(add_to);
- return_this = add_to;
break;
}
}
}
+ /*
+ * Make sure we sync the filter flags. The origin filters may have flags
+ * we still need on the outer layer!
+ */
+ add_to->f_flags |= add_this->f_flags;
+ filter_compute_hash(add_to);
+ return_this = add_to;
} else {
fjoin = (struct slapi_filter *)slapi_ch_calloc(1, sizeof(struct slapi_filter));
fjoin->f_choice = ftype;
@@ -898,6 +905,8 @@ slapi_filter_join_ex(int ftype, struct slapi_filter *f1, struct slapi_filter *f2
fjoin->f_list = f1;
f1->f_next = f2;
}
+ /* Make sure any flags that were set move to the outer parent */
+ fjoin->f_flags |= f1->f_flags | f2->f_flags;
filter_compute_hash(fjoin);
return_this = fjoin;
}
@@ -1542,47 +1551,181 @@ ruv_check_filter(Slapi_Filter *f)
return 0; /* Not a RUV filter */
}
+/*
+ * To help filter optimise we break out the list manipulation
+ * code.
+ */
+
+static void
+filter_prioritise_element(Slapi_Filter **list, Slapi_Filter **head, Slapi_Filter **tail, Slapi_Filter **f_prev, Slapi_Filter **f_cur) {
+ if (*f_prev != NULL) {
+ (*f_prev)->f_next = (*f_cur)->f_next;
+ } else if (*list == *f_cur) {
+ *list = (*f_cur)->f_next;
+ }
+
+ if (*head == NULL) {
+ *head = *f_cur;
+ *tail = *f_cur;
+ (*f_cur)->f_next = NULL;
+ } else {
+ (*f_cur)->f_next = *head;
+ *head = *f_cur;
+ }
+}
+
+static void
+filter_merge_subfilter(Slapi_Filter **list, Slapi_Filter **f_prev, Slapi_Filter **f_cur, Slapi_Filter **f_next) {
+
+ /* First, graft in the new item between f_cur and f_cur -> f_next */
+ Slapi_Filter *remainder = (*f_cur)->f_next;
+ (*f_cur)->f_next = (*f_cur)->f_list;
+ /* Go to the end of the newly grafted list, and put in our remainder. */
+ Slapi_Filter *f_cur_tail = *f_cur;
+ while (f_cur_tail->f_next != NULL) {
+ f_cur_tail = f_cur_tail->f_next;
+ }
+ f_cur_tail->f_next = remainder;
+
+ /* Now indicate to the caller what the next element is. */
+ *f_next = (*f_cur)->f_next;
+
+ /* Now that we have grafted our list in, cut out f_cur */
+ if (*f_prev != NULL) {
+ (*f_prev)->f_next = *f_next;
+ } else if (*list == *f_cur) {
+ *list = *f_next;
+ }
+
+ /* Finally free the f_cur (and/or) */
+ slapi_filter_free(*f_cur, 0);
+}
-/* filter_optimize
+/* slapi_filter_optimise
* ---------------
- * takes a filter and optimizes it for fast evaluation
- * currently this merely ensures that any AND or OR
- * does not start with a NOT sub-filter if possible
+ * takes a filter and optimises it for fast evaluation
+ *
+ * Optimisations are:
+ * * In OR conditions move substrings early to promote fail-fast of unindexed types
+ * * In AND conditions move eq types (that are not objectClass) early to promote triggering threshold shortcut
+ * * In OR conditions, merge all direct child OR conditions into the list. (|(|(a)(b))) == (|(a)(b))
+ * * in AND conditions, merge all direct child AND conditions into the list. (&(&(a)(b))) == (&(a)(b))
+ *
+ * In the case of the OR and AND merges, we remove the inner filter because the outer one may have flags set.
+ *
+ * In the future this could be backend dependent.
*/
-static void
-filter_optimize(Slapi_Filter *f)
+void
+slapi_filter_optimise(Slapi_Filter *f)
{
- if (!f)
+ /*
+ * Today tombstone searches RELY on filter ordering
+ * and a filter test threshold quirk. We need to avoid
+ * touching these cases!!!
+ */
+ if (f == NULL || (f->f_flags & SLAPI_FILTER_TOMBSTONE) != 0) {
return;
+ }
switch (f->f_choice) {
case LDAP_FILTER_AND:
- case LDAP_FILTER_OR: {
- /* first optimize children */
- filter_optimize(f->f_list);
-
- /* optimize this */
- if (f->f_list->f_choice == LDAP_FILTER_NOT) {
- Slapi_Filter *f_prev = 0;
- Slapi_Filter *f_child = 0;
-
- /* grab a non not filter to place at start */
- for (f_child = f->f_list; f_child != 0; f_child = f_child->f_next) {
- if (f_child->f_choice != LDAP_FILTER_NOT) {
- /* we have a winner, do swap */
- if (f_prev)
- f_prev->f_next = f_child->f_next;
- f_child->f_next = f->f_list;
- f->f_list = f_child;
+ /* Move all equality searches to the head. */
+ /* Merge any direct descendant AND queries into us */
+ {
+ Slapi_Filter *f_prev = NULL;
+ Slapi_Filter *f_cur = NULL;
+ Slapi_Filter *f_next = NULL;
+
+ Slapi_Filter *f_op_head = NULL;
+ Slapi_Filter *f_op_tail = NULL;
+
+ f_cur = f->f_list;
+ while(f_cur != NULL) {
+
+ switch(f_cur->f_choice) {
+ case LDAP_FILTER_AND:
+ filter_merge_subfilter(&(f->f_list), &f_prev, &f_cur, &f_next);
+ f_cur = f_next;
+ break;
+ case LDAP_FILTER_EQUALITY:
+ if (strcasecmp(f_cur->f_avtype, "objectclass") != 0) {
+ f_next = f_cur->f_next;
+ /* Cut it out */
+ filter_prioritise_element(&(f->f_list), &f_op_head, &f_op_tail, &f_prev, &f_cur);
+ /* Don't change previous, because we remove this f_cur */
+ f_cur = f_next;
+ break;
+ } else {
+ /* Move along */
+ f_prev = f_cur;
+ f_cur = f_cur->f_next;
+ }
+ break;
+ default:
+ /* Move along */
+ f_prev = f_cur;
+ f_cur = f_cur->f_next;
break;
}
+ }
- f_prev = f_child;
+ if (f_op_head != NULL) {
+ f_op_tail->f_next = f->f_list;
+ f->f_list = f_op_head;
}
}
- }
+ /* finally optimize children */
+ slapi_filter_optimise(f->f_list);
+
+ break;
+
+ case LDAP_FILTER_OR:
+ /* Move all substring searches to the head. */
+ {
+ Slapi_Filter *f_prev = NULL;
+ Slapi_Filter *f_cur = NULL;
+ Slapi_Filter *f_next = NULL;
+
+ Slapi_Filter *f_op_head = NULL;
+ Slapi_Filter *f_op_tail = NULL;
+
+ f_cur = f->f_list;
+ while(f_cur != NULL) {
+
+ switch(f_cur->f_choice) {
+ case LDAP_FILTER_OR:
+ filter_merge_subfilter(&(f->f_list), &f_prev, &f_cur, &f_next);
+ f_cur = f_next;
+ break;
+ case LDAP_FILTER_APPROX:
+ case LDAP_FILTER_GE:
+ case LDAP_FILTER_LE:
+ case LDAP_FILTER_SUBSTRINGS:
+ f_next = f_cur->f_next;
+ /* Cut it out */
+ filter_prioritise_element(&(f->f_list), &f_op_head, &f_op_tail, &f_prev, &f_cur);
+ /* Don't change previous, because we remove this f_cur */
+ f_cur = f_next;
+ break;
+ default:
+ /* Move along */
+ f_prev = f_cur;
+ f_cur = f_cur->f_next;
+ break;
+ }
+ }
+ if (f_op_head != NULL) {
+ f_op_tail->f_next = f->f_list;
+ f->f_list = f_op_head;
+ }
+ }
+ /* finally optimize children */
+ slapi_filter_optimise(f->f_list);
+
+ break;
+
default:
- filter_optimize(f->f_next);
+ slapi_filter_optimise(f->f_next);
break;
}
}
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
new file mode 100644
index 000000000..7d7e1b782
--- /dev/null
+++ b/ldap/servers/slapd/index_subsystem.c
@@ -0,0 +1,1209 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2005 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+/* The indexing subsystem
+ * ----------------------
+ *
+ * This provides support for indexing plugins and assigning
+ * those plugins to sub-filters of a search filter. Currently
+ * the old indexing code still exists and operates on those
+ * indexes which do not have a plugin assigned. This indexing
+ * abstraction is intended to eventually decouple the index mechanics
+ * from the back-end where that is possible. Hopefully, while
+ * supporting the needs of virtual attribute indexes, it will allow
+ * easier integration of other back ends.
+ *
+ */
+
+/* includes */
+#include "slap.h"
+#include "./back-ldbm/back-ldbm.h"
+#include "./back-ldbm/idlapi.h"
+#include "index_subsys.h"
+
+#define INDEX_IDLIST_INITIAL_SIZE 128 /* make this a good size to avoid constant reallocs */
+
+/* data */
+static void **idl_api;
+
+struct _indexLinkedList
+{
+ void *pNext;
+ void *pPrev;
+};
+typedef struct _indexLinkedList indexLinkedList;
+
+struct _indexEntry
+{
+ indexLinkedList list;
+ char *indexedAttribute;
+ Slapi_Filter *indexfilter;
+ char *indexfilterstr;
+ char **associated_attrs;
+ void *user_data;
+ Slapi_DN *namespace_dn;
+ index_search_callback lookup_func; /* search call back */
+};
+typedef struct _indexEntry indexEntry;
+
+struct _indexPlugin
+{
+ indexLinkedList list;
+ char *id;
+ indexEntry *indexes;
+ index_validate_callback validate_op;
+};
+typedef struct _indexPlugin indexPlugin;
+
+struct _globalIndexCache
+{
+ indexPlugin *pPlugins;
+ indexEntry **ppIndexIndex; /* sorted list with key: indexEntry.indexedAttribute */
+ int index_count;
+ Slapi_RWLock *cache_lock;
+};
+typedef struct _globalIndexCache globalIndexCache;
+
+static globalIndexCache *theCache = 0;
+
+/* prototypes */
+static int index_subsys_decoder_done(Slapi_Filter *f);
+static int index_subsys_assign_decoders(Slapi_Filter *f);
+static int index_subsys_assign_decoder(Slapi_Filter *f);
+static int index_subsys_group_decoders(Slapi_Filter *f);
+static int index_subsys_unlink_subfilter(Slapi_Filter *fcomplex, Slapi_Filter *fsub);
+static int index_subsys_index_matches_associated(indexEntry *index, Slapi_Filter *f);
+
+/* matching alg - note : values 0/1/2/3 supported right now*/
+#define INDEX_MATCH_NONE 0
+#define INDEX_MATCH_EQUALITY 1
+#define INDEX_MATCH_PRESENCE 2
+#define INDEX_MATCH_SUBSTRING 3
+#define INDEX_MATCH_COMPLEX 4
+static int index_subsys_index_matches_filter(indexEntry *index, Slapi_Filter *f);
+
+static void
+index_subsys_read_lock(void)
+{
+ slapi_rwlock_rdlock(theCache->cache_lock);
+}
+
+static void
+index_subsys_write_lock(void)
+{
+ slapi_rwlock_wrlock(theCache->cache_lock);
+}
+
+static void
+index_subsys_unlock(void)
+{
+ slapi_rwlock_unlock(theCache->cache_lock);
+}
+
+int
+slapi_index_entry_list_create(IndexEntryList **list)
+{
+ if (idl_api)
+ *list = (IndexEntryList *)IDList_alloc(idl_api, INDEX_IDLIST_INITIAL_SIZE);
+ else
+ *list = 0;
+
+ return !(*list);
+}
+
+int
+slapi_index_entry_list_add(IndexEntryList **list, IndexEntryID id)
+{
+ if (idl_api)
+ IDList_insert(idl_api, (IDList **)list, (ID)id);
+
+ return 0; /* no way to tell failure */
+}
+
+
+static int
+index_subsys_index_matches_filter(indexEntry *index, Slapi_Filter *f)
+{
+ int ret = INDEX_MATCH_NONE;
+
+ /* simple filters only right now */
+ if (slapi_attr_types_equivalent(index->indexedAttribute, f->f_type)) {
+ /* ok we have some type of match, lets find out which */
+
+ switch (index->indexfilter->f_choice) {
+ case LDAP_FILTER_PRESENT:
+ /* present means "x=*" */
+ if (f->f_choice == LDAP_FILTER_PRESENT)
+ ret = INDEX_MATCH_PRESENCE;
+ break;
+ case LDAP_FILTER_SUBSTRINGS:
+ /* our equality filters look like this "x=**"
+ * that means the filter will be assigned
+ * a substring f_choice by the filter code
+ * in str2filter.c
+ * but we need to differentiate so we take
+ * advantage of the fact that this creates a
+ * special substring filter with no substring
+ * to look for...
+ */
+ if (index->indexfilter->f_sub_initial == 0 &&
+ index->indexfilter->f_sub_any == 0 &&
+ index->indexfilter->f_sub_final == 0) {
+ /* this is an index equality filter */
+ if (f->f_choice == LDAP_FILTER_EQUALITY)
+ ret = INDEX_MATCH_EQUALITY;
+ } else {
+ /* this is a regualar substring filter */
+ if (f->f_choice == LDAP_FILTER_SUBSTRINGS)
+ ret = INDEX_MATCH_SUBSTRING;
+ }
+
+ break;
+
+ default:
+ /* we don't know about any other type yet */
+ break;
+ }
+ }
+
+ return ret;
+}
+
+/* index_subsys_assign_filter_decoders
+ * -----------------------------------
+ * assigns index plugins to sub-filters
+ */
+int
+index_subsys_assign_filter_decoders(Slapi_PBlock *pb)
+{
+ int rc = 0;
+ Slapi_Filter *f;
+ char *subsystem = "index_subsys_assign_filter_decoders";
+ char logbuf[1024];
+
+ if (!theCache) {
+ return rc;
+ }
+
+ /* extract the filter */
+ slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &f);
+ if (f) {
+ if (loglevel_is_set(LDAP_DEBUG_FILTER)) {
+ logbuf[0] = '\0';
+ slapi_log_err(SLAPI_LOG_DEBUG, subsystem, "before: %s\n",
+ slapi_filter_to_string(f, logbuf, sizeof(logbuf)));
+ }
+
+ /* find decoders */
+ rc = index_subsys_assign_decoders(f);
+
+ if (loglevel_is_set(LDAP_DEBUG_FILTER)) {
+ logbuf[0] = '\0';
+ slapi_log_err(SLAPI_LOG_DEBUG, subsystem, " after: %s\n",
+ slapi_filter_to_string(f, logbuf, sizeof(logbuf)));
+ }
+ }
+
+ return rc;
+}
+
+/* index_subsys_filter_decoders_done
+ * ---------------------------------
+ * removes assigned index plugins in
+ * sub-filters
+ */
+int
+index_subsys_filter_decoders_done(Slapi_PBlock *pb)
+{
+ Slapi_Filter *f;
+
+ /* extract the filter */
+ slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &f);
+
+ /* remove decoders */
+ return index_subsys_decoder_done(f);
+}
+
+
+/* index_subsys_unlink_subfilter
+ * -----------------------------
+ * removes the sub-filter from
+ * the complex filter list
+ * does NOT deallocate the sub-filter
+ */
+static int
+index_subsys_unlink_subfilter(Slapi_Filter *fcomplex, Slapi_Filter *fsub)
+{
+ int ret = -1;
+ Slapi_Filter *f;
+ Slapi_Filter *f_prev = 0;
+
+ for (f = fcomplex->f_list; f != NULL; f = f->f_next) {
+ if (f == fsub) {
+ if (f_prev) {
+ f_prev->f_next = f->f_next;
+ f->f_next = 0;
+ ret = 0;
+ break;
+ } else {
+ /* was at the beginning of the list */
+ fcomplex->f_list = f->f_next;
+ f->f_next = 0;
+ ret = 0;
+ break;
+ }
+ }
+
+ f_prev = f;
+ }
+
+ return ret;
+}
+
+/* index_subsys_index_matches_associated
+ * -------------------------------------
+ * determines if there is any kind of match
+ * between the specified type and the index.
+ *
+ * matches could be on the indexed type or
+ * on any associated attribute
+ * returns:
+ * 0 when false
+ * non-zero when true
+ */
+static int
+index_subsys_index_matches_associated(indexEntry *index, Slapi_Filter *f)
+{
+ int ret = 0;
+ char **associated_attrs = index->associated_attrs;
+
+ if (INDEX_MATCH_NONE != index_subsys_index_matches_filter(index, f)) {
+ /* matched on indexed attribute */
+ ret = -1;
+ goto bail;
+ }
+
+ /* check associated attributes */
+ if (associated_attrs) {
+ int i;
+ char *type = f->f_type;
+
+ for (i = 0; associated_attrs[i]; i++) {
+ if (slapi_attr_types_equivalent(associated_attrs[i], type)) {
+ /* matched on associated attribute */
+ ret = -1;
+ break;
+ }
+ }
+ }
+
+bail:
+ return ret;
+}
+
+
+/* index_subsys_flatten_filter
+ * ---------------------------
+ * takes a complex filter as argument (assumed)
+ * and merges all compatible complex sub-filters
+ * such that their list of sub-filters are moved
+ * to the main list of sub-filters in f.
+ *
+ * This "flattens" the filter so that there are
+ * the minimum number of nested complex filters
+ * possible.
+ *
+ * What is a "compatible complex sub-filter?"
+ * Answer: a complex sub-filter which is of the
+ * same type (AND or OR) as the containing complex
+ * filter and which is either assigned the same
+ * index decoder or no index decoder is assigned to
+ * either complex filter.
+ *
+ * This function assumes that it has already
+ * been called for every complex sub-filter of f
+ * i.e. it only looks one layer deep.
+ *
+ * Note that once a filter has been processed in
+ * this fashion, rearranging the filter based
+ * on the optimal evaluation order becomes very
+ * much simpler. It should also have benefits for
+ * performance when a filter is evaluated many
+ * times since a linear list traversal is faster than a
+ * context switch to recurse down into a complex
+ * filter structure.
+ *
+ */
+static void
+index_subsys_flatten_filter(Slapi_Filter *flist)
+{
+ struct slapi_filter *f = flist->f_list;
+ struct slapi_filter *fprev = 0;
+ struct slapi_filter *flast = 0;
+
+ while (f) {
+ if (f->assigned_decoder == flist->assigned_decoder) {
+ /* mmmk, but is the filter complex? */
+ if (f->f_choice == LDAP_FILTER_AND || f->f_choice == LDAP_FILTER_OR) {
+ if (f->f_choice == flist->f_choice) {
+ /* flatten this, and remember
+ * we expect that any complex sub-filters
+ * have already been flattened, so we
+ * simply transfer the contents of this
+ * sub-filter to the main sub-filter and
+ * remove this complex sub-filter
+ *
+ * take care not to change the filter
+ * ordering in any way (it may have been
+ * optimized)
+ */
+ struct slapi_filter *fnext = f->f_next;
+ struct slapi_filter *fsub = 0;
+
+ while (f->f_list) {
+ fsub = f->f_list;
+ index_subsys_unlink_subfilter(f, f->f_list);
+ fsub->f_next = fnext;
+
+ if (flast) {
+ /* we inserted something before - insert after */
+ flast->f_next = fsub;
+ } else {
+ /* first insertion */
+ if (fprev) {
+ fprev->f_next = fsub;
+ } else {
+ /* insert at list start */
+ flist->f_list = fsub;
+ }
+
+ fprev = fsub;
+ }
+
+ flast = fsub;
+ }
+
+ /* zero for dont recurse - recursing would
+ * be bad since we have created a mutant
+ * complex filter with no children
+ */
+ slapi_filter_free(f, 0);
+ f = fnext;
+ } else {
+ /* don't loose a nested filter having a different choice */
+ if (flast) {
+ flast->f_next = f;
+ flast = f;
+ }
+ fprev = f;
+ f = f->f_next;
+ }
+ } else {
+ /* don't loose a simple filter */
+ if (flast) {
+ flast->f_next = f;
+ flast = f;
+ }
+ fprev = f;
+ f = f->f_next;
+ }
+ } else {
+ fprev = f;
+ f = f->f_next;
+ }
+ }
+}
+
+/* index_subsys_group_decoders
+ * ---------------------------
+ * looks for grouping opportunities
+ * such that a complex filter may
+ * be assigned to a single index.
+ *
+ * it is assumed that any complex sub-filters
+ * have already been assigned decoders
+ * using this function if it
+ * was possible to do so
+ */
+static int
+index_subsys_group_decoders(Slapi_Filter *flist)
+{
+ int ret = 0;
+ struct slapi_filter *f = 0;
+ struct slapi_filter *f_indexed = 0;
+ struct slapi_filter *fhead = 0;
+ int index_count = 0;
+ int matched = 1;
+
+ switch (flist->f_choice) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ break;
+
+ default:
+ /* any other result not handled by this code */
+ goto bail;
+ }
+
+ /* make sure we start with an unassigned filter */
+ flist->assigned_decoder = 0;
+
+ /* Since this function is about optimal grouping of complex filters,
+ * lets explain what is happening here:
+ *
+ * Beyond detecting that what was passed in is already optimal,
+ * there are 4 basic problems we need to solve here:
+ *
+ * Input this function Output
+ * 1) (&(indexed)(other)(associated)) -> X -> (&(&(indexed)(associated))(other))
+ * 2) (&(&(indexed)(other))(associated)) -> X -> (&(&(indexed)(associated))(other))
+ * 3) (&(&(associated)(other))(indexed)) -> X -> (&(&(indexed)(associated))(other))
+ * 4) (&(&(indexed)(associated))(associated)) -> X -> (&(indexed)(associated)(associated))
+ *
+ * To avoid having special code for 2) and 3) we make them look like
+ * 1) by flattening the filter - note this will only flatten subfilters
+ * which have no decoder assigned since the filter we flatten has no
+ * decoder assigned - and this behaviour is exactly what we want.
+ * 4) is a special case of 1) and since that is the case, we can allow
+ * the code for 1) to process it but make sure we flatten the filter
+ * before exit. If 4) is exactly as stated without any other non-indexed
+ * or associated references then in fact it will be detected as a completely
+ * matching filter prior to reaching the code for 1).
+ */
+
+ index_subsys_flatten_filter(flist);
+ fhead = flist->f_list;
+
+ /* find the first index assigned */
+ for (f_indexed = fhead; f_indexed != NULL; f_indexed = f_indexed->f_next) {
+ if (f_indexed->assigned_decoder) {
+ /* non-null decoder means assigned */
+ break;
+ }
+ }
+
+ if (NULL == f_indexed)
+ /* nothing to process */
+ goto bail;
+
+ /* determine if whole filter matches
+ * to avoid allocations where it is
+ * not necessary
+ */
+ for (f = fhead; f != NULL; f = f->f_next) {
+ if (f->assigned_decoder != f_indexed->assigned_decoder) {
+ switch (f->f_choice) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ /*
+ * All complex subfilters are guaranteed to have the correct
+ * decoder assigned already, so this is a mismatch.
+ */
+
+ matched = 0;
+ break;
+
+ default:
+ if (!index_subsys_index_matches_associated(f_indexed->assigned_decoder, f)) {
+ matched = 0;
+ }
+ break;
+ }
+
+ if (!matched)
+ break;
+ }
+ }
+
+ if (matched) {
+ /* whole filter matches - assign to this decoder */
+ flist->assigned_decoder = f_indexed->assigned_decoder;
+ /* finally lets flatten this filter if possible
+ * Didn't we do that already? No, we flattened the
+ * filter *prior* to assigning a decoder
+ */
+ index_subsys_flatten_filter(flist);
+ goto bail;
+ }
+
+ /* whole filter does not match so,
+ * if the sub-filter count is > 2
+ * for each assigned sub-filter,
+ * match other groupable filters
+ * and extract them into another sub-filter
+ */
+
+ /* count */
+ for (f = fhead; f != NULL && index_count < 3; f = f->f_next) {
+ index_count++;
+ }
+
+ if (index_count > 2) {
+ /* this is where we start re-arranging the filter assertions
+ * into groups which can be serviced by a single plugin
+ * at this point we know that:
+ * a) the filter has at least 2 assertions that cannot be grouped
+ * b) there are more than 2 assertions and so grouping is still possible
+ */
+
+ struct slapi_filter *f_listposition = f_indexed; /* flist subfilter list iterator */
+ int main_iterate; /* controls whether to iterate to the next sub-filter of flist */
+
+ while (f_listposition) {
+ /* the target grouping container - we move sub-filters here */
+ struct slapi_filter *targetf = 0;
+
+ /* indicates we found an existing targetf */
+ int assigned = 0;
+
+ /* something to join with next compatible
+ * subfilter we find - this will be the
+ * first occurence of a filter assigned
+ * to a particular decoder
+ */
+ struct slapi_filter *saved_filter = 0;
+
+ struct slapi_filter *f_tmp = 0; /* save filter for list fixups */
+
+ /* controls whether to iterate to the
+ * next sub-filter of flist
+ * inner loop
+ */
+ int iterate = 1;
+
+ f_indexed = f_listposition;
+ main_iterate = 1;
+
+ /* finding a convenient existing sub-filter of the same
+ * type as the containing filter avoids allocation
+ * so lets look for one
+ */
+
+ for (f = fhead; f != NULL; f = f->f_next) {
+ switch (f->f_choice) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ if (f->f_choice == flist->f_choice &&
+ f->assigned_decoder == f_indexed->assigned_decoder) {
+ targetf = f;
+ assigned = 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (assigned)
+ break;
+ }
+
+ /* now look for grouping opportunities */
+ for (f = fhead; f != NULL; (iterate && f) ? f = f->f_next : f) {
+ iterate = 1;
+
+ if (f != targetf) {
+ switch (f->f_choice) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ if ((targetf && f->f_choice == targetf->f_choice) && f->assigned_decoder == f_indexed->assigned_decoder) {
+ /* ok we have a complex filter we can group - group it
+ * it is worth noting that if we got here, then we must
+ * have found a complex filter suitable for for putting
+ * sub-filters in, so there is no need to add the newly
+ * merged complex filter to the main complex filter,
+ * since it is already there
+ */
+
+ /* main filter list fix ups */
+ f_tmp = f;
+ f = f->f_next;
+ iterate = 0;
+
+ if (f_tmp == f_listposition) {
+ f_listposition = f;
+ main_iterate = 0;
+ }
+
+ /* remove f from the main complex filter */
+ index_subsys_unlink_subfilter(flist, f_tmp);
+
+
+ /* merge - note, not true merge since f gets
+ * added to targetf as a sub-filter
+ */
+ slapi_filter_join_ex(targetf->f_choice, targetf, f_tmp, 0);
+
+ /* since it was not a true merge, lets do the true merge now */
+ index_subsys_flatten_filter(targetf);
+ }
+ break;
+
+ default:
+ if (index_subsys_index_matches_associated(f_indexed->assigned_decoder, f)) {
+ if (targetf) {
+ /* main filter list fix ups */
+ f_tmp = f;
+ f = f->f_next;
+ iterate = 0;
+
+ if (f_tmp == f_listposition) {
+ f_listposition = f;
+ main_iterate = 0;
+ }
+
+ index_subsys_unlink_subfilter(flist, f_tmp);
+ targetf = slapi_filter_join_ex(targetf->f_choice, targetf, f_tmp, 0);
+ } else {
+ if (saved_filter) {
+ /* main filter list fix ups */
+ f_tmp = f;
+ f = f->f_next;
+ iterate = 0;
+
+ if (f_tmp == f_listposition) {
+ f_listposition = f;
+ main_iterate = 0;
+ }
+
+ index_subsys_unlink_subfilter(flist, f_tmp);
+ index_subsys_unlink_subfilter(flist, saved_filter);
+ targetf = slapi_filter_join_ex(flist->f_choice, saved_filter, f_tmp, 0);
+ targetf->assigned_decoder = f_indexed->assigned_decoder;
+ } else {
+ /* nothing to join so save this for
+ * when we find another compatible
+ * filter
+ */
+ saved_filter = f;
+ }
+ }
+
+ if (!assigned && targetf) {
+ /* targetf has just been created, so
+ * we must add it to the main complex filter
+ */
+ targetf->f_next = flist->f_list;
+ flist->f_list = targetf;
+ assigned = 1;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ /* iterate through the main list
+ * to the next indexed sub-filter
+ */
+ if (f_listposition &&
+ (main_iterate ||
+ (!main_iterate &&
+ !f_listposition->assigned_decoder))) {
+ if (!f_listposition->f_next) {
+ f_listposition = 0;
+ break;
+ }
+
+ for (f_listposition = f_listposition->f_next; f_listposition != NULL; f_listposition = f_listposition->f_next) {
+ if (f_listposition->assigned_decoder) {
+ /* non-null decoder means assigned */
+ break;
+ }
+ }
+ }
+ }
+ }
+
+bail:
+
+ return ret;
+}
+
+
+/* index_subsys_assign_decoders
+ * ----------------------------
+ * recurses through complex filters
+ * assigning decoders
+ */
+static int
+index_subsys_assign_decoders(Slapi_Filter *f)
+{
+ int ret = 0;
+ Slapi_Filter *subf;
+
+ switch (slapi_filter_get_choice(f)) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ case LDAP_FILTER_NOT:
+ /* assign simple filters first */
+ f->assigned_decoder = 0;
+ for (subf = f->f_list; subf != NULL; subf = subf->f_next)
+ ret = index_subsys_assign_decoders(subf);
+
+ /* now check for filter grouping opportunities... */
+ if (slapi_filter_get_choice(f) != LDAP_FILTER_NOT)
+ index_subsys_group_decoders(f);
+ else {
+ /* LDAP_FILTER_NOT is a special case
+ * the contained sub-filter determines
+ * the assigned index - the index plugin has
+ * the option to refuse to service the
+ * NOT filter when it is presented
+ */
+ f->assigned_decoder = f->f_list->assigned_decoder;
+ }
+
+ break;
+
+ default:
+ /* find a decoder that fits this simple filter */
+ ret = index_subsys_assign_decoder(f);
+ }
+
+ return ret;
+}
+
+/* index_subsys_decoder_done
+ * -------------------------
+ * recurses through complex filters
+ * removing decoders
+ */
+static int
+index_subsys_decoder_done(Slapi_Filter *f)
+{
+ int ret = 0;
+ Slapi_Filter *subf;
+ indexEntry *index;
+ indexEntry *next_index;
+
+ switch (slapi_filter_get_choice(f)) {
+ case LDAP_FILTER_AND:
+ case LDAP_FILTER_OR:
+ case LDAP_FILTER_NOT:
+ /* remove simple filters first */
+ for (subf = f->f_list; subf != NULL; subf = subf->f_next)
+ ret = index_subsys_decoder_done(subf);
+
+ break;
+
+ default:
+ /* free the decoders - shallow free */
+ index = f->assigned_decoder;
+
+ while (index) {
+ next_index = index->list.pNext;
+ slapi_ch_free((void **)index);
+ index = next_index;
+ }
+
+ f->assigned_decoder = 0;
+ }
+
+ return ret;
+}
+
+/* index_subsys_evaluate_filter
+ * ----------------------------
+ * passes the filter to the correct plugin
+ * index_subsys_assign_filter_decoders() must
+ * have been called previously on this filter
+ * this function can be safely called on all
+ * filters post index_subsys_assign_filter_decoders()
+ * whether they are assigned to a plugin or not
+ *
+ * returns:
+ * INDEX_FILTER_EVALUTED: a candidate list is produced
+ * INDEX_FILTER_UNEVALUATED: filter not considered
+ */
+int
+index_subsys_evaluate_filter(Slapi_Filter *f, Slapi_DN *namespace_dn, IndexEntryList **out)
+{
+ int ret = INDEX_FILTER_UNEVALUATED;
+ indexEntry *index = (indexEntry *)f->assigned_decoder;
+
+ if (index && theCache) {
+ index_subsys_read_lock();
+
+ /* there is a list of indexes which may
+ * provide an answer for this filter, we
+ * need to invoke the first one that matches
+ * the namespace requested
+ */
+ for (; index; index = index->list.pNext) {
+ /* check namespace */
+ if (slapi_sdn_compare(index->namespace_dn, namespace_dn)) {
+ /* wrong namespace */
+ continue;
+ }
+
+ /* execute the search */
+ if (index->lookup_func) {
+ ret = (index->lookup_func)(f, out, index->user_data);
+ break;
+ }
+ }
+
+ index_subsys_unlock();
+ }
+
+ return ret;
+}
+
+
+/* slapi_index_register_decoder
+ * ----------------------------
+ * This allows a decoder to register itself,
+ * it also builds the initial cache when first
+ * called. Note, there is no way to deregister
+ * once registered - this allows a lock free cache
+ * at the expense of a restart to clear old
+ * indexes, this shouldnt be a problem since it is
+ * not expected that indexes will be removed
+ * often.
+ */
+int
+slapi_index_register_decoder(char *plugin_id, index_validate_callback validate_op)
+{
+ static int firstTime = 1;
+ static int gotIDLapi = 0;
+ int ret = 0;
+ indexPlugin *plg;
+
+ if (firstTime) {
+ /* create the cache */
+ theCache = (globalIndexCache *)slapi_ch_malloc(sizeof(globalIndexCache));
+ if (theCache) {
+ theCache->pPlugins = 0;
+ theCache->ppIndexIndex = 0;
+ theCache->index_count = 0;
+ theCache->cache_lock = slapi_new_rwlock();
+ firstTime = 0;
+
+ if (!gotIDLapi) {
+ if (slapi_apib_get_interface(IDL_v1_0_GUID, &idl_api)) {
+ gotIDLapi = 1;
+ }
+ }
+ } else {
+ ret = -1;
+ goto bail;
+ }
+ }
+
+ index_subsys_write_lock();
+
+ /* add the index decoder to the cache - no checks, better register once only*/
+ plg = (indexPlugin *)slapi_ch_malloc(sizeof(indexPlugin));
+ if (plg) {
+ plg->id = slapi_ch_strdup(plugin_id);
+ plg->indexes = 0;
+ plg->validate_op = validate_op;
+
+ /* we always add to the start of the linked list */
+ plg->list.pPrev = 0;
+
+ if (theCache->pPlugins) {
+ plg->list.pNext = theCache->pPlugins;
+ theCache->pPlugins->list.pPrev = plg;
+ } else
+ plg->list.pNext = 0;
+
+
+ theCache->pPlugins = plg;
+ } else
+ ret = -1;
+
+ index_subsys_unlock();
+
+bail:
+ return ret;
+}
+
+
+/* slapi_index_register_index
+ * --------------------------
+ * a plugin that has registered itself may
+ * then proceed to register individual indexes
+ * that it looks after. This function adds
+ * the indexes to the plugin cache.
+ */
+int
+slapi_index_register_index(char *plugin_id, indexed_item *registration_item, void *user_data)
+{
+ int ret = 0;
+ indexPlugin *plg;
+ indexEntry *index;
+ int a_matched_index = 0;
+ Slapi_Filter *tmp_f = slapi_str2filter(registration_item->index_filter);
+ Slapi_Backend *be;
+
+ if (!theCache || !tmp_f)
+ return -1;
+
+ index_subsys_write_lock();
+
+ /* first lets find the plugin */
+ plg = theCache->pPlugins;
+
+ while (plg) {
+ if (!slapi_UTF8CASECMP(plugin_id, plg->id)) {
+ /* found plugin */
+ break;
+ }
+
+ plg = plg->list.pNext;
+ }
+
+ if (0 == plg) {
+ /* not found */
+ ret = -1;
+ goto bail;
+ }
+
+ /* map the namespace dn to a backend dn */
+ be = slapi_be_select(registration_item->namespace_dn);
+
+ if (be == defbackend_get_backend()) {
+ ret = -1;
+ goto bail;
+ }
+
+ /* now add the new index - we shall assume indexes
+ * will not be registered twice by different plugins,
+ * in that event, the last one added wins
+ * the first matching index in the list is always
+ * the current one, other matching indexes are ignored
+ * therefore reregistering an index with NULL
+ * callbacks disables the index for that plugin
+ */
+
+ /* find the index if already registered */
+
+ index = plg->indexes;
+
+ while (index) {
+ if (index_subsys_index_matches_filter(index, tmp_f)) {
+ /* found it - free what is currently there, it will be replaced */
+ slapi_ch_free((void **)&index->indexfilterstr);
+ slapi_filter_free(index->indexfilter, 1);
+ slapi_ch_free((void **)&index->indexedAttribute);
+
+ charray_free(index->associated_attrs);
+ index->associated_attrs = 0;
+
+ a_matched_index = 1;
+ break;
+ }
+
+ index = index->list.pNext;
+ }
+
+ if (!index)
+ index = (indexEntry *)slapi_ch_calloc(1, sizeof(indexEntry));
+
+ index->indexfilterstr = slapi_ch_strdup(registration_item->index_filter);
+ index->indexfilter = tmp_f;
+ index->lookup_func = registration_item->search_op;
+ index->user_data = user_data;
+
+ index->namespace_dn = (Slapi_DN *)slapi_be_getsuffix(be, 0);
+
+ /* for now, we support simple filters only */
+ index->indexedAttribute = slapi_ch_strdup(index->indexfilter->f_type);
+
+ /* add associated attributes */
+ if (registration_item->associated_attrs) {
+ index->associated_attrs =
+ cool_charray_dup(registration_item->associated_attrs);
+ }
+
+ if (!a_matched_index) {
+ if (plg->indexes) {
+ index->list.pNext = plg->indexes;
+ plg->indexes->list.pPrev = plg;
+ } else
+ index->list.pNext = 0;
+
+ index->list.pPrev = 0;
+
+ plg->indexes = index;
+
+ theCache->index_count++;
+ }
+
+/* now we need to rebuild the index (onto the indexed items)
+ * this is a bit inefficient since
+ * every new index that is added triggers
+ * an index rebuild - but this is countered
+ * by the fact this will probably happen once
+ * at start up most of the time, and very rarely
+ * otherwise, so normal server performance should
+ * not be unduly effected effected
+ * we take care to build the index and only then swap it in
+ * for the old one
+ * PARPAR: we need to RW (or maybe a ref count) lock here
+ * only alternative would be to not have an index :(
+ * for few plugins with few indexes thats a possibility
+ * traditionally many indexes have not been a good idea
+ * anyway so...
+ */
+
+/* indexIndex = (indexEntry**)slapi_ch_malloc(sizeof(indexEntry*) * (theCache->index_count+1));
+*/
+/* for now, lets see how fast things are without an index
+ * that should not be a problem at all to begin with since
+ * presence will be the only index decoder. Additionally,
+ * adding an index means we need locks - um, no.
+ * so no more to do
+ */
+
+bail:
+ index_subsys_unlock();
+
+ return ret;
+}
+
+/* index_subsys_index_matches_index
+ * --------------------------------
+ * criteria for a match is that the types
+ * are the same and that all the associated
+ * attributes that are configured for cmp_to
+ * are also in cmp_with.
+ */
+int
+index_subsys_index_matches_index(indexEntry *cmp_to, indexEntry *cmp_with)
+{
+ int ret = 0;
+
+ if (slapi_attr_types_equivalent(cmp_to->indexedAttribute, cmp_with->indexedAttribute)) {
+ /* now check associated */
+ if (cmp_to->associated_attrs) {
+ if (cmp_with->associated_attrs) {
+ int x, y;
+
+ ret = 1;
+
+ for (x = 0; cmp_to->associated_attrs[x] && ret == 1; x++) {
+ ret = 0;
+
+ for (y = 0; cmp_with->associated_attrs[y]; y++) {
+ if (slapi_attr_types_equivalent(
+ cmp_to->associated_attrs[x],
+ cmp_with->associated_attrs[y])) {
+ /* matched on associated attribute */
+ ret = 1;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ /* no associated is an auto match */
+ ret = 1;
+ }
+ }
+
+ return ret;
+}
+
+indexEntry *
+index_subsys_index_shallow_dup(indexEntry *dup_this)
+{
+ indexEntry *ret = (indexEntry *)slapi_ch_calloc(1, sizeof(indexEntry));
+
+ /* shallow copy - dont copy linked list pointers */
+ ret->indexedAttribute = dup_this->indexedAttribute;
+ ret->indexfilter = dup_this->indexfilter;
+ ret->indexfilterstr = dup_this->indexfilterstr;
+ ret->user_data = dup_this->user_data;
+ ret->namespace_dn = dup_this->namespace_dn;
+ ret->lookup_func = dup_this->lookup_func;
+ ret->associated_attrs = dup_this->associated_attrs;
+
+ return ret;
+}
+
+/* index_subsys_assign_decoder
+ * ---------------------------
+ * finds a decoder which will service
+ * the filter if one is available and assigns
+ * the decoder to the filter. Currently this
+ * function supports only simple filters, but
+ * may in the future support complex filter
+ * assignment (possibly including filter rewriting
+ * to make more matches possible)
+ *
+ * populates f->alternate_decoders if more than one
+ * index could deal with a filter - only filters that
+ * have a match with all associated attributes of the
+ * first found filter are said to match - their
+ * namespaces may be different
+ */
+static int
+index_subsys_assign_decoder(Slapi_Filter *f)
+{
+ int ret = 0; /* always succeed */
+ indexPlugin *plg;
+ indexEntry *index = 0;
+ indexEntry *last = 0;
+
+ f->assigned_decoder = 0;
+
+ if (!theCache)
+ return 0;
+
+ index_subsys_read_lock();
+
+ plg = theCache->pPlugins;
+
+ while (plg) {
+ index = plg->indexes;
+
+ while (index) {
+ if (INDEX_MATCH_NONE != index_subsys_index_matches_filter(index, f)) {
+ /* we have a match, assign this decoder if not disabled */
+ if (index->lookup_func) {
+ if (!f->assigned_decoder) {
+ f->assigned_decoder = index_subsys_index_shallow_dup(index);
+ last = f->assigned_decoder;
+ } else {
+ /* add to alternate list - we require that they all
+ * have the same associated attributes configuration for now
+ * though they may have different namespaces
+ */
+ if (index_subsys_index_matches_index(f->assigned_decoder, index) && last) {
+ /* add to end */
+ last->list.pNext = index_subsys_index_shallow_dup(index);
+ last = last->list.pNext;
+ }
+ }
+ } else {
+ /* index disabled, so we must allow another plugin to
+ * get a crack at servicing the index
+ */
+ break;
+ }
+ }
+
+ index = index->list.pNext;
+ }
+
+ plg = plg->list.pNext;
+ }
+
+ index_subsys_unlock();
+
+ return ret;
+}
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 2104592f6..274f4ec5f 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1724,6 +1724,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
(*(struct slapi_filter **)value) = pblock->pb_op->o_params.p.p_search.search_filter;
}
break;
+ case SLAPI_SEARCH_FILTER_INTENDED:
+ if (pblock->pb_op != NULL) {
+ if (pblock->pb_op->o_params.p.p_search.search_filter_intended) {
+ (*(struct slapi_filter **)value) = pblock->pb_op->o_params.p.p_search.search_filter_intended;
+ } else {
+ (*(struct slapi_filter **)value) = pblock->pb_op->o_params.p.p_search.search_filter;
+ }
+ }
+ break;
case SLAPI_SEARCH_STRFILTER:
if (pblock->pb_op != NULL) {
(*(char **)value) = pblock->pb_op->o_params.p.p_search.search_strfilter;
@@ -3610,6 +3619,13 @@ slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_SEARCH_FILTER:
if (pblock->pb_op != NULL) {
pblock->pb_op->o_params.p.p_search.search_filter = (struct slapi_filter *)value;
+ /* Prevent UAF by reseting this on set. */
+ pblock->pb_op->o_params.p.p_search.search_filter_intended = NULL;
+ }
+ break;
+ case SLAPI_SEARCH_FILTER_INTENDED:
+ if (pblock->pb_op != NULL) {
+ pblock->pb_op->o_params.p.p_search.search_filter_intended = (struct slapi_filter *)value;
}
break;
case SLAPI_SEARCH_STRFILTER:
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index a4d27c1a2..1aedc5eda 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -7415,6 +7415,7 @@ typedef enum _slapi_op_note_t {
#define SLAPI_SEARCH_REQATTRS 1161
#define SLAPI_SEARCH_ATTRSONLY 117
#define SLAPI_SEARCH_IS_AND 118
+#define SLAPI_SEARCH_FILTER_INTENDED 119
/* abandon arguments */
#define SLAPI_ABANDON_MSGID 120
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index b875f46c3..4789e87e7 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -393,6 +393,7 @@ void ndn_cache_get_stats(uint64_t *hits, uint64_t *tries, uint64_t *size, uint64
int filter_flag_is_set(const Slapi_Filter *f, unsigned char flag);
char *slapi_filter_to_string(const Slapi_Filter *f, char *buffer, size_t bufsize);
char *slapi_filter_to_string_internal(const struct slapi_filter *f, char *buf, size_t *bufsize);
+void slapi_filter_optimise(Slapi_Filter *f);
/* operation.c */
@@ -592,6 +593,7 @@ typedef struct slapi_operation_parameters
int search_sizelimit;
int search_timelimit;
struct slapi_filter *search_filter;
+ struct slapi_filter *search_filter_intended;
char *search_strfilter;
char **search_attrs;
int search_attrsonly;
diff --git a/test/libslapd/filter/optimise.c b/test/libslapd/filter/optimise.c
new file mode 100644
index 000000000..bcf4ccd79
--- /dev/null
+++ b/test/libslapd/filter/optimise.c
@@ -0,0 +1,83 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2017 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#include "../../test_slapd.h"
+
+/* To access filter optimise */
+#include <slapi-private.h>
+
+void
+test_libslapd_filter_optimise(void **state __attribute__((unused)))
+{
+ char *test_filters[] = {
+ "(&(uid=uid1)(sn=last1)(givenname=first1))",
+ "(&(uid=uid1)(&(sn=last1)(givenname=first1)))",
+ "(&(uid=uid1)(&(&(sn=last1))(&(givenname=first1))))",
+ "(&(uid=*)(sn=last3)(givenname=*))",
+ "(&(uid=*)(&(sn=last3)(givenname=*)))",
+ "(&(uid=uid5)(&(&(sn=*))(&(givenname=*))))",
+ "(&(objectclass=*)(uid=*)(sn=last*))",
+ "(&(objectclass=*)(uid=*)(sn=last1))",
+
+ "(|(uid=uid1)(sn=last1)(givenname=first1))",
+ "(|(uid=uid1)(|(sn=last1)(givenname=first1)))",
+ "(|(uid=uid1)(|(|(sn=last1))(|(givenname=first1))))",
+ "(|(objectclass=*)(sn=last1)(|(givenname=first1)))",
+ "(|(&(objectclass=*)(sn=last1))(|(givenname=first1)))",
+ "(|(&(objectclass=*)(sn=last))(|(givenname=first1)))",
+
+ "(&(uid=uid1)(!(cn=NULL)))",
+ "(&(!(cn=NULL))(uid=uid1))",
+ "(&(uid=*)(&(!(uid=1))(!(givenname=first1))))",
+
+ "(&(|(uid=uid1)(uid=NULL))(sn=last1))",
+ "(&(|(uid=uid1)(uid=NULL))(!(sn=NULL)))",
+ "(&(|(uid=uid1)(sn=last2))(givenname=first1))",
+ "(|(&(uid=uid1)(!(uid=NULL)))(sn=last2))",
+ "(|(&(uid=uid1)(uid=NULL))(sn=last2))",
+ "(&(uid=uid5)(sn=*)(cn=*)(givenname=*)(uid=u*)(sn=la*)(cn=full*)(givenname=f*)(uid>=u)(!(givenname=NULL)))",
+ "(|(&(objectclass=*)(sn=last))(&(givenname=first1)))",
+
+ "(&(uid=uid1)(sn=last1)(givenname=NULL))",
+ "(&(uid=uid1)(&(sn=last1)(givenname=NULL)))",
+ "(&(uid=uid1)(&(&(sn=last1))(&(givenname=NULL))))",
+ "(&(uid=uid1)(&(&(sn=last1))(&(givenname=NULL)(sn=*)))(|(sn=NULL)))",
+ "(&(uid=uid1)(&(&(sn=last*))(&(givenname=first*)))(&(sn=NULL)))",
+
+ "(|(uid=NULL)(sn=NULL)(givenname=NULL))",
+ "(|(uid=NULL)(|(sn=NULL)(givenname=NULL)))",
+ "(|(uid=NULL)(|(|(sn=NULL))(|(givenname=NULL))))",
+
+ "(uid>=uid3)",
+ "(&(uid=*)(uid>=uid3))",
+ "(|(uid>=uid3)(uid<=uid5))",
+ "(&(uid>=uid3)(uid<=uid5))",
+ "(|(&(uid>=uid3)(uid<=uid5))(uid=*))",
+
+ "(|(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)(uid=*)"
+ "(uid=*))",
+ NULL
+ };
+
+ for (size_t i = 0; test_filters[i] != NULL; i++) {
+ char *filter_str = slapi_ch_strdup(test_filters[i]);
+
+ struct slapi_filter *filter = slapi_str2filter(filter_str);
+ slapi_filter_optimise(filter);
+ slapi_filter_free(filter, 1);
+ slapi_ch_free_string(&filter_str);
+ }
+}
+
diff --git a/test/libslapd/test.c b/test/libslapd/test.c
index 0a81076bf..32d0cbe0f 100644
--- a/test/libslapd/test.c
+++ b/test/libslapd/test.c
@@ -30,6 +30,7 @@ run_libslapd_tests(void)
cmocka_unit_test(test_libslapd_operation_v3c_target_spec),
cmocka_unit_test(test_libslapd_counters_atomic_usage),
cmocka_unit_test(test_libslapd_counters_atomic_overflow),
+ cmocka_unit_test(test_libslapd_filter_optimise),
cmocka_unit_test(test_libslapd_pal_meminfo),
cmocka_unit_test(test_libslapd_util_cachesane),
};
diff --git a/test/test_slapd.h b/test/test_slapd.h
index f517e9ddf..63e0ffc90 100644
--- a/test/test_slapd.h
+++ b/test/test_slapd.h
@@ -27,6 +27,9 @@ int run_plugin_tests(void);
/* libslapd */
void test_libslapd_hello(void **state);
+/* libslapd-filter-optimise */
+void test_libslapd_filter_optimise(void **state);
+
/* libslapd-pblock-analytics */
void test_libslapd_pblock_analytics(void **state);
| 0 |
6d17ca7df0fdd58175ff03ded410412400780065
|
389ds/389-ds-base
|
Bump version to 2.0.2
|
commit 6d17ca7df0fdd58175ff03ded410412400780065
Author: Mark Reynolds <[email protected]>
Date: Thu Jan 14 13:16:20 2021 -0500
Bump version to 2.0.2
diff --git a/VERSION.sh b/VERSION.sh
index 35256ef43..af9e99c77 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -10,7 +10,7 @@ vendor="389 Project"
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=2
VERSION_MINOR=0
-VERSION_MAINT=1
+VERSION_MAINT=2
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
| 0 |
95094b83959c600871a7153b29f939795669ee13
|
389ds/389-ds-base
|
Resolves: bug 244475
Bug Description: crash at startup with new ldap sdk on 64-bit platform
Reviewed by: nkinder (Thanks!)
Fix Description: I went ahead and cleaned up or removed the incorrect ber code. We do not need to use LBER_SOCKBUF_OPT_DESC or LBER_SOCKBUF_OPT_READ_FN or LBER_SOCKBUF_OPT_WRITE_FN. I removed an unnecessary malloc/free and just used the stack as we do everywhere else in the code. It looks as though the start_tls cleanup code is almost never used - the code assumes that when you do a start_tls, that stays in force throughout the lifetime of the connection. Removing this code now should insulate us from future ldap c sdk changes.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
|
commit 95094b83959c600871a7153b29f939795669ee13
Author: Rich Megginson <[email protected]>
Date: Wed Oct 10 01:55:36 2007 +0000
Resolves: bug 244475
Bug Description: crash at startup with new ldap sdk on 64-bit platform
Reviewed by: nkinder (Thanks!)
Fix Description: I went ahead and cleaned up or removed the incorrect ber code. We do not need to use LBER_SOCKBUF_OPT_DESC or LBER_SOCKBUF_OPT_READ_FN or LBER_SOCKBUF_OPT_WRITE_FN. I removed an unnecessary malloc/free and just used the stack as we do everywhere else in the code. It looks as though the start_tls cleanup code is almost never used - the code assumes that when you do a start_tls, that stays in force throughout the lifetime of the connection. Removing this code now should insulate us from future ldap c sdk changes.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 8d4f2f60d..38c4e2365 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2242,13 +2242,9 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
}
PR_Lock( conn->c_mutex );
-#if !defined( XP_WIN32 )
- ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd);
-#else
+#if defined( XP_WIN32 )
if( !secure )
ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&ns);
- else
- ber_sockbuf_set_option(conn->c_sb,LBER_SOCKBUF_OPT_DESC,&pr_clonefd);
#endif
conn->c_sd = ns;
@@ -2288,13 +2284,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) pr_clonefd;
ber_sockbuf_set_option( conn->c_sb,
LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
-
- /* changed here by Cheston
- ber_sockbuf_set_option( conn->c_sb,
- LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function );
- ber_sockbuf_set_option( conn->c_sb,
- LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function );
- */
} else {
struct lber_x_ext_io_fns func_pointers;
memset(&func_pointers, 0, sizeof(func_pointers));
@@ -2309,12 +2298,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
#endif
ber_sockbuf_set_option( conn->c_sb,
LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
- /*
- ber_sockbuf_set_option( conn->c_sb,
- LBER_SOCKBUF_OPT_READ_FN, (void *)read_function );
- ber_sockbuf_set_option( conn->c_sb,
- LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function );
- */
}
if( secure && config_get_SSLclientAuth() != SLAPD_SSLCLIENTAUTH_OFF ) {
diff --git a/ldap/servers/slapd/start_tls_extop.c b/ldap/servers/slapd/start_tls_extop.c
index 3b4fadcbb..d5e2b98b9 100644
--- a/ldap/servers/slapd/start_tls_extop.c
+++ b/ldap/servers/slapd/start_tls_extop.c
@@ -277,24 +277,17 @@ start_tls( Slapi_PBlock *pb )
secure = 1;
ns = configure_pr_socket( &newsocket, secure, 0 /*never local*/ );
-
- /*
- ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_DESC, &newsocket );
- ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)secure_read_function );
- ber_sockbuf_set_option( conn->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)secure_write_function );
- */
-
/*changed to */
{
- struct lber_x_ext_io_fns *func_pointers = malloc(LBER_X_EXTIO_FNS_SIZE);
- func_pointers->lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
- func_pointers->lbextiofn_read = secure_read_function;
- func_pointers->lbextiofn_write = secure_write_function;
- func_pointers->lbextiofn_writev = NULL;
- func_pointers->lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket;
+ struct lber_x_ext_io_fns func_pointers;
+ memset(&func_pointers, 0, sizeof(func_pointers));
+ func_pointers.lbextiofn_size = LBER_X_EXTIO_FNS_SIZE;
+ func_pointers.lbextiofn_read = secure_read_function;
+ func_pointers.lbextiofn_write = secure_write_function;
+ func_pointers.lbextiofn_writev = NULL;
+ func_pointers.lbextiofn_socket_arg = (struct lextiof_socket_private *) newsocket;
ber_sockbuf_set_option( conn->c_sb,
- LBER_SOCKBUF_OPT_EXT_IO_FNS, func_pointers);
- free(func_pointers);
+ LBER_SOCKBUF_OPT_EXT_IO_FNS, &func_pointers);
}
conn->c_flags |= CONN_FLAG_SSL;
conn->c_flags |= CONN_FLAG_START_TLS;
@@ -420,26 +413,17 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
secure = 0;
ns = configure_pr_socket( &(c->c_prfd), secure, 0 /*never local*/ );
- ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &(c->c_prfd) );
-
#else
ns = PR_FileDesc2NativeHandle( c->c_prfd );
c->c_prfd = NULL;
configure_ns_socket( &ns );
-
- ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_DESC, &ns );
-
#endif
c->c_sd = ns;
c->c_flags &= ~CONN_FLAG_SSL;
c->c_flags &= ~CONN_FLAG_START_TLS;
- ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_READ_FN, (void *)read_function );
- ber_sockbuf_set_option( c->c_sb, LBER_SOCKBUF_OPT_WRITE_FN, (void *)write_function );
-
-
/* authentication & authorization credentials must be set to "anonymous". */
bind_credentials_clear( c, PR_FALSE, PR_TRUE );
| 0 |
b6397cbbb06585694f3395505b2bba5b669f9cab
|
389ds/389-ds-base
|
Resolves: #237731
Summary: Random SASL GSSAPI test failure on shadowfoot (Comment #7)
Changes: If PR_Recv in sasl_recv_connection gets EAGAIN (== errno 11),
check whether it should be retried as being done for "a temporary
non-blocking I/O error".
|
commit b6397cbbb06585694f3395505b2bba5b669f9cab
Author: Noriko Hosoi <[email protected]>
Date: Fri Apr 27 18:00:21 2007 +0000
Resolves: #237731
Summary: Random SASL GSSAPI test failure on shadowfoot (Comment #7)
Changes: If PR_Recv in sasl_recv_connection gets EAGAIN (== errno 11),
check whether it should be retried as being done for "a temporary
non-blocking I/O error".
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 8ac98770f..21ea36b62 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -1745,7 +1745,8 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
}
/* err = PR_GetError(); */
/* If we would block, we need to poll for a while */
- if ( SLAPD_PR_WOULD_BLOCK_ERROR( err ) ) {
+ if ( SLAPD_PR_WOULD_BLOCK_ERROR( err ) ||
+ SLAPD_SYSTEM_WOULD_BLOCK_ERROR( err ) ) {
struct PRPollDesc pr_pd;
PRIntervalTime timeout = PR_MillisecondsToInterval(CONN_TURBO_TIMEOUT_INTERVAL);
pr_pd.fd = (PRFileDesc *)conn->c_prfd;
| 0 |
4f05b2710b50aa10857c414ae06214c21bb551dd
|
389ds/389-ds-base
|
bump version to 1.3.5.a1
|
commit 4f05b2710b50aa10857c414ae06214c21bb551dd
Author: Noriko Hosoi <[email protected]>
Date: Fri Jun 19 13:58:23 2015 -0700
bump version to 1.3.5.a1
diff --git a/VERSION.sh b/VERSION.sh
index 78fd85f17..46bd1b32b 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=4
+VERSION_MAINT=5
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
| 0 |
dc33f18501bce10785f9a254a95ad73dd1069312
|
389ds/389-ds-base
|
Trac Ticket #536 - Clean up compiler warnings for 1.3
https://fedorahosted.org/389/ticket/536
Description: Cleaning up compiler warnings by:
- declaring config_get_schemamod in proto-slap.h
- putting parentheses around assignment
- explicitly casting to discard 'const'
|
commit dc33f18501bce10785f9a254a95ad73dd1069312
Author: Noriko Hosoi <[email protected]>
Date: Mon Dec 10 11:12:06 2012 -0800
Trac Ticket #536 - Clean up compiler warnings for 1.3
https://fedorahosted.org/389/ticket/536
Description: Cleaning up compiler warnings by:
- declaring config_get_schemamod in proto-slap.h
- putting parentheses around assignment
- explicitly casting to discard 'const'
diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c
index 3c062f164..d7e4d04f4 100644
--- a/ldap/servers/slapd/attrsyntax.c
+++ b/ldap/servers/slapd/attrsyntax.c
@@ -823,7 +823,7 @@ slapi_attr_is_dn_syntax_type(char *type)
asi = attr_syntax_get_by_name(type);
if (asi && asi->asi_plugin) { /* If not set, there is no way to get the info */
- if (syntaxoid = asi->asi_plugin->plg_syntax_oid) {
+ if ((syntaxoid = asi->asi_plugin->plg_syntax_oid)) {
dn_syntax = ((0 == strcmp(syntaxoid, NAMEANDOPTIONALUID_SYNTAX_OID))
|| (0 == strcmp(syntaxoid, DN_SYNTAX_OID)));
}
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 53d873629..fd404321f 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -704,9 +704,9 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
if ( (NULL != pdse) && (NULL != filename) )
{
/* check if the "real" file exists and cam be used, if not try tmp as backup */
- rc = dse_check_file(filename, pdse->dse_tmpfile);
+ rc = dse_check_file((char *)filename, pdse->dse_tmpfile);
if (!rc)
- rc = dse_check_file(filename, pdse->dse_fileback);
+ rc = dse_check_file((char *)filename, pdse->dse_fileback);
if ( (rc = PR_GetFileInfo( filename, &prfinfo )) != PR_SUCCESS )
{
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 37b46473f..b5940259a 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -551,6 +551,8 @@ size_t config_get_ndn_cache_size();
int config_get_ndn_cache_enabled();
char *config_get_allowed_sasl_mechs();
int config_set_allowed_sasl_mechs(const char *attrname, char *value, char *errorbuf, int apply);
+int config_get_schemamod();
+
PLHashNumber hashNocaseString(const void *key);
PRIntn hashNocaseCompare(const void *v1, const void *v2);
| 0 |
088133a6cab5b7d8fb54108213179bb3c48d78be
|
389ds/389-ds-base
|
Ticket 332 - wrong argument count in ldif2db
Description: The arg count check should of been 4 or less, not 5 or less.
https://fedorahosted.org/389/ticket/332
|
commit 088133a6cab5b7d8fb54108213179bb3c48d78be
Author: Mark Reynolds <[email protected]>
Date: Fri Mar 8 09:19:38 2013 -0500
Ticket 332 - wrong argument count in ldif2db
Description: The arg count check should of been 4 or less, not 5 or less.
https://fedorahosted.org/389/ticket/332
diff --git a/ldap/admin/src/scripts/ldif2db.in b/ldap/admin/src/scripts/ldif2db.in
index 92ac5f403..2db3287a8 100755
--- a/ldap/admin/src/scripts/ldif2db.in
+++ b/ldap/admin/src/scripts/ldif2db.in
@@ -92,7 +92,7 @@ fi
configdir="@instconfigdir@/slapd-$servid"
-if [ $# -lt 5 ]
+if [ $# -lt 4 ]
then
usage
exit 1
| 0 |
4a0199b3c3a73b094a7bff64404a632c3bfe7072
|
389ds/389-ds-base
|
Fri Jun 7 10:41:00 2013 -0400
Coverity Fixes (Part 6)
11611 - Unchecked value (main.c)
11671 - Copy-paste error (cb_instance.c)
11704 - Dereference after null check (repl5_replica_config.c)
11766 - Resource leak (dblayer.c)
11873 - Argument can not be negative (ldclt/data.c)
Jenkins error: mmldif.c
11876 - Deference before null check (cl5_clcache.c)
https://bugzilla.redhat.com/show_bug.cgi?id=970221
Reviewed by: Rich(Thanks!)
|
commit 4a0199b3c3a73b094a7bff64404a632c3bfe7072
Author: Mark Reynolds <[email protected]>
Date: Fri Jun 7 11:15:27 2013 -0400
Fri Jun 7 10:41:00 2013 -0400
Coverity Fixes (Part 6)
11611 - Unchecked value (main.c)
11671 - Copy-paste error (cb_instance.c)
11704 - Dereference after null check (repl5_replica_config.c)
11766 - Resource leak (dblayer.c)
11873 - Argument can not be negative (ldclt/data.c)
Jenkins error: mmldif.c
11876 - Deference before null check (cl5_clcache.c)
https://bugzilla.redhat.com/show_bug.cgi?id=970221
Reviewed by: Rich(Thanks!)
diff --git a/ldap/servers/plugins/chainingdb/cb_instance.c b/ldap/servers/plugins/chainingdb/cb_instance.c
index 8fb694a83..95781b532 100644
--- a/ldap/servers/plugins/chainingdb/cb_instance.c
+++ b/ldap/servers/plugins/chainingdb/cb_instance.c
@@ -1437,7 +1437,7 @@ static int cb_instance_bindmech_set(void *arg, void *value, char *errorbuf, int
charray_add(&inst->pool->waste_basket,inst->pool->mech);
}
if (inst->bind_pool->mech) {
- charray_add(&inst->pool->waste_basket,inst->bind_pool->mech);
+ charray_add(&inst->bind_pool->waste_basket,inst->bind_pool->mech);
}
rc=CB_REOPEN_CONN;
}
diff --git a/ldap/servers/plugins/replication/cl5_clcache.c b/ldap/servers/plugins/replication/cl5_clcache.c
index 738e4cb97..1c20b92d5 100644
--- a/ldap/servers/plugins/replication/cl5_clcache.c
+++ b/ldap/servers/plugins/replication/cl5_clcache.c
@@ -734,9 +734,7 @@ clcache_skip_change ( CLC_Buffer *buf )
(csn_get_seqnum(buf->buf_current_csn) ==
csn_get_seqnum(cscb->local_maxcsn) + 1) )
{
- if(cscb->local_maxcsn){
- csn_init_by_csn ( cscb->local_maxcsn, buf->buf_current_csn );
- }
+ csn_init_by_csn ( cscb->local_maxcsn, buf->buf_current_csn );
if(cscb->consumer_maxcsn){
csn_init_by_csn ( cscb->consumer_maxcsn, buf->buf_current_csn );
}
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 7d83c99fa..592faeb67 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -2454,7 +2454,7 @@ delete_aborted_rid(Replica *r, ReplicaId rid, char *repl_root, int skip){
static void
delete_cleaned_rid_config(cleanruv_data *clean_data)
{
- Slapi_PBlock *pb = slapi_pblock_new();
+ Slapi_PBlock *pb;
Slapi_Entry **entries = NULL;
LDAPMod *mods[2];
LDAPMod mod;
@@ -2483,6 +2483,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
/*
* Search the config for the exact attribute value to delete
*/
+ pb = slapi_pblock_new();
dn = replica_get_dn(clean_data->replica);
slapi_search_internal_set_pb(pb, dn, LDAP_SCOPE_SUBTREE, "nsds5ReplicaCleanRUV=*", NULL, 0, NULL, NULL,
(void *)plugin_get_default_component_id(), 0);
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index abb64e2b0..20af828e9 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -3087,6 +3087,8 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
int return_value = 0;
DB *dbp = NULL;
char *subname = NULL;
+ char inst_dir[MAXPATHLEN];
+ char *inst_dirp = NULL;
PR_ASSERT(NULL != li);
priv = (dblayer_private*)li->li_dblayer_private;
@@ -3150,8 +3152,6 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
inst->inst_parent_dir_name) > 0) &&
!dblayer_inst_exists(inst, file_name))
{
- char inst_dir[MAXPATHLEN];
- char *inst_dirp = NULL;
char *abs_file_name = NULL;
/* create a file with abs path, then try again */
@@ -3163,9 +3163,6 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
}
abs_file_name = slapi_ch_smprintf("%s%c%s",
inst_dirp, get_sep(inst_dirp), file_name);
- if (inst_dirp != inst_dir){
- slapi_ch_free_string(&inst_dirp);
- }
DB_OPEN(pENV->dblayer_openflags,
dbp, NULL/* txnid */, abs_file_name, subname, DB_BTREE,
open_flags, priv->dblayer_file_mode, return_value);
@@ -3198,6 +3195,9 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
out:
slapi_ch_free((void**)&file_name);
slapi_ch_free((void**)&rel_path);
+ if (inst_dirp != inst_dir){
+ slapi_ch_free_string(&inst_dirp);
+ }
/* close the database handle to avoid handle leak */
if (dbp && (return_value != 0)) {
dblayer_close_file(&dbp);
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 321511d97..a17a2c598 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -232,7 +232,10 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn, PRBool both)
if((ptr=strrchr(log,'/'))==NULL)
{
LDAPDebug(LDAP_DEBUG_ANY, "Caution changing ownership of ./%s \n",name,0,0);
- slapd_chown_if_not_owner(log, pw->pw_uid, -1 );
+ if(slapd_chown_if_not_owner(log, pw->pw_uid, -1 )){
+ LDAPDebug(LDAP_DEBUG_ANY, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
+ log, errno, slapd_system_strerror(errno));
+ }
rc=1;
} else if(log==ptr) {
LDAPDebug(LDAP_DEBUG_ANY, "Caution changing ownership of / directory and its contents to %s\n",pw->pw_name,0,0);
@@ -247,7 +250,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn, PRBool both)
while( (entry = PR_ReadDir(dir , PR_SKIP_BOTH )) !=NULL )
{
PR_snprintf(file,MAXPATHLEN+1,"%s/%s",log,entry->name);
- if((rc = slapd_chown_if_not_owner( file, pw->pw_uid, both?pw->pw_gid:-1 )) != 0){
+ if(slapd_chown_if_not_owner( file, pw->pw_uid, both?pw->pw_gid:-1 )){
LDAPDebug(LDAP_DEBUG_ANY, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
file, errno, slapd_system_strerror(errno));
}
diff --git a/ldap/servers/slapd/tools/ldclt/data.c b/ldap/servers/slapd/tools/ldclt/data.c
index f6dd4ef47..45016d8f2 100644
--- a/ldap/servers/slapd/tools/ldclt/data.c
+++ b/ldap/servers/slapd/tools/ldclt/data.c
@@ -143,7 +143,7 @@ int loadImages (
char *fileName; /* As read from the system */
char name [1024]; /* To build the full path */
struct stat stat_buf; /* To read the image size */
- int fd; /* To open the image */
+ int fd = -1; /* To open the image */
int ret; /* Return value */
int rc = 0;
@@ -303,11 +303,13 @@ int loadImages (
*/
if (close (fd) < 0)
{
- perror (name);
- fprintf (stderr, "Cannot close(%s)\n", name);
- fflush (stderr);
- rc = -1;
- goto exit;
+ perror (name);
+ fprintf (stderr, "Cannot close(%s)\n", name);
+ fflush (stderr);
+ rc = -1;
+ goto exit;
+ } else {
+ fd = -1;
}
}
#ifdef _WIN32
@@ -335,7 +337,8 @@ exit:
#ifdef _WIN32
if (findPath) free (findPath);
#endif
- close(fd);
+ if(fd != -1)
+ close(fd);
return rc;
}
diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c
index fb97129f5..1f0197689 100644
--- a/ldap/servers/slapd/tools/mmldif.c
+++ b/ldap/servers/slapd/tools/mmldif.c
@@ -729,7 +729,7 @@ readrec(edfFILE * edf1, attrib1_t ** attrib)
int toolong = FALSE;
int rc;
int cmp;
- attrib1_t * att;
+ attrib1_t * att = NULL;
attrib1_t ** prev;
attrib1_t * freelist = *attrib;
attrib1_t * newlist = NULL;
| 0 |
4763e65124114bfded887e361fecb43a2e7b8d66
|
389ds/389-ds-base
|
Issue 4656 - Allow backward compatilbity for replication plugin name change
Description: We still need to map the plugin name from the old one to the new
one to support upgrades with other applications.
relates: https://github.com/389ds/389-ds-base/issues/4656
ASAN tested and approved
Reviewed by: abbra(Thanks!)
|
commit 4763e65124114bfded887e361fecb43a2e7b8d66
Author: Mark Reynolds <[email protected]>
Date: Thu May 27 15:18:06 2021 -0400
Issue 4656 - Allow backward compatilbity for replication plugin name change
Description: We still need to map the plugin name from the old one to the new
one to support upgrades with other applications.
relates: https://github.com/389ds/389-ds-base/issues/4656
ASAN tested and approved
Reviewed by: abbra(Thanks!)
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 1f7113245..d86798f79 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -1619,17 +1619,17 @@ do_dse_search(struct dse *pdse, Slapi_PBlock *pb, int scope, const Slapi_DN *bas
int
dse_search(Slapi_PBlock *pb) /* JCM There should only be one exit point from this function! */
{
- int scope; /*Scope of the search*/
- Slapi_Filter *filter; /*The filter*/
- char **attrs; /*Attributes*/
- int attrsonly; /*Should we just return the attributes found?*/
- /*int nentries= 0; Number of entries found thus far*/
+ Slapi_Filter *filter;
+ Slapi_DN *basesdn = NULL;
+ Slapi_DN *old_repl_sdn = NULL;
struct dse *pdse;
- int returncode = LDAP_SUCCESS;
- int isrootdse = 0;
+ char **attrs;
char returntext[SLAPI_DSE_RETURNTEXT_SIZE] = "";
- Slapi_DN *basesdn = NULL;
+ int attrsonly;
int estimate = 0; /* estimated search result set size */
+ int isrootdse = 0;
+ int returncode = LDAP_SUCCESS;
+ int scope;
/*
* Get private information created in the init routine.
@@ -1651,6 +1651,16 @@ dse_search(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
*/
isrootdse = slapi_sdn_isempty(basesdn);
+ /* Hopefully this plugin DN mapping can be removed in 3.x */
+ old_repl_sdn = slapi_sdn_new_dn_byval("cn=Multimaster Replication Plugin,cn=plugins,cn=config");
+ if(slapi_sdn_compare(basesdn, old_repl_sdn) == 0) {
+ /* Map the old name to the new one */
+ slapi_sdn_free(&basesdn);
+ basesdn = slapi_sdn_new_dn_byval("cn=Multisupplier Replication Plugin,cn=plugins,cn=config");
+ slapi_pblock_set(pb, SLAPI_SEARCH_TARGET_SDN, basesdn);
+ }
+ slapi_sdn_free(&old_repl_sdn);
+
switch (scope) {
case LDAP_SCOPE_BASE: {
Slapi_Entry *baseentry = NULL;
@@ -1804,6 +1814,7 @@ dse_modify(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
int returncode = LDAP_SUCCESS;
char returntext[SLAPI_DSE_RETURNTEXT_SIZE] = "";
Slapi_DN *sdn = NULL;
+ Slapi_DN *old_repl_sdn = NULL;
int dont_write_file = 0; /* default */
int rc = SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
int retval = -1;
@@ -1829,6 +1840,16 @@ dse_modify(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
return retval;
}
+ /* Hopefully this plugin DN mapping can be removed in 3.x */
+ old_repl_sdn = slapi_sdn_new_dn_byval("cn=Multimaster Replication Plugin,cn=plugins,cn=config");
+ if(slapi_sdn_compare(sdn, old_repl_sdn) == 0) {
+ /* Map the old name to the new one */
+ slapi_sdn_free(&sdn);
+ sdn = slapi_sdn_new_dn_byval("cn=Multisupplier Replication Plugin,cn=plugins,cn=config");
+ slapi_pblock_set(pb, SLAPI_MODIFY_TARGET_SDN, sdn);
+ }
+ slapi_sdn_free(&old_repl_sdn);
+
slapi_pblock_get(pb, SLAPI_OPERATION, &pb_op);
if (pb_op){
internal_op = operation_is_flag_set(pb_op, OP_FLAG_INTERNAL);
| 0 |
786b00eb68d3152f09fe8fe9a6882b82f5d200a7
|
389ds/389-ds-base
|
Issue 49381 - Add docstrings to ds_logs, gssapi_repl, betxn
Description: Refactor docstrings of ds_logs, gssapi_repl and betxn test
suites. Also change test_betxn_init to fixure function.
And add pytest.mark.bz numbers.
https://pagure.io/389-ds-base/issue/49381
Reviewed by: Simon Pichugin
|
commit 786b00eb68d3152f09fe8fe9a6882b82f5d200a7
Author: Amita Sharma <[email protected]>
Date: Thu Sep 14 16:59:30 2017 +0530
Issue 49381 - Add docstrings to ds_logs, gssapi_repl, betxn
Description: Refactor docstrings of ds_logs, gssapi_repl and betxn test
suites. Also change test_betxn_init to fixure function.
And add pytest.mark.bz numbers.
https://pagure.io/389-ds-base/issue/49381
Reviewed by: Simon Pichugin
diff --git a/dirsrvtests/tests/suites/betxns/betxn_test.py b/dirsrvtests/tests/suites/betxns/betxn_test.py
index 289e8c545..175496495 100644
--- a/dirsrvtests/tests/suites/betxns/betxn_test.py
+++ b/dirsrvtests/tests/suites/betxns/betxn_test.py
@@ -18,8 +18,9 @@ logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)
-def test_betxn_init(topology_st):
- # First enable dynamic plugins - makes plugin testing much easier
[email protected](scope='module')
+def dynamic_plugins(topology_st):
+ """Enable dynamic plugins - makes plugin testing much easier"""
try:
topology_st.standalone.modify_s(DN_CONFIG, [(ldap.MOD_REPLACE, 'nsslapd-dynamic-plugins', 'on')])
except ldap.LDAPError as e:
@@ -27,10 +28,26 @@ def test_betxn_init(topology_st):
assert False
-def test_betxt_7bit(topology_st):
- '''
- Test that the 7-bit plugin correctly rejects an invalid update
- '''
+def test_betxt_7bit(topology_st, dynamic_plugins):
+ """Test that the 7-bit plugin correctly rejects an invalid update
+
+ :id: 9e2ab27b-eda9-4cd9-9968-a1a8513210fd
+
+ :setup: Standalone instance and enabled dynamic plugins
+
+ :steps: 1. Enable PLUGIN_7_BIT_CHECK to "ON"
+ 2. Add test user
+ 3. Try to Modify test user's RDN to have 8 bit RDN
+ 4. Execute search operation for new 8 bit RDN
+ 5. Remove the test user for cleanup
+
+ :expectedresults:
+ 1. PLUGIN_7_BIT_CHECK should be ON
+ 2. Test users should be added
+ 3. Modify RDN for test user should FAIL
+ 4. Search operation should FAIL
+ 5. Test user should be removed
+ """
log.info('Running test_betxt_7bit...')
@@ -67,7 +84,7 @@ def test_betxt_7bit(topology_st):
log.fatal('test_betxt_7bit: Incorrectly found the entry using the invalid RDN')
assert False
except ldap.LDAPError as e:
- log.fatal('Error whiles earching for test entry: ' + e.message['desc'])
+ log.fatal('Error while searching for test entry: ' + e.message['desc'])
assert False
#
@@ -82,13 +99,27 @@ def test_betxt_7bit(topology_st):
log.info('test_betxt_7bit: PASSED')
-def test_betxn_attr_uniqueness(topology_st):
- '''
- Test that we can not add two entries that have the same attr value that is
- defined by the plugin.
- '''
+def test_betxn_attr_uniqueness(topology_st, dynamic_plugins):
+ """Test that we can not add two entries that have the same attr value that is
+ defined by the plugin
+
+ :id: 42aeb41c-fbb5-4bc6-a97b-56274034d29f
+
+ :setup: Standalone instance and enabled dynamic plugins
- log.info('Running test_betxn_attr_uniqueness...')
+ :steps: 1. Enable PLUGIN_ATTR_UNIQUENESS plugin as "ON"
+ 2. Add a test user
+ 3. Add another test user having duplicate uid as previous one
+ 4. Cleanup - disable PLUGIN_ATTR_UNIQUENESS plugin as "OFF"
+ 5. Cleanup - remove test user entry
+
+ :expectedresults:
+ 1. PLUGIN_ATTR_UNIQUENESS plugin should be ON
+ 2. Test user should be added
+ 3. Add operation should FAIL
+ 4. PLUGIN_ATTR_UNIQUENESS plugin should be "OFF"
+ 5. Test user entry should be removed
+ """
USER1_DN = 'uid=test_entry1,' + DEFAULT_SUFFIX
USER2_DN = 'uid=test_entry2,' + DEFAULT_SUFFIX
@@ -107,7 +138,7 @@ def test_betxn_attr_uniqueness(topology_st):
USER1_DN + ', error ' + e.message['desc'])
assert False
- # Add the second entry with a dupliate uid
+ # Add the second entry with a duplicate uid
try:
topology_st.standalone.add_s(Entry((USER2_DN, {'objectclass': "top extensibleObject".split(),
'sn': '2',
@@ -136,7 +167,27 @@ def test_betxn_attr_uniqueness(topology_st):
log.info('test_betxn_attr_uniqueness: PASSED')
-def test_betxn_memberof(topology_st):
+def test_betxn_memberof(topology_st, dynamic_plugins):
+ """Test PLUGIN_MEMBER_OF plugin
+
+ :id: 70d0b96e-b693-4bf7-bbf5-102a66ac5993
+
+ :setup: Standalone instance and enabled dynamic plugins
+
+ :steps: 1. Enable and configure memberOf plugin
+ 2. Set memberofgroupattr="member" and memberofAutoAddOC="referral"
+ 3. Add two test groups - group1 and group2
+ 4. Add group2 to group1
+ 5. Add group1 to group2
+
+ :expectedresults:
+ 1. memberOf plugin plugin should be ON
+ 2. Set memberofgroupattr="member" and memberofAutoAddOC="referral" should PASS
+ 3. Add operation should PASS
+ 4. Add operation should FAIL
+ 5. Add operation should FAIL
+ """
+
ENTRY1_DN = 'cn=group1,' + DEFAULT_SUFFIX
ENTRY2_DN = 'cn=group2,' + DEFAULT_SUFFIX
PLUGIN_DN = 'cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config'
diff --git a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py b/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
index e0521120f..fb73a22c4 100644
--- a/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
+++ b/dirsrvtests/tests/suites/ds_logs/ds_logs_test.py
@@ -58,13 +58,23 @@ def search_users(topology_st):
log.fatal('Search failed, error: ' + e.message['desc'])
raise e
-
[email protected]
def test_check_default(topology_st):
- """Bug 1273549 - Check the default value of nsslapd-logging-hr-timestamps-enabled,
- it should be ON
- """
+ """Check the default value of nsslapd-logging-hr-timestamps-enabled,
+ it should be ON
+
+ :id: 2d15002e-9ed3-4796-b0bb-bf04e4e59bd3
+
+ :setup: Standalone instance
+
+ :steps:
+ 1. Fetch the value of nsslapd-logging-hr-timestamps-enabled attribute
+ 2. Test that the attribute value should be "ON" by default
- log.info('Check the default value of nsslapd-logging-hr-timestamps-enabled, it should be ON')
+ :expectedresults:
+ 1. Value should be fetched successfully
+ 2. Value should be "ON" by default
+ """
# Get the default value of nsslapd-logging-hr-timestamps-enabled attribute
default = topology_st.standalone.config.get_attr_val(PLUGIN_TIMESTAMP)
@@ -73,19 +83,49 @@ def test_check_default(topology_st):
assert (default == "on")
log.debug(default)
-
[email protected]
def test_plugin_set_invalid(topology_st):
- """Bug 1273549 - Try to set some invalid values for the newly added attribute"""
+ """Try to set some invalid values for nsslapd-logging-hr-timestamps-enabled
+ attribute
+
+ :id: c60a68d2-703a-42bf-a5c2-4040736d511a
+
+ :setup: Standalone instance
+
+ :steps:
+ 1. Set some "JUNK" value of nsslapd-logging-hr-timestamps-enabled attribute
+
+ :expectedresults:
+ 1. There should be an operation error
+ """
log.info('test_plugin_set_invalid - Expect to fail with junk value')
with pytest.raises(ldap.OPERATIONS_ERROR):
result = topology_st.standalone.config.set(PLUGIN_TIMESTAMP, 'JUNK')
-
[email protected]
def test_log_plugin_on(topology_st):
- """Bug 1273549 - Check access logs for milisecond, when attribute is ON"""
+ """Check access logs for millisecond, when
+ nsslapd-logging-hr-timestamps-enabled=ON
+
+ :id: 65ae4e2a-295f-4222-8d69-12124bc7a872
+
+ :setup: Standalone instance
- log.info('Bug 1273549 - Check access logs for milisecond, when attribute is ON')
+ :steps:
+ 1. To generate big logs, add 100 test users
+ 2. Search users to generate more access logs
+ 3. Restart server
+ 4. Parse the logs to check the milliseconds got recorded in logs
+
+ :expectedresults:
+ 1. Add operation should be successful
+ 2. Search operation should be successful
+ 3. Server should be restarted successfully
+ 4. There should be milliseconds added in the access logs
+ """
+
+ log.info('Bug 1273549 - Check access logs for millisecond, when attribute is ON')
log.info('perform any ldap operation, which will trigger the logs')
add_users(topology_st, 100)
search_users(topology_st)
@@ -98,19 +138,41 @@ def test_log_plugin_on(topology_st):
assert len(access_log_lines) > 0
assert topology_st.standalone.ds_access_log.match('^\[.+\d{9}.+\].+')
-
[email protected]
def test_log_plugin_off(topology_st):
- """Bug 1273549 - Check access logs for missing milisecond, when attribute is OFF"""
+ """Milliseconds should be absent from access logs when
+ nsslapd-logging-hr-timestamps-enabled=OFF
+
+ :id: b3400e46-d940-4574-b399-e3f4b49bc4b5
+
+ :setup: Standalone instance
+
+ :steps:
+ 1. Set nsslapd-logging-hr-timestamps-enabled=OFF
+ 2. Restart the server
+ 3. Delete old access logs
+ 4. Do search operations to generate fresh access logs
+ 5. Restart the server
+ 6. Check access logs
+
+ :expectedresults:
+ 1. Attribute nsslapd-logging-hr-timestamps-enabled should be set to "OFF"
+ 2. Server should restart
+ 3. Access logs should be deleted
+ 4. Search operation should PASS
+ 5. Server should restart
+ 6. There should not be any milliseconds added in the access logs
+ """
- log.info('Bug 1273549 - Check access logs for missing milisecond, when attribute is OFF')
+ log.info('Bug 1273549 - Check access logs for missing millisecond, when attribute is OFF')
- log.info('test_log_plugin_off - set the configuraton attribute to OFF')
+ log.info('test_log_plugin_off - set the configuration attribute to OFF')
topology_st.standalone.config.set(PLUGIN_TIMESTAMP, 'OFF')
log.info('Restart the server to flush the logs')
topology_st.standalone.restart(timeout=10)
- log.info('test_log_plugin_off - delete the privious access logs')
+ log.info('test_log_plugin_off - delete the previous access logs')
topology_st.standalone.deleteAccessLogs()
# Now generate some fresh logs
diff --git a/dirsrvtests/tests/suites/ds_logs/regression_test.py b/dirsrvtests/tests/suites/ds_logs/regression_test.py
index 15cd98fd5..07ba3e3c1 100644
--- a/dirsrvtests/tests/suites/ds_logs/regression_test.py
+++ b/dirsrvtests/tests/suites/ds_logs/regression_test.py
@@ -1,5 +1,5 @@
# --- BEGIN COPYRIGHT BLOCK ---
- # Copyright (C) 2017 Red Hat, Inc.
+# Copyright (C) 2017 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
@@ -24,13 +24,15 @@ log = logging.getLogger(__name__)
@pytest.mark.bz1460718
@pytest.mark.parametrize("log_level", [(LOG_REPLICA + LOG_DEFAULT), (LOG_ACL + LOG_DEFAULT), (LOG_TRACE + LOG_DEFAULT)])
def test_default_loglevel_stripped(topo, log_level):
- """ The default log level 16384 is stripped from the log level returned to a client
+ """The default log level 16384 is stripped from the log level returned to a client
:id: c300f8f1-aa11-4621-b124-e2be51930a6b
- :feature: Logging
+
:setup: Standalone instance
+
:steps: 1. Change the error log level to the default and custom value.
2. Check if the server returns the new value.
+
:expectedresults:
1. Changing the error log level should be successful.
2. Server should return the new log level.
@@ -42,13 +44,15 @@ def test_default_loglevel_stripped(topo, log_level):
@pytest.mark.bz1460718
def test_dse_config_loglevel_error(topo):
- """ Manually setting nsslapd-errorlog-level to 64 in dse.ldif throws error
+ """Manually setting nsslapd-errorlog-level to 64 in dse.ldif throws error
:id: 0eeefa17-ec1c-4208-8e7b-44d8fbc38f10
- :feature: Logging
+
:setup: Standalone instance
+
:steps: 1. Stop the server, edit dse.ldif file and change nsslapd-errorlog-level value to 64
2. Start the server and observe the error logs.
+
:expectedresults:
1. Server should be successfully stopped and nsslapd-errorlog-level value should be changed.
2. Server should be successfully started without any errors being reported in the logs.
diff --git a/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py b/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
index 19382360d..5fde51b62 100644
--- a/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
+++ b/dirsrvtests/tests/suites/gssapi_repl/gssapi_repl_test.py
@@ -68,8 +68,29 @@ def _allow_machine_account(inst, name):
def test_gssapi_repl(topology_m2):
- """Create a kdc, then using that, provision two masters which have a gssapi
- authenticated replication agreement.
+ """Test gssapi authenticated replication agreement of two masters using KDC
+
+ :id: 552850aa-afc3-473e-9c39-aae802b46f11
+
+ :setup: MMR with two masters
+
+ :steps:
+ 1. Create the locations on each master for the other master to bind to
+ 2. Set on the cn=replica config to accept the other masters mapping under mapping tree
+ 3. Create the replication agreements from M1->M2 and vice versa (M2->M1)
+ 4. Set the replica bind method to sasl gssapi for both agreements
+ 5. Initialize all the agreements
+ 6. Create a user on M1 and check if user is created on M2
+ 7. Create a user on M2 and check if user is created on M1
+
+ :expectedresults:
+ 1. Locations should be added successfully
+ 2. Configuration should be added successfully
+ 3. Replication agreements should be added successfully
+ 4. Bind method should be set to sasl gssapi for both agreements
+ 5. Agreements should be initialized successfully
+ 6. Test User should be created on M1 and M2 both
+ 7. Test User should be created on M1 and M2 both
"""
return
| 0 |
4b82475ae55f3d4fae366d37b803211d70fca848
|
389ds/389-ds-base
|
Fixed this problem on Solaris: Netscape Portable Runtime error -5977: ld.so.1: ns-slapd: fatal: libns-dshttpd72.so: open failed: No such file or directory
|
commit 4b82475ae55f3d4fae366d37b803211d70fca848
Author: Noriko Hosoi <[email protected]>
Date: Fri Nov 3 00:53:55 2006 +0000
Fixed this problem on Solaris: Netscape Portable Runtime error -5977: ld.so.1: ns-slapd: fatal: libns-dshttpd72.so: open failed: No such file or directory
diff --git a/ldap/cm/Makefile b/ldap/cm/Makefile
index 0bb6ffe06..78d71fc3d 100644
--- a/ldap/cm/Makefile
+++ b/ldap/cm/Makefile
@@ -312,7 +312,7 @@ releaseDirectory:
# the httpd library
ifneq ($(ARCH), WINNT)
- $(INSTALL) -m 755 $(OBJDIR)/$(NSHTTPD_DLL)$(DLL_PRESUF).$(DLL_SUFFIX)* $(RELDIR)/$(DS_LIBDIR)
+ $(INSTALL) -m 755 $(OBJDIR)/$(NSHTTPD_DLL)$(DLL_PRESUF).$(DLL_SUFFIX)* $(LDAP_PLUGIN_RELDIR)
endif
# Images for IM Presence plugin
@@ -1042,7 +1042,7 @@ $(INSTDIR)/$(SLAPD_DIR)/slapd.z:
then $(INSTALL) -m 755 $$file $(RELDIR)/$(DS_DSGWDIR) ; \
fi ; \
done
- $(INSTALL) -m 755 $(OBJDIR)/$(BUILD_HTTPDLL_NAME).dll $(RELDIR)/$(DS_LIBDIR)
+ $(INSTALL) -m 755 $(OBJDIR)/$(BUILD_HTTPDLL_NAME).dll $(RELDIR)/$(DS_PLUGINDIR)
$(INSTALL) -m 755 $(OBJDIR)/$(BUILD_HTTPDLL_NAME).dll $(RELDIR)/$(DS_DSGWDIR)
rm -f $(SLAPD_ZIPFILE); cd $(RELDIR); zip -r $(SLAPD_ZIPFILE) *
| 0 |
dcba969f2cb4a77e7ce6328408834f6fd44b1b0c
|
389ds/389-ds-base
|
Ticket 49394 - slapi_pblock_get may leave unchanged the provided variable
Bug Description:
Since 1.3.6.4 the pblock struct is a split in sub-structs
(https://pagure.io/389-ds-base/issue/49097)
Before, it was a quite flat calloc struct and any slapi-pblock-get
retrieved the field (NULL if not previously slapi_pblock_set) and
assigned the provided variable.
Now, the sub-struct are allocated on demand (slapi_pblock_set).
If a substruct that contains the requested field is not allocated the
provided variable is unchanged.
This is a change of behavior, because a uninitialized local variable can
get random value (stack) if the lookup field/struct has not been set.
Fix Description:
Update slapi_pblock_set so that it systematically sets the
provided variable when those substructs are NULL
pb_mr
pb_dse
pb_task
pb_misc
pb_intop
pb_intplugin
pb_deprecated
https://pagure.io/389-ds-base/issue/49394
Reviewed by: Mark Reynolds, William Brown
Platforms tested: F23
Flag Day: no
Doc impact: no
|
commit dcba969f2cb4a77e7ce6328408834f6fd44b1b0c
Author: Thierry Bordaz <[email protected]>
Date: Thu Oct 5 12:50:50 2017 +0200
Ticket 49394 - slapi_pblock_get may leave unchanged the provided variable
Bug Description:
Since 1.3.6.4 the pblock struct is a split in sub-structs
(https://pagure.io/389-ds-base/issue/49097)
Before, it was a quite flat calloc struct and any slapi-pblock-get
retrieved the field (NULL if not previously slapi_pblock_set) and
assigned the provided variable.
Now, the sub-struct are allocated on demand (slapi_pblock_set).
If a substruct that contains the requested field is not allocated the
provided variable is unchanged.
This is a change of behavior, because a uninitialized local variable can
get random value (stack) if the lookup field/struct has not been set.
Fix Description:
Update slapi_pblock_set so that it systematically sets the
provided variable when those substructs are NULL
pb_mr
pb_dse
pb_task
pb_misc
pb_intop
pb_intplugin
pb_deprecated
https://pagure.io/389-ds-base/issue/49394
Reviewed by: Mark Reynolds, William Brown
Platforms tested: F23
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 077684d23..89937df46 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -379,6 +379,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_BACKEND_COUNT:
if (pblock->pb_misc != NULL) {
(*(int *)value) = pblock->pb_misc->pb_backend_count;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_BE_TYPE:
@@ -616,6 +618,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_REQUESTOR_ISROOT:
if (pblock->pb_intop != NULL) {
(*(int *)value) = pblock->pb_intop->pb_requestor_isroot;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_SKIP_MODIFIED_ATTRS:
@@ -657,6 +661,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DESTROY_CONTENT:
if (pblock->pb_deprecated != NULL) {
(*(int *)value) = pblock->pb_deprecated->pb_destroy_content;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -685,16 +691,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_OPRETURN:
if (pblock->pb_intop != NULL) {
(*(int *)value) = pblock->pb_intop->pb_opreturn;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_PLUGIN_OBJECT:
if (pblock->pb_intplugin != NULL) {
(*(void **)value) = pblock->pb_intplugin->pb_object;
+ } else {
+ (*(void **)value) = NULL;
}
break;
case SLAPI_PLUGIN_DESTROY_FN:
if (pblock->pb_intplugin != NULL) {
(*(IFP *)value) = pblock->pb_intplugin->pb_destroy_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
case SLAPI_PLUGIN_DESCRIPTION:
@@ -703,11 +715,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_IDENTITY:
if (pblock->pb_intplugin != NULL) {
(*(void **)value) = pblock->pb_intplugin->pb_plugin_identity;
+ } else {
+ (*(void **)value) = NULL;
}
break;
case SLAPI_PLUGIN_CONFIG_AREA:
if (pblock->pb_intplugin != NULL) {
(*(char **)value) = pblock->pb_intplugin->pb_plugin_config_area;
+ } else {
+ (*(char **)value) = 0;
}
break;
case SLAPI_PLUGIN_CONFIG_DN:
@@ -718,16 +734,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_INTOP_RESULT:
if (pblock->pb_intop != NULL) {
(*(int *)value) = pblock->pb_intop->pb_internal_op_result;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_entries;
+ } else {
+ (*(Slapi_Entry ***)value) = NULL;
}
break;
case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
if (pblock->pb_intop != NULL) {
(*(char ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_referrals;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
@@ -1167,11 +1189,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_ENTRY_PRE_OP:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_pre_op_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_ENTRY_POST_OP:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_post_op_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
@@ -1419,12 +1445,16 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
if (pblock->pb_intop != NULL) {
(*(LDAPControl ***)value) = pblock->pb_intop->pb_ctrls_arg;
+ } else {
+ (*(LDAPControl ***)value) = NULL;
}
break;
/* notes to be added to the access log RESULT line for this op. */
case SLAPI_OPERATION_NOTES:
if (pblock->pb_intop != NULL) {
(*(unsigned int *)value) = pblock->pb_intop->pb_operation_notes;
+ } else {
+ (*(unsigned int *)value) = NULL;
}
break;
@@ -1486,6 +1516,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
if (pblock->pb_intplugin != NULL) {
(*(int **)value) = pblock->pb_intplugin->pb_substrlens;
+ } else {
+ (*(int **)value) = NULL;
}
break;
case SLAPI_PLUGIN_SYNTAX_VALIDATE:
@@ -1505,11 +1537,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_MANAGEDSAIT:
if (pblock->pb_intop != NULL) {
(*(int *)value) = pblock->pb_intop->pb_managedsait;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_PWPOLICY:
if (pblock->pb_intop != NULL) {
(*(int *)value) = pblock->pb_intop->pb_pwpolicy_ctrl;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -1522,11 +1558,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_ADD_EXISTING_DN_ENTRY:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_existing_dn_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_existing_uniqueid_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_ADD_PARENT_ENTRY:
@@ -1537,6 +1577,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_ADD_PARENT_UNIQUEID:
if (pblock->pb_op != NULL) {
(*(char **)value) = pblock->pb_op->o_params.p.p_add.parentuniqueid;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -1624,16 +1666,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_MODRDN_PARENT_ENTRY:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_parent_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_MODRDN_NEWPARENT_ENTRY:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_newparent_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_MODRDN_TARGET_ENTRY:
if (pblock->pb_intop != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_intop->pb_target_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
@@ -1740,26 +1788,36 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
if (pblock->pb_mr != NULL) {
(*(mrFilterMatchFn *)value) = pblock->pb_mr->filter_match_fn;
+ } else {
+ (*(mrFilterMatchFn *)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
if (pblock->pb_mr != NULL) {
(*(IFP *)value) = pblock->pb_mr->filter_index_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
if (pblock->pb_mr != NULL) {
(*(IFP *)value) = pblock->pb_mr->filter_reset_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_INDEX_FN:
if (pblock->pb_mr != NULL) {
(*(IFP *)value) = pblock->pb_mr->index_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_INDEX_SV_FN:
if (pblock->pb_mr != NULL) {
(*(IFP *)value) = pblock->pb_mr->index_sv_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
@@ -1767,41 +1825,57 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_MR_OID:
if (pblock->pb_mr != NULL) {
(*(char **)value) = pblock->pb_mr->oid;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_TYPE:
if (pblock->pb_mr != NULL) {
(*(char **)value) = pblock->pb_mr->type;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_VALUE:
if (pblock->pb_mr != NULL) {
(*(struct berval **)value) = pblock->pb_mr->value;
+ } else {
+ (*(struct berval **)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_VALUES:
if (pblock->pb_mr != NULL) {
(*(struct berval ***)value) = pblock->pb_mr->values;
+ } else {
+ (*(struct berval ***)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_KEYS:
if (pblock->pb_mr != NULL) {
(*(struct berval ***)value) = pblock->pb_mr->keys;
+ } else {
+ (*(struct berval ***)value) = NULL;
}
break;
case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
if (pblock->pb_mr != NULL) {
(*(unsigned int *)value) = pblock->pb_mr->filter_reusable;
+ } else {
+ (*(unsigned int *)value) = 0;
}
break;
case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
if (pblock->pb_mr != NULL) {
(*(int *)value) = pblock->pb_mr->query_operator;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_PLUGIN_MR_USAGE:
if (pblock->pb_mr != NULL) {
(*(unsigned int *)value) = pblock->pb_mr->usage;
+ } else {
+ (*(unsigned int *)value) = 0;
}
break;
@@ -1865,16 +1939,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_SEQ_TYPE:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->seq_type;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_SEQ_ATTRNAME:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->seq_attrname;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_SEQ_VAL:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->seq_val;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -1882,47 +1962,65 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_LDIF2DB_FILE:
if (pblock->pb_task != NULL) {
(*(char ***)value) = pblock->pb_task->ldif_files;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
case SLAPI_LDIF2DB_REMOVEDUPVALS:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->removedupvals;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_DB2INDEX_ATTRS:
if (pblock->pb_task != NULL) {
(*(char ***)value) = pblock->pb_task->db2index_attrs;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
case SLAPI_LDIF2DB_NOATTRINDEXES:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->ldif2db_noattrindexes;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_LDIF2DB_INCLUDE:
if (pblock->pb_task != NULL) {
(*(char ***)value) = pblock->pb_task->ldif_include;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
case SLAPI_LDIF2DB_EXCLUDE:
if (pblock->pb_task != NULL) {
(*(char ***)value) = pblock->pb_task->ldif_exclude;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->ldif_generate_uniqueid;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_LDIF2DB_ENCRYPT:
case SLAPI_DB2LDIF_DECRYPT:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->ldif_encrypt;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_LDIF2DB_NAMESPACEID:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->ldif_namespaceid;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -1930,16 +2028,22 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DB2LDIF_PRINTKEY:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->ldif_printkey;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_DB2LDIF_DUMP_UNIQUEID:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->ldif_dump_uniqueid;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_DB2LDIF_FILE:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->ldif_file;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -1947,37 +2051,51 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_BACKEND_INSTANCE_NAME:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->instance_name;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_BACKEND_TASK:
if (pblock->pb_task != NULL) {
(*(Slapi_Task **)value) = pblock->pb_task->task;
+ } else {
+ (*(Slapi_Task **)value) = NULL;
}
break;
case SLAPI_TASK_FLAGS:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->task_flags;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_DB2LDIF_SERVER_RUNNING:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->server_running;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_BULK_IMPORT_ENTRY:
if (pblock->pb_task != NULL) {
(*(Slapi_Entry **)value) = pblock->pb_task->import_entry;
+ } else {
+ (*(Slapi_Entry **)value) = NULL;
}
break;
case SLAPI_BULK_IMPORT_STATE:
if (pblock->pb_task != NULL) {
(*(int *)value) = pblock->pb_task->import_state;
+ } else {
+ (*(int *)value) = 0;
}
break;
/* dbverify */
case SLAPI_DBVERIFY_DBDIR:
if (pblock->pb_task != NULL) {
(*(char **)value) = pblock->pb_task->dbverify_dbdir;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -1993,11 +2111,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_TXN:
if (pblock->pb_intop != NULL) {
(*(void **)value) = pblock->pb_intop->pb_txn;
+ } else {
+ (*(void **)value) = NULL;
}
break;
case SLAPI_TXN_RUV_MODS_FN:
if (pblock->pb_intop != NULL) {
(*(IFP *)value) = pblock->pb_intop->pb_txn_ruv_mods_fn;
+ } else {
+ (*(IFP *)value) = NULL;
}
break;
@@ -2052,6 +2174,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PB_RESULT_TEXT:
if (pblock->pb_intop != NULL) {
*((char **)value) = pblock->pb_intop->pb_result_text;
+ } else {
+ *((char **)value) = NULL;
}
break;
@@ -2059,6 +2183,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DBSIZE:
if (pblock->pb_misc != NULL) {
(*(unsigned int *)value) = pblock->pb_misc->pb_dbsize;
+ } else {
+ (*(unsigned int *)value) = 0;
}
break;
@@ -2153,11 +2279,15 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_ARGC:
if (pblock->pb_misc != NULL) {
(*(int *)value) = pblock->pb_misc->pb_slapd_argc;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_ARGV:
if (pblock->pb_misc != NULL) {
(*(char ***)value) = pblock->pb_misc->pb_slapd_argv;
+ } else {
+ (*(char ***)value) = NULL;
}
break;
@@ -2165,6 +2295,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_CONFIG_DIRECTORY:
if (pblock->pb_intplugin != NULL) {
(*(char **)value) = pblock->pb_intplugin->pb_slapd_configdir;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -2175,12 +2307,16 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
if (pblock->pb_deprecated != NULL) {
(*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_user_passwd;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
if (pblock->pb_deprecated != NULL) {
(*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_db_passwd;
+ } else {
+ (*(char **)value) = NULL;
}
break;
@@ -2208,6 +2344,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_PLUGIN_ENABLED:
if (pblock->pb_intplugin != NULL) {
*((int *)value) = pblock->pb_intplugin->pb_plugin_enabled;
+ } else {
+ *((int *)value) = 0;
}
break;
@@ -2215,6 +2353,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->dont_add_write;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -2222,6 +2362,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DSE_MERGE_WHEN_ADDING:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->add_merge;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -2229,6 +2371,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DSE_DONT_CHECK_DUPS:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->dont_check_dups;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -2236,6 +2380,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DSE_REAPPLY_MODS:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->reapply_mods;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -2243,6 +2389,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_DSE_IS_PRIMARY_FILE:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->is_primary_file;
+ } else {
+ (*(int *)value) = 0;
}
break;
@@ -2250,42 +2398,56 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_SCHEMA_FLAGS:
if (pblock->pb_dse != NULL) {
(*(int *)value) = pblock->pb_dse->schema_flags;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_URP_NAMING_COLLISION_DN:
if (pblock->pb_intop != NULL) {
(*(char **)value) = pblock->pb_intop->pb_urp_naming_collision_dn;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_URP_TOMBSTONE_UNIQUEID:
if (pblock->pb_intop != NULL) {
(*(char **)value) = pblock->pb_intop->pb_urp_tombstone_uniqueid;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_URP_TOMBSTONE_CONFLICT_DN:
if (pblock->pb_intop != NULL) {
- (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_conflict_dn;
+ (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_conflict_dn;
+ } else {
+ (*(char **)value) = NULL;
}
break;
case SLAPI_SEARCH_CTRLS:
if (pblock->pb_intop != NULL) {
(*(LDAPControl ***)value) = pblock->pb_intop->pb_search_ctrls;
+ } else {
+ (*(LDAPControl ***)value) = NULL;
}
break;
case SLAPI_PLUGIN_SYNTAX_FILTER_NORMALIZED:
if (pblock->pb_intplugin != NULL) {
(*(int *)value) = pblock->pb_intplugin->pb_syntax_filter_normalized;
+ } else {
+ (*(int *)value) = 0;
}
break;
case SLAPI_PLUGIN_SYNTAX_FILTER_DATA:
if (pblock->pb_intplugin != NULL) {
(*(void **)value) = pblock->pb_intplugin->pb_syntax_filter_data;
+ } else {
+ (*(void **)value) = NULL;
}
break;
@@ -2311,6 +2473,8 @@ slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
case SLAPI_ACI_TARGET_CHECK:
if (pblock->pb_misc != NULL) {
(*(int *)value) = pblock->pb_misc->pb_aci_target_check;
+ } else {
+ (*(int *)value) = 0;
}
break;
| 0 |
2e7ad54fbed212a387c45dc67ae803afc619cc62
|
389ds/389-ds-base
|
Resolves: 248924
Summary: Make password modify extended operation reset expired passwords.
|
commit 2e7ad54fbed212a387c45dc67ae803afc619cc62
Author: Nathan Kinder <[email protected]>
Date: Fri Jan 16 05:26:42 2009 +0000
Resolves: 248924
Summary: Make password modify extended operation reset expired passwords.
diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c
index 5958171bb..2953b1b85 100644
--- a/ldap/servers/slapd/passwd_extop.c
+++ b/ldap/servers/slapd/passwd_extop.c
@@ -143,8 +143,8 @@ passwd_modify_getEntry( const char *dn, Slapi_Entry **e2 ) {
/* Construct Mods pblock and perform the modify operation
* Sets result of operation in SLAPI_PLUGIN_INTOP_RESULT
*/
-static int passwd_apply_mods(const char *dn, Slapi_Mods *mods, LDAPControl **req_controls,
- LDAPControl ***resp_controls)
+static int passwd_apply_mods(Slapi_PBlock *pb_orig, const char *dn, Slapi_Mods *mods,
+ LDAPControl **req_controls, LDAPControl ***resp_controls)
{
Slapi_PBlock pb;
LDAPControl **req_controls_copy = NULL;
@@ -168,7 +168,19 @@ static int passwd_apply_mods(const char *dn, Slapi_Mods *mods, LDAPControl **req
pw_get_componentID(), /* PluginID */
0); /* Flags */
+ /* We copy the connection from the original pblock into the
+ * pblock we use for the internal modify operation. We do
+ * this to allow the password policy code to be able to tell
+ * that the password change was initiated by the user who
+ * sent the extended operation instead of always assuming
+ * that it was done by the root DN. */
+ pb.pb_conn = pb_orig->pb_conn;
+
ret =slapi_modify_internal_pb (&pb);
+
+ /* We now clean up the connection that we copied into the
+ * new pblock. We want to leave it untouched. */
+ pb.pb_conn = NULL;
slapi_pblock_get(&pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
@@ -195,8 +207,8 @@ static int passwd_apply_mods(const char *dn, Slapi_Mods *mods, LDAPControl **req
/* Modify the userPassword attribute field of the entry */
-static int passwd_modify_userpassword(Slapi_Entry *targetEntry, const char *newPasswd,
- LDAPControl **req_controls, LDAPControl ***resp_controls)
+static int passwd_modify_userpassword(Slapi_PBlock *pb_orig, Slapi_Entry *targetEntry,
+ const char *newPasswd, LDAPControl **req_controls, LDAPControl ***resp_controls)
{
char *dn = NULL;
int ret = 0;
@@ -209,7 +221,7 @@ static int passwd_modify_userpassword(Slapi_Entry *targetEntry, const char *newP
slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, SLAPI_USERPWD_ATTR, newPasswd);
- ret = passwd_apply_mods(dn, &smods, req_controls, resp_controls);
+ ret = passwd_apply_mods(pb_orig, dn, &smods, req_controls, resp_controls);
slapi_mods_done(&smods);
@@ -770,7 +782,7 @@ parse_req_done:
slapi_pblock_get(pb, SLAPI_REQCONTROLS, &req_controls);
/* Now we're ready to make actual password change */
- ret = passwd_modify_userpassword(targetEntry, newPasswd, req_controls, &resp_controls);
+ ret = passwd_modify_userpassword(pb, targetEntry, newPasswd, req_controls, &resp_controls);
/* Set the response controls if necessary. We want to do this now
* so it is set for both the success and failure cases. The pblock
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 46814bef0..423c5fb68 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -160,6 +160,7 @@ slapi_pw_find_sv(
/* Checks if the specified value is encoded.
Returns 1 if it is and 0 otherwise
*/
+/* NGK - Use this for checking if the password is hashed */
int slapi_is_encoded (char *value)
{
struct pw_scheme *is_hashed = NULL;
@@ -554,6 +555,11 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) {
time_t cur_time;
char *dn;
passwdPolicy *pwpolicy = NULL;
+ int internal_op = 0;
+ Slapi_Operation *operation = NULL;
+
+ slapi_pblock_get(pb, SLAPI_OPERATION, &operation);
+ internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
cur_time = current_time();
slapi_pblock_get( pb, SLAPI_TARGET_DN, &dn );
@@ -588,12 +594,13 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) {
/* Clear the passwordgraceusertime from the user entry */
slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "passwordgraceusertime", "0");
- /* if the password is reset by root, mark it the first time logon */
-
- if ( pb->pb_requestor_isroot == 1 &&
- pwpolicy->pw_must_change){
+ /* If the password is reset by root, mark it the first time logon. If this is an internal
+ * operation, we have a special case for the password modify extended operation where
+ * we stuff the actual user who initiated the password change in pb_conn. We check
+ * for this special case to ensure we reset the expiration date properly. */
+ if ((internal_op && pwpolicy->pw_must_change && (!pb->pb_conn || slapi_dn_isroot(pb->pb_conn->c_dn))) ||
+ (!internal_op && pwpolicy->pw_must_change && (pb->pb_requestor_isroot == 1))) {
pw_exp_date = NO_TIME;
-
} else if ( pwpolicy->pw_exp == 1 ) {
Slapi_Entry *pse = NULL;
@@ -757,6 +764,20 @@ check_pw_syntax_ext ( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals,
int max_repeated = 0;
int num_categories = 0;
+ /* NGK - Check if password is already hashed and reject if so. */
+ /* NGK - Allow if root or if replication user */
+ if (slapi_is_encoded(slapi_value_get_string(vals[i]))) {
+ PR_snprintf( errormsg, BUFSIZ,
+ "invalid password syntax - pre-hashed passwords are not allowed");
+ if ( pwresponse_req == 1 ) {
+ slapi_pwpolicy_make_response_control ( pb, -1, -1,
+ LDAP_PWPOLICY_INVALIDPWDSYNTAX );
+ }
+ pw_send_ldap_result ( pb, LDAP_CONSTRAINT_VIOLATION, NULL, errormsg, 0, NULL );
+ delete_passwdPolicy(&pwpolicy);
+ return( 1 );
+ }
+
/* check for the minimum password length */
if ( pwpolicy->pw_minlength >
ldap_utf8characters((char *)slapi_value_get_string( vals[i] )) )
| 0 |
31f875c5162dc52c53ec91f13fe78be3d3f23059
|
389ds/389-ds-base
|
do not print ERROR message every time creating an instance
Reviewed by: tbordaz (Thanks!)
|
commit 31f875c5162dc52c53ec91f13fe78be3d3f23059
Author: Rich Megginson <[email protected]>
Date: Wed Nov 20 19:14:51 2013 -0700
do not print ERROR message every time creating an instance
Reviewed by: tbordaz (Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index d034d07be..217136c45 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -244,7 +244,7 @@ class DirSrv(SimpleLDAPObject):
self.simple_bind_s(self.binddn, self.bindpw)
except ldap.SERVER_DOWN, e:
# TODO add server info in exception
- log.error("Cannot connect to %r" % uri)
+ log.debug("Cannot connect to %r" % uri)
raise e
break
except ldap.CONFIDENTIALITY_REQUIRED:
| 0 |
b862b3cb6d1ace2b71a4793b72d90dac9edebfc0
|
389ds/389-ds-base
|
Ticket #29 - Samba3-schema is missing sambaTrustedDomainPassword
https://fedorahosted.org/389/ticket/29
Resolves: Ticket #29
Bug Description: Samba3-schema is missing sambaTrustedDomainPassword
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: Add schema to 60samba3.ldif
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit b862b3cb6d1ace2b71a4793b72d90dac9edebfc0
Author: Rich Megginson <[email protected]>
Date: Fri Jan 27 12:01:09 2012 -0700
Ticket #29 - Samba3-schema is missing sambaTrustedDomainPassword
https://fedorahosted.org/389/ticket/29
Resolves: Ticket #29
Bug Description: Samba3-schema is missing sambaTrustedDomainPassword
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: Add schema to 60samba3.ldif
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/schema/60samba3.ldif b/ldap/schema/60samba3.ldif
index d6a0e5c6f..5dd5f31a8 100644
--- a/ldap/schema/60samba3.ldif
+++ b/ldap/schema/60samba3.ldif
@@ -399,6 +399,28 @@ attributeTypes: (
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
)
#
+###############################################################################
+#
+attributeTypes: (
+ 1.3.6.1.4.1.7165.2.1.68
+ NAME 'sambaClearTextPassword'
+ DESC 'Clear text password (used for trusted domain passwords)'
+ EQUALITY octetStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
+ SINGLE-VALUE
+ )
+#
+###############################################################################
+#
+attributeTypes: (
+ 1.3.6.1.4.1.7165.2.1.69
+ NAME 'sambaPreviousClearTextPassword'
+ DESC 'Previous clear text password (used for trusted domain passwords)'
+ EQUALITY octetStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40
+ SINGLE-VALUE
+ )
+#
################################################################################
#
objectClasses: (
@@ -530,3 +552,15 @@ objectClasses: (
#
################################################################################
#
+objectClasses: (
+ 1.3.6.1.4.1.7165.2.2.15
+ NAME 'sambaTrustedDomainPassword'
+ DESC 'Samba Trusted Domain Password'
+ SUP top
+ STRUCTURAL
+ MUST ( sambaDomainName $ sambaSID $ sambaClearTextPassword $ sambaPwdLastSet )
+ MAY ( sambaPreviousClearTextPassword )
+ )
+#
+###############################################################################
+#
| 0 |
6557c2582782fb6fc7ce6bc65b7c5ba56a7ae5c3
|
389ds/389-ds-base
|
Ticket 48949 - Fix ups for style and correctness
Bug Description: We were provided with a method that set the name to "set"
rather than get. The method shouldn't be in the object, but as a standalone helper.
Additionally, os.path.join can take "path/dir" , "next/path", and join. We don't
need to seperate them up to a whole array.
Fix Description: Fix the method to be get not set. change paths to have /
seperator when possible.
https://fedorahosted.org/389/ticket/48949
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit 6557c2582782fb6fc7ce6bc65b7c5ba56a7ae5c3
Author: William Brown <[email protected]>
Date: Fri Aug 5 09:19:01 2016 +1000
Ticket 48949 - Fix ups for style and correctness
Bug Description: We were provided with a method that set the name to "set"
rather than get. The method shouldn't be in the object, but as a standalone helper.
Additionally, os.path.join can take "path/dir" , "next/path", and join. We don't
need to seperate them up to a whole array.
Fix Description: Fix the method to be get not set. change paths to have /
seperator when possible.
https://fedorahosted.org/389/ticket/48949
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index c84c38db1..77312cd36 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -241,8 +241,9 @@ class DirSrv(SimpleLDAPObject):
# parse the lib dir, and so set the plugin dir
self.instdir = instdir
# THIS NEEDS TO BE FIXED .... There is no guarantee this is correct.
- self.libdir = self.instdir.replace(ensure_bytes('slapd-%s' % self.serverid), ensure_bytes(''))
- self.plugindir = self.libdir + ensure_bytes('plugins')
+ # These two values aren't even used, yet cause so much pain.
+ # self.libdir = self.instdir.replace(ensure_bytes('slapd-%s' % self.serverid), ensure_bytes(''))
+ # self.plugindir = self.libdir + ensure_bytes('plugins')
# if self.verbose:
# log.debug("instdir=%r" % instdir)
diff --git a/src/lib389/lib389/tools.py b/src/lib389/lib389/tools.py
index 5397d914c..2d92bc7f0 100644
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -120,6 +120,20 @@ def runCmd(cmd, timeout_sec):
timer.cancel()
return proc.returncode
+# Could be nicer if we did _get_config_fallback_<type>?
+def _get_config_fallback(config, group, attr, value, boolean=False, num=False):
+ try:
+ if boolean:
+ return config.getboolean(group, attr)
+ elif num:
+ return config.getint(group, attr)
+ else:
+ return config.get(group, attr)
+ except ValueError:
+ return value
+ except configparser.NoOptionError:
+ log.info("%s not specified:setting to default - %s" % (attr, value))
+ return value
class DirSrvTools(object):
"""DirSrv mix-in."""
@@ -1224,29 +1238,15 @@ class SetupDs(object):
def _install(self, extra):
pass
- def _set_config_fallback(self, config, group, attr, value, boolean=False, num=False):
- try:
- if boolean:
- return config.getboolean(group, attr)
- elif num:
- return config.getint(group, attr)
- else:
- return config.get(group, attr)
- except ValueError:
- return value
- except configparser.NoOptionError:
- log.info("%s not specified:setting to default - %s" % (attr, value))
- return value
-
def _validate_ds_2_config(self, config):
assert config.has_section('slapd')
# Extract them in a way that create can understand.
general = {}
general['config_version'] = config.getint('general', 'config_version')
general['full_machine_name'] = config.get('general', 'full_machine_name')
- general['strict_host_checking'] = self._set_config_fallback(config, 'general', 'strict_host_checking', True, boolean=True)
+ general['strict_host_checking'] = _get_config_fallback(config, 'general', 'strict_host_checking', True, boolean=True)
# Change this to detect if SELinux is running
- general['selinux'] = self._set_config_fallback(config, 'general', 'selinux', False, boolean=True)
+ general['selinux'] = _get_config_fallback(config, 'general', 'selinux', False, boolean=True)
if self.verbose:
log.info("Configuration general %s" % general)
@@ -1257,40 +1257,40 @@ class SetupDs(object):
slapd = {}
# Can probably set these defaults out of somewhere else ...
slapd['instance_name'] = config.get('slapd', 'instance_name')
- slapd['user'] = self._set_config_fallback(config, 'slapd', 'user', 'dirsrv')
- slapd['group'] = self._set_config_fallback(config, 'slapd', 'group', 'dirsrv')
- slapd['root_dn'] = self._set_config_fallback(config, 'slapd', 'root_dn', 'cn=Directory Manager')
+ slapd['user'] = _get_config_fallback(config, 'slapd', 'user', 'dirsrv')
+ slapd['group'] = _get_config_fallback(config, 'slapd', 'group', 'dirsrv')
+ slapd['root_dn'] = _get_config_fallback(config, 'slapd', 'root_dn', 'cn=Directory Manager')
slapd['root_password'] = config.get('slapd', 'root_password')
- slapd['prefix'] = self._set_config_fallback(config, 'slapd', 'prefix', '/')
+ slapd['prefix'] = _get_config_fallback(config, 'slapd', 'prefix', '/')
# How do we default, defaults to the DS version.
- slapd['defaults'] = self._set_config_fallback(config, 'slapd', 'defaults', None)
- slapd['port'] = self._set_config_fallback(config, 'slapd', 'port', 389, num=True)
- slapd['secure_port'] = self._set_config_fallback(config, 'slapd', 'secure_port', 636, num=True)
+ slapd['defaults'] = _get_config_fallback(config, 'slapd', 'defaults', None)
+ slapd['port'] = _get_config_fallback(config, 'slapd', 'port', 389, num=True)
+ slapd['secure_port'] = _get_config_fallback(config, 'slapd', 'secure_port', 636, num=True)
# These are all the paths for DS, that are RELATIVE to the prefix
# This will need to change to cope with configure scripts from DS!
# perhaps these should be read as a set of DEFAULTs from a config file?
- slapd['bin_dir'] = self._set_config_fallback(config, 'slapd', 'bin_dir', os.path.join(slapd['prefix'], 'bin'))
- slapd['sysconf_dir'] = self._set_config_fallback(config, 'slapd', 'sysconf_dir', os.path.join(slapd['prefix'], 'etc'))
- slapd['data_dir'] = self._set_config_fallback(config, 'slapd', 'data_dir', os.path.join(slapd['prefix'], 'share'))
- slapd['local_state_dir'] = self._set_config_fallback(config, 'slapd', 'local_state_dir', os.path.join(slapd['prefix'], 'var'))
-
- slapd['lib_dir'] = self._set_config_fallback(config, 'slapd', 'lib_dir', os.path.join(slapd['prefix'], 'usr', 'lib64', 'dirsrv'))
- slapd['cert_dir'] = self._set_config_fallback(config, 'slapd', 'cert_dir', os.path.join(slapd['prefix'], 'etc', 'dirsrv', 'slapd-%s' % slapd['instance_name']))
- slapd['config_dir'] = self._set_config_fallback(config, 'slapd', 'config_dir', os.path.join(slapd['prefix'], 'etc', 'dirsrv', 'slapd-%s' % slapd['instance_name']))
-
- slapd['inst_dir'] = self._set_config_fallback(config, 'slapd', 'inst_dir', os.path.join(slapd['prefix'], 'var', 'lib', 'dirsrv', 'slapd-%s' % slapd['instance_name']))
- slapd['backup_dir'] = self._set_config_fallback(config, 'slapd', 'backup_dir', os.path.join(slapd['inst_dir'], 'bak'))
- slapd['db_dir'] = self._set_config_fallback(config, 'slapd', 'db_dir', os.path.join(slapd['inst_dir'], 'db'))
- slapd['ldif_dir'] = self._set_config_fallback(config, 'slapd', 'ldif_dir', os.path.join(slapd['inst_dir'], 'ldif'))
-
- slapd['lock_dir'] = self._set_config_fallback(config, 'slapd', 'lock_dir', os.path.join(slapd['prefix'], 'var', 'lock', 'dirsrv', 'slapd-%s' % slapd['instance_name']))
- slapd['log_dir'] = self._set_config_fallback(config, 'slapd', 'log_dir', os.path.join(slapd['prefix'], 'var', 'log', 'dirsrv', 'slapd-%s' % slapd['instance_name']))
- slapd['run_dir'] = self._set_config_fallback(config, 'slapd', 'run_dir', os.path.join(slapd['prefix'], 'var', 'run', 'dirsrv'))
- slapd['sbin_dir'] = self._set_config_fallback(config, 'slapd', 'sbin_dir', os.path.join(slapd['prefix'], 'sbin'))
- slapd['schema_dir'] = self._set_config_fallback(config, 'slapd', 'schema_dir', os.path.join(slapd['prefix'], 'etc', 'dirsrv', 'slapd-%s' % slapd['instance_name'], 'schema'))
- slapd['tmp_dir'] = self._set_config_fallback(config, 'slapd', 'tmp_dir', '/tmp')
+ slapd['bin_dir'] = _get_config_fallback(config, 'slapd', 'bin_dir', os.path.join(slapd['prefix'], 'bin'))
+ slapd['sysconf_dir'] = _get_config_fallback(config, 'slapd', 'sysconf_dir', os.path.join(slapd['prefix'], 'etc'))
+ slapd['data_dir'] = _get_config_fallback(config, 'slapd', 'data_dir', os.path.join(slapd['prefix'], 'share'))
+ slapd['local_state_dir'] = _get_config_fallback(config, 'slapd', 'local_state_dir', os.path.join(slapd['prefix'], 'var'))
+
+ slapd['lib_dir'] = _get_config_fallback(config, 'slapd', 'lib_dir', os.path.join(slapd['prefix'], 'usr/lib64/dirsrv'))
+ slapd['cert_dir'] = _get_config_fallback(config, 'slapd', 'cert_dir', os.path.join(slapd['prefix'], 'etc/dirsrv/slapd-%s' % slapd['instance_name']))
+ slapd['config_dir'] = _get_config_fallback(config, 'slapd', 'config_dir', os.path.join(slapd['prefix'], 'etc/dirsrv/slapd-%s' % slapd['instance_name']))
+
+ slapd['inst_dir'] = _get_config_fallback(config, 'slapd', 'inst_dir', os.path.join(slapd['prefix'], 'var/lib/dirsrv/slapd-%s' % slapd['instance_name']))
+ slapd['backup_dir'] = _get_config_fallback(config, 'slapd', 'backup_dir', os.path.join(slapd['inst_dir'], 'bak'))
+ slapd['db_dir'] = _get_config_fallback(config, 'slapd', 'db_dir', os.path.join(slapd['inst_dir'], 'db'))
+ slapd['ldif_dir'] = _get_config_fallback(config, 'slapd', 'ldif_dir', os.path.join(slapd['inst_dir'], 'ldif'))
+
+ slapd['lock_dir'] = _get_config_fallback(config, 'slapd', 'lock_dir', os.path.join(slapd['prefix'], 'var/lock/dirsrv/slapd-%s' % slapd['instance_name']))
+ slapd['log_dir'] = _get_config_fallback(config, 'slapd', 'log_dir', os.path.join(slapd['prefix'], 'var/log/dirsrv/slapd-%s' % slapd['instance_name']))
+ slapd['run_dir'] = _get_config_fallback(config, 'slapd', 'run_dir', os.path.join(slapd['prefix'], 'var/run/dirsrv'))
+ slapd['sbin_dir'] = _get_config_fallback(config, 'slapd', 'sbin_dir', os.path.join(slapd['prefix'], 'sbin'))
+ slapd['schema_dir'] = _get_config_fallback(config, 'slapd', 'schema_dir', os.path.join(slapd['prefix'], 'etc/dirsrv/slapd-%s' % slapd['instance_name'], 'schema'))
+ slapd['tmp_dir'] = _get_config_fallback(config, 'slapd', 'tmp_dir', '/tmp')
# Need to add all the default filesystem paths.
@@ -1502,10 +1502,11 @@ class SetupDs(object):
# Copy correct data to the paths.
# Copy in the schema
# This is a little fragile, make it better.
- shutil.copytree(os.path.join(slapd['sysconf_dir'], 'dirsrv', 'schema'), slapd['schema_dir'])
+ shutil.copytree(os.path.join(slapd['sysconf_dir'], 'dirsrv/schema'), slapd['schema_dir'])
os.chown(slapd['schema_dir'], slapd['user_uid'], slapd['group_gid'])
- srcfile = os.path.join(slapd['sysconf_dir'], 'dirsrv', 'config', 'slapd-collations.conf')
+ # Copy in the collation
+ srcfile = os.path.join(slapd['sysconf_dir'], 'dirsrv/config/slapd-collations.conf')
dstfile = os.path.join(slapd['config_dir'], 'slapd-collations.conf')
shutil.copy2(srcfile, dstfile)
os.chown(slapd['schema_dir'], slapd['user_uid'], slapd['group_gid'])
| 0 |
01e3e3b2afc56ae051bdf74b09179efc54a39cfd
|
389ds/389-ds-base
|
Ticket 532 - RUV is not getting updated for both Master and consumer
Bug Description: Orignal patch did not update the purl in the ruv.
Fix Description: Check if the purl has changed when adding the new
replica to the ruv. If it has, rewrite it.
https://fedorahosted.org/389/ticket/532
Reviewed by: Noriko(Thanks!!)
|
commit 01e3e3b2afc56ae051bdf74b09179efc54a39cfd
Author: Mark Reynolds <[email protected]>
Date: Thu Jan 24 14:56:51 2013 -0500
Ticket 532 - RUV is not getting updated for both Master and consumer
Bug Description: Orignal patch did not update the purl in the ruv.
Fix Description: Check if the purl has changed when adding the new
replica to the ruv. If it has, rewrite it.
https://fedorahosted.org/389/ticket/532
Reviewed by: Noriko(Thanks!!)
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index 972b81278..9ce976812 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -462,11 +462,13 @@ ruv_add_replica (RUV *ruv, ReplicaId rid, const char *replica_purl)
slapi_rwlock_wrlock (ruv->lock);
replica = ruvGetReplica (ruv, rid);
- if (replica == NULL)
- {
+ if (replica == NULL){
replica = ruvAddReplicaNoCSN (ruv, rid, replica_purl);
+ } else {
+ if(strcasecmp(replica->replica_purl, replica_purl )){ /* purls are different - replace it */
+ ruv_replace_replica_purl_nolock(ruv, rid, replica_purl, RUV_DONT_LOCK);
+ }
}
-
slapi_rwlock_unlock (ruv->lock);
if (replica)
@@ -477,13 +479,21 @@ ruv_add_replica (RUV *ruv, ReplicaId rid, const char *replica_purl)
int
ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl)
+{
+ return ruv_replace_replica_purl_nolock(ruv, rid, replica_purl, RUV_LOCK);
+}
+
+int
+ruv_replace_replica_purl_nolock(RUV *ruv, ReplicaId rid, const char *replica_purl, int lock)
{
RUVElement* replica;
int rc = RUV_NOTFOUND;
PR_ASSERT (ruv && replica_purl);
- slapi_rwlock_wrlock (ruv->lock);
+ if(lock)
+ slapi_rwlock_wrlock (ruv->lock);
+
replica = ruvGetReplica (ruv, rid);
if (replica != NULL)
{
@@ -497,7 +507,9 @@ ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl)
rc = RUV_SUCCESS;
}
- slapi_rwlock_unlock (ruv->lock);
+ if(lock)
+ slapi_rwlock_unlock (ruv->lock);
+
return rc;
}
diff --git a/ldap/servers/plugins/replication/repl5_ruv.h b/ldap/servers/plugins/replication/repl5_ruv.h
index 944f5ede4..036951fb9 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.h
+++ b/ldap/servers/plugins/replication/repl5_ruv.h
@@ -82,6 +82,10 @@ enum
RUV_COMP_RUV2_MISSING /* ruv1 contains replicas not in ruv2 */
};
+/* used by ruv_replace_replica_purl_nolock */
+#define RUV_LOCK 1
+#define RUV_DONT_LOCK 0
+
#define RUV_COMP_IS_FATAL(ruvcomp) (ruvcomp && (ruvcomp < RUV_COMP_RUV1_MISSING))
typedef struct ruv_enum_data
@@ -99,6 +103,7 @@ RUV* ruv_dup (const RUV *ruv);
void ruv_destroy (RUV **ruv);
void ruv_copy_and_destroy (RUV **srcruv, RUV **destruv);
int ruv_replace_replica_purl (RUV *ruv, ReplicaId rid, const char *replica_purl);
+int ruv_replace_replica_purl_nolock(RUV *ruv, ReplicaId rid, const char *replica_purl, int lock);
int ruv_delete_replica (RUV *ruv, ReplicaId rid);
int ruv_add_replica (RUV *ruv, ReplicaId rid, const char *replica_purl);
int ruv_add_index_replica (RUV *ruv, ReplicaId rid, const char *replica_purl, int index);
| 0 |
ee385e64f9dff2f36ffa8eebd872f98aadcffbdb
|
389ds/389-ds-base
|
Resolves: #193724
Summary: "nested" filtered roles result in deadlock (Comment #12)
Description:
1. Changed cache_lock to the read-write lock.
2. Instead of using the local vattr_context in vattr_test_filter, use the one
set in pblock as much as possible. To achieve the goal, introduced
pb_vattr_context to pblock.
3. Increased VATTR_LOOP_COUNT_MAX from 50 to 256.
4. When the loop count hit VATTR_LOOP_COUNT_MAX, it sets
LDAP_UNWILLING_TO_PERFORM and returns it to the client.
|
commit ee385e64f9dff2f36ffa8eebd872f98aadcffbdb
Author: Noriko Hosoi <[email protected]>
Date: Fri Oct 12 18:03:43 2007 +0000
Resolves: #193724
Summary: "nested" filtered roles result in deadlock (Comment #12)
Description:
1. Changed cache_lock to the read-write lock.
2. Instead of using the local vattr_context in vattr_test_filter, use the one
set in pblock as much as possible. To achieve the goal, introduced
pb_vattr_context to pblock.
3. Increased VATTR_LOOP_COUNT_MAX from 50 to 256.
4. When the loop count hit VATTR_LOOP_COUNT_MAX, it sets
LDAP_UNWILLING_TO_PERFORM and returns it to the client.
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index 9eac62a1f..88678868f 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -2222,6 +2222,7 @@ bail:
returns
0 on success, we added a computed attribute
1 on outright failure
+ > LDAP ERROR CODE
-1 when doesn't know about attribute
{PARPAR} must also check the attribute does not exist if we are not
@@ -2392,10 +2393,14 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Sl
int free_flags = 0;
if(pSpec && pSpec->val) {
- slapi_vattr_values_get_sp(context, e, pSpec->val, &pAttrSpecs, &type_name_disposition, &actual_type_name, 0, &free_flags);
+ ret = slapi_vattr_values_get_sp(context, e, pSpec->val, &pAttrSpecs, &type_name_disposition, &actual_type_name, 0, &free_flags);
/* MAB: We need to free actual_type_name here !!!
XXX BAD--should use slapi_vattr_values_free() */
slapi_ch_free((void **) &actual_type_name);
+ if (SLAPI_VIRTUALATTRS_LOOP_DETECTED == ret) {
+ ret = LDAP_UNWILLING_TO_PERFORM;
+ goto bail;
+ }
}
if(pAttrSpecs || pDef->cosType == COSTYPE_POINTER)
@@ -2548,6 +2553,8 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context, Sl
ret = 1;
else if(hit == 1)
ret = 0;
+ else
+ ret = -1;
if(props)
*props = 0;
diff --git a/ldap/servers/plugins/roles/roles_cache.c b/ldap/servers/plugins/roles/roles_cache.c
index 9aa001911..4d3c40379 100644
--- a/ldap/servers/plugins/roles/roles_cache.c
+++ b/ldap/servers/plugins/roles/roles_cache.c
@@ -105,7 +105,7 @@ typedef struct _roles_cache_def {
PRThread *roles_tid;
int keeprunning;
- Slapi_Mutex *cache_lock;
+ PRRWLock *cache_lock;
Slapi_Mutex *stop_lock;
Slapi_Mutex *change_lock;
@@ -143,6 +143,7 @@ typedef struct _roles_cache_build_result
Slapi_Entry *requested_entry; /* entry to get nsrole from */
int has_value; /* flag to determine if a new value has been added to the result */
int need_value; /* flag to determine if we need the result */
+ vattr_context *context; /* vattr context */
} roles_cache_build_result;
/* Structure used to check if is_entry_member_of is part of a role defined in its suffix */
@@ -178,8 +179,9 @@ static int roles_cache_build_nsrole( caddr_t data, caddr_t arg );
static int roles_cache_find_node( caddr_t d1, caddr_t d2 );
static int roles_cache_find_roles_in_suffix(Slapi_DN *target_entry_dn, roles_cache_def **list_of_roles);
static int roles_is_entry_member_of_object(caddr_t data, caddr_t arg );
+static int roles_is_entry_member_of_object_ext(vattr_context *c, caddr_t data, caddr_t arg );
static int roles_check_managed(Slapi_Entry *entry_to_check, role_object *role, int *present);
-static int roles_check_filtered(Slapi_Entry *entry_to_check, role_object *role, int *present);
+static int roles_check_filtered(vattr_context *c, Slapi_Entry *entry_to_check, role_object *role, int *present);
static int roles_check_nested(caddr_t data, caddr_t arg);
static int roles_is_inscope(Slapi_Entry *entry_to_check, Slapi_DN *role_dn);
static void berval_set_string(struct berval *bv, const char* string);
@@ -303,7 +305,7 @@ static roles_cache_def *roles_cache_create_suffix(Slapi_DN *sdn)
return(NULL);
}
- new_suffix->cache_lock = slapi_new_mutex();
+ new_suffix->cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "roles_def_lock");
new_suffix->change_lock = slapi_new_mutex();
new_suffix->stop_lock = slapi_new_mutex();
new_suffix->create_lock = slapi_new_mutex();
@@ -610,7 +612,7 @@ static int roles_cache_update(roles_cache_def *suffix_to_update)
slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_update \n");
- slapi_lock_mutex(suffix_to_update->cache_lock);
+ PR_RWLock_Wlock(suffix_to_update->cache_lock);
operation = suffix_to_update->notified_operation;
entry = suffix_to_update->notified_entry;
@@ -646,7 +648,7 @@ static int roles_cache_update(roles_cache_def *suffix_to_update)
suffix_to_update->notified_entry = NULL;
}
- slapi_unlock_mutex(suffix_to_update->cache_lock);
+ PR_RWLock_Unlock(suffix_to_update->cache_lock);
if ( dn != NULL )
{
@@ -1425,6 +1427,11 @@ static int roles_cache_object_nested_from_dn(Slapi_DN *role_dn, role_object_nest
Return -1: the entry has no nsrole
*/
int roles_cache_listroles(Slapi_Entry *entry, int return_values, Slapi_ValueSet **valueset_out)
+{
+ return roles_cache_listroles_ext(NULL, entry, return_values, valueset_out);
+}
+
+int roles_cache_listroles_ext(vattr_context *c, Slapi_Entry *entry, int return_values, Slapi_ValueSet **valueset_out)
{
roles_cache_def *roles_cache = NULL;
int rc = 0;
@@ -1464,13 +1471,14 @@ int roles_cache_listroles(Slapi_Entry *entry, int return_values, Slapi_ValueSet
arg.need_value = return_values;
arg.requested_entry = entry;
arg.has_value = 0;
+ arg.context = c;
/* XXX really need a mutex for this read operation ? */
- slapi_lock_mutex(roles_cache->cache_lock);
+ PR_RWLock_Rlock(roles_cache->cache_lock);
avl_apply(roles_cache->avl_tree, (IFP)roles_cache_build_nsrole, &arg, -1, AVL_INORDER);
- slapi_unlock_mutex(roles_cache->cache_lock);
+ PR_RWLock_Unlock(roles_cache->cache_lock);
if( !arg.has_value )
{
@@ -1507,53 +1515,59 @@ int roles_cache_listroles(Slapi_Entry *entry, int return_values, Slapi_ValueSet
------------------------
Traverse the tree containing roles definitions for a suffix and for each
one of them, check wether the entry is a member of it or not
- For ones which check out positive, we add their DN to the value
- always return 0 to allow to trverse all the tree
+ For ones which check out positive, we add their DN to the value
+ always return 0 to allow to trverse all the tree
*/
static int roles_cache_build_nsrole( caddr_t data, caddr_t arg )
{
Slapi_Value *value = NULL;
roles_cache_build_result *result = (roles_cache_build_result*)arg;
role_object *this_role = (role_object*)data;
- roles_cache_search_in_nested get_nsrole;
+ roles_cache_search_in_nested get_nsrole;
/* Return a value different from the stop flag to be able
to go through all the tree */
- int rc = 0;
+ int rc = 0;
+ int tmprc = 0;
- slapi_log_error(SLAPI_LOG_PLUGIN,
- ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_build_nsrole: role %s\n",
- (char*) slapi_sdn_get_ndn(this_role->dn));
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ ROLES_PLUGIN_SUBSYSTEM, "--> roles_cache_build_nsrole: role %s\n",
+ (char*) slapi_sdn_get_ndn(this_role->dn));
value = slapi_value_new_string("");
- get_nsrole.is_entry_member_of = result->requested_entry;
- get_nsrole.present = 0;
- get_nsrole.hint = 0;
+ get_nsrole.is_entry_member_of = result->requested_entry;
+ get_nsrole.present = 0;
+ get_nsrole.hint = 0;
- roles_is_entry_member_of_object((caddr_t)this_role, (caddr_t)&get_nsrole);
+ tmprc = roles_is_entry_member_of_object_ext(result->context, (caddr_t)this_role, (caddr_t)&get_nsrole);
+ if (SLAPI_VIRTUALATTRS_LOOP_DETECTED == tmprc)
+ {
+ /* all we want to detect and return is loop/stack overflow */
+ rc = tmprc;
+ }
/* If so, add its DN to the attribute */
if (get_nsrole.present)
{
result->has_value = 1;
- if ( result->need_value )
- {
- slapi_value_set_string(value,(char*) slapi_sdn_get_ndn(this_role->dn));
- slapi_valueset_add_value(*(result->nsrole_values),value);
- }
- else
- {
- /* we don't need the value but we already know there is one nsrole.
- stop the traversal
- */
- rc = -1;
- }
+ if ( result->need_value )
+ {
+ slapi_value_set_string(value,(char*) slapi_sdn_get_ndn(this_role->dn));
+ slapi_valueset_add_value(*(result->nsrole_values),value);
+ }
+ else
+ {
+ /* we don't need the value but we already know there is one nsrole.
+ stop the traversal
+ */
+ rc = -1;
+ }
}
slapi_value_free(&value);
- slapi_log_error(SLAPI_LOG_PLUGIN,
- ROLES_PLUGIN_SUBSYSTEM, "<-- roles_cache_build_nsrole\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ ROLES_PLUGIN_SUBSYSTEM, "<-- roles_cache_build_nsrole\n");
return rc;
}
@@ -1564,54 +1578,54 @@ static int roles_cache_build_nsrole( caddr_t data, caddr_t arg )
Checks if an entry has a presented role, assuming that we've already verified
that
the role both exists and is in scope
- return 0: no processing error
- return -1: error
+ return 0: no processing error
+ return -1: error
*/
int roles_check(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present)
{
roles_cache_def *roles_cache = NULL;
role_object *this_role = NULL;
- roles_cache_search_in_nested get_nsrole;
+ roles_cache_search_in_nested get_nsrole;
int rc = 0;
- slapi_log_error(SLAPI_LOG_PLUGIN,
- ROLES_PLUGIN_SUBSYSTEM, "--> roles_check\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ ROLES_PLUGIN_SUBSYSTEM, "--> roles_check\n");
- *present = 0;
+ *present = 0;
- PR_RWLock_Rlock(global_lock);
+ PR_RWLock_Rlock(global_lock);
if ( roles_cache_find_roles_in_suffix(slapi_entry_get_sdn(entry_to_check),
&roles_cache) != 0 )
{
- PR_RWLock_Unlock(global_lock);
+ PR_RWLock_Unlock(global_lock);
return -1;
}
- PR_RWLock_Unlock(global_lock);
+ PR_RWLock_Unlock(global_lock);
this_role = (role_object *)avl_find(roles_cache->avl_tree, role_dn, (IFP)roles_cache_find_node);
- /* MAB: For some reason the assumption made by this function (the role exists and is in scope)
- * does not seem to be true... this_role might be NULL after the avl_find call (is the avl_tree
- * broken? Anyway, this is crashing the 5.1 server on 29-Aug-01, so I am applying the following patch
- * to avoid the crash inside roles_is_entry_member_of_object */
- /* Begin patch */
- if (!this_role) {
- /* Assume that the entry is not member of the role (*present=0) and leave... */
- return rc;
- }
- /* End patch */
+ /* MAB: For some reason the assumption made by this function (the role exists and is in scope)
+ * does not seem to be true... this_role might be NULL after the avl_find call (is the avl_tree
+ * broken? Anyway, this is crashing the 5.1 server on 29-Aug-01, so I am applying the following patch
+ * to avoid the crash inside roles_is_entry_member_of_object */
+ /* Begin patch */
+ if (!this_role) {
+ /* Assume that the entry is not member of the role (*present=0) and leave... */
+ return rc;
+ }
+ /* End patch */
- get_nsrole.is_entry_member_of = entry_to_check;
- get_nsrole.present = 0;
- get_nsrole.hint = 0;
+ get_nsrole.is_entry_member_of = entry_to_check;
+ get_nsrole.present = 0;
+ get_nsrole.hint = 0;
roles_is_entry_member_of_object((caddr_t)this_role, (caddr_t)&get_nsrole);
- *present = get_nsrole.present;
+ *present = get_nsrole.present;
- slapi_log_error(SLAPI_LOG_PLUGIN,
- ROLES_PLUGIN_SUBSYSTEM, "<-- roles_check\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ ROLES_PLUGIN_SUBSYSTEM, "<-- roles_check\n");
return rc;
}
@@ -1690,6 +1704,11 @@ static int roles_cache_find_roles_in_suffix(Slapi_DN *target_entry_dn, roles_cac
-> to check the presence, see present
*/
static int roles_is_entry_member_of_object(caddr_t data, caddr_t argument )
+{
+ return roles_is_entry_member_of_object_ext(NULL, data, argument );
+}
+
+static int roles_is_entry_member_of_object_ext(vattr_context *c, caddr_t data, caddr_t argument )
{
int rc = -1;
@@ -1717,7 +1736,7 @@ static int roles_is_entry_member_of_object(caddr_t data, caddr_t argument )
rc = roles_check_managed(entry_to_check,this_role,&get_nsrole->present);
break;
case ROLE_TYPE_FILTERED:
- rc = roles_check_filtered(entry_to_check,this_role,&get_nsrole->present);
+ rc = roles_check_filtered(c, entry_to_check,this_role,&get_nsrole->present);
break;
case ROLE_TYPE_NESTED:
{
@@ -1789,13 +1808,14 @@ static int roles_check_managed(Slapi_Entry *entry_to_check, role_object *role, i
return 1: fail
-> to check the presence, see present
*/
-static int roles_check_filtered(Slapi_Entry *entry_to_check, role_object *role, int *present)
+static int roles_check_filtered(vattr_context *c, Slapi_Entry *entry_to_check, role_object *role, int *present)
{
int rc = 0;
slapi_log_error(SLAPI_LOG_PLUGIN,
ROLES_PLUGIN_SUBSYSTEM, "--> roles_check_filtered\n");
- rc = slapi_filter_test_simple(entry_to_check,role->filter);
+ rc = slapi_vattr_filter_test_ext(slapi_vattr_get_pblock_from_context(c),
+ entry_to_check, role->filter, 0, 0);
if ( rc == 0 )
{
*present = 1;
@@ -1991,7 +2011,7 @@ static void roles_cache_role_def_free(roles_cache_def *role_def)
avl_free(role_def->avl_tree, (IFP)roles_cache_role_object_free);
slapi_sdn_free(&(role_def->suffix_dn));
- slapi_destroy_mutex(role_def->cache_lock);
+ PR_DestroyRWLock(role_def->cache_lock);
role_def->cache_lock = NULL;
slapi_destroy_mutex(role_def->change_lock);
role_def->change_lock = NULL;
diff --git a/ldap/servers/plugins/roles/roles_cache.h b/ldap/servers/plugins/roles/roles_cache.h
index c4049d9a2..870f5a06e 100644
--- a/ldap/servers/plugins/roles/roles_cache.h
+++ b/ldap/servers/plugins/roles/roles_cache.h
@@ -73,6 +73,7 @@ int roles_cache_init();
void roles_cache_stop();
void roles_cache_change_notify(Slapi_PBlock *pb);
int roles_cache_listroles(Slapi_Entry *entry, int return_value, Slapi_ValueSet **valueset_out);
+int roles_cache_listroles_ext(vattr_context *c, Slapi_Entry *entry, int return_value, Slapi_ValueSet **valueset_out);
int roles_check(Slapi_Entry *entry_to_check, Slapi_DN *role_dn, int *present);
diff --git a/ldap/servers/plugins/roles/roles_plugin.c b/ldap/servers/plugins/roles/roles_plugin.c
index 4db36c42a..9edc903cc 100644
--- a/ldap/servers/plugins/roles/roles_plugin.c
+++ b/ldap/servers/plugins/roles/roles_plugin.c
@@ -248,7 +248,7 @@ int roles_sp_get_value(vattr_sp_handle *handle,
{
int rc = -1;
- rc = roles_cache_listroles(e, 1, results);
+ rc = roles_cache_listroles_ext(c, e, 1, results);
if (rc == 0)
{
*free_flags = SLAPI_VIRTUALATTRS_RETURNED_COPIES;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 162e39603..7979b5852 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -48,14 +48,14 @@
/* prototypes */
static int build_candidate_list( Slapi_PBlock *pb, backend *be,
- struct backentry *e, const char * base, int scope,
- int *lookup_returned_allidsp, IDList** candidates);
+ struct backentry *e, const char * base, int scope,
+ int *lookup_returned_allidsp, IDList** candidates);
static IDList *base_candidates( Slapi_PBlock *pb, struct backentry *e );
static IDList *onelevel_candidates( Slapi_PBlock *pb, backend *be, const char *base, struct backentry *e, Slapi_Filter *filter, int managedsait, int *lookup_returned_allidsp, int *err );
static back_search_result_set* new_search_result_set(IDList* idl,int vlv, int lookthroughlimit);
static void delete_search_result_set( back_search_result_set **sr );
static int can_skip_filter_test( Slapi_PBlock *pb, struct slapi_filter *f,
- int scope, IDList *idl );
+ int scope, IDList *idl );
/* This is for performance testing, allows us to disable ACL checking altogether */
#if defined(DISABLE_ACL_CHECK)
@@ -69,38 +69,38 @@ static int can_skip_filter_test( Slapi_PBlock *pb, struct slapi_filter *f,
static int
compute_lookthrough_limit( Slapi_PBlock *pb, struct ldbminfo *li )
{
- Slapi_Connection *conn = NULL;
- int limit;
-
- slapi_pblock_get( pb, SLAPI_CONNECTION, &conn);
-
- if ( slapi_reslimit_get_integer_limit( conn,
- li->li_reslimit_lookthrough_handle, &limit )
- != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
- /*
- * no limit associated with binder/connection or some other error
- * occurred. use the default.
- */
- int isroot = 0;
-
- slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot );
- if (isroot) {
- limit = -1;
- } else {
- PR_Lock(li->li_config_mutex);
- limit = li->li_lookthroughlimit;
- PR_Unlock(li->li_config_mutex);
- }
- }
-
- return( limit );
+ Slapi_Connection *conn = NULL;
+ int limit;
+
+ slapi_pblock_get( pb, SLAPI_CONNECTION, &conn);
+
+ if ( slapi_reslimit_get_integer_limit( conn,
+ li->li_reslimit_lookthrough_handle, &limit )
+ != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
+ /*
+ * no limit associated with binder/connection or some other error
+ * occurred. use the default.
+ */
+ int isroot = 0;
+
+ slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot );
+ if (isroot) {
+ limit = -1;
+ } else {
+ PR_Lock(li->li_config_mutex);
+ limit = li->li_lookthroughlimit;
+ PR_Unlock(li->li_config_mutex);
+ }
+ }
+
+ return( limit );
}
/* don't free the berval, just clean it */
static void
berval_done(struct berval *val)
{
- slapi_ch_free_string(&val->bv_val);
+ slapi_ch_free_string(&val->bv_val);
}
/*
@@ -116,20 +116,20 @@ int ldbm_back_search_cleanup(Slapi_PBlock *pb, struct ldbminfo *li, sort_spec_th
{
slapi_send_ldap_result( pb, ldap_result, NULL, ldap_result_description, 0, NULL );
}
- {
- /* hack hack --- code to free the result set if we don't need it */
- /* We get it and check to see if the structure was ever used */
- back_search_result_set *sr = NULL;
- slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr );
- if ( (NULL != sr) && (function_result != 0) ) {
- delete_search_result_set(&sr);
- }
- }
- slapi_sdn_done(sdn);
- if (vlv_request_control)
- {
- berval_done(&vlv_request_control->value);
- }
+ {
+ /* hack hack --- code to free the result set if we don't need it */
+ /* We get it and check to see if the structure was ever used */
+ back_search_result_set *sr = NULL;
+ slapi_pblock_get( pb, SLAPI_SEARCH_RESULT_SET, &sr );
+ if ( (NULL != sr) && (function_result != 0) ) {
+ delete_search_result_set(&sr);
+ }
+ }
+ slapi_sdn_done(sdn);
+ if (vlv_request_control)
+ {
+ berval_done(&vlv_request_control->value);
+ }
return function_result;
}
@@ -630,8 +630,8 @@ ldbm_back_search( Slapi_PBlock *pb )
*/
static int
build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
- const char * base, int scope, int *lookup_returned_allidsp,
- IDList** candidates)
+ const char * base, int scope, int *lookup_returned_allidsp,
+ IDList** candidates)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;
int managedsait= 0;
@@ -875,123 +875,123 @@ subtree_candidates(
return( candidates );
}
-static int grok_filter(struct slapi_filter *f);
+static int grok_filter(struct slapi_filter *f);
#if 0
/* Helper for grok_filter() */
static int
-grok_filter_list(struct slapi_filter *flist)
+grok_filter_list(struct slapi_filter *flist)
{
- struct slapi_filter *f;
-
- /* Scan the clauses of the AND filter, if any of them fails the grok, then we fail */
- for ( f = flist; f != NULL; f = f->f_next ) {
- if ( !grok_filter(f) ) {
- return( 0 );
- }
- }
- return( 1 );
+ struct slapi_filter *f;
+
+ /* Scan the clauses of the AND filter, if any of them fails the grok, then we fail */
+ for ( f = flist; f != NULL; f = f->f_next ) {
+ if ( !grok_filter(f) ) {
+ return( 0 );
+ }
+ }
+ return( 1 );
}
#endif
/* Helper function for can_skip_filter_test() */
-static int grok_filter(struct slapi_filter *f)
+static int grok_filter(struct slapi_filter *f)
{
- switch ( f->f_choice ) {
- case LDAP_FILTER_EQUALITY:
- return 1; /* If there's an ID list and an equality filter, we can skip the filter test */
- case LDAP_FILTER_SUBSTRINGS:
- return 0;
+ switch ( f->f_choice ) {
+ case LDAP_FILTER_EQUALITY:
+ return 1; /* If there's an ID list and an equality filter, we can skip the filter test */
+ case LDAP_FILTER_SUBSTRINGS:
+ return 0;
- case LDAP_FILTER_GE:
- return 1;
+ case LDAP_FILTER_GE:
+ return 1;
- case LDAP_FILTER_LE:
- return 1;
+ case LDAP_FILTER_LE:
+ return 1;
- case LDAP_FILTER_PRESENT:
- return 1; /* If there's an ID list, and a presence filter, we can skip the filter test */
+ case LDAP_FILTER_PRESENT:
+ return 1; /* If there's an ID list, and a presence filter, we can skip the filter test */
- case LDAP_FILTER_APPROX:
- return 0;
+ case LDAP_FILTER_APPROX:
+ return 0;
- case LDAP_FILTER_EXTENDED:
- return 0;
+ case LDAP_FILTER_EXTENDED:
+ return 0;
- case LDAP_FILTER_AND:
- return 0; /* Unless we check to see whether the presence and equality branches
- of the search filter were all indexed, we get things wrong here,
- so let's punt for now */
- /* return grok_filter_list(f->f_and); AND clauses are potentially OK */
+ case LDAP_FILTER_AND:
+ return 0; /* Unless we check to see whether the presence and equality branches
+ of the search filter were all indexed, we get things wrong here,
+ so let's punt for now */
+ /* return grok_filter_list(f->f_and); AND clauses are potentially OK */
- case LDAP_FILTER_OR:
- return 0;
+ case LDAP_FILTER_OR:
+ return 0;
- case LDAP_FILTER_NOT:
- return 0;
+ case LDAP_FILTER_NOT:
+ return 0;
- default:
- return 0;
- }
+ default:
+ return 0;
+ }
}
/* Routine which says whether or not the indices produced a "correct" answer */
static int
can_skip_filter_test(
- Slapi_PBlock *pb,
- struct slapi_filter *f,
- int scope,
- IDList *idl
+ Slapi_PBlock *pb,
+ struct slapi_filter *f,
+ int scope,
+ IDList *idl
)
{
- int rc = 0;
-
- /* Is the ID list ALLIDS ? */
- if ( ALLIDS(idl)) {
- /* If so, then can't optimize */
- return rc;
- }
-
- /* Is this a base scope search? */
- if ( scope == LDAP_SCOPE_BASE ) {
- /*
- * If so, then we can't optimize. Why not? Because we only consult
- * the entrydn index in producing our 1 candidate, and that means
- * we have not used the filter to produce the candidate list.
- */
- return rc;
- }
-
- /* Grok the filter and tell me if it has only equality components in it */
- rc = grok_filter(f);
-
- /* If we haven't determined that we can't skip the filter test already,
- * do one last check for attribute subtypes. We don't need to worry
- * about any complex filters here since grok_filter() will have already
- * assumed that we can't skip the filter test in those cases. */
- if (rc != 0) {
- char *type = NULL;
- char *basetype = NULL;
-
- /* We don't need to free type since that's taken
- * care of when the filter is free'd later. We
- * do need to free basetype when we are done. */
- slapi_filter_get_attribute_type(f, &type);
- basetype = slapi_attr_basetype(type, NULL, 0);
-
- /* Is the filter using an attribute subtype? */
- if (strcasecmp(type, basetype) != 0) {
- /* If so, we can't optimize since attribute subtypes
- * are simply indexed under their basetype attribute.
- * The basetype index has no knowledge of the subtype
- * itself. In the future, we should add support for
- * indexing the subtypes so we can optimize this type
- * of search. */
- rc = 0;
- }
- slapi_ch_free_string(&basetype);
- }
-
- return rc;
+ int rc = 0;
+
+ /* Is the ID list ALLIDS ? */
+ if ( ALLIDS(idl)) {
+ /* If so, then can't optimize */
+ return rc;
+ }
+
+ /* Is this a base scope search? */
+ if ( scope == LDAP_SCOPE_BASE ) {
+ /*
+ * If so, then we can't optimize. Why not? Because we only consult
+ * the entrydn index in producing our 1 candidate, and that means
+ * we have not used the filter to produce the candidate list.
+ */
+ return rc;
+ }
+
+ /* Grok the filter and tell me if it has only equality components in it */
+ rc = grok_filter(f);
+
+ /* If we haven't determined that we can't skip the filter test already,
+ * do one last check for attribute subtypes. We don't need to worry
+ * about any complex filters here since grok_filter() will have already
+ * assumed that we can't skip the filter test in those cases. */
+ if (rc != 0) {
+ char *type = NULL;
+ char *basetype = NULL;
+
+ /* We don't need to free type since that's taken
+ * care of when the filter is free'd later. We
+ * do need to free basetype when we are done. */
+ slapi_filter_get_attribute_type(f, &type);
+ basetype = slapi_attr_basetype(type, NULL, 0);
+
+ /* Is the filter using an attribute subtype? */
+ if (strcasecmp(type, basetype) != 0) {
+ /* If so, we can't optimize since attribute subtypes
+ * are simply indexed under their basetype attribute.
+ * The basetype index has no knowledge of the subtype
+ * itself. In the future, we should add support for
+ * indexing the subtypes so we can optimize this type
+ * of search. */
+ rc = 0;
+ }
+ slapi_ch_free_string(&basetype);
+ }
+
+ return rc;
}
@@ -1014,24 +1014,25 @@ ldbm_back_next_search_entry( Slapi_PBlock *pb )
int
ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
{
- backend *be;
- ldbm_instance *inst;
+ backend *be;
+ ldbm_instance *inst;
struct ldbminfo *li;
- int scope;
- int managedsait;
- Slapi_Attr *attr;
- Slapi_Filter *filter;
- char *base;
- back_search_result_set *sr;
- ID id;
- struct backentry *e;
- int nentries;
- time_t curtime, stoptime, optime;
- int tlimit, llimit, slimit, isroot;
- struct berval **urls = NULL;
- int err;
- Slapi_DN basesdn;
- char *target_uniqueid;
+ int scope;
+ int managedsait;
+ Slapi_Attr *attr;
+ Slapi_Filter *filter;
+ char *base;
+ back_search_result_set *sr;
+ ID id;
+ struct backentry *e;
+ int nentries;
+ time_t curtime, stoptime, optime;
+ int tlimit, llimit, slimit, isroot;
+ struct berval **urls = NULL;
+ int err;
+ Slapi_DN basesdn;
+ char *target_uniqueid;
+ int rc = 0;
slapi_pblock_get( pb, SLAPI_BACKEND, &be );
slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
@@ -1083,8 +1084,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL );
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
- slapi_sdn_done(&basesdn);
- return -1;
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
}
/* check time limit */
@@ -1097,8 +1098,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL );
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
- slapi_sdn_done(&basesdn);
- return -1;
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
}
/* check lookthrough limit */
@@ -1110,8 +1111,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL );
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
- slapi_sdn_done(&basesdn);
- return -1;
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
}
/* get the entry */
@@ -1124,8 +1125,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL );
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
- slapi_sdn_done(&basesdn);
- return 0;
+ rc = 0;
+ goto bail;
}
++sr->sr_lookthroughcount; /* checked above */
@@ -1142,8 +1143,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
* is gonna be traumatic. unavoidable.
*/
slapi_send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);
- slapi_sdn_done(&basesdn);
- return return_on_disk_full(li);
+ rc = return_on_disk_full(li);
+ goto bail;
}
}
LDAPDebug( LDAP_DEBUG_ARGS, "candidate %lu not found\n", (u_long)id, 0, 0 );
@@ -1182,8 +1183,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, e );
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, e->ep_entry );
- slapi_sdn_done(&basesdn);
- return 0;
+ rc = 0;
+ goto bail;
}
}
else
@@ -1253,8 +1254,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
cache_return( &inst->inst_cache, &e );
delete_search_result_set( &sr );
slapi_send_ldap_result( pb, LDAP_SIZELIMIT_EXCEEDED, NULL, NULL, nentries, urls );
- slapi_sdn_done(&basesdn);
- return -1;
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
}
slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, &slimit );
}
@@ -1277,8 +1278,8 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
}
slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, e->ep_entry );
}
- slapi_sdn_done(&basesdn);
- return 0;
+ rc = 0;
+ goto bail;
}
else
{
@@ -1289,11 +1290,19 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
{
/* Failed the filter test, and this isn't a VLV Search */
cache_return( &inst->inst_cache, &(sr->sr_entry) );
+ 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,
+ "Failed the filter test", 0, NULL );
+ rc = SLAPI_FAIL_GENERAL;
+ goto bail;
+ }
}
}
}
- /*NOTREACHED*/
+bail:
slapi_sdn_done(&basesdn);
+ return rc;
}
@@ -1333,19 +1342,19 @@ ldbm_back_entry_release( Slapi_PBlock *pb, void *backend_info_ptr ) {
ldbm_instance *inst;
if ( backend_info_ptr == NULL )
- return 1;
+ return 1;
slapi_pblock_get( pb, SLAPI_BACKEND, &be );
- inst = (ldbm_instance *) be->be_instance_info;
+ inst = (ldbm_instance *) be->be_instance_info;
cache_return( &inst->inst_cache, (struct backentry **)&backend_info_ptr );
if( ((struct backentry *) backend_info_ptr)->ep_vlventry != NULL )
{
- /* This entry was created during a vlv search whose acl check failed. It needs to be
- * freed here */
+ /* This entry was created during a vlv search whose acl check failed. It needs to be
+ * freed here */
slapi_entry_free( ((struct backentry *) backend_info_ptr)->ep_vlventry );
- ((struct backentry *) backend_info_ptr)->ep_vlventry = NULL;
+ ((struct backentry *) backend_info_ptr)->ep_vlventry = NULL;
}
return 0;
}
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index 1669bdc3c..317c4f247 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -861,7 +861,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type );
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type );
break;
case LDAP_FILTER_SUBSTRINGS:
@@ -873,7 +873,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_SUBSTRING, f->f_sub_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_SUBSTRING, f->f_sub_type);
break;
case LDAP_FILTER_GE:
@@ -886,7 +886,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_LE:
@@ -899,7 +899,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_PRESENT:
@@ -911,7 +911,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_PRES, f->f_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_PRES, f->f_type);
break;
case LDAP_FILTER_APPROX:
@@ -924,7 +924,7 @@ slapi_vattr_filter_test_ext_internal(
if ( only_check_access || rc != LDAP_SUCCESS ) {
return( rc );
}
- rc = vattr_test_filter( e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
+ rc = vattr_test_filter( pb, e, f, FILTER_TYPE_AVA, f->f_ava.ava_type);
break;
case LDAP_FILTER_EXTENDED:
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 7a6b13748..020514f58 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1418,6 +1418,7 @@ typedef struct slapi_pblock {
/* For password policy control */
int pb_pwpolicy_ctrl;
+ void *pb_vattr_context; /* hold the vattr_context for roles/cos */
} slapi_pblock;
/* The referral element */
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 498b68e93..85aa85c50 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -475,7 +475,8 @@ int slapi_vattrcache_iscacheable( const char * type );
void slapi_vattrcache_cache_all();
void slapi_vattrcache_cache_none();
-int vattr_test_filter(/* Entry we're interested in */ Slapi_Entry *e,
+int vattr_test_filter( Slapi_PBlock *pb,
+ /* Entry we're interested in */ Slapi_Entry *e,
Slapi_Filter *f,
filter_type_t filter_type,
char *type);
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index d18951f58..8e34f305f 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -102,7 +102,7 @@ struct _vattr_context {
unsigned int vattr_context_loop_count;
unsigned int error_displayed;
};
-#define VATTR_LOOP_COUNT_MAX 50
+#define VATTR_LOOP_COUNT_MAX 256
typedef vattr_sp_handle vattr_sp_handle_list;
@@ -300,11 +300,19 @@ static int vattr_helper_get_entry_conts_ex(Slapi_Entry *e,const char *type, vatt
vattr_context *vattr_context_new( Slapi_PBlock *pb )
{
- vattr_context *c = (vattr_context *)slapi_ch_calloc(1, sizeof(vattr_context));
+ vattr_context *c = NULL;
+ if (pb && pb->pb_vattr_context) {
+ c = (vattr_context *)pb->pb_vattr_context;
+ } else {
+ c = (vattr_context *)slapi_ch_calloc(1, sizeof(vattr_context));
+ }
/* The payload is zero, which is what we want */
if ( c ) {
c->pb = pb;
}
+ if ( pb && c != (vattr_context *)pb->pb_vattr_context ) {
+ pb->pb_vattr_context = (void *)c;
+ }
return c;
}
@@ -333,15 +341,33 @@ static void vattr_context_ungrok(vattr_context **c)
/* Decrement the loop count */
if (0 == vattr_context_unmark(*c)) {
/* If necessary, delete the structure */
+ if ((*c)->pb) {
+ (*c)->pb->pb_vattr_context = NULL;
+ }
slapi_ch_free((void **)c);
}
}
+static int vattr_context_grok_pb( Slapi_PBlock *pb, vattr_context **c )
+{
+ int rc = -1;
+ if (NULL == c) {
+ return rc;
+ }
+ *c = vattr_context_new( pb );
+ if (NULL == *c) {
+ return ENOMEM;
+ }
+ rc = vattr_context_check(*c);
+ vattr_context_mark(*c); /* increment loop count */
+ return rc;
+}
+
/* Check and mess with the context structure on entry to a vattr sp function */
static int vattr_context_grok(vattr_context **c)
{
int rc = 0;
- /* First check that we've not got into an infinite loop.
+ /* First check that we've not got into an infinite loop.
We do so by means of the vattr_context structure.
*/
@@ -388,10 +414,12 @@ static int vattr_context_is_loop_msg_displayed(vattr_context **c)
* >0 an ldap error code
*
*/
-int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
+int vattr_test_filter( Slapi_PBlock *pb,
+ /* Entry we're interested in */ Slapi_Entry *e,
Slapi_Filter *f,
filter_type_t filter_type,
- char * type) {
+ char * type)
+{
int rc = -1;
int sp_bit = 0; /* Set if an SP supplied an answer */
vattr_sp_handle_list *list = NULL;
@@ -445,26 +473,23 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
char **actual_type_name;
int buffer_flags;
vattr_get_thang my_get = {0};
- vattr_context ctx;
/* bit cacky, but need to make a null terminated lists for now
* for the (unimplemented and so fake) batch attribute request
*/
char *types[2];
void *hint_list[2];
+ vattr_context *ctx;
+ vattr_context_grok_pb( pb, &ctx ); /* get or new context */
types[0] = type;
types[1] = 0;
hint_list[1] = 0;
- /* set up some local context */
- ctx.vattr_context_loop_count=1;
- ctx.error_displayed = 0;
-
for (current_handle = vattr_map_sp_first(list,&hint); current_handle; current_handle = vattr_map_sp_next(current_handle,&hint))
{
hint_list[0] = hint;
- rc = vattr_call_sp_get_batch_values(current_handle,&ctx,e,
+ rc = vattr_call_sp_get_batch_values(current_handle,ctx,e,
&my_get,types,&results,&type_name_disposition,
&actual_type_name,flags,&buffer_flags, hint_list);
@@ -474,6 +499,7 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
break;
}
}
+ vattr_context_ungrok(&ctx);
if(!sp_bit)
{
@@ -483,7 +509,6 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
* but first lets cache the no result
*/
slapi_entry_vattrcache_merge_sv(e, type, NULL );
-
}
else
{
@@ -491,7 +516,7 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
* A vattr sp supplied an answer.
* so turn the value into a Slapi_Attr, pass
* to the syntax plugin for comparison.
- */
+ */
if ( filter_type == FILTER_TYPE_AVA ||
filter_type == FILTER_TYPE_SUBSTRING ) {
@@ -566,14 +591,13 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
slapi_ch_free((void**)&type_name_disposition);
}
}
-
break;
- }
+ }
}/* switch */
}
/* If no SP supplied the answer, take it from the entry */
- if (!sp_bit)
- {
+ if (rc <= 1 && !sp_bit) /* if LDAP ERROR is set, skip further testing */
+ {
int acl_test_done;
if ( filter_type == FILTER_TYPE_AVA ) {
@@ -597,7 +621,7 @@ int vattr_test_filter( /* Entry we're interested in */ Slapi_Entry *e,
0 /* do test filter */,
&acl_test_done);
}
- }
+ }
return rc;
}
/*
@@ -1690,7 +1714,7 @@ int vattr_call_sp_get_batch_values(vattr_sp_handle *handle, vattr_context *c, Sl
*actual_type_name = (char**)slapi_ch_calloc(2, sizeof(*actual_type_name));
ret =((handle->sp->sp_get_fn)(handle,c,e,*type,*results,*type_name_disposition,*actual_type_name,flags,buffer_flags, hint));
- if(ret)
+ if (ret)
{
slapi_ch_free((void**)results );
slapi_ch_free((void**)type_name_disposition );
@@ -2332,6 +2356,16 @@ void vattrcache_entry_WRITE_UNLOCK(const Slapi_Entry *e){
PR_RWLock_Unlock(e->e_virtual_lock);
}
+Slapi_PBlock *
+slapi_vattr_get_pblock_from_context(vattr_context *c)
+{
+ if (c) {
+ return c->pb;
+ } else {
+ return NULL;
+ }
+}
+
#ifdef VATTR_TEST_CODE
/* Prototype SP begins here */
diff --git a/ldap/servers/slapd/vattr_spi.h b/ldap/servers/slapd/vattr_spi.h
index 50d75901c..a7a670b3d 100644
--- a/ldap/servers/slapd/vattr_spi.h
+++ b/ldap/servers/slapd/vattr_spi.h
@@ -88,4 +88,6 @@ int slapi_vattr_values_get_sp_ex(vattr_context *c, /* Entry we're interested in
int slapi_vattr_namespace_values_get_sp(vattr_context *c, /* Entry we're interested in */ Slapi_Entry *e, /* backend namespace dn */ Slapi_DN *namespace_dn, /* attr type name */ char *type, /* pointer to result set */ Slapi_ValueSet*** results,int **type_name_disposition, char ***actual_type_name, int flags, int *free_flags, int *subtype_count);
int slapi_vattr_value_compare_sp(vattr_context *c, Slapi_Entry *e,char *type, Slapi_Value *test_this, int *result, int flags);
int slapi_vattr_namespace_value_compare_sp(vattr_context *c,/* Entry we're interested in */ Slapi_Entry *e, /* backend namespace dn*/Slapi_DN *namespace_dn, /* attr type name */ const char *type, Slapi_Value *test_this,/* pointer to result */ int *result, int flags);
+Slapi_PBlock *slapi_vattr_get_pblock_from_context( vattr_context *c );
+
| 0 |
aeebd5a04b7ccbf89f7052ac34652dd2e9ab4782
|
389ds/389-ds-base
|
Issue 5602 - UI - browser crash when trying to modify read-only variable
Description: Existing code that used to work (incorrectly) is now causing issues.
Need to use "let" instead of "const".
relates: https://github.com/389ds/389-ds-base/issues/5602
Reviewed by: spichugi(Thanks!)
|
commit aeebd5a04b7ccbf89f7052ac34652dd2e9ab4782
Author: Mark Reynolds <[email protected]>
Date: Thu Jan 12 08:28:45 2023 -0500
Issue 5602 - UI - browser crash when trying to modify read-only variable
Description: Existing code that used to work (incorrectly) is now causing issues.
Need to use "let" instead of "const".
relates: https://github.com/389ds/389-ds-base/issues/5602
Reviewed by: spichugi(Thanks!)
diff --git a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addCosTemplate.jsx b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addCosTemplate.jsx
index 2db056d04..b7dc75c33 100644
--- a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addCosTemplate.jsx
+++ b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addCosTemplate.jsx
@@ -540,7 +540,7 @@ class AddCosTemplate extends React.Component {
const required = oc.cells[1].split(',');
const optional = oc.cells[2].split(',');
- for (const attr of required) {
+ for (let attr of required) {
attr = attr.trim().toLowerCase();
if (attr === '') {
continue;
@@ -596,7 +596,7 @@ class AddCosTemplate extends React.Component {
}
}
- for (const attr of optional) {
+ for (let attr of optional) {
attr = attr.trim();
if (attr === '') {
continue;
diff --git a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addLdapEntry.jsx b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addLdapEntry.jsx
index 80ae94477..bffb210e2 100644
--- a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addLdapEntry.jsx
+++ b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/addLdapEntry.jsx
@@ -441,7 +441,7 @@ class AddLdapEntry extends React.Component {
const required = oc.cells[1].split(',');
const optional = oc.cells[2].split(',');
- for (const attr of required) {
+ for (let attr of required) {
attr = attr.trim().toLowerCase();
if (attr === '') {
continue;
@@ -493,7 +493,7 @@ class AddLdapEntry extends React.Component {
}
}
- for (const attr of optional) {
+ for (let attr of optional) {
attr = attr.trim();
if (attr === '') {
continue;
diff --git a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/editLdapEntry.jsx b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/editLdapEntry.jsx
index 658a8ae48..385d76aee 100644
--- a/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/editLdapEntry.jsx
+++ b/src/cockpit/389-console/src/lib/ldap_editor/wizards/operations/editLdapEntry.jsx
@@ -683,7 +683,7 @@ class EditLdapEntry extends React.Component {
let personOC = false;
for (const existingOC of this.state.selectedObjectClasses) {
if (existingOC.cells[0].toLowerCase() === 'person' ||
- existingOC.cells[0].toLowerCase() === 'nsperson') {
+ existingOC.cells[0].toLowerCase() === 'nsperson') {
personOC = true;
break;
}
| 0 |
6dce81e77a47dc23e0b825952c97112039f45201
|
389ds/389-ds-base
|
Ticket #48216 - crash in ns-slapd when deleting winSyncSubtreePair from sync agreement
Description: In free_subtree_pairs, the condition for stopping the
loop to clean up the AD and DS subtree dn was incomplete.
This patch checks the AD and DS subtree dn and if any of the pair
is NULL, it stops the clean up. Related to the issue, more checks
for the validation of the winSyncSubtreePair is added so that any
single valued cases are ignored with an error log.
[single valued case examples]
winSyncSubtreePair: ou=People,dc=anytree
winSyncSubtreePair: ou=People,dc=anytree:
winSyncSubtreePair: :ou=People,dc=anytree
https://fedorahosted.org/389/ticket/48216
Reviewed by [email protected] (Thank you, Rich!!)
|
commit 6dce81e77a47dc23e0b825952c97112039f45201
Author: Noriko Hosoi <[email protected]>
Date: Thu Jul 9 17:23:57 2015 -0700
Ticket #48216 - crash in ns-slapd when deleting winSyncSubtreePair from sync agreement
Description: In free_subtree_pairs, the condition for stopping the
loop to clean up the AD and DS subtree dn was incomplete.
This patch checks the AD and DS subtree dn and if any of the pair
is NULL, it stops the clean up. Related to the issue, more checks
for the validation of the winSyncSubtreePair is added so that any
single valued cases are ignored with an error log.
[single valued case examples]
winSyncSubtreePair: ou=People,dc=anytree
winSyncSubtreePair: ou=People,dc=anytree:
winSyncSubtreePair: :ou=People,dc=anytree
https://fedorahosted.org/389/ticket/48216
Reviewed by [email protected] (Thank you, Rich!!)
diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c
index 36015c234..f5cb44e87 100644
--- a/ldap/servers/plugins/replication/windows_private.c
+++ b/ldap/servers/plugins/replication/windows_private.c
@@ -885,7 +885,7 @@ windows_private_get_subtreepairs(const Repl_Agmt *ra)
return dp->subtree_pairs;
}
-/* parray is NOT passed in */
+/* parray is NOT passed in; caller frees it. */
void
windows_private_set_subtreepairs(const Repl_Agmt *ra, char **parray)
{
@@ -930,6 +930,12 @@ create_subtree_pairs(char **pairs)
for (ptr = pairs; ptr && *ptr; ptr++) {
p0 = ldap_utf8strtok_r(*ptr, ":", &saveptr);
p1 = ldap_utf8strtok_r(NULL, ":", &saveptr);
+ if ((NULL == p0) || (NULL == p1)) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,
+ "create_subtree_pairs: "
+ "Ignoring invalid subtree pairs \"%s\".\n", *ptr);
+ continue;
+ }
spp->DSsubtree = slapi_sdn_new_dn_byval(p0);
if (NULL == spp->DSsubtree) {
LDAPDebug1Arg(LDAP_DEBUG_ANY,
@@ -960,7 +966,11 @@ free_subtree_pairs(subtreePair **pairs)
if (NULL == pairs) {
return;
}
- for (p = *pairs; p; p++) {
+ /*
+ * If exists, the subtree pair is both non-NULL or NULL.
+ * Both NULL is the condition to stop the loop.
+ */
+ for (p = *pairs; p && p->ADsubtree && p->DSsubtree; p++) {
slapi_sdn_free(&(p->ADsubtree));
slapi_sdn_free(&(p->DSsubtree));
}
| 0 |
b43380f77d70b0b78f75a22c694b57fb5ee8811e
|
389ds/389-ds-base
|
Bump version to 1.4.0.20
|
commit b43380f77d70b0b78f75a22c694b57fb5ee8811e
Author: Mark Reynolds <[email protected]>
Date: Fri Dec 14 13:33:58 2018 -0500
Bump version to 1.4.0.20
diff --git a/VERSION.sh b/VERSION.sh
index 2328d3f9f..88330eeff 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=4
-VERSION_MAINT=0.19
+VERSION_MAINT=0.20
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
| 0 |
885cdf426040d120def7ed0c62962b107c5e7dc8
|
389ds/389-ds-base
|
Issue 6561 - TLS 1.2 stickiness in FIPS mode
Description:
TLS 1.3 works with NSS in FIPS mode for quite some time now,
this restriction is no longer needed.
Fixes: https://github.com/389ds/389-ds-base/issues/6561
Reviewed by: @mreynolds389 (Thanks!)
|
commit 885cdf426040d120def7ed0c62962b107c5e7dc8
Author: Viktor Ashirov <[email protected]>
Date: Thu Feb 13 16:37:43 2025 +0100
Issue 6561 - TLS 1.2 stickiness in FIPS mode
Description:
TLS 1.3 works with NSS in FIPS mode for quite some time now,
this restriction is no longer needed.
Fixes: https://github.com/389ds/389-ds-base/issues/6561
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 94259efe7..84a7fb004 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -1929,14 +1929,6 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
*/
sslStatus = SSL_VersionRangeGet(pr_sock, &slapdNSSVersions);
if (sslStatus == SECSuccess) {
- if (slapdNSSVersions.max > LDAP_OPT_X_TLS_PROTOCOL_TLS1_2 && fipsMode) {
- /*
- * FIPS & NSS currently only support a max version of TLS1.2
- * (although NSS advertises 1.3 as a max range in FIPS mode),
- * hopefully this code block can be removed soon...
- */
- slapdNSSVersions.max = LDAP_OPT_X_TLS_PROTOCOL_TLS1_2;
- }
/* Reset request range */
sslStatus = SSL_VersionRangeSet(pr_sock, &slapdNSSVersions);
if (sslStatus == SECSuccess) {
| 0 |
8b2c56123118ba02bb15e3091d2ae62d46df7ba5
|
389ds/389-ds-base
|
Issue 5221 - User with expired password can still login with full privledges
Bug Description:
A user with an expired password can still login and perform operations
with its typical access perimssions. But an expired password means the
account should be considered anonymous.
Fix Description:
Clear the bind credentials if the password is expired
relates: https://github.com/389ds/389-ds-base/issues/5221
Reviewed by: progier(Thanks!)
|
commit 8b2c56123118ba02bb15e3091d2ae62d46df7ba5
Author: Mark Reynolds <[email protected]>
Date: Thu Mar 3 16:29:41 2022 -0500
Issue 5221 - User with expired password can still login with full privledges
Bug Description:
A user with an expired password can still login and perform operations
with its typical access perimssions. But an expired password means the
account should be considered anonymous.
Fix Description:
Clear the bind credentials if the password is expired
relates: https://github.com/389ds/389-ds-base/issues/5221
Reviewed by: progier(Thanks!)
diff --git a/dirsrvtests/tests/suites/password/pw_expired_access_test.py b/dirsrvtests/tests/suites/password/pw_expired_access_test.py
new file mode 100644
index 000000000..fb0afb190
--- /dev/null
+++ b/dirsrvtests/tests/suites/password/pw_expired_access_test.py
@@ -0,0 +1,62 @@
+import ldap
+import logging
+import pytest
+import os
+import time
+from lib389._constants import DEFAULT_SUFFIX, PASSWORD
+from lib389.idm.domain import Domain
+from lib389.idm.user import UserAccounts
+from lib389.topologies import topology_st as topo
+
+log = logging.getLogger(__name__)
+
+def test_expired_user_has_no_privledge(topo):
+ """Specify a test case purpose or name here
+
+ :id: 3df86b45-9929-414b-9bf6-06c25301d207
+ :setup: Standalone Instance
+ :steps:
+ 1. Set short password expiration time
+ 2. Add user and wait for expiration time to run out
+ 3. Set one aci that allows authenticated users full access
+ 4. Bind as user (password should be expired)
+ 5. Attempt modify
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ 5. Success
+ """
+
+ # Configured password epxiration
+ topo.standalone.config.replace_many(('passwordexp', 'on'), ('passwordmaxage', '1'))
+
+ # Set aci
+ suffix = Domain(topo.standalone, DEFAULT_SUFFIX)
+ ACI_TEXT = '(targetattr="*")(version 3.0; acl "test aci"; allow (all) (userdn="ldap:///all");)'
+ suffix.replace('aci', ACI_TEXT)
+
+ # Add user
+ user = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn=None).create_test_user()
+ user.replace('userpassword', PASSWORD)
+ time.sleep(2)
+
+ # Bind as user with expired password. Need to use raw ldap calls because
+ # lib389 will close the connection when an error 49 is encountered.
+ ldap_object = ldap.initialize(topo.standalone.toLDAPURL())
+ with pytest.raises(ldap.INVALID_CREDENTIALS):
+ res_type, res_data, res_msgid, res_ctrls = ldap_object.simple_bind_s(
+ user.dn, PASSWORD)
+
+ # Try modify
+ with pytest.raises(ldap.INSUFFICIENT_ACCESS):
+ modlist = [ (ldap.MOD_REPLACE, 'description', b'Should not work!') ]
+ ldap_object.modify_ext_s(DEFAULT_SUFFIX, modlist)
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main(["-s", CURRENT_FILE])
diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c
index 59b90dfa6..b67c2c8c0 100644
--- a/ldap/servers/slapd/pw_mgmt.c
+++ b/ldap/servers/slapd/pw_mgmt.c
@@ -208,6 +208,7 @@ skip:
slapi_pwpolicy_make_response_control(pb, -1, -1, LDAP_PWPOLICY_PWDEXPIRED);
}
slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
+ bind_credentials_clear(pb_conn, PR_FALSE, PR_TRUE);
slapi_send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL,
"password expired!", 0, NULL);
| 0 |
0d4849dd7551347f0e24ac1027f4d0501084dcf3
|
389ds/389-ds-base
|
Ticket #47623 fix memleak caused by 47347
https://fedorahosted.org/389/ticket/47623
Reviewed by: tbordaz, nhosoi (Thanks!)
Branch: master
Fix Description: Create the mutex if it doesn't exist.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit 0d4849dd7551347f0e24ac1027f4d0501084dcf3
Author: Rich Megginson <[email protected]>
Date: Tue Dec 10 08:08:35 2013 -0700
Ticket #47623 fix memleak caused by 47347
https://fedorahosted.org/389/ticket/47623
Reviewed by: tbordaz, nhosoi (Thanks!)
Branch: master
Fix Description: Create the mutex if it doesn't exist.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a835d6b2d..9af5773db 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -122,7 +122,6 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
sizeof(PagedResults) * maxlen);
}
*index = maxlen; /* the first position in the new area */
- conn->c_pagedresults.prl_list[*index].pr_mutex = PR_NewLock();
} else {
for (i = 0; i < conn->c_pagedresults.prl_maxlen; i++) {
if (!conn->c_pagedresults.prl_list[i].pr_current_be) {
@@ -131,6 +130,9 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
}
}
}
+ if (!conn->c_pagedresults.prl_list[*index].pr_mutex) {
+ conn->c_pagedresults.prl_list[*index].pr_mutex = PR_NewLock();
+ }
conn->c_pagedresults.prl_count++;
} else {
/* Repeated paged results request.
| 0 |
4fc526e6274262bf022bb330d396d8f50ab02871
|
389ds/389-ds-base
|
get rid of lfds - use nunc-stans/ subdir for nunc-stans headers
|
commit 4fc526e6274262bf022bb330d396d8f50ab02871
Author: Rich Megginson <[email protected]>
Date: Thu Feb 26 19:00:58 2015 -0700
get rid of lfds - use nunc-stans/ subdir for nunc-stans headers
diff --git a/Makefile.am b/Makefile.am
index 4ecdaf1b5..39fc2ee5f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,8 @@ DEBUG_DEFINES = @debug_defs@
DS_DEFINES = -DBUILD_NUM=$(BUILDNUM) -DVENDOR="\"$(vendor)\"" -DBRAND="\"$(brand)\"" -DCAPBRAND="\"$(capbrand)\"" \
-UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT
if enable_nunc_stans
-NUNC_STANS_INCLUDES = $(nunc_stans_inc) $(lfds_inc)
-NUNC_STANS_LINK = $(nunc_stans_lib) -lnunc-stans $(lfds_lib) -llfds
+NUNC_STANS_INCLUDES = $(nunc_stans_inc)
+NUNC_STANS_LINK = $(nunc_stans_lib) -lnunc-stans
endif
DS_INCLUDES = -I$(srcdir)/ldap/include -I$(srcdir)/ldap/servers/slapd -I$(srcdir)/include -I. $(NUNC_STANS_INCLUDES)
diff --git a/Makefile.in b/Makefile.in
index 06e651128..218bc8db2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -108,8 +108,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/sasl.m4 $(top_srcdir)/m4/svrcore.m4 \
$(top_srcdir)/m4/icu.m4 $(top_srcdir)/m4/netsnmp.m4 \
$(top_srcdir)/m4/kerberos.m4 $(top_srcdir)/m4/pcre.m4 \
- $(top_srcdir)/m4/selinux.m4 $(top_srcdir)/m4/lfds.m4 \
- $(top_srcdir)/m4/nunc-stans.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/selinux.m4 $(top_srcdir)/m4/nunc-stans.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -706,8 +706,7 @@ libschemareload_plugin_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libschemareload_plugin_la_LDFLAGS) \
$(LDFLAGS) -o $@
-@enable_nunc_stans_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \
-@enable_nunc_stans_TRUE@ $(am__DEPENDENCIES_1)
+@enable_nunc_stans_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
libslapd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
@@ -1423,9 +1422,6 @@ ldapsdk_lib = @ldapsdk_lib@
ldapsdk_libdir = @ldapsdk_libdir@
ldaptool_bindir = @ldaptool_bindir@
ldaptool_opts = @ldaptool_opts@
-lfds_inc = @lfds_inc@
-lfds_lib = @lfds_lib@
-lfds_libdir = @lfds_libdir@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -1512,8 +1508,8 @@ DEBUG_DEFINES = @debug_defs@
DS_DEFINES = -DBUILD_NUM=$(BUILDNUM) -DVENDOR="\"$(vendor)\"" -DBRAND="\"$(brand)\"" -DCAPBRAND="\"$(capbrand)\"" \
-UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT
-@enable_nunc_stans_TRUE@NUNC_STANS_INCLUDES = $(nunc_stans_inc) $(lfds_inc)
-@enable_nunc_stans_TRUE@NUNC_STANS_LINK = $(nunc_stans_lib) -lnunc-stans $(lfds_lib) -llfds
+@enable_nunc_stans_TRUE@NUNC_STANS_INCLUDES = $(nunc_stans_inc)
+@enable_nunc_stans_TRUE@NUNC_STANS_LINK = $(nunc_stans_lib) -lnunc-stans
DS_INCLUDES = -I$(srcdir)/ldap/include -I$(srcdir)/ldap/servers/slapd -I$(srcdir)/include -I. $(NUNC_STANS_INCLUDES)
# these paths are dependent on the settings of prefix and exec_prefix which may be specified
diff --git a/configure b/configure
index ec30ecd17..e1e0525b6 100755
--- a/configure
+++ b/configure
@@ -643,9 +643,6 @@ localrundir
nunc_stans_libdir
nunc_stans_lib
nunc_stans_inc
-lfds_libdir
-lfds_lib
-lfds_inc
pcre_libdir
pcre_lib
pcre_inc
@@ -965,9 +962,6 @@ with_kerberos_inc
with_kerberos_lib
with_pcre
with_selinux
-with_lfds
-with_lfds_inc
-with_lfds_lib
with_nunc_stans
with_nunc_stans_inc
with_nunc_stans_lib
@@ -1734,9 +1728,6 @@ Optional Packages:
kerberos
--with-pcre[=PATH] Perl Compatible Regular Expression directory
--with-selinux Support SELinux policy
- --with-lfds[=PATH] LFDS directory
- --with-lfds-inc=PATH LFDS include file directory
- --with-lfds-lib=PATH LFDS library directory
--with-nunc-stans[=PATH]
nunc-stans directory
--with-nunc-stans-inc=PATH
@@ -21293,110 +21284,6 @@ $as_echo "no" >&6; }
fi
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# END COPYRIGHT BLOCK
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lfds..." >&5
-$as_echo "$as_me: checking for lfds..." >&6;}
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lfds" >&5
-$as_echo_n "checking for --with-lfds... " >&6; }
-
-# Check whether --with-lfds was given.
-if test "${with_lfds+set}" = set; then :
- withval=$with_lfds;
- if test "$withval" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- elif test "$withval" = "no"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- elif test -d "$withval"/inc -a -d "$withval"/bin; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $withval" >&5
-$as_echo "using $withval" >&6; }
- lfds_lib="-L$withval/bin"
- lfds_libdir="$withval/lib"
- lfds_incdir="$withval/inc"
- if ! test -e "$lfds_incdir/liblfds.h" ; then
- as_fn_error $? "$withval include dir not found" "$LINENO" 5
- fi
- lfds_inc="-I$lfds_incdir"
- else
- echo
- as_fn_error $? "$withval not found" "$LINENO" 5
- fi
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-# check for --with-lfds-inc
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lfds-inc" >&5
-$as_echo_n "checking for --with-lfds-inc... " >&6; }
-
-# Check whether --with-lfds-inc was given.
-if test "${with_lfds_inc+set}" = set; then :
- withval=$with_lfds_inc;
- if test -e "$withval"/liblfds.h
- then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $withval" >&5
-$as_echo "using $withval" >&6; }
- lfds_incdir="$withval"
- lfds_inc="-I$withval"
- else
- echo
- as_fn_error $? "$withval not found" "$LINENO" 5
- fi
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-# check for --with-lfds-lib
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lfds-lib" >&5
-$as_echo_n "checking for --with-lfds-lib... " >&6; }
-
-# Check whether --with-lfds-lib was given.
-if test "${with_lfds_lib+set}" = set; then :
- withval=$with_lfds_lib;
- if test -d "$withval"
- then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $withval" >&5
-$as_echo "using $withval" >&6; }
- lfds_lib="-L$withval"
- lfds_libdir="$withval"
- else
- echo
- as_fn_error $? "$withval not found" "$LINENO" 5
- fi
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2015 Red Hat, Inc.
# All rights reserved.
@@ -21435,10 +21322,10 @@ $as_echo "no" >&6; }
elif test -d "$withval"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using $withval" >&5
$as_echo "using $withval" >&6; }
- nunc_stans_lib="-L$withval"
- nunc_stans_libdir="$withval"
- nunc_stans_incdir="$withval"
- if ! test -e "$nunc_stans_incdir/ns_thrpool.h" ; then
+ nunc_stans_lib="-L$withval/lib"
+ nunc_stans_libdir="$withval/lib"
+ nunc_stans_incdir="$withval/include"
+ if ! test -e "$nunc_stans_incdir/nunc-stans/ns_thrpool.h" ; then
as_fn_error $? "$withval include dir not found" "$LINENO" 5
fi
nunc_stans_inc="-I$nunc_stans_incdir"
@@ -21460,7 +21347,7 @@ $as_echo_n "checking for --with-nunc-stans-inc... " >&6; }
# Check whether --with-nunc-stans-inc was given.
if test "${with_nunc_stans_inc+set}" = set; then :
withval=$with_nunc_stans_inc;
- if test -e "$withval"/ns_thrpool.h
+ if test -e "$withval"/nunc-stans/ns_thrpool.h
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using $withval" >&5
$as_echo "using $withval" >&6; }
@@ -21591,9 +21478,6 @@ fi
-
-
-
diff --git a/configure.ac b/configure.ac
index 96a717932..c151870a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -690,7 +690,6 @@ m4_include(m4/netsnmp.m4)
m4_include(m4/kerberos.m4)
m4_include(m4/pcre.m4)
m4_include(m4/selinux.m4)
-m4_include(m4/lfds.m4)
m4_include(m4/nunc-stans.m4)
PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
@@ -749,9 +748,6 @@ AC_SUBST(netsnmp_link)
AC_SUBST(pcre_inc)
AC_SUBST(pcre_lib)
AC_SUBST(pcre_libdir)
-AC_SUBST(lfds_inc)
-AC_SUBST(lfds_lib)
-AC_SUBST(lfds_libdir)
AC_SUBST(nunc_stans_inc)
AC_SUBST(nunc_stans_lib)
AC_SUBST(nunc_stans_libdir)
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index b856afe5b..8a0d11a84 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -173,7 +173,7 @@ typedef struct symbol_t {
#include "uuid.h"
#ifdef ENABLE_NUNC_STANS
-#include <ns_thrpool.h>
+#include <nunc-stans/ns_thrpool.h>
#endif
#if defined(OS_solaris)
diff --git a/m4/lfds.m4 b/m4/lfds.m4
deleted file mode 100644
index d5dcbb7b6..000000000
--- a/m4/lfds.m4
+++ /dev/null
@@ -1,78 +0,0 @@
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2015 Red Hat, Inc.
-# All rights reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# END COPYRIGHT BLOCK
-
-AC_CHECKING(for lfds)
-
-dnl - check for --with-lfds
-AC_MSG_CHECKING(for --with-lfds)
-AC_ARG_WITH(lfds, AS_HELP_STRING([--with-lfds@<:@=PATH@:>@],[LFDS directory]),
-[
- if test "$withval" = "yes"; then
- AC_MSG_RESULT(yes)
- elif test "$withval" = "no"; then
- AC_MSG_RESULT(no)
- elif test -d "$withval"/inc -a -d "$withval"/bin; then
- AC_MSG_RESULT([using $withval])
- dnl - check the user provided location
- lfds_lib="-L$withval/bin"
- lfds_libdir="$withval/lib"
- lfds_incdir="$withval/inc"
- if ! test -e "$lfds_incdir/liblfds.h" ; then
- AC_MSG_ERROR([$withval include dir not found])
- fi
- lfds_inc="-I$lfds_incdir"
- else
- echo
- AC_MSG_ERROR([$withval not found])
- fi
-],
-AC_MSG_RESULT(no))
-
-# check for --with-lfds-inc
-AC_MSG_CHECKING(for --with-lfds-inc)
-AC_ARG_WITH(lfds-inc, AS_HELP_STRING([--with-lfds-inc=PATH],[LFDS include file directory]),
-[
- if test -e "$withval"/liblfds.h
- then
- AC_MSG_RESULT([using $withval])
- lfds_incdir="$withval"
- lfds_inc="-I$withval"
- else
- echo
- AC_MSG_ERROR([$withval not found])
- fi
-],
-AC_MSG_RESULT(no))
-
-# check for --with-lfds-lib
-AC_MSG_CHECKING(for --with-lfds-lib)
-AC_ARG_WITH(lfds-lib, AS_HELP_STRING([--with-lfds-lib=PATH],[LFDS library directory]),
-[
- if test -d "$withval"
- then
- AC_MSG_RESULT([using $withval])
- lfds_lib="-L$withval"
- lfds_libdir="$withval"
- else
- echo
- AC_MSG_ERROR([$withval not found])
- fi
-],
-AC_MSG_RESULT(no))
diff --git a/m4/nunc-stans.m4 b/m4/nunc-stans.m4
index e68f6518a..91ba72e0a 100644
--- a/m4/nunc-stans.m4
+++ b/m4/nunc-stans.m4
@@ -31,10 +31,10 @@ AC_ARG_WITH(nunc-stans, AS_HELP_STRING([--with-nunc-stans@<:@=PATH@:>@],[nunc-st
elif test -d "$withval"; then
AC_MSG_RESULT([using $withval])
dnl - check the user provided location
- nunc_stans_lib="-L$withval"
- nunc_stans_libdir="$withval"
- nunc_stans_incdir="$withval"
- if ! test -e "$nunc_stans_incdir/ns_thrpool.h" ; then
+ nunc_stans_lib="-L$withval/lib"
+ nunc_stans_libdir="$withval/lib"
+ nunc_stans_incdir="$withval/include"
+ if ! test -e "$nunc_stans_incdir/nunc-stans/ns_thrpool.h" ; then
AC_MSG_ERROR([$withval include dir not found])
fi
nunc_stans_inc="-I$nunc_stans_incdir"
@@ -49,7 +49,7 @@ AC_MSG_RESULT(no))
AC_MSG_CHECKING(for --with-nunc-stans-inc)
AC_ARG_WITH(nunc-stans-inc, AS_HELP_STRING([--with-nunc-stans-inc=PATH],[nunc-stans include file directory]),
[
- if test -e "$withval"/ns_thrpool.h
+ if test -e "$withval"/nunc-stans/ns_thrpool.h
then
AC_MSG_RESULT([using $withval])
nunc_stans_incdir="$withval"
| 0 |
c21515b1577d5e71fddc20b91bae7abfda6c90e1
|
389ds/389-ds-base
|
Bug 742324 - allow nsslapd-idlistscanlimit to be set dynamically and per-user
https://bugzilla.redhat.com/show_bug.cgi?id=742324
Resolves: bug 742324
Bug Description: allow nsslapd-idlistscanlimit to be set dynamically and per-user
Reviewed by: nhosoi, nkinder (Thanks!)
Branch: master
Fix Description: Changed the ldbm_config for idlistscanlimit to allow running
change. Added a new attribute nsIDListScanLimit that works just like
nsLookThroughLimit for user entries. For each search operation, calculate
the idlistscanlimit to use based on any nsIDListScanLimit or database config.
The biggest change was to extend the internal database API to allow the
idlistscanlimit (aka allidslimit) to be passed down into the lowest level of
the code where it is used.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: Yes - will need to document how nsIDListScanLimit and
nsslapd-idlistscanlimit work now
|
commit c21515b1577d5e71fddc20b91bae7abfda6c90e1
Author: Rich Megginson <[email protected]>
Date: Thu Sep 29 11:36:20 2011 -0600
Bug 742324 - allow nsslapd-idlistscanlimit to be set dynamically and per-user
https://bugzilla.redhat.com/show_bug.cgi?id=742324
Resolves: bug 742324
Bug Description: allow nsslapd-idlistscanlimit to be set dynamically and per-user
Reviewed by: nhosoi, nkinder (Thanks!)
Branch: master
Fix Description: Changed the ldbm_config for idlistscanlimit to allow running
change. Added a new attribute nsIDListScanLimit that works just like
nsLookThroughLimit for user entries. For each search operation, calculate
the idlistscanlimit to use based on any nsIDListScanLimit or database config.
The biggest change was to extend the internal database API to allow the
idlistscanlimit (aka allidslimit) to be passed down into the lowest level of
the code where it is used.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: Yes - will need to document how nsIDListScanLimit and
nsslapd-idlistscanlimit work now
diff --git a/ldap/schema/02common.ldif b/ldap/schema/02common.ldif
index 52c837a48..0193091ff 100644
--- a/ldap/schema/02common.ldif
+++ b/ldap/schema/02common.ldif
@@ -123,6 +123,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.570 NAME 'nsLookThroughLimit' DESC 'Bind
attributeTypes: ( 2.16.840.1.113730.3.1.571 NAME 'nsSizeLimit' DESC 'Binder-based search operation size limit (entries)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.572 NAME 'nsTimeLimit' DESC 'Binder-based search operation time limit (seconds)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.573 NAME 'nsIdleTimeout' DESC 'Binder-based connection idle timeout (seconds)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2106 NAME 'nsIDListScanLimit' DESC 'Binder-based search operation ID list scan limit (candidate entries)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.574 NAME 'nsRole' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.575 NAME 'nsRoleDN' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.576 NAME 'nsRoleFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c
index 43a30b8e3..1e90871c7 100644
--- a/ldap/servers/slapd/back-ldbm/ancestorid.c
+++ b/ldap/servers/slapd/back-ldbm/ancestorid.c
@@ -643,7 +643,7 @@ static IDList *idl_union_allids(backend *be, struct attrinfo *ai, IDList *a, IDL
if (!idl_get_idl_new()) {
if (a != NULL && b != NULL) {
if (ALLIDS( a ) || ALLIDS( b ) ||
- (IDL_NIDS(a) + IDL_NIDS(b) > idl_get_allidslimit(ai))) {
+ (IDL_NIDS(a) + IDL_NIDS(b) > idl_get_allidslimit(ai, 0))) {
return( idl_allids( be ) );
}
}
@@ -975,11 +975,12 @@ int ldbm_ancestorid_move_subtree(
return ret;
}
-int ldbm_ancestorid_read(
+int ldbm_ancestorid_read_ext(
backend *be,
back_txn *txn,
ID id,
- IDList **idl
+ IDList **idl,
+ int allidslimit
)
{
int ret = 0;
@@ -989,8 +990,17 @@ int ldbm_ancestorid_read(
bv.bv_val = keybuf;
bv.bv_len = PR_snprintf(keybuf, sizeof(keybuf), "%lu", (u_long)id);
- *idl = index_read(be, LDBM_ANCESTORID_STR, indextype_EQUALITY, &bv, txn, &ret);
+ *idl = index_read_ext_allids(be, LDBM_ANCESTORID_STR, indextype_EQUALITY, &bv, txn, &ret, NULL, allidslimit);
return ret;
}
+int ldbm_ancestorid_read(
+ backend *be,
+ back_txn *txn,
+ ID id,
+ IDList **idl
+)
+{
+ return ldbm_ancestorid_read_ext(be, txn, id, idl, 0);
+}
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index f9939d418..e6cab2108 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -634,6 +634,7 @@ 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 */
+ int li_reslimit_allids_handle; /* allids aka idlistscan */
};
/* li_flags could store these bits defined in ../slapi-plugin.h
@@ -801,6 +802,8 @@ typedef struct _back_search_result_set
/* Name of attribute type used for binder-based look through limit */
#define LDBM_LOOKTHROUGHLIMIT_AT "nsLookThroughLimit"
+/* Name of attribute type used for binder-based look through limit */
+#define LDBM_ALLIDSLIMIT_AT "nsIDListScanLimit"
/* OIDs for attribute types used internally */
#define LDBM_ENTRYDN_OID "2.16.840.1.113730.3.1.602"
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index eacb6ef33..d214c5488 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -50,11 +50,11 @@ extern const char *indextype_EQUALITY;
extern const char *indextype_APPROX;
extern const char *indextype_SUB;
-static IDList *ava_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int ftype, Slapi_Filter *nextf, int range, int *err);
-static IDList *presence_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err);
-static IDList *extensible_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err);
-static IDList *list_candidates(Slapi_PBlock *pb, backend *be, const char *base, Slapi_Filter *flist, int ftype, int *err);
-static IDList *substring_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err);
+static IDList *ava_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int ftype, Slapi_Filter *nextf, int range, int *err, int allidslimit);
+static IDList *presence_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err, int allidslimit);
+static IDList *extensible_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err, int allidslimit);
+static IDList *list_candidates(Slapi_PBlock *pb, backend *be, const char *base, Slapi_Filter *flist, int ftype, int *err, int allidslimit);
+static IDList *substring_candidates(Slapi_PBlock *pb, backend *be, Slapi_Filter *f, int *err, int allidslimit);
static IDList * range_candidates(
Slapi_PBlock *pb,
backend *be,
@@ -62,7 +62,8 @@ static IDList * range_candidates(
struct berval *low_val,
struct berval *high_val,
int *err,
- const Slapi_Attr *sattr
+ const Slapi_Attr *sattr,
+ int allidslimit
);
static IDList *
keys2idl(
@@ -72,18 +73,20 @@ keys2idl(
Slapi_Value **ivals,
int *err,
int *unindexed,
- back_txn *txn
+ back_txn *txn,
+ int allidslimit
);
IDList *
-filter_candidates(
+filter_candidates_ext(
Slapi_PBlock *pb,
backend *be,
const char *base,
Slapi_Filter *f,
Slapi_Filter *nextf,
int range,
- int *err
+ int *err,
+ int allidslimit
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;
@@ -91,7 +94,11 @@ filter_candidates(
int ftype;
LDAPDebug( LDAP_DEBUG_TRACE, "=> filter_candidates\n", 0, 0, 0 );
-
+
+ if (!allidslimit) {
+ allidslimit = compute_allids_limit(pb, li);
+ }
+
/* check if this is to be serviced by a virtual index */
if(INDEX_FILTER_EVALUTED == index_subsys_evaluate_filter(f, (Slapi_DN*)slapi_be_getsuffix(be, 0), (IndexEntryList**)&result))
{
@@ -119,50 +126,50 @@ filter_candidates(
switch ( (ftype = slapi_filter_get_choice( f )) ) {
case LDAP_FILTER_EQUALITY:
LDAPDebug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
- result = ava_candidates( pb, be, f, LDAP_FILTER_EQUALITY, nextf, range, err );
+ result = ava_candidates( pb, be, f, LDAP_FILTER_EQUALITY, nextf, range, err, allidslimit );
break;
case LDAP_FILTER_SUBSTRINGS:
LDAPDebug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
- result = substring_candidates( pb, be, f, err );
+ result = substring_candidates( pb, be, f, err, allidslimit );
break;
case LDAP_FILTER_GE:
LDAPDebug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
result = ava_candidates( pb, be, f, LDAP_FILTER_GE, nextf, range,
- err );
+ err, allidslimit );
break;
case LDAP_FILTER_LE:
LDAPDebug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
result = ava_candidates( pb, be, f, LDAP_FILTER_LE, nextf, range,
- err );
+ err, allidslimit );
break;
case LDAP_FILTER_PRESENT:
LDAPDebug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
- result = presence_candidates( pb, be, f, err );
+ result = presence_candidates( pb, be, f, err, allidslimit );
break;
case LDAP_FILTER_APPROX:
LDAPDebug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
result = ava_candidates( pb, be, f, LDAP_FILTER_APPROX, nextf,
- range, err );
+ range, err, allidslimit );
break;
case LDAP_FILTER_EXTENDED:
LDAPDebug( LDAP_DEBUG_FILTER, "\tEXTENSIBLE\n", 0, 0, 0 );
- result = extensible_candidates( pb, be, f, err );
+ result = extensible_candidates( pb, be, f, err, allidslimit );
break;
case LDAP_FILTER_AND:
LDAPDebug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
- result = list_candidates( pb, be, base, f, LDAP_FILTER_AND, err );
+ result = list_candidates( pb, be, base, f, LDAP_FILTER_AND, err, allidslimit );
break;
case LDAP_FILTER_OR:
LDAPDebug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
- result = list_candidates( pb, be, base, f, LDAP_FILTER_OR, err );
+ result = list_candidates( pb, be, base, f, LDAP_FILTER_OR, err, allidslimit );
break;
case LDAP_FILTER_NOT:
@@ -182,6 +189,20 @@ filter_candidates(
return( result );
}
+IDList *
+filter_candidates(
+ Slapi_PBlock *pb,
+ backend *be,
+ const char *base,
+ Slapi_Filter *f,
+ Slapi_Filter *nextf,
+ int range,
+ int *err
+)
+{
+ return filter_candidates_ext(pb, be, base, f, nextf, range, err, 0);
+}
+
static IDList *
ava_candidates(
Slapi_PBlock *pb,
@@ -190,7 +211,8 @@ ava_candidates(
int ftype,
Slapi_Filter *nextf,
int range,
- int *err
+ int *err,
+ int allidslimit
)
{
char *type, *indextype = NULL;
@@ -238,13 +260,13 @@ ava_candidates(
switch ( ftype ) {
case LDAP_FILTER_GE:
- idl = range_candidates(pb, be, type, bval, NULL, err, &sattr);
+ idl = range_candidates(pb, be, type, bval, NULL, err, &sattr, allidslimit);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
goto done;
break;
case LDAP_FILTER_LE:
- idl = range_candidates(pb, be, type, NULL, bval, err, &sattr);
+ idl = range_candidates(pb, be, type, NULL, bval, err, &sattr, allidslimit);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
goto done;
@@ -288,7 +310,7 @@ ava_candidates(
ivals=ptr;
slapi_attr_assertion2keys_ava_sv( &sattr, &tmp, (Slapi_Value ***)&ivals, LDAP_FILTER_EQUALITY_FAST);
- idl = keys2idl( be, type, indextype, ivals, err, &unindexed, &txn );
+ idl = keys2idl( be, type, indextype, ivals, err, &unindexed, &txn, allidslimit );
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
@@ -320,7 +342,7 @@ ava_candidates(
idl = idl_allids( be );
goto done;
}
- idl = keys2idl( be, type, indextype, ivals, err, &unindexed, &txn );
+ idl = keys2idl( be, type, indextype, ivals, err, &unindexed, &txn, allidslimit );
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
@@ -340,7 +362,8 @@ presence_candidates(
Slapi_PBlock *pb,
backend *be,
Slapi_Filter *f,
- int *err
+ int *err,
+ int allidslimit
)
{
char *type;
@@ -356,8 +379,8 @@ presence_candidates(
return( NULL );
}
slapi_pblock_get(pb, SLAPI_TXN, &txn.back_txn_txn);
- idl = index_read_ext( be, type, indextype_PRESENCE,
- NULL, &txn, err, &unindexed );
+ idl = index_read_ext_allids( be, type, indextype_PRESENCE,
+ NULL, &txn, err, &unindexed, allidslimit );
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
@@ -371,9 +394,9 @@ presence_candidates(
"fallback to eq index as pres index gave allids\n",
0, 0, 0);
idl_free(idl);
- idl = index_range_read(pb, be, type, indextype_EQUALITY,
+ idl = index_range_read_ext(pb, be, type, indextype_EQUALITY,
SLAPI_OP_GREATER_OR_EQUAL,
- NULL, NULL, 0, &txn, err);
+ NULL, NULL, 0, &txn, err, allidslimit);
}
LDAPDebug( LDAP_DEBUG_TRACE, "<= presence_candidates %lu\n",
@@ -386,7 +409,8 @@ extensible_candidates(
Slapi_PBlock *glob_pb,
backend *be,
Slapi_Filter *f,
- int *err
+ int *err,
+ int allidslimit
)
{
IDList* idl = NULL;
@@ -462,10 +486,10 @@ extensible_candidates(
{
int unindexed = 0;
IDList* idl3 = (mrOP == SLAPI_OP_EQUAL) ?
- index_read_ext(be, mrTYPE, mrOID, *key, &txn,
- err, &unindexed) :
- index_range_read (pb, be, mrTYPE, mrOID, mrOP,
- *key, NULL, 0, &txn, err);
+ index_read_ext_allids(be, mrTYPE, mrOID, *key, &txn,
+ err, &unindexed, allidslimit) :
+ index_range_read_ext(pb, be, mrTYPE, mrOID, mrOP,
+ *key, NULL, 0, &txn, err, allidslimit);
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
slapi_pblock_set( glob_pb,
@@ -537,7 +561,8 @@ range_candidates(
struct berval *low_val,
struct berval *high_val,
int *err,
- const Slapi_Attr *sattr
+ const Slapi_Attr *sattr,
+ int allidslimit
)
{
IDList *idl = NULL;
@@ -572,17 +597,17 @@ range_candidates(
}
if (low == NULL) {
- idl = index_range_read(pb, be, type, (char*)indextype_EQUALITY,
- SLAPI_OP_LESS_OR_EQUAL,
- high, NULL, 0, &txn, err);
+ idl = index_range_read_ext(pb, be, type, (char*)indextype_EQUALITY,
+ SLAPI_OP_LESS_OR_EQUAL,
+ high, NULL, 0, &txn, err, allidslimit);
} else if (high == NULL) {
- idl = index_range_read(pb, be, type, (char*)indextype_EQUALITY,
- SLAPI_OP_GREATER_OR_EQUAL,
- low, NULL, 0, &txn, err);
+ idl = index_range_read_ext(pb, be, type, (char*)indextype_EQUALITY,
+ SLAPI_OP_GREATER_OR_EQUAL,
+ low, NULL, 0, &txn, err, allidslimit);
} else {
- idl = index_range_read(pb, be, type, (char*)indextype_EQUALITY,
- SLAPI_OP_GREATER_OR_EQUAL,
- low, high, 1, &txn, err);
+ idl = index_range_read_ext(pb, be, type, (char*)indextype_EQUALITY,
+ SLAPI_OP_GREATER_OR_EQUAL,
+ low, high, 1, &txn, err, allidslimit);
}
done:
@@ -602,7 +627,8 @@ list_candidates(
const char *base,
Slapi_Filter *flist,
int ftype,
- int *err
+ int *err,
+ int allidslimit
)
{
IDList *idl, *tmp, *tmp2;
@@ -712,7 +738,7 @@ list_candidates(
Slapi_Attr sattr;
slapi_attr_init(&sattr, tpairs[0]);
- idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err, &sattr);
+ idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err, &sattr, allidslimit);
attr_done(&sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
@@ -741,7 +767,7 @@ list_candidates(
/* Fetch the IDL for foo */
/* Later we'll remember to call idl_notin() */
LDAPDebug( LDAP_DEBUG_TRACE,"NOT filter\n", 0, 0, 0 );
- tmp = ava_candidates( pb, be, slapi_filter_list_first(f), LDAP_FILTER_EQUALITY, nextf, range, err );
+ tmp = ava_candidates( pb, be, slapi_filter_list_first(f), LDAP_FILTER_EQUALITY, nextf, range, err, allidslimit );
} else {
if (fpairs[0] == f)
{
@@ -753,7 +779,7 @@ list_candidates(
slapi_attr_init(&sattr, tpairs[0]);
tmp = range_candidates(pb, be, tpairs[0],
- vpairs[0], vpairs[1], err, &sattr);
+ vpairs[0], vpairs[1], err, &sattr, allidslimit);
attr_done(&sattr);
if (tmp == NULL && ftype == LDAP_FILTER_AND)
{
@@ -765,7 +791,7 @@ list_candidates(
}
}
/* Proceed as normal */
- else if ( (tmp = filter_candidates( pb, be, base, f, nextf, range, err ))
+ else if ( (tmp = filter_candidates_ext( pb, be, base, f, nextf, range, err, allidslimit ))
== NULL && ftype == LDAP_FILTER_AND ) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= list_candidates NULL\n", 0, 0, 0 );
@@ -802,9 +828,7 @@ list_candidates(
break;
} else {
Slapi_Operation *operation;
- struct ldbminfo *li;
slapi_pblock_get( pb, SLAPI_OPERATION, &operation );
- slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
idl = idl_union( be, idl, tmp );
idl_free( tmp );
@@ -812,13 +836,11 @@ list_candidates(
/* stop if we're already committed to an exhaustive
* search. :(
*/
- /* PAGED RESULTS: if not Directory Manager, we strictly limit
- * the idlist size by the lookthrough limit.
+ /* PAGED RESULTS: we strictly limit the idlist size by the allids (aka idlistscan) limit.
*/
if (operation->o_flags & OP_FLAG_PAGED_RESULTS) {
int nids = IDL_NIDS(idl);
- int lookthroughlimits = compute_lookthrough_limit( pb, li );
- if ( lookthroughlimits > 0 && nids > lookthroughlimits ) {
+ if ( allidslimit > 0 && nids > allidslimit ) {
idl_free( idl );
idl = idl_allids( be );
}
@@ -852,7 +874,8 @@ substring_candidates(
Slapi_PBlock *pb,
backend *be,
Slapi_Filter *f,
- int *err
+ int *err,
+ int allidslimit
)
{
char *type, *initial, *final;
@@ -892,7 +915,7 @@ substring_candidates(
* IDLists together.
*/
slapi_pblock_get(pb, SLAPI_TXN, &txn.back_txn_txn);
- idl = keys2idl( be, type, indextype_SUB, ivals, err, &unindexed, &txn );
+ idl = keys2idl( be, type, indextype_SUB, ivals, err, &unindexed, &txn, allidslimit );
if ( unindexed ) {
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
pagedresults_set_unindexed( pb->pb_conn );
@@ -912,7 +935,8 @@ keys2idl(
Slapi_Value **ivals,
int *err,
int *unindexed,
- back_txn *txn
+ back_txn *txn,
+ int allidslimit
)
{
IDList *idl;
@@ -924,7 +948,7 @@ keys2idl(
for ( i = 0; ivals[i] != NULL; i++ ) {
IDList *idl2;
- idl2 = index_read_ext( be, type, indextype, slapi_value_get_berval(ivals[i]), txn, err, unindexed );
+ idl2 = index_read_ext_allids( be, type, indextype, slapi_value_get_berval(ivals[i]), txn, err, unindexed, allidslimit );
#ifdef LDAP_DEBUG
/* XXX if ( slapd_ldap_debug & LDAP_DEBUG_TRACE ) { XXX */
diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c b/ldap/servers/slapd/back-ldbm/idl_new.c
index 298d5e830..aa6996086 100644
--- a/ldap/servers/slapd/back-ldbm/idl_new.c
+++ b/ldap/servers/slapd/back-ldbm/idl_new.c
@@ -102,18 +102,29 @@ int idl_new_get_tune() {
return idl_tune;
}
-size_t idl_new_get_allidslimit(struct attrinfo *a)
+size_t idl_new_get_allidslimit(struct attrinfo *a, int allidslimit)
{
idl_private *priv = NULL;
+ if (allidslimit) {
+ return (size_t)allidslimit;
+ }
+
PR_ASSERT(NULL != a);
PR_ASSERT(NULL != a->ai_idl);
priv = a->ai_idl;
-
+
return priv->idl_allidslimit;
}
+int idl_new_exceeds_allidslimit(size_t count, struct attrinfo *a, int allidslimit)
+{
+ size_t limit = idl_new_get_allidslimit(a, allidslimit);
+ return (limit != (size_t)-1) && (count > limit);
+}
+
+
/* routine to initialize the private data used by the IDL code per-attribute */
int idl_new_init_private(backend *be,struct attrinfo *a)
{
@@ -127,7 +138,7 @@ int idl_new_init_private(backend *be,struct attrinfo *a)
if (NULL == priv) {
return -1; /* Memory allocation failure */
}
- priv->idl_allidslimit = li->li_allidsthreshold;
+ priv->idl_allidslimit = (size_t)li->li_allidsthreshold;
/* Initialize the structure */
a->ai_idl = (void*)priv;
return 0;
@@ -150,7 +161,8 @@ IDList * idl_new_fetch(
DBT *inkey,
DB_TXN *txn,
struct attrinfo *a,
- int *flag_err
+ int *flag_err,
+ int allidslimit
)
{
int ret = 0;
@@ -261,7 +273,7 @@ IDList * idl_new_fetch(
#if defined(DB_ALLIDS_ON_READ)
/* enforce the allids read limit */
if (NEW_IDL_NO_ALLID != *flag_err &&
- NULL != a && count > idl_new_get_allidslimit(a)) {
+ NULL != a && idl_new_exceeds_allidslimit(count, a, allidslimit)) {
idl->b_nids = 1;
idl->b_ids[0] = ALLID;
ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */
@@ -289,7 +301,7 @@ IDList * idl_new_fetch(
}
#if defined(DB_ALLIDS_ON_READ)
/* enforce the allids read limit */
- if (count > idl_new_get_allidslimit(a)) {
+ if (idl_new_exceeds_allidslimit(count, a, allidslimit)) {
idl->b_nids = 1;
idl->b_ids[0] = ALLID;
ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */
@@ -392,7 +404,7 @@ int idl_new_insert_key(
key->data, 0, 0);
goto error;
}
- if ((size_t)count > idl_new_get_allidslimit(a)) {
+ if ((size_t)count > idl_new_get_allidslimit(a, 0)) {
LDAPDebug(LDAP_DEBUG_TRACE, "allidslimit exceeded for key %s\n",
key->data, 0, 0);
cursor->c_close(cursor);
@@ -589,7 +601,7 @@ int idl_new_store_block(
#if defined(DB_ALLIDS_ON_WRITE)
/* allids check on input idl */
- if (ALLIDS(idl) || (idl->b_nids > (ID)idl_new_get_allidslimit(a))) {
+ if (ALLIDS(idl) || (idl->b_nids > (ID)idl_new_get_allidslimit(a, 0))) {
return idl_new_store_allids(be, db, key, txn);
}
#endif
@@ -638,7 +650,7 @@ int idl_new_store_block(
key->data, 0, 0);
goto error;
}
- if ((size_t)count > idl_new_get_allidslimit(a)) {
+ if ((size_t)count > idl_new_get_allidslimit(a, 0)) {
LDAPDebug(LDAP_DEBUG_TRACE, "allidslimit exceeded for key %s\n",
key->data, 0, 0);
cursor->c_close(cursor);
diff --git a/ldap/servers/slapd/back-ldbm/idl_shim.c b/ldap/servers/slapd/back-ldbm/idl_shim.c
index 10d8618bb..8d4d48a57 100644
--- a/ldap/servers/slapd/back-ldbm/idl_shim.c
+++ b/ldap/servers/slapd/back-ldbm/idl_shim.c
@@ -62,8 +62,8 @@ void idl_new_set_tune(int val);
int idl_new_get_tune();
int idl_new_init_private(backend *be, struct attrinfo *a);
int idl_new_release_private(struct attrinfo *a);
-size_t idl_new_get_allidslimit(struct attrinfo *a);
-IDList * idl_new_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err );
+size_t idl_new_get_allidslimit(struct attrinfo *a, int allidslimit);
+IDList * idl_new_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err, int allidslimit );
int idl_new_insert_key( backend *be, DB* db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a,int *disposition );
int idl_new_delete_key( backend *be, DB *db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a );
int idl_new_store_block( backend *be,DB *db,DBT *key,IDList *idl,DB_TXN *txn,struct attrinfo *a);
@@ -115,24 +115,29 @@ int idl_release_private(struct attrinfo *a)
}
}
-size_t idl_get_allidslimit(struct attrinfo *a)
+size_t idl_get_allidslimit(struct attrinfo *a, int allidslimit)
{
if (idl_new) {
- return idl_new_get_allidslimit(a);
+ return idl_new_get_allidslimit(a, allidslimit);
} else {
return idl_old_get_allidslimit(a);
}
}
-IDList * idl_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err )
+IDList * idl_fetch_ext( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err, int allidslimit )
{
if (idl_new) {
- return idl_new_fetch(be,db,key,txn,a,err);
+ return idl_new_fetch(be,db,key,txn,a,err,allidslimit);
} else {
return idl_old_fetch(be,db,key,txn,a,err);
}
}
+IDList * idl_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err )
+{
+ return idl_fetch_ext(be, db, key, txn, a, err, 0);
+}
+
int idl_insert_key( backend *be, DB* db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a,int *disposition )
{
if (idl_new) {
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 5e5c001c1..207c47011 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -1931,7 +1931,7 @@ foreman_do_parentid(ImportJob *job, FifoItem *fi, struct attrinfo *parentid_ai)
if (idl_disposition == IDL_INSERT_NOW_ALLIDS) {
import_subcount_mother_init(job->mothers, parent_id,
- idl_get_allidslimit(parentid_ai)+1);
+ idl_get_allidslimit(parentid_ai, 0)+1);
} else if (idl_disposition == IDL_INSERT_ALLIDS) {
import_subcount_mother_count(job->mothers, parent_id);
}
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 67be28d7f..c8be27a85 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -811,16 +811,21 @@ index_read(
* The unindexed flag can be used to distinguish between a
* return of allids due to the attr not being indexed or
* the value really being allids.
+ * You can pass in the value of the allidslimit (aka idlistscanlimit)
+ * with this version of the function
+ * if the value is 0, it will use the old method of getting the value
+ * from the attrinfo*.
*/
IDList *
-index_read_ext(
+index_read_ext_allids(
backend *be,
char *type,
const char *indextype,
const struct berval *val,
back_txn *txn,
int *err,
- int *unindexed
+ int *unindexed,
+ int allidslimit
)
{
DB *db = NULL;
@@ -945,7 +950,7 @@ index_read_ext(
}
for (retry_count = 0; retry_count < IDL_FETCH_RETRY_COUNT; retry_count++) {
*err = NEW_IDL_DEFAULT;
- idl = idl_fetch( be, db, &key, db_txn, ai, err );
+ idl = idl_fetch_ext( be, db, &key, db_txn, ai, err, allidslimit );
if(*err == DB_LOCK_DEADLOCK) {
ldbm_nasty("index read retrying transaction", 1045, *err);
continue;
@@ -974,6 +979,20 @@ index_read_ext(
return( idl );
}
+IDList *
+index_read_ext(
+ backend *be,
+ char *type,
+ const char *indextype,
+ const struct berval *val,
+ back_txn *txn,
+ int *err,
+ int *unindexed
+)
+{
+ return index_read_ext_allids(be, type, indextype, val, txn, err, unindexed, 0);
+}
+
/* This function compares two index keys. It is assumed
that the values are already normalized, since they should have
been when the index was created (by int_values2keys).
@@ -1101,7 +1120,7 @@ error:
}
IDList *
-index_range_read(
+index_range_read_ext(
Slapi_PBlock *pb,
backend *be,
char *type,
@@ -1111,7 +1130,8 @@ index_range_read(
struct berval *nextval,
int range,
back_txn *txn,
- int *err
+ int *err,
+ int allidslimit
)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;
@@ -1427,7 +1447,7 @@ index_range_read(
cur_key.flags = 0;
for (retry_count = 0; retry_count < IDL_FETCH_RETRY_COUNT; retry_count++) {
*err = NEW_IDL_DEFAULT;
- tmp = idl_fetch( be, db, &cur_key, NULL, ai, err );
+ tmp = idl_fetch_ext( be, db, &cur_key, NULL, ai, err, allidslimit );
if(*err == DB_LOCK_DEADLOCK) {
ldbm_nasty("index_range_read retrying transaction", 1090, *err);
continue;
@@ -1494,6 +1514,23 @@ error:
return( idl );
}
+IDList *
+index_range_read(
+ Slapi_PBlock *pb,
+ backend *be,
+ char *type,
+ const char *indextype,
+ int operator,
+ struct berval *val,
+ struct berval *nextval,
+ int range,
+ back_txn *txn,
+ int *err
+)
+{
+ return index_range_read_ext(pb, be, type, indextype, operator, val, nextval, range, txn, err, 0);
+}
+
/* DBDB: this function is never actually called */
#if 0
static int
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index e265eafda..44c7ff9b6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -203,7 +203,7 @@ static int ldbm_config_allidsthreshold_set(void *arg, void *value, char *errorbu
/* Do whatever we can to make sure the data is ok. */
/* Catch attempts to configure a stupidly low allidsthreshold */
- if (val < 100) {
+ if ((val > -1) && (val < 100)) {
val = 100;
}
@@ -1231,7 +1231,7 @@ static int ldbm_config_db_tx_max_set(
static config_info ldbm_config[] = {
{CONFIG_LOOKTHROUGHLIMIT, CONFIG_TYPE_INT, "5000", &ldbm_config_lookthroughlimit_get, &ldbm_config_lookthroughlimit_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{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_IDLISTSCANLIMIT, CONFIG_TYPE_INT, "4000", &ldbm_config_allidsthreshold_get, &ldbm_config_allidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{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},
{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},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index 43b4fab8b..94341c533 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -96,6 +96,26 @@ compute_lookthrough_limit( Slapi_PBlock *pb, struct ldbminfo *li )
return( limit );
}
+int
+compute_allids_limit( Slapi_PBlock *pb, struct ldbminfo *li )
+{
+ Slapi_Connection *conn = NULL;
+ int limit;
+
+ slapi_pblock_get( pb, SLAPI_CONNECTION, &conn);
+
+ if ( slapi_reslimit_get_integer_limit( conn,
+ li->li_reslimit_allids_handle, &limit )
+ != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
+ PR_Lock(li->li_config_mutex);
+ limit = li->li_allidsthreshold;
+ PR_Unlock(li->li_config_mutex);
+ }
+
+ return( limit );
+}
+
+
/* don't free the berval, just clean it */
static void
berval_done(struct berval *val)
@@ -962,12 +982,14 @@ subtree_candidates(
IDList *candidates;
PRBool has_tombstone_filter;
int isroot = 0;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;
+ int allidslimit = compute_allids_limit(pb, li);
/* make (|(originalfilter)(objectclass=referral)) */
ftop= create_subtree_filter(filter, managedsait, &focref, &forr);
/* Fetch a candidate list for the original filter */
- candidates = filter_candidates( pb, be, base, ftop, NULL, 0, err );
+ candidates = filter_candidates_ext( pb, be, base, ftop, NULL, 0, err, allidslimit );
slapi_filter_free( forr, 0 );
slapi_filter_free( focref, 0 );
@@ -1000,7 +1022,7 @@ subtree_candidates(
idl_free(tmp);
idl_free(descendants);
} else if (!has_tombstone_filter) {
- *err = ldbm_ancestorid_read(be, &txn, e->ep_id, &descendants);
+ *err = ldbm_ancestorid_read_ext(be, &txn, e->ep_id, &descendants, allidslimit);
idl_insert(&descendants, e->ep_id);
candidates = idl_intersection(be, candidates, descendants);
idl_free(tmp);
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index a087a053e..c30e98751 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -198,6 +198,7 @@ struct backentry * uniqueid2entry(backend *be, const char *uniqueid,
* filterindex.c
*/
IDList * filter_candidates( Slapi_PBlock *pb, backend *be, const char *base, Slapi_Filter *f, Slapi_Filter *nextf, int range, int *err );
+IDList * filter_candidates_ext( Slapi_PBlock *pb, backend *be, const char *base, Slapi_Filter *f, Slapi_Filter *nextf, int range, int *err, int allidslimit );
/*
* findentry.c
@@ -242,6 +243,7 @@ void idl_insert(IDList **idl, ID id);
int idl_delete( IDList **idl, ID id );
IDList * idl_allids( backend *be );
IDList * idl_fetch( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err );
+IDList * idl_fetch_ext( backend *be, DB* db, DBT *key, DB_TXN *txn, struct attrinfo *a, int *err, int allidslimit );
int idl_insert_key( backend *be, DB* db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a,int *disposition );
int idl_delete_key( backend *be, DB *db, DBT *key, ID id, DB_TXN *txn, struct attrinfo *a );
IDList * idl_intersection( backend *be, IDList *a, IDList *b );
@@ -262,7 +264,7 @@ size_t idl_sizeof(IDList *idl);
int idl_store_block(backend *be,DB *db,DBT *key,IDList *idl,DB_TXN *txn,struct attrinfo *a);
void idl_set_tune(int val);
int idl_get_tune();
-size_t idl_get_allidslimit(struct attrinfo *a);
+size_t idl_get_allidslimit(struct attrinfo *a, int allidslimit);
int idl_get_idl_new();
int idl_new_compare_dups(
#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 3200
@@ -284,7 +286,9 @@ int id_array_init(Id_Array *new_guy, int size);
IDList* index_read( backend *be, char *type, const char* indextype, const struct berval* val, back_txn *txn, int *err );
IDList* index_read_ext( backend *be, char *type, const char* indextype, const struct berval* val, back_txn *txn, int *err, int *unindexed );
+IDList* index_read_ext_allids( backend *be, char *type, const char* indextype, const struct berval* val, back_txn *txn, int *err, int *unindexed, int allidslimit );
IDList* index_range_read( Slapi_PBlock *pb, backend *be, char *type, const char* indextype, int ftype, struct berval* val, struct berval* nextval, int range, back_txn *txn, int *err );
+IDList* index_range_read_ext( Slapi_PBlock *pb, backend *be, char *type, const char* indextype, int ftype, struct berval* val, struct berval* nextval, int range, back_txn *txn, int *err, int allidslimit );
const char *encode( const struct berval* data, char buf[BUFSIZ] );
extern const char* indextype_PRESENCE;
@@ -569,6 +573,7 @@ IDList* subtree_candidates(Slapi_PBlock *pb, backend *be, const char *base, cons
void search_set_tune(struct ldbminfo *li,int val);
int search_get_tune(struct ldbminfo *li);
int compute_lookthrough_limit( Slapi_PBlock *pb, struct ldbminfo *li );
+int compute_allids_limit( Slapi_PBlock *pb, struct ldbminfo *li );
/*
@@ -638,6 +643,7 @@ void replace_ldbm_config_value(char *conftype, char *val, struct ldbminfo *li);
int ldbm_ancestorid_create_index(backend *be);
int ldbm_ancestorid_index_entry(backend *be, struct backentry *e, int flags, back_txn *txn);
int ldbm_ancestorid_read(backend *be, back_txn *txn, ID id, IDList **idl);
+int ldbm_ancestorid_read_ext(backend *be, back_txn *txn, ID id, IDList **idl, int allidslimit);
int ldbm_ancestorid_move_subtree(
backend *be,
const Slapi_DN *olddn,
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 6c19c7689..9e18086d4 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -81,7 +81,17 @@ ldbm_back_start( Slapi_PBlock *pb )
if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
LDBM_LOOKTHROUGHLIMIT_AT, &li->li_reslimit_lookthrough_handle )
!= SLAPI_RESLIMIT_STATUS_SUCCESS ) {
- LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed\n",
+ LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for lookthroughlimit\n",
+ 0, 0, 0 );
+ return SLAPI_FAIL_GENERAL;
+ }
+
+ /* register with the binder-based resource limit subsystem so that */
+ /* allidslimit (aka idlistscanlimit) can be supported on a per-connection basis. */
+ if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
+ LDBM_ALLIDSLIMIT_AT, &li->li_reslimit_allids_handle )
+ != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
+ LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for allidslimit\n",
0, 0, 0 );
return SLAPI_FAIL_GENERAL;
}
| 0 |
9b0834c07888aa1ee88b52141460a3b4e80d1962
|
389ds/389-ds-base
|
Ticket #47327 - error syncing group if group member user is not synced
Bug description: Windows Sync synchronizes member attributes
in a group entry if the member entry itself is synchronized.
The entries in the sync scope are basically to be synchronized.
But there is an exception such as a container in the scope is
not synchronized due to the objecttype constraints. Such an
unsync'ed entry could have users in it. Users are the target
of Windows Sync. But since the parent container is not synch-
ronized, the users in the container are not, neither. If a
group contains such special user as a member, synchronization
failed there and the other normal members are failed to get
synchronized.
Fix description: Windows Sync has a helper function
is_subject_of_agreement_remote, which checks if the entry is
in the scope to be synchronized. This patch adds the check
if the checking entry's parent locally exists in the DS. If
it does not exist, it considers the entry is out of scope.
AD strictly checks if the entry exists prior to adding it
to a group entry as a member. That is, a member to be added
is supposed to be in the server, as well as its parent is.
With this change, the AD user which is not synchronized to
the DS is just skipped to add to the group in the DS in the
same manner as an user out of scope is.
https://fedorahosted.org/389/ticket/47327
Reviewed by Rich (Thanks!!)
|
commit 9b0834c07888aa1ee88b52141460a3b4e80d1962
Author: Noriko Hosoi <[email protected]>
Date: Tue May 21 12:16:52 2013 -0700
Ticket #47327 - error syncing group if group member user is not synced
Bug description: Windows Sync synchronizes member attributes
in a group entry if the member entry itself is synchronized.
The entries in the sync scope are basically to be synchronized.
But there is an exception such as a container in the scope is
not synchronized due to the objecttype constraints. Such an
unsync'ed entry could have users in it. Users are the target
of Windows Sync. But since the parent container is not synch-
ronized, the users in the container are not, neither. If a
group contains such special user as a member, synchronization
failed there and the other normal members are failed to get
synchronized.
Fix description: Windows Sync has a helper function
is_subject_of_agreement_remote, which checks if the entry is
in the scope to be synchronized. This patch adds the check
if the checking entry's parent locally exists in the DS. If
it does not exist, it considers the entry is out of scope.
AD strictly checks if the entry exists prior to adding it
to a group entry as a member. That is, a member to be added
is supposed to be in the server, as well as its parent is.
With this change, the AD user which is not synchronized to
the DS is just skipped to add to the group in the DS in the
same manner as an user out of scope is.
https://fedorahosted.org/389/ticket/47327
Reviewed by Rich (Thanks!!)
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 84382e5d7..03d6ff367 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -3858,8 +3858,11 @@ map_entry_dn_inbound_ext(Slapi_Entry *e, Slapi_DN **dn, const Repl_Agmt *ra, int
windows_private_get_windows_subtree(ra));
}
}
- new_dn = slapi_sdn_new_dn_byval(new_dn_string);
- PR_smprintf_free(new_dn_string);
+ /*
+ * new_dn_string is created by slapi_create_dn_string,
+ * which is normalized. Thus, we can use _normdn_.
+ */
+ new_dn = slapi_sdn_new_normdn_passin(new_dn_string);
slapi_ch_free_string(&container_str);
/* Clear any earlier error */
retval = 0;
@@ -3954,6 +3957,7 @@ is_subject_of_agreement_remote(Slapi_Entry *e, const Repl_Agmt *ra)
int retval = 0;
int is_in_subtree = 0;
const Slapi_DN *agreement_subtree = NULL;
+ const Slapi_DN *sdn;
/* First test for the sync'ed subtree */
agreement_subtree = windows_private_get_windows_subtree(ra);
@@ -3961,10 +3965,33 @@ is_subject_of_agreement_remote(Slapi_Entry *e, const Repl_Agmt *ra)
{
goto error;
}
- is_in_subtree = slapi_sdn_scope_test(slapi_entry_get_sdn_const(e), agreement_subtree, LDAP_SCOPE_SUBTREE);
+ sdn = slapi_entry_get_sdn_const(e);
+ is_in_subtree = slapi_sdn_scope_test(sdn, agreement_subtree, LDAP_SCOPE_SUBTREE);
if (is_in_subtree)
{
- retval = 1;
+ Slapi_DN psdn = {0};
+ Slapi_Entry *pentry = NULL;
+ /*
+ * Check whether the parent of the entry exists or not.
+ * If it does not, treat the entry e is out of scope.
+ * For instance, agreement_subtree is cn=USER,<SUFFIX>
+ * cn=container,cn=USER,<SUFFIX> is not synchronized.
+ * If 'e' is uid=test,cn=container,cn=USER,<SUFFIX>,
+ * the entry is not synchronized, either. We treat
+ * 'e' as out of scope.
+ */
+ slapi_sdn_get_parent(sdn, &psdn);
+ if (0 == slapi_sdn_compare(&psdn, agreement_subtree)) {
+ retval = 1;
+ } else {
+ /* If parent entry is not local, the entry is out of scope */
+ int rc = windows_get_local_entry(&psdn, &pentry);
+ if ((0 == rc) && pentry) {
+ retval = 1;
+ slapi_entry_free(pentry);
+ }
+ }
+ slapi_sdn_done(&psdn);
}
error:
return retval;
| 0 |
715d2d490dcd3ebd2b4184870dbd93bda20ecb46
|
389ds/389-ds-base
|
Issue 5495 - BUG - Minor fix to dds skip, inconsistent attrs caused errors (#5501)
Bug Description: Incorrect variables were used in the inconsistent attribute
logs.
Fix Description: Fix the variable names and reporting.
fixes: https://github.com/389ds/389-ds-base/issues/5495
Author: William Brown <[email protected]>
Review by: @droideck
|
commit 715d2d490dcd3ebd2b4184870dbd93bda20ecb46
Author: Firstyear <[email protected]>
Date: Fri Oct 28 10:33:19 2022 +1000
Issue 5495 - BUG - Minor fix to dds skip, inconsistent attrs caused errors (#5501)
Bug Description: Incorrect variables were used in the inconsistent attribute
logs.
Fix Description: Fix the variable names and reporting.
fixes: https://github.com/389ds/389-ds-base/issues/5495
Author: William Brown <[email protected]>
Review by: @droideck
diff --git a/src/lib389/lib389/migrate/plan.py b/src/lib389/lib389/migrate/plan.py
index d31a10dea..599374384 100644
--- a/src/lib389/lib389/migrate/plan.py
+++ b/src/lib389/lib389/migrate/plan.py
@@ -220,20 +220,21 @@ class SchemaAttributeInconsistent(MigrationAction):
log.info(f" * Schema Skip Inconsistent Attribute -> {self.attr.names[0]} ({self.attr.oid})")
def display_post(self, log):
- log.info(f" * [ ] - Review Schema Inconsistent Attribute -> {self.obj.names[0]} ({self.obj.oid})")
+ log.info(f" * [ ] - Review Schema Inconsistent Attribute -> {self.attr.names[0]} ({self.attr.oid})")
class SchemaAttributeAmbiguous(MigrationAction):
- def __init__(self, attr):
+ def __init__(self, attr, overlaps):
self.attr = attr
+ self.overlaps = overlaps
def __unicode__(self):
return f"SchemaAttributeAmbiguous -> {self.attr.__unicode__()}"
def display_plan(self, log):
- log.info(f" * Schema Skip Abmiguous Attribute -> {self.attr.names[0]} ({self.attr.oid})")
+ log.info(f" * Schema Skip Abmiguous Attribute -> {self.attr.names[0]} ({self.attr.oid}) overlaps {self.overlaps}")
def display_post(self, log):
- log.info(f" * [ ] - Review Schema Ambiguous Attribute -> {self.obj.names[0]} ({self.obj.oid})")
+ log.info(f" * [ ] - Review Schema Ambiguous Attribute -> {self.attr.names[0]} ({self.attr.oid}) overlaps {self.overlaps}")
class SchemaAttributeInvalid(MigrationAction):
def __init__(self, attr, reason):
| 0 |
2db1412b4f81f7e90769cf6b2df3e1a2fe4ada4a
|
389ds/389-ds-base
|
Issue 6352 - Fix DeprecationWarning
Bug Description:
When pytest is used on ASAN build, pytest-html plugin collects `*asan*`
files, which results in the following deprecation warning:
```
The 'report.extra' attribute is deprecated and will be removed in a
future release, use 'report.extras' instead.
```
Fixes: https://github.com/389ds/389-ds-base/issues/6352
Reviwed by: @droideck (Thanks!)
|
commit 2db1412b4f81f7e90769cf6b2df3e1a2fe4ada4a
Author: Viktor Ashirov <[email protected]>
Date: Fri Jul 11 13:12:44 2025 +0200
Issue 6352 - Fix DeprecationWarning
Bug Description:
When pytest is used on ASAN build, pytest-html plugin collects `*asan*`
files, which results in the following deprecation warning:
```
The 'report.extra' attribute is deprecated and will be removed in a
future release, use 'report.extras' instead.
```
Fixes: https://github.com/389ds/389-ds-base/issues/6352
Reviwed by: @droideck (Thanks!)
diff --git a/dirsrvtests/conftest.py b/dirsrvtests/conftest.py
index c989729c1..0db6045f4 100644
--- a/dirsrvtests/conftest.py
+++ b/dirsrvtests/conftest.py
@@ -138,7 +138,7 @@ def pytest_runtest_makereport(item, call):
log_name = os.path.basename(f)
instance_name = os.path.basename(os.path.dirname(f)).split("slapd-",1)[1]
extra.append(pytest_html.extras.text(text, name=f"{instance_name}-{log_name}"))
- report.extra = extra
+ report.extras = extra
# Make a screenshot if WebUI test fails
if call.when == "call" and "WEBUI" in os.environ:
| 0 |
6157c6a8f8b03e401bcd580a9ebcf58787dc22a2
|
389ds/389-ds-base
|
Ticket 49693 - A DB_DEADLOCK while adding a tombstone (RUV) leads to access of an already freed entry
Bug Description:
During a ADD, in order to manage DB_DEADLOCK, instead of using the entry provided in the pblock
(i.e. 'e') the code uses a couple addingentry/originalentry.
Only in the initial attempt addingentry refers to 'e', in the others it refers to a duplicate one.
On DB_DEADLOCK, the entry is freed immediately (as it was not in the cache)
if we hit a DB_DEADLOCK then 'e' is freed and the next attempt is with a duplicate of 'e'.
But if the added entry is a tombstone we log a message dumping 'e', unfortunately 'e' was already freed.
Fix Description:
Use addingentry->ep_entry instead of 'e'. Also as it is for logging, test if the logging
level is set before dumping the entry.
https://pagure.io/389-ds-base/issue/49693
Reviewed by: Ludwig Krispenz, Mark Reynolds (thanks !!)
Platforms tested: F26
Flag Day: no
Doc impact: no
|
commit 6157c6a8f8b03e401bcd580a9ebcf58787dc22a2
Author: Thierry Bordaz <[email protected]>
Date: Wed May 16 16:21:40 2018 +0200
Ticket 49693 - A DB_DEADLOCK while adding a tombstone (RUV) leads to access of an already freed entry
Bug Description:
During a ADD, in order to manage DB_DEADLOCK, instead of using the entry provided in the pblock
(i.e. 'e') the code uses a couple addingentry/originalentry.
Only in the initial attempt addingentry refers to 'e', in the others it refers to a duplicate one.
On DB_DEADLOCK, the entry is freed immediately (as it was not in the cache)
if we hit a DB_DEADLOCK then 'e' is freed and the next attempt is with a duplicate of 'e'.
But if the added entry is a tombstone we log a message dumping 'e', unfortunately 'e' was already freed.
Fix Description:
Use addingentry->ep_entry instead of 'e'. Also as it is for logging, test if the logging
level is set before dumping the entry.
https://pagure.io/389-ds-base/issue/49693
Reviewed by: Ludwig Krispenz, Mark Reynolds (thanks !!)
Platforms tested: F26
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index 32c8e71ff..f26911595 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -905,10 +905,10 @@ ldbm_back_add(Slapi_PBlock *pb)
goto error_return;
}
}
- if (is_tombstone_operation) {
+ if (is_tombstone_operation && slapi_is_loglevel_set(SLAPI_LOG_DEBUG)) {
int len = 0;
const char *rs = slapi_entry_get_rdn_const(addingentry->ep_entry);
- char *es= slapi_entry2str_with_options(e, &len, SLAPI_DUMP_STATEINFO | SLAPI_DUMP_UNIQUEID);
+ char *es= slapi_entry2str_with_options(addingentry->ep_entry, &len, SLAPI_DUMP_STATEINFO | SLAPI_DUMP_UNIQUEID);
slapi_log_err(SLAPI_LOG_DEBUG, "ldbm_back_add", "now adding entry: %s\n %s\n", rs?rs:"no rdn", es);
slapi_ch_free_string(&es);
}
| 0 |
e84ef2eceaeaae02acf62b74b37be8e9b2ac59bc
|
389ds/389-ds-base
|
Bug 630092 - Coverity #11985: Resource leaks issues
https://bugzilla.redhat.com/show_bug.cgi?id=630092
Description:
The str2simple() has been modified to release unqstr when
an error occurs.
|
commit e84ef2eceaeaae02acf62b74b37be8e9b2ac59bc
Author: Endi Sukma Dewata <[email protected]>
Date: Fri Sep 17 16:37:27 2010 -0400
Bug 630092 - Coverity #11985: Resource leaks issues
https://bugzilla.redhat.com/show_bug.cgi?id=630092
Description:
The str2simple() has been modified to release unqstr when
an error occurs.
diff --git a/ldap/servers/slapd/str2filter.c b/ldap/servers/slapd/str2filter.c
index 0dd91a566..9ffcf245e 100644
--- a/ldap/servers/slapd/str2filter.c
+++ b/ldap/servers/slapd/str2filter.c
@@ -320,6 +320,7 @@ str2simple( char *str , int unescape_filter)
value[len] = savechar;
if (!r) {
slapi_filter_free(f, 1);
+ slapi_ch_free((void**)&unqstr);
return NULL;
}
f->f_avvalue.bv_val = unqstr;
| 0 |
37101d995654fbfc2fc863fd397a9633229e23c0
|
389ds/389-ds-base
|
Issue 5221 - fix covscan (#5359)
|
commit 37101d995654fbfc2fc863fd397a9633229e23c0
Author: tbordaz <[email protected]>
Date: Mon Jul 4 15:17:54 2022 +0200
Issue 5221 - fix covscan (#5359)
diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c
index b67c2c8c0..4718ed93f 100644
--- a/ldap/servers/slapd/pw_mgmt.c
+++ b/ldap/servers/slapd/pw_mgmt.c
@@ -208,7 +208,9 @@ skip:
slapi_pwpolicy_make_response_control(pb, -1, -1, LDAP_PWPOLICY_PWDEXPIRED);
}
slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
- bind_credentials_clear(pb_conn, PR_FALSE, PR_TRUE);
+ if (pb_conn) {
+ bind_credentials_clear(pb_conn, PR_FALSE, PR_TRUE);
+ }
slapi_send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL,
"password expired!", 0, NULL);
| 0 |
45e8474529c8f2734dc03710764f3eed4a54b751
|
389ds/389-ds-base
|
Ticket 50243 - refint modrdn stress test
Bug Description: It was reported that modrdn of an ou which
contained many items could break refint in some cases.
Fix Description: Add a stress test to try to reproduce the issue
https://pagure.io/389-ds-base/issue/50243
Author: William Brown <[email protected]>
Review by: spichugi (Thanks)
|
commit 45e8474529c8f2734dc03710764f3eed4a54b751
Author: William Brown <[email protected]>
Date: Mon Feb 25 09:59:21 2019 +1000
Ticket 50243 - refint modrdn stress test
Bug Description: It was reported that modrdn of an ou which
contained many items could break refint in some cases.
Fix Description: Add a stress test to try to reproduce the issue
https://pagure.io/389-ds-base/issue/50243
Author: William Brown <[email protected]>
Review by: spichugi (Thanks)
diff --git a/dirsrvtests/tests/suites/referint_plugin/rename_test.py b/dirsrvtests/tests/suites/referint_plugin/rename_test.py
new file mode 100644
index 000000000..442c1a49c
--- /dev/null
+++ b/dirsrvtests/tests/suites/referint_plugin/rename_test.py
@@ -0,0 +1,177 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2019 William Brown <[email protected]>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+
+
+from lib389._constants import DEFAULT_SUFFIX
+from lib389.topologies import topology_m2
+
+from lib389.replica import ReplicationManager
+from lib389.idm.group import Groups
+from lib389.idm.user import nsUserAccounts
+from lib389.idm.organizationalunit import OrganizationalUnit as OrganisationalUnit
+
+from lib389.plugins import AutoMembershipPlugin, ReferentialIntegrityPlugin, AutoMembershipDefinitions, MemberOfPlugin
+
+UCOUNT = 400
+
+def _enable_plugins(inst, group_dn):
+ # Enable automember
+ amp = AutoMembershipPlugin(inst)
+ amp.enable()
+
+ # Create the automember definition
+ automembers = AutoMembershipDefinitions(inst)
+
+ automember = automembers.create(properties={
+ 'cn': 'testgroup_definition',
+ 'autoMemberScope': DEFAULT_SUFFIX,
+ 'autoMemberFilter': 'objectclass=nsAccount',
+ 'autoMemberDefaultGroup': group_dn,
+ 'autoMemberGroupingAttr': 'member:dn',
+ })
+
+ # Enable MemberOf
+ mop = MemberOfPlugin(inst)
+ mop.enable()
+
+ # Enable referint
+ rip = ReferentialIntegrityPlugin(inst)
+ # We only need to enable the plugin, the default configuration is sane and
+ # correctly coveres member as an enforced attribute.
+ rip.enable()
+
+ # Restart to make sure it's enabled and good to go.
+ inst.restart()
+
+def test_rename_large_subtree(topology_m2):
+ """
+ A report stated that the following configuration would lead
+ to an operation failure:
+
+ ou=int,ou=account,dc=...
+ ou=s1,ou=int,ou=account,dc=...
+ ou=s2,ou=int,ou=account,dc=...
+
+ rename ou=s1 to re-parent to ou=account, leaving:
+
+ ou=int,ou=account,dc=...
+ ou=s1,ou=account,dc=...
+ ou=s2,ou=account,dc=...
+
+ The ou=s1 if it has < 100 entries below, is able to be reparented.
+
+ If ou=s1 has > 400 entries, it fails.
+
+ Other conditions was the presence of referential integrity - so one would
+ assume that all users under s1 are a member of some group external to this.
+
+ :id: 5915c38d-b3c2-4b7c-af76-8a1e002e27f7
+
+ :setup: standalone instance
+
+ :steps: 1. Enable automember plugin
+ 2. Add UCOUNT users, and ensure they are members of a group.
+ 3. Enable refer-int plugin
+ 4. Move ou=s1 to a new parent
+
+ :expectedresults:
+ 1. The plugin is enabled
+ 2. The users are members of the group
+ 3. The plugin is enabled
+ 4. The rename operation of ou=s1 succeeds
+ """
+
+ st = topology_m2.ms["master1"]
+ m2 = topology_m2.ms["master2"]
+
+ # Create a default group
+ gps = Groups(st, DEFAULT_SUFFIX)
+ # Keep the group so we can get it's DN out.
+ group = gps.create(properties={
+ 'cn': 'default_group'
+ })
+
+ _enable_plugins(st, group.dn)
+ _enable_plugins(m2, group.dn)
+
+ # Now unlike normal, we bypass the plural-create method, because we need control
+ # over the exact DN of the OU to create.
+ # Create the ou=account
+
+ # We don't need to set a DN here because ...
+ ou_account = OrganisationalUnit(st)
+
+ # It's set in the .create step.
+ ou_account.create(
+ basedn = DEFAULT_SUFFIX,
+ properties={
+ 'ou': 'account'
+ })
+ # create the ou=int,ou=account
+ ou_int = OrganisationalUnit(st)
+ ou_int.create(
+ basedn = ou_account.dn,
+ properties={
+ 'ou': 'int'
+ })
+ # Create the ou=s1,ou=int,ou=account
+ ou_s1 = OrganisationalUnit(st)
+ ou_s1.create(
+ basedn = ou_int.dn,
+ properties={
+ 'ou': 's1'
+ })
+
+ # Pause replication
+ repl = ReplicationManager(DEFAULT_SUFFIX)
+ repl.disable_to_master(m2, [st, ])
+
+ # Create the users 1 -> UCOUNT in ou=s1
+ nsu = nsUserAccounts(st, basedn=ou_s1.dn, rdn=None)
+ for i in range(1000, 1000 + UCOUNT):
+ nsu.create_test_user(uid=i)
+
+ # Enable replication
+
+ repl.enable_to_master(m2, [st, ])
+
+ # Assert they are in the group as we expect
+ members = group.get_attr_vals_utf8('member')
+ assert len(members) == UCOUNT
+
+ # Wait for replication
+ repl.wait_for_replication(st, m2)
+
+ for i in range(0, 5):
+ # Move ou=s1 to ou=account as parent. We have to provide the rdn,
+ # even though it's not changing.
+ ou_s1.rename('ou=s1', newsuperior=ou_account.dn)
+
+ members = group.get_attr_vals_utf8('member')
+ assert len(members) == UCOUNT
+ # Check that we really did refer-int properly, and ou=int is not in the members.
+ for member in members:
+ assert 'ou=int' not in member
+
+ # Now move it back
+ ou_s1.rename('ou=s1', newsuperior=ou_int.dn)
+ members = group.get_attr_vals_utf8('member')
+ assert len(members) == UCOUNT
+ for member in members:
+ assert 'ou=int' in member
+
+ # Check everythig on the other side is good.
+ repl.wait_for_replication(st, m2)
+
+ group2 = Groups(m2, DEFAULT_SUFFIX).get('default_group')
+
+ members = group2.get_attr_vals_utf8('member')
+ assert len(members) == UCOUNT
+ for member in members:
+ assert 'ou=int' in member
diff --git a/src/lib389/lib389/plugins.py b/src/lib389/lib389/plugins.py
index adc5eb3d9..c8b024be3 100644
--- a/src/lib389/lib389/plugins.py
+++ b/src/lib389/lib389/plugins.py
@@ -911,7 +911,7 @@ class AutoMembershipDefinition(DSLdapObject):
:type dn: str
"""
- def __init__(self, instance, dn=None):
+ def __init__(self, instance, dn):
super(AutoMembershipDefinition, self).__init__(instance, dn)
self._rdn_attribute = 'cn'
self._must_attributes = ['cn', 'autoMemberScope', 'autoMemberFilter', 'autoMemberGroupingAttr']
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index a462c98eb..9117661b3 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -1214,7 +1214,8 @@ class Replica(DSLdapObject):
scope=ldap.SCOPE_SUBTREE,
filterstr='(&(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff)(objectclass=nstombstone))',
attrlist=['nsds50ruv'],
- serverctrls=self._server_controls, clientctrls=self._client_controls)[0]
+ serverctrls=self._server_controls, clientctrls=self._client_controls,
+ escapehatch='i am sure')[0]
data = ensure_list_str(ent.getValues('nsds50ruv'))
@@ -1233,7 +1234,8 @@ class Replica(DSLdapObject):
scope=ldap.SCOPE_SUBTREE,
filterstr='(&(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff)(objectclass=nstombstone))',
attrlist=['nsds5agmtmaxcsn'],
- serverctrls=self._server_controls, clientctrls=self._client_controls)[0]
+ serverctrls=self._server_controls, clientctrls=self._client_controls,
+ escapehatch='i am sure')[0]
return ensure_list_str(ent.getValues('nsds5agmtmaxcsn'))
| 0 |
eb358a5ed6dea6f32c017c8f86e49d436db181fa
|
389ds/389-ds-base
|
Ticket 49051 - Enable SASL LOGIN/PLAIN support as a precursor to LDAPSSOTOKEN
Bug Description: We should allow LOGIN/PLAIN support for SASL. This is enabled
if the user has the cyrus-sasl plain libraries installed. The reason for this
is that LDAPSSOTOKEN will use the same userdb callbacks, so if we create them
then we also need to support LOGIN/PLAIN else they will autodetect and will just
be non-functional.
Fix Description: Modularise some of the bind pw verification code from bind.c
to pw_verify.c, then make the call to it from saslbind.c
https://fedorahosted.org/389/ticket/49051
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit eb358a5ed6dea6f32c017c8f86e49d436db181fa
Author: William Brown <[email protected]>
Date: Wed Nov 23 17:03:59 2016 +1000
Ticket 49051 - Enable SASL LOGIN/PLAIN support as a precursor to LDAPSSOTOKEN
Bug Description: We should allow LOGIN/PLAIN support for SASL. This is enabled
if the user has the cyrus-sasl plain libraries installed. The reason for this
is that LDAPSSOTOKEN will use the same userdb callbacks, so if we create them
then we also need to support LOGIN/PLAIN else they will autodetect and will just
be non-functional.
Fix Description: Modularise some of the bind pw verification code from bind.c
to pw_verify.c, then make the call to it from saslbind.c
https://fedorahosted.org/389/ticket/49051
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 1d76aeb0e..9cf30eee9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1738,6 +1738,7 @@ ns_slapd_SOURCES = ldap/servers/slapd/abandon.c \
ldap/servers/slapd/passwd_extop.c \
ldap/servers/slapd/psearch.c \
ldap/servers/slapd/pw_mgmt.c \
+ ldap/servers/slapd/pw_verify.c \
ldap/servers/slapd/rootdse.c \
ldap/servers/slapd/sasl_io.c \
ldap/servers/slapd/saslbind.c \
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 12d6dca1e..d8811d58b 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -38,6 +38,7 @@
#include "slap.h"
#include "fe.h"
#include "pratom.h"
+#include "pw_verify.h"
#include <sasl.h>
static void log_bind_access(
@@ -49,38 +50,6 @@ static void log_bind_access(
const char *msg
);
-
-/*
- * Function: is_root_dn_pw
- *
- * Returns: 1 if the password for the root dn is correct.
- * 0 otherwise.
- * dn must be normalized
- *
- */
-static int
-is_root_dn_pw( const char *dn, const Slapi_Value *cred )
-{
- int rv= 0;
- char *rootpw = config_get_rootpw();
- if ( rootpw == NULL || !slapi_dn_isroot( dn ) )
- {
- rv = 0;
- }
- else
- {
- Slapi_Value rdnpwbv;
- Slapi_Value *rdnpwvals[2];
- slapi_value_init_string(&rdnpwbv,rootpw);
- rdnpwvals[ 0 ] = &rdnpwbv;
- rdnpwvals[ 1 ] = NULL;
- rv = slapi_pw_find_sv( rdnpwvals, cred ) == 0;
- value_done(&rdnpwbv);
- }
- slapi_ch_free_string( &rootpw );
- return rv;
-}
-
void
do_bind( Slapi_PBlock *pb )
{
@@ -94,7 +63,6 @@ do_bind( Slapi_PBlock *pb )
const char *dn = NULL;
char *saslmech = NULL;
struct berval cred = {0};
- Slapi_Backend *be = NULL;
ber_tag_t ber_rc;
int rc = 0;
Slapi_DN *sdn = NULL;
@@ -107,7 +75,6 @@ do_bind( Slapi_PBlock *pb )
int auto_bind = 0;
int minssf = 0;
int minssf_exclude_rootdse = 0;
- Slapi_DN *original_sdn = NULL;
slapi_log_err(SLAPI_LOG_TRACE, "do_bind", "=>\n");
@@ -612,7 +579,7 @@ do_bind( Slapi_PBlock *pb )
/*
* Check the dn and password
*/
- if ( is_root_dn_pw( slapi_sdn_get_ndn(sdn), &cv )) {
+ if (pw_verify_root_dn( slapi_sdn_get_ndn(sdn), &cv ) == SLAPI_BIND_SUCCESS) {
/*
* right dn and passwd - authorize
*/
@@ -648,232 +615,201 @@ do_bind( Slapi_PBlock *pb )
send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
}
goto free_and_return;
- }
+ } /* End isroot and auth_simple */
- /* We could be serving multiple database backends. Select the appropriate one */
- if (slapi_mapping_tree_select(pb, &be, &referral, NULL, 0) != LDAP_SUCCESS) {
- send_nobackend_ldap_result( pb );
- be = NULL;
- goto free_and_return;
- }
+ /*
+ * call the pre-bind plugins. if they succeed, call
+ * the backend bind function. then call the post-bind
+ * plugins.
+ */
+ if ( plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) == 0 ) {
+ rc = 0;
+
+ /* Check if a pre_bind plugin mapped the DN to another backend */
+ Slapi_DN *pb_sdn;
+ slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &pb_sdn);
+ if (!pb_sdn) {
+ slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set NULL dn\n");
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
+ goto free_and_return;
+ }
+ sdn = pb_sdn;
+ dn = slapi_sdn_get_dn(sdn);
+ if (!dn) {
+ const char *udn = slapi_sdn_get_udn(sdn);
+ slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set corrupted dn %s\n", udn?udn:"");
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
+ goto free_and_return;
+ }
- if (referral) {
- send_referrals_from_entry(pb,referral);
- slapi_entry_free(referral);
- goto free_and_return;
- }
+ /* We could be serving multiple database backends. Select the appropriate one */
+ /* pw_verify_be_dn will select the backend we need for us. */
- slapi_pblock_set( pb, SLAPI_BACKEND, be );
+ rc = pw_verify_be_dn(pb, &referral);
- /* not root dn - pass to the backend */
- if ( be->be_bind != NULL ) {
- original_sdn = slapi_sdn_dup(sdn);
- /*
- * call the pre-bind plugins. if they succeed, call
- * the backend bind function. then call the post-bind
- * plugins.
- */
- if ( plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) == 0 ) {
- int sdn_updated = 0;
- rc = 0;
-
- /* Check if a pre_bind plugin mapped the DN to another backend */
- Slapi_DN *pb_sdn;
- slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &pb_sdn);
- if (!pb_sdn) {
- slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set NULL dn\n");
- slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
- goto free_and_return;
- } else if ((pb_sdn != sdn) || (sdn_updated = slapi_sdn_compare(original_sdn, pb_sdn))) {
- /*
- * Slapi_DN set in pblock was changed by a pre bind plug-in.
- * It is a plug-in's responsibility to free the original Slapi_DN.
- */
- sdn = pb_sdn;
- dn = slapi_sdn_get_dn(sdn);
- if (!dn) {
- const char *udn = slapi_sdn_get_udn(sdn);
- slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in set corrupted dn %s\n", udn?udn:"");
- slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
- goto free_and_return;
+ if (rc == SLAPI_BIND_NO_BACKEND) {
+ send_nobackend_ldap_result( pb );
+ goto free_and_return;
+ } else if (rc == SLAPI_BIND_REFERRAL) {
+ send_referrals_from_entry(pb,referral);
+ slapi_entry_free(referral);
+ goto free_and_return;
+ } else if (auto_bind || rc == SLAPI_BIND_SUCCESS || rc == SLAPI_BIND_ANONYMOUS) {
+ long t;
+ char* authtype = NULL;
+ /* rc is SLAPI_BIND_SUCCESS or SLAPI_BIND_ANONYMOUS */
+ if(auto_bind) {
+ rc = SLAPI_BIND_SUCCESS;
+ }
+
+ switch ( method ) {
+ case LDAP_AUTH_SIMPLE:
+ if (cred.bv_len != 0) {
+ authtype = SLAPD_AUTH_SIMPLE;
}
- if (!sdn_updated) { /* pb_sdn != sdn; need to compare the dn's. */
- sdn_updated = slapi_sdn_compare(original_sdn, sdn);
+#if defined(ENABLE_AUTOBIND)
+ else if(auto_bind) {
+ authtype = SLAPD_AUTH_OS;
}
- if (sdn_updated) { /* call slapi_be_select only when the DN is updated. */
- slapi_be_Unlock(be);
- be = slapi_be_select_exact(sdn);
- if (be) {
- slapi_be_Rlock(be);
- slapi_pblock_set( pb, SLAPI_BACKEND, be );
- } else {
- slapi_create_errormsg(errorbuf, sizeof(errorbuf), "No matching backend for %s\n", dn);
- slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errorbuf);
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, "", 0, NULL);
- goto free_and_return;
- }
+#endif /* ENABLE_AUTOBIND */
+ else {
+ authtype = SLAPD_AUTH_NONE;
}
+ break;
+ case LDAP_AUTH_SASL:
+ /* authtype = SLAPD_AUTH_SASL && saslmech: */
+ PR_snprintf(authtypebuf, sizeof(authtypebuf), "%s%s", SLAPD_AUTH_SASL, saslmech);
+ authtype = authtypebuf;
+ break;
+ default:
+ break;
}
- slapi_pblock_set( pb, SLAPI_PLUGIN, be->be_database );
- set_db_default_result_handlers(pb);
- if ( (rc != 1) &&
- (auto_bind ||
- (((rc = (*be->be_bind)( pb )) == SLAPI_BIND_SUCCESS) ||
- (rc == SLAPI_BIND_ANONYMOUS))) ) {
- long t;
- char* authtype = NULL;
- /* rc is SLAPI_BIND_SUCCESS or SLAPI_BIND_ANONYMOUS */
- if(auto_bind) {
- rc = SLAPI_BIND_SUCCESS;
- }
- switch ( method ) {
- case LDAP_AUTH_SIMPLE:
- if (cred.bv_len != 0) {
- authtype = SLAPD_AUTH_SIMPLE;
- }
-#if defined(ENABLE_AUTOBIND)
- else if(auto_bind) {
- authtype = SLAPD_AUTH_OS;
- }
-#endif /* ENABLE_AUTOBIND */
- else {
- authtype = SLAPD_AUTH_NONE;
+ if ( rc == SLAPI_BIND_SUCCESS ) {
+ int myrc = 0;
+ Slapi_Backend *be = NULL;
+ /*
+ * The bind is successful.
+ * We can give it to slapi_check_account_lock and reslimit_update_from_dn.
+ */
+ /*
+ * Is this account locked ?
+ * could be locked through the account inactivation
+ * or by the password policy
+ *
+ * rc=0: account not locked
+ * rc=1: account locked, can not bind, result has been sent
+ * rc!=0 and rc!=1: error. Result was not sent, lets be_bind
+ * deal with it.
+ *
+ */
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
+ bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(sdn));
+ myrc = slapi_check_account_lock(pb, bind_target_entry, pw_response_requested, 1, 1);
+ if (1 == myrc) { /* account is locked */
+ rc = myrc;
+ goto account_locked;
}
- break;
- case LDAP_AUTH_SASL:
- /* authtype = SLAPD_AUTH_SASL && saslmech: */
- PR_snprintf(authtypebuf, sizeof(authtypebuf), "%s%s", SLAPD_AUTH_SASL, saslmech);
- authtype = authtypebuf;
- break;
- default:
- break;
+ myrc = 0;
}
-
- if ( rc == SLAPI_BIND_SUCCESS ) {
- int myrc = 0;
+ if (!auto_bind) {
/*
- * The bind is successful.
- * We can give it to slapi_check_account_lock and reslimit_update_from_dn.
+ * There could be a race that bind_target_entry was not added
+ * when bind_target_entry was retrieved before be_bind, but it
+ * was in be_bind. Since be_bind returned SLAPI_BIND_SUCCESS,
+ * the entry is in the DS. So, we need to retrieve it once more.
*/
- /*
- * Is this account locked ?
- * could be locked through the account inactivation
- * or by the password policy
- *
- * rc=0: account not locked
- * rc=1: account locked, can not bind, result has been sent
- * rc!=0 and rc!=1: error. Result was not sent, lets be_bind
- * deal with it.
- *
- */
- if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
+ if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA) &&
+ !bind_target_entry) {
bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(sdn));
- myrc = slapi_check_account_lock(pb, bind_target_entry, pw_response_requested, 1, 1);
- if (1 == myrc) { /* account is locked */
- rc = myrc;
- goto account_locked;
+ if (!bind_target_entry) {
+ slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "No such entry");
+ send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL, "", 0, NULL);
+ goto free_and_return;
}
- myrc = 0;
}
- if (!auto_bind) {
- /*
- * There could be a race that bind_target_entry was not added
- * when bind_target_entry was retrieved before be_bind, but it
- * was in be_bind. Since be_bind returned SLAPI_BIND_SUCCESS,
- * the entry is in the DS. So, we need to retrieve it once more.
- */
- if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA) &&
- !bind_target_entry) {
- bind_target_entry = get_entry(pb, slapi_sdn_get_ndn(sdn));
- if (!bind_target_entry) {
- slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, "No such entry");
- send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL, "", 0, NULL);
- goto free_and_return;
- }
- }
- bind_credentials_set(pb->pb_conn, authtype,
- slapi_ch_strdup(slapi_sdn_get_ndn(sdn)),
- NULL, NULL, NULL, bind_target_entry);
- if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
- /* check if need new password before sending
- the bind success result */
- myrc = need_new_pw(pb, &t, bind_target_entry, pw_response_requested);
- switch (myrc) {
- case 1:
- (void)slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
- break;
- case 2:
- (void)slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRING, t);
- break;
- default:
- break;
- }
+ bind_credentials_set(pb->pb_conn, authtype,
+ slapi_ch_strdup(slapi_sdn_get_ndn(sdn)),
+ NULL, NULL, NULL, bind_target_entry);
+ if (!slapi_be_is_flag_set(be, SLAPI_BE_FLAG_REMOTE_DATA)) {
+ /* check if need new password before sending
+ the bind success result */
+ myrc = need_new_pw(pb, &t, bind_target_entry, pw_response_requested);
+ switch (myrc) {
+ case 1:
+ (void)slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRED, 0);
+ break;
+ case 2:
+ (void)slapi_add_pwd_control(pb, LDAP_CONTROL_PWEXPIRING, t);
+ break;
+ default:
+ break;
}
}
- if (auth_response_requested) {
- slapi_add_auth_response_control(pb, slapi_sdn_get_ndn(sdn));
- }
- if (-1 == myrc) {
- /* need_new_pw failed; need_new_pw already send_ldap_result in it. */
- goto free_and_return;
- }
- } else { /* anonymous */
- /* set bind creds here so anonymous limits are set */
- bind_credentials_set(pb->pb_conn, authtype, NULL, NULL, NULL, NULL, NULL);
-
- if ( auth_response_requested ) {
- slapi_add_auth_response_control(pb, "");
- }
}
- } else {
-account_locked:
- if(cred.bv_len == 0) {
- /* its an UnAuthenticated Bind, DN specified but no pw */
- slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
- }else{
- /* password must have been invalid */
- /* increment BindSecurityError count */
- slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
+ if (auth_response_requested) {
+ slapi_add_auth_response_control(pb, slapi_sdn_get_ndn(sdn));
}
- }
+ if (-1 == myrc) {
+ /* need_new_pw failed; need_new_pw already send_ldap_result in it. */
+ goto free_and_return;
+ }
+ if (be) {
+ slapi_be_Unlock(be);
+ }
+ } else { /* anonymous */
+ /* set bind creds here so anonymous limits are set */
+ bind_credentials_set(pb->pb_conn, authtype, NULL, NULL, NULL, NULL, NULL);
- /*
- * if rc != SLAPI_BIND_SUCCESS and != SLAPI_BIND_ANONYMOUS,
- * the result has already been sent by the backend. otherwise,
- * we assume it is success and send it here to avoid a race
- * condition where the client could be told by the
- * backend that the bind succeeded before we set the
- * c_dn field in the connection structure here in
- * the front end.
- */
- if ( rc == SLAPI_BIND_SUCCESS || rc == SLAPI_BIND_ANONYMOUS) {
- send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
+ if ( auth_response_requested ) {
+ slapi_add_auth_response_control(pb, "");
+ }
+ }
+ } else { /* if auto_bind || rc == slapi_bind_success | slapi_bind_anonymous */
+ if (rc == LDAP_OPERATIONS_ERROR) {
+ send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL, "Function not implemented", 0, NULL );
+ goto free_and_return;
+ }
+account_locked:
+ if(cred.bv_len == 0) {
+ /* its an UnAuthenticated Bind, DN specified but no pw */
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsUnAuthBinds);
+ }else{
+ /* password must have been invalid */
+ /* increment BindSecurityError count */
+ slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsBindSecurityErrors);
}
+ }
- slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &rc );
- plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
- } else {
- /* even though preop failed, we should still call the post-op plugins */
- plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
- /* If the prebind plugins fail we MUST send a result! */
- /* Is there a way to get a better result descriptions from say the ADDN plugin? */
- slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in failed\n");
- send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
- goto free_and_return;
+ /*
+ * if rc != SLAPI_BIND_SUCCESS and != SLAPI_BIND_ANONYMOUS,
+ * the result has already been sent by the backend. otherwise,
+ * we assume it is success and send it here to avoid a race
+ * condition where the client could be told by the
+ * backend that the bind succeeded before we set the
+ * c_dn field in the connection structure here in
+ * the front end.
+ */
+ if ( rc == SLAPI_BIND_SUCCESS || rc == SLAPI_BIND_ANONYMOUS) {
+ send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
}
+
+ slapi_pblock_set( pb, SLAPI_PLUGIN_OPRETURN, &rc );
+ plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
} else {
- send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
- "Function not implemented", 0, NULL );
+ /* even though preop failed, we should still call the post-op plugins */
+ plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
+ /* If the prebind plugins fail we MUST send a result! */
+ /* Is there a way to get a better result descriptions from say the ADDN plugin? */
+ slapi_create_errormsg(errorbuf, sizeof(errorbuf), "Pre-bind plug-in failed\n");
+ send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, errorbuf, 0, NULL);
+ goto free_and_return;
}
-free_and_return:;
- slapi_sdn_free(&original_sdn);
- if (be) {
- slapi_be_Unlock(be);
- }
+free_and_return:
if (bind_sdn_in_pb) {
slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &sdn);
}
diff --git a/ldap/servers/slapd/pw_verify.c b/ldap/servers/slapd/pw_verify.c
new file mode 100644
index 000000000..93e5ff357
--- /dev/null
+++ b/ldap/servers/slapd/pw_verify.c
@@ -0,0 +1,95 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2016 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+/*
+ * pw_verify.c
+ *
+ * This contains helpers that take a DN and a password credential from a simple
+ * bind or SASL PLAIN/LOGIN. It steps through the raw credential and returns
+ *
+ * SLAPI_BIND_SUCCESS : The credentials are correct for the DN.
+ * SLAPI_BIND_ANONYMOUS : The credentials are anonymous.
+ * SLAPI_BIND_REFERRAL : The DN provided is going to be a referal, go away!
+ * LDAP_INVALID_CREDENTIALS : The credentials are incorrect for this DN, or not
+ * enough material was provided.
+ * LDAP_OPERATIONS_ERROR : Something went wrong during verification.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "slap.h"
+#include "fe.h"
+
+int
+pw_verify_root_dn(const char *dn, const Slapi_Value *cred)
+{
+ int result = LDAP_OPERATIONS_ERROR;
+ char *root_pw = config_get_rootpw();
+ if (root_pw != NULL && slapi_dn_isroot(dn)) {
+ /* Now build a slapi value to give to slapi_pw_find_sv */
+ Slapi_Value root_dn_pw_bval;
+ slapi_value_init_string(&root_dn_pw_bval, root_pw);
+ Slapi_Value *root_dn_pw_vals[] = {&root_dn_pw_bval, NULL};
+ result = slapi_pw_find_sv(root_dn_pw_vals, cred);
+ value_done(&root_dn_pw_bval);
+ }
+ slapi_ch_free_string(&root_pw);
+ return result;
+}
+
+/*
+ * This will work out which backend is needed, and then work from there.
+ * You must set the SLAPI_BIND_TARGET_SDN, and SLAPI_BIND_CREDENTIALS to
+ * the pblock for this to operate correctly.
+ *
+ * In the future, this will use the credentials and do mfa.
+ *
+ * If you get SLAPI_BIND_SUCCESS or SLAPI_BIND_ANONYMOUS you need to unlock
+ * the backend.
+ * All other results, it's already released.
+ */
+int
+pw_verify_be_dn(Slapi_PBlock *pb, Slapi_Entry **referral)
+{
+ int rc = 0;
+ Slapi_Backend *be = NULL;
+
+ if (slapi_mapping_tree_select(pb, &be, referral, NULL, 0) != LDAP_SUCCESS) {
+ return SLAPI_BIND_NO_BACKEND;
+ }
+
+ if (*referral) {
+ slapi_be_Unlock(be);
+ return SLAPI_BIND_REFERRAL;
+ }
+
+ slapi_pblock_set( pb, SLAPI_BACKEND, be );
+ /* Put the credentials into the pb */
+ if (be->be_bind == NULL) {
+ /* Selected backend doesn't support binds! */
+ slapi_be_Unlock(be);
+ return LDAP_OPERATIONS_ERROR;
+ }
+ slapi_pblock_set(pb, SLAPI_PLUGIN, be->be_database);
+ /* Make sure the result handlers are setup */
+ set_db_default_result_handlers(pb);
+ /* now take the dn, and check it */
+ rc = (*be->be_bind)(pb);
+ /* now attempt the bind. */
+ if (rc != SLAPI_BIND_SUCCESS && rc != SLAPI_BIND_ANONYMOUS) {
+ slapi_be_Unlock(be);
+ }
+ return rc;
+}
+
+int
+pw_verify_dn()
+{
+ return LDAP_OPERATIONS_ERROR;
+}
diff --git a/ldap/servers/slapd/pw_verify.h b/ldap/servers/slapd/pw_verify.h
new file mode 100644
index 000000000..fc34fd147
--- /dev/null
+++ b/ldap/servers/slapd/pw_verify.h
@@ -0,0 +1,15 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2016 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#ifndef _SLAPD_PW_VERIFY_H_
+#define _SLAPD_PW_VERIFY_H_
+
+int pw_verify_root_dn(const char *dn, const Slapi_Value *cred);
+int pw_verify_be_dn(Slapi_PBlock *pb, Slapi_Entry **referral);
+
+#endif /* _SLAPD_PW_VERIFY_H_ */
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 55d52bcda..9e5d1f06f 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -19,6 +19,7 @@
#include <slap.h>
#include <fe.h>
+#include <pw_verify.h>
#include <sasl.h>
#include <saslplug.h>
#include <unistd.h>
@@ -510,6 +511,88 @@ static int ids_sasl_getpluginpath(sasl_conn_t *conn, const char **path)
return SASL_OK;
}
+static int ids_sasl_userdb_checkpass(sasl_conn_t *conn, void *context, const char *user, const char *pass, unsigned passlen, struct propctx *propctx) {
+ /*
+ * Based on the mech
+ */
+ char *mech = NULL;
+ int isroot = 0;
+ int bind_result = SLAPI_BIND_FAIL;
+ struct berval cred;
+
+ sasl_getprop(conn, SASL_MECHNAME, (const void**)&mech);
+ if (mech == NULL) {
+ slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_userdb_checkpass", "Unable to read SASL mechanism while verifying userdb password.\n");
+ goto out;
+ }
+
+ slapi_log_err(SLAPI_LOG_TRACE, "ids_sasl_userdb_checkpass", "Using mech %s", mech);
+ if (passlen == 0) {
+ goto out;
+ }
+
+ if (strncasecmp(user, "dn: ", 4) == 0) {
+ isroot = slapi_dn_isroot(user+4);
+ } else {
+ /* The sasl request probably didn't come from us ... */
+ goto out;
+ }
+
+ /* Both types will need the creds. */
+ cred.bv_len = passlen;
+ cred.bv_val = (char *)pass;
+
+ if (isroot) {
+ Slapi_Value sv_cred;
+ /* Turn the creds into a Slapi Value */
+ slapi_value_init_berval(&sv_cred,&cred);
+ bind_result = pw_verify_root_dn(user+4, &sv_cred);
+ value_done(&sv_cred);
+ } else {
+ /* Convert the dn char str to an SDN */
+ ber_tag_t method = LDAP_AUTH_SIMPLE;
+ Slapi_Entry *referral = NULL;
+ Slapi_DN *sdn = slapi_sdn_new();
+ slapi_sdn_set_dn_byval(sdn, user+4);
+ /* Create a pblock */
+ Slapi_PBlock *pb = slapi_pblock_new();
+ /* We have to make a fake operation for the targetsdn spec. */
+ /* This is used within the be_dn function */
+ Slapi_Operation *op = operation_new(OP_FLAG_INTERNAL);
+ operation_set_type(op, SLAPI_OPERATION_BIND);
+ /* For mapping tree to work */
+ operation_set_target_spec(op, sdn);
+ slapi_pblock_set(pb, SLAPI_OPERATION, op);
+ /* Equivalent to SLAPI_BIND_TARGET_SDN
+ * Used by ldbm bind to know who to bind to.
+ */
+ slapi_pblock_set(pb, SLAPI_TARGET_SDN, (void *)sdn);
+ slapi_pblock_set(pb, SLAPI_BIND_CREDENTIALS, &cred);
+ /* To make the ldbm-bind code work, we pretend to be a simple auth right now. */
+ slapi_pblock_set(pb, SLAPI_BIND_METHOD, &method);
+ /* Feed it to pw_verify_be_dn */
+ bind_result = pw_verify_be_dn(pb, &referral);
+ /* Now check the result, and unlock be if needed. */
+ if (bind_result == SLAPI_BIND_SUCCESS || bind_result == SLAPI_BIND_ANONYMOUS) {
+ Slapi_Backend *be = NULL;
+ slapi_pblock_get(pb, SLAPI_BACKEND, &be);
+ slapi_be_Unlock(be);
+ } else if (bind_result == SLAPI_BIND_REFERRAL) {
+ /* If we have a referral do we ignore it for sasl? */
+ slapi_entry_free(referral);
+ }
+ /* Free everything */
+ slapi_sdn_free(&sdn);
+ slapi_pblock_destroy(pb);
+ }
+
+out:
+ if (bind_result == SLAPI_BIND_SUCCESS) {
+ return SASL_OK;
+ }
+ return SASL_FAIL;
+}
+
static sasl_callback_t ids_sasl_callbacks[] =
{
{
@@ -532,6 +615,11 @@ static sasl_callback_t ids_sasl_callbacks[] =
(IFP) ids_sasl_getpluginpath,
NULL
},
+ {
+ SASL_CB_SERVER_USERDB_CHECKPASS,
+ (IFP) ids_sasl_userdb_checkpass,
+ NULL
+ },
{
SASL_CB_LIST_END,
(IFP) NULL,
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 7c087e66c..b223f6504 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -468,8 +468,11 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
* return codes used by BIND functions
*/
#define SLAPI_BIND_SUCCESS 0 /* front end will send result */
+ /* 1 is reserved */
#define SLAPI_BIND_FAIL 2 /* back end should send result */
-#define SLAPI_BIND_ANONYMOUS 3 /* front end will send result */
+#define SLAPI_BIND_ANONYMOUS 3 /* front end will send result */
+#define SLAPI_BIND_REFERRAL 4 /* caller should send result */
+#define SLAPI_BIND_NO_BACKEND 5 /* caller should send result */
/* commonly used attributes names */
| 0 |
9940ca29ca258891c52640a23adc2851afe59d0e
|
389ds/389-ds-base
|
Ticket 47759 - Crash in replication when server is under write load
Bug Description: When the server is under alot of load, a race condition allows
a replication connection LDAP struct to be freed(unbind) while
it is being used by another thread. This leads to a crash.
Fix Description: Extend the connection lock to also cover ldap client interaction
(e.g. conn->ld struct).
https://fedorahosted.org/389/ticket/47759
Reviewed by: nhosoi & rmeggins(Thanks!!)
|
commit 9940ca29ca258891c52640a23adc2851afe59d0e
Author: Mark Reynolds <[email protected]>
Date: Mon Mar 31 15:17:59 2014 -0400
Ticket 47759 - Crash in replication when server is under write load
Bug Description: When the server is under alot of load, a race condition allows
a replication connection LDAP struct to be freed(unbind) while
it is being used by another thread. This leads to a crash.
Fix Description: Extend the connection lock to also cover ldap client interaction
(e.g. conn->ld struct).
https://fedorahosted.org/389/ticket/47759
Reviewed by: nhosoi & rmeggins(Thanks!!)
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index 0e49b9459..3d29a79ef 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -142,6 +142,7 @@ static void repl5_debug_timeout_callback(time_t when, void *arg);
/* Forward declarations */
static void close_connection_internal(Repl_Connection *conn);
+static void conn_delete_internal(Repl_Connection *conn);
/*
* Create a new connection object. Returns a pointer to the object, or
@@ -186,11 +187,22 @@ conn_new(Repl_Agmt *agmt)
rpc->plain = NULL;
return rpc;
loser:
- conn_delete(rpc);
+ conn_delete_internal(rpc);
slapi_ch_free((void**)&rpc);
return NULL;
}
+static PRBool
+conn_connected_locked(Repl_Connection *conn, int locked)
+{
+ PRBool return_value;
+
+ if(!locked) PR_Lock(conn->lock);
+ return_value = STATE_CONNECTED == conn->state;
+ if(!locked) PR_Unlock(conn->lock);
+
+ return return_value;
+}
/*
* Return PR_TRUE if the connection is in the connected state
@@ -198,14 +210,9 @@ loser:
static PRBool
conn_connected(Repl_Connection *conn)
{
- PRBool return_value;
- PR_Lock(conn->lock);
- return_value = STATE_CONNECTED == conn->state;
- PR_Unlock(conn->lock);
- return return_value;
+ return conn_connected_locked(conn, 1);
}
-
/*
* Destroy a connection object.
*/
@@ -247,7 +254,6 @@ conn_delete(Repl_Connection *conn)
if (slapi_eq_cancel(conn->linger_event) == 1)
{
/* Event was found and cancelled. Destroy the connection object. */
- PR_Unlock(conn->lock);
destroy_it = PR_TRUE;
}
else
@@ -258,16 +264,15 @@ conn_delete(Repl_Connection *conn)
* off, so arrange for the event to destroy the object .
*/
conn->delete_after_linger = PR_TRUE;
- PR_Unlock(conn->lock);
}
}
if (destroy_it)
{
conn_delete_internal(conn);
}
+ PR_Unlock(conn->lock);
}
-
/*
* Return the last operation type processed by the connection
* object, and the LDAP error encountered.
@@ -331,17 +336,18 @@ conn_read_result_ex(Repl_Connection *conn, char **retoidp, struct berval **retda
while (!slapi_is_shutting_down())
{
/* we have to make sure the update sending thread does not
- attempt to call conn_disconnect while we are reading
+ attempt to close connection while we are reading
results - so lock the conn while we get the results */
PR_Lock(conn->lock);
+
if ((STATE_CONNECTED != conn->state) || !conn->ld) {
rc = -1;
return_value = CONN_NOT_CONNECTED;
PR_Unlock(conn->lock);
break;
}
-
rc = ldap_result(conn->ld, send_msgid, 1, &local_timeout, &res);
+
PR_Unlock(conn->lock);
if (0 != rc)
@@ -665,8 +671,10 @@ perform_operation(Repl_Connection *conn, int optype, const char *dn,
server_controls[1] = update_control;
server_controls[2] = NULL;
- /* lock the conn to prevent the result reader thread
- from closing the connection out from under us */
+ /*
+ * Lock the conn to prevent the result reader thread
+ * from closing the connection out from under us.
+ */
PR_Lock(conn->lock);
if (STATE_CONNECTED == conn->state)
{
@@ -808,7 +816,6 @@ conn_send_rename(Repl_Connection *conn, const char *dn,
NULL /* extop OID */, NULL /* extop payload */, message_id);
}
-
/*
* Send an LDAP extended operation.
*/
@@ -822,7 +829,6 @@ conn_send_extended_operation(Repl_Connection *conn, const char *extop_oid,
update_control, extop_oid, payload, message_id);
}
-
/*
* Synchronously read an entry and return a specific attribute's values.
* Returns CONN_OPERATION_SUCCESS if successful. Returns
@@ -842,6 +848,8 @@ conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
LDAPMessage *res = NULL;
char *attrs[2];
+ PR_Lock(conn->lock);
+
PR_ASSERT(NULL != type);
if (conn_connected(conn))
{
@@ -864,7 +872,7 @@ conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
}
else if (IS_DISCONNECT_ERROR(ldap_rc))
{
- conn_disconnect(conn);
+ close_connection_internal(conn);
return_value = CONN_NOT_CONNECTED;
}
else
@@ -882,10 +890,11 @@ conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
{
return_value = CONN_NOT_CONNECTED;
}
+ PR_Unlock(conn->lock);
+
return return_value;
}
-
/*
* Return an pointer to a string describing the connection's status.
*/
@@ -896,8 +905,6 @@ conn_get_status(Repl_Connection *conn)
return conn->status;
}
-
-
/*
* Cancel any outstanding linger timer. Should be called when
* a replication session is beginning.
@@ -929,7 +936,6 @@ conn_cancel_linger(Repl_Connection *conn)
PR_Unlock(conn->lock);
}
-
/*
* Called when our linger timeout timer expires. This means
* we should check to see if perhaps the connection's become
@@ -961,7 +967,6 @@ linger_timeout(time_t event_time, void *arg)
}
}
-
/*
* Indicate that a session is ending. The linger timer starts when
* this function is called.
@@ -999,8 +1004,6 @@ conn_start_linger(Repl_Connection *conn)
PR_Unlock(conn->lock);
}
-
-
/*
* If no connection is currently active, opens a connection and binds to
* the remote server. If a connection is open (e.g. lingering) then
@@ -1019,10 +1022,14 @@ conn_connect(Repl_Connection *conn)
ConnResult return_value = CONN_OPERATION_SUCCESS;
int pw_ret = 1;
- /** Connection already open just return SUCCESS **/
- if(conn->state == STATE_CONNECTED) goto done;
-
PR_Lock(conn->lock);
+
+ /* Connection already open, just return SUCCESS */
+ if(conn->state == STATE_CONNECTED){
+ PR_Unlock(conn->lock);
+ return return_value;
+ }
+
if (conn->flag_agmt_changed) {
/* So far we cannot change Hostname and Port */
/* slapi_ch_free((void **)&conn->hostname); */
@@ -1037,7 +1044,6 @@ conn_connect(Repl_Connection *conn)
conn->port = agmt_get_port(conn->agmt); /* port could be updated */
slapi_ch_free((void **)&conn->plain);
}
- PR_Unlock(conn->lock);
creds = agmt_get_credentials(conn->agmt);
@@ -1178,6 +1184,7 @@ done:
{
close_connection_internal(conn);
}
+ PR_Unlock(conn->lock);
return return_value;
}
@@ -1213,7 +1220,6 @@ conn_disconnect(Repl_Connection *conn)
PR_Unlock(conn->lock);
}
-
/*
* Determine if the remote replica supports DS 5.0 replication.
* Return codes:
@@ -1230,6 +1236,7 @@ conn_replica_supports_ds5_repl(Repl_Connection *conn)
ConnResult return_value;
int ldap_rc;
+ PR_Lock(conn->lock);
if (conn_connected(conn))
{
if (conn->supports_ds50_repl == -1) {
@@ -1277,7 +1284,7 @@ conn_replica_supports_ds5_repl(Repl_Connection *conn)
if (IS_DISCONNECT_ERROR(ldap_rc))
{
conn->last_ldap_error = ldap_rc; /* specific reason */
- conn_disconnect(conn);
+ close_connection_internal(conn);
return_value = CONN_NOT_CONNECTED;
}
else
@@ -1297,10 +1304,11 @@ conn_replica_supports_ds5_repl(Repl_Connection *conn)
/* Not connected */
return_value = CONN_NOT_CONNECTED;
}
+ PR_Unlock(conn->lock);
+
return return_value;
}
-
/*
* Determine if the remote replica supports DS 7.1 replication.
* Return codes:
@@ -1317,6 +1325,7 @@ conn_replica_supports_ds71_repl(Repl_Connection *conn)
ConnResult return_value;
int ldap_rc;
+ PR_Lock(conn->lock);
if (conn_connected(conn))
{
if (conn->supports_ds71_repl == -1) {
@@ -1348,7 +1357,7 @@ conn_replica_supports_ds71_repl(Repl_Connection *conn)
if (IS_DISCONNECT_ERROR(ldap_rc))
{
conn->last_ldap_error = ldap_rc; /* specific reason */
- conn_disconnect(conn);
+ close_connection_internal(conn);
return_value = CONN_NOT_CONNECTED;
}
else
@@ -1368,6 +1377,8 @@ conn_replica_supports_ds71_repl(Repl_Connection *conn)
/* Not connected */
return_value = CONN_NOT_CONNECTED;
}
+ PR_Unlock(conn->lock);
+
return return_value;
}
@@ -1387,6 +1398,7 @@ conn_replica_supports_ds90_repl(Repl_Connection *conn)
ConnResult return_value;
int ldap_rc;
+ PR_Lock(conn->lock);
if (conn_connected(conn))
{
if (conn->supports_ds90_repl == -1) {
@@ -1418,7 +1430,7 @@ conn_replica_supports_ds90_repl(Repl_Connection *conn)
if (IS_DISCONNECT_ERROR(ldap_rc))
{
conn->last_ldap_error = ldap_rc; /* specific reason */
- conn_disconnect(conn);
+ close_connection_internal(conn);
return_value = CONN_NOT_CONNECTED;
}
else
@@ -1427,7 +1439,7 @@ conn_replica_supports_ds90_repl(Repl_Connection *conn)
}
}
if (NULL != res)
- ldap_msgfree(res);
+ ldap_msgfree(res);
}
else
{
@@ -1439,6 +1451,8 @@ conn_replica_supports_ds90_repl(Repl_Connection *conn)
/* Not connected */
return_value = CONN_NOT_CONNECTED;
}
+ PR_Unlock(conn->lock);
+
return return_value;
}
@@ -1456,7 +1470,6 @@ conn_replica_is_readonly(Repl_Connection *conn)
}
}
-
/*
* Return 1 if "value" is a value of attribute type "type" in entry "entry".
* Otherwise, return 0.
@@ -1505,9 +1518,6 @@ attribute_string_value_present(LDAP *ld, LDAPMessage *entry, const char *type,
return return_value;
}
-
-
-
/*
* Read the remote server's schema entry, then read the local schema entry,
* and compare the nsschemacsn attribute. If the local csn is newer, or
@@ -1537,7 +1547,7 @@ conn_push_schema(Repl_Connection *conn, CSN **remotecsn)
return_value = CONN_OPERATION_FAILED;
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "NULL remote CSN\n");
}
- else if (!conn_connected(conn))
+ else if (!conn_connected_locked(conn, 0 /* not locked */))
{
return_value = CONN_NOT_CONNECTED;
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
@@ -1754,6 +1764,7 @@ conn_push_schema(Repl_Connection *conn, CSN **remotecsn)
{
csn_free(&localcsn);
}
+
return return_value;
}
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 6e559ee2a..7daaaf3dc 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -1044,8 +1044,8 @@ slapi_ldap_bind(
than the currently unused clientctrls */
ldap_get_option(ld, LDAP_OPT_CLIENT_CONTROLS, &clientctrls);
if (clientctrls && clientctrls[0] &&
- slapi_control_present(clientctrls, START_TLS_OID, NULL, NULL)) {
- secure = 2;
+ slapi_control_present(clientctrls, START_TLS_OID, NULL, NULL)) {
+ secure = 2;
} else {
#if defined(USE_OPENLDAP)
/* openldap doesn't have a SSL/TLS yes/no flag - so grab the
@@ -1084,12 +1084,12 @@ slapi_ldap_bind(
slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_bind",
"Set up conn to use client auth\n");
}
- bvcreds.bv_val = NULL; /* ignore username and passed in creds */
- bvcreds.bv_len = 0; /* for external auth */
- bindid = NULL;
+ bvcreds.bv_val = NULL; /* ignore username and passed in creds */
+ bvcreds.bv_len = 0; /* for external auth */
+ bindid = NULL;
} else { /* other type of auth */
- bvcreds.bv_val = (char *)creds;
- bvcreds.bv_len = creds ? strlen(creds) : 0;
+ bvcreds.bv_val = (char *)creds;
+ bvcreds.bv_len = creds ? strlen(creds) : 0;
}
if (secure == 2) { /* send start tls */
@@ -1117,31 +1117,29 @@ slapi_ldap_bind(
bindid, creds);
if ((rc = ldap_sasl_bind(ld, bindid, mech, &bvcreds, serverctrls,
NULL /* clientctrls */, &mymsgid))) {
- char *myhostname = NULL;
- char *copy = NULL;
+ char *hostname = NULL;
+ char *host_port = NULL;
char *ptr = NULL;
int myerrno = errno;
int gaierr = 0;
- ldap_get_option(ld, LDAP_OPT_HOST_NAME, &myhostname);
- if (myhostname) {
- ptr = strchr(myhostname, ':');
+ ldap_get_option(ld, LDAP_OPT_HOST_NAME, &host_port);
+ if (host_port) {
+ ptr = strchr(host_port, ':');
if (ptr) {
- copy = slapi_ch_strdup(myhostname);
- *(copy + (ptr - myhostname)) = '\0';
- slapi_ch_free_string(&myhostname);
- myhostname = copy;
+ hostname = slapi_ch_strdup(host_port);
+ *(hostname + (ptr - host_port)) = '\0';
}
}
-
if (0 == myerrno) {
struct addrinfo *result = NULL;
- gaierr = getaddrinfo(myhostname, NULL, NULL, &result);
+ gaierr = getaddrinfo(hostname, NULL, NULL, &result);
myerrno = errno;
if (result) {
freeaddrinfo(result);
}
}
+
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
"Error: could not send bind request for id "
"[%s] authentication mechanism [%s]: error %d (%s), system error %d (%s), "
@@ -1152,8 +1150,9 @@ slapi_ldap_bind(
PR_GetError(), slapd_pr_strerror(PR_GetError()),
myerrno ? myerrno : gaierr,
myerrno ? slapd_system_strerror(myerrno) : gai_strerror(gaierr),
- myhostname ? myhostname : "unknown host");
- slapi_ch_free_string(&myhostname);
+ host_port ? host_port : "unknown host");
+ slapi_ch_free_string(&hostname);
+ slapi_ch_free_string(&host_port);
goto done;
}
| 0 |
f27d4bbac4c13e21dfa62d35edd5af17dcee8c57
|
389ds/389-ds-base
|
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 11991.
description: The acllas__client_match_URL() has been modified to set/allocate and release hostport only when it receives ldap(s)://host:port/ URL.
|
commit f27d4bbac4c13e21dfa62d35edd5af17dcee8c57
Author: Endi S. Dewata <[email protected]>
Date: Wed Jul 28 20:48:14 2010 -0500
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 11991.
description: The acllas__client_match_URL() has been modified to set/allocate and release hostport only when it receives ldap(s)://host:port/ URL.
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index 25f544dc8..8b4c5bfac 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -3483,7 +3483,7 @@ static int
acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url )
{
- LDAPURLDesc *ludp;
+ LDAPURLDesc *ludp = NULL;
int rc;
Slapi_Filter *f = NULL;
char *rawdn = NULL;
@@ -3537,7 +3537,8 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
if ( NULL == aclpb->aclpb_client_entry ) {
slapi_log_error (SLAPI_LOG_ACL, plugin_name,
"acllas__client_match_URL: Unable to get client's entry\n");
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
/* DN potion of URL must be normalized before calling ldap_url_parse.
@@ -3552,14 +3553,14 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
} else {
slapi_log_error (SLAPI_LOG_ACL, plugin_name,
"acllas__client_match_URL: url %s does not have a recognized ldap protocol prefix\n", url);
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
rawdn = url + prefix_len; /* ldap(s)://host:port/... or ldap(s):///... */
/* rawdn at ^ or ^ */
/* let rawdn point the suffix */
if ('/' == *(rawdn+1)) { /* ldap(s):/// */
rawdn += 2;
- hostport = "/";
} else {
char *tmpp = rawdn;
rawdn = strchr(tmpp, '/');
@@ -3567,7 +3568,8 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
if (NULL == rawdn) {
slapi_log_error (SLAPI_LOG_ACL, plugin_name,
"acllas__client_match_URL: url %s does not have a valid ldap protocol prefix\n", url);
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
hostport_len = ++rawdn - tmpp; /* ldap(s)://host:port/... */
/* <--------> */
@@ -3584,7 +3586,8 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
if (rc < 0) {
slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
"acllas__client_match_URL: Invalid syntax: %s\n", url);
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
} else if (rc == 0) { /* url is passed in and not terminated with NULL*/
*(dn + dnlen) = '\0';
}
@@ -3594,43 +3597,41 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
normed = slapi_ch_smprintf("%s%s%s%s",
(prefix_len==LDAP_URL_prefix_len)?
LDAP_URL_prefix_core:LDAPS_URL_prefix_core,
- hostport, dn, p?p:"");
+ hostport ? hostport : "/", dn, p?p:"");
if (rc > 0) {
/* dn was allocated in slapi_dn_normalize_ext */
slapi_ch_free_string(&dn);
}
- if ('/' != *hostport) {
- slapi_ch_free_string(&hostport);
- }
rc = ldap_url_parse(normed, &ludp);
slapi_ch_free_string(&normed);
if (rc) {
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
if ( ( NULL == ludp->lud_dn) || ( NULL == ludp->lud_filter) ) {
- ldap_free_urldesc( ludp );
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
/* Check the scope */
if ( ludp->lud_scope == LDAP_SCOPE_SUBTREE ) {
if (!slapi_dn_issuffix(n_clientdn, ludp->lud_dn)) {
- ldap_free_urldesc( ludp );
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
} else if ( ludp->lud_scope == LDAP_SCOPE_ONELEVEL ) {
char *parent = slapi_dn_parent (n_clientdn);
if (slapi_utf8casecmp ((ACLUCHP)parent, (ACLUCHP)ludp->lud_dn) != 0 ) {
slapi_ch_free ( (void **) &parent);
- ldap_free_urldesc( ludp );
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
slapi_ch_free ( (void **) &parent);
} else { /* default */
if (slapi_utf8casecmp ( (ACLUCHP)n_clientdn, (ACLUCHP)ludp->lud_dn) != 0 ) {
- ldap_free_urldesc( ludp );
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
}
@@ -3643,8 +3644,8 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
slapi_log_error(SLAPI_LOG_FATAL, plugin_name,
"DS_LASUserAttrEval: The member URL search filter in entry [%s] is not valid: [%s]\n",
n_clientdn, ludp->lud_filter);
- ldap_free_urldesc( ludp );
- return ACL_FALSE;
+ rc = ACL_FALSE;
+ goto done;
}
rc = ACL_TRUE;
@@ -3652,9 +3653,11 @@ acllas__client_match_URL (struct acl_pblock *aclpb, char *n_clientdn, char *url
aclpb->aclpb_client_entry, f, 0 /* no acces chk */ )))
rc = ACL_FALSE;
- ldap_free_urldesc( ludp );
slapi_filter_free ( f, 1 ) ;
+done:
+ slapi_ch_free_string(&hostport);
+ ldap_free_urldesc( ludp );
return rc;
}
static int
| 0 |
a6bf0a1943fee51d6bdeb060c1ccafe3fe237275
|
389ds/389-ds-base
|
Issue 5399 - UI - LDAP Editor is not updated when we switch instances (#5400)
Description: We don't refresh LDAP Editor when we switch instances.
It may lead to unpleasant errors.
Add componentDidUpdate function with the appropriate processing and
properties.
Fixes: https://github.com/389ds/389-ds-base/issues/5399
Reviewed by: @mreynolds389 (Thanks!)
|
commit a6bf0a1943fee51d6bdeb060c1ccafe3fe237275
Author: Simon Pichugin <[email protected]>
Date: Fri Aug 5 10:08:45 2022 -0700
Issue 5399 - UI - LDAP Editor is not updated when we switch instances (#5400)
Description: We don't refresh LDAP Editor when we switch instances.
It may lead to unpleasant errors.
Add componentDidUpdate function with the appropriate processing and
properties.
Fixes: https://github.com/389ds/389-ds-base/issues/5399
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/src/cockpit/389-console/src/LDAPEditor.jsx b/src/cockpit/389-console/src/LDAPEditor.jsx
index 4e2d62b13..a78423a82 100644
--- a/src/cockpit/389-console/src/LDAPEditor.jsx
+++ b/src/cockpit/389-console/src/LDAPEditor.jsx
@@ -60,6 +60,7 @@ export class LDAPEditor extends React.Component {
this.state = {
activeTabKey: 0,
+ firstLoad: true,
keyIndex: 0,
suffixList: [],
changeLayout: false,
@@ -250,6 +251,12 @@ export class LDAPEditor extends React.Component {
addNotification: this.props.addNotification,
};
+ if (this.state.firstLoad) {
+ this.setState({
+ firstLoad: false
+ });
+ }
+
this.setState({
searching: true,
loading: refresh
@@ -363,6 +370,18 @@ export class LDAPEditor extends React.Component {
});
}
+ componentDidUpdate(prevProps) {
+ if (this.props.wasActiveList.includes(7)) {
+ if (this.state.firstLoad) {
+ this.handleReload(true);
+ } else {
+ if (this.props.serverId !== prevProps.serverId) {
+ this.handleReload(true);
+ }
+ }
+ }
+ }
+
getPageData (page, perPage) {
if (page === 1) {
const pagedRows = this.state.rows.slice(0, 2 * perPage); // Each parent has a single child.
diff --git a/src/cockpit/389-console/src/ds.jsx b/src/cockpit/389-console/src/ds.jsx
index 87ff9ac46..1c2b14333 100644
--- a/src/cockpit/389-console/src/ds.jsx
+++ b/src/cockpit/389-console/src/ds.jsx
@@ -765,6 +765,7 @@ export class DSInstance extends React.Component {
key="ldap-editor"
addNotification={this.addNotification}
serverId={this.state.serverId}
+ wasActiveList={this.state.wasActiveList}
setPageSectionVariant={this.setPageSectionVariant}
/>
</Tab>
| 0 |
a0282b832d09951a893a4293707a2586020d09cf
|
389ds/389-ds-base
|
Bug 531642 - EntryUSN: RFE: a configuration option to make entryusn "global"
https://bugzilla.redhat.com/show_bug.cgi?id=531642
Resolves: 531642
Fix description:
1. Introduced a config parameter nsslapd-entryusn-global: on|off to
enable | disable the global mode. By default, off.
In the global mode, search on root dse returns "lastusn: <num>"
without the backend subtype (e.g., "lastusn;userroot: <num>")
2. Added slapi_get_next_suffix_ext to mapping_tree.c, which visits
children as well as siblings in the mapping tree.
(Note: slapi_get_next_suffix does just siblings.)
3. import (ldif2db) adds "entryusn: 0" to every entry unless the
entry already contains the entryusn attribute.
4. ldbm_back_delete, ldbm_back_modify, ldbm_back_modrdn: set
ldap_result_code to pblock so that bepost plugin could see if
the operation was successful or not.
See also http://directory.fedoraproject.org/wiki/Entry_USN#Global_mode
|
commit a0282b832d09951a893a4293707a2586020d09cf
Author: Noriko Hosoi <[email protected]>
Date: Thu Aug 26 17:30:29 2010 -0700
Bug 531642 - EntryUSN: RFE: a configuration option to make entryusn "global"
https://bugzilla.redhat.com/show_bug.cgi?id=531642
Resolves: 531642
Fix description:
1. Introduced a config parameter nsslapd-entryusn-global: on|off to
enable | disable the global mode. By default, off.
In the global mode, search on root dse returns "lastusn: <num>"
without the backend subtype (e.g., "lastusn;userroot: <num>")
2. Added slapi_get_next_suffix_ext to mapping_tree.c, which visits
children as well as siblings in the mapping tree.
(Note: slapi_get_next_suffix does just siblings.)
3. import (ldif2db) adds "entryusn: 0" to every entry unless the
entry already contains the entryusn attribute.
4. ldbm_back_delete, ldbm_back_modify, ldbm_back_modrdn: set
ldap_result_code to pblock so that bepost plugin could see if
the operation was successful or not.
See also http://directory.fedoraproject.org/wiki/Entry_USN#Global_mode
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
index fff9d8e8e..75c80ba23 100644
--- a/ldap/servers/plugins/usn/usn.c
+++ b/ldap/servers/plugins/usn/usn.c
@@ -565,31 +565,58 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
int attr_len = 64; /* length of lastusn;<backend_name> */
char *attr = (char *)slapi_ch_malloc(attr_len);
char *attr_subp = NULL;
+ int isglobal = config_get_entryusn_global();
slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM,
"--> usn_rootdse_search\n");
usn_berval.bv_val = counter_buf;
- PR_snprintf(attr, USN_LAST_USN_ATTR_CORE_LEN+1, "%s;", USN_LAST_USN);
- attr_subp = attr + USN_LAST_USN_ATTR_CORE_LEN;
- for (be = slapi_get_first_backend(&cookie); be;
- be = slapi_get_next_backend(cookie)) {
- if (NULL == be->be_usn_counter) { /* no counter == not a db backend */
- continue;
+ if (isglobal) {
+ /* nsslapd-entryusn-global: on*/
+ /* root dse shows ...
+ * lastusn: <num> */
+ PR_snprintf(attr, USN_LAST_USN_ATTR_CORE_LEN + 1, "%s", USN_LAST_USN);
+ for (be = slapi_get_first_backend(&cookie); be;
+ be = slapi_get_next_backend(cookie)) {
+ if (be->be_usn_counter) {
+ break;
+ }
+ }
+ if (be->be_usn_counter) {
+ /* get a next USN counter from be_usn_counter;
+ * then minus 1 from it */
+ PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRI64 "d",
+ slapi_counter_get_value(be->be_usn_counter)-1);
+ usn_berval.bv_len = strlen(usn_berval.bv_val);
+ slapi_entry_attr_replace(e, attr, vals);
}
- /* get a next USN counter from be_usn_counter; then minus 1 from it */
- PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRI64 "d",
- slapi_counter_get_value(be->be_usn_counter)-1);
- usn_berval.bv_len = strlen(usn_berval.bv_val);
-
- if (USN_LAST_USN_ATTR_CORE_LEN + strlen(be->be_name) + 1 > attr_len) {
- attr_len *= 2;
- attr = (char *)slapi_ch_realloc(attr, attr_len);
- attr_subp = attr + USN_LAST_USN_ATTR_CORE_LEN;
+ } else {
+ /* nsslapd-entryusn-global: off (default) */
+ /* root dse shows ...
+ * lastusn;<backend>: <num> */
+ PR_snprintf(attr, USN_LAST_USN_ATTR_CORE_LEN + 2, "%s;", USN_LAST_USN);
+ attr_subp = attr + USN_LAST_USN_ATTR_CORE_LEN + 1;
+ for (be = slapi_get_first_backend(&cookie); be;
+ be = slapi_get_next_backend(cookie)) {
+ if (NULL == be->be_usn_counter) {
+ /* no counter == not a db backend */
+ continue;
+ }
+ /* get a next USN counter from be_usn_counter;
+ * then minus 1 from it */
+ PR_snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRI64 "d",
+ slapi_counter_get_value(be->be_usn_counter)-1);
+ usn_berval.bv_len = strlen(usn_berval.bv_val);
+
+ if (USN_LAST_USN_ATTR_CORE_LEN+strlen(be->be_name)+2 > attr_len) {
+ attr_len *= 2;
+ attr = (char *)slapi_ch_realloc(attr, attr_len);
+ attr_subp = attr + USN_LAST_USN_ATTR_CORE_LEN;
+ }
+ PR_snprintf(attr_subp, attr_len - USN_LAST_USN_ATTR_CORE_LEN,
+ "%s", be->be_name);
+ slapi_entry_attr_replace(e, attr, vals);
}
- PR_snprintf(attr_subp, attr_len - USN_LAST_USN_ATTR_CORE_LEN,
- "%s", be->be_name);
- slapi_entry_attr_replace(e, attr, vals);
}
slapi_ch_free_string(&cookie);
diff --git a/ldap/servers/plugins/usn/usn.h b/ldap/servers/plugins/usn/usn.h
index ac9f86b10..8e6c5c8e0 100644
--- a/ldap/servers/plugins/usn/usn.h
+++ b/ldap/servers/plugins/usn/usn.h
@@ -44,7 +44,7 @@
#define USN_CSNGEN_ID 65535
#define USN_LAST_USN "lastusn"
-#define USN_LAST_USN_ATTR_CORE_LEN 8 /* lastusn; */
+#define USN_LAST_USN_ATTR_CORE_LEN 7 /* lastusn */
#define USN_COUNTER_BUF_LEN 64 /* enough size for 64 bit integers */
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index f0e290ebe..f4a6f434d 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -635,6 +635,7 @@ struct ldbminfo {
int li_flags;
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 */
};
/* li_flags could store these bits defined in ../slapi-plugin.h
@@ -840,4 +841,7 @@ typedef struct _back_search_result_set
*/
#define LDBM_ERROR_FOUND_DUPDN 9999
+/* Initial entryusn value */
+#define INITIALUSN (PRUint64)(-1)
+
#endif /* _back_ldbm_h_ */
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 3a65590b6..a17ba5ce2 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -657,6 +657,10 @@ int dblayer_terminate(struct ldbminfo *li)
slapi_ch_free((void**)&priv);
li->li_dblayer_private = NULL;
+ if (config_get_entryusn_global()) {
+ slapi_counter_destroy(&li->li_global_usn_counter);
+ }
+
return 0;
}
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 8ea647745..7107eb41a 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -666,11 +666,30 @@ import_producer(void *param)
pw_encodevals( (Slapi_Value **)va ); /* jcm - cast away const */
}
- if (job->flags & FLAG_ABORT) {
- backentry_free(&ep);
- goto error;
- }
+ if (job->flags & FLAG_ABORT) {
+ backentry_free(&ep);
+ goto error;
+ }
+ /*
+ * Check if entryusn plugin is enabled.
+ * If yes, add "entryusn: 0" to the entry
+ * if it does not have the attr type .
+ */
+ if (plugin_enabled("USN", (void *)plugin_get_default_component_id())) {
+ if (slapi_entry_attr_find(ep->ep_entry, SLAPI_ATTR_ENTRYUSN,
+ &attr)) { /* not found */
+ /* add entryusn: 0 to the entry */
+ Slapi_Value *usn_value = NULL;
+ struct berval usn_berval = {0};
+ usn_berval.bv_val = slapi_ch_smprintf("0");
+ usn_berval.bv_len = strlen(usn_berval.bv_val);
+ usn_value = slapi_value_new_berval(&usn_berval);
+ slapi_entry_add_value(ep->ep_entry,
+ SLAPI_ATTR_ENTRYUSN, usn_value);
+ slapi_value_free(&usn_value);
+ }
+ }
/* Now we have this new entry, all decoded
* Next thing we need to do is:
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 36ded0c9d..d2c0401cb 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -892,6 +892,8 @@ common_return:
backentry_free( &tombstone );
}
+ /* result code could be used in the bepost plugin functions. */
+ slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/*
* The bepostop is called even if the operation fails,
* but not if the operation is purging tombstones.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 462a501fe..882f10a21 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -855,9 +855,21 @@ static int ldbm_instance_generate(struct ldbminfo *li, char *instance_name,
rc = ldbm_instance_create_default_indexes(new_be);
/* if USN plugin is enabled, set slapi_counter */
- if (plugin_enabled("USN", li->li_identity)) {
- /* slapi_counter_new sets the initial value to 0 */
- new_be->be_usn_counter = slapi_counter_new();
+ if (plugin_enabled("USN", li->li_identity) && ldbm_back_isinitialized()) {
+ /*
+ * ldbm_back is already initialized.
+ * I.e., a new instance is being added.
+ * If not initialized, ldbm_usn_init is called later and
+ * be usn counter is initialized there.
+ */
+ if (config_get_entryusn_global()) {
+ /* global usn counter is already created.
+ * set it to be_usn_counter. */
+ new_be->be_usn_counter = li->li_global_usn_counter;
+ } else {
+ new_be->be_usn_counter = slapi_counter_new();
+ slapi_counter_set_value(new_be->be_usn_counter, INITIALUSN);
+ }
}
if (ret_be != NULL) {
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 30a99b18c..529f55e02 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -332,7 +332,6 @@ ldbm_back_modify( Slapi_PBlock *pb )
}
if ( !change_entry || ldap_result_code != 0 ) {
/* change_entry == 0 is not an error, but we need to free lock etc */
- slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
goto error_return;
}
}
@@ -550,7 +549,11 @@ common_return:
{
CACHE_RETURN( &inst->inst_cache, &ec );
}
- /* JCMREPL - The bepostop is called even if the operation fails. */
+
+ /* result code could be used in the bepost plugin functions. */
+ slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
+
+ /* The bepostop is called even if the operation fails. */
if (!disk_full)
plugin_call_plugins (pb, SLAPI_PLUGIN_BE_POST_MODIFY_FN);
@@ -560,10 +563,10 @@ common_return:
}
if(ldap_result_code!=-1)
{
- slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
+ slapi_send_ldap_result( pb, ldap_result_code, NULL, ldap_result_message, 0, NULL );
}
- slapi_ch_free( (void**)&errbuf);
+ slapi_ch_free_string(&errbuf);
return rc;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index dbe53e5be..4848c83e6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -995,6 +995,9 @@ common_return:
}
moddn_unlock_and_return_entries(be,&e,&existingentry);
+
+ /* result code could be used in the bepost plugin functions. */
+ slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/*
* The bepostop is called even if the operation fails.
*/
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_usn.c b/ldap/servers/slapd/back-ldbm/ldbm_usn.c
index 4bcd95ecf..2bb64bc24 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_usn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_usn.c
@@ -67,6 +67,9 @@ ldbm_usn_init(struct ldbminfo *li)
int rc = 0;
Slapi_Backend *be = NULL;
PRUint64 last_usn = 0;
+ PRUint64 global_last_usn = INITIALUSN;
+ int isglobal = config_get_entryusn_global();
+ int isfirst = 1;
/* if USN is not enabled, return immediately */
if (!plugin_enabled("USN", li->li_identity)) {
@@ -75,15 +78,34 @@ ldbm_usn_init(struct ldbminfo *li)
/* Search each namingContext in turn */
for ( sdn = slapi_get_first_suffix( &node, 0 ); sdn != NULL;
- sdn = slapi_get_next_suffix( &node, 0 )) {
+ sdn = slapi_get_next_suffix_ext( &node, 0 )) {
be = slapi_mapping_tree_find_backend_for_sdn(sdn);
- slapi_log_error(SLAPI_LOG_TRACE, "ldbm_usn_init",
- "backend: %s\n", be->be_name);
+ slapi_log_error(SLAPI_LOG_BACKLDBM, "ldbm_usn_init",
+ "backend: %s \n", be->be_name, isglobal?"(global mode)":"");
rc = usn_get_last_usn(be, &last_usn);
if (0 == rc) { /* only when the last usn is available */
- be->be_usn_counter = slapi_counter_new();
- slapi_counter_set_value(be->be_usn_counter, last_usn);
- slapi_counter_increment(be->be_usn_counter); /* stores next usn */
+ if (isglobal) {
+ if (isfirst) {
+ li->li_global_usn_counter = slapi_counter_new();
+ isfirst = 0;
+ }
+ /* share one counter */
+ be->be_usn_counter = li->li_global_usn_counter;
+ /* Initialize global_last_usn;
+ * Set the largest last_usn among backends */
+ if ((global_last_usn == INITIALUSN) ||
+ ((last_usn != INITIALUSN) && (global_last_usn < last_usn))) {
+ global_last_usn = last_usn;
+ }
+ slapi_counter_set_value(be->be_usn_counter, global_last_usn);
+ /* stores next usn */
+ slapi_counter_increment(be->be_usn_counter);
+ } else {
+ be->be_usn_counter = slapi_counter_new();
+ slapi_counter_set_value(be->be_usn_counter, last_usn);
+ /* stores next usn */
+ slapi_counter_increment(be->be_usn_counter);
+ }
}
}
bail:
@@ -110,7 +132,7 @@ usn_get_last_usn(Slapi_Backend *be, PRUint64 *last_usn)
memset(&key, 0, sizeof(key));
memset(&value, 0, sizeof(key));
- *last_usn = -1; /* to start from 0 */
+ *last_usn = INITIALUSN; /* to start from 0 */
/* Open the entryusn index */
ainfo_get(be, SLAPI_ATTR_ENTRYUSN, &ai);
@@ -179,14 +201,32 @@ int
ldbm_set_last_usn(Slapi_Backend *be)
{
PRUint64 last_usn = 0;
- int rc = usn_get_last_usn(be, &last_usn);
-
- if (0 == rc) { /* only when the last usn is available */
- /* destroy old counter, if any */
- slapi_counter_destroy(&(be->be_usn_counter));
- be->be_usn_counter = slapi_counter_new();
- slapi_counter_set_value(be->be_usn_counter, last_usn);
- slapi_counter_increment(be->be_usn_counter); /* stores next usn */
+ PRUint64 current_usn = 0;
+ int isglobal = config_get_entryusn_global();
+ int rc = -1;
+
+ if (NULL == be) {
+ slapi_log_error(SLAPI_LOG_FATAL, "ldbm_set_last_usn",
+ "Empty backend\n");
+ return rc;
+ }
+
+ if (isglobal) {
+ struct ldbminfo *li = (struct ldbminfo *)be->be_database->plg_private;
+ /* destroy old counter, if any */
+ slapi_counter_destroy(&(li->li_global_usn_counter));
+ ldbm_usn_init(li);
+ } else {
+ slapi_log_error(SLAPI_LOG_BACKLDBM, "ldbm_set_last_usn",
+ "backend: %s\n", be->be_name);
+ rc = usn_get_last_usn(be, &last_usn);
+ if (0 == rc) { /* only when the last usn is available */
+ /* destroy old counter, if any */
+ slapi_counter_destroy(&(be->be_usn_counter));
+ be->be_usn_counter = slapi_counter_new();
+ slapi_counter_set_value(be->be_usn_counter, last_usn);
+ slapi_counter_increment(be->be_usn_counter); /* stores next usn */
+ }
}
return rc;
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 90ac5700b..615d93737 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -479,6 +479,7 @@ int ldbm_back_entry_release( Slapi_PBlock *pb, void *backend_info_ptr );
void ldbm_back_search_results_release( void **search_results );
int ldbm_back_init( Slapi_PBlock *pb );
void ldbm_back_prev_search_results( Slapi_PBlock *pb );
+int ldbm_back_isinitialized();
/*
* monitor.c
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 8ea44aa16..6c19c7689 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -46,6 +46,14 @@
#include "back-ldbm.h"
+static int initialized = 0;
+
+int
+ldbm_back_isinitialized()
+{
+ return initialized;
+}
+
/*
* Start the LDBM plugin, and all its instances.
*/
@@ -53,7 +61,6 @@ int
ldbm_back_start( Slapi_PBlock *pb )
{
struct ldbminfo *li;
- static int initialized = 0;
char *home_dir;
int action;
int retval;
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
index 8784866b8..087f437ad 100644
--- a/ldap/servers/slapd/backend.c
+++ b/ldap/servers/slapd/backend.c
@@ -129,7 +129,9 @@ be_done(Slapi_Backend *be)
slapi_ch_free((void **)&be->be_backendconfig);
/* JCM char **be_include; ??? */
slapi_ch_free((void **)&be->be_name);
- slapi_counter_destroy(&be->be_usn_counter);
+ if (!config_get_entryusn_global()) {
+ slapi_counter_destroy(&be->be_usn_counter);
+ }
PR_DestroyLock(be->be_state_lock);
if (be->be_lock != NULL)
{
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index f1836567d..f36588cb3 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -624,7 +624,11 @@ static struct config_get_and_set {
{CONFIG_FORCE_SASL_EXTERNAL_ATTRIBUTE, config_set_force_sasl_external,
NULL, 0,
(void**)&global_slapdFrontendConfig.force_sasl_external, CONFIG_ON_OFF,
- (ConfigGetFunc)config_get_force_sasl_external}
+ (ConfigGetFunc)config_get_force_sasl_external},
+ {CONFIG_ENTRYUSN_GLOBAL, config_set_entryusn_global,
+ NULL, 0,
+ (void**)&global_slapdFrontendConfig.entryusn_global, CONFIG_ON_OFF,
+ (ConfigGetFunc)config_get_entryusn_global}
#ifdef MEMPOOL_EXPERIMENTAL
,{CONFIG_MEMPOOL_SWITCH_ATTRIBUTE, config_set_mempool_switch,
NULL, 0,
@@ -1002,6 +1006,8 @@ FrontendConfig_init () {
cfg->auditlog_exptime = 1;
cfg->auditlog_exptimeunit = slapi_ch_strdup("month");
+ cfg->entryusn_global = LDAP_OFF;
+
#ifdef MEMPOOL_EXPERIMENTAL
cfg->mempool_switch = LDAP_ON;
cfg->mempool_maxfreelist = 1024;
@@ -5526,6 +5532,30 @@ config_set_force_sasl_external( const char *attrname, char *value,
return retVal;
}
+int
+config_get_entryusn_global(void)
+{
+ int retVal;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ CFG_LOCK_READ(slapdFrontendConfig);
+ retVal = slapdFrontendConfig->entryusn_global;
+ CFG_UNLOCK_READ(slapdFrontendConfig);
+
+ return retVal;
+}
+
+int
+config_set_entryusn_global( const char *attrname, char *value,
+ char *errorbuf, int apply )
+{
+ int retVal = LDAP_SUCCESS;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+ retVal = config_set_onoff(attrname, value,
+ &(slapdFrontendConfig->entryusn_global),
+ errorbuf, apply);
+ return retVal;
+}
/*
* This function is intended to be used from the dse code modify callback. It
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index eccfe4ea5..f8bc64d6b 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -3005,6 +3005,9 @@ Slapi_DN *
slapi_get_first_suffix(void ** node, int show_private)
{
mapping_tree_node * first_node = mapping_tree_root->mtn_children;
+ if (NULL == node) {
+ return NULL;
+ }
*node = (void * ) first_node ;
while (first_node && (first_node->mtn_private && (show_private == 0)))
first_node = first_node->mtn_brother;
@@ -3014,11 +3017,15 @@ slapi_get_first_suffix(void ** node, int show_private)
Slapi_DN *
slapi_get_next_suffix(void ** node, int show_private)
{
- mapping_tree_node * next_node = *node;
+ mapping_tree_node * next_node = NULL;
- if (next_node == NULL)
+ if (NULL == node) {
return NULL;
-
+ }
+ next_node = *node;
+ if (next_node == NULL) {
+ return NULL;
+ }
next_node = next_node->mtn_brother;
while (next_node && (next_node->mtn_private && (show_private == 0)))
next_node = next_node->mtn_brother;
@@ -3026,6 +3033,38 @@ slapi_get_next_suffix(void ** node, int show_private)
return (next_node ? next_node->mtn_subtree : NULL);
}
+/* get mapping tree node recursively */
+Slapi_DN *
+slapi_get_next_suffix_ext(void ** node, int show_private)
+{
+ mapping_tree_node * next_node = NULL;
+
+ if (NULL == node) {
+ return NULL;
+ }
+ next_node = *node;
+ if (next_node == NULL) {
+ return NULL;
+ }
+ if (next_node->mtn_children) {
+ next_node = next_node->mtn_children;
+ } else if (next_node->mtn_brother) {
+ next_node = next_node->mtn_brother;
+ } else {
+ next_node = next_node->mtn_parent;
+ if (next_node) {
+ next_node = next_node->mtn_brother;
+ }
+ }
+ while (next_node && (next_node->mtn_private && (show_private == 0)))
+ next_node = next_node->mtn_brother;
+ if (next_node) {
+ *node = next_node;
+ return next_node->mtn_subtree;
+ }
+ return (next_node ? next_node->mtn_subtree : NULL);
+}
+
/* check if a suffix is a root of the DIT
* return 1 if yes, 0 if no
*/
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 1ca998716..ed146c445 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -371,6 +371,8 @@ int config_set_minssf(const char *attrname, char *value, char *errorbuf, int app
int config_set_accesslogbuffering(const char *attrname, char *value, char *errorbuf, int apply);
int config_set_csnlogging(const char *attrname, char *value, char *errorbuf, int apply);
int config_set_force_sasl_external(const char *attrname, char *value, char *errorbuf, int apply );
+int config_set_entryusn_global( const char *attrname, char *value, char *errorbuf, int apply );
+
#if !defined(_WIN32) && !defined(AIX)
int config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, int apply );
@@ -509,6 +511,7 @@ long config_get_system_page_size();
int config_get_system_page_bits();
#endif
int config_get_force_sasl_external();
+int config_get_entryusn_global(void);
int is_abspath(const char *);
char* rel2abspath( char * );
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index f5919c7a3..e63a0b62b 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1891,6 +1891,7 @@ typedef struct _slapdEntryPoints {
#define CONFIG_HASH_FILTERS_ATTRIBUTE "nsslapd-hash-filters"
#define CONFIG_OUTBOUND_LDAP_IO_TIMEOUT_ATTRIBUTE "nsslapd-outbound-ldap-io-timeout"
#define CONFIG_FORCE_SASL_EXTERNAL_ATTRIBUTE "nsslapd-force-sasl-external"
+#define CONFIG_ENTRYUSN_GLOBAL "nsslapd-entryusn-global"
#ifdef MEMPOOL_EXPERIMENTAL
#define CONFIG_MEMPOOL_SWITCH_ATTRIBUTE "nsslapd-mempool"
@@ -2107,6 +2108,7 @@ typedef struct _slapdFrontendConfig {
int system_page_bits; /* bit count to shift the system page size */
#endif /* MEMPOOL_EXPERIMENTAL */
int force_sasl_external; /* force SIMPLE bind to be SASL/EXTERNAL if client cert credentials were supplied */
+ int entryusn_global; /* Entry USN: Use global counter */
} slapdFrontendConfig_t;
/* possible values for slapdFrontendConfig_t.schemareplace */
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 92f8230e8..87125e258 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5104,6 +5104,7 @@ void * slapi_be_get_instance_info(Slapi_Backend * be);
void slapi_be_set_instance_info(Slapi_Backend * be, void * data);
Slapi_DN * slapi_get_first_suffix(void ** node, int show_private);
Slapi_DN * slapi_get_next_suffix(void ** node, int show_private);
+Slapi_DN * slapi_get_next_suffix_ext(void ** node, int show_private);
int slapi_is_root_suffix(Slapi_DN * dn);
const Slapi_DN *slapi_get_suffix_by_dn(const Slapi_DN *dn);
const char * slapi_be_gettype(Slapi_Backend *be);
| 0 |
53ca55df5db80f24975824589c55886d022ec3cf
|
389ds/389-ds-base
|
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 12005.
description: The dna_get_replica_bind_creds() has been modified to release transport before it returns.
|
commit 53ca55df5db80f24975824589c55886d022ec3cf
Author: Endi S. Dewata <[email protected]>
Date: Thu Jul 29 17:07:11 2010 -0500
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 12005.
description: The dna_get_replica_bind_creds() has been modified to release transport before it returns.
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 005954635..2261318e0 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -2506,6 +2506,7 @@ static int dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server,
}
bail:
+ slapi_ch_free_string(&transport);
slapi_ch_free_string(&filter);
slapi_sdn_free(&range_sdn);
slapi_ch_free_string(&replica_dn);
| 0 |
f88490faa19daaf0e43ed27a7f936ea5cca4cda0
|
389ds/389-ds-base
|
Bug 630092 - Coverity #15490: Resource leaks issues
https://bugzilla.redhat.com/show_bug.cgi?id=630092
Description:
The import_producer() has been modified to release ep when an error
occured.
|
commit f88490faa19daaf0e43ed27a7f936ea5cca4cda0
Author: Endi Sukma Dewata <[email protected]>
Date: Thu Sep 16 14:29:30 2010 -0400
Bug 630092 - Coverity #15490: Resource leaks issues
https://bugzilla.redhat.com/show_bug.cgi?id=630092
Description:
The import_producer() has been modified to release ep when an error
occured.
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index b18bbce55..c00e4b7ce 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -636,6 +636,7 @@ import_producer(void *param)
ep = import_make_backentry(e, id);
if ((ep == NULL) || (ep->ep_entry == NULL)) {
slapi_entry_free(e);
+ backentry_free(&ep);
goto error;
}
| 0 |
40865edea16c8eaa93ba391a71e20318e0a7d244
|
389ds/389-ds-base
|
Resolves: #316281
Summary: db2bak fails if the archive path exists and ends with '/'
Fix description:
1. Use path normalize API rel2abspath to remove the trailing '/'s.
2. db2bak renames the archive dir if the directory exists, checks the directory
is the db dir or not. If it is, the command line rename back the existing db
to the original and exits with the error: db2archive: Cannot archive to the db
directory. Then, the original dir is renamed back. If the db2bak runs as a
task (db2bak.pl or console), the server is up and running. Although the
backend is disabled, we don't want to rename the db path even for a short time.
That being said, changed the order to: check if the archive dir is the same as
db dir or not. It exits immediately.
|
commit 40865edea16c8eaa93ba391a71e20318e0a7d244
Author: Noriko Hosoi <[email protected]>
Date: Wed Oct 3 19:14:58 2007 +0000
Resolves: #316281
Summary: db2bak fails if the archive path exists and ends with '/'
Fix description:
1. Use path normalize API rel2abspath to remove the trailing '/'s.
2. db2bak renames the archive dir if the directory exists, checks the directory
is the db dir or not. If it is, the command line rename back the existing db
to the original and exits with the error: db2archive: Cannot archive to the db
directory. Then, the original dir is renamed back. If the db2bak runs as a
task (db2bak.pl or console), the server is up and running. Although the
backend is disabled, we don't want to rename the db path even for a short time.
That being said, changed the order to: check if the archive dir is the same as
db dir or not. It exits immediately.
diff --git a/ldap/servers/slapd/back-ldbm/archive.c b/ldap/servers/slapd/back-ldbm/archive.c
index 3d9ec999f..79520f6e4 100644
--- a/ldap/servers/slapd/back-ldbm/archive.c
+++ b/ldap/servers/slapd/back-ldbm/archive.c
@@ -110,7 +110,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
slapi_task_log_notice(task,
"backup has old idl format; "
"to restore old formated backup onto the new server, "
- "please use command line utility \"bak2db\" .\n");
+ "please use command line utility \"bak2db\" .");
}
goto out;
}
@@ -128,7 +128,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
if (task) {
slapi_task_log_notice(task,
"Backend '%s' is already in the middle of "
- "another task and cannot be disturbed.\n",
+ "another task and cannot be disturbed.",
inst->inst_name);
}
@@ -257,7 +257,8 @@ out:
int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
{
struct ldbminfo *li;
- char *directory = NULL; /* -a <directory> */
+ char *rawdirectory = NULL; /* -a <directory> */
+ char *directory = NULL; /* normalized */
char *dir_bak = NULL;
int return_value = -1;
int task_flags = 0;
@@ -266,25 +267,57 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
struct stat sbuf;
slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
- slapi_pblock_get( pb, SLAPI_SEQ_VAL, &directory );
+ slapi_pblock_get( pb, SLAPI_SEQ_VAL, &rawdirectory );
slapi_pblock_get( pb, SLAPI_TASK_FLAGS, &task_flags );
li->li_flags = run_from_cmdline = (task_flags & TASK_RUNNING_FROM_COMMANDLINE);
slapi_pblock_get( pb, SLAPI_BACKEND_TASK, &task );
- if ( !directory || !*directory ) {
+ if ( !rawdirectory || !*rawdirectory ) {
LDAPDebug( LDAP_DEBUG_ANY, "db2archive: no archive name\n",
0, 0, 0 );
- return( -1 );
+ return -1;
+ }
+
+ /* start the database code up, do not attempt to perform recovery */
+ if (run_from_cmdline) {
+ /* No ldbm be's exist until we process the config information. */
+ mapping_tree_init();
+ ldbm_config_load_dse_info(li);
+ if (0 != (return_value =
+ dblayer_start(li,
+ DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE))) {
+ LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to init database\n",
+ 0, 0, 0);
+ if (task) {
+ slapi_task_log_notice(task, "Failed to init database");
+ }
+ return -1;
+ }
}
- if (stat(directory, &sbuf) == 0) {
- int baklen = strlen(directory) + 5; /* ".bak\0" */
+
+ if (stat(rawdirectory, &sbuf) == 0) {
+ int baklen = 0;
+ directory = rel2abspath(rawdirectory);
+
+ if (slapd_comp_path(directory, li->li_directory) == 0) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "db2archive: Cannot archive to the db directory.\n", 0, 0, 0);
+ if (task) {
+ slapi_task_log_notice(task,
+ "Cannot archive to the db directory.");
+ }
+ return_value = -1;
+ goto out;
+ }
+
+ baklen = strlen(directory) + 5; /* ".bak\0" */
dir_bak = slapi_ch_malloc(baklen);
PR_snprintf(dir_bak, baklen, "%s.bak", directory);
LDAPDebug(LDAP_DEBUG_ANY, "db2archive: %s exists. Renaming to %s\n",
directory, dir_bak, 0);
if (task) {
- slapi_task_log_notice(task, "%s exists. Renaming to %s\n",
+ slapi_task_log_notice(task, "%s exists. Renaming to %s",
directory, dir_bak);
}
if (stat(dir_bak, &sbuf) == 0) {
@@ -295,7 +328,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
dir_bak, 0, 0);
if (task) {
slapi_task_log_notice(task,
- "%s exists and failed to delete it.\n", dir_bak);
+ "%s exists and failed to delete it.", dir_bak);
}
return_value = -1;
goto out;
@@ -305,10 +338,10 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
if (return_value != PR_SUCCESS) {
PRErrorCode prerr = PR_GetError();
LDAPDebug(LDAP_DEBUG_ANY,
- "db2archive: Failed to rename \"%s\" to \"%s\".",
+ "db2archive: Failed to rename \"%s\" to \"%s\".\n",
directory, dir_bak, 0);
LDAPDebug(LDAP_DEBUG_ANY,
- SLAPI_COMPONENT_NAME_NSPR " error %d (%s)",
+ SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
prerr, slapd_pr_strerror(prerr), 0);
if (task) {
slapi_task_log_notice(task,
@@ -336,11 +369,6 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
goto err;
}
- /* No ldbm be's exist until we process the config information. */
- if (run_from_cmdline) {
- mapping_tree_init();
- ldbm_config_load_dse_info(li);
- }
/* to avoid conflict w/ import, do this check for commandline, as well */
{
Object *inst_obj, *inst_obj2;
@@ -360,7 +388,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
if (task) {
slapi_task_log_notice(task,
"Backend '%s' is already in the middle of "
- "another task and cannot be disturbed.\n",
+ "another task and cannot be disturbed.",
inst->inst_name);
}
@@ -381,45 +409,9 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
}
}
- /* start the database code up, do not attempt to perform recovery */
- if (run_from_cmdline &&
- 0 != (return_value = dblayer_start(li,DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE))) {
- LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to init database\n",
- 0, 0, 0);
- if (task) {
- slapi_task_log_notice(task, "Failed to init database");
- }
- goto rel_err;
- }
-
- if (slapd_comp_path(directory, li->li_directory) == 0) {
- LDAPDebug(LDAP_DEBUG_ANY,
- "db2archive: Cannot archive to the db directory.\n", 0, 0, 0);
- if (task) {
- slapi_task_log_notice(task, "Cannot archive to the db directory.\n");
- }
- return_value = -1;
- goto rel_err;
- }
-
/* tell it to archive */
return_value = dblayer_backup(li, directory, task);
-rel_err:
- /* close the database down again */
- if (run_from_cmdline &&
- 0 != dblayer_close(li,DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE)) {
- LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to close database\n",
- 0, 0, 0);
- if (task) {
- slapi_task_log_notice(task, "Failed to close database");
- }
-
- /* The backup succeeded, so a failed close is not really a
- total error... */
- /*return( -1 );*/
- }
-
if (! run_from_cmdline) {
ldbm_instance *inst;
Object *inst_obj;
@@ -436,13 +428,24 @@ err:
LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Rename %s back to %s\n",
dir_bak, directory, 0);
if (task) {
- slapi_task_log_notice(task, "Rename %s back to %s\n",
+ slapi_task_log_notice(task, "Rename %s back to %s",
dir_bak, directory);
}
ldbm_delete_dirs(directory);
PR_Rename(dir_bak, directory);
}
out:
+ /* close the database down again */
+ if (run_from_cmdline &&
+ 0 != dblayer_close(li,DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE)) {
+ LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to close database\n",
+ 0, 0, 0);
+ if (task) {
+ slapi_task_log_notice(task, "Failed to close database");
+ }
+ }
+
slapi_ch_free_string(&dir_bak);
+ slapi_ch_free_string(&directory);
return return_value;
}
| 0 |
0263e0bffdfcb9cf59b7c6ba29f060987d06449a
|
389ds/389-ds-base
|
Bug 720059 - RDN with % can cause crashes or missing entries
https://bugzilla.redhat.com/show_bug.cgi?id=720059
Resolves: bug 720059
Bug Description: RDN with % can cause crashes or missing entries
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: The code was using PR_snprintf to copy the RDN to the
buffer used to store the value in the entryrdn index. If there was
a % in the value, the PR_snprintf was interpreting the next char as a
formatting directive. But since we don't pass any varargs arguments,
the formatting directive was using random garbage on the stack, which
can lead to crashes or missing entries or other undefined behavior.
The fix is to use PL_strncpyz which will just copy the string up to
the correct buffer size and will make sure the string is properly
null terminated.
You can use a simple C program to illustrate this problem:
int
main(int argc, char *argv[])
{
char buf[10];
argv++;
for (; *argv; ++argv) {
PR_snprintf(buf, sizeof(buf), *argv);
printf("buf is [%s]\n", buf);
}
return 0;
}
gcc -o testit testit.c -lnspr4
Then pass in values like %d %100s %100.100s and so on. You will either
get crashes or random output.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
|
commit 0263e0bffdfcb9cf59b7c6ba29f060987d06449a
Author: Rich Megginson <[email protected]>
Date: Mon Jul 11 10:08:56 2011 -0600
Bug 720059 - RDN with % can cause crashes or missing entries
https://bugzilla.redhat.com/show_bug.cgi?id=720059
Resolves: bug 720059
Bug Description: RDN with % can cause crashes or missing entries
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: The code was using PR_snprintf to copy the RDN to the
buffer used to store the value in the entryrdn index. If there was
a % in the value, the PR_snprintf was interpreting the next char as a
formatting directive. But since we don't pass any varargs arguments,
the formatting directive was using random garbage on the stack, which
can lead to crashes or missing entries or other undefined behavior.
The fix is to use PL_strncpyz which will just copy the string up to
the correct buffer size and will make sure the string is properly
null terminated.
You can use a simple C program to illustrate this problem:
int
main(int argc, char *argv[])
{
char buf[10];
argv++;
for (; *argv; ++argv) {
PR_snprintf(buf, sizeof(buf), *argv);
printf("buf is [%s]\n", buf);
}
return 0;
}
gcc -o testit testit.c -lnspr4
Then pass in values like %d %100s %100.100s and so on. You will either
get crashes or random output.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index a1b40621b..d8f60b273 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -95,7 +95,7 @@ int ldbm_config_add_dse_entries(struct ldbminfo *li, char **entries, char *strin
util_pb = slapi_pblock_new();
PR_snprintf(entry_string, 512, entries[x], string1, string2, string3);
e = slapi_str2entry(entry_string, 0);
- PR_snprintf(ebuf, sizeof(ebuf), slapi_entry_get_dn_const(e)); /* for logging */
+ PL_strncpyz(ebuf, slapi_entry_get_dn_const(e), sizeof(ebuf)); /* for logging */
slapi_add_entry_internal_set_pb(util_pb, e, NULL, li->li_identity, 0);
slapi_pblock_set(util_pb, SLAPI_DSE_DONT_WRITE_WHEN_ADDING,
&dont_write_file);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index 6698d8356..2f1e648cc 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -1354,8 +1354,8 @@ _entryrdn_new_rdn_elem(backend *be,
id_internal_to_stored(id, re->rdn_elem_id);
sizeushort_internal_to_stored(nrdn_len, re->rdn_elem_nrdn_len);
sizeushort_internal_to_stored(rdn_len, re->rdn_elem_rdn_len);
- PR_snprintf(re->rdn_elem_nrdn_rdn, nrdn_len, nrdn);
- PR_snprintf(RDN_ADDR(re), rdn_len, rdn);
+ PL_strncpyz(re->rdn_elem_nrdn_rdn, nrdn, nrdn_len);
+ PL_strncpyz(RDN_ADDR(re), rdn, rdn_len);
slapi_log_error(SLAPI_LOG_TRACE, ENTRYRDN_TAG,
"<-- _entryrdn_new_rdn_elem\n");
| 0 |
56ea32d66c602b1d160b240046ad801d2c1afcae
|
389ds/389-ds-base
|
Issue 50615 - Log current test name to journald
Bug Description:
Sometimes server crashes during test execution, events about crash are
logged to journald. But it's not easy to tell in which test the crash
happened, especially during the full test run.
Fix Description:
Add a fixture that is used automatically for all tests (if the server is
built with systemd) on setup and teardown, and logs a message to journald
Fixes: https://pagure.io/389-ds-base/issue/50615
Reviewed by: mreynolds (Thanks!)
|
commit 56ea32d66c602b1d160b240046ad801d2c1afcae
Author: Viktor Ashirov <[email protected]>
Date: Thu Sep 19 20:57:59 2019 +0200
Issue 50615 - Log current test name to journald
Bug Description:
Sometimes server crashes during test execution, events about crash are
logged to journald. But it's not easy to tell in which test the crash
happened, especially during the full test run.
Fix Description:
Add a fixture that is used automatically for all tests (if the server is
built with systemd) on setup and teardown, and logs a message to journald
Fixes: https://pagure.io/389-ds-base/issue/50615
Reviewed by: mreynolds (Thanks!)
diff --git a/dirsrvtests/conftest.py b/dirsrvtests/conftest.py
index cee9e8b7c..70a6d5ac8 100644
--- a/dirsrvtests/conftest.py
+++ b/dirsrvtests/conftest.py
@@ -3,6 +3,7 @@ import logging
import pytest
import os
+from lib389.paths import Paths
from enum import Enum
pkgs = ['389-ds-base', 'nss', 'nspr', 'openldap', 'cyrus-sasl']
@@ -69,3 +70,15 @@ def pytest_html_results_table_header(cells):
@pytest.mark.optionalhook
def pytest_html_results_table_row(report, cells):
cells.pop()
+
+
[email protected](scope="function", autouse=True)
+def log_test_name_to_journald(request):
+ p = Paths()
+ if p.with_systemd:
+ def log_current_test():
+ subprocess.Popen("echo $PYTEST_CURRENT_TEST | systemd-cat -t pytest", stdin=subprocess.PIPE, shell=True)
+
+ log_current_test()
+ request.addfinalizer(log_current_test)
+ return log_test_name_to_journald
| 0 |
27a8e752935491cb6c259f7bb15efb23d592ff8b
|
389ds/389-ds-base
|
Resolves: bug 227452
Bug Description: Solaris build: Need to add other libs for autotool build
Reviewed by: nhosoi (Thanks!)
Fix Description: The AC_CHECK_LIB test for db_create needs -lnsl because libdb links with it on Solaris. Other executables require -lnsl, -lsocket, and -ldl. The strategy is to put these in the platform specific section in configure.ac so they can be exported to the Makefile. Then we can just use the macros directly in Makefile. On platforms where these are not required, they will evaluate to empty.
There was a bug in the regexp that derived the libdir from pkg-config in several m4 files. We needed to use .* instead of just *. pkg-config --libs-only-L returns multiple paths on Solaris but not on linux.
Platforms tested: Solaris 9
Flag Day: no
Doc impact: no
|
commit 27a8e752935491cb6c259f7bb15efb23d592ff8b
Author: Rich Megginson <[email protected]>
Date: Tue Feb 6 15:51:22 2007 +0000
Resolves: bug 227452
Bug Description: Solaris build: Need to add other libs for autotool build
Reviewed by: nhosoi (Thanks!)
Fix Description: The AC_CHECK_LIB test for db_create needs -lnsl because libdb links with it on Solaris. Other executables require -lnsl, -lsocket, and -ldl. The strategy is to put these in the platform specific section in configure.ac so they can be exported to the Makefile. Then we can just use the macros directly in Makefile. On platforms where these are not required, they will evaluate to empty.
There was a bug in the regexp that derived the libdir from pkg-config in several m4 files. We needed to use .* instead of just *. pkg-config --libs-only-L returns multiple paths on Solaris but not on linux.
Platforms tested: Solaris 9
Flag Day: no
Doc impact: no
diff --git a/Makefile.am b/Makefile.am
index 9b25d020f..12bbe65cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,6 +37,10 @@ ICU_LINK = @icu_lib@ -licui18n -licuuc -licudata
NETSNMP_LINK = @netsnmp_lib@ @netsnmp_link@
PAM_LINK = -lpam
+LIBSOCKET=@LIBSOCKET@
+LIBNSL=@LIBNSL@
+LIBDL=@LIBDL@
+
#------------------------
# Generated Sources
#------------------------
@@ -680,7 +684,7 @@ libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.c \
ldap/servers/plugins/replication/windows_protocol_util.c \
ldap/servers/plugins/replication/windows_tot_protocol.c
-libreplication_plugin_la_CPPFLAGS = @icu_inc@ @db_inc@ $(PLUGIN_CPPFLAGS)
+libreplication_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @icu_inc@ @db_inc@
libreplication_plugin_la_LIBADD = $(ICU_LINK) $(DB_LINK)
#------------------------
@@ -764,7 +768,7 @@ ds_newinst_bin_SOURCES = ldap/admin/src/cfg_sspt.c \
ldap/admin/src/script-gen.c
ds_newinst_bin_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/ldap/admin/include @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-ds_newinst_bin_LDADD = libds_admin.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+ds_newinst_bin_LDADD = libds_admin.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET)
#------------------------
# dsktune
@@ -780,7 +784,7 @@ infadd_bin_SOURCES = ldap/servers/slapd/tools/rsearch/addthread.c \
ldap/servers/slapd/tools/rsearch/nametable.c
infadd_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-infadd_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+infadd_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKET)
#------------------------
# ldap-agent
@@ -812,7 +816,7 @@ ldclt_bin_SOURCES += ldap/servers/slapd/tools/ldclt/opCheck.c
endif
ldclt_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-ldclt_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+ldclt_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(LIBDL)
#------------------------
# ldif
@@ -878,7 +882,7 @@ ns_slapd_SOURCES = ldap/servers/slapd/abandon.c \
ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) @sasl_inc@ @ldapsdk_inc@ @nss_inc@ \
@nspr_inc@ @svrcore_inc@
ns_slapd_LDADD = libslapd.la libldaputil.a $(LDAPSDK_LINK) $(NSS_LINK) \
- $(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK)
+ $(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(LIBNSL) $(LIBSOCKET)
#------------------------
# pwdhash
@@ -897,7 +901,7 @@ rsearch_bin_SOURCES = ldap/servers/slapd/tools/rsearch/nametable.c \
ldap/servers/slapd/tools/rsearch/searchthread.c
rsearch_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKET)
# these are for the config files and scripts that we need to generate and replace
# the paths and other tokens with the real values set during configure/make
diff --git a/Makefile.in b/Makefile.in
index 87d4eb167..418756414 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -553,6 +553,7 @@ am_ds_newinst_bin_OBJECTS = \
ldap/admin/src/ds_newinst_bin-script-gen.$(OBJEXT)
ds_newinst_bin_OBJECTS = $(am_ds_newinst_bin_OBJECTS)
ds_newinst_bin_DEPENDENCIES = libds_admin.la $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_dsktune_bin_OBJECTS = ldap/systools/idsktune.$(OBJEXT) \
@@ -564,7 +565,8 @@ am_infadd_bin_OBJECTS = ldap/servers/slapd/tools/rsearch/infadd_bin-addthread.$(
ldap/servers/slapd/tools/rsearch/infadd_bin-nametable.$(OBJEXT)
infadd_bin_OBJECTS = $(am_infadd_bin_OBJECTS)
infadd_bin_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am_ldap_agent_bin_OBJECTS = \
ldap/servers/snmp/ldap_agent_bin-main.$(OBJEXT) \
ldap/servers/snmp/ldap_agent_bin-ldap-agent.$(OBJEXT) \
@@ -599,7 +601,9 @@ am_ldclt_bin_OBJECTS = \
$(am__objects_3)
ldclt_bin_OBJECTS = $(am_ldclt_bin_OBJECTS)
ldclt_bin_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
am_ldif_bin_OBJECTS = \
ldap/servers/slapd/tools/ldif_bin-ldif.$(OBJEXT)
ldif_bin_OBJECTS = $(am_ldif_bin_OBJECTS)
@@ -654,6 +658,7 @@ am_ns_slapd_OBJECTS = ldap/servers/slapd/ns_slapd-abandon.$(OBJEXT) \
ldap/servers/slapd/ns_slapd-unbind.$(OBJEXT)
ns_slapd_OBJECTS = $(am_ns_slapd_OBJECTS)
ns_slapd_DEPENDENCIES = libslapd.la libldaputil.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
@@ -669,7 +674,8 @@ am_rsearch_bin_OBJECTS = ldap/servers/slapd/tools/rsearch/rsearch_bin-nametable.
ldap/servers/slapd/tools/rsearch/rsearch_bin-searchthread.$(OBJEXT)
rsearch_bin_OBJECTS = $(am_rsearch_bin_OBJECTS)
rsearch_bin_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
serverSCRIPT_INSTALL = $(INSTALL_SCRIPT)
taskSCRIPT_INSTALL = $(INSTALL_SCRIPT)
@@ -797,8 +803,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
+LIBDL = @LIBDL@
+LIBNSL = @LIBNSL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
+LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
@@ -1550,7 +1559,7 @@ libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.c \
ldap/servers/plugins/replication/windows_protocol_util.c \
ldap/servers/plugins/replication/windows_tot_protocol.c
-libreplication_plugin_la_CPPFLAGS = @icu_inc@ @db_inc@ $(PLUGIN_CPPFLAGS)
+libreplication_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @icu_inc@ @db_inc@
libreplication_plugin_la_LIBADD = $(ICU_LINK) $(DB_LINK)
#------------------------
@@ -1629,7 +1638,7 @@ ds_newinst_bin_SOURCES = ldap/admin/src/cfg_sspt.c \
ldap/admin/src/script-gen.c
ds_newinst_bin_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/ldap/admin/include @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-ds_newinst_bin_LDADD = libds_admin.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+ds_newinst_bin_LDADD = libds_admin.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET)
#------------------------
# dsktune
@@ -1646,7 +1655,7 @@ infadd_bin_SOURCES = ldap/servers/slapd/tools/rsearch/addthread.c \
ldap/servers/slapd/tools/rsearch/nametable.c
infadd_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-infadd_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+infadd_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKET)
#------------------------
# ldap-agent
@@ -1673,7 +1682,7 @@ ldclt_bin_SOURCES = ldap/servers/slapd/tools/ldclt/data.c \
ldap/servers/slapd/tools/ldclt/version.c \
ldap/servers/slapd/tools/ldclt/workarounds.c $(am__append_1)
ldclt_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-ldclt_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+ldclt_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(LIBDL)
#------------------------
# ldif
@@ -1737,7 +1746,7 @@ ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) @sasl_inc@ @ldapsdk_inc@ @nss_inc@ \
@nspr_inc@ @svrcore_inc@
ns_slapd_LDADD = libslapd.la libldaputil.a $(LDAPSDK_LINK) $(NSS_LINK) \
- $(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK)
+ $(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(LIBNSL) $(LIBSOCKET)
#------------------------
@@ -1756,7 +1765,7 @@ rsearch_bin_SOURCES = ldap/servers/slapd/tools/rsearch/nametable.c \
ldap/servers/slapd/tools/rsearch/searchthread.c
rsearch_bin_CPPFLAGS = $(AM_CPPFLAGS) @ldapsdk_inc@ @nss_inc@ @nspr_inc@
-rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+rsearch_bin_LDADD = $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK) $(LIBSOCKET)
# these are for the config files and scripts that we need to generate and replace
# the paths and other tokens with the real values set during configure/make
diff --git a/config.guess b/config.guess
index 7d0185e01..917bbc50f 100755
--- a/config.guess
+++ b/config.guess
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2004-09-07'
+timestamp='2005-07-08'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,13 +17,15 @@ timestamp='2004-09-07'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Originally written by Per Bothner <[email protected]>.
# Please send patches to <[email protected]>. Submit a context
# diff and a properly formatted ChangeLog entry.
@@ -53,7 +55,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -66,11 +68,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# ([email protected] 1994-08-24)
@@ -196,55 +198,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
- exit 0 ;;
- amd64:OpenBSD:*:*)
- echo x86_64-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- cats:OpenBSD:*:*)
- echo arm-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- luna88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- macppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvmeppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips64-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@@ -297,37 +264,43 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
- exit 0 ;;
+ exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
- exit 0 ;;
+ exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
- exit 0;;
+ exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
+ exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
- exit 0 ;;
+ exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
- exit 0 ;;
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
- exit 0 ;;
+ exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
+ exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# [email protected] (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -335,32 +308,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
else
echo pyramid-pyramid-bsd
fi
- exit 0 ;;
+ exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
- exit 0 ;;
+ exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
- exit 0 ;;
- DRS?6000:UNIX_SV:4.2*:7*)
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7 && exit 0 ;;
+ sparc) echo sparc-icl-nx7; exit ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
@@ -369,10 +342,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
+ exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -384,10 +357,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
- exit 0 ;;
+ exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -398,40 +371,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
- exit 0 ;;
+ exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -455,32 +428,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c \
- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
- exit 0 ;;
+ exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
- exit 0 ;;
+ exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
- exit 0 ;;
+ exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
- exit 0 ;;
+ exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -496,29 +470,29 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
- exit 0 ;;
+ exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
- exit 0 ;;
+ exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
- exit 0 ;;
+ exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
+ exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
- exit 0 ;;
+ exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
@@ -526,7 +500,7 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
@@ -541,14 +515,18 @@ EOF
exit(0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
- echo rs6000-ibm-aix3.2.5
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
- exit 0 ;;
+ exit ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -562,28 +540,28 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
- exit 0 ;;
+ exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
- exit 0 ;;
+ exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
+ exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
- exit 0 ;;
+ exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
- exit 0 ;;
+ exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
- exit 0 ;;
+ exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
- exit 0 ;;
+ exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
@@ -645,9 +623,19 @@ EOF
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
- # avoid double evaluation of $set_cc_for_build
- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@@ -655,11 +643,11 @@ EOF
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -687,158 +675,166 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
- exit 0 ;;
+ exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
- exit 0 ;;
+ exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
- exit 0 ;;
+ exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
- exit 0 ;;
+ exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
- exit 0 ;;
+ exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
- exit 0 ;;
+ exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
- exit 0 ;;
+ exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
- exit 0 ;;
+ exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
+ exit ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
+ exit ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit 0 ;;
+ exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
- exit 0 ;;
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
- exit 0 ;;
+ exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
- exit 0 ;;
+ exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
+ exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit 0 ;;
+ exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
+ exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
- exit 0 ;;
+ exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
- exit 0 ;;
+ exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -856,7 +852,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
@@ -875,14 +871,14 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -896,7 +892,7 @@ EOF
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -904,25 +900,25 @@ EOF
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
- exit 0 ;;
+ exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
- exit 0 ;;
+ exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
@@ -940,15 +936,15 @@ EOF
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
+ exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0 ;;
+ exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit 0 ;;
+ exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
@@ -976,15 +972,18 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
- exit 0 ;;
+ exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
@@ -992,27 +991,27 @@ EOF
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
+ exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
+ exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
- i*86:syllable:*:*)
+ exit ;;
+ i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
- exit 0 ;;
+ exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -1020,15 +1019,16 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
- exit 0 ;;
- i*86:*:5:[78]*)
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1046,73 +1046,73 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
- exit 0 ;;
+ exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
- exit 0 ;;
+ exit ;;
paragon:*:*:*)
echo i860-intel-osf1
- exit 0 ;;
+ exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
- exit 0 ;;
+ exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
- exit 0 ;;
+ exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
- exit 0 ;;
+ exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
- exit 0 ;;
+ exit ;;
M68*:*:R3V[5678]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
- exit 0 ;;
+ exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1120,61 +1120,65 @@ EOF
else
echo ns32k-sni-sysv
fi
- exit 0 ;;
+ exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <[email protected]>
echo i586-unisys-sysv4
- exit 0 ;;
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <[email protected]>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
- exit 0 ;;
+ exit ;;
*:*:*:FTX*)
# From [email protected].
echo i860-stratus-sysv4
- exit 0 ;;
+ exit ;;
+ i*86:VOS:*:*)
+ # From [email protected].
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
*:VOS:*:*)
# From [email protected].
echo hppa1.1-stratus-vos
- exit 0 ;;
+ exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
- exit 0 ;;
+ exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
- exit 0 ;;
+ exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
- exit 0 ;;
+ exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
- exit 0 ;;
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
@@ -1182,7 +1186,7 @@ EOF
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1190,22 +1194,25 @@ EOF
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
- exit 0 ;;
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
- exit 0 ;;
+ exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
- exit 0 ;;
+ exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
@@ -1216,38 +1223,44 @@ EOF
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
+ exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
- exit 0 ;;
+ exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
- exit 0 ;;
+ exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
- exit 0 ;;
+ exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
- exit 0 ;;
+ exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
- exit 0 ;;
+ exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
- exit 0 ;;
+ exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
+ exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms && exit 0 ;;
- I*) echo ia64-dec-vms && exit 0 ;;
- V*) echo vax-dec-vms && exit 0 ;;
- esac
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1279,7 +1292,7 @@ main ()
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
+ printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
@@ -1368,11 +1381,12 @@ main ()
}
EOF
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
@@ -1381,22 +1395,22 @@ then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
c34*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
c38*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
c4*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
esac
fi
@@ -1407,7 +1421,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- ftp://ftp.gnu.org/pub/gnu/config/
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
diff --git a/config.sub b/config.sub
index edb6b663c..1c366dfde 100755
--- a/config.sub
+++ b/config.sub
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2004-08-29'
+timestamp='2005-07-08'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,14 +21,15 @@ timestamp='2004-08-29'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Please send patches to <[email protected]>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@@ -70,7 +71,7 @@ Report bugs and patches to <[email protected]>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
- exit 0;;
+ exit ;;
* )
break ;;
@@ -231,13 +232,14 @@ case $basic_machine in
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | mcore \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -246,6 +248,7 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
@@ -254,23 +257,28 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | ms1 \
| msp430 \
| ns16k | ns32k \
- | openrisc | or32 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xstormy16 | xtensa \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@@ -298,7 +306,7 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
- | bs2000-* \
+ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
@@ -310,7 +318,7 @@ case $basic_machine in
| ip2k-* | iq2000-* \
| m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -319,6 +327,7 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
@@ -327,6 +336,7 @@ case $basic_machine in
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
+ | ms1-* \
| msp430-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
@@ -334,20 +344,23 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- | xtensa-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
+ m32c-*)
+ ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -489,6 +502,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@@ -754,9 +771,8 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
- or32 | or32-*)
+ openrisc | openrisc-*)
basic_machine=or32-unknown
- os=-coff
;;
os400)
basic_machine=powerpc-ibm
@@ -1029,6 +1045,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@@ -1078,12 +1098,9 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sh64)
- basic_machine=sh64-unknown
- ;;
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
@@ -1170,7 +1187,8 @@ case $os in
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1188,7 +1206,7 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
@@ -1297,6 +1315,9 @@ case $os in
-kaos*)
os=-kaos
;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
-none)
;;
*)
@@ -1374,6 +1395,9 @@ case $basic_machine in
*-be)
os=-beos
;;
+ *-haiku)
+ os=-haiku
+ ;;
*-ibm)
os=-aix
;;
@@ -1545,7 +1569,7 @@ case $basic_machine in
esac
echo $basic_machine$os
-exit 0
+exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/configure b/configure
index 27c68e503..9e193da30 100755
--- a/configure
+++ b/configure
@@ -465,7 +465,7 @@ ac_includes_default="\
#endif"
ac_default_prefix=/opt/fedora-ds
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE SOLARIS_TRUE SOLARIS_FALSE LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS debug_defs configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL SOLARIS_TRUE SOLARIS_FALSE PKG_CONFIG ICU_CONFIG NETSNMP_CONFIG nspr_inc nspr_lib nspr_libdir nss_inc nss_lib nss_libdir ldapsdk_inc ldapsdk_lib ldapsdk_libdir ldapsdk_bindir db_inc db_incdir db_lib db_libdir db_bindir db_libver sasl_inc sasl_lib sasl_libdir svrcore_inc svrcore_lib icu_lib icu_inc icu_bin netsnmp_inc netsnmp_lib netsnmp_libdir netsnmp_link LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -22875,6 +22875,246 @@ fi;
+# installation paths - by default, configure will just
+# use /usr as the prefix for everything, which means
+# /usr/etc and /usr/var. FHS sez to use /etc and /var.
+if test "$with_fhs" = "yes"; then
+ ac_default_prefix=/usr
+ prefix=$ac_default_prefix
+ exec_prefix=$prefix
+ sysconfdir='/etc'
+ localstatedir='/var'
+fi
+
+# relative to sysconfdir
+configdir=/fedora-ds/config
+# relative to datadir
+sampledatadir=/fedora-ds/data
+# relative to sysconfdir
+propertydir=/fedora-ds/property
+# relative to sysconfdir
+schemadir=/fedora-ds/schema
+# relative to libdir
+serverdir=/fedora-ds
+# relative to libdir
+serverplugindir=/fedora-ds/plugins
+# relative to datadir
+scripttemplatedir=/fedora-ds/script-templates
+
+
+
+
+
+
+
+
+# WINNT should be true if building on Windows system not using
+# cygnus, mingw, or the like and using cmd.exe as the shell
+
+
+if false; then
+ WINNT_TRUE=
+ WINNT_FALSE='#'
+else
+ WINNT_TRUE='#'
+ WINNT_FALSE=
+fi
+
+
+# Deal with platform dependent defines
+case $host in
+ *-*-linux*)
+
+cat >>confdefs.h <<\_ACEOF
+#define XP_UNIX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define Linux 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_0 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_2 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define LINUX2_4 1
+_ACEOF
+
+ platform="linux"
+ ;;
+ ia64-hp-hpux*)
+
+cat >>confdefs.h <<\_ACEOF
+#define XP_UNIX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define hpux 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX11 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX11_23 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CPU_ia64
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define OS_hpux 1
+_ACEOF
+
+ platform="hpux"
+ ;;
+ hppa*-hp-hpux*)
+
+cat >>confdefs.h <<\_ACEOF
+#define XP_UNIX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define hpux 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX11 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HPUX11_11 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CPU_hppa
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define OS_hpux 1
+_ACEOF
+
+ platform="hpux"
+ ;;
+ sparc-sun-solaris*)
+
+cat >>confdefs.h <<\_ACEOF
+#define XP_UNIX 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SVR4 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __svr4 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __svr4__ 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _SVID_GETTOD 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define SOLARIS 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define CPU_sparc
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define OS_solaris 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define sunos5 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define OSVERSION 509
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+ LIBSOCKET=-lsocket
+ LIBSOCKET=$LIBSOCKET
+
+ LIBNSL=-lnsl
+ LIBNSL=$LIBNSL
+
+ LIBDL=-ldl
+ LIBDL=$LIBDL
+
+ platform="solaris"
+ ;;
+ *)
+ platform=""
+ ;;
+esac
+
+
+
+if test "$platform" = "solaris"; then
+ SOLARIS_TRUE=
+ SOLARIS_FALSE='#'
+else
+ SOLARIS_TRUE='#'
+ SOLARIS_FALSE=
+fi
+
+
# Check for library dependencies
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2007 Red Hat, Inc.
@@ -23027,13 +23267,13 @@ echo $ECHO_N "checking for nspr with pkg-config... $ECHO_C" >&6
if $PKG_CONFIG --exists nspr; then
nspr_inc=`$PKG_CONFIG --cflags-only-I nspr`
nspr_lib=`$PKG_CONFIG --libs-only-L nspr`
- nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ *$//`
+ nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ .*$//`
echo "$as_me:$LINENO: result: using system NSPR" >&5
echo "${ECHO_T}using system NSPR" >&6
elif $PKG_CONFIG --exists dirsec-nspr; then
nspr_inc=`$PKG_CONFIG --cflags-only-I dirsec-nspr`
nspr_lib=`$PKG_CONFIG --libs-only-L dirsec-nspr`
- nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ *$//`
+ nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ .*$//`
echo "$as_me:$LINENO: result: using system dirsec NSPR" >&5
echo "${ECHO_T}using system dirsec NSPR" >&6
else
@@ -23195,13 +23435,13 @@ echo $ECHO_N "checking for nss with pkg-config... $ECHO_C" >&6
if $PKG_CONFIG --exists nss; then
nss_inc=`$PKG_CONFIG --cflags-only-I nss`
nss_lib=`$PKG_CONFIG --libs-only-L nss`
- nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ *$//`
+ nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
echo "$as_me:$LINENO: result: using system NSS" >&5
echo "${ECHO_T}using system NSS" >&6
elif $PKG_CONFIG --exists dirsec-nss; then
nss_inc=`$PKG_CONFIG --cflags-only-I dirsec-nss`
nss_lib=`$PKG_CONFIG --libs-only-L dirsec-nss`
- nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ *$//`
+ nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
echo "$as_me:$LINENO: result: using system dirsec NSS" >&5
echo "${ECHO_T}using system dirsec NSS" >&6
else
@@ -23372,7 +23612,7 @@ echo "$as_me: error: LDAPSDK not found, specify with --with-ldapsdk-inc|-lib." >
fi
ldapsdk_inc=`$PKG_CONFIG --cflags-only-I $mozldappkg`
ldapsdk_lib=`$PKG_CONFIG --libs-only-L $mozldappkg`
- ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ *$//`
+ ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ .*$//`
ldapsdk_bindir=`$PKG_CONFIG --variable=bindir $mozldappkg`
echo "$as_me:$LINENO: result: using system $mozldappkg" >&5
echo "${ECHO_T}using system $mozldappkg" >&6
@@ -23547,7 +23787,6 @@ db_ver_maj=`grep DB_VERSION_MAJOR $db_incdir/db.h | awk '{print $3}'`
db_ver_min=`grep DB_VERSION_MINOR $db_incdir/db.h | awk '{print $3}'`
db_ver_pat=`grep DB_VERSION_PATCH $db_incdir/db.h | awk '{print $3}'`
db_libver=${db_ver_maj}.${db_ver_min}
-
as_ac_Lib=`echo "ac_cv_lib_db-$db_libver''_db_create" | $as_tr_sh`
echo "$as_me:$LINENO: checking for db_create in -ldb-$db_libver" >&5
echo $ECHO_N "checking for db_create in -ldb-$db_libver... $ECHO_C" >&6
@@ -23555,7 +23794,7 @@ if eval "test \"\${$as_ac_Lib+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldb-$db_libver $LIBS"
+LIBS="-ldb-$db_libver $LIBNSL $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -23614,12 +23853,7 @@ fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6
if test `eval echo '${'$as_ac_Lib'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_LIBdb-$db_libver" | $as_tr_cpp` 1
-_ACEOF
-
- LIBS="-ldb-$db_libver $LIBS"
-
+ true
else
{ { echo "$as_me:$LINENO: error: $db_incdir/db.h is version $db_libver but libdb-$db_libver not found" >&5
echo "$as_me: error: $db_incdir/db.h is version $db_libver but libdb-$db_libver not found" >&2;}
@@ -24583,237 +24817,6 @@ fi
-
-
-# installation paths - by default, configure will just
-# use /usr as the prefix for everything, which means
-# /usr/etc and /usr/var. FHS sez to use /etc and /var.
-if test "$with_fhs" = "yes"; then
- ac_default_prefix=/usr
- prefix=$ac_default_prefix
- exec_prefix=$prefix
- sysconfdir='/etc'
- localstatedir='/var'
-fi
-
-# relative to sysconfdir
-configdir=/fedora-ds/config
-# relative to datadir
-sampledatadir=/fedora-ds/data
-# relative to sysconfdir
-propertydir=/fedora-ds/property
-# relative to sysconfdir
-schemadir=/fedora-ds/schema
-# relative to libdir
-serverdir=/fedora-ds
-# relative to libdir
-serverplugindir=/fedora-ds/plugins
-# relative to datadir
-scripttemplatedir=/fedora-ds/script-templates
-
-
-
-
-
-
-
-
-# WINNT should be true if building on Windows system not using
-# cygnus, mingw, or the like and using cmd.exe as the shell
-
-
-if false; then
- WINNT_TRUE=
- WINNT_FALSE='#'
-else
- WINNT_TRUE='#'
- WINNT_FALSE=
-fi
-
-
-# Deal with platform dependent defines
-case $host in
- *-*-linux*)
-
-cat >>confdefs.h <<\_ACEOF
-#define XP_UNIX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define Linux 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define LINUX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define LINUX2_0 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define LINUX2_2 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define LINUX2_4 1
-_ACEOF
-
- platform="linux"
- ;;
- ia64-hp-hpux*)
-
-cat >>confdefs.h <<\_ACEOF
-#define XP_UNIX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define hpux 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX11 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX11_23 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define CPU_ia64
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define OS_hpux 1
-_ACEOF
-
- platform="hpux"
- ;;
- hppa*-hp-hpux*)
-
-cat >>confdefs.h <<\_ACEOF
-#define XP_UNIX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define hpux 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX11 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HPUX11_11 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define CPU_hppa
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define OS_hpux 1
-_ACEOF
-
- platform="hpux"
- ;;
- sparc-sun-solaris*)
-
-cat >>confdefs.h <<\_ACEOF
-#define XP_UNIX 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SVR4 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define __svr4 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define __svr4__ 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _SVID_GETTOD 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define SOLARIS 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define CPU_sparc
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define OS_solaris 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define sunos5 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define OSVERSION 509
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
-
- platform="solaris"
- ;;
- *)
- platform=""
- ;;
-esac
-
-
-
-if test "$platform" = "solaris"; then
- SOLARIS_TRUE=
- SOLARIS_FALSE='#'
-else
- SOLARIS_TRUE='#'
- SOLARIS_FALSE=
-fi
@@ -25566,6 +25569,20 @@ s,@ac_ct_F77@,$ac_ct_F77,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@debug_defs@,$debug_defs,;t t
+s,@configdir@,$configdir,;t t
+s,@sampledatadir@,$sampledatadir,;t t
+s,@propertydir@,$propertydir,;t t
+s,@schemadir@,$schemadir,;t t
+s,@serverdir@,$serverdir,;t t
+s,@serverplugindir@,$serverplugindir,;t t
+s,@scripttemplatedir@,$scripttemplatedir,;t t
+s,@WINNT_TRUE@,$WINNT_TRUE,;t t
+s,@WINNT_FALSE@,$WINNT_FALSE,;t t
+s,@LIBSOCKET@,$LIBSOCKET,;t t
+s,@LIBNSL@,$LIBNSL,;t t
+s,@LIBDL@,$LIBDL,;t t
+s,@SOLARIS_TRUE@,$SOLARIS_TRUE,;t t
+s,@SOLARIS_FALSE@,$SOLARIS_FALSE,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
s,@ICU_CONFIG@,$ICU_CONFIG,;t t
s,@NETSNMP_CONFIG@,$NETSNMP_CONFIG,;t t
@@ -25597,17 +25614,6 @@ s,@netsnmp_inc@,$netsnmp_inc,;t t
s,@netsnmp_lib@,$netsnmp_lib,;t t
s,@netsnmp_libdir@,$netsnmp_libdir,;t t
s,@netsnmp_link@,$netsnmp_link,;t t
-s,@configdir@,$configdir,;t t
-s,@sampledatadir@,$sampledatadir,;t t
-s,@propertydir@,$propertydir,;t t
-s,@schemadir@,$schemadir,;t t
-s,@serverdir@,$serverdir,;t t
-s,@serverplugindir@,$serverplugindir,;t t
-s,@scripttemplatedir@,$scripttemplatedir,;t t
-s,@WINNT_TRUE@,$WINNT_TRUE,;t t
-s,@WINNT_FALSE@,$WINNT_FALSE,;t t
-s,@SOLARIS_TRUE@,$SOLARIS_TRUE,;t t
-s,@SOLARIS_FALSE@,$SOLARIS_FALSE,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/configure.ac b/configure.ac
index 6922f5a71..729620d46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,47 +61,6 @@ AC_SUBST([debug_defs])
AC_PREFIX_DEFAULT([/opt/fedora-ds])
-# Check for library dependencies
-m4_include(m4/nspr.m4)
-m4_include(m4/nss.m4)
-m4_include(m4/mozldap.m4)
-m4_include(m4/db.m4)
-m4_include(m4/sasl.m4)
-m4_include(m4/svrcore.m4)
-m4_include(m4/icu.m4)
-m4_include(m4/netsnmp.m4)
-m4_include(m4/fhs.m4)
-
-# write out paths for binary components
-AC_SUBST(nspr_inc)
-AC_SUBST(nspr_lib)
-AC_SUBST(nspr_libdir)
-AC_SUBST(nss_inc)
-AC_SUBST(nss_lib)
-AC_SUBST(nss_libdir)
-AC_SUBST(ldapsdk_inc)
-AC_SUBST(ldapsdk_lib)
-AC_SUBST(ldapsdk_libdir)
-AC_SUBST(ldapsdk_bindir)
-AC_SUBST(db_inc)
-AC_SUBST(db_incdir)
-AC_SUBST(db_lib)
-AC_SUBST(db_libdir)
-AC_SUBST(db_bindir)
-AC_SUBST(db_libver)
-AC_SUBST(sasl_inc)
-AC_SUBST(sasl_lib)
-AC_SUBST(sasl_libdir)
-AC_SUBST(svrcore_inc)
-AC_SUBST(svrcore_lib)
-AC_SUBST(icu_lib)
-AC_SUBST(icu_inc)
-AC_SUBST(icu_bin)
-AC_SUBST(netsnmp_inc)
-AC_SUBST(netsnmp_lib)
-AC_SUBST(netsnmp_libdir)
-AC_SUBST(netsnmp_link)
-
# installation paths - by default, configure will just
# use /usr as the prefix for everything, which means
# /usr/etc and /usr/var. FHS sez to use /etc and /var.
@@ -184,6 +143,12 @@ case $host in
AC_DEFINE([sunos5], [1], [SunOS5])
AC_DEFINE([OSVERSION], [509], [OS version])
AC_DEFINE([_REENTRANT], [1], [_REENTRANT])
+ LIBSOCKET=-lsocket
+ AC_SUBST([LIBSOCKET], [$LIBSOCKET])
+ LIBNSL=-lnsl
+ AC_SUBST([LIBNSL], [$LIBNSL])
+ LIBDL=-ldl
+ AC_SUBST([LIBDL], [$LIBDL])
platform="solaris"
;;
*)
@@ -193,6 +158,47 @@ esac
AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
+# Check for library dependencies
+m4_include(m4/nspr.m4)
+m4_include(m4/nss.m4)
+m4_include(m4/mozldap.m4)
+m4_include(m4/db.m4)
+m4_include(m4/sasl.m4)
+m4_include(m4/svrcore.m4)
+m4_include(m4/icu.m4)
+m4_include(m4/netsnmp.m4)
+m4_include(m4/fhs.m4)
+
+# write out paths for binary components
+AC_SUBST(nspr_inc)
+AC_SUBST(nspr_lib)
+AC_SUBST(nspr_libdir)
+AC_SUBST(nss_inc)
+AC_SUBST(nss_lib)
+AC_SUBST(nss_libdir)
+AC_SUBST(ldapsdk_inc)
+AC_SUBST(ldapsdk_lib)
+AC_SUBST(ldapsdk_libdir)
+AC_SUBST(ldapsdk_bindir)
+AC_SUBST(db_inc)
+AC_SUBST(db_incdir)
+AC_SUBST(db_lib)
+AC_SUBST(db_libdir)
+AC_SUBST(db_bindir)
+AC_SUBST(db_libver)
+AC_SUBST(sasl_inc)
+AC_SUBST(sasl_lib)
+AC_SUBST(sasl_libdir)
+AC_SUBST(svrcore_inc)
+AC_SUBST(svrcore_lib)
+AC_SUBST(icu_lib)
+AC_SUBST(icu_inc)
+AC_SUBST(icu_bin)
+AC_SUBST(netsnmp_inc)
+AC_SUBST(netsnmp_lib)
+AC_SUBST(netsnmp_libdir)
+AC_SUBST(netsnmp_link)
+
AC_DEFINE([LDAP_DEBUG], [1], [LDAP debug flag])
AC_DEFINE([LDAP_DONT_USE_SMARTHEAP], [1], [Don't use smartheap])
diff --git a/ltmain.sh b/ltmain.sh
index 06823e057..0223495a0 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -46,10 +46,16 @@ PACKAGE=libtool
VERSION=1.5.22
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes.
-if test -n "${ZSH_VERSION+set}" ; then
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
# Check that we have a working $echo.
@@ -105,12 +111,14 @@ esac
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ fi"
+done
# Make sure IFS has a sensible default
lt_nl='
@@ -136,6 +144,8 @@ duplicate_deps=no
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
#####################################
# Shell function definitions:
@@ -327,7 +337,17 @@ func_extract_archives ()
*) my_xabs=`pwd`"/$my_xlib" ;;
esac
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
- my_xdir="$my_gentop/$my_xlib"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ extracted_serial=`expr $extracted_serial + 1`
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
$show "${rm}r $my_xdir"
$run ${rm}r "$my_xdir"
@@ -758,6 +778,7 @@ if test -z "$show_help"; then
*.f90) xform=f90 ;;
*.for) xform=for ;;
*.java) xform=java ;;
+ *.obj) xform=obj ;;
esac
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
@@ -1138,8 +1159,9 @@ EOF
for arg
do
case $arg in
- -all-static | -static)
- if test "X$arg" = "X-all-static"; then
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
fi
@@ -1147,12 +1169,20 @@ EOF
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=yes
- else
+ ;;
+ -static)
if test -z "$pic_flag" && test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
fi
prefer_static_libs=built
- fi
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
build_libtool_libs=no
build_old_libs=yes
break
@@ -1712,7 +1742,7 @@ EOF
continue
;;
- -static)
+ -static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
# didn't have a PIC flag, but the assumption that the effects
@@ -2490,7 +2520,9 @@ EOF
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
@@ -3186,7 +3218,7 @@ EOF
# which has an extra 1 added just for fun
#
case $version_type in
- darwin|linux|osf|windows)
+ darwin|linux|osf|windows|none)
current=`expr $number_major + $number_minor`
age="$number_minor"
revision="$number_revision"
@@ -3410,11 +3442,11 @@ EOF
fi
# Eliminate all temporary directories.
- for path in $notinst_path; do
- lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
- deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
- dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
- done
+# for path in $notinst_path; do
+# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
+# done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
@@ -3515,13 +3547,12 @@ EOF
int main() { return 0; }
EOF
$rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
- if test "$?" -eq 0 ; then
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
ldd_output=`ldd conftest`
for i in $deplibs; do
name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" -ne "0"; then
+ if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
@@ -3560,9 +3591,7 @@ EOF
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
$rm conftest
- $LTCC $LTCFLAGS -o conftest conftest.c $i
- # Did it work?
- if test "$?" -eq 0 ; then
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
@@ -3594,7 +3623,7 @@ EOF
droppeddeps=yes
$echo
$echo "*** Warning! Library $i is needed by this library but I was not able to"
- $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** make it link in! You will probably need to install it or some"
$echo "*** library that it depends on before this library will be fully"
$echo "*** functional. Installing it before continuing would be even better."
fi
@@ -4239,12 +4268,14 @@ EOF
reload_conv_objs=
gentop=
# reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
wl=
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
- eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
generated="$generated $gentop"
@@ -4692,16 +4723,16 @@ static const void *lt_preloaded_setup() {
case $host in
*cygwin* | *mingw* )
if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
else
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
fi
;;
* )
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
;;
esac
;;
@@ -4716,13 +4747,13 @@ static const void *lt_preloaded_setup() {
# really was required.
# Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
fi
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
# Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
@@ -4809,7 +4840,7 @@ static const void *lt_preloaded_setup() {
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
else
# fast_install is set to needless
relink_command=
@@ -4846,7 +4877,7 @@ static const void *lt_preloaded_setup() {
fi
done
relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
fi
# Quote $echo for shipping.
@@ -5253,6 +5284,18 @@ EOF
Xsed='${SED} -e 1s/^X//'
sed_quote_subst='$sed_quote_subst'
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
@@ -5395,7 +5438,7 @@ else
;;
esac
$echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ \$echo \"\$0: cannot exec \$program \$*\"
exit $EXIT_FAILURE
fi
else
@@ -5581,7 +5624,7 @@ fi\
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
@@ -5926,9 +5969,9 @@ relink_command=\"$relink_command\""
if test -n "$inst_prefix_dir"; then
# Stick the inst_prefix_dir data into the link command.
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
else
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
fi
$echo "$modename: warning: relinking \`$file'" 1>&2
@@ -6137,7 +6180,7 @@ relink_command=\"$relink_command\""
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
outputname="$tmpdir/$file"
# Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
$show "$relink_command"
if $run eval "$relink_command"; then :
@@ -6413,12 +6456,15 @@ relink_command=\"$relink_command\""
fi
# Restore saved environment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
+ for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
# Now prepare to actually exec the command.
exec_cmd="\$cmd$args"
@@ -6775,9 +6821,9 @@ The following components of LINK-COMMAND are treated specially:
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
+ try to export only the symbols listed in SYMFILE
-export-symbols-regex REGEX
- try to export only the symbols matching REGEX
+ try to export only the symbols matching REGEX
-LLIBDIR search LIBDIR for required installed libraries
-lNAME OUTPUT-FILE requires the installed library libNAME
-module build a library that can dlopened
@@ -6791,9 +6837,11 @@ The following components of LINK-COMMAND are treated specially:
-release RELEASE specify package release information
-rpath LIBDIR the created library will eventually be installed in LIBDIR
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
-version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
+ specify library version info [each variable defaults to 0]
All other options (arguments beginning with \`-') are ignored.
diff --git a/m4/db.m4 b/m4/db.m4
index 680f57e1d..2e43b1440 100644
--- a/m4/db.m4
+++ b/m4/db.m4
@@ -72,6 +72,8 @@ db_ver_pat=`grep DB_VERSION_PATCH $db_incdir/db.h | awk '{print $3}'`
dnl libname is libdb-maj.min e.g. libdb-4.2
db_libver=${db_ver_maj}.${db_ver_min}
dnl make sure the lib is available
-AC_CHECK_LIB([db-$db_libver], [db_create], [],
- [AC_MSG_ERROR([$db_incdir/db.h is version $db_libver but libdb-$db_libver not found])])
+dnl use true so libdb won't be added to LIBS
+AC_CHECK_LIB([db-$db_libver], [db_create], [true],
+ [AC_MSG_ERROR([$db_incdir/db.h is version $db_libver but libdb-$db_libver not found])],
+ [$LIBNSL])
diff --git a/m4/mozldap.m4 b/m4/mozldap.m4
index 6a65b176f..7249c9ea9 100644
--- a/m4/mozldap.m4
+++ b/m4/mozldap.m4
@@ -86,7 +86,7 @@ if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib" -o -z "$ldapsdk_libdir" -o -z "$l
fi
ldapsdk_inc=`$PKG_CONFIG --cflags-only-I $mozldappkg`
ldapsdk_lib=`$PKG_CONFIG --libs-only-L $mozldappkg`
- ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ *$//`
+ ldapsdk_libdir=`$PKG_CONFIG --libs-only-L $mozldappkg | sed -e s/-L// | sed -e s/\ .*$//`
ldapsdk_bindir=`$PKG_CONFIG --variable=bindir $mozldappkg`
AC_MSG_RESULT([using system $mozldappkg])
fi
diff --git a/m4/nspr.m4 b/m4/nspr.m4
index 50da5ba7c..e89b9a89c 100644
--- a/m4/nspr.m4
+++ b/m4/nspr.m4
@@ -79,12 +79,12 @@ if test -z "$nspr_inc" -o -z "$nspr_lib" -o -z "$nspr_libdir"; then
if $PKG_CONFIG --exists nspr; then
nspr_inc=`$PKG_CONFIG --cflags-only-I nspr`
nspr_lib=`$PKG_CONFIG --libs-only-L nspr`
- nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ *$//`
+ nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system NSPR])
elif $PKG_CONFIG --exists dirsec-nspr; then
nspr_inc=`$PKG_CONFIG --cflags-only-I dirsec-nspr`
nspr_lib=`$PKG_CONFIG --libs-only-L dirsec-nspr`
- nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ *$//`
+ nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system dirsec NSPR])
else
AC_MSG_ERROR([NSPR not found, specify with --with-nspr.])
diff --git a/m4/nss.m4 b/m4/nss.m4
index 1f11957a7..9d892254e 100644
--- a/m4/nss.m4
+++ b/m4/nss.m4
@@ -79,12 +79,12 @@ if test -z "$nss_inc" -o -z "$nss_lib" -o -z "$nss_libdir"; then
if $PKG_CONFIG --exists nss; then
nss_inc=`$PKG_CONFIG --cflags-only-I nss`
nss_lib=`$PKG_CONFIG --libs-only-L nss`
- nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ *$//`
+ nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system NSS])
elif $PKG_CONFIG --exists dirsec-nss; then
nss_inc=`$PKG_CONFIG --cflags-only-I dirsec-nss`
nss_lib=`$PKG_CONFIG --libs-only-L dirsec-nss`
- nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ *$//`
+ nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
AC_MSG_RESULT([using system dirsec NSS])
else
AC_MSG_ERROR([NSS not found, specify with --with-nss.])
| 0 |
65678bb3b952123e151cab6211259b4e54d6dd1f
|
389ds/389-ds-base
|
Issue 4384 - Separate eventq into REALTIME and MONOTONIC
Description: The recent changes to the eventq "when" time changed
internally from REALTIME to MONOTONIC, and this broke
the API. Create a new API for MONOTONIC clocks, and
keep the original API intact for REALTIME clocks.
Relates: https://github.com/389ds/389-ds-base/issues/4384
Reviewed by: firstyear(Thanks!)
|
commit 65678bb3b952123e151cab6211259b4e54d6dd1f
Author: Mark Reynolds <[email protected]>
Date: Thu Dec 17 15:25:42 2020 -0500
Issue 4384 - Separate eventq into REALTIME and MONOTONIC
Description: The recent changes to the eventq "when" time changed
internally from REALTIME to MONOTONIC, and this broke
the API. Create a new API for MONOTONIC clocks, and
keep the original API intact for REALTIME clocks.
Relates: https://github.com/389ds/389-ds-base/issues/4384
Reviewed by: firstyear(Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 1dfb1f190..83bde0a9a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1103,6 +1103,7 @@ libslapd_la_SOURCES = ldap/servers/slapd/add.c \
ldap/servers/slapd/entrywsi.c \
ldap/servers/slapd/errormap.c \
ldap/servers/slapd/eventq.c \
+ ldap/servers/slapd/eventq-deprecated.c \
ldap/servers/slapd/factory.c \
ldap/servers/slapd/features.c \
ldap/servers/slapd/fileio.c \
diff --git a/docs/slapi.doxy.in b/docs/slapi.doxy.in
index b1e4810ab..1cafc50ce 100644
--- a/docs/slapi.doxy.in
+++ b/docs/slapi.doxy.in
@@ -759,7 +759,6 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = src/libsds/include/sds.h \
- docs/job-safety.md \
# ldap/servers/slapd/slapi-plugin.h \
# This tag can be used to specify the character encoding of the source files
diff --git a/ldap/servers/plugins/chainingdb/cb_instance.c b/ldap/servers/plugins/chainingdb/cb_instance.c
index bc1864c1a..7fd85deb0 100644
--- a/ldap/servers/plugins/chainingdb/cb_instance.c
+++ b/ldap/servers/plugins/chainingdb/cb_instance.c
@@ -217,7 +217,7 @@ cb_instance_free(cb_backend_instance *inst)
slapi_rwlock_wrlock(inst->rwl_config_lock);
if (inst->eq_ctx != NULL) {
- slapi_eq_cancel(inst->eq_ctx);
+ slapi_eq_cancel_rel(inst->eq_ctx);
inst->eq_ctx = NULL;
}
@@ -1947,8 +1947,8 @@ cb_instance_add_config_callback(Slapi_PBlock *pb __attribute__((unused)),
* we can't call recursively into the DSE to do more adds, they'll
* silently fail. instead, schedule the adds to happen in 1 second.
*/
- inst->eq_ctx = slapi_eq_once(cb_instance_add_monitor_later, (void *)inst,
- slapi_current_rel_time_t() + 1);
+ inst->eq_ctx = slapi_eq_once_rel(cb_instance_add_monitor_later, (void *)inst,
+ slapi_current_rel_time_t() + 1);
}
/* Get the list of operational attrs defined in the schema */
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 1cb54580b..b46edfcbb 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -688,7 +688,7 @@ dna_close(Slapi_PBlock *pb __attribute__((unused)))
slapi_log_err(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
"--> dna_close\n");
- slapi_eq_cancel(eq_ctx);
+ slapi_eq_cancel_rel(eq_ctx);
dna_delete_config(NULL);
slapi_ch_free((void **)&dna_global_config);
slapi_destroy_rwlock(g_dna_cache_lock);
@@ -908,7 +908,7 @@ dna_load_plugin_config(Slapi_PBlock *pb, int use_eventq)
* starting up would cause the change to not
* get changelogged. */
now = slapi_current_rel_time_t();
- eq_ctx = slapi_eq_once(dna_update_config_event, NULL, now + 30);
+ eq_ctx = slapi_eq_once_rel(dna_update_config_event, NULL, now + 30);
} else {
dna_update_config_event(0, NULL);
}
diff --git a/ldap/servers/plugins/replication/repl5_backoff.c b/ldap/servers/plugins/replication/repl5_backoff.c
index 40ec75dd7..8c851beb2 100644
--- a/ldap/servers/plugins/replication/repl5_backoff.c
+++ b/ldap/servers/plugins/replication/repl5_backoff.c
@@ -99,7 +99,7 @@ backoff_reset(Backoff_Timer *bt, slapi_eq_fn_t callback, void *callback_data)
bt->callback_arg = callback_data;
/* Cancel any pending events in the event queue */
if (NULL != bt->pending_event) {
- slapi_eq_cancel(bt->pending_event);
+ slapi_eq_cancel_rel(bt->pending_event);
bt->pending_event = NULL;
}
/* Compute the first fire time */
@@ -112,8 +112,8 @@ backoff_reset(Backoff_Timer *bt, slapi_eq_fn_t callback, void *callback_data)
/* Schedule the callback */
bt->last_fire_time = slapi_current_rel_time_t();
return_value = bt->last_fire_time + bt->next_interval;
- bt->pending_event = slapi_eq_once(bt->callback, bt->callback_arg,
- return_value);
+ bt->pending_event = slapi_eq_once_rel(bt->callback, bt->callback_arg,
+ return_value);
PR_Unlock(bt->lock);
return return_value;
}
@@ -159,8 +159,8 @@ backoff_step(Backoff_Timer *bt)
/* Schedule the callback, if any */
bt->last_fire_time += previous_interval;
return_value = bt->last_fire_time + bt->next_interval;
- bt->pending_event = slapi_eq_once(bt->callback, bt->callback_arg,
- return_value);
+ bt->pending_event = slapi_eq_once_rel(bt->callback, bt->callback_arg,
+ return_value);
}
PR_Unlock(bt->lock);
return return_value;
@@ -196,7 +196,7 @@ backoff_delete(Backoff_Timer **btp)
PR_Lock(bt->lock);
/* Cancel any pending events in the event queue */
if (NULL != bt->pending_event) {
- slapi_eq_cancel(bt->pending_event);
+ slapi_eq_cancel_rel(bt->pending_event);
}
PR_Unlock(bt->lock);
PR_DestroyLock(bt->lock);
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index bc9ca424b..2dd74f9e7 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -272,7 +272,7 @@ conn_delete(Repl_Connection *conn)
PR_ASSERT(NULL != conn);
PR_Lock(conn->lock);
if (conn->linger_active) {
- if (slapi_eq_cancel(conn->linger_event) == 1) {
+ if (slapi_eq_cancel_rel(conn->linger_event) == 1) {
/* Event was found and cancelled. Destroy the connection object. */
destroy_it = PR_TRUE;
} else {
@@ -961,7 +961,7 @@ conn_cancel_linger(Repl_Connection *conn)
"conn_cancel_linger - %s - Canceling linger on the connection\n",
agmt_get_long_name(conn->agmt));
conn->linger_active = PR_FALSE;
- if (slapi_eq_cancel(conn->linger_event) == 1) {
+ if (slapi_eq_cancel_rel(conn->linger_event) == 1) {
conn->refcnt--;
}
conn->linger_event = NULL;
@@ -1030,7 +1030,7 @@ conn_start_linger(Repl_Connection *conn)
agmt_get_long_name(conn->agmt));
} else {
conn->linger_active = PR_TRUE;
- conn->linger_event = slapi_eq_once(linger_timeout, conn, now + conn->linger_time);
+ conn->linger_event = slapi_eq_once_rel(linger_timeout, conn, now + conn->linger_time);
conn->status = STATUS_LINGERING;
}
PR_Unlock(conn->lock);
@@ -1990,7 +1990,7 @@ repl5_start_debug_timeout(int *setlevel)
Slapi_Eq_Context eqctx = 0;
if (s_debug_timeout && s_debug_level) {
time_t now = slapi_current_rel_time_t();
- eqctx = slapi_eq_once(repl5_debug_timeout_callback, setlevel,
+ eqctx = slapi_eq_once_rel(repl5_debug_timeout_callback, setlevel,
s_debug_timeout + now);
}
return eqctx;
@@ -2002,7 +2002,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
char buf[20];
if (eqctx && !*setlevel) {
- (void)slapi_eq_cancel(eqctx);
+ (void)slapi_eq_cancel_rel(eqctx);
}
if (s_debug_timeout && s_debug_level && *setlevel) {
diff --git a/ldap/servers/plugins/replication/repl5_mtnode_ext.c b/ldap/servers/plugins/replication/repl5_mtnode_ext.c
index 82e230958..2967a47f8 100644
--- a/ldap/servers/plugins/replication/repl5_mtnode_ext.c
+++ b/ldap/servers/plugins/replication/repl5_mtnode_ext.c
@@ -82,8 +82,8 @@ multimaster_mtnode_construct_replicas()
}
}
/* Wait a few seconds for everything to startup before resuming any replication tasks */
- slapi_eq_once(replica_check_for_tasks, (void *)replica_get_root(r),
- slapi_current_rel_time_t() + 5);
+ slapi_eq_once_rel(replica_check_for_tasks, (void *)replica_get_root(r),
+ slapi_current_rel_time_t() + 5);
}
}
}
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index cf8407e9d..7db0c1678 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -244,17 +244,17 @@ replica_new_from_entry(Slapi_Entry *e, char *errortext, PRBool is_add_operation,
/* ONREPL - the state update can occur before the entry is added to the DIT.
In that case the updated would fail but nothing bad would happen. The next
scheduled update would save the state */
- r->repl_eqcxt_rs = slapi_eq_repeat(replica_update_state, r->repl_name,
- slapi_current_rel_time_t() + START_UPDATE_DELAY, RUV_SAVE_INTERVAL);
+ r->repl_eqcxt_rs = slapi_eq_repeat_rel(replica_update_state, r->repl_name,
+ slapi_current_rel_time_t() + START_UPDATE_DELAY, RUV_SAVE_INTERVAL);
if (r->tombstone_reap_interval > 0) {
/*
* Reap Tombstone should be started some time after the plugin started.
* This will allow the server to fully start before consuming resources.
*/
- r->repl_eqcxt_tr = slapi_eq_repeat(eq_cb_reap_tombstones, r->repl_name,
- slapi_current_rel_time_t() + r->tombstone_reap_interval,
- 1000 * r->tombstone_reap_interval);
+ r->repl_eqcxt_tr = slapi_eq_repeat_rel(eq_cb_reap_tombstones, r->repl_name,
+ slapi_current_rel_time_t() + r->tombstone_reap_interval,
+ 1000 * r->tombstone_reap_interval);
}
done:
@@ -316,12 +316,12 @@ replica_destroy(void **arg)
*/
if (r->repl_eqcxt_rs) {
- slapi_eq_cancel(r->repl_eqcxt_rs);
+ slapi_eq_cancel_rel(r->repl_eqcxt_rs);
r->repl_eqcxt_rs = NULL;
}
if (r->repl_eqcxt_tr) {
- slapi_eq_cancel(r->repl_eqcxt_tr);
+ slapi_eq_cancel_rel(r->repl_eqcxt_tr);
r->repl_eqcxt_tr = NULL;
}
@@ -1528,14 +1528,14 @@ replica_set_enabled(Replica *r, PRBool enable)
if (enable) {
if (r->repl_eqcxt_rs == NULL) /* event is not already registered */
{
- r->repl_eqcxt_rs = slapi_eq_repeat(replica_update_state, r->repl_name,
- slapi_current_rel_time_t() + START_UPDATE_DELAY, RUV_SAVE_INTERVAL);
+ r->repl_eqcxt_rs = slapi_eq_repeat_rel(replica_update_state, r->repl_name,
+ slapi_current_rel_time_t() + START_UPDATE_DELAY, RUV_SAVE_INTERVAL);
}
} else /* disable */
{
if (r->repl_eqcxt_rs) /* event is still registerd */
{
- slapi_eq_cancel(r->repl_eqcxt_rs);
+ slapi_eq_cancel_rel(r->repl_eqcxt_rs);
r->repl_eqcxt_rs = NULL;
}
}
@@ -3656,7 +3656,7 @@ replica_set_tombstone_reap_interval(Replica *r, long interval)
if (interval > 0 && r->repl_eqcxt_tr && r->tombstone_reap_interval != interval) {
int found;
- found = slapi_eq_cancel(r->repl_eqcxt_tr);
+ found = slapi_eq_cancel_rel(r->repl_eqcxt_tr);
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
"replica_set_tombstone_reap_interval - tombstone_reap event (interval=%" PRId64 ") was %s\n",
r->tombstone_reap_interval, (found ? "cancelled" : "not found"));
@@ -3664,7 +3664,7 @@ replica_set_tombstone_reap_interval(Replica *r, long interval)
}
r->tombstone_reap_interval = interval;
if (interval > 0 && r->repl_eqcxt_tr == NULL) {
- r->repl_eqcxt_tr = slapi_eq_repeat(eq_cb_reap_tombstones, r->repl_name,
+ r->repl_eqcxt_tr = slapi_eq_repeat_rel(eq_cb_reap_tombstones, r->repl_name,
slapi_current_rel_time_t() + r->tombstone_reap_interval,
1000 * r->tombstone_reap_interval);
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
diff --git a/ldap/servers/plugins/replication/repl5_schedule.c b/ldap/servers/plugins/replication/repl5_schedule.c
index 9539f4031..ca42df561 100644
--- a/ldap/servers/plugins/replication/repl5_schedule.c
+++ b/ldap/servers/plugins/replication/repl5_schedule.c
@@ -550,7 +550,7 @@ schedule_window_state_change_event(Schedule *sch)
wakeup_time = PRTime2time_t(tm);
/* schedule the event */
- sch->pending_event = slapi_eq_once(window_state_changed, sch, wakeup_time);
+ sch->pending_event = slapi_eq_once_rel(window_state_changed, sch, wakeup_time);
timestr = get_timestring(&wakeup_time);
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "%s: Update window will %s at %s\n",
@@ -593,7 +593,7 @@ static void
unschedule_window_state_change_event(Schedule *sch)
{
if (sch->pending_event) {
- slapi_eq_cancel(sch->pending_event);
+ slapi_eq_cancel_rel(sch->pending_event);
sch->pending_event = NULL;
}
}
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index ce0662544..5eca5fad1 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -204,7 +204,7 @@ windows_conn_delete(Repl_Connection *conn)
PR_ASSERT(NULL != conn);
PR_Lock(conn->lock);
if (conn->linger_active) {
- if (slapi_eq_cancel(conn->linger_event) == 1) {
+ if (slapi_eq_cancel_rel(conn->linger_event) == 1) {
/* Event was found and cancelled. Destroy the connection object. */
PR_Unlock(conn->lock);
destroy_it = PR_TRUE;
@@ -1052,7 +1052,7 @@ windows_conn_cancel_linger(Repl_Connection *conn)
"windows_conn_cancel_linger - %s: Cancelling linger on the connection\n",
agmt_get_long_name(conn->agmt));
conn->linger_active = PR_FALSE;
- if (slapi_eq_cancel(conn->linger_event) == 1) {
+ if (slapi_eq_cancel_rel(conn->linger_event) == 1) {
conn->refcnt--;
}
conn->linger_event = NULL;
@@ -1129,7 +1129,7 @@ windows_conn_start_linger(Repl_Connection *conn)
agmt_get_long_name(conn->agmt));
} else {
conn->linger_active = PR_TRUE;
- conn->linger_event = slapi_eq_once(linger_timeout, conn, now + conn->linger_time);
+ conn->linger_event = slapi_eq_once_rel(linger_timeout, conn, now + conn->linger_time);
conn->status = STATUS_LINGERING;
}
PR_Unlock(conn->lock);
@@ -1822,8 +1822,8 @@ repl5_start_debug_timeout(int *setlevel)
if (s_debug_timeout && s_debug_level) {
time_t now = time(NULL);
- eqctx = slapi_eq_once(repl5_debug_timeout_callback, setlevel,
- s_debug_timeout + now);
+ eqctx = slapi_eq_once_rel(repl5_debug_timeout_callback, setlevel,
+ s_debug_timeout + now);
}
slapi_log_err(SLAPI_LOG_TRACE, windows_repl_plugin_name, "<= repl5_start_debug_timeout\n");
return eqctx;
@@ -1837,7 +1837,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
slapi_log_err(SLAPI_LOG_TRACE, windows_repl_plugin_name, "=> repl5_stop_debug_timeout\n");
if (eqctx && !*setlevel) {
- (void)slapi_eq_cancel(eqctx);
+ (void)slapi_eq_cancel_rel(eqctx);
}
if (s_debug_timeout && s_debug_level && *setlevel) {
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c
index dec63bea1..310bedcca 100644
--- a/ldap/servers/plugins/replication/windows_inc_protocol.c
+++ b/ldap/servers/plugins/replication/windows_inc_protocol.c
@@ -132,7 +132,7 @@ windows_inc_delete(Private_Repl_Protocol **prpp)
slapi_log_err(SLAPI_LOG_TRACE, windows_repl_plugin_name, "=> windows_inc_delete\n");
/* First, stop the protocol if it isn't already stopped */
/* Then, delete all resources used by the protocol */
- rc = slapi_eq_cancel(dirsync);
+ rc = slapi_eq_cancel_rel(dirsync);
slapi_log_err(SLAPI_LOG_REPL, windows_repl_plugin_name,
"windows_inc_delete - dirsync: %p, rval: %d\n", dirsync, rc);
/* if backoff is set, delete it (from EQ, as well) */
@@ -324,12 +324,13 @@ windows_inc_run(Private_Repl_Protocol *prp)
if (interval != current_interval) {
current_interval = interval;
if (dirsync) {
- int rc = slapi_eq_cancel(dirsync);
+ int rc = slapi_eq_cancel_rel(dirsync);
slapi_log_err(SLAPI_LOG_REPL, windows_repl_plugin_name,
"windows_inc_run - Cancelled dirsync: %p, rval: %d\n",
dirsync, rc);
}
- dirsync = slapi_eq_repeat(periodic_dirsync, (void *)prp, (time_t)0, interval);
+ dirsync = slapi_eq_repeat_rel(periodic_dirsync, (void *)prp,
+ slapi_current_rel_time_t(), interval);
slapi_log_err(SLAPI_LOG_REPL, windows_repl_plugin_name,
"windows_inc_run - New dirsync: %p\n", dirsync);
}
diff --git a/ldap/servers/plugins/retrocl/retrocl_trim.c b/ldap/servers/plugins/retrocl/retrocl_trim.c
index a3e16c4e1..12a395210 100644
--- a/ldap/servers/plugins/retrocl/retrocl_trim.c
+++ b/ldap/servers/plugins/retrocl/retrocl_trim.c
@@ -460,10 +460,10 @@ retrocl_init_trimming(void)
ts.ts_s_initialized = 1;
retrocl_trimming = 1;
- retrocl_trim_ctx = slapi_eq_repeat(retrocl_housekeeping,
- NULL, (time_t)0,
- /* in milliseconds */
- trim_interval * 1000);
+ retrocl_trim_ctx = slapi_eq_repeat_rel(retrocl_housekeeping,
+ NULL, (time_t)0,
+ /* in milliseconds */
+ trim_interval * 1000);
}
/*
@@ -487,7 +487,7 @@ retrocl_stop_trimming(void)
*/
retrocl_trimming = 0;
if (retrocl_trim_ctx) {
- slapi_eq_cancel(retrocl_trim_ctx);
+ slapi_eq_cancel_rel(retrocl_trim_ctx);
retrocl_trim_ctx = NULL;
}
PR_DestroyLock(ts.ts_s_trim_mutex);
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index eb302de55..713c5e62f 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -1117,7 +1117,8 @@ slapd_daemon(daemon_ports_t *ports)
slapi_log_err(SLAPI_LOG_TRACE, "slapd_daemon",
"slapd shutting down - waiting for backends to close down\n");
- eq_stop();
+ eq_stop(); /* deprecated */
+ eq_stop_rel();
if (!in_referral_mode) {
task_shutdown();
uniqueIDGenCleanup();
diff --git a/ldap/servers/slapd/eventq-deprecated.c b/ldap/servers/slapd/eventq-deprecated.c
new file mode 100644
index 000000000..71a7bf8f5
--- /dev/null
+++ b/ldap/servers/slapd/eventq-deprecated.c
@@ -0,0 +1,483 @@
+/** BEGIN COPYRIGHT BLOCK
+ * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+ * Copyright (C) 2020 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * License: GPL (version 3 or any later version).
+ * See LICENSE for details.
+ * END COPYRIGHT BLOCK **/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+/* ********************************************************
+eventq-deprecated.c - Event queue/scheduling system.
+
+There are 3 publicly-accessible entry points:
+
+slapi_eq_once(): cause an event to happen exactly once
+slapi_eq_repeat(): cause an event to happen repeatedly
+slapi_eq_cancel(): cancel a pending event
+
+There is also an initialization point which must be
+called by the server to initialize the event queue system:
+eq_start(), and an entry point used to shut down the system:
+eq_stop().
+
+These functions are now deprecated in favor of the functions
+in eventq.c which use MONOTONIC clocks instead of REALTIME
+clocks.
+*********************************************************** */
+
+#include "slap.h"
+#include "prlock.h"
+#include "prcvar.h"
+#include "prinit.h"
+
+/*
+ * Private definition of slapi_eq_context. Only this
+ * module (eventq.c) should know about the layout of
+ * this structure.
+ */
+typedef struct _slapi_eq_context
+{
+ time_t ec_when;
+ time_t ec_interval;
+ slapi_eq_fn_t ec_fn;
+ void *ec_arg;
+ Slapi_Eq_Context ec_id;
+ struct _slapi_eq_context *ec_next;
+} slapi_eq_context;
+
+/*
+ * Definition of the event queue.
+ */
+typedef struct _event_queue
+{
+ PRLock *eq_lock;
+ PRCondVar *eq_cv;
+ slapi_eq_context *eq_queue;
+} event_queue;
+
+/*
+ * The event queue itself.
+ */
+static event_queue eqs = {0};
+static event_queue *eq = &eqs;
+
+/*
+ * Thread ID of the main thread loop
+ */
+static PRThread *eq_loop_tid = NULL;
+
+/*
+ * Flags used to control startup/shutdown of the event queue
+ */
+static int eq_running = 0;
+static int eq_stopped = 0;
+static int eq_initialized = 0;
+PRLock *ss_lock = NULL;
+PRCondVar *ss_cv = NULL;
+PRCallOnceType init_once = {0};
+
+/* Forward declarations */
+static slapi_eq_context *eq_new(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval);
+static void eq_enqueue(slapi_eq_context *newec);
+static slapi_eq_context *eq_dequeue(time_t now);
+static PRStatus eq_create(void);
+
+
+/* ******************************************************** */
+
+
+/*
+ * slapi_eq_once: cause an event to happen exactly once.
+ *
+ * Arguments:
+ * fn: the function to call
+ * arg: an argument to pass to the called function
+ * when: the time that the function should be called
+ * Returns:
+ * slapi_eq_context - a handle to an opaque object which
+ * the caller can use to refer to this particular scheduled
+ * event.
+ */
+Slapi_Eq_Context
+slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when)
+{
+ slapi_eq_context *tmp;
+ PR_ASSERT(eq_initialized);
+ if (!eq_stopped) {
+
+ Slapi_Eq_Context id;
+
+ tmp = eq_new(fn, arg, when, 0UL);
+ id = tmp->ec_id;
+
+ eq_enqueue(tmp);
+
+ /* After this point, <tmp> may have */
+ /* been freed, depending on the thread */
+ /* scheduling. Too bad */
+
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL,
+ "added one-time event id %p at time %ld\n",
+ id, when);
+ return (id);
+ }
+ return NULL; /* JCM - Not sure if this should be 0 or something else. */
+}
+
+
+/*
+ * slapi_eq_repeat: cause an event to happen repeatedly.
+ *
+ * Arguments:
+ * fn: the function to call
+ * arg: an argument to pass to the called function
+ * when: the time that the function should first be called
+ * interval: the amount of time (in milliseconds) between
+ * successive calls to the function
+ * Returns:
+ * slapi_eq_context - a handle to an opaque object which
+ * the caller can use to refer to this particular scheduled
+ */
+Slapi_Eq_Context
+slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
+{
+ slapi_eq_context *tmp;
+ PR_ASSERT(eq_initialized);
+ if (!eq_stopped) {
+ tmp = eq_new(fn, arg, when, interval);
+ eq_enqueue(tmp);
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL,
+ "added repeating event id %p at time %ld, interval %lu\n",
+ tmp->ec_id, when, interval);
+ return (tmp->ec_id);
+ }
+ return NULL; /* JCM - Not sure if this should be 0 or something else. */
+}
+
+
+/*
+ * slapi_eq_cancel: cancel a pending event.
+ * Arguments:
+ * ctx: the context of the event which should be de-scheduled
+ */
+int
+slapi_eq_cancel(Slapi_Eq_Context ctx)
+{
+ slapi_eq_context **p, *tmp = NULL;
+ int found = 0;
+
+ PR_ASSERT(eq_initialized);
+ if (!eq_stopped) {
+ PR_Lock(eq->eq_lock);
+ p = &(eq->eq_queue);
+ while (!found && *p != NULL) {
+ if ((*p)->ec_id == ctx) {
+ tmp = *p;
+ *p = (*p)->ec_next;
+ slapi_ch_free((void **)&tmp);
+ found = 1;
+ } else {
+ p = &((*p)->ec_next);
+ }
+ }
+ PR_Unlock(eq->eq_lock);
+ }
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL,
+ "cancellation of event id %p requested: %s\n",
+ ctx, found ? "cancellation succeeded" : "event not found");
+ return found;
+}
+
+
+/*
+ * Construct a new ec structure
+ */
+static slapi_eq_context *
+eq_new(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
+{
+ slapi_eq_context *retptr = (slapi_eq_context *)slapi_ch_calloc(1, sizeof(slapi_eq_context));
+
+ retptr->ec_fn = fn;
+ retptr->ec_arg = arg;
+ /*
+ * retptr->ec_when = when < now ? now : when;
+ * we used to amke this check, but it make no sense: when queued, if when
+ * has expired, we'll be executed anyway. save the cycles, and just set
+ * ec_when.
+ */
+ retptr->ec_when = when;
+ retptr->ec_interval = interval == 0UL ? 0UL : (interval + 999) / 1000;
+ retptr->ec_id = (Slapi_Eq_Context)retptr;
+ return retptr;
+}
+
+
+/*
+ * Add a new event to the event queue.
+ */
+static void
+eq_enqueue(slapi_eq_context *newec)
+{
+ slapi_eq_context **p;
+
+ PR_ASSERT(NULL != newec);
+ PR_Lock(eq->eq_lock);
+ /* Insert <newec> in order (sorted by start time) in the list */
+ for (p = &(eq->eq_queue); *p != NULL; p = &((*p)->ec_next)) {
+ if ((*p)->ec_when > newec->ec_when) {
+ break;
+ }
+ }
+ if (NULL != *p) {
+ newec->ec_next = *p;
+ } else {
+ newec->ec_next = NULL;
+ }
+ *p = newec;
+ PR_NotifyCondVar(eq->eq_cv); /* wake up scheduler thread */
+ PR_Unlock(eq->eq_lock);
+}
+
+
+/*
+ * If there is an event in the queue scheduled at time
+ * <now> or before, dequeue it and return a pointer
+ * to it. Otherwise, return NULL.
+ */
+static slapi_eq_context *
+eq_dequeue(time_t now)
+{
+ slapi_eq_context *retptr = NULL;
+
+ PR_Lock(eq->eq_lock);
+ if (NULL != eq->eq_queue && eq->eq_queue->ec_when <= now) {
+ retptr = eq->eq_queue;
+ eq->eq_queue = retptr->ec_next;
+ }
+ PR_Unlock(eq->eq_lock);
+ return retptr;
+}
+
+
+/*
+ * Call all events which are due to run.
+ * Note that if we've missed a schedule
+ * opportunity, we don't try to catch up
+ * by calling the function repeatedly.
+ */
+static void
+eq_call_all(void)
+{
+ slapi_eq_context *p;
+ time_t curtime = slapi_current_utc_time();
+
+ while ((p = eq_dequeue(curtime)) != NULL) {
+ /* Call the scheduled function */
+ p->ec_fn(p->ec_when, p->ec_arg);
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL,
+ "Event id %p called at %ld (scheduled for %ld)\n",
+ p->ec_id, curtime, p->ec_when);
+ if (0UL != p->ec_interval) {
+ /* This is a repeating event. Requeue it. */
+ do {
+ p->ec_when += p->ec_interval;
+ } while (p->ec_when < curtime);
+ eq_enqueue(p);
+ } else {
+ slapi_ch_free((void **)&p);
+ }
+ }
+}
+
+
+/*
+ * The main event queue loop.
+ */
+static void
+eq_loop(void *arg __attribute__((unused)))
+{
+ while (eq_running) {
+ time_t curtime = slapi_current_utc_time();
+ PRIntervalTime timeout;
+ int until;
+ PR_Lock(eq->eq_lock);
+ while (!((NULL != eq->eq_queue) && (eq->eq_queue->ec_when <= curtime))) {
+ if (!eq_running) {
+ PR_Unlock(eq->eq_lock);
+ goto bye;
+ }
+ /* Compute new timeout */
+ if (NULL != eq->eq_queue) {
+ until = eq->eq_queue->ec_when - curtime;
+ timeout = PR_SecondsToInterval(until);
+ } else {
+ timeout = PR_INTERVAL_NO_TIMEOUT;
+ }
+ PR_WaitCondVar(eq->eq_cv, timeout);
+ curtime = slapi_current_utc_time();
+ }
+ /* There is some work to do */
+ PR_Unlock(eq->eq_lock);
+ eq_call_all();
+ }
+bye:
+ eq_stopped = 1;
+ PR_Lock(ss_lock);
+ PR_NotifyAllCondVar(ss_cv);
+ PR_Unlock(ss_lock);
+}
+
+
+/*
+ * Allocate and initialize the event queue structures.
+ */
+static PRStatus
+eq_create(void)
+{
+ PR_ASSERT(NULL == eq->eq_lock);
+ if ((eq->eq_lock = PR_NewLock()) == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create", "PR_NewLock failed\n");
+ exit(1);
+ }
+ if ((eq->eq_cv = PR_NewCondVar(eq->eq_lock)) == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create", "PR_NewCondVar failed\n");
+ exit(1);
+ }
+ if ((ss_lock = PR_NewLock()) == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create", "PR_NewLock failed\n");
+ exit(1);
+ }
+ if ((ss_cv = PR_NewCondVar(ss_lock)) == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create", "PR_NewCondVar failed\n");
+ exit(1);
+ }
+ eq->eq_queue = NULL;
+ eq_initialized = 1;
+ return PR_SUCCESS;
+}
+
+
+/*
+ * eq_start: start the event queue system.
+ *
+ * This should be called exactly once. It will start a
+ * thread which wakes up periodically and schedules events.
+ */
+void
+eq_start()
+{
+ PR_ASSERT(eq_initialized);
+ eq_running = 1;
+ if ((eq_loop_tid = PR_CreateThread(PR_USER_THREAD, (VFP)eq_loop,
+ NULL, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD,
+ SLAPD_DEFAULT_THREAD_STACKSIZE)) == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_start", "eq_loop PR_CreateThread failed\n");
+ exit(1);
+ }
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL, "event queue services have started\n");
+}
+
+
+/*
+ * eq_init: initialize the event queue system.
+ *
+ * This function should be called early in server startup.
+ * Once it has been called, the event queue will queue
+ * events, but will not fire any events. Once all of the
+ * server plugins have been started, the eq_start()
+ * function should be called, and events will then start
+ * to fire.
+ */
+void
+eq_init()
+{
+ if (!eq_initialized) {
+ if (PR_SUCCESS != PR_CallOnce(&init_once, eq_create)) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_init", "eq_create failed\n");
+ }
+ }
+}
+
+
+/*
+ * eq_stop: shut down the event queue system.
+ * Does not return until event queue is fully
+ * shut down.
+ */
+void
+eq_stop()
+{
+ slapi_eq_context *p, *q;
+
+ if (NULL == eq || NULL == eq->eq_lock) { /* never started */
+ eq_stopped = 1;
+ return;
+ }
+
+ eq_stopped = 0;
+ eq_running = 0;
+ /*
+ * Signal the eq thread function to stop, and wait until
+ * it acknowledges by setting eq_stopped.
+ */
+ while (!eq_stopped) {
+ PR_Lock(eq->eq_lock);
+ PR_NotifyAllCondVar(eq->eq_cv);
+ PR_Unlock(eq->eq_lock);
+ PR_Lock(ss_lock);
+ PR_WaitCondVar(ss_cv, PR_MillisecondsToInterval(100));
+ PR_Unlock(ss_lock);
+ }
+ (void)PR_JoinThread(eq_loop_tid);
+ /*
+ * XXXggood we don't free the actual event queue data structures.
+ * This is intentional, to allow enqueueing/cancellation of events
+ * even after event queue services have shut down (these are no-ops).
+ * The downside is that the event queue can't be stopped and restarted
+ * easily.
+ */
+ PR_Lock(eq->eq_lock);
+ p = eq->eq_queue;
+ while (p != NULL) {
+ q = p->ec_next;
+ slapi_ch_free((void **)&p);
+ /* Some ec_arg could get leaked here in shutdown (e.g., replica_name)
+ * This can be fixed by specifying a flag when the context is queued.
+ * [After 6.2]
+ */
+ p = q;
+ }
+ PR_Unlock(eq->eq_lock);
+ slapi_log_err(SLAPI_LOG_HOUSE, NULL, "event queue services have shut down\n");
+}
+
+/*
+ * return arg (ec_arg) only if the context is in the event queue
+ */
+void *
+slapi_eq_get_arg(Slapi_Eq_Context ctx)
+{
+ slapi_eq_context **p;
+
+ PR_ASSERT(eq_initialized);
+ if (eq && !eq_stopped) {
+ PR_Lock(eq->eq_lock);
+ p = &(eq->eq_queue);
+ while (p && *p != NULL) {
+ if ((*p)->ec_id == ctx) {
+ PR_Unlock(eq->eq_lock);
+ return (*p)->ec_arg;
+ } else {
+ p = &((*p)->ec_next);
+ }
+ }
+ PR_Unlock(eq->eq_lock);
+ }
+ return NULL;
+}
diff --git a/ldap/servers/slapd/eventq.c b/ldap/servers/slapd/eventq.c
index e1900724f..4c39e08cf 100644
--- a/ldap/servers/slapd/eventq.c
+++ b/ldap/servers/slapd/eventq.c
@@ -17,14 +17,14 @@ eventq.c - Event queue/scheduling system.
There are 3 publicly-accessible entry points:
-slapi_eq_once(): cause an event to happen exactly once
-slapi_eq_repeat(): cause an event to happen repeatedly
-slapi_eq_cancel(): cancel a pending event
+slapi_eq_once_rel(): cause an event to happen exactly once
+slapi_eq_repeat_rel(): cause an event to happen repeatedly
+slapi_eq_cancel_rel(): cancel a pending event
There is also an initialization point which must be
called by the server to initialize the event queue system:
-eq_start(), and an entry point used to shut down the system:
-eq_stop().
+eq_start_rel(), and an entry point used to shut down the system:
+eq_stop_rel().
*********************************************************** */
#include "slap.h"
@@ -60,36 +60,36 @@ typedef struct _event_queue
/*
* The event queue itself.
*/
-static event_queue eqs = {0};
-static event_queue *eq = &eqs;
+static event_queue eqs_rel = {0};
+static event_queue *eq_rel = &eqs_rel;
/*
* Thread ID of the main thread loop
*/
-static PRThread *eq_loop_tid = NULL;
+static PRThread *eq_loop_rel_tid = NULL;
/*
* Flags used to control startup/shutdown of the event queue
*/
-static int eq_running = 0;
-static int eq_stopped = 0;
-static int eq_initialized = 0;
-static pthread_mutex_t ss_lock;
-static pthread_cond_t ss_cv;
-PRCallOnceType init_once = {0};
+static int eq_rel_running = 0;
+static int eq_rel_stopped = 0;
+static int eq_rel_initialized = 0;
+static pthread_mutex_t ss_rel_lock;
+static pthread_cond_t ss_rel_cv;
+PRCallOnceType init_once_rel = {0};
/* Forward declarations */
-static slapi_eq_context *eq_new(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval);
-static void eq_enqueue(slapi_eq_context *newec);
-static slapi_eq_context *eq_dequeue(time_t now);
-static PRStatus eq_create(void);
+static slapi_eq_context *eq_new_rel(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval);
+static void eq_enqueue_rel(slapi_eq_context *newec);
+static slapi_eq_context *eq_dequeue_rel(time_t now);
+static PRStatus eq_create_rel(void);
/* ******************************************************** */
/*
- * slapi_eq_once: cause an event to happen exactly once.
+ * slapi_eq_once_rel: cause an event to happen exactly once.
*
* Arguments:
* fn: the function to call
@@ -101,18 +101,18 @@ static PRStatus eq_create(void);
* event.
*/
Slapi_Eq_Context
-slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when)
+slapi_eq_once_rel(slapi_eq_fn_t fn, void *arg, time_t when)
{
slapi_eq_context *tmp;
- PR_ASSERT(eq_initialized);
- if (!eq_stopped) {
+ PR_ASSERT(eq_rel_initialized);
+ if (!eq_rel_stopped) {
Slapi_Eq_Context id;
- tmp = eq_new(fn, arg, when, 0UL);
+ tmp = eq_new_rel(fn, arg, when, 0UL);
id = tmp->ec_id;
- eq_enqueue(tmp);
+ eq_enqueue_rel(tmp);
/* After this point, <tmp> may have */
/* been freed, depending on the thread */
@@ -128,7 +128,7 @@ slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when)
/*
- * slapi_eq_repeat: cause an event to happen repeatedly.
+ * slapi_eq_repeat_rel: cause an event to happen repeatedly.
*
* Arguments:
* fn: the function to call
@@ -141,13 +141,13 @@ slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when)
* the caller can use to refer to this particular scheduled
*/
Slapi_Eq_Context
-slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
+slapi_eq_repeat_rel(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
{
slapi_eq_context *tmp;
- PR_ASSERT(eq_initialized);
- if (!eq_stopped) {
- tmp = eq_new(fn, arg, when, interval);
- eq_enqueue(tmp);
+ PR_ASSERT(eq_rel_initialized);
+ if (!eq_rel_stopped) {
+ tmp = eq_new_rel(fn, arg, when, interval);
+ eq_enqueue_rel(tmp);
slapi_log_err(SLAPI_LOG_HOUSE, NULL,
"added repeating event id %p at time %ld, interval %lu\n",
tmp->ec_id, when, interval);
@@ -158,20 +158,20 @@ slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval
/*
- * slapi_eq_cancel: cancel a pending event.
+ * slapi_eq_cancel_rel: cancel a pending event.
* Arguments:
* ctx: the context of the event which should be de-scheduled
*/
int
-slapi_eq_cancel(Slapi_Eq_Context ctx)
+slapi_eq_cancel_rel(Slapi_Eq_Context ctx)
{
slapi_eq_context **p, *tmp = NULL;
int found = 0;
- PR_ASSERT(eq_initialized);
- if (!eq_stopped) {
- pthread_mutex_lock(&(eq->eq_lock));
- p = &(eq->eq_queue);
+ PR_ASSERT(eq_rel_initialized);
+ if (!eq_rel_stopped) {
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ p = &(eq_rel->eq_queue);
while (!found && *p != NULL) {
if ((*p)->ec_id == ctx) {
tmp = *p;
@@ -182,7 +182,7 @@ slapi_eq_cancel(Slapi_Eq_Context ctx)
p = &((*p)->ec_next);
}
}
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
}
slapi_log_err(SLAPI_LOG_HOUSE, NULL,
"cancellation of event id %p requested: %s\n",
@@ -195,7 +195,7 @@ slapi_eq_cancel(Slapi_Eq_Context ctx)
* Construct a new ec structure
*/
static slapi_eq_context *
-eq_new(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
+eq_new_rel(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
{
slapi_eq_context *retptr = (slapi_eq_context *)slapi_ch_calloc(1, sizeof(slapi_eq_context));
@@ -218,14 +218,14 @@ eq_new(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval)
* Add a new event to the event queue.
*/
static void
-eq_enqueue(slapi_eq_context *newec)
+eq_enqueue_rel(slapi_eq_context *newec)
{
slapi_eq_context **p;
PR_ASSERT(NULL != newec);
- pthread_mutex_lock(&(eq->eq_lock));
+ pthread_mutex_lock(&(eq_rel->eq_lock));
/* Insert <newec> in order (sorted by start time) in the list */
- for (p = &(eq->eq_queue); *p != NULL; p = &((*p)->ec_next)) {
+ for (p = &(eq_rel->eq_queue); *p != NULL; p = &((*p)->ec_next)) {
if ((*p)->ec_when > newec->ec_when) {
break;
}
@@ -236,8 +236,8 @@ eq_enqueue(slapi_eq_context *newec)
newec->ec_next = NULL;
}
*p = newec;
- pthread_cond_signal(&(eq->eq_cv)); /* wake up scheduler thread */
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_cond_signal(&(eq_rel->eq_cv)); /* wake up scheduler thread */
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
}
@@ -247,16 +247,16 @@ eq_enqueue(slapi_eq_context *newec)
* to it. Otherwise, return NULL.
*/
static slapi_eq_context *
-eq_dequeue(time_t now)
+eq_dequeue_rel(time_t now)
{
slapi_eq_context *retptr = NULL;
- pthread_mutex_lock(&(eq->eq_lock));
- if (NULL != eq->eq_queue && eq->eq_queue->ec_when <= now) {
- retptr = eq->eq_queue;
- eq->eq_queue = retptr->ec_next;
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ if (NULL != eq_rel->eq_queue && eq_rel->eq_queue->ec_when <= now) {
+ retptr = eq_rel->eq_queue;
+ eq_rel->eq_queue = retptr->ec_next;
}
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
return retptr;
}
@@ -268,12 +268,12 @@ eq_dequeue(time_t now)
* by calling the function repeatedly.
*/
static void
-eq_call_all(void)
+eq_call_all_rel(void)
{
slapi_eq_context *p;
time_t curtime = slapi_current_rel_time_t();
- while ((p = eq_dequeue(curtime)) != NULL) {
+ while ((p = eq_dequeue_rel(curtime)) != NULL) {
/* Call the scheduled function */
p->ec_fn(p->ec_when, p->ec_arg);
slapi_log_err(SLAPI_LOG_HOUSE, NULL,
@@ -284,7 +284,7 @@ eq_call_all(void)
do {
p->ec_when += p->ec_interval;
} while (p->ec_when < curtime);
- eq_enqueue(p);
+ eq_enqueue_rel(p);
} else {
slapi_ch_free((void **)&p);
}
@@ -296,38 +296,38 @@ eq_call_all(void)
* The main event queue loop.
*/
static void
-eq_loop(void *arg __attribute__((unused)))
+eq_loop_rel(void *arg __attribute__((unused)))
{
- while (eq_running) {
+ while (eq_rel_running) {
time_t curtime = slapi_current_rel_time_t();
int until;
- pthread_mutex_lock(&(eq->eq_lock));
- while (!((NULL != eq->eq_queue) && (eq->eq_queue->ec_when <= curtime))) {
- if (!eq_running) {
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ while (!((NULL != eq_rel->eq_queue) && (eq_rel->eq_queue->ec_when <= curtime))) {
+ if (!eq_rel_running) {
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
goto bye;
}
/* Compute new timeout */
- if (NULL != eq->eq_queue) {
+ if (NULL != eq_rel->eq_queue) {
struct timespec current_time = slapi_current_rel_time_hr();
- until = eq->eq_queue->ec_when - curtime;
+ until = eq_rel->eq_queue->ec_when - curtime;
current_time.tv_sec += until;
- pthread_cond_timedwait(&eq->eq_cv, &eq->eq_lock, ¤t_time);
+ pthread_cond_timedwait(&eq_rel->eq_cv, &eq_rel->eq_lock, ¤t_time);
} else {
- pthread_cond_wait(&eq->eq_cv, &eq->eq_lock);
+ pthread_cond_wait(&eq_rel->eq_cv, &eq_rel->eq_lock);
}
curtime = slapi_current_rel_time_t();
}
/* There is some work to do */
- pthread_mutex_unlock(&(eq->eq_lock));
- eq_call_all();
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
+ eq_call_all_rel();
}
bye:
- eq_stopped = 1;
- pthread_mutex_lock(&ss_lock);
- pthread_cond_broadcast(&ss_cv);
- pthread_mutex_unlock(&ss_lock);
+ eq_rel_stopped = 1;
+ pthread_mutex_lock(&ss_rel_lock);
+ pthread_cond_broadcast(&ss_rel_cv);
+ pthread_mutex_unlock(&ss_rel_lock);
}
@@ -335,73 +335,73 @@ bye:
* Allocate and initialize the event queue structures.
*/
static PRStatus
-eq_create(void)
+eq_create_rel(void)
{
pthread_condattr_t condAttr;
int rc = 0;
/* Init the eventq mutex and cond var */
- if (pthread_mutex_init(&eq->eq_lock, NULL) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ if (pthread_mutex_init(&eq_rel->eq_lock, NULL) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Failed to create lock: error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
if ((rc = pthread_condattr_init(&condAttr)) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Failed to create new condition attribute variable. error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
if ((rc = pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC)) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Cannot set condition attr clock. error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
- if ((rc = pthread_cond_init(&eq->eq_cv, &condAttr)) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ if ((rc = pthread_cond_init(&eq_rel->eq_cv, &condAttr)) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Failed to create new condition variable. error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
/* Init the "ss" mutex and condition var */
- if (pthread_mutex_init(&ss_lock, NULL) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ if (pthread_mutex_init(&ss_rel_lock, NULL) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Failed to create ss lock: error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
- if ((rc = pthread_cond_init(&ss_cv, &condAttr)) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_create",
+ if ((rc = pthread_cond_init(&ss_rel_cv, &condAttr)) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_create_rel",
"Failed to create new ss condition variable. error %d (%s)\n",
rc, strerror(rc));
exit(1);
}
pthread_condattr_destroy(&condAttr); /* no longer needed */
- eq->eq_queue = NULL;
- eq_initialized = 1;
+ eq_rel->eq_queue = NULL;
+ eq_rel_initialized = 1;
return PR_SUCCESS;
}
/*
- * eq_start: start the event queue system.
+ * eq_start_rel: start the event queue system.
*
* This should be called exactly once. It will start a
* thread which wakes up periodically and schedules events.
*/
void
-eq_start()
+eq_start_rel()
{
- PR_ASSERT(eq_initialized);
- eq_running = 1;
- if ((eq_loop_tid = PR_CreateThread(PR_USER_THREAD, (VFP)eq_loop,
+ PR_ASSERT(eq_rel_initialized);
+ eq_rel_running = 1;
+ if ((eq_loop_rel_tid = PR_CreateThread(PR_USER_THREAD, (VFP)eq_loop_rel,
NULL, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD,
SLAPD_DEFAULT_THREAD_STACKSIZE)) == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_start", "eq_loop PR_CreateThread failed\n");
+ slapi_log_err(SLAPI_LOG_ERR, "eq_start_rel", "eq_loop_rel PR_CreateThread failed\n");
exit(1);
}
slapi_log_err(SLAPI_LOG_HOUSE, NULL, "event queue services have started\n");
@@ -409,55 +409,55 @@ eq_start()
/*
- * eq_init: initialize the event queue system.
+ * eq_init_rel: initialize the event queue system.
*
* This function should be called early in server startup.
* Once it has been called, the event queue will queue
* events, but will not fire any events. Once all of the
- * server plugins have been started, the eq_start()
+ * server plugins have been started, the eq_start_rel()
* function should be called, and events will then start
* to fire.
*/
void
-eq_init()
+eq_init_rel()
{
- if (!eq_initialized) {
- if (PR_SUCCESS != PR_CallOnce(&init_once, eq_create)) {
- slapi_log_err(SLAPI_LOG_ERR, "eq_init", "eq_create failed\n");
+ if (!eq_rel_initialized) {
+ if (PR_SUCCESS != PR_CallOnce(&init_once_rel, eq_create_rel)) {
+ slapi_log_err(SLAPI_LOG_ERR, "eq_init_rel", "eq_create_rel failed\n");
}
}
}
/*
- * eq_stop: shut down the event queue system.
+ * eq_stop_rel: shut down the event queue system.
* Does not return until event queue is fully
* shut down.
*/
void
-eq_stop()
+eq_stop_rel()
{
slapi_eq_context *p, *q;
- if (NULL == eq) { /* never started */
- eq_stopped = 1;
+ if (NULL == eq_rel) { /* never started */
+ eq_rel_stopped = 1;
return;
}
- eq_stopped = 0;
- eq_running = 0;
+ eq_rel_stopped = 0;
+ eq_rel_running = 0;
/*
* Signal the eq thread function to stop, and wait until
- * it acknowledges by setting eq_stopped.
+ * it acknowledges by setting eq_rel_stopped.
*/
- while (!eq_stopped) {
+ while (!eq_rel_stopped) {
struct timespec current_time = {0};
- pthread_mutex_lock(&(eq->eq_lock));
- pthread_cond_broadcast(&(eq->eq_cv));
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ pthread_cond_broadcast(&(eq_rel->eq_cv));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
- pthread_mutex_lock(&ss_lock);
+ pthread_mutex_lock(&ss_rel_lock);
clock_gettime(CLOCK_MONOTONIC, ¤t_time);
if (current_time.tv_nsec + 100000000 > 1000000000) {
/* nanoseconds will overflow, adjust the seconds and nanoseconds */
@@ -467,10 +467,10 @@ eq_stop()
} else {
current_time.tv_nsec += 100000000; /* 100 ms */
}
- pthread_cond_timedwait(&ss_cv, &ss_lock, ¤t_time);
- pthread_mutex_unlock(&ss_lock);
+ pthread_cond_timedwait(&ss_rel_cv, &ss_rel_lock, ¤t_time);
+ pthread_mutex_unlock(&ss_rel_lock);
}
- (void)PR_JoinThread(eq_loop_tid);
+ (void)PR_JoinThread(eq_loop_rel_tid);
/*
* XXXggood we don't free the actual event queue data structures.
* This is intentional, to allow enqueueing/cancellation of events
@@ -478,8 +478,8 @@ eq_stop()
* The downside is that the event queue can't be stopped and restarted
* easily.
*/
- pthread_mutex_lock(&(eq->eq_lock));
- p = eq->eq_queue;
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ p = eq_rel->eq_queue;
while (p != NULL) {
q = p->ec_next;
slapi_ch_free((void **)&p);
@@ -489,7 +489,7 @@ eq_stop()
*/
p = q;
}
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
slapi_log_err(SLAPI_LOG_HOUSE, NULL, "event queue services have shut down\n");
}
@@ -497,23 +497,23 @@ eq_stop()
* return arg (ec_arg) only if the context is in the event queue
*/
void *
-slapi_eq_get_arg(Slapi_Eq_Context ctx)
+slapi_eq_get_arg_rel(Slapi_Eq_Context ctx)
{
slapi_eq_context **p;
- PR_ASSERT(eq_initialized);
- if (eq && !eq_stopped) {
- pthread_mutex_lock(&(eq->eq_lock));
- p = &(eq->eq_queue);
+ PR_ASSERT(eq_rel_initialized);
+ if (eq_rel && !eq_rel_stopped) {
+ pthread_mutex_lock(&(eq_rel->eq_lock));
+ p = &(eq_rel->eq_queue);
while (p && *p != NULL) {
if ((*p)->ec_id == ctx) {
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
return (*p)->ec_arg;
} else {
p = &((*p)->ec_next);
}
}
- pthread_mutex_unlock(&(eq->eq_lock));
+ pthread_mutex_unlock(&(eq_rel->eq_lock));
}
return NULL;
}
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 88313f891..73e1e4c44 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -988,7 +988,8 @@ main(int argc, char **argv)
fedse_create_startOK(DSE_FILENAME, DSE_STARTOKFILE,
slapdFrontendConfig->configdir);
- eq_init(); /* must be done before plugins started */
+ eq_init(); /* DEPRECATED */
+ eq_init_rel(); /* must be done before plugins started */
/* Start the SNMP collator if counters are enabled. */
if (config_get_slapi_counters()) {
@@ -1058,7 +1059,8 @@ main(int argc, char **argv)
goto cleanup;
}
- eq_start(); /* must be done after plugins started */
+ eq_start(); /* must be done after plugins started - DEPRECATED */
+ eq_start_rel(); /* must be done after plugins started */
#ifdef HPUX10
/* HPUX linker voodoo */
@@ -2244,10 +2246,13 @@ slapd_exemode_db2ldif(int argc, char **argv, struct main_config *mcfg)
*/
plugin_get_plugin_dependencies(repl_plg_name, &plugin_list);
- eq_init(); /* must be done before plugins started */
+ eq_init(); /* must be done before plugins started - DEPRECATED */
+ eq_init_rel(); /* must be done before plugins started */
+
ps_init_psearch_system(); /* must come before plugin_startall() */
plugin_startall(argc, argv, plugin_list);
- eq_start(); /* must be done after plugins started */
+ eq_start(); /* must be done after plugins started - DEPRECATED*/
+ eq_start_rel(); /* must be done after plugins started */
charray_free(plugin_list);
}
@@ -2302,8 +2307,9 @@ slapd_exemode_db2ldif(int argc, char **argv, struct main_config *mcfg)
charray_free(mcfg->cmd_line_instance_names);
charray_free(mcfg->db2ldif_include);
if (mcfg->db2ldif_dump_replica) {
- eq_stop(); /* event queue should be shutdown before closing
- all plugins (especailly, replication plugin) */
+ eq_stop(); /* DEPRECATED*/
+ eq_stop_rel(); /* event queue should be shutdown before closing
+ all plugins (especially, replication plugin) */
plugin_closeall(1 /* Close Backends */, 1 /* Close Globals */);
}
return (return_value);
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 2c202b946..d624fca0c 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1328,7 +1328,6 @@ void factory_destroy_extension(int type, void *object, void *parent, void **exte
/*
* auditlog.c
*/
-
void write_audit_log_entry(Slapi_PBlock *pb);
void auditlog_hide_unhashed_pw(void);
void auditlog_expose_unhashed_pw(void);
@@ -1340,10 +1339,15 @@ void auditfaillog_expose_unhashed_pw(void);
/*
* eventq.c
*/
+void eq_init_rel(void);
+void eq_start_rel(void);
+void eq_stop_rel(void);
+/* Deprecated eventq that uses REALTIME clock instead of MONOTONIC */
void eq_init(void);
void eq_start(void);
void eq_stop(void);
+
/*
* uniqueidgen.c
*/
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 5c7486a29..3a28ed0c3 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6087,7 +6087,7 @@ void slapi_lock_mutex(Slapi_Mutex *mutex);
int slapi_unlock_mutex(Slapi_Mutex *mutex);
Slapi_CondVar *slapi_new_condvar(Slapi_Mutex *mutex);
void slapi_destroy_condvar(Slapi_CondVar *cvar);
-int slapi_wait_condvar(Slapi_CondVar *cvar, struct timeval *timeout);
+int slapi_wait_condvar(Slapi_CondVar *cvar, struct timeval *timeout) __attribute__((deprecated));
int slapi_notify_condvar(Slapi_CondVar *cvar, int notify_all);
int slapi_wait_condvar_pt(Slapi_CondVar *cvar, Slapi_Mutex *mutex, struct timeval *timeout);
@@ -8084,24 +8084,24 @@ typedef void (*slapi_eq_fn_t)(time_t when, void *arg);
*
* \param fn The function to call when the event is triggered.
* \param arg An argument to pass to the called function.
- * \param when The time that the function should be called.
+ * \param when The time that the function should be called(MONOTONIC clock).
*
* \return slapi_eq_context
*/
-Slapi_Eq_Context slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when);
+Slapi_Eq_Context slapi_eq_once_rel(slapi_eq_fn_t fn, void *arg, time_t when);
/**
* Cause an event to happen repeatedly.
*
* \param fn The function to call when the vent is triggered.
* \param arg An argument to pass to the called function.
- * \param when The time that the function should be called.
+ * \param when The time that the function should be called(MONOTONIC clock).
* \param interval The amount of time (in milliseconds) between
* successive calls to the function.
*
* \return slapi_eq_context
*/
-Slapi_Eq_Context slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval);
+Slapi_Eq_Context slapi_eq_repeat_rel(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval);
/**
* Cause a scheduled event to be canceled.
@@ -8111,7 +8111,7 @@ Slapi_Eq_Context slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsig
* \return 1 If event was found and canceled.
* \return 0 If event was not found in the queue.
*/
-int slapi_eq_cancel(Slapi_Eq_Context ctx);
+int slapi_eq_cancel_rel(Slapi_Eq_Context ctx);
/**
* Return the event's argument.
@@ -8120,7 +8120,55 @@ int slapi_eq_cancel(Slapi_Eq_Context ctx);
*
* \return A pointer to the event argument.
*/
-void *slapi_eq_get_arg(Slapi_Eq_Context ctx);
+void *slapi_eq_get_arg_rel(Slapi_Eq_Context ctx);
+
+/*
+ * These event queue functions are now DEPRECATED as they REALTIME clocks
+ * instead of the preferred MONOTONIC clocks.
+ */
+
+/**
+ * Cause an event to happen exactly once.
+ *
+ * \param fn The function to call when the event is triggered.
+ * \param arg An argument to pass to the called function.
+ * \param when The time that the function should be called(REALTIME clock).
+ *
+ * \return slapi_eq_context
+ */
+Slapi_Eq_Context slapi_eq_once(slapi_eq_fn_t fn, void *arg, time_t when) __attribute__((deprecated));
+
+/**
+ * Cause an event to happen repeatedly.
+ *
+ * \param fn The function to call when the vent is triggered.
+ * \param arg An argument to pass to the called function.
+ * \param when The time that the function should be called(REALTIME clock).
+ * \param interval The amount of time (in milliseconds) between
+ * successive calls to the function.
+ *
+ * \return slapi_eq_context
+ */
+Slapi_Eq_Context slapi_eq_repeat(slapi_eq_fn_t fn, void *arg, time_t when, unsigned long interval) __attribute__((deprecated));
+
+/**
+ * Cause a scheduled event to be canceled.
+ *
+ * \param ctx The event object to cancel
+ *
+ * \return 1 If event was found and canceled.
+ * \return 0 If event was not found in the queue.
+ */
+int slapi_eq_cancel(Slapi_Eq_Context ctx) __attribute__((deprecated));
+
+/**
+ * Return the event's argument.
+ *
+ * \param ctx The event object
+ *
+ * \return A pointer to the event argument.
+ */
+void *slapi_eq_get_arg(Slapi_Eq_Context ctx) __attribute__((deprecated));
/**
* Construct a full path and name of a plugin.
diff --git a/ldap/servers/slapd/slapi2runtime.c b/ldap/servers/slapd/slapi2runtime.c
index 3fc78fca9..c957440dd 100644
--- a/ldap/servers/slapd/slapi2runtime.c
+++ b/ldap/servers/slapd/slapi2runtime.c
@@ -133,7 +133,7 @@ slapi_destroy_condvar(Slapi_CondVar *cvar)
/*
- * Function: slapi_wait_condvar
+ * Function: slapi_wait_condvar (DEPRECATED)
* Description: behaves just like PR_WaitCondVar() except timeout is
* in seconds and microseconds instead of PRIntervalTime units.
* If timeout is NULL, this call blocks indefinitely.
@@ -145,9 +145,26 @@ slapi_destroy_condvar(Slapi_CondVar *cvar)
int
slapi_wait_condvar(Slapi_CondVar *cvar, struct timeval *timeout)
{
- /* deprecated in favor of slapi_wait_condvar_pt() which requires that the
+ /* Deprecated in favor of slapi_wait_condvar_pt() which requires that the
* mutex be passed in */
- return (0);
+ PRIntervalTime prit;
+
+ if (cvar == NULL) {
+ return (0);
+ }
+
+ if (timeout == NULL) {
+ prit = PR_INTERVAL_NO_TIMEOUT;
+ } else {
+ prit = PR_SecondsToInterval(timeout->tv_sec) + PR_MicrosecondsToInterval(timeout->tv_usec);
+ }
+
+ if (PR_WaitCondVar((PRCondVar *)cvar, prit) != PR_SUCCESS) {
+ return (0);
+ }
+
+ return (1);
+
}
int
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 3dd3af657..d760515f4 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -385,8 +385,9 @@ snmp_collator_start()
snmp_collator_init();
/* Arrange to be called back periodically to update the mmap'd stats file. */
- snmp_eq_ctx = slapi_eq_repeat(snmp_collator_update, NULL, (time_t)0,
- SLAPD_SNMP_UPDATE_INTERVAL);
+ snmp_eq_ctx = slapi_eq_repeat_rel(snmp_collator_update, NULL,
+ slapi_current_rel_time_t(),
+ SLAPD_SNMP_UPDATE_INTERVAL);
return 0;
}
@@ -411,7 +412,7 @@ snmp_collator_stop()
}
/* Abort any pending events */
- slapi_eq_cancel(snmp_eq_ctx);
+ slapi_eq_cancel_rel(snmp_eq_ctx);
snmp_collator_stopped = 1;
/* acquire the semaphore */
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index a44b24930..672726f9c 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -384,7 +384,7 @@ slapi_task_status_changed(Slapi_Task *task)
ttl = (24*3600); /* be reasonable, allow to check task status not longer than one day */
task->task_flags |= SLAPI_TASK_DESTROYING;
/* queue an event to destroy the state info */
- slapi_eq_once(destroy_task, (void *)task, slapi_current_rel_time_t() + ttl);
+ slapi_eq_once_rel(destroy_task, (void *)task, slapi_current_rel_time_t() + ttl);
}
slapi_free_search_results_internal(pb);
slapi_pblock_destroy(pb);
diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c
index a8bd6ee6c..31384a544 100644
--- a/ldap/servers/slapd/uuid.c
+++ b/ldap/servers/slapd/uuid.c
@@ -186,7 +186,8 @@ uuid_init(const char *configDir, const Slapi_DN *configDN, PRBool mtGen)
/* schedule update task for multithreaded generation */
if (_state.mtGen)
- slapi_eq_repeat(uuid_update_state, NULL, (time_t)0, UPDATE_INTERVAL);
+ slapi_eq_repeat_rel(uuid_update_state, NULL, slapi_current_rel_time_t(),
+ UPDATE_INTERVAL);
_state.initialized = PR_TRUE;
return UUID_SUCCESS;
| 0 |
33c33e1cfde3580cb74a7b69bf8c5e3545362c0b
|
389ds/389-ds-base
|
Resolves: bug 250179
Description: tmpwatch whacks stats
Reviewed by: nkinder (Thanks!)
Fix Description: move the snmp slapd.stats file to run_dir (/var/run/dirsrv) and rename to slapd-instance.stats. Had to add nsslapd-rundir to cn=config in order for ldap-agent to be able to get it.
Doc: Yes, we need to document the new attribute nsslapd-rundir.
|
commit 33c33e1cfde3580cb74a7b69bf8c5e3545362c0b
Author: Rich Megginson <[email protected]>
Date: Thu Oct 18 01:22:29 2007 +0000
Resolves: bug 250179
Description: tmpwatch whacks stats
Reviewed by: nkinder (Thanks!)
Fix Description: move the snmp slapd.stats file to run_dir (/var/run/dirsrv) and rename to slapd-instance.stats. Had to add nsslapd-rundir to cn=config in order for ldap-agent to be able to get it.
Doc: Yes, we need to document the new attribute nsslapd-rundir.
diff --git a/ldap/admin/src/scripts/dscreate.map.in b/ldap/admin/src/scripts/dscreate.map.in
index a475416a3..7cb13f942 100644
--- a/ldap/admin/src/scripts/dscreate.map.in
+++ b/ldap/admin/src/scripts/dscreate.map.in
@@ -65,3 +65,4 @@ inst_dir = inst_dir
log_dir = log_dir
config_dir = config_dir
db_dir = db_dir
+run_dir = run_dir
diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in
index ba064d8e2..c9b4556f4 100644
--- a/ldap/ldif/template-dse.ldif.in
+++ b/ldap/ldif/template-dse.ldif.in
@@ -9,6 +9,7 @@ nsslapd-tmpdir: %tmp_dir%
nsslapd-certdir: %cert_dir%
nsslapd-ldifdir: %ldif_dir%
nsslapd-bakdir: %bak_dir%
+nsslapd-rundir: %run_dir%
nsslapd-instancedir: %inst_dir%
nsslapd-accesslog-logging-enabled: on
nsslapd-accesslog-maxlogsperdir: 10
diff --git a/ldap/servers/slapd/agtmmap.h b/ldap/servers/slapd/agtmmap.h
index 4ee660a8c..e329324db 100644
--- a/ldap/servers/slapd/agtmmap.h
+++ b/ldap/servers/slapd/agtmmap.h
@@ -79,7 +79,8 @@ extern int errno;
#if !defined(_MAX_PATH)
#define _MAX_PATH 256
#endif
-#define AGT_STATS_FILE "slapd.stats"
+#define AGT_STATS_EXTENSION ".stats"
+#define AGT_STATS_FILE "slapd" AGT_STATS_EXTENSION
#define AGT_MJR_VERSION 1
#define AGT_MNR_VERSION 0
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 27075140e..21ffa4c24 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -573,6 +573,10 @@ static struct config_get_and_set {
{CONFIG_SASLPATH_ATTRIBUTE, config_set_saslpath,
NULL, 0,
(void**)&global_slapdFrontendConfig.saslpath, CONFIG_STRING, (ConfigGetFunc)config_get_saslpath},
+ /* parameterizing run dir */
+ {CONFIG_RUNDIR_ATTRIBUTE, config_set_rundir,
+ NULL, 0,
+ (void**)&global_slapdFrontendConfig.rundir, CONFIG_STRING, (ConfigGetFunc)config_get_rundir},
{CONFIG_REWRITE_RFC1274_ATTRIBUTE, config_set_rewrite_rfc1274,
NULL, 0,
(void**)&global_slapdFrontendConfig.rewrite_rfc1274, CONFIG_ON_OFF, NULL},
@@ -4728,6 +4732,43 @@ config_set_bakdir(const char *attrname, char *value, char *errorbuf, int apply)
CFG_UNLOCK_WRITE(slapdFrontendConfig);
return retVal;
}
+
+char *
+config_get_rundir()
+{
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ char *retVal;
+
+ CFG_LOCK_READ(slapdFrontendConfig);
+ retVal = config_copy_strval(slapdFrontendConfig->rundir);
+ CFG_UNLOCK_READ(slapdFrontendConfig);
+
+ return retVal;
+}
+
+int
+config_set_rundir(const char *attrname, char *value, char *errorbuf, int apply)
+{
+ int retVal = LDAP_SUCCESS;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+ if ( config_value_is_null( attrname, value, errorbuf, 0 )) {
+ return LDAP_OPERATIONS_ERROR;
+ }
+
+ if (!apply) {
+ return retVal;
+ }
+
+ CFG_LOCK_WRITE(slapdFrontendConfig);
+ slapi_ch_free((void **)&slapdFrontendConfig->rundir);
+
+ slapdFrontendConfig->rundir = slapi_ch_strdup(value);
+
+ CFG_UNLOCK_WRITE(slapdFrontendConfig);
+ return retVal;
+}
+
char *
config_get_saslpath()
{
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 571f4edc0..b27b74b43 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -326,6 +326,7 @@ int config_set_tmpdir( const char *attrname, char *value, char *errorbuf, int ap
int config_set_certdir( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_ldifdir( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_bakdir( const char *attrname, char *value, char *errorbuf, int apply );
+int config_set_rundir( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_saslpath( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_attrname_exceptions( const char *attrname, char *value, char *errorbuf, int apply );
int config_set_hash_filters( const char *attrname, char *value, char *errorbuf, int apply );
@@ -438,6 +439,7 @@ char *config_get_tmpdir();
char *config_get_certdir();
char *config_get_ldifdir();
char *config_get_bakdir();
+char *config_get_rundir();
char *config_get_saslpath();
char **config_get_errorlog_list();
char **config_get_accesslog_list();
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index f10e8fb27..f1777eb88 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1727,6 +1727,7 @@ typedef struct _slapdEntryPoints {
#define CONFIG_LDIFDIR_ATTRIBUTE "nsslapd-ldifdir"
#define CONFIG_BAKDIR_ATTRIBUTE "nsslapd-bakdir"
#define CONFIG_SASLPATH_ATTRIBUTE "nsslapd-saslpath"
+#define CONFIG_RUNDIR_ATTRIBUTE "nsslapd-rundir"
#define CONFIG_SSLCLIENTAUTH_ATTRIBUTE "nsslapd-SSLclientAuth"
#define CONFIG_SSL_CHECK_HOSTNAME_ATTRIBUTE "nsslapd-ssl-check-hostname"
#define CONFIG_HASH_FILTERS_ATTRIBUTE "nsslapd-hash-filters"
@@ -1906,6 +1907,7 @@ typedef struct _slapdFrontendConfig {
char *certdir; /* full path name of directory containing cert files */
char *ldifdir; /* full path name of directory containing ldif files */
char *bakdir; /* full path name of directory containing bakup files */
+ char *rundir; /* where pid, snmp stats, and ldapi files go */
char *saslpath; /* full path name of directory containing sasl plugins */
int attrname_exceptions; /* if true, allow questionable attribute names */
int rewrite_rfc1274; /* return attrs for both v2 and v3 names */
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 016b55c89..0aadf9b6e 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -60,6 +60,7 @@
#include "prlock.h"
#include "prerror.h"
#include "prcvar.h"
+#include "plstr.h"
#include "snmp_collator.h"
#include "../snmp/ntagt/nslagtcom_nt.h"
@@ -397,8 +398,10 @@ int snmp_collator_start()
{
int err;
- char *statspath = config_get_tmpdir();
+ char *statspath = config_get_rundir();
char *lp = NULL;
+ char *instdir = config_get_configdir();
+ char *instname = NULL;
/*
* Get directory for our stats file
@@ -407,10 +410,18 @@ int snmp_collator_start()
statspath = slapi_ch_strdup("/tmp");
}
- PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s",
- statspath, AGT_STATS_FILE);
+ instname = PL_strrstr(instdir, "slapd-");
+ if (!instname) {
+ instname = PL_strrstr(instdir, "/");
+ if (instname) {
+ instname++;
+ }
+ }
+ PR_snprintf(szStatsFile, sizeof(szStatsFile), "%s/%s%s",
+ statspath, instname, AGT_STATS_EXTENSION);
tmpstatsfile = szStatsFile;
- slapi_ch_free((void **) &statspath);
+ slapi_ch_free_string(&statspath);
+ slapi_ch_free_string(&instname);
/* open the memory map */
if ((err = agt_mopen_stats(tmpstatsfile, O_RDWR, &hdl) != 0))
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
index 6648776e1..8200d04db 100644
--- a/ldap/servers/snmp/main.c
+++ b/ldap/servers/snmp/main.c
@@ -318,6 +318,7 @@ load_config(char *conf_path)
int got_tmpdir = 0;
int lineno = 0;
char *entry = NULL;
+ char *instancename = NULL;
/* Allocate a server_instance */
if ((serv_p = malloc(sizeof(server_instance))) == NULL) {
@@ -330,6 +331,7 @@ load_config(char *conf_path)
p = p + 6;
if ((p = strtok(p, " \t\n")) != NULL) {
/* first token is the instance name */
+ instancename = strdup(p);
serv_p->dse_ldif = malloc(strlen(p) + strlen(SYSCONFDIR) +
strlen(PACKAGE_NAME) + 12);
if (serv_p->dse_ldif != NULL) {
@@ -341,6 +343,8 @@ load_config(char *conf_path)
} else {
printf("ldap-agent: malloc error processing config file\n");
error = 1;
+ free(instancename);
+ instancename = NULL;
goto close_and_exit;
}
}
@@ -350,6 +354,8 @@ load_config(char *conf_path)
printf("ldap-agent: Error opening server config file: %s\n",
serv_p->dse_ldif);
error = 1;
+ free(instancename);
+ instancename = NULL;
goto close_and_exit;
}
@@ -376,16 +382,18 @@ load_config(char *conf_path)
if (strcmp(attr, "nsslapd-port") == 0) {
serv_p->port = atol(val);
got_port = 1;
- } else if (strcmp(attr, "nsslapd-tmpdir") == 0) {
+ } else if (strcmp(attr, "nsslapd-rundir") == 0) {
serv_p->stats_file = malloc(vlen + 13);
if (serv_p->stats_file != NULL) {
snprintf(serv_p->stats_file, vlen + 13,
- "%s/slapd.stats", val);
+ "%s/%s.stats", instancename, val);
serv_p->stats_file[(vlen + 12)] = (char)0;
} else {
printf("ldap-agent: malloc error processing config file\n");
free(entry);
error = 1;
+ free(instancename);
+ instancename = NULL;
goto close_and_exit;
}
got_tmpdir = 1;
@@ -404,6 +412,8 @@ load_config(char *conf_path)
}
}
+ free(instancename);
+ instancename = NULL;
/* We're done reading entries from dse_ldif now, so
* we can free entry */
free(entry);
| 0 |
b170243e77ee7609529e6d34216d2c6478ab4d45
|
389ds/389-ds-base
|
Ticket #47536 - Allow usage of OpenLDAP libraries that don't use NSS for crypto
Design Doc: http://www.port389.org/docs/389ds/design/allow-usage-of-openldap-lib-w-openssl.html
This patch also addresses the issue described in
Ticket #48756 - if startTLS is enabled, perl utilities fail to start.
The ticket #48756 is closed as dup of Ticket #47536.
Note: Instead of checking with "OpenSSL" for the openldap client library,
this patch checks with "Not MozNSS" for non-Fedora/RHEL platform support.
https://fedorahosted.org/389/ticket/47536
Reviewed by [email protected] (Thank you, William!!!)
|
commit b170243e77ee7609529e6d34216d2c6478ab4d45
Author: Noriko Hosoi <[email protected]>
Date: Thu Apr 14 13:42:34 2016 -0700
Ticket #47536 - Allow usage of OpenLDAP libraries that don't use NSS for crypto
Design Doc: http://www.port389.org/docs/389ds/design/allow-usage-of-openldap-lib-w-openssl.html
This patch also addresses the issue described in
Ticket #48756 - if startTLS is enabled, perl utilities fail to start.
The ticket #48756 is closed as dup of Ticket #47536.
Note: Instead of checking with "OpenSSL" for the openldap client library,
this patch checks with "Not MozNSS" for non-Fedora/RHEL platform support.
https://fedorahosted.org/389/ticket/47536
Reviewed by [email protected] (Thank you, William!!!)
diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in
index 983070349..3476d67f6 100644
--- a/ldap/admin/src/scripts/DSUtil.pm.in
+++ b/ldap/admin/src/scripts/DSUtil.pm.in
@@ -1251,6 +1251,19 @@ sub get_info {
$info{ldapiURL} = "ldapi://" . $value;
}
+ while($entry = readOneEntry $ldif){
+ if($entry->getDN() eq "cn=encryption,cn=config"){
+ $foundcfg = "yes";
+ last;
+ }
+ }
+ if($foundcfg eq "yes"){
+ $info{cacertfile} = $entry->getValues("CACertExtractFile");
+ if ($info{cacertfile}) {
+ $ENV{LDAPTLS_CACERT}=$info{cacertfile};
+ }
+ }
+
close (DSE);
return %info;
}
diff --git a/ldap/schema/01core389.ldif b/ldap/schema/01core389.ldif
index 5628e99d5..e620e74ee 100644
--- a/ldap/schema/01core389.ldif
+++ b/ldap/schema/01core389.ldif
@@ -103,6 +103,9 @@ attributeTypes: ( allowWeakCipher-oid NAME 'allowWeakCipher' DESC 'Netscape defi
attributeTypes: ( nsSSLToken-oid NAME 'nsSSLToken' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
attributeTypes: ( nsSSLPersonalitySSL-oid NAME 'nsSSLPersonalitySSL' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
attributeTypes: ( nsSSLActivation-oid NAME 'nsSSLActivation' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
+attributeTypes: ( CACertExtractFile-oid NAME 'CACertExtractFile' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
+attributeTypes: ( ServerKeyExtractFile-oid NAME 'ServerKeyExtractFile' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
+attributeTypes: ( ServerCertExtractFile-oid NAME 'ServerCertExtractFile' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
attributeTypes: ( 2.16.840.1.113730.3.1.2091 NAME 'nsslapd-suffix' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Netscape' )
attributeTypes: ( 2.16.840.1.113730.3.1.2092 NAME 'nsslapd-ldapiautodnsuffix' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Netscape' )
attributeTypes: ( 2.16.840.1.113730.3.1.2095 NAME 'connection' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape' )
@@ -308,8 +311,8 @@ objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC
objectClasses: ( 2.16.840.1.113730.3.2.39 NAME 'nsslapdConfig' DESC 'Netscape defined objectclass' SUP top MAY ( cn ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.317 NAME 'nsSaslMapping' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSaslMapRegexString $ nsSaslMapBaseDNTemplate $ nsSaslMapFilterTemplate ) MAY ( nsSaslMapPriority ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.43 NAME 'nsSNMP' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSNMPEnabled ) MAY ( nsSNMPOrganization $ nsSNMPLocation $ nsSNMPContact $ nsSNMPDescription $ nsSNMPName $ nsSNMPMasterHost $ nsSNMPMasterPort ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( nsEncryptionConfig-oid NAME 'nsEncryptionConfig' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsCertfile $ nsKeyfile $ nsSSL2 $ nsSSL3 $ nsTLS1 $ sslVersionMin $ sslVersionMax $ nsSSLSessionTimeout $ nsSSL3SessionTimeout $ nsSSLClientAuth $ nsSSL2Ciphers $ nsSSL3Ciphers $ nsSSLSupportedCiphers $ allowWeakCipher) X-ORIGIN 'Netscape' )
-objectClasses: ( nsEncryptionModule-oid NAME 'nsEncryptionModule' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsSSLToken $ nsSSLPersonalityssl $ nsSSLActivation ) X-ORIGIN 'Netscape' )
+objectClasses: ( nsEncryptionConfig-oid NAME 'nsEncryptionConfig' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsCertfile $ nsKeyfile $ nsSSL2 $ nsSSL3 $ nsTLS1 $ sslVersionMin $ sslVersionMax $ nsSSLSessionTimeout $ nsSSL3SessionTimeout $ nsSSLClientAuth $ nsSSL2Ciphers $ nsSSL3Ciphers $ nsSSLSupportedCiphers $ allowWeakCipher $ CACertExtractFile ) X-ORIGIN 'Netscape' )
+objectClasses: ( nsEncryptionModule-oid NAME 'nsEncryptionModule' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsSSLToken $ nsSSLPersonalityssl $ nsSSLActivation $ ServerKeyExtractFile $ ServerCertExtractFile ) X-ORIGIN 'Netscape' )
objectClasses: ( 2.16.840.1.113730.3.2.327 NAME 'rootDNPluginConfig' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( rootdn-open-time $ rootdn-close-time $ rootdn-days-allowed $ rootdn-allow-host $ rootdn-deny-host $ rootdn-allow-ip $ rootdn-deny-ip ) X-ORIGIN 'Netscape' )
objectClasses: ( 2.16.840.1.113730.3.2.328 NAME 'nsSchemaPolicy' DESC 'Netscape defined objectclass' SUP top MAY ( cn $ schemaUpdateObjectclassAccept $ schemaUpdateObjectclassReject $ schemaUpdateAttributeAccept $ schemaUpdateAttributeReject) X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index d19393897..88f2a1db2 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -1234,9 +1234,9 @@ conn_connect(Repl_Connection *conn)
* initialisation should be done before ever trying to open any connection at all.
*/
if (conn->transport_flags == TRANSPORT_FLAG_TLS) {
- secure = 2;
+ secure = SLAPI_LDAP_INIT_FLAG_startTLS;
} else if (conn->transport_flags == TRANSPORT_FLAG_SSL) {
- secure = 1;
+ secure = SLAPI_LDAP_INIT_FLAG_SSL;
}
if (secure > 0) {
@@ -1261,7 +1261,7 @@ conn_connect(Repl_Connection *conn)
"%s: Trying %s%s slapi_ldap_init_ext\n",
agmt_get_long_name(conn->agmt),
secure ? "secure" : "non-secure",
- (secure == 2) ? " startTLS" : "");
+ (secure == SLAPI_LDAP_INIT_FLAG_startTLS) ? " startTLS" : "");
/* shared = 1 because we will read results from a second thread */
if (conn->ld) {
/* Since we call slapi_ldap_init, we must call slapi_ldap_unbind */
@@ -1279,7 +1279,7 @@ conn_connect(Repl_Connection *conn)
"%s: Failed to establish %s%sconnection to the consumer\n",
agmt_get_long_name(conn->agmt),
secure ? "secure " : "",
- (secure == 2) ? "startTLS " : "");
+ (secure == SLAPI_LDAP_INIT_FLAG_startTLS) ? "startTLS " : "");
goto done;
}
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index a06a07ecd..cab371526 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -1313,9 +1313,9 @@ windows_conn_connect(Repl_Connection *conn)
* initialisation should be done before ever trying to open any connection at all.
*/
if (conn->transport_flags == TRANSPORT_FLAG_TLS) {
- secure = 2;
+ secure = SLAPI_LDAP_INIT_FLAG_startTLS;
} else if (conn->transport_flags == TRANSPORT_FLAG_SSL) {
- secure = 1;
+ secure = SLAPI_LDAP_INIT_FLAG_SSL;
}
if (secure > 0) {
@@ -1340,7 +1340,7 @@ windows_conn_connect(Repl_Connection *conn)
"%s: Trying %s%s slapi_ldap_init_ext\n",
agmt_get_long_name(conn->agmt),
secure ? "secure" : "non-secure",
- (secure == 2) ? " startTLS" : "");
+ (secure == SLAPI_LDAP_INIT_FLAG_startTLS) ? " startTLS" : "");
conn->ld = slapi_ldap_init_ext(NULL, conn->hostname, conn->port, secure, 0, NULL);
if (NULL == conn->ld)
@@ -1353,7 +1353,7 @@ windows_conn_connect(Repl_Connection *conn)
"%s: Failed to establish %s%sconnection to the consumer\n",
agmt_get_long_name(conn->agmt),
secure ? "secure " : "",
- (secure == 2) ? "startTLS " : "");
+ (secure == SLAPI_LDAP_INIT_FLAG_startTLS) ? "startTLS " : "");
goto done;
}
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 8a54cb9c2..138be1ed3 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -575,6 +575,7 @@ setup_ol_tls_conn(LDAP *ld, int clientauth)
int optval = 0;
int ssl_strength = 0;
int rc = 0;
+ const char *cacert = NULL;
if (config_get_ssl_check_hostname()) {
ssl_strength = LDAP_OPT_X_TLS_HARD;
@@ -587,7 +588,29 @@ setup_ol_tls_conn(LDAP *ld, int clientauth)
slapi_log_error(SLAPI_LOG_FATAL, "setup_ol_tls_conn",
"failed: unable to set REQUIRE_CERT option to %d\n", ssl_strength);
}
- /* tell it where our cert db is */
+ if (slapi_client_uses_non_nss(ld)) {
+ cacert = slapi_get_cacertfile();
+ if (cacert) {
+ /* CA Cert PEM file exists. Set the path to openldap option. */
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CACERTFILE, cacert);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, "setup_ol_tls_conn",
+ "Could not set CA cert path [%s]: %d:%s\n",
+ cacert, rc, ldap_err2string(rc));
+ }
+ }
+ if (slapi_client_uses_openssl(ld)) {
+ const int crlcheck = LDAP_OPT_X_TLS_CRL_ALL;
+ /* Sets the CRL evaluation strategy. */
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CRLCHECK, &crlcheck);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, "setup_ol_tls_conn",
+ "Could not set CRLCHECK [%d]: %d:%s\n",
+ crlcheck, rc, ldap_err2string(rc));
+ }
+ }
+ }
+ /* tell it where our cert db/file is */
if ((rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CACERTDIR, certdir))) {
slapi_log_error(SLAPI_LOG_FATAL, "setup_ol_tls_conn",
"failed: unable to set CACERTDIR option to %s\n", certdir);
@@ -635,8 +658,8 @@ setup_ol_tls_conn(LDAP *ld, int clientauth)
on the secure setting (389 for ldap, 636 for ldaps, 389 for starttls)
secure takes 1 of 3 values - 0 means regular ldap, 1 means ldaps, 2
means regular ldap with starttls.
- filename is the ldapi file name - if this is given, and no other options
- are given, ldapi is assumed.
+ ldapi_socket is the ldapi file name
+ if this is given, and no other options are given, ldapi is assumed.
*/
/* util_sasl_path: the string argument for putenv.
It must be a global or a static */
@@ -646,12 +669,12 @@ LDAP *
slapi_ldap_init_ext(
const char *ldapurl, /* full ldap url */
const char *hostname, /* can also use this to override
- host in url */
+ host in url */
int port, /* can also use this to override port in url */
int secure, /* 0 for ldap, 1 for ldaps, 2 for starttls -
- override proto in url */
+ override proto in url */
int shared, /* if true, LDAP* will be shared among multiple threads */
- const char *filename /* for ldapi */
+ const char *ldapi_socket /* for ldapi */
)
{
LDAPURLDesc *ludp = NULL;
@@ -705,16 +728,16 @@ slapi_ldap_init_ext(
/* use secure setting from url if none given */
if (!secure && ludp) {
if (secureurl) {
- secure = 1;
+ secure = SLAPI_LDAP_INIT_FLAG_SSL;
} else if (0/* starttls option - not supported yet in LDAP URLs */) {
- secure = 2;
+ secure = SLAPI_LDAP_INIT_FLAG_startTLS;
}
}
/* ldap_url_parse doesn't yet handle ldapi */
/*
- if (!filename && ludp && ludp->lud_file) {
- filename = ludp->lud_file;
+ if (!ldapi_socket && ludp && ludp->lud_file) {
+ ldapi_socket = ludp->lud_file;
}
*/
@@ -762,10 +785,11 @@ slapi_ldap_init_ext(
} else {
char *makeurl = NULL;
- if (filename) {
- makeurl = slapi_ch_smprintf("ldapi://%s/", filename);
+ if (ldapi_socket) {
+ makeurl = slapi_ch_smprintf("ldapi://%s/", ldapi_socket);
} else { /* host port */
- makeurl = convert_to_openldap_uri(hostname, port, (secure == 1 ? "ldaps" : "ldap"));
+ makeurl = convert_to_openldap_uri(hostname, port,
+ (secure == SLAPI_LDAP_INIT_FLAG_SSL ? "ldaps" : "ldap"));
}
if (PR_SUCCESS != PR_CallOnce(&ol_init_callOnce, internal_ol_init_init)) {
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_init_ext",
@@ -796,15 +820,15 @@ slapi_ldap_init_ext(
* hostname (such as localhost.localdomain).
*/
if((rc = ldap_set_option(ld, LDAP_OPT_X_SASL_NOCANON, LDAP_OPT_ON))){
- slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_init_ext",
+ slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_init_ext",
"Could not set ldap option LDAP_OPT_X_SASL_NOCANON for (%s), error %d (%s)\n",
ldapurl, rc, ldap_err2string(rc) );
}
}
#else /* !USE_OPENLDAP */
- if (filename) {
+ if (ldapi_socket) {
/* ldapi in mozldap client is not yet supported */
- } else if (secure == 1) {
+ } else if (secure == SLAPI_LDAP_INIT_FLAG_SSL) {
ld = ldapssl_init(hostname, port, secure);
} else { /* regular ldap and/or starttls */
/*
@@ -828,7 +852,7 @@ slapi_ldap_init_ext(
}
}
- if ((ld != NULL) && !filename) {
+ if (ld && !ldapi_socket) {
/*
* Set the outbound LDAP I/O timeout based on the server config.
*/
@@ -876,7 +900,7 @@ slapi_ldap_init_ext(
* LDAP* if it has already gone through ldapssl_init -
* so, use NULL if using starttls
*/
- if (secure == 1) {
+ if (secure == SLAPI_LDAP_INIT_FLAG_SSL) {
myld = ld;
}
@@ -900,7 +924,7 @@ slapi_ldap_init_ext(
SLAPI_COMPONENT_NAME_NSPR " error %d - %s)\n",
prerr, slapd_pr_strerror(prerr));
}
- if (secure == 1) {
+ if (secure == SLAPI_LDAP_INIT_FLAG_SSL) {
/* tell bind code we are using SSL */
ldap_set_option(ld, LDAP_OPT_SSL, LDAP_OPT_ON);
}
@@ -908,7 +932,7 @@ slapi_ldap_init_ext(
}
}
- if (ld && (secure == 2)) {
+ if (ld && (secure == SLAPI_LDAP_INIT_FLAG_startTLS)) {
/*
* We don't have a way to stash context data with the LDAP*, so we
* stash the information in the client controls (currently unused).
@@ -938,8 +962,8 @@ slapi_ldap_init_ext(
slapi_log_error(SLAPI_LOG_SHELL, "slapi_ldap_init_ext",
"Success: set up conn to [%s:%d]%s\n",
hostname, port,
- (secure == 2) ? " using startTLS" :
- ((secure == 1) ? " using SSL" : ""));
+ (secure == SLAPI_LDAP_INIT_FLAG_startTLS) ? " using startTLS" :
+ ((secure == SLAPI_LDAP_INIT_FLAG_SSL) ? " using SSL" : ""));
done:
ldap_free_urldesc(ludp);
@@ -993,7 +1017,7 @@ ldaputil_get_saslpath()
LDAP *
slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared )
{
- return slapi_ldap_init_ext(NULL, ldaphost, ldapport, secure, shared, NULL);
+ return slapi_ldap_init_ext(NULL, ldaphost, ldapport, secure, shared, NULL/*, NULL*/);
}
/*
@@ -1030,7 +1054,7 @@ slapi_ldap_bind(
ldap_get_option(ld, LDAP_OPT_CLIENT_CONTROLS, &clientctrls);
if (clientctrls && clientctrls[0] &&
slapi_control_present(clientctrls, START_TLS_OID, NULL, NULL)) {
- secure = 2;
+ secure = SLAPI_LDAP_INIT_FLAG_startTLS;
} else {
#if defined(USE_OPENLDAP)
/* openldap doesn't have a SSL/TLS yes/no flag - so grab the
@@ -1039,7 +1063,7 @@ slapi_ldap_bind(
ldap_get_option(ld, LDAP_OPT_URI, &ldapurl);
if (ldapurl && !PL_strncasecmp(ldapurl, "ldaps", 5)) {
- secure = 1;
+ secure = SLAPI_LDAP_INIT_FLAG_SSL;
}
slapi_ch_free_string(&ldapurl);
#else /* !USE_OPENLDAP */
@@ -1077,7 +1101,7 @@ slapi_ldap_bind(
bvcreds.bv_len = creds ? strlen(creds) : 0;
}
- if (secure == 2) { /* send start tls */
+ if (secure == SLAPI_LDAP_INIT_FLAG_startTLS) { /* send start tls */
rc = ldap_start_tls_s(ld, NULL /* serverctrls?? */, NULL);
if (LDAP_SUCCESS != rc) {
slapi_log_error(SLAPI_LOG_FATAL, "slapi_ldap_bind",
@@ -2386,3 +2410,47 @@ slapi_berval_get_msg_len(struct berval *bv, int strict)
return len;
}
+
+int
+slapi_client_uses_non_nss(LDAP *ld)
+{
+ static int not_nss = 0;
+#if defined(USE_OPENLDAP)
+ static int initialized = 0;
+ char *package_name = NULL;
+ int rc;
+
+ if (initialized) {
+ return not_nss;
+ }
+ rc = ldap_get_option(ld, LDAP_OPT_X_TLS_PACKAGE, &package_name);
+ if (!rc && PL_strcasecmp(package_name, "MozNSS")) {
+ not_nss = 1;
+ slapi_ch_free_string(&package_name);
+ }
+ initialized = 1;
+#endif
+ return not_nss;
+}
+
+int
+slapi_client_uses_openssl(LDAP *ld)
+{
+ static int is_openssl = 0;
+#if defined(USE_OPENLDAP)
+ static int initialized = 0;
+ char *package_name = NULL;
+ int rc;
+
+ if (initialized) {
+ return is_openssl;
+ }
+ rc = ldap_get_option(ld, LDAP_OPT_X_TLS_PACKAGE, &package_name);
+ if (!rc && !PL_strcasecmp(package_name, "OpenSSL")) {
+ is_openssl = 1;
+ slapi_ch_free_string(&package_name);
+ }
+ initialized = 1;
+#endif
+ return is_openssl;
+}
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 33f2f9257..7bbf10ea1 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -253,6 +253,7 @@ slapi_int_t init_malloc_mmap_threshold;
#ifdef MEMPOOL_EXPERIMENTAL
slapi_onoff_t init_mempool_switch;
#endif
+slapi_onoff_t init_extract_pem;
#define DEFAULT_SSLCLIENTAPTH "off"
#define DEFAULT_ALLOW_ANON_ACCESS "on"
@@ -1197,6 +1198,10 @@ static struct config_get_and_set {
(void**)&global_slapdFrontendConfig.logging_hr_timestamps,
CONFIG_ON_OFF, NULL, &init_logging_hr_timestamps},
#endif
+ {CONFIG_EXTRACT_PEM, config_set_extract_pem,
+ NULL, 0,
+ (void**)&global_slapdFrontendConfig.extract_pem,
+ CONFIG_ON_OFF, (ConfigGetFunc)config_get_extract_pem, &init_extract_pem},
{CONFIG_LOGGING_BACKEND, NULL,
log_set_backend, 0,
(void**)&global_slapdFrontendConfig.logging_backend,
@@ -1680,6 +1685,7 @@ FrontendConfig_init () {
}
}
#endif /* MEMPOOL_EXPERIMENTAL */
+ init_extract_pem = cfg->extract_pem = LDAP_OFF;
init_config_get_and_set();
}
@@ -8074,6 +8080,26 @@ config_get_maxsimplepaged_per_conn()
return retVal;
}
+int
+config_set_extract_pem(const char *attrname, char *value, char *errorbuf, int apply)
+{
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ int retVal = LDAP_SUCCESS;
+
+ retVal = config_set_onoff(attrname, value, &(slapdFrontendConfig->extract_pem), errorbuf, apply);
+ return retVal;
+}
+
+int
+config_get_extract_pem()
+{
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ int retVal;
+
+ retVal = slapdFrontendConfig->extract_pem;
+ return retVal;
+}
+
#if defined(LINUX)
int
config_set_malloc_mxfast(const char *attrname, char *value, char *errorbuf, int apply)
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index e9b46182e..255e4bd50 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -581,6 +581,7 @@ int config_get_cn_uses_dn_syntax_in_dns();
int config_get_enable_nunc_stans(void);
int config_set_enable_nunc_stans(const char *attrname, char *value, char *errorbuf, int apply);
#endif
+int config_set_extract_pem(const char *attrname, char *value, char *errorbuf, int apply);
PLHashNumber hashNocaseString(const void *key);
PRIntn hashNocaseCompare(const void *v1, const void *v2);
@@ -594,6 +595,7 @@ int config_get_malloc_mmap_threshold();
#endif
int config_get_maxsimplepaged_per_conn();
+int config_get_extract_pem();
int is_abspath(const char *);
char* rel2abspath( char * );
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 0019c68fa..c6763e4e9 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -2129,6 +2129,8 @@ typedef struct _slapdEntryPoints {
#define CONFIG_MAXSIMPLEPAGED_PER_CONN_ATTRIBUTE "nsslapd-maxsimplepaged-per-conn"
#define CONFIG_LOGGING_BACKEND "nsslapd-logging-backend"
+#define CONFIG_EXTRACT_PEM "nsslapd-extract-pemfiles"
+
#ifdef HAVE_CLOCK_GETTIME
#define CONFIG_LOGGING_HR_TIMESTAMPS "nsslapd-logging-hr-timestamps-enabled"
#endif
@@ -2331,7 +2333,6 @@ typedef struct _slapdFrontendConfig {
#ifdef HAVE_CLOCK_GETTIME
slapi_onoff_t logging_hr_timestamps;
#endif
-
slapi_onoff_t return_exact_case; /* Return attribute names with the same case
as they appear in at.conf */
@@ -2427,6 +2428,7 @@ typedef struct _slapdFrontendConfig {
int malloc_trim_threshold; /* mallopt M_TRIM_THRESHOLD */
int malloc_mmap_threshold; /* mallopt M_MMAP_THRESHOLD */
#endif
+ slapi_onoff_t extract_pem; /* If "on", export key/cert as pem files */
} slapdFrontendConfig_t;
/* possible values for slapdFrontendConfig_t.schemareplace */
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 0dd10d991..d13aae9ed 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6160,12 +6160,14 @@ int slapi_rwlock_get_size( void );
/*
* thread-safe LDAP connections
*/
+#define SLAPI_LDAP_INIT_FLAG_SSL 1 /* SSL */
+#define SLAPI_LDAP_INIT_FLAG_startTLS 2 /* startTLS */
/**
* Initializes an LDAP connection, and returns a handle to the connection.
*
* \param ldaphost Hostname or IP address - NOTE: for TLS or GSSAPI, should be the FQDN
* \param ldapport LDAP server port number (default 389)
- * \param secure \c 0 - LDAP \c 1 - LDAPS \c 2 - startTLS
+ * \param secure \c 0 - LDAP \c SLAPI_LDAP_INIT_FLAG_SSL - LDAPS \c SLAPI_LDAP_INIT_FLAG_startTLS - startTLS
* \param shared \c 0 - single thread access \c 1 - LDAP* will be shared among multiple threads
* \return A pointer to an LDAP* handle
*
@@ -6184,6 +6186,7 @@ LDAP *slapi_ldap_init( char *ldaphost, int ldapport, int secure, int shared );
* \see slapi_ldap_init_ext()
*/
void slapi_ldap_unbind( LDAP *ld );
+
/**
* Initializes an LDAP connection, and returns a handle to the connection.
*
@@ -6191,9 +6194,9 @@ void slapi_ldap_unbind( LDAP *ld );
* ldapi://path - if \c NULL, #hostname, #port, and #secure must be provided
* \param hostname Hostname or IP address - NOTE: for TLS or GSSAPI, should be the FQDN
* \param port LDAP server port number (default 389)
- * \param secure \c 0 - LDAP \c 1 - LDAPS \c 2 - startTLS
+ * \param secure \c 0 - LDAP \c SLAPI_LDAP_INIT_FLAG_SSL - LDAPS \c SLAPI_LDAP_INIT_FLAG_startTLS - startTLS
* \param shared \c 0 - single thread access \c 1 - LDAP* will be shared among multiple threads
- * \param filename - currently not supported
+ * \param ldapi_socket - ldapi socket path
* \return A pointer to an LDAP* handle
*
* \note Use #slapi_ldap_unbind() to close and free the handle
@@ -6209,7 +6212,7 @@ LDAP *slapi_ldap_init_ext(
int secure, /* 0 for ldap, 1 for ldaps, 2 for starttls -
override proto in url */
int shared, /* if true, LDAP* will be shared among multiple threads */
- const char *filename /* for ldapi */
+ const char *ldap_socket /* ldapi socket path */
);
/**
* The LDAP bind request - this function handles all of the different types of mechanisms
@@ -6245,6 +6248,18 @@ int slapi_ldap_bind(
int *msgidp /* pass in non-NULL for async handling */
);
+/**
+ * Return the full path of PEM format CA Cert
+ *
+ * \return the full path of PEM format CA Cert
+ */
+const char * slapi_get_cacertfile();
+
+/**
+ * Set the full path of PEM format CA Cert
+ */
+void slapi_set_cacertfile(char *certfile);
+
/**
* Create either a v1 Proxy Auth Control or a v2 Proxied Auth Control
*
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index fb7b5f864..903486993 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -1160,6 +1160,7 @@ char* slapd_get_tmp_dir( void );
#include <stdio.h> /* GGOODREPL - For BUFSIZ, below, gak */
const char* escape_string (const char* str, char buf[BUFSIZ]);
const char* escape_string_with_punctuation(const char* str, char buf[BUFSIZ]);
+const char* escape_string_for_filename(const char* str);
void strcpy_unescape_value( char *d, const char *s );
char *slapi_berval_get_string_copy(const struct berval *bval);
@@ -1304,6 +1305,8 @@ void add_internal_modifiersname(Slapi_PBlock *pb, Slapi_Entry *e);
/* ldaputil.c */
char *ldaputil_get_saslpath();
+int slapi_client_uses_non_nss(LDAP *ld);
+int slapi_client_uses_openssl(LDAP *ld);
/* ssl.c */
/*
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 544c9bcf3..85c2c6f02 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -231,6 +231,19 @@ PRBool enableSSL3 = PR_FALSE;
*/
PRBool enableTLS1 = PR_TRUE;
+/*
+ * OpenLDAP client library with OpenSSL (ticket 47536)
+ */
+#define PEMEXT ".pem"
+/* CA cert pem file */
+static char *CACertPemFile = NULL;
+
+/* helper functions for openldap update. */
+static int slapd_extract_cert(Slapi_Entry *entry, int isCA);
+static int slapd_extract_key(Slapi_Entry *entry, char *token, PK11SlotInfo *slot);
+static void entrySetValue(Slapi_DN *sdn, char *type, char *value);
+static char *gen_pem_path(char *filename);
+
static void
slapd_SSL_report(int degree, char *fmt, va_list args)
{
@@ -277,7 +290,7 @@ getSupportedCiphers()
SSL_GetCipherSuiteInfo((PRUint16)_conf_ciphers[i].num,&info,sizeof(info));
/* only support FIPS approved ciphers in FIPS mode */
if (!isFIPS || info.isFIPS) {
- cipher_names[idx++] = PR_smprintf("%s%s%s%s%s%s%d",
+ cipher_names[idx++] = slapi_ch_smprintf("%s%s%s%s%s%s%d",
_conf_ciphers[i].name,sep,
info.symCipherName,sep,
info.macAlgorithmName,sep,
@@ -315,7 +328,7 @@ getEnabledCiphers()
SSL_CipherPrefGetDefault(_conf_ciphers[x].num, &enabled);
if (enabled) {
SSL_GetCipherSuiteInfo((PRUint16)_conf_ciphers[x].num,&info,sizeof(info));
- enabled_cipher_names[idx++] = PR_smprintf("%s%s%s%s%s%s%d",
+ enabled_cipher_names[idx++] = slapi_ch_smprintf("%s%s%s%s%s%s%d",
_conf_ciphers[x].name,sep,
info.symCipherName,sep,
info.macAlgorithmName,sep,
@@ -575,7 +588,7 @@ charray2str(char **ary, const char *delim)
if (str) {
str = PR_sprintf_append(str, "%s%s", delim, *ary++);
} else {
- str = PR_smprintf("%s", *ary++);
+ str = slapi_ch_smprintf("%s", *ary++);
}
}
@@ -757,7 +770,7 @@ _conf_setciphers(char *ciphers, int flags)
slapi_ch_free((void **)&unsuplist); /* strings inside are static */
if (!enabledOne) {
- char *nocipher = PR_smprintf("No active cipher suite is available.");
+ char *nocipher = slapi_ch_smprintf("No active cipher suite is available.");
return nocipher;
}
_conf_dumpciphers();
@@ -856,6 +869,31 @@ freeChildren( char **list ) {
}
}
+static void
+entrySetValue(Slapi_DN *sdn, char *type, char *value)
+{
+ Slapi_PBlock mypb;
+ LDAPMod attr;
+ LDAPMod *mods[2];
+ char *values[2];
+
+ values[0] = value;
+ values[1] = NULL;
+
+ /* modify the attribute */
+ attr.mod_type = type;
+ attr.mod_op = LDAP_MOD_REPLACE;
+ attr.mod_values = values;
+
+ mods[0] = &attr;
+ mods[1] = NULL;
+
+ pblock_init(&mypb);
+ slapi_modify_internal_set_pb_ext(&mypb, sdn, mods, NULL, NULL, (void *)plugin_get_default_component_id(), 0);
+ slapi_modify_internal_pb(&mypb);
+ pblock_done(&mypb);
+}
+
/* Logs a warning and returns 1 if cert file doesn't exist. You
* can skip the warning log message by setting no_log to 1.*/
static int
@@ -863,8 +901,8 @@ warn_if_no_cert_file(const char *dir, int no_log)
{
int ret = 0;
char *filename = slapi_ch_smprintf("%s/cert8.db", dir);
- PRStatus status = PR_Access(filename, PR_ACCESS_READ_OK);
- if (PR_SUCCESS != status) {
+ PRStatus status = PR_Access(filename, PR_ACCESS_READ_OK);
+ if (PR_SUCCESS != status) {
slapi_ch_free_string(&filename);
filename = slapi_ch_smprintf("%s/cert7.db", dir);
status = PR_Access(filename, PR_ACCESS_READ_OK);
@@ -1148,7 +1186,7 @@ slapd_nss_init(int init_ssl, int config_available)
slapd_pk11_configurePKCS11(NULL, NULL, tokPBE, ptokPBE, NULL, NULL, NULL, NULL, 0, 0 );
secStatus = NSS_Initialize(certdir, NULL, NULL, "secmod.db", nssFlags);
- dongle_file_name = PR_smprintf("%s/pin.txt", certdir);
+ dongle_file_name = slapi_ch_smprintf("%s/pin.txt", certdir);
if (secStatus != SECSuccess) {
errorCode = PR_GetError();
@@ -1280,10 +1318,16 @@ slapd_ssl_init()
freeConfigEntry( &entry );
return -1;
}
+ if (config_get_extract_pem()) {
+ /* extract cert file and convert it to a pem file. */
+ slapd_extract_cert(entry, PR_TRUE);
+ }
+
if ((family_list = getChildren(configDN))) {
char **family;
char *token;
char *activation;
+ int isinternal = 0;
for (family = family_list; *family; family++) {
@@ -1311,6 +1355,7 @@ slapd_ssl_init()
if (!PL_strcasecmp(token, "internal") ||
!PL_strcasecmp(token, "internal (software)")) {
slot = slapd_pk11_getInternalKeySlot();
+ isinternal = 1;
} else {
slot = slapd_pk11_findSlotByName(token);
}
@@ -1324,8 +1369,6 @@ slapd_ssl_init()
return -1;
}
- slapi_ch_free((void **) &token);
-
if (!slot) {
errorCode = PR_GetError();
slapd_SSL_warn("Security Initialization: Unable to find slot ("
@@ -1333,6 +1376,7 @@ slapd_ssl_init()
errorCode, slapd_pr_strerror(errorCode));
freeChildren(family_list);
freeConfigEntry( &entry );
+ slapi_ch_free((void **) &token);
return -1;
}
/* authenticate */
@@ -1342,13 +1386,20 @@ slapd_ssl_init()
#endif
if (slapd_pk11_authenticate(slot, PR_TRUE, NULL) != SECSuccess) {
errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Unable to authenticate ("
- SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
- errorCode, slapd_pr_strerror(errorCode));
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_ssl_init",
+ "Unable to authenticate (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+ errorCode, slapd_pr_strerror(errorCode));
freeChildren(family_list);
freeConfigEntry( &entry );
+ slapi_ch_free((void **) &token);
return -1;
}
+ if (config_get_extract_pem()) {
+ /* Get Server{Key,Cert}ExtractFile from cn=Cipher,cn=encryption entry if any. */
+ slapd_extract_cert(entry, PR_FALSE);
+ slapd_extract_key(entry, isinternal?internalTokenName:token, slot);
+ }
+ slapi_ch_free((void **) &token);
}
freeChildren( family_list );
freeConfigEntry( &entry );
@@ -1669,9 +1720,9 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
if(slapd_pk11_isFIPS()) {
if(slapd_pk11_authenticate(slot, PR_TRUE, NULL) != SECSuccess) {
errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Unable to authenticate ("
- SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
- errorCode, slapd_pr_strerror(errorCode));
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_ssl_init2",
+ "Unable to authenticate (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)\n",
+ errorCode, slapd_pr_strerror(errorCode));
return -1;
}
fipsMode = PR_TRUE;
@@ -2103,111 +2154,117 @@ slapd_SSL_client_auth (LDAP* ld)
char *token = NULL;
SVRCOREStdPinObj *StdPinObj;
SVRCOREError err = SVRCORE_Success;
+ char *finalpersonality = NULL;
+ char *CertExtractFile = NULL;
+ char *KeyExtractFile = NULL;
- if((family_list = getChildren(configDN))) {
+ if ((family_list = getChildren(configDN))) {
char **family;
- char *personality = NULL;
char *activation = NULL;
char *cipher = NULL;
+ char *personality = NULL;
for (family = family_list; *family; family++) {
getConfigEntry( *family, &entry );
if ( entry == NULL ) {
- continue;
+ continue;
}
activation = slapi_entry_attr_get_charptr( entry, "nssslactivation" );
- if((!activation) || (!PL_strcasecmp(activation, "off"))) {
- /* this family was turned off, goto next */
- slapi_ch_free((void **) &activation);
- freeConfigEntry( &entry );
- continue;
+ if ((!activation) || (!PL_strcasecmp(activation, "off"))) {
+ /* this family was turned off, goto next */
+ slapi_ch_free((void **) &activation);
+ freeConfigEntry( &entry );
+ continue;
}
-
- slapi_ch_free((void **) &activation);
+ slapi_ch_free((void **) &activation);
personality = slapi_entry_attr_get_charptr( entry, "nssslpersonalityssl" );
cipher = slapi_entry_attr_get_charptr( entry, "cn" );
- if ( cipher && !PL_strcasecmp(cipher, "RSA" )) {
- char *ssltoken;
-
- /* If there already is a token name, use it */
- if (token) {
- slapi_ch_free((void **) &personality);
- slapi_ch_free((void **) &cipher);
- freeConfigEntry( &entry );
- continue;
- }
+ if ( cipher && !PL_strcasecmp(cipher, "RSA" )) {
+ char *ssltoken;
+
+ /* If there already is a token name, use it */
+ if (token) {
+ slapi_ch_free_string(&personality);
+ slapi_ch_free_string(&cipher);
+ freeConfigEntry( &entry );
+ continue;
+ }
- ssltoken = slapi_entry_attr_get_charptr( entry, "nsssltoken" );
- if( ssltoken && personality ) {
- if( !PL_strcasecmp(ssltoken, "internal") ||
- !PL_strcasecmp(ssltoken, "internal (software)") ) {
+ ssltoken = slapi_entry_attr_get_charptr( entry, "nsssltoken" );
+ if( ssltoken && personality ) {
+ if (!PL_strcasecmp(ssltoken, "internal") ||
+ !PL_strcasecmp(ssltoken, "internal (software)")) {
- /* Translate config internal name to more
- * readable form. Certificate name is just
- * the personality for internal tokens.
- */
- token = slapi_ch_strdup(internalTokenName);
+ /* Translate config internal name to more
+ * readable form. Certificate name is just
+ * the personality for internal tokens.
+ */
+ token = slapi_ch_strdup(internalTokenName);
#if defined(USE_OPENLDAP)
- /* openldap needs tokenname:certnick */
- PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
+ /* openldap needs tokenname:certnick */
+ PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
#else
- PL_strncpyz(cert_name, personality, sizeof(cert_name));
+ PL_strncpyz(cert_name, personality, sizeof(cert_name));
#endif
- slapi_ch_free((void **) &ssltoken);
- } else {
- /* external PKCS #11 token - attach token name */
- /*ssltoken was already dupped and we don't need it anymore*/
- token = ssltoken;
- PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
- }
- } else {
- errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Failed to get cipher "
- "family information. Missing nsssltoken or"
- "nssslpersonalityssl in %s ("
- SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
- *family, errorCode, slapd_pr_strerror(errorCode));
- slapi_ch_free((void **) &ssltoken);
- slapi_ch_free((void **) &personality);
- slapi_ch_free((void **) &cipher);
- freeConfigEntry( &entry );
- continue;
- }
- } else { /* external PKCS #11 cipher */
- char *ssltoken;
-
- ssltoken = slapi_entry_attr_get_charptr( entry, "nsssltoken" );
- if( token && personality ) {
-
- /* free the old token and remember the new one */
- if (token) slapi_ch_free((void **)&token);
- token = ssltoken; /*ssltoken was already dupped and we don't need it anymore*/
-
- /* external PKCS #11 token - attach token name */
- PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
- } else {
- errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Failed to get cipher "
- "family information. Missing nsssltoken or"
- "nssslpersonalityssl in %s ("
- SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
- *family, errorCode, slapd_pr_strerror(errorCode));
- slapi_ch_free((void **) &ssltoken);
- slapi_ch_free((void **) &personality);
- slapi_ch_free((void **) &cipher);
- freeConfigEntry( &entry );
- continue;
- }
+ slapi_ch_free_string(&ssltoken);
+ } else {
+ /* external PKCS #11 token - attach token name */
+ token = ssltoken; /*ssltoken was already dupped */
+ PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
+ }
+ } else {
+ errorCode = PR_GetError();
+ slapd_SSL_warn("Security Initialization: Failed to get cipher "
+ "family information. Missing nsssltoken or"
+ "nssslpersonalityssl in %s ("
+ SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+ *family, errorCode, slapd_pr_strerror(errorCode));
+ slapi_ch_free_string(&ssltoken);
+ slapi_ch_free_string(&personality);
+ slapi_ch_free_string(&cipher);
+ freeConfigEntry( &entry );
+ continue;
+ }
+ } else { /* external PKCS #11 cipher */
+ char *ssltoken;
+
+ ssltoken = slapi_entry_attr_get_charptr( entry, "nsssltoken" );
+ if( ssltoken && personality ) {
- }
- slapi_ch_free((void **) &personality);
- slapi_ch_free((void **) &cipher);
- freeConfigEntry( &entry );
+ /* free the old token and remember the new one */
+ if (token) slapi_ch_free_string(&token);
+ token = ssltoken; /*ssltoken was already dupped */
+
+ /* external PKCS #11 token - attach token name */
+ PR_snprintf(cert_name, sizeof(cert_name), "%s:%s", token, personality);
+ } else {
+ errorCode = PR_GetError();
+ slapd_SSL_warn("Security Initialization: Failed to get cipher "
+ "family information. Missing nsssltoken or"
+ "nssslpersonalityssl in %s ("
+ SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+ * family, errorCode, slapd_pr_strerror(errorCode));
+ slapi_ch_free_string(&ssltoken);
+ slapi_ch_free_string(&personality);
+ slapi_ch_free_string(&cipher);
+ freeConfigEntry( &entry );
+ continue;
+ }
+ }
+ slapi_ch_free_string(&finalpersonality);
+ finalpersonality = personality;
+ slapi_ch_free_string(&cipher);
+ /* Get ServerCert/KeyExtractFile from given entry if any. */
+ slapi_ch_free_string(&CertExtractFile);
+ CertExtractFile = slapi_entry_attr_get_charptr(entry, "ServerCertExtractFile");
+ slapi_ch_free_string(&KeyExtractFile);
+ KeyExtractFile = slapi_entry_attr_get_charptr(entry, "ServerKeyExtractFile");
+ freeConfigEntry( &entry );
} /* end of for */
- freeChildren( family_list );
+ freeChildren( family_list );
}
/* Free config data */
@@ -2226,15 +2283,69 @@ slapd_SSL_client_auth (LDAP* ld)
errorCode, slapd_pr_strerror(errorCode));
} else {
#if defined(USE_OPENLDAP)
- rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, SERVER_KEY_NAME);
- if (rc) {
- slapd_SSL_warn("SSL client authentication cannot be used "
- "unable to set the key to use to %s", SERVER_KEY_NAME);
- }
- rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, cert_name);
- if (rc) {
- slapd_SSL_warn("SSL client authentication cannot be used "
- "unable to set the cert to use to %s", cert_name);
+ if (slapi_client_uses_non_nss(ld)) {
+ char *certdir = config_get_certdir();
+ char *keyfile = NULL;
+ char *certfile = NULL;
+ if (KeyExtractFile) {
+ if ('/' == *KeyExtractFile) {
+ keyfile = KeyExtractFile;
+ } else {
+ keyfile = slapi_ch_smprintf("%s/%s", certdir, KeyExtractFile);
+ slapi_ch_free_string(&KeyExtractFile);
+ }
+ } else {
+ keyfile = slapi_ch_smprintf("%s/%s-Key%s", certdir, finalpersonality, PEMEXT);
+ }
+ if (CertExtractFile) {
+ if ('/' == *CertExtractFile) {
+ certfile = CertExtractFile;
+ } else {
+ certfile = slapi_ch_smprintf("%s/%s", certdir, CertExtractFile);
+ slapi_ch_free_string(&CertExtractFile);
+ }
+ } else {
+ certfile = slapi_ch_smprintf("%s/%s%s", certdir, finalpersonality, PEMEXT);
+ }
+ slapi_ch_free_string(&certdir);
+ if (PR_SUCCESS != PR_Access(keyfile, PR_ACCESS_EXISTS)) {
+ slapi_ch_free_string(&keyfile);
+ slapd_SSL_warn("SSL key file (%s) for client authentication does not exist. "
+ "Using %s", keyfile, SERVER_KEY_NAME);
+ keyfile = slapi_ch_strdup(SERVER_KEY_NAME);
+ }
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, keyfile);
+ if (rc) {
+ slapd_SSL_warn("SSL client authentication cannot be used "
+ "unable to set the key to use to %s", keyfile);
+ }
+ slapi_ch_free_string(&keyfile);
+ rc = PR_Access(certfile, PR_ACCESS_EXISTS);
+ if (rc) {
+ slapi_ch_free_string(&certfile);
+ slapd_SSL_warn("SSL cert file (%s) for client authentication does not exist. "
+ "Using %s", certfile, cert_name);
+ certfile = cert_name;
+ }
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, certfile);
+ if (rc) {
+ slapd_SSL_warn("SSL client authentication cannot be used "
+ "unable to set the cert to use to %s", certfile);
+ }
+ if (certfile != cert_name) {
+ slapi_ch_free_string(&certfile);
+ }
+ } else {
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_KEYFILE, SERVER_KEY_NAME);
+ if (rc) {
+ slapd_SSL_warn("SSL client authentication cannot be used "
+ "unable to set the key to use to %s", SERVER_KEY_NAME);
+ }
+ rc = ldap_set_option(ld, LDAP_OPT_X_TLS_CERTFILE, cert_name);
+ if (rc) {
+ slapd_SSL_warn("SSL client authentication cannot be used "
+ "unable to set the cert to use to %s", cert_name);
+ }
}
/*
* not sure what else needs to be done for client auth - don't
@@ -2265,6 +2376,7 @@ slapd_SSL_client_auth (LDAP* ld)
slapi_ch_free_string(&token);
slapi_ch_free_string(&pw);
+ slapi_ch_free_string(&finalpersonality);
LDAPDebug (LDAP_DEBUG_TRACE, "slapd_SSL_client_auth() %i\n", rc, 0, 0);
return rc;
@@ -2365,9 +2477,10 @@ slapd_get_unlocked_key_for_cert(CERTCertificate *cert, void *pin_arg)
slotname, tokenname, certsubject);
break;
} else {
- slapi_log_error(SLAPI_LOG_TRACE, "slapd_get_unlocked_key_for_cert",
- "Skipping locked slot [%s] token [%s] for certificate [%s]\n",
- slotname, tokenname, certsubject);
+ PRErrorCode errcode = PR_GetError();
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_get_unlocked_key_for_cert",
+ "Skipping locked slot [%s] token [%s] for certificate [%s] (%d - %s)\n",
+ slotname, tokenname, certsubject, errcode, slapd_pr_strerror(errcode));
}
}
@@ -2391,3 +2504,591 @@ slapd_get_unlocked_key_for_cert(CERTCertificate *cert, void *pin_arg)
return key;
}
+/*
+ * Functions to extract key and cert from the NSS cert db.
+ */
+#include <libgen.h>
+#include <seccomon.h>
+#include <secmodt.h>
+#include <certt.h>
+#include <base64.h>
+#define DONOTEDIT "This file is auto-generated by 389-ds-base.\nDo not edit directly.\n"
+#define NS_CERT_HEADER "-----BEGIN CERTIFICATE-----"
+#define NS_CERT_TRAILER "-----END CERTIFICATE-----"
+#define KEY_HEADER "-----BEGIN PRIVATE KEY-----"
+#define KEY_TRAILER "-----END PRIVATE KEY-----"
+#define ENCRYPTED_KEY_HEADER "-----BEGIN ENCRYPTED PRIVATE KEY-----"
+#define ENCRYPTED_KEY_TRAILER "-----END ENCRYPTED PRIVATE KEY-----"
+
+typedef struct {
+ enum {
+ PW_NONE = 0,
+ PW_FROMFILE = 1,
+ PW_PLAINTEXT = 2,
+ PW_EXTERNAL = 3
+ } source;
+ char *data;
+} secuPWData;
+
+static SECStatus
+listCerts(CERTCertDBHandle *handle, CERTCertificate *cert, PK11SlotInfo *slot,
+ PRFileDesc *outfile, void *pwarg)
+{
+ SECItem data;
+ SECStatus rv = SECFailure;
+ CERTCertList *certs;
+ CERTCertListNode *node;
+ CERTCertificate *the_cert = NULL;
+ char *name = NULL;
+
+ if (!cert) {
+ slapi_log_error(SLAPI_LOG_FATAL, "listCerts", "No cert given\n");
+ return rv;
+ }
+ name = cert->nickname;
+
+ if (!name) {
+ slapi_log_error(SLAPI_LOG_FATAL, "listCerts", "No cert nickname\n");
+ return rv;
+ }
+ the_cert = CERT_FindCertByNicknameOrEmailAddr(handle, name);
+ if (!the_cert) {
+ slapi_log_error(SLAPI_LOG_FATAL, "listCerts", "Could not find cert: %s\n", name);
+ return SECFailure;
+ }
+
+ PR_fprintf(outfile, "%s\n", DONOTEDIT);
+ /* Here, we have one cert with the desired nickname or email
+ * address. Now, we will attempt to get a list of ALL certs
+ * with the same subject name as the cert we have. That list
+ * should contain, at a minimum, the one cert we have already found.
+ * If the list of certs is empty (NULL), the libraries have failed.
+ */
+ certs = CERT_CreateSubjectCertList(NULL, handle, &the_cert->derSubject,
+ PR_Now(), PR_FALSE);
+ CERT_DestroyCertificate(the_cert);
+ if (!certs) {
+ slapi_log_error(SLAPI_LOG_FATAL, "listCerts", "problem printing certificates");
+ return SECFailure;
+ }
+ for (node = CERT_LIST_HEAD(certs); !CERT_LIST_END(node,certs); node = CERT_LIST_NEXT(node)) {
+ the_cert = node->cert;
+ PR_fprintf(outfile, "Issuer: %s\n", the_cert->issuerName);
+ PR_fprintf(outfile, "Subject: %s\n", the_cert->subjectName);
+ /* now get the subjectList that matches this cert */
+ data.data = the_cert->derCert.data;
+ data.len = the_cert->derCert.len;
+ PR_fprintf(outfile, "\n%s\n%s\n%s\n", NS_CERT_HEADER,
+ BTOA_DataToAscii(data.data, data.len), NS_CERT_TRAILER);
+ rv = SECSuccess;
+ }
+ if (certs) {
+ CERT_DestroyCertList(certs);
+ }
+ if (rv) {
+ slapi_log_error(SLAPI_LOG_FATAL, "listCerts", "problem printing certificate nicknames");
+ return SECFailure;
+ }
+
+ return rv;
+}
+
+static char *
+gen_pem_path(char *filename)
+{
+ char *pem = NULL;
+ char *pempath = NULL;
+ char *dname = NULL;
+ char *bname = NULL;
+ char *certdir = config_get_certdir();
+
+ if (!filename) {
+ goto bail;
+ }
+ pem = PL_strstr(filename, PEMEXT);
+ if (pem) {
+ *pem = '\0';
+ }
+ bname = basename(filename);
+ dname = dirname(filename);
+ if (!PL_strcmp(dname, ".")) {
+ /* just a file name */
+ pempath = slapi_ch_smprintf("%s/%s%s", certdir, bname, PEMEXT);
+ } else if (*dname == '/') {
+ /* full path */
+ pempath = slapi_ch_smprintf("%s/%s%s", dname, bname, PEMEXT);
+ } else {
+ /* relative path */
+ pempath = slapi_ch_smprintf("%s/%s/%s%s", certdir, dname, bname, PEMEXT);
+ }
+bail:
+ return pempath;
+}
+
+static int
+slapd_extract_cert(Slapi_Entry *entry, int isCA)
+{
+ CERTCertDBHandle *certHandle;
+ char *certdir = config_get_certdir();
+ CERTCertListNode *node;
+ CERTCertList *list = PK11_ListCerts(PK11CertListAll, NULL);
+ PRFileDesc *outFile = NULL;
+ SECStatus rv = SECFailure;
+ char *CertExtractFile = NULL;
+ char *certfile = NULL;
+ char *personality = NULL;
+
+ if (!entry) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert",
+ "No entry is given for %s Cert.\n", isCA?"CA":"Server");
+ goto bail;
+ }
+
+ /* Get CertExtractFile from given entry if any. */
+ if (isCA) {
+ CertExtractFile = slapi_entry_attr_get_charptr(entry, "CACertExtractFile");
+ } else {
+ CertExtractFile = slapi_entry_attr_get_charptr(entry, "ServerCertExtractFile");
+ personality = slapi_entry_attr_get_charptr(entry, "nsSSLPersonalitySSL" );
+ }
+ certfile = gen_pem_path(CertExtractFile);
+ if (isCA) {
+ slapi_ch_free_string(&CACertPemFile);
+ CACertPemFile = certfile;
+ }
+
+ certHandle = CERT_GetDefaultCertDB();
+ for (node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list);
+ node = CERT_LIST_NEXT(node)) {
+ CERTCertificate *cert = node->cert;
+ CERTCertTrust trust;
+ switch (isCA) {
+ case PR_TRUE:
+ if ((CERT_GetCertTrust(cert, &trust) == SECSuccess) &&
+ (trust.sslFlags & (CERTDB_VALID_CA|CERTDB_TRUSTED_CA|CERTDB_TRUSTED_CLIENT_CA))) {
+ /* default token "internal" */
+ PK11SlotInfo *slot = slapd_pk11_getInternalKeySlot();
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert", "CA CERT NAME: %s\n", cert->nickname);
+ if (!certfile) {
+ certfile = slapi_ch_smprintf("%s/%s%s", certdir, escape_string_for_filename(cert->nickname), PEMEXT);
+ entrySetValue(slapi_entry_get_sdn(entry), "CACertExtractFile", certfile);
+ slapi_set_cacertfile(certfile);
+ }
+ if (!outFile) {
+ outFile = PR_Open(certfile, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660);
+ }
+ if (!outFile) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert",
+ "Unable to open \"%s\" for writing (%d, %d).\n",
+ certfile, PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+ rv = listCerts(certHandle, cert, slot, outFile, NULL);
+ if (rv) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert", "listCerts failed\n");
+ break;
+ }
+ }
+ break;
+ default:
+ if (!PL_strcmp(cert->nickname, personality)) {
+ PK11SlotInfo *slot = slapd_pk11_getInternalKeySlot();
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert", "SERVER CERT NAME: %s\n", cert->nickname);
+ if (!certfile) {
+ certfile = slapi_ch_smprintf("%s/%s%s", certdir, escape_string_for_filename(cert->nickname), PEMEXT);
+ }
+ if (!outFile) {
+ outFile = PR_Open(certfile, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660);
+ }
+ if (!outFile) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert",
+ "Unable to open \"%s\" for writing (%d, %d).\n",
+ certfile, PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+ rv = listCerts(certHandle, cert, slot, outFile, NULL);
+ if (rv) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_cert", "listCerts failed\n");
+ }
+ PR_Close(outFile);
+ outFile = NULL;
+ break; /* One cert per one pem file. */
+ }
+ break;
+ }
+ }
+ rv = SECSuccess;
+bail:
+ CERT_DestroyCertList(list);
+ slapi_ch_free_string(&CertExtractFile);
+ if (CACertPemFile != certfile) {
+ slapi_ch_free_string(&certfile);
+ }
+ slapi_ch_free_string(&personality);
+ if (outFile) {
+ PR_Close(outFile);
+ }
+ return rv;
+}
+
+/*
+ * Borrowed from keyutil.c (crypto-util)
+ *
+ * Extract the public and private keys and the subject
+ * distinguished from the cert with the given nickname
+ * in the given slot.
+ *
+ * @param nickname the certificate nickname
+ * @param slot the slot where keys it was loaded
+ * @param pwdat module authentication password
+ * @param privkey private key out
+ * @param pubkey public key out
+ * @param subject subject out
+ */
+static SECStatus
+extractRSAKeysAndSubject(
+ const char *nickname,
+ PK11SlotInfo *slot,
+ secuPWData *pwdata,
+ SECKEYPrivateKey **privkey,
+ SECKEYPublicKey **pubkey,
+ CERTName **subject)
+{
+ PRErrorCode rv = SECFailure;
+ CERTCertificate *cert = PK11_FindCertFromNickname((char *)nickname, NULL);
+ if (!cert) {
+ rv = PR_GetError();
+ slapi_log_error(SLAPI_LOG_FATAL, "extractRSAKeysAndSubject",
+ "Failed extract cert with %s, (%d-%s, %d).\n",
+ nickname, rv, slapd_pr_strerror(rv), PR_GetOSError());
+ goto bail;
+ }
+
+ *pubkey = CERT_ExtractPublicKey(cert);
+ if (!*pubkey) {
+ rv = PR_GetError();
+ slapi_log_error(SLAPI_LOG_FATAL, "extractRSAKeysAndSubject",
+ "Could not get public key from cert for %s, (%d-%s, %d)\n",
+ nickname, rv, slapd_pr_strerror(rv), PR_GetOSError());
+ goto bail;
+ }
+
+ *privkey = PK11_FindKeyByDERCert(slot, cert, pwdata);
+ if (!*privkey) {
+ rv = PR_GetError();
+ slapi_log_error(SLAPI_LOG_FATAL, "extractRSAKeysAndSubject",
+ "Unable to find the key with PK11_FindKeyByDERCert for %s, (%d-%s, %d)\n",
+ nickname, rv, slapd_pr_strerror(rv), PR_GetOSError());
+ *privkey= PK11_FindKeyByAnyCert(cert, &pwdata);
+ if (!*privkey) {
+ rv = PR_GetError();
+ slapi_log_error(SLAPI_LOG_FATAL, "extractRSAKeysAndSubject",
+ "Unable to find the key with PK11_FindKeyByAnyCert for %s, (%d-%s, %d)\n",
+ nickname, rv, slapd_pr_strerror(rv), PR_GetOSError());
+ goto bail;
+ }
+ }
+
+ PR_ASSERT(((*privkey)->keyType) == rsaKey);
+ *subject = CERT_AsciiToName(cert->subjectName);
+
+ if (!*subject) {
+ slapi_log_error(SLAPI_LOG_FATAL, "extractRSAKeysAndSubject",
+ "Improperly formatted name: \"%s\"\n",
+ cert->subjectName);
+ goto bail;
+ }
+ rv = SECSuccess;
+bail:
+ if (cert)
+ CERT_DestroyCertificate(cert);
+ return rv;
+}
+
+/*
+ * Decrypt the private key
+ */
+SECStatus DecryptKey(
+ SECKEYEncryptedPrivateKeyInfo *epki,
+ SECOidTag algTag,
+ SECItem *pwitem,
+ secuPWData *pwdata,
+ SECItem *derPKI)
+{
+ SECItem *cryptoParam = NULL;
+ PK11SymKey *symKey = NULL;
+ PK11Context *ctx = NULL;
+ SECStatus rv = SECFailure;
+
+ if (!pwitem) {
+ return rv;
+ }
+
+ do {
+ SECAlgorithmID algid = epki->algorithm;
+ CK_MECHANISM_TYPE cryptoMechType;
+ CK_ATTRIBUTE_TYPE operation = CKA_DECRYPT;
+ PK11SlotInfo *slot = NULL;
+
+ cryptoMechType = PK11_GetPBECryptoMechanism(&algid, &cryptoParam, pwitem);
+ if (cryptoMechType == CKM_INVALID_MECHANISM) {
+ break;
+ }
+
+ slot = PK11_GetBestSlot(cryptoMechType, NULL);
+ if (!slot) {
+ break;
+ }
+
+ symKey = PK11_PBEKeyGen(slot, &algid, pwitem, PR_FALSE, pwdata);
+ if (symKey == NULL) {
+ break;
+ }
+
+ ctx = PK11_CreateContextBySymKey(cryptoMechType, operation, symKey, cryptoParam);
+ if (ctx == NULL) {
+ break;
+ }
+
+ rv = PK11_CipherOp(ctx,
+ derPKI->data, /* out */
+ (int *)(&derPKI->len), /* out len */
+ (int)epki->encryptedData.len, /* max out */
+ epki->encryptedData.data, /* in */
+ (int)epki->encryptedData.len); /* in len */
+
+ PR_ASSERT(derPKI->len == epki->encryptedData.len);
+ PR_ASSERT(rv == SECSuccess);
+ rv = PK11_Finalize(ctx);
+ PR_ASSERT(rv == SECSuccess);
+
+ } while (0);
+
+ /* cleanup */
+ if (symKey) {
+ PK11_FreeSymKey(symKey);
+ }
+ if (cryptoParam) {
+ SECITEM_ZfreeItem(cryptoParam, PR_TRUE);
+ cryptoParam = NULL;
+ }
+ if (ctx) {
+ PK11_DestroyContext(ctx, PR_TRUE);
+ }
+
+ return rv;
+
+}
+
+/* #define ENCRYPTEDKEY 1 */
+#define RAND_PASS_LEN 32
+static int
+slapd_extract_key(Slapi_Entry *entry, char *token, PK11SlotInfo *slot)
+{
+ char *KeyExtractFile = NULL;
+ char *personality = NULL;
+ char *keyfile = NULL;
+ unsigned char randomPassword[RAND_PASS_LEN] = {0};
+ SECStatus rv = SECFailure;
+ SECItem pwitem = { 0, NULL, 0 };
+ SECItem clearKeyDER = { 0, NULL, 0 };
+ PRFileDesc *outFile = NULL;
+ SECKEYEncryptedPrivateKeyInfo *epki = NULL;
+ SECKEYPrivateKey *privkey = NULL;
+ SECKEYPublicKey *pubkey = NULL;
+ secuPWData pwdata = { PW_NONE, 0 };
+ CERTName *subject = NULL;
+ PLArenaPool *arenaForPKI = NULL;
+ char *b64 = NULL;
+ PRUint32 total = 0;
+ PRUint32 numBytes = 0;
+ char *certdir = config_get_certdir();
+#if defined(ENCRYPTEDKEY)
+ char *keyEncPwd = NULL;
+ SVRCOREError err = SVRCORE_Success;
+ PRArenaPool *arenaForEPKI = NULL;
+ SVRCOREStdPinObj *StdPinObj;
+ SECItem *encryptedKeyDER = NULL;
+#endif
+
+ if (!entry) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "No entry is given for Server Key.\n");
+ goto bail;
+ }
+#if defined(ENCRYPTEDKEY)
+ if (!token) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "No token is given.\n");
+ goto bail;
+ }
+ StdPinObj = (SVRCOREStdPinObj *)SVRCORE_GetRegisteredPinObj();
+ if (!StdPinObj) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "No entry is given for Server Key.\n");
+ goto bail;
+ }
+ err = SVRCORE_StdPinGetPin(&keyEncPwd, StdPinObj, token);
+ if (err || !keyEncPwd) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Failed to extract pw with token %s.\n", token);
+ goto bail;
+ }
+ pwitem.data = (unsigned char *)keyEncPwd;
+ pwitem.len = (unsigned int)strlen(keyEncPwd);
+ pwitem.type = siBuffer;
+#else
+ /* Caller wants clear keys. Make up a dummy
+ * password to get NSS to export an encrypted
+ * key which we will decrypt.
+ */
+ rv = PK11_GenerateRandom(randomPassword, sizeof((const char *)randomPassword) - 1);
+ if (rv != SECSuccess) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key", "Failed to generate random.\n");
+ goto bail;
+ }
+ pwitem.data = randomPassword;
+ pwitem.len = strlen((const char *)randomPassword);
+ pwitem.type = siBuffer;
+#endif
+
+ /* Get ServerKeyExtractFile from given entry if any. */
+ KeyExtractFile = slapi_entry_attr_get_charptr(entry, "ServerKeyExtractFile");
+ personality = slapi_entry_attr_get_charptr(entry, "nsSSLPersonalitySSL" );
+ if (!personality) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "nsSSLPersonalitySSL value not found.\n");
+ goto bail;
+ }
+ keyfile = gen_pem_path(KeyExtractFile);
+ if (!keyfile) {
+ keyfile = slapi_ch_smprintf("%s/%s-Key%s", certdir, escape_string_for_filename(personality), PEMEXT);
+ }
+ outFile = PR_Open(keyfile, PR_CREATE_FILE | PR_RDWR | PR_TRUNCATE, 00660);
+ if (!outFile) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Unable to open \"%s\" for writing (%d, %d).\n",
+ keyfile, PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+ rv = extractRSAKeysAndSubject(personality, slot, &pwdata, &privkey, &pubkey, &subject);
+ if (rv != SECSuccess) {
+#if defined(ENCRYPTEDKEY)
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Failed to extract keys for \"%s\".\n", token);
+#else
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key", "Failed to extract keys for %s.\n", personality);
+#endif
+ goto bail;
+ }
+
+ /*
+ * Borrowed the code from KeyOut in keyutil.c (crypto-util).
+ * Is it ok to hardcode the algorithm SEC_OID_DES_EDE3_CBC???
+ */
+ epki = PK11_ExportEncryptedPrivKeyInfo(NULL, SEC_OID_DES_EDE3_CBC, &pwitem, privkey, 1000, &pwdata);
+ if (!epki) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Unable to export encrypted private key (%d, %d).\n",
+ PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+#if defined(ENCRYPTEDKEY)
+ arenaForEPKI = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ /* NULL dest to let it allocate memory for us */
+ encryptedKeyDER = SEC_ASN1EncodeItem(arenaForEPKI, NULL, epki, SECKEY_EncryptedPrivateKeyInfoTemplate);
+ if (!encryptedKeyDER) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "SEC_ASN1EncodeItem failed. (%d, %d).\n", PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+#else
+ /* Make a decrypted key the one to write out. */
+ arenaForPKI = PORT_NewArena(2048);
+ if (!arenaForPKI) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "PORT_NewArena failed. (%d, %d).\n", PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+ clearKeyDER.data = PORT_ArenaAlloc(arenaForPKI, epki->encryptedData.len);
+ clearKeyDER.len = epki->encryptedData.len;
+ clearKeyDER.type = siBuffer;
+
+ rv = DecryptKey(epki, SEC_OID_DES_EDE3_CBC, &pwitem, &pwdata, &clearKeyDER);
+ if (rv != SECSuccess) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "DekryptKey failed. (%d, %d).\n", PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+#endif
+
+ /* we could be exporting a clear or encrypted key */
+#if defined(ENCRYPTEDKEY)
+ b64 = BTOA_ConvertItemToAscii(encryptedKeyDER);
+#else
+ b64 = BTOA_ConvertItemToAscii(&clearKeyDER);
+#endif
+ if (!b64) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Failed to conver to the ASCII (%d, %d).\n",
+ PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+
+ total = PL_strlen(b64);
+ PR_fprintf(outFile, "%s\n", DONOTEDIT);
+#if defined(ENCRYPTEDKEY)
+ PR_fprintf(outFile, "%s\n", ENCRYPTED_KEY_HEADER);
+#else
+ PR_fprintf(outFile, "%s\n", KEY_HEADER);
+#endif
+ numBytes = PR_Write(outFile, b64, total);
+ if (numBytes != total) {
+ slapi_log_error(SLAPI_LOG_FATAL, "slapd_extract_key",
+ "Failed to write to the file (%d, %d).\n",
+ PR_GetError(), PR_GetOSError());
+ goto bail;
+ }
+#if defined(ENCRYPTEDKEY)
+ PR_fprintf(outFile, "\n%s\n", ENCRYPTED_KEY_TRAILER);
+#else
+ PR_fprintf(outFile, "\n%s\n", KEY_TRAILER);
+#endif
+ rv = SECSuccess;
+bail:
+ slapi_ch_free_string(&certdir);
+ slapi_ch_free_string(&KeyExtractFile);
+ slapi_ch_free_string(&keyfile);
+ if (outFile) {
+ PR_Close(outFile);
+ }
+#if defined(ENCRYPTEDKEY)
+ if (arenaForEPKI) {
+ PORT_FreeArena(arenaForEPKI, PR_FALSE);
+ }
+ if (pwitem.data) {
+ memset(pwitem.data, 0, pwitem.len);
+ PORT_Free(pwitem.data);
+ }
+ memset(&pwitem, 0, sizeof(SECItem));
+#else
+ if (arenaForPKI) {
+ PORT_FreeArena(arenaForPKI, PR_FALSE);
+ }
+ memset(randomPassword, 0, strlen((const char *)randomPassword));
+#endif
+ return rv;
+}
+
+const char *
+slapi_get_cacertfile()
+{
+ return CACertPemFile;
+}
+
+void
+slapi_set_cacertfile(char *certfile)
+{
+ slapi_ch_free_string(&CACertPemFile);
+ CACertPemFile = certfile;
+}
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 41e213e7f..b9d2ea542 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -55,8 +55,14 @@
#include <sys/pstat.h>
#endif
-
-
+static int special_filename(unsigned char c)
+{
+ if ((c < 45) || (c == '/') || ((c > 57) && (c < 65)) ||
+ ((c > 90) && (c < 95)) || (c == 96) ||(c > 122) ) {
+ return UTIL_ESCAPE_HEX;
+ }
+ return UTIL_ESCAPE_NONE;
+}
static int special_np(unsigned char c)
{
@@ -118,12 +124,16 @@ special_attr_char(unsigned char c)
c == '"');
}
+/* No '\\' */
+#define DOESCAPE_FLAGS_HEX_NOESC 0x1
+
static const char*
do_escape_string (
const char* str,
int len, /* -1 means str is nul-terminated */
char buf[BUFSIZ],
- int (*special)(unsigned char)
+ int (*special)(unsigned char),
+ int flags
)
{
const char* s;
@@ -140,54 +150,56 @@ do_escape_string (
last = str + len - 1;
for (s = str; s <= last; ++s) {
- if ( (esc = (*special)((unsigned char)*s))) {
- const char* first = str;
- char* bufNext = buf;
- int bufSpace = BUFSIZ - 4;
- while (1) {
- if (bufSpace < (s - first)) s = first + bufSpace - 1;
- if (s > first) {
- memcpy (bufNext, first, s - first);
- bufNext += (s - first);
- bufSpace -= (s - first);
- }
- if (s > last) {
- break;
- }
- do {
- if (esc == UTIL_ESCAPE_BACKSLASH) {
- /* *s is '\\' */
- /* If *(s+1) and *(s+2) are both hex digits,
- * the char is already escaped. */
- if (isxdigit(*(s+1)) && isxdigit(*(s+2))) {
- memcpy(bufNext, s, 3);
- bufNext += 3;
- bufSpace -= 3;
- s += 2;
- } else {
- *bufNext++ = *s; --bufSpace;
- }
- } else { /* UTIL_ESCAPE_HEX */
- *bufNext++ = '\\'; --bufSpace;
- if (bufSpace < 3) {
- memcpy(bufNext, "..", 2);
- bufNext += 2;
- goto bail;
- }
- PR_snprintf(bufNext, 3, "%02x", *(unsigned char*)s);
- bufNext += 2; bufSpace -= 2;
- }
- } while (++s <= last &&
+ if ( (esc = (*special)((unsigned char)*s))) {
+ const char* first = str;
+ char* bufNext = buf;
+ int bufSpace = BUFSIZ - 4;
+ while (1) {
+ if (bufSpace < (s - first)) s = first + bufSpace - 1;
+ if (s > first) {
+ memcpy (bufNext, first, s - first);
+ bufNext += (s - first);
+ bufSpace -= (s - first);
+ }
+ if (s > last) {
+ break;
+ }
+ do {
+ if (esc == UTIL_ESCAPE_BACKSLASH) {
+ /* *s is '\\' */
+ /* If *(s+1) and *(s+2) are both hex digits,
+ * the char is already escaped. */
+ if (isxdigit(*(s+1)) && isxdigit(*(s+2))) {
+ memcpy(bufNext, s, 3);
+ bufNext += 3;
+ bufSpace -= 3;
+ s += 2;
+ } else {
+ *bufNext++ = *s; --bufSpace;
+ }
+ } else { /* UTIL_ESCAPE_HEX */
+ if (!(flags & DOESCAPE_FLAGS_HEX_NOESC)) {
+ *bufNext++ = '\\'; --bufSpace;
+ }
+ if (bufSpace < 3) {
+ memcpy(bufNext, "..", 2);
+ bufNext += 2;
+ goto bail;
+ }
+ PR_snprintf(bufNext, 3, "%02x", *(unsigned char*)s);
+ bufNext += 2; bufSpace -= 2;
+ }
+ } while (++s <= last &&
(esc = (*special)((unsigned char)*s)));
- if (s > last) break;
- first = s;
- while ( (esc = (*special)((unsigned char)*s)) == UTIL_ESCAPE_NONE && s <= last) ++s;
- }
- bail:
- *bufNext = '\0';
- return buf;
- }
- }
+ if (s > last) break;
+ first = s;
+ while ( (esc = (*special)((unsigned char)*s)) == UTIL_ESCAPE_NONE && s <= last) ++s;
+ }
+bail:
+ *bufNext = '\0';
+ return buf;
+ }
+ } /* for */
return str;
}
@@ -204,13 +216,20 @@ do_escape_string (
const char*
escape_string (const char* str, char buf[BUFSIZ])
{
- return do_escape_string(str,-1,buf,special_np);
+ return do_escape_string(str,-1,buf,special_np, 0);
}
const char*
escape_string_with_punctuation(const char* str, char buf[BUFSIZ])
{
- return do_escape_string(str,-1,buf,special_np_and_punct);
+ return do_escape_string(str,-1,buf,special_np_and_punct, 0);
+}
+
+const char*
+escape_string_for_filename(const char *str)
+{
+ char buf[BUFSIZ];
+ return do_escape_string(str,-1,buf,special_filename, DOESCAPE_FLAGS_HEX_NOESC);
}
#define ESCAPE_FILTER 1
| 0 |
1bde54db66bef3c392206f343f904d32c19dabc6
|
389ds/389-ds-base
|
Ticket #49 - better handling for server shutdown while long running tasks are active
https://fedorahosted.org/389/ticket/49
Bug Description: tasks like memberOf fix-up do not check for shutdown events. In my test this causes a shutdown
to hang until the task is complete. I did not get crash in my tests.
Fix Description: The only plugins that appear to have lengthy tasks are: usn, linkedattrtrs, and memberOf. Added checks for g_get_shutdown.
Also cleaned up some code & fixed some indentation issues.
|
commit 1bde54db66bef3c392206f343f904d32c19dabc6
Author: Mark Reynolds <[email protected]>
Date: Thu Jan 19 09:55:28 2012 -0500
Ticket #49 - better handling for server shutdown while long running tasks are active
https://fedorahosted.org/389/ticket/49
Bug Description: tasks like memberOf fix-up do not check for shutdown events. In my test this causes a shutdown
to hang until the task is complete. I did not get crash in my tests.
Fix Description: The only plugins that appear to have lengthy tasks are: usn, linkedattrtrs, and memberOf. Added checks for g_get_shutdown.
Also cleaned up some code & fixed some indentation issues.
diff --git a/ldap/servers/plugins/linkedattrs/fixup_task.c b/ldap/servers/plugins/linkedattrs/fixup_task.c
index ef2c7e093..ee64d7137 100644
--- a/ldap/servers/plugins/linkedattrs/fixup_task.c
+++ b/ldap/servers/plugins/linkedattrs/fixup_task.c
@@ -130,8 +130,8 @@ linked_attrs_fixup_task_thread(void *arg)
int rc = 0;
Slapi_Task *task = (Slapi_Task *)arg;
task_data *td = NULL;
- PRCList *main_config = NULL;
- int found_config = 0;
+ PRCList *main_config = NULL;
+ int found_config = 0;
/* Fetch our task data from the task */
td = (task_data *)slapi_task_get_data(task);
@@ -144,51 +144,50 @@ linked_attrs_fixup_task_thread(void *arg)
"Syntax validate task starting (link dn: \"%s\") ...\n",
td->linkdn ? td->linkdn : "");
- linked_attrs_read_lock();
- main_config = linked_attrs_get_config();
- if (!PR_CLIST_IS_EMPTY(main_config)) {
- struct configEntry *config_entry = NULL;
- PRCList *list = PR_LIST_HEAD(main_config);
-
- while (list != main_config) {
- config_entry = (struct configEntry *) list;
-
- /* See if this is the requested config and fix up if so. */
- if (td->linkdn) {
- if (strcasecmp(td->linkdn, config_entry->dn) == 0) {
- found_config = 1;
- slapi_task_log_notice(task, "Fixing up linked attribute pair (%s)\n",
- config_entry->dn);
- slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
- "Fixing up linked attribute pair (%s)\n",
- config_entry->dn);
-
- linked_attrs_fixup_links(config_entry, NULL);
- break;
- }
- } else {
- /* No config DN was supplied, so fix up all configured links. */
+ linked_attrs_read_lock();
+ main_config = linked_attrs_get_config();
+ if (!PR_CLIST_IS_EMPTY(main_config)) {
+ struct configEntry *config_entry = NULL;
+ PRCList *list = PR_LIST_HEAD(main_config);
+
+ while (list != main_config) {
+ config_entry = (struct configEntry *) list;
+
+ /* See if this is the requested config and fix up if so. */
+ if (td->linkdn) {
+ if (strcasecmp(td->linkdn, config_entry->dn) == 0) {
+ found_config = 1;
slapi_task_log_notice(task, "Fixing up linked attribute pair (%s)\n",
- config_entry->dn);
+ config_entry->dn);
slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
- "Fixing up linked attribute pair (%s)\n", config_entry->dn);
+ "Fixing up linked attribute pair (%s)\n", config_entry->dn);
linked_attrs_fixup_links(config_entry, NULL);
+ break;
}
-
- list = PR_NEXT_LINK(list);
+ } else {
+ /* No config DN was supplied, so fix up all configured links. */
+ slapi_task_log_notice(task, "Fixing up linked attribute pair (%s)\n",
+ config_entry->dn);
+ slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
+ "Fixing up linked attribute pair (%s)\n", config_entry->dn);
+
+ linked_attrs_fixup_links(config_entry, NULL);
}
- }
- /* Log a message if we didn't find the requested attribute pair. */
- if (td->linkdn && !found_config) {
- slapi_task_log_notice(task, "Requested link config DN not found (%s)\n",
- td->linkdn);
- slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
- "Requested link config DN not found (%s)\n", td->linkdn);
+ list = PR_NEXT_LINK(list);
}
+ }
- linked_attrs_unlock();
+ /* Log a message if we didn't find the requested attribute pair. */
+ if (td->linkdn && !found_config) {
+ slapi_task_log_notice(task, "Requested link config DN not found (%s)\n",
+ td->linkdn);
+ slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
+ "Requested link config DN not found (%s)\n", td->linkdn);
+ }
+
+ linked_attrs_unlock();
/* Log finished message. */
slapi_task_log_notice(task, "Linked attributes fixup task complete.\n");
@@ -364,6 +363,10 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
int perform_update = 0;
Slapi_DN *targetsdn = slapi_sdn_new_dn_byref(targetdn);
+ if (g_get_shutdown()) {
+ return -1;
+ }
+
if (config->scope) {
/* Check if the target is within the scope. */
perform_update = slapi_dn_issuffix(targetdn, config->scope);
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c
index 9956dfe92..db6cd3efa 100644
--- a/ldap/servers/plugins/memberof/memberof.c
+++ b/ldap/servers/plugins/memberof/memberof.c
@@ -667,7 +667,9 @@ int memberof_postop_modrdn(Slapi_PBlock *pb)
{
if(0 == slapi_entry_attr_find(post_e, configCopy.groupattrs[i], &attr))
{
- memberof_moddn_attr_list(pb, &configCopy, pre_dn, post_dn, attr, txn);
+ if(memberof_moddn_attr_list(pb, &configCopy, pre_dn, post_dn, attr, txn) != 0){
+ break;
+ }
}
}
}
@@ -1266,7 +1268,10 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config,
slapi_entry_attr_find( e, config->groupattrs[i], &members );
if(members)
{
- memberof_mod_attr_list_r(pb, config, mod_op, group_dn, op_this, members, ll, txn);
+ if(memberof_mod_attr_list_r(pb, config, mod_op, group_dn, op_this, members, ll, txn) != 0){
+ rc = -1;
+ goto bail;
+ }
}
}
@@ -1668,6 +1673,11 @@ int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
Slapi_ValueSet *groupvals = *((memberof_get_groups_data*)callback_data)->groupvals;
int rc = 0;
+ if(g_get_shutdown()){
+ rc = -1;
+ goto bail;
+ }
+
if (!groupvals)
{
slapi_log_error( SLAPI_LOG_PLUGIN, MEMBEROF_PLUGIN_SUBSYSTEM,
@@ -2441,6 +2451,7 @@ int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data)
memberof_del_dn_type_callback(e, &del_data);
}
+bail:
slapi_valueset_free(groups);
return rc;
diff --git a/ldap/servers/plugins/usn/usn_cleanup.c b/ldap/servers/plugins/usn/usn_cleanup.c
index 315297550..16e6a9529 100644
--- a/ldap/servers/plugins/usn/usn_cleanup.c
+++ b/ldap/servers/plugins/usn/usn_cleanup.c
@@ -46,7 +46,6 @@ struct usn_cleanup_data {
char *maxusn_to_delete;
};
-
static int usn_cleanup_add(Slapi_PBlock *pb, Slapi_Entry *e,
Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg);
@@ -143,6 +142,15 @@ usn_cleanup_thread(void *arg)
int delrv = 0;
const Slapi_DN *sdn = slapi_entry_get_sdn_const(*ep);
+ /* check for shutdown */
+ if(g_get_shutdown()){
+ slapi_task_log_notice(task, "USN tombstone cleanup task aborted due to shutdown.");
+ slapi_task_log_status(task, "USN tombstone cleanup task aborted due to shutdown.");
+ slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,
+ "USN tombstone cleanup task aborted due to shutdown.\n");
+ goto bail;
+ }
+
slapi_delete_internal_set_pb(delete_pb, slapi_sdn_get_dn(sdn),
NULL, NULL, usn_get_identity(), 0);
slapi_delete_internal_pb(delete_pb);
| 0 |
40619625534aa886f95c45a526d5587ada6bcab0
|
389ds/389-ds-base
|
Fixed object build path: convert relative path to absolute path (tlackey)
|
commit 40619625534aa886f95c45a526d5587ada6bcab0
Author: svrbld <svrbld>
Date: Mon May 16 23:25:55 2005 +0000
Fixed object build path: convert relative path to absolute path (tlackey)
diff --git a/ldap/servers/ntds/wrapper/build.bat b/ldap/servers/ntds/wrapper/build.bat
index 30d18d520..d186de3db 100644
--- a/ldap/servers/ntds/wrapper/build.bat
+++ b/ldap/servers/ntds/wrapper/build.bat
@@ -22,6 +22,7 @@ set PATH=%PATH%;%CD%\%LIBROOT%\wix
set WXSLOC=%CD%\wix
echo %WXSLOC%
+call :relative %OBJDEST%
cd %OBJDEST%
set OK=0
@@ -32,7 +33,13 @@ set /a OK=%OK% + %ERRORLEVEL%
light ntds.wixobj
set /a OK=%OK% + %ERRORLEVEL%
+
:END
popd
if %OK% GTR 1 (set OK=1)
exit %OK%
+
+goto :EOF
+:relative
+set OBJDEST=%~f1
+goto :EOF
\ No newline at end of file
| 0 |
f542f8902900b4c6b8cbd201eff01b634a8529e3
|
389ds/389-ds-base
|
Issue 4791 - Missing dependency for RetroCL RFE (#4792)
Description: The RetroCL exclude attribute RFE is dependent on functionality of the
EntryUUID bug fix, that didn't make into the latest build. This breaks the
RetroCL exclude attr feature so we need to provide a workaround.
Fixes: https://github.com/389ds/389-ds-base/issues/4791
Relates: https://github.com/389ds/389-ds-base/pull/4723
Relates: https://github.com/389ds/389-ds-base/issues/4224
Reviewed by: tbordaz, droideck (Thank you)
|
commit f542f8902900b4c6b8cbd201eff01b634a8529e3
Author: James Chapman <[email protected]>
Date: Mon Jun 14 12:29:14 2021 +0100
Issue 4791 - Missing dependency for RetroCL RFE (#4792)
Description: The RetroCL exclude attribute RFE is dependent on functionality of the
EntryUUID bug fix, that didn't make into the latest build. This breaks the
RetroCL exclude attr feature so we need to provide a workaround.
Fixes: https://github.com/389ds/389-ds-base/issues/4791
Relates: https://github.com/389ds/389-ds-base/pull/4723
Relates: https://github.com/389ds/389-ds-base/issues/4224
Reviewed by: tbordaz, droideck (Thank you)
diff --git a/dirsrvtests/tests/suites/retrocl/basic_test.py b/dirsrvtests/tests/suites/retrocl/basic_test.py
index 543945fce..71879cef3 100644
--- a/dirsrvtests/tests/suites/retrocl/basic_test.py
+++ b/dirsrvtests/tests/suites/retrocl/basic_test.py
@@ -17,7 +17,7 @@ from lib389.utils import *
from lib389.tasks import *
from lib389.cli_base import FakeArgs, connect_instance, disconnect_instance
from lib389.cli_base.dsrc import dsrc_arg_concat
-from lib389.cli_conf.plugins.retrochangelog import retrochangelog_add
+from lib389.cli_conf.plugins.retrochangelog import retrochangelog_add_attr
from lib389.idm.user import UserAccount, UserAccounts, nsUserAccounts
pytestmark = pytest.mark.tier1
@@ -117,7 +117,7 @@ def test_retrocl_exclude_attr_add(topology_st):
args.bindpw = None
args.prompt = False
args.exclude_attrs = ATTR_HOMEPHONE
- args.func = retrochangelog_add
+ args.func = retrochangelog_add_attr
dsrc_inst = dsrc_arg_concat(args, None)
inst = connect_instance(dsrc_inst, False, args)
result = args.func(inst, None, log, args)
@@ -249,7 +249,7 @@ def test_retrocl_exclude_attr_mod(topology_st):
args.bindpw = None
args.prompt = False
args.exclude_attrs = ATTR_CARLICENSE
- args.func = retrochangelog_add
+ args.func = retrochangelog_add_attr
dsrc_inst = dsrc_arg_concat(args, None)
inst = connect_instance(dsrc_inst, False, args)
result = args.func(inst, None, log, args)
diff --git a/src/lib389/lib389/cli_conf/plugins/retrochangelog.py b/src/lib389/lib389/cli_conf/plugins/retrochangelog.py
index 75faf452d..75c096094 100644
--- a/src/lib389/lib389/cli_conf/plugins/retrochangelog.py
+++ b/src/lib389/lib389/cli_conf/plugins/retrochangelog.py
@@ -6,8 +6,13 @@
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
+# JC Work around for missing dependency on https://github.com/389ds/389-ds-base/pull/4344
+import ldap
+
from lib389.plugins import RetroChangelogPlugin
-from lib389.cli_conf import add_generic_plugin_parsers, generic_object_edit, generic_object_add_attr
+# JC Work around for missing dependency https://github.com/389ds/389-ds-base/pull/4344
+# from lib389.cli_conf import add_generic_plugin_parsers, generic_object_edit, generic_object_add_attr
+from lib389.cli_conf import add_generic_plugin_parsers, generic_object_edit, _args_to_attrs
arg_to_attr = {
'is_replicated': 'isReplicated',
@@ -18,12 +23,38 @@ arg_to_attr = {
'exclude_attrs': 'nsslapd-exclude-attrs'
}
-
def retrochangelog_edit(inst, basedn, log, args):
log = log.getChild('retrochangelog_edit')
plugin = RetroChangelogPlugin(inst)
generic_object_edit(plugin, log, args, arg_to_attr)
+# JC Work around for missing dependency https://github.com/389ds/389-ds-base/pull/4344
+def retrochangelog_add_attr(inst, basedn, log, args):
+ log = log.getChild('retrochangelog_add_attr')
+ plugin = RetroChangelogPlugin(inst)
+ generic_object_add_attr(plugin, log, args, arg_to_attr)
+
+# JC Work around for missing dependency https://github.com/389ds/389-ds-base/pull/4344
+def generic_object_add_attr(dsldap_object, log, args, arg_to_attr):
+ """Add an attribute to the entry. This differs to 'edit' as edit uses replace,
+ and this allows multivalues to be added.
+
+ dsldap_object should be a single instance of DSLdapObject with a set dn
+ """
+ log = log.getChild('generic_object_add_attr')
+ # Gather the attributes
+ attrs = _args_to_attrs(args, arg_to_attr)
+
+ modlist = []
+ for attr, value in attrs.items():
+ if not isinstance(value, list):
+ value = [value]
+ modlist.append((ldap.MOD_ADD, attr, value))
+ if len(modlist) > 0:
+ dsldap_object.apply_mods(modlist)
+ log.info("Successfully changed the %s", dsldap_object.dn)
+ else:
+ raise ValueError("There is nothing to set in the %s plugin entry" % dsldap_object.dn)
def retrochangelog_add(inst, basedn, log, args):
log = log.getChild('retrochangelog_add')
| 0 |
026acc2386cec0dabbcc4b3fb5aebd97c7003496
|
389ds/389-ds-base
|
On windows, snprintf needs underscore '_' at the beginning.
|
commit 026acc2386cec0dabbcc4b3fb5aebd97c7003496
Author: Noriko Hosoi <[email protected]>
Date: Thu Mar 17 21:22:34 2005 +0000
On windows, snprintf needs underscore '_' at the beginning.
diff --git a/ldap/servers/slapd/ntwdog/ntwatchdog.c b/ldap/servers/slapd/ntwdog/ntwatchdog.c
index 5914f4e17..7768b7bf3 100644
--- a/ldap/servers/slapd/ntwdog/ntwatchdog.c
+++ b/ldap/servers/slapd/ntwdog/ntwatchdog.c
@@ -109,7 +109,7 @@ BOOL WD_GetServerConfig(char *szServerId, char *szServerRoot, LPDWORD cbServerRo
return(bReturn);
// query registry key to figure out config directory
- snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
+ _snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
szServerId);
szSlapdKey[sizeof(szSlapdKey)-1] = (char)0;
@@ -140,7 +140,7 @@ BOOL WD_GetServerId(IN DWORD dwSubKey, OUT char *szServerId, IN OUT LPDWORD cbSe
char szSlapdKey[MAX_LINE];
if(dwSubKey == 0) {
- snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT);
+ _snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT);
szSlapdKey[sizeof(szSlapdKey)-1] = (char)0;
dwResult = RegOpenKey(HKEY_LOCAL_MACHINE, szSlapdKey,
&hSlapdKey);
@@ -238,7 +238,7 @@ DWORD WD_GetDefaultKeyValue(char *szServerName, char *szKeyName, DWORD dwDefault
DWORD cbValue = sizeof(dwValue);
// query registry key to figure out config directory
- snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
+ _snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
szServerName);
szSlapdKey[sizeof(szSlapdKey)-1] = (char)0;
if(RegOpenKey(HKEY_LOCAL_MACHINE, szSlapdKey, &hSlapdKey) == ERROR_SUCCESS)
@@ -400,7 +400,7 @@ BOOL WD_GetConfigFromRegistry(char *szServerConfig, char *szServerName)
DWORD dwResult = 0;
// query registry key to figure out config directory
- snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
+ _snprintf(szSlapdKey, sizeof(szSlapdKey), "%s\\%s\\%s", KEY_SOFTWARE_NETSCAPE, SVR_KEY_ROOT,
szServerName);
szSlapdKey[sizeof(szSlapdKey)-1] = (char)0;
@@ -496,7 +496,7 @@ BOOL WD_IsServerSecure(void)
char *szTemp;
FILE *fh = NULL;
- snprintf(szFileName, sizeof(szFileName), "%s\\%s", gszServerConfig, SLAPD_CONF);
+ _snprintf(szFileName, sizeof(szFileName), "%s\\%s", gszServerConfig, SLAPD_CONF);
szFileName[sizeof(szFileName)-1] = (char)0;
if(fh = fopen(szFileName, "r"))
{
@@ -553,7 +553,7 @@ LONG APIENTRY WD_MainWndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
char szShutdownEvent[MAX_LINE];
// shutdown web server, it should exit with 0, WatchDog won't restart it
- snprintf(szShutdownEvent, sizeof(szShutdownEvent), "NS_%s", gszServerName);
+ _snprintf(szShutdownEvent, sizeof(szShutdownEvent), "NS_%s", gszServerName);
szShutdownEvent[sizeof(szShutdownEvent)-1] = (char)0;
hevShutdown = OpenEvent(EVENT_MODIFY_STATE, FALSE, szShutdownEvent);
if(hevShutdown)
@@ -740,7 +740,7 @@ BOOL WD_StartServer(PROCESS_INFORMATION *pi)
// For Directory Server, service-name is defined as slapd.exe,
// in ldapserver/include/nt/regpargms.h
- snprintf( szCmdLine, sizeof(szCmdLine), "%s\\bin\\%s\\server\\%s -D \"%s\"", szServerPath,
+ _snprintf( szCmdLine, sizeof(szCmdLine), "%s\\bin\\%s\\server\\%s -D \"%s\"", szServerPath,
PRODUCT_NAME, SERVICE_EXE, szInstancePath );
szCmdLine[sizeof(szCmdLine)-1] = (char)0;
// szCmdLine ex: c:\navgold\server\bin\slapd\slapd.exe
@@ -924,7 +924,7 @@ BOOL WD_MonitorServer(void)
// shutdown web server
//CLOSEHANDLE(pi.hProcess); // XXXahakim close them after TerminateProcess()
//CLOSEHANDLE(pi.hThread);
- snprintf(szServerDoneEvent, sizeof(szServerDoneEvent), "NS_%s", gszServerName);
+ _snprintf(szServerDoneEvent, sizeof(szServerDoneEvent), "NS_%s", gszServerName);
szServerDoneEvent[sizeof(szServerDoneEvent)-1] = (char)0;
hevServerDone = OpenEvent(EVENT_MODIFY_STATE, FALSE, szServerDoneEvent);
if(hevServerDone)
| 0 |
8330887e9320a998256cdd13d8715505e87e0826
|
389ds/389-ds-base
|
Issue 49684 - AC_PROG_CC clobbers CFLAGS set by --enable-debug
Bug description:
Default CFLAGS and CXXFLAGS might be unset without --enable-debug.
Fix description:
* Provide default CFLAGS and CXXFLAGS that would be set by AC_PROG_CC
otherwise.
* Split compiler flags and preprocessor flags into separate variables so
they are applied in a correct order.
https://pagure.io/389-ds-base/issue/49684
Reviewed by: mhonek (Thanks!)
|
commit 8330887e9320a998256cdd13d8715505e87e0826
Author: Viktor Ashirov <[email protected]>
Date: Wed May 23 16:11:29 2018 +0200
Issue 49684 - AC_PROG_CC clobbers CFLAGS set by --enable-debug
Bug description:
Default CFLAGS and CXXFLAGS might be unset without --enable-debug.
Fix description:
* Provide default CFLAGS and CXXFLAGS that would be set by AC_PROG_CC
otherwise.
* Split compiler flags and preprocessor flags into separate variables so
they are applied in a correct order.
https://pagure.io/389-ds-base/issue/49684
Reviewed by: mhonek (Thanks!)
diff --git a/Makefile.am b/Makefile.am
index ec227618b..2db1b93ef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,11 +16,13 @@ PYTHON := python3
BUILDNUM := $(shell perl $(srcdir)/buildnum.pl)
NQBUILDNUM := $(subst \,,$(subst $(QUOTE),,$(BUILDNUM)))
DEBUG_DEFINES = @debug_defs@
-GCCSEC_DEFINES = @gccsec_defs@
-ASAN_DEFINES = @asan_defs@
-MSAN_DEFINES = @msan_defs@
-TSAN_DEFINES = @tsan_defs@
-UBSAN_DEFINES = @ubsan_defs@
+DEBUG_CFLAGS = @debug_cflags@
+DEBUG_CXXFLAGS = @debug_cxxflags@
+GCCSEC_CFLAGS = @gccsec_cflags@
+ASAN_CFLAGS = @asan_cflags@
+MSAN_CFLAGS = @msan_cflags@
+TSAN_CFLAGS = @tsan_cflags@
+UBSAN_CFLAGS = @ubsan_cflags@
SYSTEMD_DEFINES = @systemd_defs@
@@ -133,7 +135,9 @@ PATH_DEFINES = -DLOCALSTATEDIR="\"$(localstatedir)\"" -DSYSCONFDIR="\"$(sysconfd
# Now that we have all our defines in place, setup the CPPFLAGS
# These flags are the "must have" for all components
-AM_CPPFLAGS = $(DEBUG_DEFINES) $(GCCSEC_DEFINES) $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_DEFINES) $(RUST_DEFINES)
+AM_CPPFLAGS = $(DEBUG_DEFINES) $(PROFILING_DEFINES) $(RUST_DEFINES)
+AM_CFLAGS = $(DEBUG_CFLAGS) $(GCCSEC_CFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS)
+AM_CXXFLAGS = $(DEBUG_CXXFLAGS) $(GCCSEC_CFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS)
# Flags for Directory Server
# WARNING: This needs a clean up, because slap.h is a horrible mess and is publically exposed!
DSPLUGIN_CPPFLAGS = $(DS_DEFINES) $(DS_INCLUDES) $(PATH_DEFINES) $(SYSTEMD_DEFINES) $(NUNCSTANS_INCLUDES) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ $(NSPR_INCLUDES) @systemd_inc@
@@ -190,7 +194,7 @@ AM_LDFLAGS = -lpthread
else
#AM_LDFLAGS = -Wl,-z,defs
# Provide the tcmalloc links if needed
-AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(TCMALLOC_LINK) $(CLANG_LDFLAGS)
+AM_LDFLAGS = $(RUST_LDFLAGS) $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(TCMALLOC_LINK) $(CLANG_LDFLAGS)
endif #end hpux
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info
@@ -2151,37 +2155,37 @@ test_libsds_SOURCES = src/libsds/test/test_sds.c \
src/libsds/test/test_sds_ht.c \
src/libsds/test/test_fixtures.c
-test_libsds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
+test_libsds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
test_libsds_LDADD = libsds.la $(NSPR_LINK)
test_libsds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS)
benchmark_sds_SOURCES = src/libsds/test/benchmark.c \
$(libavl_a_SOURCES)
-benchmark_sds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
+benchmark_sds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_sds_LDADD = libsds.la $(NSPR_LINK)
benchmark_sds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS) $(DS_INCLUDES)
benchmark_par_sds_SOURCES = src/libsds/test/benchmark_parwrap.c \
src/libsds/test/benchmark_par.c \
$(libavl_a_SOURCES)
-benchmark_par_sds_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS)
+benchmark_par_sds_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS)
benchmark_par_sds_LDADD = libsds.la $(NSPR_LINK)
benchmark_par_sds_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(SDS_CPPFLAGS) $(DS_INCLUDES)
test_nuncstans_SOURCES = src/nunc-stans/test/test_nuncstans.c
test_nuncstans_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
-test_nuncstans_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
+test_nuncstans_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_large_SOURCES = src/nunc-stans/test/test_nuncstans_stress_large.c src/nunc-stans/test/test_nuncstans_stress_core.c
test_nuncstans_stress_large_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_stress_large_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
-test_nuncstans_stress_large_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
+test_nuncstans_stress_large_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
test_nuncstans_stress_small_SOURCES = src/nunc-stans/test/test_nuncstans_stress_small.c src/nunc-stans/test/test_nuncstans_stress_core.c
test_nuncstans_stress_small_CPPFLAGS = $(AM_CPPFLAGS) $(CMOCKA_INCLUDES) $(NUNCSTANS_CPPFLAGS)
test_nuncstans_stress_small_LDADD = libnunc-stans.la libsds.la $(NSPR_LINK)
-test_nuncstans_stress_small_LDFLAGS = $(ASAN_DEFINES) $(MSAN_DEFINES) $(TSAN_DEFINES) $(UBSAN_DEFINES) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
+test_nuncstans_stress_small_LDFLAGS = $(ASAN_CFLAGS) $(MSAN_CFLAGS) $(TSAN_CFLAGS) $(UBSAN_CFLAGS) $(PROFILING_LINKS) $(CMOCKA_LINKS) $(EVENT_LINK)
endif
diff --git a/configure.ac b/configure.ac
index 47e376ef0..aece658db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,9 @@ AC_MSG_CHECKING(for --enable-debug)
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
[
AC_MSG_RESULT(yes)
- debug_defs="-g3 -DDEBUG -DMCC_DEBUG -O0"
+ debug_defs="-DDEBUG -DMCC_DEBUG"
+ debug_cflags="-g3 -O0"
+ debug_cxxflags="-g3 -O0"
debug_rust_defs="-C debuginfo=2"
cargo_defs=""
rust_target_dir="debug"
@@ -113,11 +115,16 @@ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (de
[
AC_MSG_RESULT(no)
debug_defs=""
+ # set the default safe CFLAGS that would be set by AC_PROG_CC otherwise
+ debug_cflags="-g -O2"
+ debug_cxxflags="-g -O2"
debug_rust_defs="-C debuginfo=2"
cargo_defs="--release"
rust_target_dir="release"
])
AC_SUBST([debug_defs])
+AC_SUBST([debug_cflags])
+AC_SUBST([debug_cxxflags])
AC_SUBST([debug_rust_defs])
AC_SUBST([cargo_defs])
AC_SUBST([rust_target_dir])
@@ -127,15 +134,15 @@ AC_MSG_CHECKING(for --enable-asan)
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc/clang address sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
- asan_defs="-fsanitize=address -fno-omit-frame-pointer"
+ asan_cflags="-fsanitize=address -fno-omit-frame-pointer"
asan_rust_defs="-Z sanitizer=address"
],
[
AC_MSG_RESULT(no)
- asan_defs=""
+ asan_cflags=""
asan_rust_defs=""
])
-AC_SUBST([asan_defs])
+AC_SUBST([asan_cflags])
AC_SUBST([asan_rust_defs])
AM_CONDITIONAL(enable_asan,test "$enable_asan" = "yes")
@@ -143,15 +150,15 @@ AC_MSG_CHECKING(for --enable-msan)
AC_ARG_ENABLE(msan, AS_HELP_STRING([--enable-msan], [Enable gcc/clang memory sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
- msan_defs="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
+ msan_cflags="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
msan_rust_defs="-Z sanitizer=memory"
],
[
AC_MSG_RESULT(no)
- msan_defs=""
+ msan_cflags=""
msan_rust_defs=""
])
-AC_SUBST([msan_defs])
+AC_SUBST([msan_cflags])
AC_SUBST([msan_rust_defs])
AM_CONDITIONAL(enable_msan,test "$enable_msan" = "yes")
@@ -159,15 +166,15 @@ AC_MSG_CHECKING(for --enable-tsan)
AC_ARG_ENABLE(tsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang thread sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
- tsan_defs="-fsanitize=thread -fno-omit-frame-pointer"
+ tsan_cflags="-fsanitize=thread -fno-omit-frame-pointer"
tsan_rust_defs="-Z sanitizer=thread"
],
[
AC_MSG_RESULT(no)
- tsan_defs=""
+ tsan_cflags=""
tsan_rust_defs=""
])
-AC_SUBST([tsan_defs])
+AC_SUBST([tsan_cflags])
AC_SUBST([tsan_rust_defs])
AM_CONDITIONAL(enable_tsan,test "$enable_tsan" = "yes")
@@ -175,15 +182,15 @@ AC_MSG_CHECKING(for --enable-ubsan)
AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang undefined behaviour sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
- ubsan_defs="-fsanitize=undefined -fno-omit-frame-pointer"
+ ubsan_cflags="-fsanitize=undefined -fno-omit-frame-pointer"
ubsan_rust_defs=""
],
[
AC_MSG_RESULT(no)
- ubsan_defs=""
+ ubsan_cflags=""
ubsan_rust_defs=""
])
-AC_SUBST([ubsan_defs])
+AC_SUBST([ubsan_cflags])
AC_SUBST([ubsan_rust_defs])
AM_CONDITIONAL(enable_ubsan,test "$enable_ubsan" = "yes")
@@ -220,19 +227,19 @@ AC_ARG_ENABLE(gcc-security, AS_HELP_STRING([--enable-gcc-security], [Enable gcc
[
AC_MSG_RESULT(yes)
AM_COND_IF([RPM_HARDEND_CC],
- [ gccsec_defs="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
- [ gccsec_defs="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
+ [ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 " ],
+ [ gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security" ]
)
],
[
# Without this, -fPIC doesn't work on generic fedora builds, --disable-gcc-sec.
AC_MSG_RESULT(no)
AM_COND_IF([RPM_HARDEND_CC],
- [ gccsec_defs="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
- [ gccsec_defs="" ]
+ [ gccsec_cflags="-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
+ [ gccsec_cflags="" ]
)
])
-AC_SUBST([gccsec_defs])
+AC_SUBST([gccsec_cflags])
# Pull in profiling.
AC_MSG_CHECKING(for --enable-profiling)
diff --git a/src/svrcore/configure.ac b/src/svrcore/configure.ac
index b855a4233..32f5ed82f 100644
--- a/src/svrcore/configure.ac
+++ b/src/svrcore/configure.ac
@@ -46,13 +46,13 @@ AC_MSG_CHECKING(for --enable-asan)
AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc address sanitizer options (default: no)]),
[
AC_MSG_RESULT(yes)
- asan_defs="-fsanitize=address -fno-omit-frame-pointer"
+ asan_cflags="-fsanitize=address -fno-omit-frame-pointer"
],
[
AC_MSG_RESULT(no)
- asan_defs=""
+ asan_cflags=""
])
-AC_SUBST([asan_defs])
+AC_SUBST([asan_cflags])
AC_SUBST([NSPR_CFLAGS])
AC_SUBST([NSPR_LIBS])
diff --git a/src/svrcore/src/Makefile.am b/src/svrcore/src/Makefile.am
index fba358366..f74dfab29 100644
--- a/src/svrcore/src/Makefile.am
+++ b/src/svrcore/src/Makefile.am
@@ -1,8 +1,9 @@
-ASAN_DEFINES = @asan_defs@
+ASAN_CFLAGS = @asan_cflags@
DEBUG_DEFINES = @debug_defs@
+DEBUG_CFLAGS = @debug_cflags@
-AM_CPPFLAGS = $(ASAN_DEFINES) $(DEBUG_DEFINES)
-AM_LDFLAGS = $(ASAN_DEFINES) $(DEBUG_DEFINES)
+AM_CPPFLAGS = $(DEBUG_DEFINES)
+AM_CFLAGS = $(DEBUG_CFLAGS) $(ASAN_CFLAGS)
EXTRA_DIST = key.ico \
logo.ico \
| 0 |
e64a91376288adece5d9578a93ede1bc15db1b5d
|
389ds/389-ds-base
|
Bug(s) fixed: 145179
Bug Description: The auth specific PAM libraries do not have a run time
dependency on libpam, but they do use symbols
in libpam - they expect the executable has already loaded libpam and
made its symbols visible to all other
dynamically loaded libraries. This breaks with DS when loading the PAM
plugin since we just use the default
dlopen arguments, which make the symbols private. We need a way to tell
the plugin loader to treat certain
plugins differently without changing the behavior for all plugins.
Reviewed by: dboreham, nkinder (Thanks!)
Fix Description: Added two new plugin configuration options:
nsslapd-pluginLoadNow and nsslapd-pluginLoadGlobal. These are boolean
valued and false by default (also false if absent). LoadNow causes all
symbols in the plugin and all of its dependents to be loaded
immediately, as opposed to load lazy which only loads the symbol when
used the first time (we probably don't ever want to do this, but it's
there if we need it). LoadGlobal makes all loaded symbols visible to
the executable and all other dynamically loaded libraries, which solves
the PAM problem.
Platforms tested: RHEL3
Flag Day: no
Doc impact: Yes. Need to document the two new plugin config attributes
and their behavior, and document slapi_entry_get_bool().
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
|
commit e64a91376288adece5d9578a93ede1bc15db1b5d
Author: Rich Megginson <[email protected]>
Date: Tue Jan 25 22:38:13 2005 +0000
Bug(s) fixed: 145179
Bug Description: The auth specific PAM libraries do not have a run time
dependency on libpam, but they do use symbols
in libpam - they expect the executable has already loaded libpam and
made its symbols visible to all other
dynamically loaded libraries. This breaks with DS when loading the PAM
plugin since we just use the default
dlopen arguments, which make the symbols private. We need a way to tell
the plugin loader to treat certain
plugins differently without changing the behavior for all plugins.
Reviewed by: dboreham, nkinder (Thanks!)
Fix Description: Added two new plugin configuration options:
nsslapd-pluginLoadNow and nsslapd-pluginLoadGlobal. These are boolean
valued and false by default (also false if absent). LoadNow causes all
symbols in the plugin and all of its dependents to be loaded
immediately, as opposed to load lazy which only loads the symbol when
used the first time (we probably don't ever want to do this, but it's
there if we need it). LoadGlobal makes all loaded symbols visible to
the executable and all other dynamically loaded libraries, which solves
the PAM problem.
Platforms tested: RHEL3
Flag Day: no
Doc impact: Yes. Need to document the two new plugin config attributes
and their behavior, and document slapi_entry_get_bool().
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
diff --git a/ldap/servers/slapd/dynalib.c b/ldap/servers/slapd/dynalib.c
index 4839a17be..aeb12a1f3 100644
--- a/ldap/servers/slapd/dynalib.c
+++ b/ldap/servers/slapd/dynalib.c
@@ -23,9 +23,20 @@ static void symload_report_error( char *libpath, char *symbol, char *plugin,
void *
sym_load( char *libpath, char *symbol, char *plugin, int report_errors )
+{
+ return sym_load_with_flags(libpath, symbol, plugin, report_errors, PR_FALSE, PR_FALSE);
+}
+
+void *
+sym_load_with_flags( char *libpath, char *symbol, char *plugin, int report_errors, PRBool load_now, PRBool load_global )
{
int i;
void *handle;
+ PRLibSpec libSpec;
+ unsigned int flags = PR_LD_LAZY; /* default PR_LoadLibrary flag */
+
+ libSpec.type = PR_LibSpec_Pathname;
+ libSpec.value.pathname = libpath;
for ( i = 0; libs != NULL && libs[i] != NULL; i++ ) {
if ( strcasecmp( libs[i]->dl_name, libpath ) == 0 ) {
@@ -37,7 +48,14 @@ sym_load( char *libpath, char *symbol, char *plugin, int report_errors )
}
}
- if ( (handle = PR_LoadLibrary( libpath )) == NULL ) {
+ if (load_now) {
+ flags = PR_LD_NOW;
+ }
+ if (load_global) {
+ flags |= PR_LD_GLOBAL;
+ }
+
+ if ( (handle = PR_LoadLibraryWithFlags( libSpec, flags )) == NULL ) {
if ( report_errors ) {
symload_report_error( libpath, symbol, plugin, 0 /* lib not open */ );
}
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 0d3150531..dc232db2e 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2180,6 +2180,36 @@ slapi_entry_attr_get_ulong( const Slapi_Entry* e, const char *type)
return r;
}
+PRBool
+slapi_entry_attr_get_bool( const Slapi_Entry* e, const char *type)
+{
+ PRBool r = PR_FALSE; /* default if no attr */
+ Slapi_Attr* attr;
+ slapi_entry_attr_find(e, type, &attr);
+ if (attr!=NULL)
+ {
+ Slapi_Value *v;
+ const struct berval *bvp;
+
+ slapi_valueset_first_value( &attr->a_present_values, &v);
+ bvp = slapi_value_get_berval(v);
+ if ((bvp == NULL) || (bvp->bv_len == 0)) { /* none or empty == false */
+ r = PR_FALSE;
+ } else if (!PL_strncasecmp(bvp->bv_val, "true", bvp->bv_len)) {
+ r = PR_TRUE;
+ } else if (!PL_strncasecmp(bvp->bv_val, "false", bvp->bv_len)) {
+ r = PR_FALSE;
+ } else if (!PL_strncasecmp(bvp->bv_val, "yes", bvp->bv_len)) {
+ r = PR_TRUE;
+ } else if (!PL_strncasecmp(bvp->bv_val, "no", bvp->bv_len)) {
+ r = PR_FALSE;
+ } else { /* assume numeric: 0 - false: non-zero - true */
+ r = (PRBool)slapi_value_get_ulong(v);
+ }
+ }
+ return r;
+}
+
void
slapi_entry_attr_set_charptr( Slapi_Entry* e, const char *type, const char *value)
{
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 5477f3e2d..825fb21b5 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -2064,6 +2064,9 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
if (!initfunc)
{
+ PRBool loadNow = PR_FALSE;
+ PRBool loadGlobal = PR_FALSE;
+
if (!(value = slapi_entry_attr_get_charptr(plugin_entry,
ATTR_PLUGIN_PATH)))
{
@@ -2079,12 +2082,15 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
plugin->plg_libpath = value; /* plugin owns value's memory now, don't free */
}
+ loadNow = slapi_entry_attr_get_bool(plugin_entry, ATTR_PLUGIN_LOAD_NOW);
+ loadGlobal = slapi_entry_attr_get_bool(plugin_entry, ATTR_PLUGIN_LOAD_GLOBAL);
+
/*
* load the plugin's init function
*/
- if ((initfunc = (slapi_plugin_init_fnptr)sym_load(plugin->plg_libpath,
- plugin->plg_initfunc, plugin->plg_name, 1 /* report errors */
- )) == NULL)
+ if ((initfunc = (slapi_plugin_init_fnptr)sym_load_with_flags(plugin->plg_libpath,
+ plugin->plg_initfunc, plugin->plg_name, 1 /* report errors */,
+ loadNow, loadGlobal)) == NULL)
{
status = -1;
goto PLUGIN_CLEANUP;
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 06d718eb9..96a60a01c 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -406,6 +406,14 @@ int hexchar2int( char c );
* dynalib.c
*/
void *sym_load( char *libpath, char *symbol, char *plugin, int report_errors );
+/* same as above but
+ * load_now - use PR_LD_NOW so that all referenced symbols are loaded immediately
+ * default is PR_LD_LAZY which only loads symbols as they are referenced
+ * load_global - use PR_LD_GLOBAL so that all loaded symbols are made available globally
+ * to all other dynamically loaded libraries - default is PR_LD_LOCAL
+ * which only makes symbols visible to the executable
+ */
+void *sym_load_with_flags( char *libpath, char *symbol, char *plugin, int report_errors, PRBool load_now, PRBool load_global );
/*
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index ad1ccdda4..28663b6de 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -632,6 +632,8 @@ struct matchingRuleList {
#define ATTR_PLUGIN_TARGET_SUBTREE "nsslapd-targetSubtree"
#define ATTR_PLUGIN_BIND_SUBTREE "nsslapd-bindSubtree"
#define ATTR_PLUGIN_INVOKE_FOR_REPLOP "nsslapd-invokeForReplOp"
+#define ATTR_PLUGIN_LOAD_NOW "nsslapd-pluginLoadNow"
+#define ATTR_PLUGIN_LOAD_GLOBAL "nsslapd-pluginLoadGlobal"
/* plugin action states */
enum
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 52c437aa7..c7263b4d2 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -13,6 +13,7 @@
extern "C" {
#endif
+#include "prtypes.h"
#include "ldap.h"
/*
@@ -211,6 +212,7 @@ int slapi_entry_attr_get_int(const Slapi_Entry* e, const char *type);
unsigned int slapi_entry_attr_get_uint(const Slapi_Entry* e, const char *type);
long slapi_entry_attr_get_long( const Slapi_Entry* e, const char *type);
unsigned long slapi_entry_attr_get_ulong( const Slapi_Entry* e, const char *type);
+PRBool slapi_entry_attr_get_bool( const Slapi_Entry* e, const char *type);
void slapi_entry_attr_set_charptr(Slapi_Entry* e, const char *type, const char *value);
void slapi_entry_attr_set_int( Slapi_Entry* e, const char *type, int l);
void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigned int l);
| 0 |
271b0ee57bd395a79f6ed81ac749191f33ff0dbb
|
389ds/389-ds-base
|
Resolves: bug 224672
Bug Description: Get rid of key/cert db prefix
Reviewed by: nhosoi (Thanks!)
Fix Description: Now that we have everything in its own instance
specific directory, we do not need the troublesome key/cert database
prefix. This simplifies the slapd_nss_init code a great deal.
Platforms tested: RHEL4
Flag Day: no
Doc impact: YES - A couple of the pages on the wiki talk about slapd-instance-cert8.db and so on - these pages will have to change once FDS 1.1 is released
|
commit 271b0ee57bd395a79f6ed81ac749191f33ff0dbb
Author: Rich Megginson <[email protected]>
Date: Mon Jan 29 16:46:25 2007 +0000
Resolves: bug 224672
Bug Description: Get rid of key/cert db prefix
Reviewed by: nhosoi (Thanks!)
Fix Description: Now that we have everything in its own instance
specific directory, we do not need the troublesome key/cert database
prefix. This simplifies the slapd_nss_init code a great deal.
Platforms tested: RHEL4
Flag Day: no
Doc impact: YES - A couple of the pages on the wiki talk about slapd-instance-cert8.db and so on - these pages will have to change once FDS 1.1 is released
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 9e4b0efce..13fc00b62 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -424,146 +424,68 @@ warn_if_no_key_file(const char *path, const char *name)
* config. entries from dse.ldif are NOT available (used only when
* running in referral mode).
* As of DS6.1, the init_ssl flag passed is ignored.
+ *
+ * richm 20070126 - By default now we put the key/cert db files
+ * in an instance specific directory (the certdir directory) so
+ * we do not need a prefix any more.
*/
int
slapd_nss_init(int init_ssl, int config_available)
{
SECStatus secStatus;
PRErrorCode errorCode;
- char *keyfn = NULL;
- char *certfn = NULL;
- char *val = NULL;
- char certPref[1024];
- char keyPref[1024];
- char path[1024];
+ PRStatus status;
int rv = 0;
int len = 0;
PRUint32 nssFlags = 0;
- Slapi_Entry *ec = NULL;
char *certdir;
- if (config_available) {
- getConfigEntry( configDN, &ec );
- }
-
- if ( ec != NULL ) {
- certfn = slapi_entry_attr_get_charptr( ec, "nscertfile" );
- keyfn = slapi_entry_attr_get_charptr( ec, "nskeyfile" );
- slapi_entry_free (ec);
- ec = NULL;
- }
-
/* set in slapd_bootstrap_config,
thus certdir is available even if config_available is false */
certdir = config_get_certdir();
- PL_strncpyz(path, certdir, sizeof(path));
- slapi_ch_free_string(&certdir);
/* make sure path does not end in the path separator character */
- len = strlen(path);
- if (path[len-1] == '/' || path[len-1] == '\\') {
- path[len-1] = '\0';
- }
-
- /* get the server instance dir name from path:
- <sysconfig>/BRAND_DS/slapd-<id> */
- val = strrchr(path, '/');
- if (!val) {
- val = strrchr(path, '\\');
- }
- val++;
-
- if (keyfn && certfn) {
- if (is_abspath(certfn)) {
- warn_if_no_cert_file(certfn);
- /* first, initialize path from the certfn */
- PL_strncpyz(path, certfn, sizeof(path));
- /* extract path from cert db filename */
- val = strrchr(path, '/');
- if (!val) {
- val = strrchr(path, '\\');
- }
- *val = 0; /* path is initialized */
- /* next, init the cert db prefix */
- val++;
- PL_strncpyz(certPref, val, sizeof(certPref));
- } else {
- PL_strncpyz(val, certfn, sizeof(path)-(val-path));
- warn_if_no_cert_file(path); /* assumes certfn is relative to server root */
- val = strrchr(path, '/');
- if (!val) {
- val = strrchr(path, '\\');
- }
- val++;
- PL_strncpyz(certPref, val, sizeof(certPref));
- *val = '\0';
- }
- /* path represents now the base directory where cert, key, pin, and module db live */
- /* richm - use strrstr to get the last occurance of -cert in the string, in case
- the instance is named slapd-cert - the certdb name will be slapd-cert-cert7.db
- */
- val = PL_strrstr(certPref, "-cert");
- val++;
- *val = '\0';
- /* certPref keeps the prefix added to the cert db, usually "slapd-myserver-" */
-
- /* now find the key db prefix */
- val = strrchr(keyfn, '/');
- if (!val) {
- val = strrchr(keyfn, '\\');
- }
- if (val != NULL) {
- val++;
- } else {
- val = keyfn;
- }
- PL_strncpyz(keyPref, val, sizeof(keyPref));
- warn_if_no_key_file(path, keyPref);
- /* richm - use strrstr to get the last occurance of -key in the string, in case
- the instance is named slapd-key - the keydb name will be slapd-key-key3.db
- */
- val = PL_strrstr(keyPref, "-key");
- val++;
- *val = '\0';
- /* keypref keeps the prefix added to the key db, usually "slapd-myserver-" */
- } else {
- if ( config_get_security() ) {
- /* Have to have the key and cert file names to enable an SSL port */
- errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Failed to retrieve SSL "
- "configuration information ("
- SLAPI_COMPONENT_NAME_NSPR " error %d - %s): "
- "nskeyfile: %s, nscertfile: %s ",
- errorCode, slapd_pr_strerror(errorCode),
- (keyfn ? "found" : "not found"),
- (certfn ? "found" : "not found"));
- }
- PR_snprintf(certPref, sizeof(certPref), "%s-", val);
- PL_strncpyz(keyPref, certPref, sizeof(keyPref));
+ len = strlen(certdir);
+ if (certdir[len-1] == '/' || certdir[len-1] == '\\') {
+ certdir[len-1] = '\0';
}
- slapi_ch_free((void **) &certfn);
- slapi_ch_free((void **) &keyfn);
+ /* we open the key/cert db in rw mode, so make sure the directory
+ is writable */
+ if (PR_SUCCESS != (status = PR_Access(certdir, PR_ACCESS_WRITE_OK))) {
+ char *serveruser = "unknown";
+#ifndef _WIN32
+ serveruser = config_get_localuser();
+#endif
+ slapi_log_error(SLAPI_LOG_FATAL, "SSL Initialization",
+ "Warning: The key/cert database directory [%s] is not writable by "
+ "the server uid [%s]: initialization likely to fail.\n",
+ certdir, serveruser);
+#ifndef _WIN32
+ slapi_ch_free_string(&serveruser);
+#endif
+ }
/******** Initialise NSS *********/
nssFlags &= (~NSS_INIT_READONLY);
slapd_pk11_configurePKCS11(NULL, NULL, tokDes, ptokDes, NULL, NULL, NULL, NULL, 0, 0 );
- secStatus = NSS_Initialize(path, certPref, keyPref, "secmod.db", nssFlags);
+ secStatus = NSS_Initialize(certdir, NULL, NULL, "secmod.db", nssFlags);
- dongle_file_name = PR_smprintf("%s/%spin.txt", path, certPref);
+ dongle_file_name = PR_smprintf("%s/pin.txt", certdir);
if (secStatus != SECSuccess) {
errorCode = PR_GetError();
slapd_SSL_warn("Security Initialization: NSS initialization failed ("
SLAPI_COMPONENT_NAME_NSPR " error %d - %s): "
- "path: %s, certdb prefix: %s, keydb prefix: %s.",
- errorCode, slapd_pr_strerror(errorCode), path, certPref, keyPref);
+ "certdir: %s",
+ errorCode, slapd_pr_strerror(errorCode), certdir);
rv = -1;
}
/****** end of NSS Initialization ******/
+ slapi_ch_free_string(&certdir);
return rv;
}
| 0 |
226bad930f2f91e2e487001f1f4e3b0e9531de1d
|
389ds/389-ds-base
|
Ticket 47628: port testcases to new DirSrv interface
Bug Description:
After ticket https://fedorahosted.org/389/ticket/47625, the DirSrv interface changed.
The test cases needs to be ported to this new interface
Fix Description:
https://fedorahosted.org/389/ticket/47628
Reviewed by: Rich Megginson (thanks Rich)
Platforms tested: F17
Flag Day: no
Doc impact: no
|
commit 226bad930f2f91e2e487001f1f4e3b0e9531de1d
Author: Thierry bordaz (tbordaz) <[email protected]>
Date: Thu Dec 12 17:45:24 2013 +0100
Ticket 47628: port testcases to new DirSrv interface
Bug Description:
After ticket https://fedorahosted.org/389/ticket/47625, the DirSrv interface changed.
The test cases needs to be ported to this new interface
Fix Description:
https://fedorahosted.org/389/ticket/47628
Reviewed by: Rich Megginson (thanks Rich)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tickets/constants.py b/dirsrvtests/tickets/constants.py
index 44b9b3a21..f4fe8fc53 100644
--- a/dirsrvtests/tickets/constants.py
+++ b/dirsrvtests/tickets/constants.py
@@ -5,11 +5,13 @@ Created on Oct 31, 2013
'''
import os
from lib389 import DN_DM
+from lib389._constants import *
+from lib389.properties import *
-LOCALHOST = "localhost.localdomain"
SUFFIX = 'dc=example,dc=com'
PASSWORD = 'password'
+
# Used for standalone topology
HOST_STANDALONE = LOCALHOST
PORT_STANDALONE = 33389
@@ -45,22 +47,23 @@ PORT_CONSUMER_2 = 55389
SERVERID_CONSUMER_2 = 'consumer_2'
# Each defined instance above must be added in that list
-ALL_INSTANCES = [ {'host': HOST_STANDALONE, 'port': PORT_STANDALONE, 'serverid': SERVERID_STANDALONE},
- {'host': HOST_MASTER, 'port': PORT_MASTER, 'serverid': SERVERID_MASTER},
- {'host': HOST_CONSUMER, 'port': PORT_CONSUMER, 'serverid': SERVERID_CONSUMER},
- {'host': HOST_MASTER_1, 'port': PORT_MASTER_1, 'serverid': SERVERID_MASTER_1},
- {'host': HOST_MASTER_2, 'port': PORT_MASTER_2, 'serverid': SERVERID_MASTER_2},
- {'host': HOST_CONSUMER_1, 'port': PORT_CONSUMER_1, 'serverid': SERVERID_CONSUMER_1},
- {'host': HOST_CONSUMER_2, 'port': PORT_CONSUMER_2, 'serverid': SERVERID_CONSUMER_2},
+ALL_INSTANCES = [ {SER_HOST: HOST_STANDALONE, SER_PORT: PORT_STANDALONE, SER_SERVERID_PROP: SERVERID_STANDALONE},
+ {SER_HOST: HOST_MASTER, SER_PORT: PORT_MASTER, SER_SERVERID_PROP: SERVERID_MASTER},
+ {SER_HOST: HOST_CONSUMER, SER_PORT: PORT_CONSUMER, SER_SERVERID_PROP: SERVERID_CONSUMER},
+ {SER_HOST: HOST_MASTER_1, SER_PORT: PORT_MASTER_1, SER_SERVERID_PROP: SERVERID_MASTER_1},
+ {SER_HOST: HOST_MASTER_2, SER_PORT: PORT_MASTER_2, SER_SERVERID_PROP: SERVERID_MASTER_2},
+ {SER_HOST: HOST_CONSUMER_1, SER_PORT: PORT_CONSUMER_1, SER_SERVERID_PROP: SERVERID_CONSUMER_1},
+ {SER_HOST: HOST_CONSUMER_2, SER_PORT: PORT_CONSUMER_2, SER_SERVERID_PROP: SERVERID_CONSUMER_2},
]
# This is a template
args_instance = {
- 'prefix': os.environ.get('PREFIX', None),
- 'backupdir': os.environ.get('BACKUPDIR', "/tmp"),
- 'newrootdn': DN_DM,
- 'newrootpw': PASSWORD,
- 'newhost': LOCALHOST,
- 'newport': 389,
- 'newinstance': "template",
- 'newsuffix': SUFFIX,
- 'no_admin': True}
+ SER_DEPLOYED_DIR: os.environ.get('PREFIX', None),
+ SER_BACKUP_INST_DIR: os.environ.get('BACKUPDIR', DEFAULT_BACKUPDIR),
+ SER_ROOT_DN: DN_DM,
+ SER_ROOT_PW: PASSWORD,
+ SER_HOST: LOCALHOST,
+ SER_PORT: DEFAULT_PORT,
+ SER_SERVERID_PROP: "template",
+ SER_CREATION_SUFFIX: DEFAULT_SUFFIX}
+
+
diff --git a/dirsrvtests/tickets/finalizer.py b/dirsrvtests/tickets/finalizer.py
index 23356dd9d..72e0c0f74 100644
--- a/dirsrvtests/tickets/finalizer.py
+++ b/dirsrvtests/tickets/finalizer.py
@@ -15,46 +15,27 @@ import pytest
from lib389 import DirSrv, Entry, tools
from lib389.tools import DirSrvTools
from lib389._constants import DN_DM
+from lib389.properties import *
from constants import *
log = logging.getLogger(__name__)
global installation_prefix
-
-
-def _remove_instance(args):
-
- # check the instance parameters
- args_instance['newhost'] = args.get('host', None)
- if not args_instance['newhost']:
- raise ValueError("host not defined")
-
- args_instance['newport'] = args.get('port', None)
- if not args_instance['newport']:
- raise ValueError("port not defined")
-
- args_instance['newinstance'] = args.get('serverid', None)
- if not args_instance['newinstance']:
- raise ValueError("serverid not defined")
-
- args_instance['prefix'] = args.get('prefix', None)
-
- # Get the status of the instance and remove it if it exists
- instance = DirSrvTools.existsInstance(args_instance)
- if instance:
- log.debug("_remove_instance %s %s:%d" % (instance.serverId, instance.host, instance.port))
- DirSrvTools.removeInstance(instance)
-
+installation_prefix=os.getenv('PREFIX')
def test_finalizer():
global installation_prefix
# for each defined instance, remove it
- for instance in ALL_INSTANCES:
+ for args_instance in ALL_INSTANCES:
if installation_prefix:
# overwrite the environment setting
- instance['prefix'] = installation_prefix
- _remove_instance(instance)
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ instance = DirSrv(verbose=True)
+ instance.allocate(args_instance)
+ if instance.exists():
+ instance.delete()
def run_isolated():
'''
diff --git a/dirsrvtests/tickets/ticket47490_test.py b/dirsrvtests/tickets/ticket47490_test.py
index 4fa8ffdf9..48254b47b 100644
--- a/dirsrvtests/tickets/ticket47490_test.py
+++ b/dirsrvtests/tickets/ticket47490_test.py
@@ -16,6 +16,7 @@ import re
from lib389 import DirSrv, Entry, tools
from lib389.tools import DirSrvTools
from lib389._constants import *
+from lib389.properties import *
from constants import *
logging.getLogger(__name__).setLevel(logging.DEBUG)
@@ -30,27 +31,14 @@ MUST_NEW = "(postalAddress $ preferredLocale $ telexNumber)"
MAY_OLD = "(postalCode $ street)"
MAY_NEW = "(postalCode $ street $ postOfficeBox)"
-def _ds_create_instance(args):
- # create the standalone instance
- return tools.DirSrvTools.createInstance(args, verbose=False)
-
-def _ds_rebind_instance(dirsrv):
- args_instance['prefix'] = dirsrv.prefix
- args_instance['backupdir'] = dirsrv.backupdir
- args_instance['newrootdn'] = dirsrv.binddn
- args_instance['newrootpw'] = dirsrv.bindpw
- args_instance['newhost'] = dirsrv.host
- args_instance['newport'] = dirsrv.port
- args_instance['newinstance'] = dirsrv.serverId
- args_instance['newsuffix'] = SUFFIX
- args_instance['no_admin'] = True
-
- return tools.DirSrvTools.createInstance(args_instance)
class TopologyMasterConsumer(object):
def __init__(self, master, consumer):
- self.master = _ds_rebind_instance(master)
- self.consumer = _ds_rebind_instance(consumer)
+ master.open()
+ self.master = master
+
+ consumer.open()
+ self.consumer = consumer
def pattern_errorlog(file, log_pattern):
try:
@@ -155,51 +143,63 @@ def topology(request):
global installation_prefix
if installation_prefix:
- args_instance['prefix'] = installation_prefix
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ master = DirSrv(verbose=False)
+ consumer = DirSrv(verbose=False)
# Args for the master instance
- args_instance['newhost'] = HOST_MASTER
- args_instance['newport'] = PORT_MASTER
- args_instance['newinstance'] = SERVERID_MASTER
+ args_instance[SER_HOST] = HOST_MASTER
+ args_instance[SER_PORT] = PORT_MASTER
+ args_instance[SER_SERVERID_PROP] = SERVERID_MASTER
args_master = args_instance.copy()
+ master.allocate(args_master)
# Args for the consumer instance
- args_instance['newhost'] = HOST_CONSUMER
- args_instance['newport'] = PORT_CONSUMER
- args_instance['newinstance'] = SERVERID_CONSUMER
+ args_instance[SER_HOST] = HOST_CONSUMER
+ args_instance[SER_PORT] = PORT_CONSUMER
+ args_instance[SER_SERVERID_PROP] = SERVERID_CONSUMER
args_consumer = args_instance.copy()
+ consumer.allocate(args_consumer)
# Get the status of the backups
- backup_master = DirSrvTools.existsBackup(args_master)
- backup_consumer = DirSrvTools.existsBackup(args_consumer)
+ backup_master = master.checkBackupFS()
+ backup_consumer = consumer.checkBackupFS()
# Get the status of the instance and restart it if it exists
- instance_master = DirSrvTools.existsInstance(args_master)
+ instance_master = master.exists()
if instance_master:
- DirSrvTools.stop(instance_master, timeout=10)
- DirSrvTools.start(instance_master, timeout=10)
+ master.stop(timeout=10)
+ master.start(timeout=10)
- instance_consumer = DirSrvTools.existsInstance(args_consumer)
+ instance_consumer = consumer.exists()
if instance_consumer:
- DirSrvTools.stop(instance_consumer, timeout=10)
- DirSrvTools.start(instance_consumer, timeout=10)
+ consumer.stop(timeout=10)
+ consumer.start(timeout=10)
if backup_master and backup_consumer:
# The backups exist, assuming they are correct
# we just re-init the instances with them
- master = _ds_create_instance(args_master)
- consumer = _ds_create_instance(args_consumer)
+ if not instance_master:
+ master.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ master.open()
+
+ if not instance_consumer:
+ consumer.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ consumer.open()
# restore master from backup
- DirSrvTools.stop(master, timeout=10)
- DirSrvTools.instanceRestoreFS(master, backup_master)
- DirSrvTools.start(master, timeout=10)
+ master.stop(timeout=10)
+ master.restoreFS(backup_master)
+ master.start(timeout=10)
# restore consumer from backup
- DirSrvTools.stop(consumer, timeout=10)
- DirSrvTools.instanceRestoreFS(consumer, backup_consumer)
- DirSrvTools.start(consumer, timeout=10)
+ consumer.stop(timeout=10)
+ consumer.restoreFS(backup_consumer)
+ consumer.start(timeout=10)
else:
# We should be here only in two conditions
# - This is the first time a test involve master-consumer
@@ -210,19 +210,21 @@ def topology(request):
# Remove all the backups. So even if we have a specific backup file
# (e.g backup_master) we clear all backups that an instance my have created
if backup_master:
- DirSrvTools.clearInstanceBackupFS(dirsrv=instance_master)
+ master.clearBackupFS()
if backup_consumer:
- DirSrvTools.clearInstanceBackupFS(dirsrv=instance_consumer)
+ consumer.clearBackupFS()
# Remove all the instances
if instance_master:
- DirSrvTools.removeInstance(instance_master)
+ master.delete()
if instance_consumer:
- DirSrvTools.removeInstance(instance_consumer)
-
- # Create the instance
- master = _ds_create_instance(args_master)
- consumer = _ds_create_instance(args_consumer)
+ consumer.delete()
+
+ # Create the instances
+ master.create()
+ master.open()
+ consumer.create()
+ consumer.open()
#
# Now prepare the Master-Consumer topology
@@ -258,13 +260,13 @@ def topology(request):
loop += 1
# Time to create the backups
- DirSrvTools.stop(master, timeout=10)
- master.backupfile = DirSrvTools.instanceBackupFS(master)
- DirSrvTools.start(master, timeout=10)
+ master.stop(timeout=10)
+ master.backupfile = master.backupFS()
+ master.start(timeout=10)
- DirSrvTools.stop(consumer, timeout=10)
- consumer.backupfile = DirSrvTools.instanceBackupFS(consumer)
- DirSrvTools.start(consumer, timeout=10)
+ consumer.stop(timeout=10)
+ consumer.backupfile = consumer.backupFS()
+ consumer.start(timeout=10)
#
# Here we have two instances master and consumer
@@ -641,6 +643,9 @@ def test_ticket47490_nine(topology):
res = pattern_errorlog(topology.master.errorlog_file, regex)
assert res == None
+def test_ticket47490_final(topology):
+ topology.master.stop(timeout=10)
+ topology.consumer.stop(timeout=10)
def run_isolated():
'''
@@ -664,6 +669,8 @@ def run_isolated():
test_ticket47490_seven(topo)
test_ticket47490_eight(topo)
test_ticket47490_nine(topo)
+
+ test_ticket47490_final(topo)
if __name__ == '__main__':
diff --git a/dirsrvtests/tickets/ticket47560_test.py b/dirsrvtests/tickets/ticket47560_test.py
index 1561f21d7..c11233c99 100644
--- a/dirsrvtests/tickets/ticket47560_test.py
+++ b/dirsrvtests/tickets/ticket47560_test.py
@@ -10,32 +10,17 @@ import pytest
from lib389 import DirSrv, Entry, tools
from lib389.tools import DirSrvTools
from lib389._constants import *
+from lib389.properties import *
from constants import *
log = logging.getLogger(__name__)
installation_prefix = None
-def _ds_create_instance(args):
- # create the standalone instance
- return tools.DirSrvTools.createInstance(args, verbose=False)
-
-def _ds_rebind_instance(dirsrv):
- args_instance['prefix'] = dirsrv.prefix
- args_instance['backupdir'] = dirsrv.backupdir
- args_instance['newrootdn'] = dirsrv.binddn
- args_instance['newrootpw'] = dirsrv.bindpw
- args_instance['newhost'] = dirsrv.host
- args_instance['newport'] = dirsrv.port
- args_instance['newinstance'] = dirsrv.serverId
- args_instance['newsuffix'] = SUFFIX
- args_instance['no_admin'] = True
-
- return tools.DirSrvTools.createInstance(args_instance)
-
class TopologyStandalone(object):
def __init__(self, standalone):
- self.standalone = _ds_rebind_instance(standalone)
+ standalone.open()
+ self.standalone = standalone
@pytest.fixture(scope="module")
@@ -49,7 +34,7 @@ def topology(request):
If standalone instance exists:
restart it
If backup of standalone exists:
- create or rebind to standalone
+ create/rebind to standalone
restore standalone instance from backup
else:
@@ -62,33 +47,39 @@ def topology(request):
global installation_prefix
if installation_prefix:
- args_instance['prefix'] = installation_prefix
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
# Args for the standalone instance
- args_instance['newhost'] = HOST_STANDALONE
- args_instance['newport'] = PORT_STANDALONE
- args_instance['newinstance'] = SERVERID_STANDALONE
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
args_standalone = args_instance.copy()
-
+ standalone.allocate(args_standalone)
+
# Get the status of the backups
- backup_standalone = DirSrvTools.existsBackup(args_standalone)
+ backup_standalone = standalone.checkBackupFS()
# Get the status of the instance and restart it if it exists
- instance_standalone = DirSrvTools.existsInstance(args_standalone)
+ instance_standalone = standalone.exists()
if instance_standalone:
# assuming the instance is already stopped, just wait 5 sec max
- DirSrvTools.stop(instance_standalone, timeout=5)
- DirSrvTools.start(instance_standalone, timeout=10)
+ standalone.stop(timeout=5)
+ standalone.start(timeout=10)
if backup_standalone:
# The backup exist, assuming it is correct
# we just re-init the instance with it
- standalone = _ds_create_instance(args_standalone)
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
# restore standalone instance from backup
- DirSrvTools.stop(standalone, timeout=10)
- DirSrvTools.instanceRestoreFS(standalone, backup_standalone)
- DirSrvTools.start(standalone, timeout=10)
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
else:
# We should be here only in two conditions
@@ -99,19 +90,22 @@ def topology(request):
# Remove the backup. So even if we have a specific backup file
# (e.g backup_standalone) we clear backup that an instance may have created
if backup_standalone:
- DirSrvTools.clearInstanceBackupFS(dirsrv=instance_standalone)
+ standalone.clearBackupFS()
# Remove the instance
if instance_standalone:
- DirSrvTools.removeInstance(instance_standalone)
+ standalone.delete()
# Create the instance
- standalone = _ds_create_instance(args_standalone)
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
# Time to create the backups
- DirSrvTools.stop(standalone, timeout=10)
- standalone.backupfile = DirSrvTools.instanceBackupFS(standalone)
- DirSrvTools.start(standalone, timeout=10)
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
#
# Here we have standalone instance up and running
@@ -155,13 +149,13 @@ def test_ticket47560(topology):
MEMBEROF_PLUGIN_DN = 'cn=MemberOf Plugin,cn=plugins,cn=config'
replace = [(ldap.MOD_REPLACE, 'nsslapd-pluginEnabled', value)]
topology.standalone.modify_s(MEMBEROF_PLUGIN_DN, replace)
- DirSrvTools.stop(topology.standalone, verbose=False, timeout=120)
+ topology.standalone.stop(timeout=120)
time.sleep(1)
- DirSrvTools.start(topology.standalone, verbose=False, timeout=120)
+ topology.standalone.start(timeout=120)
time.sleep(3)
# need to reopen a connection toward the instance
- topology.standalone = _ds_rebind_instance(topology.standalone)
+ topology.standalone.open()
def _test_ticket47560_setup():
"""
@@ -285,7 +279,7 @@ def test_ticket47560(topology):
assert result_successful == True
def test_ticket47560_final(topology):
- DirSrvTools.stop(topology.standalone, timeout=10)
+ topology.standalone.stop(timeout=10)
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.