commit_id
string | repo
string | commit_message
string | diff
string | label
int64 |
---|---|---|---|---|
47c44d4e61723bb3013e614c1dafce5b37694e3c
|
389ds/389-ds-base
|
Ticket 477 - CLEANALLRUV if there are only winsync agmts task will hang
Bug Description: If there are only winsync agmts, the task will loop forever.
Fix Description: Need to clear a flag after skipping over invalid agmts. The same issue
would apply for agmts that were all disabled.
https://fedorahosted.org/389/ticket/477
Reviewed by: richm(Thanks!)
|
commit 47c44d4e61723bb3013e614c1dafce5b37694e3c
Author: Mark Reynolds <[email protected]>
Date: Mon Sep 24 13:22:09 2012 -0400
Ticket 477 - CLEANALLRUV if there are only winsync agmts task will hang
Bug Description: If there are only winsync agmts, the task will loop forever.
Fix Description: Need to clear a flag after skipping over invalid agmts. The same issue
would apply for agmts that were all disabled.
https://fedorahosted.org/389/ticket/477
Reviewed by: richm(Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index 21f63d21e..51ab2e327 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1552,6 +1552,7 @@ replica_cleanallruv_thread(void *arg)
agmt = (Repl_Agmt*)object_get_data (agmt_obj);
if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
+ agmt_not_notified = 0;
continue;
}
if(replica_cleanallruv_send_extop(agmt, data->rid, data->task, data->payload, 1) == 0){
@@ -1605,6 +1606,7 @@ replica_cleanallruv_thread(void *arg)
agmt = (Repl_Agmt*)object_get_data (agmt_obj);
if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
+ found_dirty_rid = 0;
continue;
}
if(replica_cleanallruv_check_ruv(agmt, rid_text, data->task) == 0){
@@ -1698,6 +1700,7 @@ check_agmts_are_caught_up(Replica *replica, ReplicaId rid, char *maxcsn, Slapi_T
agmt = (Repl_Agmt*)object_get_data (agmt_obj);
if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
+ not_all_caughtup = 0;
continue;
}
if(replica_cleanallruv_check_maxcsn(agmt, rid_text, maxcsn, task) == 0){
@@ -1753,6 +1756,7 @@ check_agmts_are_alive(Replica *replica, ReplicaId rid, Slapi_Task *task)
agmt = (Repl_Agmt*)object_get_data (agmt_obj);
if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
agmt_obj = agmtlist_get_next_agreement_for_replica (replica, agmt_obj);
+ not_all_alive = 0;
continue;
}
if(replica_cleanallruv_replica_alive(agmt) == 0){
@@ -2364,6 +2368,7 @@ replica_abort_task_thread(void *arg)
agmt = (Repl_Agmt*)object_get_data (agmt_obj);
if(!agmt_is_enabled(agmt) || get_agmt_agreement_type(agmt) == REPLICA_TYPE_WINDOWS){
agmt_obj = agmtlist_get_next_agreement_for_replica (data->replica, agmt_obj);
+ agmt_not_notified = 0;
continue;
}
if(replica_cleanallruv_send_abort_extop(agmt, data->task, data->payload)){
| 0 |
9c4a31504e36828c0ffb68ebed004e9ad2e131cc
|
389ds/389-ds-base
|
Ticket 103 - sysconfig not found
Bug Description: In a prefix build we don't have a /etc/sysconfig
file, so we need to create it. However, if we try to create it
multiple times python will raise an exception.
Fix Description: Catch and ignore the exception if the directory
already exists.
https://pagure.io/lib389/issue/103
Author: wibrown
Review by: spichugi (Thanks!)
|
commit 9c4a31504e36828c0ffb68ebed004e9ad2e131cc
Author: William Brown <[email protected]>
Date: Wed Nov 1 17:08:06 2017 +1000
Ticket 103 - sysconfig not found
Bug Description: In a prefix build we don't have a /etc/sysconfig
file, so we need to create it. However, if we try to create it
multiple times python will raise an exception.
Fix Description: Catch and ignore the exception if the directory
already exists.
https://pagure.io/lib389/issue/103
Author: wibrown
Review by: spichugi (Thanks!)
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index 659c87e36..5f95db7b8 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -315,7 +315,10 @@ class SetupDs(object):
with open("%s/dirsrv/config/template-initconfig" % slapd['sysconf_dir']) as template_init:
for line in template_init.readlines():
initconfig += line.replace('{{', '{', 1).replace('}}', '}', 1).replace('-', '_')
- os.makedirs("%s/sysconfig" % slapd['sysconf_dir'], mode=0o775)
+ try:
+ os.makedirs("%s/sysconfig" % slapd['sysconf_dir'], mode=0o775)
+ except FileExistsError:
+ pass
with open("%s/sysconfig/dirsrv-%s" % (slapd['sysconf_dir'], slapd['instance_name']), 'w') as f:
f.write(initconfig.format(
SERVER_DIR=slapd['lib_dir'],
| 0 |
9c428b5b97db979514be45030cca235cb1133bc1
|
389ds/389-ds-base
|
added patch file for upgrading from 1.0.1 - fixes the use of admpw for basic auth
|
commit 9c428b5b97db979514be45030cca235cb1133bc1
Author: Rich Megginson <[email protected]>
Date: Wed Mar 1 14:58:27 2006 +0000
added patch file for upgrading from 1.0.1 - fixes the use of admpw for basic auth
diff --git a/ldapserver.spec.tmpl b/ldapserver.spec.tmpl
index 7b7b643c1..13af43176 100644
--- a/ldapserver.spec.tmpl
+++ b/ldapserver.spec.tmpl
@@ -139,6 +139,10 @@ if [ "$1" -gt 1 ] ; then
if [ -f $RPM_INSTALL_PREFIX/setup/adminserver-httpd-moduleorder.patch ] ; then
patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/adminserver-httpd-moduleorder.patch > /dev/null 2>&1
fi
+# patch file to fix use of admpw for basic auth
+ if [ -f $RPM_INSTALL_PREFIX/setup/admserv-conf-tmpl.patch ] ; then
+ patch -s -f -d $RPM_INSTALL_PREFIX -p0 < $RPM_INSTALL_PREFIX/setup/admserv-conf-tmpl.patch > /dev/null 2>&1
+ fi
# fix up file permissions
testfile=$RPM_INSTALL_PREFIX/admin-serv/config/nss.conf
if [ ! -f $testfile ] ; then
@@ -172,6 +176,9 @@ if [ "$1" = 0 ] ; then
fi
%changelog
+* Wed Mar 1 2006 Rich Megginson <[email protected]> - 1.0.2-1
+- Added admserv-conf-tmpl.patch to fix the use of admpw for basic auth
+
* Wed Feb 22 2006 Rich Megginson <[email protected]> - 1.0.2-1
- Add patch to fix admin server httpd module load order; you
- must now run setup after an upgrade; copy in the new 00core.ldif
| 0 |
ff9dafa5ca40e225e240597a5d5c52f0e6c7c677
|
389ds/389-ds-base
|
Ticket 48996 - update DS for ns 0.2.0
Bug Description: nunc stans changes a number of API's, but most importantly
it removes a number of options.
Fix Description: Make it possible for DS to use NS again. Remove options that
go away, and add the memalign api which NS now relies on. This removes the
(broken and nonfunctional) enable and disable listener function. It also fixes
the logging of FD exhaustion correctly, so we can see when the server is
overwhelmed. Tested with ldclt.
https://fedorahosted.org/389/ticket/48996
Author: wibrown
Review by: nhosoi, mreynolds (Thanks!)
|
commit ff9dafa5ca40e225e240597a5d5c52f0e6c7c677
Author: William Brown <[email protected]>
Date: Thu Sep 29 10:32:08 2016 +1000
Ticket 48996 - update DS for ns 0.2.0
Bug Description: nunc stans changes a number of API's, but most importantly
it removes a number of options.
Fix Description: Make it possible for DS to use NS again. Remove options that
go away, and add the memalign api which NS now relies on. This removes the
(broken and nonfunctional) enable and disable listener function. It also fixes
the logging of FD exhaustion correctly, so we can see when the server is
overwhelmed. Tested with ldclt.
https://fedorahosted.org/389/ticket/48996
Author: wibrown
Review by: nhosoi, mreynolds (Thanks!)
diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c
index 5fb0374c5..bfd6196f9 100644
--- a/ldap/servers/slapd/backend_manager.c
+++ b/ldap/servers/slapd/backend_manager.c
@@ -103,7 +103,7 @@ Slapi_Backend *
be_new_internal(struct dse *pdse, const char *type, const char *name)
{
Slapi_Backend *be= slapi_be_new(type, name, 1 /* Private */, 0 /* Do Not Log Changes */);
- be->be_database = (struct slapdplugin *) slapi_ch_calloc( 1, sizeof(struct slapdplugin) );
+ be->be_database = (struct slapdplugin *) slapi_ch_calloc( 1, sizeof(struct slapdplugin) );
be->be_database->plg_private= (void*)pdse;
be->be_database->plg_bind= &dse_bind;
be->be_database->plg_unbind= &dse_unbind;
@@ -351,29 +351,32 @@ be_flushall()
void
be_unbindall(Connection *conn, Operation *op)
{
- int i;
- Slapi_PBlock pb;
+ int i;
+ Slapi_PBlock pb = {0};
- for ( i = 0; i < maxbackends; i++ )
- {
- if ( backends[i] && (backends[i]->be_unbind != NULL) )
- {
- pblock_init_common( &pb, backends[i], conn, op );
-
- if ( plugin_call_plugins( &pb, SLAPI_PLUGIN_PRE_UNBIND_FN ) == 0 )
- {
- int rc = 0;
- slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
+ for ( i = 0; i < maxbackends; i++ )
+ {
+ if ( backends[i] && (backends[i]->be_unbind != NULL) )
+ {
+ /* This is the modern, and faster way to do pb memset(0)
+ * It also doesn't trigger the HORRIBLE stack overflows I found ...
+ */
+ pblock_init_common( &pb, backends[i], conn, op );
+
+ if ( plugin_call_plugins( &pb, SLAPI_PLUGIN_PRE_UNBIND_FN ) == 0 )
+ {
+ int rc = 0;
+ slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
if(backends[i]->be_state != BE_STATE_DELETED &&
- backends[i]->be_unbind!=NULL)
+ backends[i]->be_unbind!=NULL)
{
- rc = (*backends[i]->be_unbind)( &pb );
+ rc = (*backends[i]->be_unbind)( &pb );
}
- slapi_pblock_set( &pb, SLAPI_PLUGIN_OPRETURN, &rc );
- (void) plugin_call_plugins( &pb, SLAPI_PLUGIN_POST_UNBIND_FN );
- }
- }
- }
+ slapi_pblock_set( &pb, SLAPI_PLUGIN_OPRETURN, &rc );
+ (void) plugin_call_plugins( &pb, SLAPI_PLUGIN_POST_UNBIND_FN );
+ }
+ }
+ }
}
int
diff --git a/ldap/servers/slapd/ch_malloc.c b/ldap/servers/slapd/ch_malloc.c
index debac748b..dad7ece88 100644
--- a/ldap/servers/slapd/ch_malloc.c
+++ b/ldap/servers/slapd/ch_malloc.c
@@ -25,6 +25,7 @@
static int counters_created= 0;
PR_DEFINE_COUNTER(slapi_ch_counter_malloc);
+PR_DEFINE_COUNTER(slapi_ch_counter_memalign);
PR_DEFINE_COUNTER(slapi_ch_counter_calloc);
PR_DEFINE_COUNTER(slapi_ch_counter_realloc);
PR_DEFINE_COUNTER(slapi_ch_counter_strdup);
@@ -36,7 +37,7 @@ PR_DEFINE_COUNTER(slapi_ch_counter_exist);
static void *oom_emergency_area = NULL;
static PRLock *oom_emergency_lock = NULL;
-#define SLAPD_MODULE "memory allocator"
+#define SLAPD_MODULE "memory allocator"
static const char* const oom_advice =
"\nThe server has probably allocated all available virtual memory. To solve\n"
@@ -51,21 +52,22 @@ static const char* const oom_advice =
static void
create_counters(void)
{
- PR_CREATE_COUNTER(slapi_ch_counter_malloc,"slapi_ch","malloc","");
- PR_CREATE_COUNTER(slapi_ch_counter_calloc,"slapi_ch","calloc","");
- PR_CREATE_COUNTER(slapi_ch_counter_realloc,"slapi_ch","realloc","");
- PR_CREATE_COUNTER(slapi_ch_counter_strdup,"slapi_ch","strdup","");
- PR_CREATE_COUNTER(slapi_ch_counter_free,"slapi_ch","free","");
- PR_CREATE_COUNTER(slapi_ch_counter_created,"slapi_ch","created","");
- PR_CREATE_COUNTER(slapi_ch_counter_exist,"slapi_ch","exist","");
-
- /* ensure that we have space to allow for shutdown calls to malloc()
- * from should we run out of memory.
- */
- if (oom_emergency_area == NULL) {
- oom_emergency_area = malloc(OOM_PREALLOC_SIZE);
- }
- oom_emergency_lock = PR_NewLock();
+ PR_CREATE_COUNTER(slapi_ch_counter_malloc,"slapi_ch","malloc","");
+ PR_CREATE_COUNTER(slapi_ch_counter_memalign,"slapi_ch","memalign","");
+ PR_CREATE_COUNTER(slapi_ch_counter_calloc,"slapi_ch","calloc","");
+ PR_CREATE_COUNTER(slapi_ch_counter_realloc,"slapi_ch","realloc","");
+ PR_CREATE_COUNTER(slapi_ch_counter_strdup,"slapi_ch","strdup","");
+ PR_CREATE_COUNTER(slapi_ch_counter_free,"slapi_ch","free","");
+ PR_CREATE_COUNTER(slapi_ch_counter_created,"slapi_ch","created","");
+ PR_CREATE_COUNTER(slapi_ch_counter_exist,"slapi_ch","exist","");
+
+ /* ensure that we have space to allow for shutdown calls to malloc()
+ * from should we run out of memory.
+ */
+ if (oom_emergency_area == NULL) {
+ oom_emergency_area = malloc(OOM_PREALLOC_SIZE);
+ }
+ oom_emergency_lock = PR_NewLock();
}
/* called when we have just detected an out of memory condition, before
@@ -75,161 +77,195 @@ create_counters(void)
*/
void oom_occurred(void)
{
- int tmp_errno = errno; /* callers will need the error from malloc */
- if (oom_emergency_lock == NULL) return;
-
- PR_Lock(oom_emergency_lock);
- if (oom_emergency_area) {
- free(oom_emergency_area);
- oom_emergency_area = NULL;
- }
- PR_Unlock(oom_emergency_lock);
- errno = tmp_errno;
+ int tmp_errno = errno; /* callers will need the error from malloc */
+ if (oom_emergency_lock == NULL) {
+ return;
+ }
+
+ PR_Lock(oom_emergency_lock);
+ if (oom_emergency_area) {
+ free(oom_emergency_area);
+ oom_emergency_area = NULL;
+ }
+ PR_Unlock(oom_emergency_lock);
+ errno = tmp_errno;
}
static void
log_negative_alloc_msg( const char *op, const char *units, unsigned long size )
{
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "cannot %s %lu %s;\n"
- "trying to allocate 0 or a negative number of %s is not portable and\n"
- "gives different results on different platforms.\n",
- op, size, units, units );
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "cannot %s %lu %s;\n"
+ "trying to allocate 0 or a negative number of %s is not portable and\n"
+ "gives different results on different platforms.\n",
+ op, size, units, units );
}
#if !defined(MEMPOOL_EXPERIMENTAL)
char *
slapi_ch_malloc(
- unsigned long size
+ unsigned long size
)
{
- char *newmem;
-
- if (size <= 0) {
- log_negative_alloc_msg( "malloc", "bytes", size );
- return 0;
- }
-
- if ( (newmem = (char *) malloc( size )) == NULL ) {
- int oserr = errno;
-
- oom_occurred();
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "malloc of %lu bytes failed; OS error %d (%s)%s\n",
- size, oserr, slapd_system_strerror( oserr ), oom_advice );
- exit( 1 );
- }
- if(!counters_created)
- {
- create_counters();
- counters_created= 1;
- }
+ char *newmem;
+
+ if (size <= 0) {
+ log_negative_alloc_msg( "malloc", "bytes", size );
+ return 0;
+ }
+
+ if ( (newmem = (char *) malloc( size )) == NULL ) {
+ int oserr = errno;
+
+ oom_occurred();
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "malloc of %lu bytes failed; OS error %d (%s)%s\n",
+ size, oserr, slapd_system_strerror( oserr ), oom_advice );
+ exit( 1 );
+ }
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
+ }
PR_INCREMENT_COUNTER(slapi_ch_counter_malloc);
PR_INCREMENT_COUNTER(slapi_ch_counter_created);
PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
- return( newmem );
+ return( newmem );
+}
+
+/* See slapi-plugin.h */
+char *
+slapi_ch_memalign(size_t size, size_t alignment)
+{
+ char *newmem;
+
+ if (size <= 0) {
+ log_negative_alloc_msg( "memalign", "bytes", size );
+ return 0;
+ }
+
+ if ( posix_memalign((void **)&newmem, alignment, size) != 0 ) {
+ int oserr = errno;
+
+ oom_occurred();
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "malloc of %lu bytes failed; OS error %d (%s)%s\n",
+ size, oserr, slapd_system_strerror( oserr ), oom_advice );
+ exit( 1 );
+ }
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
+ }
+ PR_INCREMENT_COUNTER(slapi_ch_counter_memalign);
+ PR_INCREMENT_COUNTER(slapi_ch_counter_created);
+ PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
+
+ return( newmem );
}
char *
slapi_ch_realloc(
- char *block,
- unsigned long size
+ char *block,
+ unsigned long size
)
{
- char *newmem;
-
- if ( block == NULL ) {
- return( slapi_ch_malloc( size ) );
- }
-
- if (size <= 0) {
- log_negative_alloc_msg( "realloc", "bytes", size );
- return block;
- }
-
- if ( (newmem = (char *) realloc( block, size )) == NULL ) {
- int oserr = errno;
-
- oom_occurred();
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "realloc of %lu bytes failed; OS error %d (%s)%s\n",
- size, oserr, slapd_system_strerror( oserr ), oom_advice );
- exit( 1 );
- }
- if(!counters_created)
- {
- create_counters();
- counters_created= 1;
- }
+ char *newmem;
+
+ if ( block == NULL ) {
+ return( slapi_ch_malloc( size ) );
+ }
+
+ if (size <= 0) {
+ log_negative_alloc_msg( "realloc", "bytes", size );
+ return block;
+ }
+
+ if ( (newmem = (char *) realloc( block, size )) == NULL ) {
+ int oserr = errno;
+
+ oom_occurred();
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "realloc of %lu bytes failed; OS error %d (%s)%s\n",
+ size, oserr, slapd_system_strerror( oserr ), oom_advice );
+ exit( 1 );
+ }
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
+ }
PR_INCREMENT_COUNTER(slapi_ch_counter_realloc);
- return( newmem );
+ return( newmem );
}
char *
slapi_ch_calloc(
- unsigned long nelem,
- unsigned long size
+ unsigned long nelem,
+ unsigned long size
)
{
- char *newmem;
-
- if (size <= 0) {
- log_negative_alloc_msg( "calloc", "bytes", size );
- return 0;
- }
-
- if (nelem <= 0) {
- log_negative_alloc_msg( "calloc", "elements", nelem );
- return 0;
- }
-
- if ( (newmem = (char *) calloc( nelem, size )) == NULL ) {
- int oserr = errno;
-
- oom_occurred();
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "calloc of %lu elems of %lu bytes failed; OS error %d (%s)%s\n",
- nelem, size, oserr, slapd_system_strerror( oserr ), oom_advice );
- exit( 1 );
- }
- if(!counters_created)
- {
- create_counters();
- counters_created= 1;
- }
+ char *newmem;
+
+ if (size <= 0) {
+ log_negative_alloc_msg( "calloc", "bytes", size );
+ return 0;
+ }
+
+ if (nelem <= 0) {
+ log_negative_alloc_msg( "calloc", "elements", nelem );
+ return 0;
+ }
+
+ if ( (newmem = (char *) calloc( nelem, size )) == NULL ) {
+ int oserr = errno;
+
+ oom_occurred();
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "calloc of %lu elems of %lu bytes failed; OS error %d (%s)%s\n",
+ nelem, size, oserr, slapd_system_strerror( oserr ), oom_advice );
+ exit( 1 );
+ }
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
+ }
PR_INCREMENT_COUNTER(slapi_ch_counter_calloc);
PR_INCREMENT_COUNTER(slapi_ch_counter_created);
PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
- return( newmem );
+ return( newmem );
}
char*
slapi_ch_strdup ( const char* s1)
{
char* newmem;
-
- /* strdup pukes on NULL strings...bail out now */
- if(NULL == s1)
- return NULL;
- newmem = strdup (s1);
+
+ /* strdup pukes on NULL strings...bail out now */
+ if(NULL == s1)
+ return NULL;
+ newmem = strdup (s1);
if (newmem == NULL) {
- int oserr = errno;
+ int oserr = errno;
oom_occurred();
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "strdup of %lu characters failed; OS error %d (%s)%s\n",
- (unsigned long)strlen(s1), oserr, slapd_system_strerror( oserr ),
- oom_advice );
- exit (1);
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "strdup of %lu characters failed; OS error %d (%s)%s\n",
+ (unsigned long)strlen(s1), oserr, slapd_system_strerror( oserr ),
+ oom_advice );
+ exit (1);
+ }
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
}
- if(!counters_created)
- {
- create_counters();
- counters_created= 1;
- }
PR_INCREMENT_COUNTER(slapi_ch_counter_strdup);
PR_INCREMENT_COUNTER(slapi_ch_counter_created);
PR_INCREMENT_COUNTER(slapi_ch_counter_exist);
@@ -243,14 +279,14 @@ slapi_ch_bvdup (const struct berval* v)
{
struct berval* newberval = ber_bvdup ((struct berval *)v);
if (newberval == NULL) {
- int oserr = errno;
-
- oom_occurred();
- slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
- "ber_bvdup of %lu bytes failed; OS error %d (%s)%s\n",
- (unsigned long)v->bv_len, oserr, slapd_system_strerror( oserr ),
- oom_advice );
- exit( 1 );
+ int oserr = errno;
+
+ oom_occurred();
+ slapi_log_error(SLAPI_LOG_ERR, SLAPD_MODULE,
+ "ber_bvdup of %lu bytes failed; OS error %d (%s)%s\n",
+ (unsigned long)v->bv_len, oserr, slapd_system_strerror( oserr ),
+ oom_advice );
+ exit( 1 );
}
return newberval;
}
@@ -285,20 +321,20 @@ slapi_ch_bvecdup (struct berval** v)
void
slapi_ch_free(void **ptr)
{
- if (ptr==NULL || *ptr == NULL){
- return;
- }
-
- free (*ptr);
- *ptr = NULL;
- if(!counters_created)
- {
- create_counters();
- counters_created= 1;
- }
+ if (ptr==NULL || *ptr == NULL){
+ return;
+ }
+
+ free (*ptr);
+ *ptr = NULL;
+ if(!counters_created)
+ {
+ create_counters();
+ counters_created= 1;
+ }
PR_INCREMENT_COUNTER(slapi_ch_counter_free);
PR_DECREMENT_COUNTER(slapi_ch_counter_exist);
- return;
+ return;
}
#endif /* !MEMPOOL_EXPERIMENTAL */
@@ -307,13 +343,13 @@ slapi_ch_free(void **ptr)
void
slapi_ch_bvfree(struct berval** v)
{
- if (v == NULL || *v == NULL)
- return;
+ if (v == NULL || *v == NULL)
+ return;
- slapi_ch_free((void **)&((*v)->bv_val));
- slapi_ch_free((void **)v);
+ slapi_ch_free((void **)&((*v)->bv_val));
+ slapi_ch_free((void **)v);
- return;
+ return;
}
/* just like slapi_ch_free, but the argument is the address of a string
@@ -322,7 +358,7 @@ slapi_ch_bvfree(struct berval** v)
void
slapi_ch_free_string(char **s)
{
- slapi_ch_free((void **)s);
+ slapi_ch_free((void **)s);
}
/*
@@ -351,17 +387,17 @@ slapi_ch_free_string(char **s)
char *
slapi_ch_smprintf(const char *fmt, ...)
{
- char *p = NULL;
- va_list ap;
+ char *p = NULL;
+ va_list ap;
- if (NULL == fmt) {
- return NULL;
- }
+ if (NULL == fmt) {
+ return NULL;
+ }
- va_start(ap, fmt);
- p = PR_vsmprintf(fmt, ap);
- va_end(ap);
+ va_start(ap, fmt);
+ p = PR_vsmprintf(fmt, ap);
+ va_end(ap);
- return p;
+ return p;
}
#endif
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 568eef32d..7a054c579 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -229,9 +229,6 @@ connection_cleanup(Connection *conn)
/* free the connection socket buffer */
connection_free_private_buffer(conn);
- if (enable_listeners && !g_get_shutdown()) {
- ns_enable_listeners();
- }
#ifdef ENABLE_NUNC_STANS
/* even if !config_get_enable_nunc_stans, it is ok to set to 0 here */
conn->c_ns_close_jobs = 0;
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 9f8a1832a..b949bba02 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -901,50 +901,6 @@ convert_pbe_des_to_aes(void)
charray_free(attrs);
}
-#ifdef ENABLE_NUNC_STANS
-static ns_job_type_t ns_listen_job_flags = NS_JOB_ACCEPT|NS_JOB_PERSIST|NS_JOB_PRESERVE_FD;
-static PRStack *ns_disabled_listeners; /* holds the disabled listeners, if any */
-static PRInt32 num_disabled_listeners;
-#endif
-
-#ifdef ENABLE_NUNC_STANS
-static void
-ns_disable_listener(listener_info *listener)
-{
- /* tell the event framework not to listen for new connections on this listener */
- ns_job_modify(listener->ns_job, NS_JOB_DISABLE_ONLY|NS_JOB_PRESERVE_FD);
- /* add the listener to our list of disabled listeners */
- PR_StackPush(ns_disabled_listeners, (PRStackElem *)listener);
- PR_AtomicIncrement(&num_disabled_listeners);
- LDAPDebug2Args(LDAP_DEBUG_ERR, "ns_disable_listener - "
- "disabling listener for fd [%d]: [%d] now disabled\n",
- PR_FileDesc2NativeHandle(listener->listenfd),
- num_disabled_listeners);
-}
-#endif
-
-void
-ns_enable_listeners()
-{
-#ifdef ENABLE_NUNC_STANS
- if (!enable_nunc_stans) {
- return;
- }
- int num_enabled = 0;
- listener_info *listener;
- while ((listener = (listener_info *)PR_StackPop(ns_disabled_listeners))) {
- /* there was a disabled listener - re-enable it to listen for new connections */
- ns_job_modify(listener->ns_job, ns_listen_job_flags);
- PR_AtomicDecrement(&num_disabled_listeners);
- num_enabled++;
- }
- if (num_enabled) {
- LDAPDebug1Arg(LDAP_DEBUG_ERR, "ns_enable_listeners - "
- "enabled [%d] listeners\n", num_enabled);
- }
-#endif
-}
-
#ifdef ENABLE_NUNC_STANS
/*
* Nunc stans logging function.
@@ -971,6 +927,12 @@ nunc_stans_malloc(size_t size)
return (void*)slapi_ch_malloc((unsigned long)size);
}
+static void*
+nunc_stans_memalign(size_t size, size_t alignment)
+{
+ return (void*)slapi_ch_memalign(size, alignment);
+}
+
static void*
nunc_stans_calloc(size_t count, size_t size)
{
@@ -1170,11 +1132,6 @@ void slapd_daemon( daemon_ports_t *ports )
#endif /* ENABLE_LDAPI */
listener_idxs = (listener_info *)slapi_ch_calloc(listeners, sizeof(*listener_idxs));
-#ifdef ENABLE_NUNC_STANS
- if (enable_nunc_stans) {
- ns_disabled_listeners = PR_CreateStack("disabled_listeners");
- }
-#endif
/*
* Convert old DES encoded passwords to AES
*/
@@ -1187,11 +1144,8 @@ void slapd_daemon( daemon_ports_t *ports )
/* Set the nunc-stans thread pool config */
ns_thrpool_config_init(&tp_config);
- tp_config.initial_threads = maxthreads;
tp_config.max_threads = maxthreads;
tp_config.stacksize = 0;
- tp_config.event_queue_size = config_get_maxdescriptors();
- tp_config.work_queue_size = config_get_maxdescriptors();
#ifdef LDAP_DEBUG
tp_config.log_fct = nunc_stans_logging;
#else
@@ -1200,6 +1154,7 @@ void slapd_daemon( daemon_ports_t *ports )
tp_config.log_start_fct = NULL;
tp_config.log_close_fct = NULL;
tp_config.malloc_fct = nunc_stans_malloc;
+ tp_config.memalign_fct = nunc_stans_memalign;
tp_config.calloc_fct = nunc_stans_calloc;
tp_config.realloc_fct = nunc_stans_realloc;
tp_config.free_fct = nunc_stans_free;
@@ -1211,7 +1166,7 @@ void slapd_daemon( daemon_ports_t *ports )
setup_pr_read_pds(the_connection_table,n_tcps,s_tcps,i_unix,&num_poll);
for (ii = 0; ii < listeners; ++ii) {
listener_idxs[ii].ct = the_connection_table; /* to pass to handle_new_connection */
- ns_add_io_job(tp, listener_idxs[ii].listenfd, ns_listen_job_flags,
+ ns_add_io_job(tp, listener_idxs[ii].listenfd, NS_JOB_ACCEPT|NS_JOB_PERSIST|NS_JOB_PRESERVE_FD,
ns_handle_new_connection, &listener_idxs[ii], &listener_idxs[ii].ns_job);
}
@@ -2632,10 +2587,8 @@ ns_handle_new_connection(struct ns_job_t *job)
*/
if ((li->ct->size - g_get_current_conn_count())
<= config_get_reservedescriptors()) {
- /* too many open fds - shut off this listener - when an fd is
- * closed, try to resume this listener
- */
- ns_disable_listener(li);
+ /* too many open fds - Just return, and hope next time is better. */
+ slapi_log_error(SLAPI_LOG_FATAL, "ns_handle_new_connection", "Insufficient Reserve FD: File Descriptor exhaustion has occured! Connections will be silently dropped!\n");
return;
}
@@ -2644,12 +2597,13 @@ ns_handle_new_connection(struct ns_job_t *job)
PRErrorCode prerr = PR_GetError();
if (PR_PROC_DESC_TABLE_FULL_ERROR == prerr) {
/* too many open fds - shut off this listener - when an fd is
- * closed, try to resume this listener
+ * closed, try to resume this listener.
+ *
+ * WARNING: This generates a lot of false negatives. Why?
*/
- ns_disable_listener(li);
+ slapi_log_error(SLAPI_LOG_FATAL, "ns_handle_new_connection", "PR_PROC_DESC_TABLE_FULL_ERROR: File Descriptor exhaustion has occured! Connections will be silently dropped!\n");
} else {
- LDAPDebug(LDAP_DEBUG_CONNS, "ns_handle_new_connection - Error accepting"
- " new connection listenfd=%d [%d:%s]\n",
+ slapi_log_error(SLAPI_LOG_FATAL, "ns_handle_new_connection", "Error accepting new connection listenfd=%d [%d:%s]\n",
PR_FileDesc2NativeHandle(li->listenfd), prerr,
slapd_pr_strerror(prerr));
}
diff --git a/ldap/servers/slapd/fe.h b/ldap/servers/slapd/fe.h
index 4368cc67d..3d9ac08be 100644
--- a/ldap/servers/slapd/fe.h
+++ b/ldap/servers/slapd/fe.h
@@ -123,7 +123,6 @@ int daemon_register_reslimits( void );
PRFileDesc * get_ssl_listener_fd(void);
int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local );
void configure_ns_socket( int * ns );
-void ns_enable_listeners(void);
/*
* sasl_io.c
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 0cff83416..f9b22a7d9 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -23,22 +23,22 @@
void
pblock_init( Slapi_PBlock *pb )
{
- memset( pb, '\0', sizeof(Slapi_PBlock) );
+ memset( pb, '\0', sizeof(Slapi_PBlock) );
}
void
pblock_init_common(
- Slapi_PBlock *pb,
- Slapi_Backend *be,
- Connection *conn,
- Operation *op
+ Slapi_PBlock *pb,
+ Slapi_Backend *be,
+ Connection *conn,
+ Operation *op
)
{
- PR_ASSERT( NULL != pb );
- memset( pb, '\0', sizeof(Slapi_PBlock) );
- pb->pb_backend = be;
- pb->pb_conn = conn;
- pb->pb_op = op;
+ PR_ASSERT( NULL != pb );
+ memset( pb, '\0', sizeof(Slapi_PBlock) );
+ pb->pb_backend = be;
+ pb->pb_conn = conn;
+ pb->pb_op = op;
}
void
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index c1a9acf40..d7d130d72 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -5820,6 +5820,17 @@ int slapi_is_shutting_down(void);
* checking routines for allocating and freeing memory
*/
char * slapi_ch_malloc( unsigned long size );
+/*
+ * memalign returns an alligned block of memory as a multiple of alignment.
+ * alignment must be a power of 2. This is not normally needed, but is required
+ * for memory that works with certain cpu operations. It's basically malloc
+ * with some extra guarantees.
+ *
+ * \param size The size of the memory to allocate
+ * \param alignment The alignment. MUST be a power of 2!
+ * \return Pointer to the allocated memory aligned by alignment.
+ */
+char * slapi_ch_memalign( size_t size, size_t alignment);
char * slapi_ch_realloc( char *block, unsigned long size );
char * slapi_ch_calloc( unsigned long nelem, unsigned long size );
char * slapi_ch_strdup( const char *s );
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 94e0dac33..75fae329f 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -18,7 +18,7 @@
# To build without nunc-stans, set use_nunc_stans to 0.
%global use_nunc_stans __NUNC_STANS_ON__
%if %{use_nunc_stans}
-%global nunc_stans_ver 0.1.8
+%global nunc_stans_ver 0.2.0
%endif
# This enables an ASAN build. This should not go to production, so we rename.
| 0 |
12568dfd5b4c9920d41827d5bd7d62b339fdd179
|
389ds/389-ds-base
|
Resolves: 445602
Summary: Fixup replicated schema during migration.
|
commit 12568dfd5b4c9920d41827d5bd7d62b339fdd179
Author: Nathan Kinder <[email protected]>
Date: Mon Mar 23 20:13:06 2009 +0000
Resolves: 445602
Summary: Fixup replicated schema during migration.
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index dfd4021c3..69e12882c 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -820,12 +820,152 @@ my %intattrstoskip = (
'hassubordinates' => 'hasSubordinates'
);
+sub fixup99user {
+ my $mig = shift; # the Migration object
+ my $inst = shift; # The name of the instance
+ my $newschemadir = shift; # the new instance's schema path
+
+ my %attrstoskip = ();
+ my %objclassestoskip = ();
+ my $uid;
+ my $gid;
+ my $mode;
+
+ # Read every schema file in the legacy server's schema directory
+ for (glob("$mig->{oldsroot}/$inst/config/schema/*.ldif")) {
+ if (!open( OLDSCHEMA, $_ )) {
+ debug(0, "Can't open schema file $_: $!\n");
+ next;
+ }
+
+ # Read attributes from each file, looking for ones that contain
+ # the string "DESC ''".
+ my $in = new Mozilla::LDAP::LDIF(*OLDSCHEMA);
+ while (my $ent = readOneEntry $in) {
+ my @attrs = $ent->getValues('attributeTypes');
+ my @objclasses = $ent->getValues('objectClasses');
+ foreach my $attr (@attrs) {
+ debug(4, "Checking if attribute should be added to skip list ($attr)\n");
+ if ($attr =~ /\(\s*(\S*)\s*NAME .* DESC \'\'/) {
+ # Store the OID of those in an associative array for
+ # quick lookups later.
+ debug(3, "Adding attribute to list to skip (OID $1)\n");
+ $attrstoskip{"$1"} = 1;
+ }
+ }
+
+ foreach my $objclass (@objclasses) {
+ debug(4, "Checking if objectclass should be added to skip list ($objclass)\n");
+ if ($objclass =~ /\(\s*(\S*)\s*NAME .* DESC \'\'/) {
+ # Store the OID of those in an associative array for
+ # quick lookups later.
+ debug(3, "Adding objectclass to list to skip (OID $1)\n");
+ $objclassestoskip{"$1"} = 1;
+ }
+ }
+ }
+
+ close(OLDSCHEMA);
+ }
+
+ # Open the 99user.ldif file in the new server schema directory, which is a
+ # copy of the one in the legacy server. Also open a tempfile.
+ if (!open(USERSCHEMA, "$newschemadir/99user.ldif")) {
+ return ("error_opening_schema", "$newschemadir/99user.ldif", $!);
+ }
+
+ # Open a tempfile to write the cleaned 99user.ldif to
+ if (!open(TMPSCHEMA, ">$newschemadir/99user.ldif.tmp")) {
+ close(USERSCHEMA);
+ return ("error_opening_schema", "$newschemadir/99user.ldif.tmp", $!);
+ }
+
+ # Iterate through every attribute in the 99user.ldif file and write them to the
+ # tempfile if their OID doesn't exist in the "bad schema" array.
+ my $in = new Mozilla::LDAP::LDIF(*USERSCHEMA);
+ while (my $ent = readOneEntry $in) {
+ my @attrs = $ent->getValues('attributeTypes');
+ my @objclasses = $ent->getValues('objectClasses');
+ my @keepattrs;
+ my @keepobjclasses;
+ foreach my $attr (@attrs) {
+ if ($attr =~ /\(\s*(\S*)\s*NAME/) {
+ debug(3, "Checking if attribute should be trimmed (OID $1)\n");
+ # See if this OID is in our list of attrs to skip
+ if ($attrstoskip{"$1"}) {
+ debug(2, "Trimming attribute from 99user.ldif (OID $1)\n");
+ next;
+ }
+ }
+
+ # Keep this value
+ debug(3, "Keeping attribute in 99user.ldif (OID $1)\n");
+ push @keepattrs, $attr;
+ }
+
+ foreach my $objclass (@objclasses) {
+ if ($objclass =~ /\(\s*(\S*)\s*NAME/) {
+ debug(3, "Checking if objectclass should be trimmed (OID $1)\n");
+ # See if this OID is in our list of objectclasses to skip
+ if ($objclassestoskip{"$1"}) {
+ debug(2, "Trimming objectclass from 99user.ldif (OID $1)\n");
+ next;
+ }
+ }
+
+ # Keep this value
+ debug(3, "Keeping objectclass in 99user.ldif (OID $1)\n");
+ push @keepobjclasses, $objclass;
+ }
+
+ # Update the entry with the values we want to keep
+ if ($#keepattrs >= $[) {
+ $ent->setValues("attributetypes", @keepattrs);
+ } else {
+ $ent->remove("attributetypes");
+ }
+
+ if ($#keepobjclasses >= $[) {
+ $ent->setValues("objectclasses", @keepobjclasses);
+ } else {
+ $ent->remove("objectclasses");
+ }
+
+ # Write the entry to temp schema file
+ my $oldfh = select(TMPSCHEMA);
+ $ent->printLDIF();
+ select($oldfh);
+ }
+
+ close(USERSCHEMA);
+ close(TMPSCHEMA);
+
+ # Make the ownership and permissions on the temp schema file
+ # the same as the copied 99user.ldif.
+ ($mode, $uid, $gid) = (stat("$newschemadir/99user.ldif"))[2,4,5];
+ if ((chown $uid, $gid, "$newschemadir/99user.ldif.tmp") != 1) {
+ return ("error_schema_permissions", "$newschemadir/99user.ldif.tmp", $!);
+ }
+
+ if ((chmod $mode, "$newschemadir/99user.ldif.tmp") != 1) {
+ return ("error_schema_permissions", "$newschemadir/99user.ldif.tmp", $!);
+ }
+
+ # Replace the copied 99user.ldif with the trimmed file.
+ if ((rename "$newschemadir/99user.ldif.tmp", "$newschemadir/99user.ldif") != 1) {
+ return ("error_renaming_schema", "$newschemadir/99user.ldif.tmp", "$newschemadir/99user.ldif", $!);
+ }
+
+ return();
+}
+
sub migrateSchema {
my $mig = shift; # the Migration object
my $inst = shift; # the instance name (e.g. slapd-instance)
my $src = shift; # a Conn to the source
my $dest = shift; # a Conn to the dest
+ my @errs;
my $cfgent = $dest->search("cn=config", "base", "(objectclass=*)");
my $newschemadir = $cfgent->getValues('nsslapd-schemadir') ||
"$mig->{configdir}/$inst/schema";
@@ -840,6 +980,11 @@ sub migrateSchema {
}
}
+ # fixup any attributes with missing descriptions in 99user.ldif
+ if (@errs = fixup99user($mig, $inst, $newschemadir)) {
+ return @errs;
+ }
+
if (!$mig->{crossplatform}) {
# now, for all of the new schema, we need to get the list of attribute
# types with INTEGER syntax, including derived types (e.g. SUP 'attr')
diff --git a/ldap/admin/src/scripts/migrate-ds.res b/ldap/admin/src/scripts/migrate-ds.res
index b9a95bd69..3d01f0f39 100644
--- a/ldap/admin/src/scripts/migrate-ds.res
+++ b/ldap/admin/src/scripts/migrate-ds.res
@@ -7,6 +7,9 @@ error_updating_merge_entry = Could not %s the migrated entry '%s' in the target
error_importing_migrated_db = Could not import the LDIF file '%s' for the migrated database. Error: %s. Output: %s\n
error_reading_olddbconfig = Could not read the old database configuration information. Error: %s\n
error_migrating_schema = Could not copy old schema file '%s'. Error: %s\n
+error_opening_schema = Could not open new schema file '%s'. Error: %s\n
+error_schema_permissions = Could not reset permissions on schema file '%s'. Error: %s\n
+error_renaming_schema = Could not rename schema file '%s' tp '%s'. Error: %s\n
error_copying_dbdir = Could not copy database directory '%s' to '%s'. Error: %s\n
error_copying_dbfile = Could not copy database file '%s' to '%s'. Error: %s\n
error_dbsrcdir_not_exist = Could not copy from the database source directory '%s' because it does not exist. Please check your configuration.\n
| 0 |
76f8f49065cd2a4c27ffd340fda0b0c525b43766
|
389ds/389-ds-base
|
Bug 697027 - 10 - minor memory leaks found by Valgrind + TET
https://bugzilla.redhat.com/show_bug.cgi?id=697027
[Case 10]
Description: Changing to create a configuration lock only when
it is not created yet.
|
commit 76f8f49065cd2a4c27ffd340fda0b0c525b43766
Author: Noriko Hosoi <[email protected]>
Date: Fri Apr 15 13:59:12 2011 -0700
Bug 697027 - 10 - minor memory leaks found by Valgrind + TET
https://bugzilla.redhat.com/show_bug.cgi?id=697027
[Case 10]
Description: Changing to create a configuration lock only when
it is not created yet.
diff --git a/ldap/servers/plugins/replication/cl5_config.c b/ldap/servers/plugins/replication/cl5_config.c
index 0698c551a..1d0dfe3bd 100644
--- a/ldap/servers/plugins/replication/cl5_config.c
+++ b/ldap/servers/plugins/replication/cl5_config.c
@@ -77,8 +77,11 @@ int changelog5_config_init()
{
/* The FE DSE *must* be initialised before we get here */
- /* create the configuration lock */
- s_configLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "config_lock");
+ /* create the configuration lock, if not yet created. */
+ if (!s_configLock)
+ {
+ s_configLock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "config_lock");
+ }
if (s_configLock == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
| 0 |
c453431f66673f6aeed97e82aa0627d39e698a1f
|
389ds/389-ds-base
|
Reviewed by Nathan (Thanks!)
NSS 3.11 introduces a new library (libfreebl3.so) that is loaded as part of NSS initialization. With Fedora DS 1.0, we moved NSS initialization to occur after the setuid from root to the runtime uid so that the files created during NSS init would have the correct ownership. However, the bin/slapd/server directory is set to 0700 meaning no execute permission for the runtime uid. The OS requires this directory to be 711 to allow the slapd process to load in the shared libraries needed by NSS. We use 711 to disallow reading in this directory because if slapd crashes shortly after startup, a core file may go in this directory which may contain secret information.
|
commit c453431f66673f6aeed97e82aa0627d39e698a1f
Author: Rich Megginson <[email protected]>
Date: Fri Feb 17 16:57:19 2006 +0000
Reviewed by Nathan (Thanks!)
NSS 3.11 introduces a new library (libfreebl3.so) that is loaded as part of NSS initialization. With Fedora DS 1.0, we moved NSS initialization to occur after the setuid from root to the runtime uid so that the files created during NSS init would have the correct ownership. However, the bin/slapd/server directory is set to 0700 meaning no execute permission for the runtime uid. The OS requires this directory to be 711 to allow the slapd process to load in the shared libraries needed by NSS. We use 711 to disallow reading in this directory because if slapd crashes shortly after startup, a core file may go in this directory which may contain secret information.
diff --git a/ldap/cm/Makefile b/ldap/cm/Makefile
index f4da6be37..c849561b4 100644
--- a/ldap/cm/Makefile
+++ b/ldap/cm/Makefile
@@ -581,9 +581,12 @@ ifdef BUILD_RPM
endif # BUILD_RPM
find $(RELDIR) -exec chmod go-w {} \;
-# $(RELDIR)/bin/slapd/server may host a core file.
-# For security reason, it's readable only by the owner
- chmod 700 $(RELDIR)/bin/slapd/server
+# $(RELDIR)/bin/slapd/server may host a core file if the server crashes
+# shortly after startup (otherwise, cores go in slapd-instance/logs)
+# For security reasons, it's readable only by the owner
+# but it needs to be executable (11) so that it can
+# load in shared libs from slapd/lib after the setuid
+ chmod 711 $(RELDIR)/bin/slapd/server
$(INSTDIR)/slapd:
$(MKDIR) -p $@
| 0 |
086c95b4f96548544961d2b6856108a121744079
|
389ds/389-ds-base
|
Ticket 49010 - Lib389 fails to start with systemctl changes
Bug Description: systemctl changed their api to status which broke the
lib389 wrapper. Pyldap doesn't work with bytes mode on fedora 24 and python 2.
Asan would not allow the server to start correctly without the env options
Fix Description: Change the systemctl interface to use is-active, check pyldap
for python 3, and add the asan passthrough options.
https://fedorahosted.org/389/ticket/49010
Author: wibrown
Review by: spichugi (Thanks!)
|
commit 086c95b4f96548544961d2b6856108a121744079
Author: William Brown <[email protected]>
Date: Mon Oct 17 14:49:02 2016 +1000
Ticket 49010 - Lib389 fails to start with systemctl changes
Bug Description: systemctl changed their api to status which broke the
lib389 wrapper. Pyldap doesn't work with bytes mode on fedora 24 and python 2.
Asan would not allow the server to start correctly without the env options
Fix Description: Change the systemctl interface to use is-active, check pyldap
for python 3, and add the asan passthrough options.
https://fedorahosted.org/389/ticket/49010
Author: wibrown
Review by: spichugi (Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index f71092f39..554b92a3f 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -985,7 +985,7 @@ class DirSrv(SimpleLDAPObject):
uri = self.toLDAPURL()
if self.verbose:
self.log.info('open(): Connecting to uri %s' % uri)
- if hasattr(ldap, 'PYLDAP_VERSION'):
+ if hasattr(ldap, 'PYLDAP_VERSION') and MAJOR >= 3:
SimpleLDAPObject.__init__(self, uri, bytes_mode=False)
else:
SimpleLDAPObject.__init__(self, uri)
@@ -1098,11 +1098,20 @@ class DirSrv(SimpleLDAPObject):
# Start the process.
# Wait for it to terminate
# This means the server is probably ready to go ....
+ env = {}
+ if self.has_asan():
+ log.error("NOTICE: Starting instance with ASAN options")
+ log.error("This is probably not what you want. Please contact support.")
+ log.error("ASAN options will be copied from your environment")
+ env['ASAN_SYMBOLIZER_PATH'] = "/usr/bin/llvm-symbolizer"
+ env['ASAN_OPTIONS'] = "symbolize=1 detect_deadlocks=1 log_path=%s/ns-slapd-%s.asan" % (self.ds_paths.run_dir, self.serverid)
+ env.update(os.environ)
+ log.error(env)
subprocess.check_call(["%s/ns-slapd" % self.get_sbin_dir(),
"-D",
self.ds_paths.config_dir,
"-i",
- self.ds_paths.pid_file])
+ self.ds_paths.pid_file], env=env)
count = timeout
pid = pid_from_file(self.ds_paths.pid_file)
while (pid is None) and count > 0:
@@ -1169,7 +1178,7 @@ class DirSrv(SimpleLDAPObject):
if self.with_systemd() and not self.containerised:
# Do systemd things here ...
rc = subprocess.call(["/usr/bin/systemctl",
- "status",
+ "is-active", "--quiet",
"dirsrv@%s" % self.serverid])
if rc == 0:
return True
diff --git a/src/lib389/lib389/tests/plugin_test.py b/src/lib389/lib389/tests/plugin_test.py
index adbff5610..ca10fafbd 100644
--- a/src/lib389/lib389/tests/plugin_test.py
+++ b/src/lib389/lib389/tests/plugin_test.py
@@ -21,7 +21,7 @@ from lib389.utils import *
from lib389.plugins import *
-DEBUGGING = True
+DEBUGGING = False
if DEBUGGING:
logging.getLogger(__name__).setLevel(logging.DEBUG)
| 0 |
65362db30f55a41de1df97c8bd92047cac52ce83
|
389ds/389-ds-base
|
Ticket #48316 - Perl-5.20.3-328: Use of literal control characters in variable names is deprecated
Description: "$^O" issues a warning "Use of literal control characters in
variable names is deprecated at /usr/lib64/dirsrv/perl/DSCreate.pm line 839."
This patch replaces "$^O" with "$Config{'osname'}".
https://fedorahosted.org/389/ticket/48316
Reviewed by [email protected] and [email protected] (Thank you, Rich and William!!)
|
commit 65362db30f55a41de1df97c8bd92047cac52ce83
Author: Noriko Hosoi <[email protected]>
Date: Mon Nov 16 11:32:27 2015 -0800
Ticket #48316 - Perl-5.20.3-328: Use of literal control characters in variable names is deprecated
Description: "$^O" issues a warning "Use of literal control characters in
variable names is deprecated at /usr/lib64/dirsrv/perl/DSCreate.pm line 839."
This patch replaces "$^O" with "$Config{'osname'}".
https://fedorahosted.org/389/ticket/48316
Reviewed by [email protected] and [email protected] (Thank you, Rich and William!!)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index 7f272f6ba..ac6487566 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -18,6 +18,7 @@ package DSCreate;
use DSUtil;
use Inf;
use FileConn;
+use Config;
use Sys::Hostname;
# tempfiles
@@ -836,7 +837,7 @@ sub setDefaults {
}
if (!defined($inf->{slapd}->{sasl_path})) {
- if ($ ne "linux") {
+ if ($Config{'osname'} ne "linux") {
$inf->{slapd}->{sasl_path} = "$inf->{General}->{prefix}@libdir@/sasl2";
}
}
| 0 |
245d8949a3a41604a2eaeab17287051065abdf2b
|
389ds/389-ds-base
|
Issue 50920 - cl-dump exit code is 0 even if command fails with invalid arguments
Description of problem:
When running the cl-dump.pl script with invalid arguments, the exit code is always 0,
even if an error message is reported.
Fix Description:
Pass the return code to the end of the #main.
Change CI test accordingly.
https://pagure.io/389-ds-base/issue/50920
Reviewed by: vashirov, mreynolds (Thanks!)
|
commit 245d8949a3a41604a2eaeab17287051065abdf2b
Author: Simon Pichugin <[email protected]>
Date: Fri Feb 28 14:29:06 2020 +0100
Issue 50920 - cl-dump exit code is 0 even if command fails with invalid arguments
Description of problem:
When running the cl-dump.pl script with invalid arguments, the exit code is always 0,
even if an error message is reported.
Fix Description:
Pass the return code to the end of the #main.
Change CI test accordingly.
https://pagure.io/389-ds-base/issue/50920
Reviewed by: vashirov, mreynolds (Thanks!)
diff --git a/dirsrvtests/tests/suites/replication/changelog_test.py b/dirsrvtests/tests/suites/replication/changelog_test.py
index 8d8214886..e395f0e7c 100644
--- a/dirsrvtests/tests/suites/replication/changelog_test.py
+++ b/dirsrvtests/tests/suites/replication/changelog_test.py
@@ -275,9 +275,7 @@ def test_cldump_files_removed(topo):
proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
msg = proc.communicate()
log.info('output message : %s' % msg[0])
- # Waiting for bz1769296 fix, rc=0 is expected, so that the next steps be executed - to be changed when bz fixed.
- #assert proc.returncode != 0
- assert proc.returncode == 0
+ assert proc.returncode != 0
# Now the core goal of the test case
# Using cl-dump without -l option
diff --git a/ldap/admin/src/scripts/cl-dump.pl b/ldap/admin/src/scripts/cl-dump.pl
index 2e7f20413..e56c80310 100755
--- a/ldap/admin/src/scripts/cl-dump.pl
+++ b/ldap/admin/src/scripts/cl-dump.pl
@@ -101,16 +101,17 @@ $version = "Directory Server Changelog Dump - Version 1.0";
}
if (!$opt_i) {
- &cl_dump_and_decode;
+ $rc = &cl_dump_and_decode;
}
elsif ($opt_c) {
- &grep_csn ($opt_i);
+ $rc = &grep_csn ($opt_i);
}
else {
- &cl_decode ($opt_i);
+ $rc = &cl_decode ($opt_i);
}
close (OUTPUT);
+ exit($rc);
}
# Validate the parameters
@@ -209,6 +210,7 @@ sub cl_dump_and_decode
&print_header ($replica, "Not Found") if !$gotldif;
}
$conn->close;
+ return 0;
}
sub print_header
@@ -260,6 +262,7 @@ sub grep_csn
printf OUTPUT "; $modts" if $modts;
printf OUTPUT ")\n";
}
+ return 0;
}
sub csn_to_string
@@ -316,4 +319,5 @@ sub cl_decode
/^\s*(\S+)\s*\n/;
$encoded .= $1;
}
+ return 0;
}
| 0 |
4850b2720a6d2a1cf65b2cbfa296e37f04f85c5d
|
389ds/389-ds-base
|
Coverity Fixes
12626
13030
13114
13115
13116
Reviewed by: richm (Thanks Rich!)
|
commit 4850b2720a6d2a1cf65b2cbfa296e37f04f85c5d
Author: Mark Reynolds <[email protected]>
Date: Mon Nov 26 11:04:36 2012 -0500
Coverity Fixes
12626
13030
13114
13115
13116
Reviewed by: richm (Thanks Rich!)
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 6c94b3d66..175eb800b 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -6554,9 +6554,6 @@ cl5CleanRUV(ReplicaId rid){
ruv_delete_replica(file->maxRUV, rid);
obj = objset_next_obj(s_cl5Desc.dbFiles, obj);
}
- if(obj){
- object_release (obj);
- }
slapi_rwlock_unlock (s_cl5Desc.stLock);
}
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index f1baef24c..aef9c1341 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -1743,7 +1743,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
{
Object *agmt_obj;
Repl_Agmt *agmt;
- char csnstr[CSN_STRSIZE];
+ char *csnstr = NULL;
char *filter = NULL;
int not_all_cleaned = 1;
int interval = 10;
@@ -1786,6 +1786,7 @@ check_replicas_are_done_cleaning(cleanruv_data *data )
interval = 14400;
}
}
+ slapi_ch_free_string(&csnstr);
slapi_ch_free_string(&filter);
}
@@ -2356,7 +2357,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
struct berval *vals[2];
struct berval val;
char data[CSN_STRSIZE + 15];
- char csnstr[CSN_STRSIZE];
+ char *csnstr = NULL;
char *dn;
int rc;
@@ -2399,6 +2400,7 @@ delete_cleaned_rid_config(cleanruv_data *clean_data)
}
slapi_pblock_destroy (pb);
slapi_ch_free_string(&dn);
+ slapi_ch_free_string(&csnstr);
}
/*
| 0 |
6d4566ee11e3789c9f9ebacea8bde420f36cb6fd
|
389ds/389-ds-base
|
Bug 679978 - modifying attr value crashes the server, which is supposed to
be indexed as substring type, but has octetstring syntax
https://bugzilla.redhat.com/show_bug.cgi?id=679978
Description: When indexing, index_addordel_values_ext_sv calls a helper
function valuearray_minus_valuearray in index.c. There is a corner case
that could pass NULL array arguments to valuearray_minus_valuearray.
In valuearray_minus_valuearray, the array's elements were accessed w/o
checking the array was NULL or not. This patch is adding the check.
|
commit 6d4566ee11e3789c9f9ebacea8bde420f36cb6fd
Author: Noriko Hosoi <[email protected]>
Date: Mon Feb 28 16:54:11 2011 -0800
Bug 679978 - modifying attr value crashes the server, which is supposed to
be indexed as substring type, but has octetstring syntax
https://bugzilla.redhat.com/show_bug.cgi?id=679978
Description: When indexing, index_addordel_values_ext_sv calls a helper
function valuearray_minus_valuearray in index.c. There is a corner case
that could pass NULL array arguments to valuearray_minus_valuearray.
In valuearray_minus_valuearray, the array's elements were accessed w/o
checking the array was NULL or not. This patch is adding the check.
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 73275fcbf..03ea5e408 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -2152,10 +2152,10 @@ valuearray_minus_valuearray(
}
/* determine length of a */
- for (acnt = 0; a[acnt] != NULL; acnt++);
+ for (acnt = 0; a && a[acnt] != NULL; acnt++);
/* determine length of b */
- for (bcnt = 0; b[bcnt] != NULL; bcnt++);
+ for (bcnt = 0; b && b[bcnt] != NULL; bcnt++);
/* allocate return array as big as a */
c = (Slapi_Value**)slapi_ch_calloc(acnt+1, sizeof(Slapi_Value*));
| 0 |
1b486220105eacf4bd9d5145114e0b1fec78544d
|
389ds/389-ds-base
|
Ticket 48992: Total init may fail if the pushed schema is rejected
Bug Description:
In the early phase of total update (or incremental update), the supplier may send its schema.
A supplier will send its schema to the consumer at the condition its nsSchemaCSN is greater than
the consumer nsSchemaCSN.
If it is the case, a 1.2.11 supplier will systematically send its schema, while a 1.3 supplier will
check that its schema is a superset of the consumer schema before sending it.
If a 1.2.11 supplier sends its schema and that schema is a subset of consumer one, then
the >1.3 consumer will detect it is a subset and reject the update.
In that case the >1.3 consumer rejects a replicated update.
On the consumer side, with the fix https://fedorahosted.org/389/ticket/47788, if a
replication operation fails, it may trigger the closure of the replication connection.
The fix decides, based on the type of failure, if the failure can be ignored (leave the connection
opened) or is fatal (close the connection).
This is detected, on the consumer side, in multimaster_postop_*->process_postop->ignore_error_and_keep_going.
In the current version, if a replicated update of the schema fails it return LDAP_UNWILLING_TO_PERFORM.
This is a fatal error regarding ignore_error_and_keep_going that then close the connection
and interrupt the total/incremental update.
Note this bug can be transient as, the schema learning mechanism (on consumer) may learn from
the received schema (even if it is rejected) and update its local schema that increase
nsSchemaCSN. If this occur, a later replication session finding a greater nsSchemaCSN on the
consumer side will not push the schema
Fix Description:
When the update of the schema is rejected make it not fatal, switching the returned
code from LDAP_UNWILLING_TO_PERFORM to LDAP_CONSTRAINT_VIOLATION
https://fedorahosted.org/389/ticket/48992
Reviewed by: Noriko Hosoi, Ludwig Krispenz (thanks to you !)
Platforms tested: 7.3
Flag Day: no
Doc impact: no
|
commit 1b486220105eacf4bd9d5145114e0b1fec78544d
Author: Thierry Bordaz <[email protected]>
Date: Thu Sep 22 20:48:13 2016 +0200
Ticket 48992: Total init may fail if the pushed schema is rejected
Bug Description:
In the early phase of total update (or incremental update), the supplier may send its schema.
A supplier will send its schema to the consumer at the condition its nsSchemaCSN is greater than
the consumer nsSchemaCSN.
If it is the case, a 1.2.11 supplier will systematically send its schema, while a 1.3 supplier will
check that its schema is a superset of the consumer schema before sending it.
If a 1.2.11 supplier sends its schema and that schema is a subset of consumer one, then
the >1.3 consumer will detect it is a subset and reject the update.
In that case the >1.3 consumer rejects a replicated update.
On the consumer side, with the fix https://fedorahosted.org/389/ticket/47788, if a
replication operation fails, it may trigger the closure of the replication connection.
The fix decides, based on the type of failure, if the failure can be ignored (leave the connection
opened) or is fatal (close the connection).
This is detected, on the consumer side, in multimaster_postop_*->process_postop->ignore_error_and_keep_going.
In the current version, if a replicated update of the schema fails it return LDAP_UNWILLING_TO_PERFORM.
This is a fatal error regarding ignore_error_and_keep_going that then close the connection
and interrupt the total/incremental update.
Note this bug can be transient as, the schema learning mechanism (on consumer) may learn from
the received schema (even if it is rejected) and update its local schema that increase
nsSchemaCSN. If this occur, a later replication session finding a greater nsSchemaCSN on the
consumer side will not push the schema
Fix Description:
When the update of the schema is rejected make it not fatal, switching the returned
code from LDAP_UNWILLING_TO_PERFORM to LDAP_CONSTRAINT_VIOLATION
https://fedorahosted.org/389/ticket/48992
Reviewed by: Noriko Hosoi, Ludwig Krispenz (thanks to you !)
Platforms tested: 7.3
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 164dd78e7..c0581b728 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -2120,7 +2120,24 @@ modify_schema_dse (Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry *entr
slapi_log_error(SLAPI_LOG_ERR, "modify_schema_dse",
"[C] Local %s must not be overwritten (set replication log for additional info)\n",
attr_name);
- *returncode = LDAP_UNWILLING_TO_PERFORM;
+ /*
+ * If the update (replicated) of the schema is rejected then
+ * process_postop->ignore_error_and_keep_going will decide if
+ * this failure is fatal or can be ignored.
+ * LDAP_UNWILLING_TO_PERFORM is considered as fatal error --> close the connection
+ *
+ * A 6.x supplier may send a subset schema and trigger this error, that
+ * will break the replication session.
+ *
+ * With new "learning" mechanism this is not that important if the
+ * update of the schema is successful or not. Just be permissive
+ * ignoring that failure to let the full replication session going on
+ * So return LDAP_CONSTRAINT_VIOLATION (in place of LDAP_UNWILLING_TO_PERFORM)
+ * is pick up as best choice of non fatal returncode.
+ * (others better choices UNWILLING_TO_PERFORM, OPERATION_ERROR or ldap_error
+ * are unfortunately all fatal).
+ */
+ *returncode = LDAP_CONSTRAINT_VIOLATION;
return (SLAPI_DSE_CALLBACK_ERROR);
}
}
| 0 |
ef48c93ded0f766d8dab679b976ca032d6297c32
|
389ds/389-ds-base
|
Ticket 457 - dirsrv init script returns 0 even when few or all instances fail to start
Bug Description: We don't return an error code when one or more instances fails to start.
Fix Description: Return error 1 when an instance fails to start.
https://fedorahosted.org/389/ticket/457
Reviewed by: richm(Thanks!)
|
commit ef48c93ded0f766d8dab679b976ca032d6297c32
Author: Mark Reynolds <[email protected]>
Date: Mon Sep 24 12:34:59 2012 -0400
Ticket 457 - dirsrv init script returns 0 even when few or all instances fail to start
Bug Description: We don't return an error code when one or more instances fails to start.
Fix Description: Return error 1 when an instance fails to start.
https://fedorahosted.org/389/ticket/457
Reviewed by: richm(Thanks!)
diff --git a/wrappers/initscript.in b/wrappers/initscript.in
index da5f6bbb8..760178499 100644
--- a/wrappers/initscript.in
+++ b/wrappers/initscript.in
@@ -264,7 +264,8 @@ start() {
[ -x /sbin/restorecon ] && /sbin/restorecon $lockfile
fi
if [ $errors -ge 1 ]; then
- echo " *** Warning: $errors instance(s) failed to start"
+ echo " *** Error: $errors instance(s) failed to start"
+ exit 1
fi
}
| 0 |
8304caec593b591558c9c18de9bcb6b2f23db5b6
|
389ds/389-ds-base
|
Ticket 49560 - nsslapd-extract-pemfiles should be enabled by default as openldap is moving to openssl
Bug Description:
Due to a change in the OpenLDAP client libraries (switching from NSS to OpenSSL),
the TLS options LDAP_OPT_X_TLS_CACERTFILE, LDAP_OPT_X_TLS_KEYFILE, LDAP_OPT_X_TLS_CERTFILE,
need to specify path to PEM files.
Those PEM files are extracted from the key/certs from the NSS db in /etc/dirsrv/slapd-xxx
Those files are extracted if the option (under 'cn=config') nsslapd-extract-pemfiles is set to 'on'.
The default value is 'off', that prevent secure outgoing connection.
Fix Description:
Enable nsslapd-extract-pemfiles by default
Then when establishing an outgoing connection, if it is not using NSS crypto layer
and the pem files have been extracted then use the PEM files
https://pagure.io/389-ds-base/issue/49560
Reviewed by: mreynolds
Platforms tested: RHEL 7.5
Flag Day: no
Doc impact: no
Signed-off-by: Mark Reynolds <[email protected]>
|
commit 8304caec593b591558c9c18de9bcb6b2f23db5b6
Author: Thierry Bordaz <[email protected]>
Date: Tue Feb 6 19:49:22 2018 +0100
Ticket 49560 - nsslapd-extract-pemfiles should be enabled by default as openldap is moving to openssl
Bug Description:
Due to a change in the OpenLDAP client libraries (switching from NSS to OpenSSL),
the TLS options LDAP_OPT_X_TLS_CACERTFILE, LDAP_OPT_X_TLS_KEYFILE, LDAP_OPT_X_TLS_CERTFILE,
need to specify path to PEM files.
Those PEM files are extracted from the key/certs from the NSS db in /etc/dirsrv/slapd-xxx
Those files are extracted if the option (under 'cn=config') nsslapd-extract-pemfiles is set to 'on'.
The default value is 'off', that prevent secure outgoing connection.
Fix Description:
Enable nsslapd-extract-pemfiles by default
Then when establishing an outgoing connection, if it is not using NSS crypto layer
and the pem files have been extracted then use the PEM files
https://pagure.io/389-ds-base/issue/49560
Reviewed by: mreynolds
Platforms tested: RHEL 7.5
Flag Day: no
Doc impact: no
Signed-off-by: Mark Reynolds <[email protected]>
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 2fc2f0615..fcf22e632 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -591,7 +591,7 @@ setup_ol_tls_conn(LDAP *ld, int clientauth)
slapi_log_err(SLAPI_LOG_ERR, "setup_ol_tls_conn",
"failed: unable to set REQUIRE_CERT option to %d\n", ssl_strength);
}
- if (slapi_client_uses_non_nss(ld)) {
+ if (slapi_client_uses_non_nss(ld) && config_get_extract_pem()) {
cacert = slapi_get_cacertfile();
if (cacert) {
/* CA Cert PEM file exists. Set the path to openldap option. */
@@ -602,21 +602,21 @@ setup_ol_tls_conn(LDAP *ld, int clientauth)
cacert, rc, ldap_err2string(rc));
}
}
- if (slapi_client_uses_openssl(ld)) {
- int32_t crlcheck = LDAP_OPT_X_TLS_CRL_NONE;
- tls_check_crl_t tls_check_state = config_get_tls_check_crl();
- if (tls_check_state == TLS_CHECK_PEER) {
- crlcheck = LDAP_OPT_X_TLS_CRL_PEER;
- } else if (tls_check_state == TLS_CHECK_ALL) {
- 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_err(SLAPI_LOG_ERR, "setup_ol_tls_conn",
- "Could not set CRLCHECK [%d]: %d:%s\n",
- crlcheck, rc, ldap_err2string(rc));
- }
+ }
+ if (slapi_client_uses_openssl(ld)) {
+ int32_t crlcheck = LDAP_OPT_X_TLS_CRL_NONE;
+ tls_check_crl_t tls_check_state = config_get_tls_check_crl();
+ if (tls_check_state == TLS_CHECK_PEER) {
+ crlcheck = LDAP_OPT_X_TLS_CRL_PEER;
+ } else if (tls_check_state == TLS_CHECK_ALL) {
+ 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_err(SLAPI_LOG_ERR, "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 */
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index c7a87303e..d0865e1b3 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1696,7 +1696,7 @@ FrontendConfig_init(void)
init_malloc_mmap_threshold = cfg->malloc_mmap_threshold = DEFAULT_MALLOC_UNSET;
#endif
- init_extract_pem = cfg->extract_pem = LDAP_OFF;
+ init_extract_pem = cfg->extract_pem = LDAP_ON;
/* Done, unlock! */
CFG_UNLOCK_WRITE(cfg);
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 52ac7ea9f..36b09fd16 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -2462,7 +2462,7 @@ slapd_SSL_client_auth(LDAP *ld)
errorCode, slapd_pr_strerror(errorCode));
} else {
#if defined(USE_OPENLDAP)
- if (slapi_client_uses_non_nss(ld)) {
+ if (slapi_client_uses_non_nss(ld) && config_get_extract_pem()) {
char *certdir = config_get_certdir();
char *keyfile = NULL;
char *certfile = NULL;
| 0 |
be64c8dcf26804ab922c33f90e7d988fc9b2c298
|
389ds/389-ds-base
|
Remove deprecated spec file
|
commit be64c8dcf26804ab922c33f90e7d988fc9b2c298
Author: Mark Reynolds <[email protected]>
Date: Mon Dec 14 23:12:42 2015 -0500
Remove deprecated spec file
diff --git a/src/lib389/lib389.spec b/src/lib389/lib389.spec
deleted file mode 100644
index d3431d693..000000000
--- a/src/lib389/lib389.spec
+++ /dev/null
@@ -1,69 +0,0 @@
-%{!?__python2: %global __python2 %__python}
-%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-
-%define name lib389
-%define version 1.0.1
-%define prerel 1
-
-Summary: A library for accessing, testing, and configuring the 389 Directory Server
-Name: %{name}
-Version: %{version}
-Release: %{prerel}%{?dist}
-Source0: http://port389.org/binaries/%{name}-%{version}-%{prerel}.tar.bz2
-License: GPLv3+
-Group: Development/Libraries
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-Prefix: %{_prefix}
-BuildArch: noarch
-Vendor: Red Hat Inc. <[email protected]>
-Url: http://port389.org/wiki/Upstream_test_framework
-Requires: python-ldap pytest python-krbV
-
-# Currently python-ldap is not python3 compatible, so lib389 only works with
-# python 2.7
-
-%description
-This repository contains tools and libraries for accessing, testing, and
-configuring the 389 Directory Server.
-
-%prep
-%setup -qc
-mv %{name}-%{version}-%{prerel} python2
-
-%build
-pushd python2
-# Remove CFLAGS=... for noarch packages (unneeded)
-CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
-popd
-
-%install
-rm -rf $RPM_BUILD_ROOT
-pushd python2
-%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-popd
-for file in $RPM_BUILD_ROOT%{python2_sitelib}/lib389/clitools/*.py; do
- if [ "$file" != "__init__.py" ]; then
- chmod a+x $file
- fi
-done
-
-%check
-pushd python2
-%{__python2} setup.py test
-popd
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root,-)
-%doc python2/LICENSE
-%{python2_sitelib}/*
-
-%changelog
-* Tue Dec 1 2015 Mark Reynolds <[email protected]> - 1.0.1-1
-- Initial Fedora Package
-
-
-
-
| 0 |
3b6f43b60482977f44d776aa072bb9e69fd46262
|
389ds/389-ds-base
|
Issue 6841 - Cancel Actions when PR is updated
Description
GH Actions take some time to run, and updating PR before the previous
run has completed makes the new runs wait.
Instead we should cancel the previous runs for this PR to save time
and don't waste computing resources.
Fixes: https://github.com/389ds/389-ds-base/issues/6841
Reviewed by: @droideck (Thanks!)
|
commit 3b6f43b60482977f44d776aa072bb9e69fd46262
Author: Viktor Ashirov <[email protected]>
Date: Tue Jul 1 14:17:43 2025 +0200
Issue 6841 - Cancel Actions when PR is updated
Description
GH Actions take some time to run, and updating PR before the previous
run has completed makes the new runs wait.
Instead we should cancel the previous runs for this PR to save time
and don't waste computing resources.
Fixes: https://github.com/389ds/389-ds-base/issues/6841
Reviewed by: @droideck (Thanks!)
diff --git a/.github/workflows/cargotest.yml b/.github/workflows/cargotest.yml
index 80938cee4..4d1bded85 100644
--- a/.github/workflows/cargotest.yml
+++ b/.github/workflows/cargotest.yml
@@ -7,6 +7,10 @@ on:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual triggering
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml
index 0176e88c2..e7b60a12d 100644
--- a/.github/workflows/compile.yml
+++ b/.github/workflows/compile.yml
@@ -3,6 +3,10 @@ on:
- pull_request
- push
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
diff --git a/.github/workflows/lmdbpytest.yml b/.github/workflows/lmdbpytest.yml
index 21a55b7bb..68dfa9a1c 100644
--- a/.github/workflows/lmdbpytest.yml
+++ b/.github/workflows/lmdbpytest.yml
@@ -16,6 +16,10 @@ on:
required: false
default: false
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml
index f2c5d9ca9..3d9c0d52a 100644
--- a/.github/workflows/npm.yml
+++ b/.github/workflows/npm.yml
@@ -6,6 +6,10 @@ on:
schedule:
- cron: '0 0 * * *'
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index d8434dfbb..af0bd9cb0 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -16,6 +16,10 @@ on:
required: false
default: false
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index af969bf7b..3b120c2be 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -4,6 +4,10 @@ on:
push:
pull_request:
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
permissions:
actions: read
packages: read
| 0 |
d01155c2b511e4cce89ca9e06d29632b774dbd68
|
389ds/389-ds-base
|
Ticket #197 - BDB backend - clear free page files to reduce changelog size
Bug description: Even if entries in the database and changes in the
changelog database are deleted/trimmed, the unused pages of the data-
bases were not returned to the filesystem.
Fix description: This patch calls the compact API that Berkeley DB
provides, which compacts the database.
2 config parameters are introduced to specify the interval of the
compact calls.
Primary DBs (id2entry):
dn: cn=config,cn=ldbm database,cn=plugins,cn=config
nsslapd-db-compactdb-interval: <seconds>
Changelog DBs:
dn: cn=changelog5,cn=config
nsslapd-changelogcompactdb-interval: <seconds>
By default, 2592000 seconds (30 days)
Reviewed by Rich (Thank you!!)
https://fedorahosted.org/389/ticket/197
|
commit d01155c2b511e4cce89ca9e06d29632b774dbd68
Author: Noriko Hosoi <[email protected]>
Date: Wed Aug 21 16:09:26 2013 -0700
Ticket #197 - BDB backend - clear free page files to reduce changelog size
Bug description: Even if entries in the database and changes in the
changelog database are deleted/trimmed, the unused pages of the data-
bases were not returned to the filesystem.
Fix description: This patch calls the compact API that Berkeley DB
provides, which compacts the database.
2 config parameters are introduced to specify the interval of the
compact calls.
Primary DBs (id2entry):
dn: cn=config,cn=ldbm database,cn=plugins,cn=config
nsslapd-db-compactdb-interval: <seconds>
Changelog DBs:
dn: cn=changelog5,cn=config
nsslapd-changelogcompactdb-interval: <seconds>
By default, 2592000 seconds (30 days)
Reviewed by Rich (Thank you!!)
https://fedorahosted.org/389/ticket/197
diff --git a/ldap/servers/plugins/replication/cl5.h b/ldap/servers/plugins/replication/cl5.h
index 33f81403b..9939d5bf2 100644
--- a/ldap/servers/plugins/replication/cl5.h
+++ b/ldap/servers/plugins/replication/cl5.h
@@ -56,6 +56,7 @@ typedef struct changelog5Config
/* the changelog DB configuration parameters are defined as CL5DBConfig in cl5_api.h */
CL5DBConfig dbconfig;
char *symmetricKey;
+ int compactInterval;
}changelog5Config;
/* initializes changelog*/
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 0a70d6b1b..6bf421701 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -240,6 +240,7 @@ typedef struct cl5trim
{
time_t maxAge; /* maximum entry age in seconds */
int maxEntries; /* maximum number of entries across all changelog files */
+ int compactInterval; /* interval to compact changelog db */
PRLock* lock; /* controls access to trimming configuration */
} CL5Trim;
@@ -350,6 +351,7 @@ static int _cl5TrimInit ();
static void _cl5TrimCleanup ();
static int _cl5TrimMain (void *param);
static void _cl5DoTrimming (ReplicaId rid);
+static void _cl5CompactDBs();
static void _cl5TrimFile (Object *obj, long *numToTrim, ReplicaId cleaned_rid);
static PRBool _cl5CanTrim (time_t time, long *numToTrim);
static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool purge);
@@ -1175,10 +1177,12 @@ int cl5GetState ()
Description: sets changelog trimming parameters; changelog must be open.
Parameters: maxEntries - maximum number of entries in the chnagelog (in all files);
maxAge - maximum entry age;
+ compactInterval - interval to compact changelog db
Return: CL5_SUCCESS if successful;
CL5_BAD_STATE if changelog is not open
*/
-int cl5ConfigTrimming (int maxEntries, const char *maxAge)
+int
+cl5ConfigTrimming (int maxEntries, const char *maxAge, int compactInterval)
{
if (s_cl5Desc.dbState == CL5_STATE_NONE)
{
@@ -1216,6 +1220,11 @@ int cl5ConfigTrimming (int maxEntries, const char *maxAge)
s_cl5Desc.dbTrim.maxEntries = maxEntries;
}
+ if (compactInterval != CL5_NUM_IGNORE)
+ {
+ s_cl5Desc.dbTrim.compactInterval = compactInterval;
+ }
+
PR_Unlock (s_cl5Desc.dbTrim.lock);
_cl5RemoveThread ();
@@ -3420,6 +3429,7 @@ static int _cl5TrimMain (void *param)
{
PRIntervalTime interval;
time_t timePrev = current_time ();
+ time_t timeCompactPrev = current_time ();
time_t timeNow;
PR_AtomicIncrement (&s_cl5Desc.threadCount);
@@ -3434,6 +3444,13 @@ static int _cl5TrimMain (void *param)
timePrev = timeNow;
_cl5DoTrimming (0 /* there's no cleaned rid */);
}
+ if ((s_cl5Desc.dbTrim.compactInterval > 0) &&
+ (timeNow - timeCompactPrev >= s_cl5Desc.dbTrim.compactInterval))
+ {
+ /* time to trim */
+ timeCompactPrev = timeNow;
+ _cl5CompactDBs();
+ }
if (NULL == s_cl5Desc.clLock)
{
/* most likely, emergency */
@@ -3478,14 +3495,77 @@ static void _cl5DoTrimming (ReplicaId rid)
example, randomizing starting point */
obj = objset_first_obj (s_cl5Desc.dbFiles);
while (obj && _cl5CanTrim ((time_t)0, &numToTrim))
- {
+ {
_cl5TrimFile (obj, &numToTrim, rid);
- obj = objset_next_obj (s_cl5Desc.dbFiles, obj);
+ obj = objset_next_obj (s_cl5Desc.dbFiles, obj);
}
- if (obj)
- object_release (obj);
+ if (obj)
+ object_release (obj);
+
+ PR_Unlock (s_cl5Desc.dbTrim.lock);
+
+ return;
+}
+/* clear free page files to reduce changelog */
+static void
+_cl5CompactDBs()
+{
+ int rc;
+ Object *fileObj = NULL;
+ CL5DBFile *dbFile = NULL;
+ DB *db = NULL;
+ DB_TXN *txnid = NULL;
+ DB_COMPACT c_data = {0};
+
+ PR_Lock (s_cl5Desc.dbTrim.lock);
+ rc = TXN_BEGIN(s_cl5Desc.dbEnv, NULL, &txnid, 0);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5CompactDBs: failed to begin transaction; db error - %d %s\n",
+ rc, db_strerror(rc));
+ goto bail;
+ }
+ for (fileObj = objset_first_obj(s_cl5Desc.dbFiles);
+ fileObj;
+ fileObj = objset_next_obj(s_cl5Desc.dbFiles, fileObj)) {
+ dbFile = (CL5DBFile*)object_get_data(fileObj);
+ if (!dbFile) {
+ continue;
+ }
+ db = dbFile->db;
+ rc = db->compact(db, txnid, NULL/*start*/, NULL/*stop*/,
+ &c_data, DB_FREE_SPACE, NULL/*end*/);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5CompactDBs: failed to compact %s; db error - %d %s\n",
+ dbFile->replName, rc, db_strerror(rc));
+ goto bail;
+ }
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name_cl,
+ "_cl5CompactDBs: %s - %d pages freed\n",
+ dbFile->replName, c_data.compact_pages_free);
+ }
+bail:
+ if (fileObj) {
+ object_release(fileObj);
+ }
+ if (rc) {
+ rc = TXN_ABORT (txnid);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5CompactDBs: failed to abort transaction; db error - %d %s\n",
+ rc, db_strerror(rc));
+ }
+ } else {
+ rc = TXN_COMMIT (txnid, 0);
+ if (rc) {
+ slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
+ "_cl5CompactDBs: failed to commit transaction; db error - %d %s\n",
+ rc, db_strerror(rc));
+ }
+ }
PR_Unlock (s_cl5Desc.dbTrim.lock);
return;
diff --git a/ldap/servers/plugins/replication/cl5_api.h b/ldap/servers/plugins/replication/cl5_api.h
index 9b285cab7..59d3bf2f6 100644
--- a/ldap/servers/plugins/replication/cl5_api.h
+++ b/ldap/servers/plugins/replication/cl5_api.h
@@ -269,10 +269,11 @@ int cl5GetState ();
Description: sets changelog trimming parameters
Parameters: maxEntries - maximum number of entries in the log;
maxAge - maximum entry age;
+ compactInterval - interval to compact changelog db
Return: CL5_SUCCESS if successful;
CL5_BAD_STATE if changelog has not been open
*/
-int cl5ConfigTrimming (int maxEntries, const char *maxAge);
+int cl5ConfigTrimming (int maxEntries, const char *maxAge, int compactInterval);
/* Name: cl5GetOperation
Description: retireves operation specified by its csn and databaseid
diff --git a/ldap/servers/plugins/replication/cl5_config.c b/ldap/servers/plugins/replication/cl5_config.c
index 980cb7fdb..a523a808f 100644
--- a/ldap/servers/plugins/replication/cl5_config.c
+++ b/ldap/servers/plugins/replication/cl5_config.c
@@ -244,7 +244,7 @@ changelog5_config_add (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter
}
/* set trimming parameters */
- rc = cl5ConfigTrimming (config.maxEntries, config.maxAge);
+ rc = cl5ConfigTrimming (config.maxEntries, config.maxAge, config.compactInterval);
if (rc != CL5_SUCCESS)
{
*returncode = 1;
@@ -336,6 +336,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
slapi_ch_free_string(&config.dir);
config.dir = NULL;
config.maxEntries = CL5_NUM_IGNORE;
+ config.compactInterval = CL5_NUM_IGNORE;
slapi_ch_free_string(&config.maxAge);
config.maxAge = slapi_ch_strdup(CL5_STR_IGNORE);
@@ -399,6 +400,17 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
slapi_ch_free_string(&config.maxAge);
config.maxAge = slapi_ch_strdup(config_attr_value);
}
+ else if ( strcasecmp ( config_attr, CONFIG_CHANGELOG_COMPACTDB_ATTRIBUTE ) == 0 )
+ {
+ if (config_attr_value && config_attr_value[0] != '\0')
+ {
+ config.compactInterval = atoi (config_attr_value);
+ }
+ else
+ {
+ config.compactInterval = 0;
+ }
+ }
else if ( strcasecmp ( config_attr, CONFIG_CHANGELOG_SYMMETRIC_KEY ) == 0 )
{
slapi_ch_free_string(&config.symmetricKey);
@@ -424,6 +436,8 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
* except config.dir */
if (config.maxEntries == CL5_NUM_IGNORE)
config.maxEntries = originalConfig->maxEntries;
+ if (config.compactInterval == CL5_NUM_IGNORE)
+ config.compactInterval = originalConfig->compactInterval;
if (strcmp (config.maxAge, CL5_STR_IGNORE) == 0) {
slapi_ch_free_string(&config.maxAge);
if (originalConfig->maxAge)
@@ -548,7 +562,7 @@ changelog5_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
if (config.maxEntries != CL5_NUM_IGNORE ||
strcmp (config.maxAge, CL5_STR_IGNORE) != 0)
{
- rc = cl5ConfigTrimming (config.maxEntries, config.maxAge);
+ rc = cl5ConfigTrimming (config.maxEntries, config.maxAge, config.compactInterval);
if (rc != CL5_SUCCESS)
{
*returncode = 1;
@@ -706,6 +720,7 @@ static changelog5Config * changelog5_dup_config(changelog5Config *config)
dup->maxAge = slapi_ch_strdup(config->maxAge);
dup->maxEntries = config->maxEntries;
+ dup->compactInterval = config->compactInterval;
dup->dbconfig.pageSize = config->dbconfig.pageSize;
dup->dbconfig.fileMode = config->dbconfig.fileMode;
@@ -732,6 +747,16 @@ static void changelog5_extract_config(Slapi_Entry* entry, changelog5Config *conf
config->maxEntries = atoi (arg);
slapi_ch_free_string(&arg);
}
+ arg= slapi_entry_attr_get_charptr(entry,CONFIG_CHANGELOG_COMPACTDB_ATTRIBUTE);
+ if (arg)
+ {
+ config->compactInterval = atoi (arg);
+ slapi_ch_free_string(&arg);
+ }
+ else
+ {
+ config->compactInterval = CHANGELOGDB_COMPACT_INTERVAL;
+ }
config->maxAge = slapi_entry_attr_get_charptr(entry,CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE);
diff --git a/ldap/servers/plugins/replication/cl5_init.c b/ldap/servers/plugins/replication/cl5_init.c
index 8ee725dce..60e538d83 100644
--- a/ldap/servers/plugins/replication/cl5_init.c
+++ b/ldap/servers/plugins/replication/cl5_init.c
@@ -88,7 +88,7 @@ int changelog5_init()
}
/* set trimming parameters */
- rc = cl5ConfigTrimming (config.maxEntries, config.maxAge);
+ rc = cl5ConfigTrimming (config.maxEntries, config.maxAge, config.compactInterval);
if (rc != CL5_SUCCESS)
{
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl,
diff --git a/ldap/servers/plugins/replication/repl_shared.h b/ldap/servers/plugins/replication/repl_shared.h
index 99f785ed2..f79a65706 100644
--- a/ldap/servers/plugins/replication/repl_shared.h
+++ b/ldap/servers/plugins/replication/repl_shared.h
@@ -58,10 +58,12 @@
#endif
#define CHANGELOGDB_TRIM_INTERVAL 300 /* 5 minutes */
+#define CHANGELOGDB_COMPACT_INTERVAL 2592000 /* 30 days */
#define CONFIG_CHANGELOG_DIR_ATTRIBUTE "nsslapd-changelogdir"
#define CONFIG_CHANGELOG_MAXENTRIES_ATTRIBUTE "nsslapd-changelogmaxentries"
#define CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE "nsslapd-changelogmaxage"
+#define CONFIG_CHANGELOG_COMPACTDB_ATTRIBUTE "nsslapd-changelogcompactdb-interval"
/* Changelog Internal Configuration Parameters -> Changelog Cache related */
#define CONFIG_CHANGELOG_MAX_CONCURRENT_WRITES "nsslapd-changelogmaxconcurrentwrites"
#define CONFIG_CHANGELOG_ENCRYPTION_ALGORITHM "nsslapd-encryptionalgorithm"
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 5b981b019..013d1c0b2 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -4603,10 +4603,8 @@ static int log_flush_threadmain(void *param)
PR_NotifyAllCondVar(sync_txn_log_flush_done);
}
/* wait until flushing conditions are met */
- while ( trans_batch_count == 0 ||
- ( trans_batch_count < trans_batch_limit &&
- trans_batch_count < txn_in_progress_count))
- {
+ while ((trans_batch_count == 0) ||
+ (trans_batch_count < trans_batch_limit && trans_batch_count < txn_in_progress_count)) {
if (priv->dblayer_stop_threads)
break;
if (PR_IntervalNow() - last_flush > interval_flush) {
@@ -4617,7 +4615,7 @@ static int log_flush_threadmain(void *param)
}
PR_Unlock(sync_txn_log_flush);
LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (wakeup): batchcount: %d, "
- "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
} else {
DS_Sleep(interval_def);
}
@@ -4654,6 +4652,9 @@ dblayer_start_checkpoint_thread(struct ldbminfo *li)
return return_value;
}
+/*
+ * checkpoint thread -- borrow the timing for compacting id2entry, as well.
+ */
static int checkpoint_threadmain(void *param)
{
time_t time_of_last_checkpoint_completion = 0; /* seconds since epoch */
@@ -4667,6 +4668,9 @@ static int checkpoint_threadmain(void *param)
char **list = NULL;
char **listp = NULL;
struct dblayer_private_env *penv = NULL;
+ time_t time_of_last_comapctdb_completion = current_time(); /* seconds since epoch */
+ int compactdb_interval = 0;
+ back_txn txn;
PR_ASSERT(NULL != param);
li = (struct ldbminfo*)param;
@@ -4676,6 +4680,7 @@ static int checkpoint_threadmain(void *param)
INCR_THREAD_COUNT(priv);
+ compactdb_interval = priv->dblayer_compactdb_interval;
interval = PR_MillisecondsToInterval(DBLAYER_SLEEP_INTERVAL);
home_dir = dblayer_get_home_dir(li, NULL);
if (NULL == home_dir || '\0' == *home_dir)
@@ -4774,6 +4779,49 @@ static int checkpoint_threadmain(void *param)
}
/* find out which log files don't contain active txns */
DB_CHECKPOINT_LOCK(PR_TRUE, penv->dblayer_env_lock);
+ /* Compacting DB borrowing the timing of the log flush */
+ if ((compactdb_interval > 0) &&
+ (current_time() - time_of_last_comapctdb_completion > compactdb_interval)) {
+ int rc = 0;
+ Object *inst_obj;
+ ldbm_instance *inst;
+ DB *db = NULL;
+ DB_COMPACT c_data = {0};
+
+ for (inst_obj = objset_first_obj(li->li_instance_set);
+ inst_obj;
+ inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
+ inst = (ldbm_instance *)object_get_data(inst_obj);
+ rc = dblayer_get_id2entry(inst->inst_be, &db);
+ if (!db) {
+ continue;
+ }
+ LDAPDebug1Arg(LDAP_DEBUG_BACKLDBM, "compactdb: Compacting DB start: %s\n",
+ inst->inst_name);
+ rc = dblayer_txn_begin(inst->inst_be, NULL, &txn);
+ if (rc) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,
+ "compactdb: transaction begin failed: %d\n",
+ rc);
+ break;
+ }
+ rc = db->compact(db, txn.back_txn_txn, NULL/*start*/, NULL/*stop*/,
+ &c_data, DB_FREE_SPACE, NULL/*end*/);
+ if (rc) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "compactdb: failed to compact %s; db error - %d %s\n",
+ inst->inst_name, rc, db_strerror(rc));
+ rc = dblayer_txn_abort(inst->inst_be, &txn);
+ } else {
+ LDAPDebug2Args(LDAP_DEBUG_BACKLDBM,
+ "compactdb: compact %s - %d pages freed\n",
+ inst->inst_name, c_data.compact_pages_free);
+ rc = dblayer_txn_commit(inst->inst_be, &txn);
+ }
+ }
+ time_of_last_comapctdb_completion = current_time(); /* seconds since epoch */
+ compactdb_interval = priv->dblayer_compactdb_interval;
+ }
rval = LOG_ARCHIVE(penv->dblayer_DB_ENV, &list,
DB_ARCH_ABS, (void *)slapi_ch_malloc);
DB_CHECKPOINT_UNLOCK(PR_TRUE, penv->dblayer_env_lock);
@@ -4794,10 +4842,10 @@ static int checkpoint_threadmain(void *param)
checkpoint_debug_message(debug_checkpointing,
"Renaming %s -> %s\n",*listp, new_filename, 0);
if(rename(*listp, new_filename) != 0){
- LDAPDebug(LDAP_DEBUG_ANY, "checkpoint_threadmain: failed to rename log (%s) to (%s)\n",
- *listp, new_filename, 0);
- rval = -1;
- goto error_return;
+ LDAPDebug(LDAP_DEBUG_ANY, "checkpoint_threadmain: failed to rename log (%s) to (%s)\n",
+ *listp, new_filename, 0);
+ rval = -1;
+ goto error_return;
}
}
}
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h
index 7f3200c95..c382a9813 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.h
+++ b/ldap/servers/slapd/back-ldbm/dblayer.h
@@ -179,6 +179,7 @@ struct dblayer_private
int dblayer_lockdown; /* use DB_LOCKDOWN */
int dblayer_lock_config;
u_int32_t dblayer_deadlock_policy; /* i.e. the atype to DB_ENV->lock_detect in deadlock_threadmain */
+ int dblayer_compactdb_interval; /* interval to execute compact id2entry dbs */
};
#if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR >= 4300
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 4eb53e564..d53e9b358 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -679,6 +679,26 @@ static int ldbm_config_db_checkpoint_interval_set(void *arg, void *value, char *
return retval;
}
+static void *ldbm_config_db_compactdb_interval_get(void *arg)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+
+ return (void *) ((uintptr_t)li->li_dblayer_private->dblayer_compactdb_interval);
+}
+
+static int ldbm_config_db_compactdb_interval_set(void *arg, void *value, char *errorbuf, int phase, int apply)
+{
+ struct ldbminfo *li = (struct ldbminfo *) arg;
+ int retval = LDAP_SUCCESS;
+ int val = (int) ((uintptr_t)value);
+
+ if (apply) {
+ li->li_dblayer_private->dblayer_compactdb_interval = val;
+ }
+
+ return retval;
+}
+
static void *ldbm_config_db_page_size_get(void *arg)
{
struct ldbminfo *li = (struct ldbminfo *) arg;
@@ -1447,6 +1467,7 @@ static config_info ldbm_config[] = {
{CONFIG_DB_CIRCULAR_LOGGING, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_circular_logging_get, &ldbm_config_db_circular_logging_set, 0},
{CONFIG_DB_TRANSACTION_LOGGING, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_transaction_logging_get, &ldbm_config_db_transaction_logging_set, 0},
{CONFIG_DB_CHECKPOINT_INTERVAL, CONFIG_TYPE_INT, "60", &ldbm_config_db_checkpoint_interval_get, &ldbm_config_db_checkpoint_interval_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ {CONFIG_DB_COMPACTDB_INTERVAL, CONFIG_TYPE_INT, "2592000"/*30days*/, &ldbm_config_db_compactdb_interval_get, &ldbm_config_db_compactdb_interval_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_TRANSACTION_BATCH, CONFIG_TYPE_INT, "0", &dblayer_get_batch_transactions, &dblayer_set_batch_transactions, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_min_sleep, &dblayer_set_batch_txn_min_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_max_sleep, &dblayer_set_batch_txn_max_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index f42070767..cb9d3c7a9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -110,6 +110,7 @@ struct config_info {
#define CONFIG_DB_CIRCULAR_LOGGING "nsslapd-db-circular-logging"
#define CONFIG_DB_TRANSACTION_LOGGING "nsslapd-db-transaction-logging"
#define CONFIG_DB_CHECKPOINT_INTERVAL "nsslapd-db-checkpoint-interval"
+#define CONFIG_DB_COMPACTDB_INTERVAL "nsslapd-db-compactdb-interval"
#define CONFIG_DB_TRANSACTION_BATCH "nsslapd-db-transaction-batch-val"
#define CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP "nsslapd-db-transaction-batch-min-wait"
#define CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP "nsslapd-db-transaction-batch-max-wait"
| 0 |
973b59ac5d2cae1e953a6c8b48ca9efb30edd03e
|
389ds/389-ds-base
|
Ticket 48303 - Fix lib389 broken tests - agreement_test
Description: Fix the imports to the correct ones.
Add Red Hat copyright block.
Remove "Created on" block, because git contains
this information.
Remove hard coded variables, that reference to
the local user home directory.
Add missing docstrings for every test case.
Remove redundant code from schedule test case.
Fix expected exception assertions within create
and schedule test cases.
Add assert statement to status test case.
Refactore code to the pytest compatibility.
https://fedorahosted.org/389/ticket/48303
Review by: mreynolds (Thanks!)
|
commit 973b59ac5d2cae1e953a6c8b48ca9efb30edd03e
Author: Simon Pichugin <[email protected]>
Date: Thu Oct 8 15:19:41 2015 +0200
Ticket 48303 - Fix lib389 broken tests - agreement_test
Description: Fix the imports to the correct ones.
Add Red Hat copyright block.
Remove "Created on" block, because git contains
this information.
Remove hard coded variables, that reference to
the local user home directory.
Add missing docstrings for every test case.
Remove redundant code from schedule test case.
Fix expected exception assertions within create
and schedule test cases.
Add assert statement to status test case.
Refactore code to the pytest compatibility.
https://fedorahosted.org/389/ticket/48303
Review by: mreynolds (Thanks!)
diff --git a/src/lib389/tests/agreement_test.py b/src/lib389/tests/agreement_test.py
index ef878b512..a8072779b 100644
--- a/src/lib389/tests/agreement_test.py
+++ b/src/lib389/tests/agreement_test.py
@@ -1,20 +1,22 @@
-'''
-Created on Jan 9, 2014
-
-@author: tbordaz
-'''
-
+# --- 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 ldap
import time
import sys
import os
+import pytest
from lib389 import InvalidArgumentError, NoSuchEntryError
from lib389.agreement import Agreement
from lib389._constants import *
from lib389.properties import *
from lib389 import DirSrv, Entry
-from _constants import REPLICAROLE_CONSUMER
# Used for One master / One consumer topology
HOST_MASTER = LOCALHOST
@@ -26,296 +28,284 @@ HOST_CONSUMER = LOCALHOST
PORT_CONSUMER = 50389
SERVERID_CONSUMER = 'consumer'
-TEST_REPL_DN = "uid=test,%s" % DEFAULT_SUFFIX
-INSTANCE_PORT = 54321
-INSTANCE_SERVERID = 'dirsrv'
-#INSTANCE_PREFIX = os.environ.get('PREFIX', None)
-INSTANCE_PREFIX = '/home/tbordaz/install'
-INSTANCE_BACKUP = os.environ.get('BACKUPDIR', DEFAULT_BACKUPDIR)
-
SUFFIX = DEFAULT_SUFFIX
ENTRY_DN = "cn=test_entry, %s" % SUFFIX
-
-class Test_Agreement():
-
-
- def setUp(self):
- #
- # Master
- #
- # Create the master instance
- master = DirSrv(verbose=False)
- master.log.debug("Master allocated")
- args = {SER_HOST: HOST_MASTER,
- SER_PORT: PORT_MASTER,
- SER_DEPLOYED_DIR: INSTANCE_PREFIX,
- SER_SERVERID_PROP: SERVERID_MASTER
- }
- master.allocate(args)
- if master.exists():
- master.delete()
- master.create()
+class TopologyReplication(object):
+ def __init__(self, master, consumer):
master.open()
-
- # enable replication
- master.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER)
- self.master = master
-
-
- #
- # Consumer
- #
- # Create the consumer instance
- consumer = DirSrv(verbose=False)
- consumer.log.debug("Consumer allocated")
- args = {SER_HOST: HOST_CONSUMER,
- SER_PORT: PORT_CONSUMER,
- SER_DEPLOYED_DIR: INSTANCE_PREFIX,
- SER_SERVERID_PROP: SERVERID_CONSUMER
- }
- consumer.allocate(args)
- if consumer.exists():
- consumer.delete()
- consumer.create()
consumer.open()
-
- # enable replication
- consumer.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_CONSUMER)
+ self.master = master
self.consumer = consumer
- def tearDown(self):
- self.master.log.info("\n\n#########################\n### TEARDOWN\n#########################\n")
- for instance in (self.master, self.consumer):
- if instance.exists():
- instance.delete()
-
- def test_create(self):
- '''
- Test to create a replica agreement and initialize the consumer.
- Test on a unknown suffix
- '''
- self.master.log.info("\n\n#########################\n### CREATE\n#########################\n")
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- repl_agreement = self.master.agreement.create(suffix=SUFFIX, host=self.consumer.host, port=self.consumer.port, properties=properties)
- self.master.log.debug("%s created" % repl_agreement)
- self.master.agreement.init(SUFFIX, HOST_CONSUMER, PORT_CONSUMER)
- self.master.waitForReplInit(repl_agreement)
-
- # Add a test entry
- self.master.add_s(Entry((ENTRY_DN, {'objectclass': "top person".split(),
[email protected](scope="module")
+def topology(request):
+ # Master
+ #
+ # Create the master instance
+ master = DirSrv(verbose=False)
+ master.log.debug("Master allocated")
+ args = {SER_HOST: HOST_MASTER,
+ SER_PORT: PORT_MASTER,
+ SER_SERVERID_PROP: SERVERID_MASTER}
+ master.allocate(args)
+ if master.exists():
+ master.delete()
+ master.create()
+ master.open()
+
+ # Enable replication
+ master.replica.enableReplication(suffix=SUFFIX,
+ role=REPLICAROLE_MASTER,
+ replicaId=REPLICAID_MASTER)
+
+ # Consumer
+ #
+ # Create the consumer instance
+ consumer = DirSrv(verbose=False)
+ consumer.log.debug("Consumer allocated")
+ args = {SER_HOST: HOST_CONSUMER,
+ SER_PORT: PORT_CONSUMER,
+ SER_SERVERID_PROP: SERVERID_CONSUMER}
+ consumer.allocate(args)
+ if consumer.exists():
+ consumer.delete()
+ consumer.create()
+ consumer.open()
+
+ # Enable replication
+ consumer.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_CONSUMER)
+
+ # Delete each instance in the end
+ def fin():
+ master.delete()
+ consumer.delete()
+ request.addfinalizer(fin)
+
+ return TopologyReplication(master, consumer)
+
+
+def test_create(topology):
+ """Test to create a replica agreement and initialize the consumer.
+ Test on a unknown suffix
+ """
+
+ topology.master.log.info("\n\n#########################\n### CREATE\n#########################\n")
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ repl_agreement = topology.master.agreement.create(suffix=SUFFIX,
+ host=topology.consumer.host,
+ port=topology.consumer.port,
+ properties=properties)
+ topology.master.log.debug("%s created" % repl_agreement)
+ topology.master.agreement.init(SUFFIX, HOST_CONSUMER, PORT_CONSUMER)
+ topology.master.waitForReplInit(repl_agreement)
+
+ # Add a test entry
+ topology.master.add_s(Entry((ENTRY_DN, {'objectclass': "top person".split(),
'sn': 'test_entry',
'cn': 'test_entry'})))
-
- # check replication is working
- loop = 0
- while loop <= 10:
- try:
- ent = self.consumer.getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- assert loop <= 10
-
- # check that with an invalid suffix it raises NoSuchEntryError
- try:
- properties = {RA_NAME: r'meAgainTo_$host:$port'}
- self.master.agreement.create(suffix="ou=dummy", host=self.consumer.host, port=self.consumer.port, properties=properties)
- except Exception as e:
- self.master.log.info("Exception (expected): %s" % type(e).__name__)
- assert isinstance(e, NoSuchEntryError)
-
- def test_list(self):
- '''
- List the replica agreement on a suffix => 1
- Add a RA
- List the replica agreements on that suffix again => 2
- List a specific RA
-
- PREREQUISITE: it exists a replica for SUFFIX and a replica agreement
- '''
- self.master.log.info("\n\n#########################\n### LIST\n#########################\n")
- ents = self.master.agreement.list(suffix=SUFFIX)
- assert len(ents) == 1
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_HOST]) == self.consumer.host
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_PORT]) == str(self.consumer.port)
-
- # Create a second RA to check .list returns 2 RA
- properties = {RA_NAME: r'meTo_$host:$port',
- RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
- RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
- RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
- RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
- self.master.agreement.create(suffix=SUFFIX, host=self.consumer.host, port=12345, properties=properties)
- ents = self.master.agreement.list(suffix=SUFFIX)
- assert len(ents) == 2
-
- # Check we can .list a specific RA
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_HOST]) == self.consumer.host
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_PORT]) == str(self.consumer.port)
-
-
- def test_status(self):
- self.master.log.info("\n\n#########################\n### STATUS\n#########################")
- ents = self.master.agreement.list(suffix=SUFFIX)
- for ent in ents:
- self.master.log.info("Status of %s: %s" % (ent.dn, self.master.agreement.status(ent.dn)))
-
- def test_schedule(self):
-
- self.master.log.info("\n\n#########################\n### SCHEDULE\n#########################")
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
-
- self.master.agreement.schedule(ents[0].dn, Agreement.ALWAYS)
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == Agreement.ALWAYS
-
- self.master.agreement.schedule(ents[0].dn, Agreement.NEVER)
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == Agreement.NEVER
-
- CUSTOM_SCHEDULE="0000-1234 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == CUSTOM_SCHEDULE
-
- # check that with an invalid HOUR schedule raise ValueError
- try:
- CUSTOM_SCHEDULE="2500-1234 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) HOUR: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- try:
- CUSTOM_SCHEDULE="0000-2534 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) HOUR: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- # check that with an starting HOUR after ending HOUR raise ValueError
- try:
- CUSTOM_SCHEDULE="1300-1234 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) HOUR: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- # check that with an invalid MIN schedule raise ValueError
- try:
- CUSTOM_SCHEDULE="0062-1234 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) MIN: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- try:
- CUSTOM_SCHEDULE="0000-1362 6420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) MIN: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- # check that with an invalid DAYS schedule raise ValueError
- try:
- CUSTOM_SCHEDULE="0000-1234 6-420"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) MIN: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- try:
- CUSTOM_SCHEDULE="0000-1362 64209"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) MIN: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
+
+ # Check replication is working
+ loop = 0
+ while loop <= 10:
try:
- CUSTOM_SCHEDULE="0000-1362 01234560"
- self.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
- except Exception as e:
- self.master.log.info("Exception (expected) MIN: %s" % type(e).__name__)
- assert isinstance(e, ValueError)
-
- def test_getProperties(self):
- self.master.log.info("\n\n#########################\n### GETPROPERTIES\n#########################")
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- properties = self.master.agreement.getProperties(agmnt_dn=ents[0].dn)
- for prop in properties:
- self.master.log.info("RA %s : %s -> %s" % (prop, RA_PROPNAME_TO_ATTRNAME[prop], properties[prop]))
-
- properties = self.master.agreement.getProperties(agmnt_dn=ents[0].dn, properties=[RA_BINDDN])
- assert len(properties) == 1
- for prop in properties:
- self.master.log.info("RA %s : %s -> %s" % (prop, RA_PROPNAME_TO_ATTRNAME[prop], properties[prop]))
-
- def test_setProperties(self):
- self.master.log.info("\n\n#########################\n### SETPROPERTIES\n#########################")
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- test_schedule = "1234-2345 12345"
- test_desc = "hello world !"
- self.master.agreement.setProperties(agmnt_dn=ents[0].dn, properties={RA_SCHEDULE: test_schedule, RA_DESCRIPTION: test_desc})
- properties = self.master.agreement.getProperties(agmnt_dn=ents[0].dn, properties=[RA_SCHEDULE, RA_DESCRIPTION])
- assert len(properties) == 2
- assert properties[RA_SCHEDULE][0] == test_schedule
- assert properties[RA_DESCRIPTION][0] == test_desc
-
- def test_changes(self):
- self.master.log.info("\n\n#########################\n### CHANGES\n#########################")
- ents = self.master.agreement.list(suffix=SUFFIX, consumer_host=self.consumer.host, consumer_port=self.consumer.port)
- assert len(ents) == 1
- value = self.master.agreement.changes(agmnt_dn=ents[0].dn)
- self.master.log.info("\ntest_changes: %d changes\n" % value)
- assert value > 0
-
- # do an update
- TEST_STRING = 'hello you'
- mod = [(ldap.MOD_REPLACE, 'description', [TEST_STRING])]
- self.master.modify_s(ENTRY_DN, mod)
-
- # the update has been replicated
- loop = 0
- while loop <= 10:
- ent = self.consumer.getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")
- if ent and ent.hasValue('description'):
- if ent.getValue('description') == TEST_STRING:
- break
- time.sleep(1)
- loop += 1
- assert loop <= 10
-
- # check change number
- newvalue = self.master.agreement.changes(agmnt_dn=ents[0].dn)
- self.master.log.info("\ntest_changes: %d changes\n" % newvalue)
- assert (value + 1) == newvalue
-
+ ent = topology.consumer.getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ break
+ except ldap.NO_SUCH_OBJECT:
+ time.sleep(1)
+ loop += 1
+ assert loop <= 10
+
+ # Check that with an invalid suffix it raises NoSuchEntryError
+ with pytest.raises(NoSuchEntryError):
+ properties = {RA_NAME: r'meAgainTo_$host:$port'}
+ topology.master.agreement.create(suffix="ou=dummy",
+ host=topology.consumer.host,
+ port=topology.consumer.port,
+ properties=properties)
+
+
+def test_list(topology):
+ """List the replica agreement on a suffix => 1
+ Add a RA
+ List the replica agreements on that suffix again => 2
+ List a specific RA
+
+ PREREQUISITE: it exists a replica for SUFFIX and a replica agreement
+ """
+
+ topology.master.log.info("\n\n#########################\n### LIST\n#########################\n")
+ ents = topology.master.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 1
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_HOST]) == topology.consumer.host
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_PORT]) == str(topology.consumer.port)
+
+ # Create a second RA to check .list returns 2 RA
+ properties = {RA_NAME: r'meTo_$host:$port',
+ RA_BINDDN: defaultProperties[REPLICATION_BIND_DN],
+ RA_BINDPW: defaultProperties[REPLICATION_BIND_PW],
+ RA_METHOD: defaultProperties[REPLICATION_BIND_METHOD],
+ RA_TRANSPORT_PROT: defaultProperties[REPLICATION_TRANSPORT]}
+ topology.master.agreement.create(suffix=SUFFIX,
+ host=topology.consumer.host,
+ port=12345,
+ properties=properties)
+ ents = topology.master.agreement.list(suffix=SUFFIX)
+ assert len(ents) == 2
+
+ # Check we can .list a specific RA
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_HOST]) == topology.consumer.host
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_CONSUMER_PORT]) == str(topology.consumer.port)
+
+
+def test_status(topology):
+ """Test that status is returned from agreement"""
+
+ topology.master.log.info("\n\n#########################\n### STATUS\n#########################")
+ ents = topology.master.agreement.list(suffix=SUFFIX)
+ for ent in ents:
+ ra_status = topology.master.agreement.status(ent.dn)
+ assert ra_status
+ topology.master.log.info("Status of %s: %s" % (ent.dn, ra_status))
+
+
+def test_schedule(topology):
+ """Test the schedule behaviour with valid and invalid values"""
+
+ topology.master.log.info("\n\n#########################\n### SCHEDULE\n#########################")
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+
+ topology.master.agreement.schedule(ents[0].dn, Agreement.ALWAYS)
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == Agreement.ALWAYS
+
+ topology.master.agreement.schedule(ents[0].dn, Agreement.NEVER)
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == Agreement.NEVER
+
+ CUSTOM_SCHEDULE="0000-1234 6420"
+ topology.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ assert ents[0].getValue(RA_PROPNAME_TO_ATTRNAME[RA_SCHEDULE]) == CUSTOM_SCHEDULE
+
+ CUSTOM_SCHEDULES = ("2500-1234 6420", # Invalid HOUR schedule
+ "0000-2534 6420", # ^^
+ "1300-1234 6420", # Starting HOUR after ending HOUR
+ "0062-1234 6420", # Invalid MIN schedule
+ "0000-1362 6420", # ^^
+ "0000-1234 6-420", # Invalid DAYS schedule
+ "0000-1362 64209", # ^^
+ "0000-1362 01234560") # ^^
+
+ for CUSTOM_SCHEDULE in CUSTOM_SCHEDULES:
+ with pytest.raises(ValueError):
+ topology.master.agreement.schedule(ents[0].dn, CUSTOM_SCHEDULE)
+
+
+def test_getProperties(topology):
+ """Check the correct behaviour of getProperties function"""
+
+ topology.master.log.info("\n\n#########################\n### GETPROPERTIES\n#########################")
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ properties = topology.master.agreement.getProperties(agmnt_dn=ents[0].dn)
+ for prop in properties:
+ topology.master.log.info("RA %s : %s -> %s" % (prop,
+ RA_PROPNAME_TO_ATTRNAME[prop],
+ properties[prop]))
+
+ properties = topology.master.agreement.getProperties(agmnt_dn=ents[0].dn,
+ properties=[RA_BINDDN])
+ assert len(properties) == 1
+ for prop in properties:
+ topology.master.log.info("RA %s : %s -> %s" % (prop,
+ RA_PROPNAME_TO_ATTRNAME[prop],
+ properties[prop]))
+
+
+def test_setProperties(topology):
+ """Set properties to the agreement and check, if it was successful"""
+
+ topology.master.log.info("\n\n#########################\n### SETPROPERTIES\n#########################")
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ test_schedule = "1234-2345 12345"
+ test_desc = "test_desc"
+ topology.master.agreement.setProperties(agmnt_dn=ents[0].dn,
+ properties={RA_SCHEDULE: test_schedule,
+ RA_DESCRIPTION: test_desc})
+ properties = topology.master.agreement.getProperties(agmnt_dn=ents[0].dn,
+ properties=[RA_SCHEDULE,
+ RA_DESCRIPTION])
+ assert len(properties) == 2
+ assert properties[RA_SCHEDULE][0] == test_schedule
+ assert properties[RA_DESCRIPTION][0] == test_desc
+
+
+def test_changes(topology):
+ """Test the changes counter behaviour after making some changes
+ to the replicated suffix
+ """
+
+ topology.master.log.info("\n\n#########################\n### CHANGES\n#########################")
+ ents = topology.master.agreement.list(suffix=SUFFIX,
+ consumer_host=topology.consumer.host,
+ consumer_port=topology.consumer.port)
+ assert len(ents) == 1
+ value = topology.master.agreement.changes(agmnt_dn=ents[0].dn)
+ topology.master.log.info("\ntest_changes: %d changes\n" % value)
+ assert value > 0
+
+ # Do an update
+ TEST_STRING = 'test_string'
+ mod = [(ldap.MOD_REPLACE, 'description', [TEST_STRING])]
+ topology.master.modify_s(ENTRY_DN, mod)
+
+ ent = topology.consumer.getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+
+ # The update has been replicated
+ loop = 0
+ while loop <= 10:
+ ent = topology.consumer.getEntry(ENTRY_DN, ldap.SCOPE_BASE, "(objectclass=*)")
+ if ent and ent.hasValue('description'):
+ if ent.getValue('description') == TEST_STRING:
+ break
+ time.sleep(1)
+ loop += 1
+ assert loop <= 10
+
+ # Check change number
+ newvalue = topology.master.agreement.changes(agmnt_dn=ents[0].dn)
+ topology.master.log.info("\ntest_changes: %d changes\n" % newvalue)
+ assert (value + 1) == newvalue
+
+
if __name__ == "__main__":
- test = Test_Agreement()
- test.setUp()
-
- test.test_create()
- test.test_list()
- test.test_status()
- test.test_schedule()
- test.test_getProperties()
- test.test_setProperties()
- test.test_changes()
-
- test.tearDown()
\ No newline at end of file
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s -v %s" % CURRENT_FILE)
| 0 |
d261ea27ca7097d5091d0209b43d47e715122b2c
|
389ds/389-ds-base
|
Issue 6183 - Slow ldif2db import on a newly created BDB backend (#6208)
Bug Description: After creating a new BDB backend, we autotune the cache only when restarting.
So, an administrator will try to import an LDIF before that; she will have a very slow import.
Fix Description: Do the autotuning during the backend creation.
Add a CI test for the scenario.
Fixes: https://github.com/389ds/389-ds-base/issues/6183
Reviewed by: @progier389, @tbordaz (Thanks!!)
|
commit d261ea27ca7097d5091d0209b43d47e715122b2c
Author: Simon Pichugin <[email protected]>
Date: Tue Jun 11 20:19:29 2024 -0700
Issue 6183 - Slow ldif2db import on a newly created BDB backend (#6208)
Bug Description: After creating a new BDB backend, we autotune the cache only when restarting.
So, an administrator will try to import an LDIF before that; she will have a very slow import.
Fix Description: Do the autotuning during the backend creation.
Add a CI test for the scenario.
Fixes: https://github.com/389ds/389-ds-base/issues/6183
Reviewed by: @progier389, @tbordaz (Thanks!!)
diff --git a/dirsrvtests/tests/suites/import/regression_test.py b/dirsrvtests/tests/suites/import/regression_test.py
index 485f59dc5..e6fef89cc 100644
--- a/dirsrvtests/tests/suites/import/regression_test.py
+++ b/dirsrvtests/tests/suites/import/regression_test.py
@@ -434,7 +434,58 @@ def test_large_ldif2db_ancestorid_index_creation(topo, _set_mdb_map_size):
# The time for the ancestorid index creation should be less than 10s for an offline import of an ldif file with 100000 entries / 5 entries per node
# Should be adjusted if these numbers are modified in the test
assert etime <= 10
-
+
+
+def create_backend_and_import(instance, ldif_file, suffix, backend):
+ log.info(f'Add suffix:{suffix} and backend: {backend}...')
+ backends = Backends(instance)
+ backends.create(properties={'nsslapd-suffix': suffix, 'name': backend})
+ props = {'numUsers': 10000, 'nodeLimit': 5, 'suffix': suffix}
+
+ log.info(f'Create a large nested ldif file using dbgen : {ldif_file}')
+ dbgen_nested_ldif(instance, ldif_file, props)
+
+ log.info('Stop the server and run offline import...')
+ instance.stop()
+ log.info('Measure the import time for the ldif file...')
+ start = time.time()
+ assert instance.ldif2db(backend, None, None, None, ldif_file)
+ end = time.time()
+ instance.start()
+ return end - start
+
+
[email protected](get_default_db_lib() == "mdb", reason="Not cache size over mdb")
+def test_ldif2db_after_backend_create(topo):
+ """Test that ldif2db after backend creation is not slow first time
+
+ :id: c1ab1df7-c70a-46be-bbca-8d65c6ebaa14
+ :setup: Standalone Instance
+ :steps:
+ 1. Create backend and suffix
+ 2. Generate large LDIF file
+ 3. Stop server and run offline import
+ 4. Measure import time
+ 5. Restart server and repeat steps 1-4 with new backend and suffix
+ :expectedresults:
+ 1. Operation successful
+ 2. Operation successful
+ 3. Operation successful
+ 4. Import times should be approximately the same
+ 5. Operation successful
+ """
+
+ instance = topo.standalone
+ ldif_dir = instance.get_ldif_dir()
+ ldif_file_1 = os.path.join(ldif_dir, 'large_nested_1.ldif')
+ ldif_file_2 = os.path.join(ldif_dir, 'large_nested_2.ldif')
+
+ import_time_1 = create_backend_and_import(instance, ldif_file_1, 'o=test_1', 'test_1')
+ import_time_2 = create_backend_and_import(instance, ldif_file_2, 'o=test_2', 'test_2')
+
+ log.info('Import times should be approximately the same')
+ assert abs(import_time_1 - import_time_2) < 5
+
if __name__ == '__main__':
# Run isolated
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index a267601f9..f65779081 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -1031,6 +1031,24 @@ ldbm_instance_postadd_instance_entry_callback(Slapi_PBlock *pb __attribute__((un
/* Initialize and register callbacks for VLV indexes */
vlv_init(inst);
+ /* We are autotuning the caches. was:
+ * retval = ldbm_back_start_autotune(li);
+ * This involves caches specific to instances managed in the ldbm layer
+ * and to caches specific to the db implementation.
+ * The cache usage and requirements of the db is not known here, also it
+ * might have impact on the sizing of the instance caches.
+ * Therfor this functionality is moved to the db_xxx layer.
+ * The latest autotune function was implemented only with BDB in mind
+ * so it should be safe to move it to db_bdb.
+ */
+ priv = (dblayer_private *)li->li_dblayer_private;
+ rval = priv->dblayer_auto_tune_fn(li);
+ if (rval != 0) {
+ slapi_log_err(SLAPI_LOG_ERR,
+ "ldbm_instance_postadd_instance_entry_callback",
+ "Failed to set database tuning on backends\n");
+ }
+
/* this is an ACTUAL ADD being done while the server is running!
* start up the appropriate backend...
*/
@@ -1044,7 +1062,6 @@ ldbm_instance_postadd_instance_entry_callback(Slapi_PBlock *pb __attribute__((un
/* call the backend implementation specific callbacks */
- priv = (dblayer_private *)li->li_dblayer_private;
priv->instance_postadd_config_fn(li, inst);
slapi_ch_free((void **)&instance_name);
| 0 |
53c9c4e84e3bcbc40de87b1e7cf7634d14599e1c
|
389ds/389-ds-base
|
Ticket #48194 - nsSSL3Ciphers preference not enforced server side
Description: The fix for ticket 47838 accidentally changed the timing
of setting default cipher preferences and creating a sslSocket which
broke setting the default preferences to each sslSocket.
https://fedorahosted.org/389/ticket/48194
Reviewed by [email protected] (Thank you, Rich!!)
|
commit 53c9c4e84e3bcbc40de87b1e7cf7634d14599e1c
Author: Noriko Hosoi <[email protected]>
Date: Thu Jun 11 22:25:14 2015 -0700
Ticket #48194 - nsSSL3Ciphers preference not enforced server side
Description: The fix for ticket 47838 accidentally changed the timing
of setting default cipher preferences and creating a sslSocket which
broke setting the default preferences to each sslSocket.
https://fedorahosted.org/389/ticket/48194
Reviewed by [email protected] (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index 67d01cd68..198edbc83 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -1342,9 +1342,6 @@ slapd_ssl_init()
freeConfigEntry( &entry );
}
- /* ugaston- Cipher preferences must be set before any sslSocket is created
- * for such sockets to take preferences into account.
- */
freeConfigEntry( &entry );
/* Introduce a way of knowing whether slapd_ssl_init has
@@ -1590,6 +1587,45 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
errorbuf[0] = '\0';
+ /*
+ * Cipher preferences must be set before any sslSocket is created
+ * for such sockets to take preferences into account.
+ */
+ getConfigEntry(configDN, &e);
+ if (e == NULL) {
+ slapd_SSL_warn("Security Initialization: Failed get config entry %s", configDN);
+ return 1;
+ }
+ val = slapi_entry_attr_get_charptr(e, "allowWeakCipher");
+ if (val) {
+ if (!PL_strcasecmp(val, "off") || !PL_strcasecmp(val, "false") ||
+ !PL_strcmp(val, "0") || !PL_strcasecmp(val, "no")) {
+ allowweakcipher = CIPHER_SET_DISALLOWWEAKCIPHER;
+ } else if (!PL_strcasecmp(val, "on") || !PL_strcasecmp(val, "true") ||
+ !PL_strcmp(val, "1") || !PL_strcasecmp(val, "yes")) {
+ allowweakcipher = CIPHER_SET_ALLOWWEAKCIPHER;
+ } else {
+ slapd_SSL_warn("The value of allowWeakCipher \"%s\" in %s is invalid.",
+ "Ignoring it and set it to default.", val, configDN);
+ }
+ }
+ slapi_ch_free((void **) &val);
+
+ /* Set SSL cipher preferences */
+ *cipher_string = 0;
+ if(ciphers && (*ciphers) && PL_strcmp(ciphers, "blank"))
+ PL_strncpyz(cipher_string, ciphers, sizeof(cipher_string));
+ slapi_ch_free((void **) &ciphers);
+
+ if ( NULL != (val = _conf_setciphers(cipher_string, allowweakcipher)) ) {
+ errorCode = PR_GetError();
+ slapd_SSL_warn("Security Initialization: Failed to set SSL cipher "
+ "preference information: %s (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
+ val, errorCode, slapd_pr_strerror(errorCode));
+ slapi_ch_free((void **) &val);
+ }
+ freeConfigEntry(&e);
+
/* Import pr fd into SSL */
pr_sock = SSL_ImportFD( NULL, sock );
if( pr_sock == (PRFileDesc *)NULL ) {
@@ -1632,8 +1668,6 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
slapd_pk11_setSlotPWValues(slot, 0, 0);
}
-
-
/*
* Now, get the complete list of cipher families. Each family
* has a token name and personality name which we'll use to find
@@ -1816,9 +1850,8 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
"out of disk space! Make more room in /tmp "
"and try again. (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
errorCode, slapd_pr_strerror(errorCode));
- }
- else {
- slapd_SSL_error("Config of server nonce cache failed (error %d - %s)",
+ } else {
+ slapd_SSL_error("Config of server nonce cache failed (error %d - %s)",
errorCode, slapd_pr_strerror(errorCode));
}
return rv;
@@ -1985,36 +2018,6 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
#if !defined(NSS_TLS10) /* NSS_TLS11 or newer */
}
#endif
- val = slapi_entry_attr_get_charptr(e, "allowWeakCipher");
- if (val) {
- if (!PL_strcasecmp(val, "off") || !PL_strcasecmp(val, "false") ||
- !PL_strcmp(val, "0") || !PL_strcasecmp(val, "no")) {
- allowweakcipher = CIPHER_SET_DISALLOWWEAKCIPHER;
- } else if (!PL_strcasecmp(val, "on") || !PL_strcasecmp(val, "true") ||
- !PL_strcmp(val, "1") || !PL_strcasecmp(val, "yes")) {
- allowweakcipher = CIPHER_SET_ALLOWWEAKCIPHER;
- } else {
- slapd_SSL_warn("The value of allowWeakCipher \"%s\" in %s is invalid.",
- "Ignoring it and set it to default.", val, configDN);
- }
- }
- slapi_ch_free((void **) &val);
-
- /* Set SSL cipher preferences */
- *cipher_string = 0;
- if(ciphers && (*ciphers) && PL_strcmp(ciphers, "blank"))
- PL_strncpyz(cipher_string, ciphers, sizeof(cipher_string));
- slapi_ch_free((void **) &ciphers);
-
- if ( NULL != (val = _conf_setciphers(cipher_string, allowweakcipher)) ) {
- errorCode = PR_GetError();
- slapd_SSL_warn("Security Initialization: Failed to set SSL cipher "
- "preference information: %s (" SLAPI_COMPONENT_NAME_NSPR " error %d - %s)",
- val, errorCode, slapd_pr_strerror(errorCode));
- rv = 3;
- slapi_ch_free((void **) &val);
- }
-
freeConfigEntry( &e );
if(( slapd_SSLclientAuth = config_get_SSLclientAuth()) != SLAPD_SSLCLIENTAUTH_OFF ) {
@@ -2059,17 +2062,17 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
/* richm 20020227
To do LDAP client SSL init, we need to do
- static void
- ldapssl_basic_init( void )
- {
- PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
+ static void
+ ldapssl_basic_init( void )
+ {
+ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
- PR_SetConcurrency( 4 );
- }
+ PR_SetConcurrency( 4 );
+ }
NSS_Init(certdbpath);
SSL_OptionSetDefault(SSL_ENABLE_SSL2, PR_FALSE);
- SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE);
- s = NSS_SetDomesticPolicy();
+ SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE);
+ s = NSS_SetDomesticPolicy();
We already do pr_init, we don't need pr_setconcurrency, we already do nss_init and the rest
*/
@@ -2095,7 +2098,7 @@ slapd_SSL_client_auth (LDAP* ld)
char **family;
char *personality = NULL;
char *activation = NULL;
- char *cipher = NULL;
+ char *cipher = NULL;
for (family = family_list; *family; family++) {
getConfigEntry( *family, &entry );
| 0 |
bdc315f76832f4d399ea11b69f857b568e3643fa
|
389ds/389-ds-base
|
Issue 4962 - Fix various UI bugs - Plugins (#4969)
Description:
Bug 1816526 - restart instance after plugin enabled/disabled should depend on 'nsslapd-dynamic-plugins' status
Bug 2011183 - Retro Changelog plugin - saving any configuration is stuck in loading
Bug 2011187 - Posix Winsync Plugin - configuration is not saved
Bug 2011188 - DNA plugin fails to be enabled
Bug 2011751 - Referential Integrity Plugin - unable to save changes
Bug 2011767 - RootDN Access Control Plugin - configuration stuck and a wrong message is displayed
Bug 2011814 - Account Policy Plugin - configuration failing with error
relates: #4962
Reviewed by: @mreynolds389 (Thanks!)
|
commit bdc315f76832f4d399ea11b69f857b568e3643fa
Author: Simon Pichugin <[email protected]>
Date: Fri Oct 29 18:11:34 2021 -0700
Issue 4962 - Fix various UI bugs - Plugins (#4969)
Description:
Bug 1816526 - restart instance after plugin enabled/disabled should depend on 'nsslapd-dynamic-plugins' status
Bug 2011183 - Retro Changelog plugin - saving any configuration is stuck in loading
Bug 2011187 - Posix Winsync Plugin - configuration is not saved
Bug 2011188 - DNA plugin fails to be enabled
Bug 2011751 - Referential Integrity Plugin - unable to save changes
Bug 2011767 - RootDN Access Control Plugin - configuration stuck and a wrong message is displayed
Bug 2011814 - Account Policy Plugin - configuration failing with error
relates: #4962
Reviewed by: @mreynolds389 (Thanks!)
diff --git a/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx b/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx
index 338f7d3e1..8133bd89c 100644
--- a/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx
@@ -250,6 +250,10 @@ class AccountPolicy extends React.Component {
});
})
.fail(_ => {
+ this.props.addNotification(
+ "warning",
+ `Warning! Account Policy config entry "${this.state.configArea}" doesn't exist!`
+ );
this.setState({
sharedConfigExists: false
});
@@ -983,6 +987,7 @@ class AccountPolicy extends React.Component {
key="manage"
variant="primary"
onClick={this.openModal}
+ isDisabled={saveBtnDisabled}
>
{this.state.sharedConfigExists ? "Manage Config" : "Create Config"}
</Button>
diff --git a/src/cockpit/389-console/src/lib/plugins/dna.jsx b/src/cockpit/389-console/src/lib/plugins/dna.jsx
index 3bf17f304..bcacfd6b8 100644
--- a/src/cockpit/389-console/src/lib/plugins/dna.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/dna.jsx
@@ -1495,6 +1495,7 @@ DNAPlugin.propTypes = {
savePluginHandler: PropTypes.func,
pluginListHandler: PropTypes.func,
addNotification: PropTypes.func,
+ toggleLoadingHandler: PropTypes.func
};
DNAPlugin.defaultProps = {
diff --git a/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx b/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx
index a0ba9a997..fb2fc3dcc 100644
--- a/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx
@@ -89,12 +89,46 @@ class PluginBasicConfig extends React.Component {
.done(content => {
console.info("savePlugin", "Result", content);
pluginListHandler();
- addNotification(
- "warning",
- `${pluginName} plugin was successfully ${new_status}d.
- Please, restart the instance.`
- );
- toggleLoadingHandler();
+ const successCheckCMD = [
+ "dsconf", "-j", "ldapi://%2fvar%2frun%2fslapd-" + serverId + ".socket",
+ "config", "get", "nsslapd-dynamic-plugins"
+ ];
+ log_cmd("handleSwitchChange", "Get Dynamic Plugins attribute", successCheckCMD);
+ cockpit
+ .spawn(successCheckCMD, { superuser: true, err: "message" })
+ .done(content => {
+ const config = JSON.parse(content);
+ let dynamicPluginEnabled;
+ if (config.attrs["nsslapd-dynamic-plugins"][0] === "on") {
+ dynamicPluginEnabled = true;
+ } else if (config.attrs["nsslapd-dynamic-plugins"][0] === "off") {
+ dynamicPluginEnabled = false;
+ } else {
+ console.error(
+ "handleSwitchChange failed",
+ "wrong nsslapd-dynamic-pluginc attribute value",
+ config.attrs["nsslapd-dynamic-plugins"][0]
+ );
+ }
+ addNotification(
+ `${!dynamicPluginEnabled ? 'warning' : 'success'}`,
+ `${pluginName} plugin was successfully ${new_status}d.
+ ${!dynamicPluginEnabled ? 'Please, restart the instance.' : ''}`
+ );
+ toggleLoadingHandler();
+ })
+ .fail(err => {
+ console.error(
+ "handleSwitchChange failed",
+ "Failed to get nsslapd-dynamic-pluginc attribute value"
+ );
+ addNotification(
+ "warning",
+ `${pluginName} plugin was successfully ${new_status}d.
+ Please, restart the instance.`
+ );
+ toggleLoadingHandler();
+ });
})
.fail(err => {
const errMsg = JSON.parse(err);
diff --git a/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx b/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx
index a68830003..4190255f8 100644
--- a/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx
@@ -332,7 +332,6 @@ class ReferentialIntegrity extends React.Component {
saveConfig() {
const {
- updateDelay,
membershipAttr,
entryScope,
excludeEntryScope,
@@ -340,6 +339,7 @@ class ReferentialIntegrity extends React.Component {
logFile,
referintConfigEntry,
} = this.state;
+ const updateDelay = this.state.updateDelay.toString();
let cmd = [
"dsconf",
diff --git a/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx b/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx
index 3dace322d..97b82b8d7 100644
--- a/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx
@@ -210,6 +210,9 @@ class RetroChangelog extends React.Component {
`Successfully updated the Retro Changelog`
);
this.props.pluginListHandler();
+ this.setState({
+ saving: false
+ });
})
.fail(err => {
const errMsg = JSON.parse(err);
@@ -218,6 +221,9 @@ class RetroChangelog extends React.Component {
`Failed to update Retro Changelog Plugin - ${errMsg.desc}`
);
this.props.pluginListHandler();
+ this.setState({
+ saving: false
+ });
});
}
diff --git a/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx b/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx
index 46daf8644..9410eb129 100644
--- a/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx
@@ -449,17 +449,23 @@ class RootDNAccessControl extends React.Component {
.done(content => {
this.props.addNotification(
"success",
- `Successfully updated the Retro Changelog`
+ `Successfully updated the RootDN Access Control`
);
this.props.pluginListHandler();
+ this.setState({
+ saving: false
+ });
})
.fail(err => {
const errMsg = JSON.parse(err);
this.props.addNotification(
"error",
- `Failed to update Retro Changelog Plugin - ${errMsg.desc}`
+ `Failed to update RootDN Access Control Plugin - ${errMsg.desc}`
);
this.props.pluginListHandler();
+ this.setState({
+ saving: false
+ });
});
}
diff --git a/src/cockpit/389-console/src/lib/plugins/winsync.jsx b/src/cockpit/389-console/src/lib/plugins/winsync.jsx
index bc29cebdd..d4f86e893 100644
--- a/src/cockpit/389-console/src/lib/plugins/winsync.jsx
+++ b/src/cockpit/389-console/src/lib/plugins/winsync.jsx
@@ -60,6 +60,7 @@ class WinSync extends React.Component {
this.toggleFixupModal = this.toggleFixupModal.bind(this);
this.validateConfig = this.validateConfig.bind(this);
this.validateModal = this.validateModal.bind(this);
+ this.savePlugin = this.savePlugin.bind(this);
}
toggleFixupModal() {
diff --git a/src/cockpit/389-console/src/plugins.jsx b/src/cockpit/389-console/src/plugins.jsx
index 4e0f17fc1..42761cba0 100644
--- a/src/cockpit/389-console/src/plugins.jsx
+++ b/src/cockpit/389-console/src/plugins.jsx
@@ -476,6 +476,7 @@ export class Plugins extends React.Component {
savePluginHandler={this.savePlugin}
pluginListHandler={this.pluginList}
addNotification={this.props.addNotification}
+ toggleLoadingHandler={this.toggleLoading}
wasActiveList={this.props.wasActiveList}
attributes={this.state.attributes}
key={this.props.wasActiveList}
| 0 |
0fb5cccfabffd94b3ebec2a0c24423741c0733e1
|
389ds/389-ds-base
|
Resolves: bug 483256
Bug Description: DS crash when modify entry that does not exist in AD
Reviewed by: nkinder (Thanks!)
Fix Description: The function that checks to see if the mod has already been made to the AD entry should just return 0 if the AD entry does not exist or could not be found - in this case, the regular windows replay code will handle it.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
|
commit 0fb5cccfabffd94b3ebec2a0c24423741c0733e1
Author: Rich Megginson <[email protected]>
Date: Wed Feb 4 20:40:34 2009 +0000
Resolves: bug 483256
Bug Description: DS crash when modify entry that does not exist in AD
Reviewed by: nkinder (Thanks!)
Fix Description: The function that checks to see if the mod has already been made to the AD entry should just return 0 if the AD entry does not exist or could not be found - in this case, the regular windows replay code will handle it.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 7e00e106b..8cd5bdfae 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -1817,6 +1817,14 @@ mod_already_made(Private_Repl_Protocol *prp, Slapi_Mod *smod)
return 1;
}
+ if (!ad_entry) { /* mods cannot already have been made */
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
+ "%s: mod_already_made: "
+ "AD entry not found\n",
+ agmt_get_long_name(prp->agmt));
+ return retval; /* just allow - will probably fail later if entry really doesn't exist */
+ }
+
op = slapi_mod_get_operation(smod);
type = slapi_mod_get_type(smod);
if (SLAPI_IS_MOD_ADD(op)) { /* make sure value is not there */
| 0 |
42fa04d672eb7998209cd731b80fdeb2a42e02cb
|
389ds/389-ds-base
|
Issue 5210 - Python undefined names in lib389
Bug Description:
There are several Python undefined names in lib389. Usually they are
plain errors caused by refactorings, typos, etc.
Fix Description:
- added missing imports
- fixed typos
Note: `lib389.tests.cli.conf_plugin_test` was not fixed yet. I'm not sure
whether it should be removed completely or only
plugin_{enable,disable,get_dn} parts.
Fixes: https://github.com/389ds/389-ds-base/issues/5210
Reviewed by: Mark Reynolds (thanks!)
Signed-off-by: Stanislav Levin <[email protected]>
|
commit 42fa04d672eb7998209cd731b80fdeb2a42e02cb
Author: Stanislav Levin <[email protected]>
Date: Tue Mar 15 17:46:57 2022 +0300
Issue 5210 - Python undefined names in lib389
Bug Description:
There are several Python undefined names in lib389. Usually they are
plain errors caused by refactorings, typos, etc.
Fix Description:
- added missing imports
- fixed typos
Note: `lib389.tests.cli.conf_plugin_test` was not fixed yet. I'm not sure
whether it should be removed completely or only
plugin_{enable,disable,get_dn} parts.
Fixes: https://github.com/389ds/389-ds-base/issues/5210
Reviewed by: Mark Reynolds (thanks!)
Signed-off-by: Stanislav Levin <[email protected]>
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 52638bfb6..b3c98a423 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -241,7 +241,9 @@ def _ds_shutil_copytree(src, dst, symlinks=False, ignore=None, copy_function=cop
# code with a custom `copy_function` may rely on copytree
# doing the right thing.
os.symlink(linkto, dstname)
- copystat(srcname, dstname, follow_symlinks=not symlinks)
+ shutil.copystat(
+ srcname, dstname, follow_symlinks=not symlinks
+ )
else:
# ignore dangling symlink if the flag is on
if not os.path.exists(linkto) and ignore_dangling_symlinks:
@@ -303,6 +305,7 @@ class DirSrv(SimpleLDAPObject, object):
@raise ldap.CONFIDENTIALITY_REQUIRED - missing TLS:
"""
+ uri = self.toLDAPURL()
if hasattr(ldap, 'PYLDAP_VERSION') and MAJOR >= 3:
super(DirSrv, self).__init__(uri, bytes_mode=False, trace_level=TRACE_LEVEL)
else:
@@ -922,7 +925,7 @@ class DirSrv(SimpleLDAPObject, object):
with suppress(Exception):
dse_ldif = DSEldif(None, self)
self._db_lib = dse_ldif.get(DN_CONFIG_LDBM, "nsslapd-backend-implement", single=True)
- return _self.db_lib
+ return self._db_lib
return get_default_db_lib()
def delete(self):
@@ -1471,7 +1474,7 @@ class DirSrv(SimpleLDAPObject, object):
for f in glob.glob("%s*" % self.accesslog):
self.log.debug("restoreFS: before restore remove file %s", f)
os.remove(f)
- log.debug("restoreFS: remove audit logs %s" % self.accesslog)
+ self.log.debug("restoreFS: remove audit logs %s" % self.auditlog)
for f in glob.glob("%s*" % self.auditlog):
self.log.debug("restoreFS: before restore remove file %s", f)
os.remove(f)
diff --git a/src/lib389/lib389/_entry.py b/src/lib389/lib389/_entry.py
index 54fae1237..36735d867 100644
--- a/src/lib389/lib389/_entry.py
+++ b/src/lib389/lib389/_entry.py
@@ -14,6 +14,7 @@ import binascii
from ldap.cidict import cidict
import sys
+from lib389.exceptions import MissingEntryError
from lib389._constants import *
from lib389.properties import *
from lib389.utils import (ensure_str, ensure_bytes, ensure_list_bytes, display_log_data)
diff --git a/src/lib389/lib389/cli_idm/role.py b/src/lib389/lib389/cli_idm/role.py
index dc316cac9..0ad8267a1 100644
--- a/src/lib389/lib389/cli_idm/role.py
+++ b/src/lib389/lib389/cli_idm/role.py
@@ -15,8 +15,9 @@ from lib389.idm.role import (
FilteredRoles,
NestedRoles,
MUST_ATTRIBUTES,
- MUST_ATTRIBUTES_NESTED
- )
+ MUST_ATTRIBUTES_NESTED,
+ RDN,
+)
from lib389.cli_base import (
populate_attr_arguments,
_get_arg,
diff --git a/src/lib389/lib389/idm/role.py b/src/lib389/lib389/idm/role.py
index 07214239d..410fc523d 100644
--- a/src/lib389/lib389/idm/role.py
+++ b/src/lib389/lib389/idm/role.py
@@ -21,6 +21,7 @@ MUST_ATTRIBUTES_NESTED = [
'cn',
'nsRoleDN'
]
+RDN = 'cn'
class RoleState(Enum):
ACTIVATED = "activated"
@@ -47,7 +48,7 @@ class Role(DSLdapObject):
def __init__(self, instance, dn=None):
super(Role, self).__init__(instance, dn)
- self._rdn_attribute = 'cn'
+ self._rdn_attribute = RDN
self._create_objectclasses = [
'top',
'LDAPsubentry',
@@ -256,7 +257,7 @@ class FilteredRole(Role):
def __init__(self, instance, dn=None):
super(FilteredRole, self).__init__(instance, dn)
- self._rdn_attribute = 'cn'
+ self._rdn_attribute = RDN
self._create_objectclasses = ['nsComplexRoleDefinition', 'nsFilteredRoleDefinition']
self._protected = False
@@ -291,7 +292,7 @@ class ManagedRole(Role):
def __init__(self, instance, dn=None):
super(ManagedRole, self).__init__(instance, dn)
- self._rdn_attribute = 'cn'
+ self._rdn_attribute = RDN
self._create_objectclasses = ['nsSimpleRoleDefinition', 'nsManagedRoleDefinition']
self._protected = False
@@ -327,7 +328,7 @@ class NestedRole(Role):
def __init__(self, instance, dn=None):
super(NestedRole, self).__init__(instance, dn)
self._must_attributes = MUST_ATTRIBUTES_NESTED
- self._rdn_attribute = 'cn'
+ self._rdn_attribute = RDN
self._create_objectclasses = ['nsComplexRoleDefinition', 'nsNestedRoleDefinition']
self._protected = False
diff --git a/src/lib389/lib389/mit_krb5.py b/src/lib389/lib389/mit_krb5.py
index a9e7fca81..971c68305 100644
--- a/src/lib389/lib389/mit_krb5.py
+++ b/src/lib389/lib389/mit_krb5.py
@@ -92,7 +92,7 @@ class MitKrb5(object):
# Raise a scary warning about eating your krb settings
if self.warnings:
print("This will alter / erase your krb5 and kdc settings.")
- raw_input("Ctrl-C to exit, or press ENTER to continue.")
+ input("Ctrl-C to exit, or press ENTER to continue.")
print("Kerberos primary password: %s" % self.krb_primary_password)
# If we don't have the directories for this, create them.
@@ -169,7 +169,7 @@ class MitKrb5(object):
assert(self.check_realm())
if self.warnings:
print("This will ERASE your kdc settings.")
- raw_input("Ctrl-C to exit, or press ENTER to continue.")
+ input("Ctrl-C to exit, or press ENTER to continue.")
# If the pid exissts, try to kill it.
if os.path.isfile(self.kdcpid):
with open(self.kdcpid, 'r') as pfile:
diff --git a/src/lib389/lib389/paths.py b/src/lib389/lib389/paths.py
index fce08abaa..a1a0bf144 100644
--- a/src/lib389/lib389/paths.py
+++ b/src/lib389/lib389/paths.py
@@ -204,7 +204,7 @@ class Paths(object):
raise KeyError('Invalid defaults.inf, missing key %s' % k)
return True
- def _pretty_exception(err, msg):
+ def _pretty_exception(self, err, msg):
# Remap LDAPError exceptions to get a nicer stack than python-ldap one
# Lets grab the data from the exception (a bit painfull but I did not find any better way)
result = None
@@ -250,7 +250,7 @@ class Paths(object):
# Search in config.
break
if err is not None:
- raise _pretty_exception(err, f"while searching attribute {attr} in entry {dn} on server {self.serverid}")
+ raise self._pretty_exception(err, f"while searching attribute {attr} in entry {dn} on server {self.serverid}")
# If the server doesn't have it, fall back to our configuration.
if attr is not None:
v = ensure_str(ent.getValue(attr))
diff --git a/src/lib389/lib389/replica.py b/src/lib389/lib389/replica.py
index 4b7be8a76..923415d4e 100644
--- a/src/lib389/lib389/replica.py
+++ b/src/lib389/lib389/replica.py
@@ -36,7 +36,7 @@ from lib389.idm.services import ServiceAccounts
from lib389.idm.organizationalunit import OrganizationalUnits
from lib389.conflicts import ConflictEntries
from lib389.lint import (DSREPLLE0001, DSREPLLE0002, DSREPLLE0003, DSREPLLE0004,
- DSREPLLE0005)
+ DSREPLLE0005, DSCLLE0001)
class ReplicaLegacy(object):
@@ -1588,8 +1588,7 @@ class Replica(DSLdapObject):
# it should have all the logic for figuring out the credentials
credentials = get_credentials(host, port)
if not credentials["binddn"]:
- report_data[supplier] = {"status": "Unavailable",
- "reason": "Bind DN was not specified"}
+ self._log.debug("Bind DN was not specified")
continue
# Open a connection to the consumer
@@ -1810,8 +1809,8 @@ class Replicas(DSLdapObjects):
def restore_changelog(self, replica_root, log=None):
"""Restore Directory Server replication changelog from '.ldif' or '.ldif.done' file
- :param replica_roots: Replica suffixes that need to be processed (and optional LDIF file path)
- :type replica_roots: list of str
+ :param replica_root: Replica suffixes that need to be processed (and optional LDIF file path)
+ :type replica_root: list of str
:param log: The logger object
:type log: logger
"""
@@ -1820,7 +1819,7 @@ class Replicas(DSLdapObjects):
try:
replica = self.get(replica_root)
except:
- raise ValueError(f'The specified root "{repl_root}" is not enbaled for replication')
+ raise ValueError(f'The specified root "{replica_root}" is not enbaled for replication')
replica_name = replica.get_attr_val_utf8_l("nsDS5ReplicaName")
ldif_dir = self._instance.get_ldif_dir()
@@ -1833,8 +1832,8 @@ class Replicas(DSLdapObjects):
if not replica.task_finished():
raise ValueError("The changelog import task (LDIF2CL) did not complete in time")
elif changelog_ldif_done:
- ldif_done_file = os.path.join(cl_dir, changelog_ldif_done[0])
- ldif_file = os.path.join(cl_dir, f"{replica_name}_cl.ldif")
+ ldif_done_file = os.path.join(ldif_dir, changelog_ldif_done[0])
+ ldif_file = os.path.join(ldif_dir, f"{replica_name}_cl.ldif")
ldif_file_exists = os.path.exists(ldif_file)
if ldif_file_exists:
copy_with_permissions(ldif_file, f'{ldif_file}.backup')
@@ -1846,7 +1845,7 @@ class Replicas(DSLdapObjects):
if ldif_file_exists:
os.rename(f'{ldif_file}.backup', ldif_file)
else:
- log.error(f"Changelog LDIF for '{repl_root}' was not found")
+ log.error(f"Changelog LDIF for '{replica_root}' was not found")
class BootstrapReplicationManager(DSLdapObject):
diff --git a/src/lib389/lib389/schema.py b/src/lib389/lib389/schema.py
index c150f0adf..b3aa67f87 100755
--- a/src/lib389/lib389/schema.py
+++ b/src/lib389/lib389/schema.py
@@ -710,7 +710,7 @@ class SchemaLegacy(object):
if len(matchingRule) != 1:
# This is an error.
if json:
- raise ValueError('Could not find matchingrule: ' + objectclassname)
+ raise ValueError('Could not find matchingrule: ' + mr_name)
else:
return None
matchingRule = matchingRule[0]
diff --git a/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py b/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py
index bffb34c1f..249709cab 100644
--- a/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py
+++ b/src/lib389/lib389/tests/cli/conf_plugins/automember_test.py
@@ -33,7 +33,6 @@ def test_namenotexists_listdefinition(topology):
with pytest.raises(ldap.NO_SUCH_OBJECT):
automember_cli.list_definition(topology.standalone, None, topology.logcap.log, args)
- log.info("Definition for instance {} does not exist".format(args.name))
def test_createdefinition(topology):
@@ -69,7 +68,6 @@ def test_invalidattributes_createdefinition(topology):
with pytest.raises(ldap.INVALID_SYNTAX):
automember_cli.create_definition(topology.standalone, None, topology.logcap.log, args)
- log.info("There are invalid attributes in the definition.")
def test_ifnameexists_createdefinition(topology):
@@ -88,7 +86,6 @@ def test_ifnameexists_createdefinition(topology):
with pytest.raises(ldap.ALREADY_EXISTS):
automember_cli.create_definition(topology.standalone, None, topology.logcap.log, args)
- log.info("Definition for instance {} already exists.".format(args.name))
def test_editdefinition(topology):
@@ -119,4 +116,3 @@ def test_nonexistentinstance_removedefinition(topology):
with pytest.raises(ldap.NO_SUCH_OBJECT):
automember_cli.remove_definition(topology.standalone, None, topology.logcap.log, args)
- log.info("Definition for instance {} does not exist.".format(args.name))
diff --git a/src/lib389/lib389/tools.py b/src/lib389/lib389/tools.py
index 2d3e3180e..c5bab5815 100644
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -19,6 +19,7 @@ import time
import shutil
import subprocess
import tarfile
+import urllib
import re
import glob
import pwd
@@ -487,7 +488,7 @@ class DirSrvTools(object):
"""run the remove instance command"""
prog = os.path.join(_ds_paths.sbin_dir, 'dsctl')
try:
- cmd = "%s slapd-%s remove --do-it" % (prog, self.serverid)
+ cmd = "%s slapd-%s remove --do-it" % (prog, dirsrv.serverid)
log.info('Running: {}'.format(" ".join(cmd)))
subprocess.check_call(cmd)
except subprocess.CalledProcessError as e:
@@ -508,7 +509,8 @@ class DirSrvTools(object):
instance.prefix
instance.backup
'''
- instance = lib389.DirSrv(verbose=True)
+ from lib389 import DirSrv
+ instance = DirSrv(verbose=True)
instance.allocate(args)
return instance
| 0 |
04a5f7c71485c1efbc047856e4cac5fe571cf48a
|
389ds/389-ds-base
|
Resolves: bug 479077
Bug Description: Server to Server SASL/DIGEST-MD5 not Supported over SSL/TLS
Reviewed by: nkinder (Thanks!)
Fix Description: If using TLS/SSL, we don't need to use a sasl security layer, so just set the maxssf to 0.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
|
commit 04a5f7c71485c1efbc047856e4cac5fe571cf48a
Author: Rich Megginson <[email protected]>
Date: Wed Jan 7 02:33:37 2009 +0000
Resolves: bug 479077
Bug Description: Server to Server SASL/DIGEST-MD5 not Supported over SSL/TLS
Reviewed by: nkinder (Thanks!)
Fix Description: If using TLS/SSL, we don't need to use a sasl security layer, so just set the maxssf to 0.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 151969663..d53f1e74d 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1257,6 +1257,10 @@ slapi_ldap_bind(
}
}
} else {
+ /* a SASL mech - set the sasl ssf to 0 if using TLS/SSL */
+ if (secure) {
+ ldap_set_option(ld, LDAP_OPT_X_SASL_SECPROPS, "maxssf=0");
+ }
rc = slapd_ldap_sasl_interactive_bind(ld, bindid, creds, mech,
serverctrls, returnedctrls,
msgidp);
| 0 |
582f02945e02950610c260b99821f7131581815d
|
389ds/389-ds-base
|
Issue 5781 - Bug handling return code of pre-extended operation plugin.
Issue 5781 - Bug handling return code of pre-extended operation plugin.
Bug Description: The return code of the plugin with the type "pre-extended operation" is not used when processing extended operation.Regardless of the plugin's return code, the operation continues to be processed.
Fix Description: Add additional condition in if statement
relates: https://github.com/389ds/389-ds-base/issues/5781
Author: osenchenko
Reviewed by: Mark Reynolds (thanks)
|
commit 582f02945e02950610c260b99821f7131581815d
Author: osenchenko <[email protected]>
Date: Sat May 27 13:40:19 2023 +0300
Issue 5781 - Bug handling return code of pre-extended operation plugin.
Issue 5781 - Bug handling return code of pre-extended operation plugin.
Bug Description: The return code of the plugin with the type "pre-extended operation" is not used when processing extended operation.Regardless of the plugin's return code, the operation continues to be processed.
Fix Description: Add additional condition in if statement
relates: https://github.com/389ds/389-ds-base/issues/5781
Author: osenchenko
Reviewed by: Mark Reynolds (thanks)
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index aadddc658..ebef8e10c 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -2002,6 +2002,7 @@ plugin_call_func(struct slapdplugin *list, int operation, Slapi_PBlock *pb, int
slapi_plugin_op_finished(list);
if (SLAPI_PLUGIN_PREOPERATION == list->plg_type ||
SLAPI_PLUGIN_INTERNAL_PREOPERATION == list->plg_type ||
+ SLAPI_PLUGIN_PREEXTOPERATION == list->plg_type ||
SLAPI_PLUGIN_START_FN == operation) {
/*
* We bail out of plugin processing for preop plugins
| 0 |
947477f2e2367337a8c220d8c9d03a62bf1bbf1c
|
389ds/389-ds-base
|
Ticket #48146 - async simple paged results issue
Description: When the last page of the single paged results is returned,
the search results structure is freed in the simple paged results code
(in op_shared_search). The search results structure is stashed in the
simple paged results object across the pages. The free and the clean up
of the stashed address should have been atomic, but it was not.
https://fedorahosted.org/389/ticket/48146
Reviewed by [email protected] (Thank you, Mark!!)
|
commit 947477f2e2367337a8c220d8c9d03a62bf1bbf1c
Author: Noriko Hosoi <[email protected]>
Date: Sun Apr 26 14:46:44 2015 -0700
Ticket #48146 - async simple paged results issue
Description: When the last page of the single paged results is returned,
the search results structure is freed in the simple paged results code
(in op_shared_search). The search results structure is stashed in the
simple paged results object across the pages. The free and the clean up
of the stashed address should have been atomic, but it was not.
https://fedorahosted.org/389/ticket/48146
Reviewed by [email protected] (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 84a2bb431..272e55068 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -881,7 +881,10 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
if (sr) { /* in case a left over sr is found, clean it up */
+ PR_Lock(pb->pb_conn->c_mutex);
+ pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
be->be_search_results_release(&sr);
+ PR_Unlock(pb->pb_conn->c_mutex);
}
if (NULL == next_be) {
/* no more entries && no more backends */
@@ -897,17 +900,10 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);
pagedresults_lock(pb->pb_conn, pr_idx);
if ((pagedresults_set_current_be(pb->pb_conn, be, pr_idx) < 0) ||
- (pagedresults_set_search_result(pb->pb_conn, operation,
- sr, 0, pr_idx) < 0) ||
- (pagedresults_set_search_result_count(pb->pb_conn, operation,
- curr_search_count,
- pr_idx) < 0) ||
- (pagedresults_set_search_result_set_size_estimate(pb->pb_conn,
- operation,
- estimate,
- pr_idx) < 0) ||
- (pagedresults_set_with_sort(pb->pb_conn, operation,
- with_sort, pr_idx) < 0)) {
+ (pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx) < 0) ||
+ (pagedresults_set_search_result_count(pb->pb_conn, operation, curr_search_count, pr_idx) < 0) ||
+ (pagedresults_set_search_result_set_size_estimate(pb->pb_conn, operation, estimate, pr_idx) < 0) ||
+ (pagedresults_set_with_sort(pb->pb_conn, operation, with_sort, pr_idx) < 0)) {
pagedresults_unlock(pb->pb_conn, pr_idx);
goto free_and_return;
}
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index d58970864..e61c0008e 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -100,26 +100,20 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
ber_free(ber, 1);
if ( cookie.bv_len <= 0 ) {
int i;
- int maxlen;
/* first time? */
- maxlen = conn->c_pagedresults.prl_maxlen;
+ int maxlen = conn->c_pagedresults.prl_maxlen;
if (conn->c_pagedresults.prl_count == maxlen) {
if (0 == maxlen) { /* first time */
conn->c_pagedresults.prl_maxlen = 1;
- conn->c_pagedresults.prl_list =
- (PagedResults *)slapi_ch_calloc(1,
- sizeof(PagedResults));
+ conn->c_pagedresults.prl_list = (PagedResults *)slapi_ch_calloc(1, sizeof(PagedResults));
} else {
/* new max length */
conn->c_pagedresults.prl_maxlen *= 2;
- conn->c_pagedresults.prl_list =
- (PagedResults *)slapi_ch_realloc(
+ conn->c_pagedresults.prl_list = (PagedResults *)slapi_ch_realloc(
(char *)conn->c_pagedresults.prl_list,
- sizeof(PagedResults) *
- conn->c_pagedresults.prl_maxlen);
+ sizeof(PagedResults) * conn->c_pagedresults.prl_maxlen);
/* initialze newly allocated area */
- memset(conn->c_pagedresults.prl_list + maxlen, '\0',
- sizeof(PagedResults) * maxlen);
+ memset(conn->c_pagedresults.prl_list + maxlen, '\0', sizeof(PagedResults) * maxlen);
}
*index = maxlen; /* the first position in the new area */
} else {
@@ -276,8 +270,8 @@ pagedresults_free_one( Connection *conn, Operation *op, int index )
prp->pr_current_be->be_search_results_release &&
prp->pr_search_result_set) {
prp->pr_current_be->be_search_results_release(&(prp->pr_search_result_set));
- prp->pr_current_be = NULL;
}
+ prp->pr_current_be = NULL;
if (prp->pr_mutex) {
/* pr_mutex is reused; back it up and reset it. */
prmutex = prp->pr_mutex;
@@ -314,8 +308,8 @@ pagedresults_free_one_msgid_nolock( Connection *conn, ber_int_t msgid )
prp->pr_current_be->be_search_results_release &&
prp->pr_search_result_set) {
prp->pr_current_be->be_search_results_release(&(prp->pr_search_result_set));
- prp->pr_current_be = NULL;
}
+ prp->pr_current_be = NULL;
prp->pr_flags |= CONN_FLAG_PAGEDRESULTS_ABANDONED;
prp->pr_flags &= ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
conn->c_pagedresults.prl_count--;
@@ -404,16 +398,8 @@ pagedresults_set_search_result(Connection *conn, Operation *op, void *sr,
if (conn && (index > -1)) {
if (!locked) PR_Lock(conn->c_mutex);
if (index < conn->c_pagedresults.prl_maxlen) {
- if (sr) { /* set */
- if (NULL ==
- conn->c_pagedresults.prl_list[index].pr_search_result_set) {
- conn->c_pagedresults.prl_list[index].pr_search_result_set = sr;
- rc = 0;
- }
- } else { /* reset */
- conn->c_pagedresults.prl_list[index].pr_search_result_set = sr;
- rc = 0;
- }
+ conn->c_pagedresults.prl_list[index].pr_search_result_set = sr;
+ rc = 0;
}
if (!locked) PR_Unlock(conn->c_mutex);
}
@@ -732,9 +718,9 @@ pagedresults_cleanup(Connection *conn, int needlock)
if (prp->pr_current_be && prp->pr_search_result_set &&
prp->pr_current_be->be_search_results_release) {
prp->pr_current_be->be_search_results_release(&(prp->pr_search_result_set));
- prp->pr_current_be = NULL;
rc = 1;
}
+ prp->pr_current_be = NULL;
if (prp->pr_mutex) {
PR_DestroyLock(prp->pr_mutex);
}
@@ -780,9 +766,9 @@ pagedresults_cleanup_all(Connection *conn, int needlock)
if (prp->pr_current_be && prp->pr_search_result_set &&
prp->pr_current_be->be_search_results_release) {
prp->pr_current_be->be_search_results_release(&(prp->pr_search_result_set));
- prp->pr_current_be = NULL;
rc = 1;
}
+ prp->pr_current_be = NULL;
}
slapi_ch_free((void **)&conn->c_pagedresults.prl_list);
conn->c_pagedresults.prl_maxlen = 0;
| 0 |
94f30daf7c9b48a68a4690d4badd1cae336ec5e8
|
389ds/389-ds-base
|
Bump version to 1.4.0.15
|
commit 94f30daf7c9b48a68a4690d4badd1cae336ec5e8
Author: Mark Reynolds <[email protected]>
Date: Thu Aug 16 13:01:46 2018 -0400
Bump version to 1.4.0.15
diff --git a/VERSION.sh b/VERSION.sh
index 9d0332ae9..bdc47fb39 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.14
+VERSION_MAINT=0.15
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
VERSION_DATE=$(date -u +%Y%m%d)
| 0 |
6ada149c42dbcce727662927129ae55832def5a0
|
389ds/389-ds-base
|
Bug 681015 - RFE: allow fine grained password policy duration attributes in days, hours, minutes, as well
https://bugzilla.redhat.com/show_bug.cgi?id=681015
Description: passwordLockoutDuration attribute is not working
with the fine grain password policy. The code to parse the
value of passwordlockoutduration was missing. This patch
adds it.
|
commit 6ada149c42dbcce727662927129ae55832def5a0
Author: Noriko Hosoi <[email protected]>
Date: Mon Mar 21 16:44:16 2011 -0700
Bug 681015 - RFE: allow fine grained password policy duration attributes in days, hours, minutes, as well
https://bugzilla.redhat.com/show_bug.cgi?id=681015
Description: passwordLockoutDuration attribute is not working
with the fine grain password policy. The code to parse the
value of passwordlockoutduration was missing. This patch
adds it.
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 2992623d9..7c6210b1b 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -1673,7 +1673,7 @@ new_passwdPolicy(Slapi_PBlock *pb, char *dn)
else
if (!strcasecmp(attr_name, "passwordlockoutduration")) {
if ((sval = attr_get_present_values(attr))) {
- pwdpolicy->pw_lockduration = slapi_value_get_long(*sval);
+ pwdpolicy->pw_lockduration = slapi_value_get_timelong(*sval);
}
}
else
| 0 |
354d98df7551011d238f8a6e5e441c4c46c0de59
|
389ds/389-ds-base
|
Issue 4719 - CI - Add dsconf add a PTA URL test
Description: This test checks that you are able to add a PTA URL through dsconf. Test tries to add new PTA URL and then check logs for message: "Successfully added URL".
Relates: https://github.com/389ds/389-ds-base/issues/4719
Reviewed by: @mreynolds389 @droideck (Thanks!)
|
commit 354d98df7551011d238f8a6e5e441c4c46c0de59
Author: Vladimir Cech <[email protected]>
Date: Wed Jun 28 11:24:53 2023 +0200
Issue 4719 - CI - Add dsconf add a PTA URL test
Description: This test checks that you are able to add a PTA URL through dsconf. Test tries to add new PTA URL and then check logs for message: "Successfully added URL".
Relates: https://github.com/389ds/389-ds-base/issues/4719
Reviewed by: @mreynolds389 @droideck (Thanks!)
diff --git a/dirsrvtests/tests/suites/clu/dsconf_pta_add_url_test.py b/dirsrvtests/tests/suites/clu/dsconf_pta_add_url_test.py
new file mode 100644
index 000000000..e79b42c31
--- /dev/null
+++ b/dirsrvtests/tests/suites/clu/dsconf_pta_add_url_test.py
@@ -0,0 +1,49 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2023 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
+import pytest
+import os
+import logging
+
+from lib389.topologies import topology_st
+from lib389.cli_conf.plugins.ldappassthrough import pta_add
+from lib389._constants import DEFAULT_SUFFIX
+from lib389.cli_base import FakeArgs
+from . import check_value_in_log_and_reset
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+new_url = "ldap://localhost:7389/o=redhat"
+
+
+def test_dsconf_add_pta_url(topology_st):
+ """ Test dsconf add a PTA URL
+
+ :id: 38c7331c-b828-4671-a39f-4f57d1742178
+ :setup: Standalone instance
+ :steps:
+ 1. Try to add new PTA URL
+ 2. Check if new PTA URL is added.
+ :expectedresults:
+ 1. Success
+ 2. Success
+ """
+
+ args = FakeArgs()
+ args.URL = new_url
+
+ log.info("Add new URL.")
+ pta_add(topology_st.standalone, DEFAULT_SUFFIX, topology_st.logcap.log, args)
+ check_value_in_log_and_reset(topology_st, check_value="Successfully added URL")
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main(["-s", CURRENT_FILE])
diff --git a/src/lib389/lib389/cli_conf/plugins/ldappassthrough.py b/src/lib389/lib389/cli_conf/plugins/ldappassthrough.py
index 584297ed4..f787d8436 100644
--- a/src/lib389/lib389/cli_conf/plugins/ldappassthrough.py
+++ b/src/lib389/lib389/cli_conf/plugins/ldappassthrough.py
@@ -88,6 +88,7 @@ def pta_add(inst, basedn, log, args):
if new_url_l in urls:
raise ldap.ALREADY_EXISTS("Entry %s already exists" % args.URL)
plugin.add("nsslapd-pluginarg%s" % next_num, args.URL)
+ log.info("Successfully added URL")
def pta_edit(inst, basedn, log, args):
| 0 |
56cd3389da608a3f6eeee58d20dffbcd286a8033
|
389ds/389-ds-base
|
Issue 6374 - nsslapd-mdb-max-dbs autotuning doesn't work properly (#6400)
* Issue 6374 - nsslapd-mdb-max-dbs autotuning doesn't work properly
Several issues:
After restarting the server nsslapd-mdb-max-dbs may not be high enough to add a new backend
because the value computation is wrong.
dbscan fails to open the database if nsslapd-mdb-max-dbs has been increased.
dbscan crashes when closing the database (typically when using -S)
When starting the instance the nsslapd-mdb-max-dbs parameter is increased to ensure that a new backend may be added.
When dse.ldif path is not specified, the db environment is now open using the INFO.mdb data instead of using the default values.
synchronization between thread closure and database context destruction is hardened
Issue: #6374
Reviewed by: @tbordaz , @vashirov (Thanks!)
|
commit 56cd3389da608a3f6eeee58d20dffbcd286a8033
Author: progier389 <[email protected]>
Date: Wed Nov 13 15:31:35 2024 +0100
Issue 6374 - nsslapd-mdb-max-dbs autotuning doesn't work properly (#6400)
* Issue 6374 - nsslapd-mdb-max-dbs autotuning doesn't work properly
Several issues:
After restarting the server nsslapd-mdb-max-dbs may not be high enough to add a new backend
because the value computation is wrong.
dbscan fails to open the database if nsslapd-mdb-max-dbs has been increased.
dbscan crashes when closing the database (typically when using -S)
When starting the instance the nsslapd-mdb-max-dbs parameter is increased to ensure that a new backend may be added.
When dse.ldif path is not specified, the db environment is now open using the INFO.mdb data instead of using the default values.
synchronization between thread closure and database context destruction is hardened
Issue: #6374
Reviewed by: @tbordaz , @vashirov (Thanks!)
diff --git a/dirsrvtests/tests/suites/config/config_test.py b/dirsrvtests/tests/suites/config/config_test.py
index c3e26eed4..08544594f 100644
--- a/dirsrvtests/tests/suites/config/config_test.py
+++ b/dirsrvtests/tests/suites/config/config_test.py
@@ -17,6 +17,7 @@ from lib389.topologies import topology_m2, topology_st as topo
from lib389.utils import *
from lib389._constants import DN_CONFIG, DEFAULT_SUFFIX, DEFAULT_BENAME
from lib389._mapped_object import DSLdapObjects
+from lib389.agreement import Agreements
from lib389.cli_base import FakeArgs
from lib389.cli_conf.backend import db_config_set
from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
@@ -27,6 +28,8 @@ from lib389.cos import CosPointerDefinitions, CosTemplates
from lib389.backend import Backends, DatabaseConfig
from lib389.monitor import MonitorLDBM, Monitor
from lib389.plugins import ReferentialIntegrityPlugin
+from lib389.replica import BootstrapReplicationManager, Replicas
+from lib389.passwd import password_generate
pytestmark = pytest.mark.tier0
@@ -36,6 +39,8 @@ PSTACK_CMD = '/usr/bin/pstack'
logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)
+DEBUGGING = os.getenv("DEBUGGING", default=False)
+
@pytest.fixture(scope="module")
def big_file():
TEMP_BIG_FILE = ''
@@ -813,6 +818,87 @@ def test_numlisteners_limit(topo):
assert numlisteners[0] == '4'
+def bootstrap_replication(inst_from, inst_to, creds):
+ manager = BootstrapReplicationManager(inst_to)
+ rdn_val = 'replication manager'
+ if manager.exists():
+ manager.delete()
+ manager.create(properties={
+ 'cn': rdn_val,
+ 'uid': rdn_val,
+ 'userPassword': creds
+ })
+ for replica in Replicas(inst_to).list():
+ replica.remove_all('nsDS5ReplicaBindDNGroup')
+ replica.replace('nsDS5ReplicaBindDN', manager.dn)
+ for agmt in Agreements(inst_from).list():
+ agmt.replace('nsDS5ReplicaBindDN', manager.dn)
+ agmt.replace('nsDS5ReplicaCredentials', creds)
+
+
[email protected](get_default_db_lib() != "mdb", reason="This test requires lmdb")
+def test_lmdb_autotuned_maxdbs(topology_m2, request):
+ """Verify that after restart, nsslapd-mdb-max-dbs is large enough to add a new backend.
+
+ :id: 0272d432-9080-11ef-8f40-482ae39447e5
+ :setup: Two suppliers configuration
+ :steps:
+ 1. loop 20 times
+ 3. In 1 loop: restart instance
+ 3. In 1 loop: add a new backend
+ 4. In 1 loop: check that instance is still alive
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ """
+
+ s1 = topology_m2.ms["supplier1"]
+ s2 = topology_m2.ms["supplier2"]
+
+ backends = Backends(s1)
+ db_config = DatabaseConfig(s1)
+ # Generate the teardown finalizer
+ belist = []
+ creds=password_generate()
+ bootstrap_replication(s2, s1, creds)
+ bootstrap_replication(s1, s2, creds)
+
+ def fin():
+ s1.start()
+ for be in belist:
+ be.delete()
+
+ if not DEBUGGING:
+ request.addfinalizer(fin)
+
+ # 1. Set autotuning (off-line to be able to decrease the value)
+ s1.stop()
+ dse_ldif = DSEldif(s1)
+ dse_ldif.replace(db_config.dn, 'nsslapd-mdb-max-dbs', '0')
+ os.remove(f'{s1.dbdir}/data.mdb')
+ s1.start()
+
+ # 2. Reinitialize the db:
+ log.info("Bulk import...")
+ agmt = Agreements(s2).list()[0]
+ agmt.begin_reinit()
+ (done, error) = agmt.wait_reinit()
+ log.info(f'Bulk importresult is ({done}, {error})')
+ assert done is True
+ assert error is False
+
+ # 3. loop 20 times
+ for idx in range(20):
+ s1.restart()
+ log.info(f'Adding backend test{idx}')
+ belist.append(backends.create(properties={'cn': f'test{idx}',
+ 'nsslapd-suffix': f'dc=test{idx}'}))
+ assert s1.status()
+
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 8fea63e35..35d0ece04 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -896,4 +896,6 @@ typedef struct _back_search_result_set
((L)->size == (R)->size && !memcmp((L)->data, (R)->data, (L)->size))
typedef int backend_implement_init_fn(struct ldbminfo *li, config_info *config_array);
+
+pthread_mutex_t *get_import_ctx_mutex();
#endif /* _back_ldbm_h_ */
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_config.c b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_config.c
index b3cd5ee86..447f3c70a 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_config.c
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_config.c
@@ -83,7 +83,7 @@ dbmdb_compute_limits(struct ldbminfo *li)
uint64_t total_space = 0;
uint64_t avail_space = 0;
uint64_t cur_dbsize = 0;
- int nbchangelogs = 0;
+ int nbvlvs = 0;
int nbsuffixes = 0;
int nbindexes = 0;
int nbagmt = 0;
@@ -99,8 +99,8 @@ dbmdb_compute_limits(struct ldbminfo *li)
* But some tunable may be autotuned.
*/
if (dbmdb_count_config_entries("(objectClass=nsMappingTree)", &nbsuffixes) ||
- dbmdb_count_config_entries("(objectClass=nsIndex)", &nbsuffixes) ||
- dbmdb_count_config_entries("(&(objectClass=nsds5Replica)(nsDS5Flags=1))", &nbchangelogs) ||
+ dbmdb_count_config_entries("(objectClass=nsIndex)", &nbindexes) ||
+ dbmdb_count_config_entries("(objectClass=vlvIndex)", &nbvlvs) ||
dbmdb_count_config_entries("(objectClass=nsds5replicationagreement)", &nbagmt)) {
/* error message is already logged */
return 1;
@@ -120,8 +120,15 @@ dbmdb_compute_limits(struct ldbminfo *li)
info->pagesize = sysconf(_SC_PAGE_SIZE);
limits->min_readers = config_get_threadnumber() + nbagmt + DBMDB_READERS_MARGIN;
- /* Default indexes are counted in "nbindexes" so we should always have enough resource to add 1 new suffix */
- limits->min_dbs = nbsuffixes + nbindexes + nbchangelogs + DBMDB_DBS_MARGIN;
+ /*
+ * For each suffix there are 4 databases instances:
+ * long-entryrdn, replication_changelog, id2entry and ancestorid
+ * then the indexes and the vlv and vlv cache
+ *
+ * Default indexes are counted in "nbindexes" so we should always have enough
+ * resource to add 1 new suffix
+ */
+ limits->min_dbs = 4*nbsuffixes + nbindexes + 2*nbvlvs + DBMDB_DBS_MARGIN;
total_space = ((uint64_t)(buf.f_blocks)) * ((uint64_t)(buf.f_bsize));
avail_space = ((uint64_t)(buf.f_bavail)) * ((uint64_t)(buf.f_bsize));
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_import_threads.c b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_import_threads.c
index 9504c2434..2d2a4f711 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_import_threads.c
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_import_threads.c
@@ -4280,9 +4280,12 @@ dbmdb_import_init_writer(ImportJob *job, ImportRole_t role)
void
dbmdb_free_import_ctx(ImportJob *job)
{
- if (job->writer_ctx) {
- ImportCtx_t *ctx = job->writer_ctx;
- job->writer_ctx = NULL;
+ ImportCtx_t *ctx = NULL;
+ pthread_mutex_lock(get_import_ctx_mutex());
+ ctx = job->writer_ctx;
+ job->writer_ctx = NULL;
+ pthread_mutex_unlock(get_import_ctx_mutex());
+ if (ctx) {
pthread_mutex_destroy(&ctx->workerq.mutex);
pthread_cond_destroy(&ctx->workerq.cv);
slapi_ch_free((void**)&ctx->workerq.slots);
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
index 50db548d9..83787931b 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
@@ -287,6 +287,13 @@ int add_dbi(dbi_open_ctx_t *octx, backend *be, const char *fname, int flags)
slapi_ch_free((void**)&treekey.dbname);
return octx->rc;
}
+ if (treekey.dbi >= ctx->dsecfg.max_dbs) {
+ octx->rc = MDB_DBS_FULL;
+ slapi_log_err(SLAPI_LOG_ERR, "add_dbi", "Failed to open database instance %s slots: %d/%d. Error is %d: %s.\n",
+ treekey.dbname, treekey.dbi, ctx->dsecfg.max_dbs, octx->rc, mdb_strerror(octx->rc));
+ slapi_ch_free((void**)&treekey.dbname);
+ return octx->rc;
+ }
if (octx->ai && octx->ai->ai_key_cmp_fn) {
octx->rc = dbmdb_update_dbi_cmp_fn(ctx, &treekey, octx->ai->ai_key_cmp_fn, octx->txn);
if (octx->rc) {
@@ -694,6 +701,7 @@ int dbmdb_make_env(dbmdb_ctx_t *ctx, int readOnly, mdb_mode_t mode)
rc = dbmdb_write_infofile(ctx);
} else {
/* No Config ==> read it from info file */
+ ctx->dsecfg = ctx->startcfg;
}
if (rc) {
return rc;
diff --git a/ldap/servers/slapd/back-ldbm/dbimpl.c b/ldap/servers/slapd/back-ldbm/dbimpl.c
index 86df986bd..f3bf68a9f 100644
--- a/ldap/servers/slapd/back-ldbm/dbimpl.c
+++ b/ldap/servers/slapd/back-ldbm/dbimpl.c
@@ -505,7 +505,7 @@ int dblayer_show_statistics(const char *dbimpl_name, const char *dbhome, FILE *f
li->li_plugin = be->be_database;
li->li_plugin->plg_name = (char*) "back-ldbm-dbimpl";
li->li_plugin->plg_libpath = (char*) "libback-ldbm";
- li->li_directory = (char*)dbhome;
+ li->li_directory = get_li_directory(dbhome);
/* Initialize database plugin */
rc = dbimpl_setup(li, dbimpl_name);
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 2bb8cb581..30ec462fa 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -27,6 +27,9 @@
#define NEED_DN_NORM_SP -25
#define NEED_DN_NORM_BT -26
+/* Protect against import context destruction */
+static pthread_mutex_t import_ctx_mutex = PTHREAD_MUTEX_INITIALIZER;
+
/********** routines to manipulate the entry fifo **********/
@@ -143,6 +146,14 @@ ldbm_back_wire_import(Slapi_PBlock *pb)
/* Threads management */
+/* Return the mutex that protects against import context destruction */
+pthread_mutex_t *
+get_import_ctx_mutex()
+{
+ return &import_ctx_mutex;
+}
+
+
/* tell all the threads to abort */
void
import_abort_all(ImportJob *job, int wait_for_them)
@@ -151,7 +162,7 @@ import_abort_all(ImportJob *job, int wait_for_them)
/* tell all the worker threads to abort */
job->flags |= FLAG_ABORT;
-
+ pthread_mutex_lock(&import_ctx_mutex);
for (worker = job->worker_list; worker; worker = worker->next)
worker->command = ABORT;
@@ -167,6 +178,7 @@ import_abort_all(ImportJob *job, int wait_for_them)
}
}
}
+ pthread_mutex_unlock(&import_ctx_mutex);
}
| 0 |
b6c1f13f8ece15bf4a64c8985a5ae6f3bab14f4d
|
389ds/389-ds-base
|
Bug(s) fixed: 213786
Bug Description: upgrade install of ssl enabled servers changes file/dir permisssions from nobody to root
Reviewed by: nhosoi (Thanks!)
Fix Description: The ssloff and sslon operations change several files, by grep/sed to temp
files, then moving the temp files over the original ones. When done as root,
this changes the file ownership to root from the original nobody. In order to
preserve the file/directory ownership, we first figure out the instance, then
use the ownership of that dse.ldif file to determine the server user:group. We
have to do this before the call to SSLOff because SSLOff needs the user:group
to chown the files. Then, every time we create a new file and replace an
existing one, we do a chown $user:$group to preserve the existing file
ownership.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
|
commit b6c1f13f8ece15bf4a64c8985a5ae6f3bab14f4d
Author: Rich Megginson <[email protected]>
Date: Fri Nov 3 19:09:57 2006 +0000
Bug(s) fixed: 213786
Bug Description: upgrade install of ssl enabled servers changes file/dir permisssions from nobody to root
Reviewed by: nhosoi (Thanks!)
Fix Description: The ssloff and sslon operations change several files, by grep/sed to temp
files, then moving the temp files over the original ones. When done as root,
this changes the file ownership to root from the original nobody. In order to
preserve the file/directory ownership, we first figure out the instance, then
use the ownership of that dse.ldif file to determine the server user:group. We
have to do this before the call to SSLOff because SSLOff needs the user:group
to chown the files. Then, every time we create a new file and replace an
existing one, we do a chown $user:$group to preserve the existing file
ownership.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
diff --git a/ldap/cm/newinst/setup b/ldap/cm/newinst/setup
index ac2d39e2d..cc38ce881 100755
--- a/ldap/cm/newinst/setup
+++ b/ldap/cm/newinst/setup
@@ -157,6 +157,10 @@ inffile=
tmpinffile=
nextisinffile=
keepinffile=
+# set by user or from existing files during upgrade
+user=
+# set by user or from existing files during upgrade
+group=
for arg in "$@" ; do
if [ "$arg" = "-s" ]; then
silent=1
@@ -227,6 +231,7 @@ adminSSLOff() {
echo $conffile=$security >> $tmpfile
cat $conffile | sed -e "s/^\($security\) .*/\1 off/g" > $conffile.01
mv $conffile.01 $conffile
+ chown $user:$group $conffile
echo "$conffile: SSL off ..."
fi
fi
@@ -248,6 +253,7 @@ adminXmlSSLOff() {
echo $conffile=$confparam >> $tmpfile
cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"off\"/g" > $conffile.0
mv $conffile.0 $conffile
+ chown $user:$group $conffile
echo "$conffile: SSL off ..."
fi
sslparams0=`grep -i "<.*SSLPARAMS " $conffile`
@@ -263,6 +269,7 @@ echo adminXmlSSLOff: SSLPARAMS off
sslparams=`echo $sslparams1 | sed -e 's/\"/\\\\\"/g'`
cat $conffile | sed -e "s/\($sslparams\)/\<\!-- \1 --\>/g" > $conffile.1
mv $conffile.1 $conffile
+ chown $user:$group $conffile
fi
fi
}
@@ -282,6 +289,7 @@ SSLOff() {
$dir/stop-slapd
cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 off/g" > $dir/config/dse.ldif.0
mv $dir/config/dse.ldif.0 $dir/config/dse.ldif
+ chown $user:$group $dir/config/dse.ldif
echo "$dir/config/dse.ldif: SSL off ..."
fi
fi
@@ -308,6 +316,7 @@ adminSSLOn() {
if [ -f $conffile ]; then
cat $conffile | sed -e "s/^\($confparam\) .*/\1 on/g" > $conffile.00
mv $conffile.00 $conffile
+ chown $user:$group $conffile
echo "$conffile $confparam: SSL on ..."
fi
}
@@ -317,6 +326,7 @@ adminXmlSSLOn() {
if [ -f $conffile ]; then
cat $conffile | sed -e "s/\([Ss][Ee][Cc][Uu][Rr][Ii][Tt][Yy]=\)\"[A-Za-z]*\"/\1\"on\"/g" > $conffile.2
mv $conffile.2 $conffile
+ chown $user:$group $conffile
fi
grep -i "<.*SSLPARAMS " $conffile > /dev/null 2>&1
rval=$?
@@ -324,6 +334,7 @@ adminXmlSSLOn() {
then
cat $conffile | sed -e "s/<\!-- *$sslparams *-->/$sslparams/g" > $conffile.3
mv $conffile.3 $conffile
+ chown $user:$group $conffile
fi
echo "$conffile: SSL on ..."
}
@@ -336,6 +347,7 @@ SSLOn() {
$dir/stop-slapd
cat $dir/config/dse.ldif | sed -e "s/\($security\) .*/\1 on/g" > $dir/config/dse.ldif.0
mv $dir/config/dse.ldif.0 $dir/config/dse.ldif
+ chown $user:$group $dir/config/dse.ldif
echo "$dir/config/dse.ldif: SSL on ..."
echo "Restarting Directory Server: $dir/start-slapd"
$dir/start-slapd
@@ -370,9 +382,14 @@ SSLOn() {
# check whether it is an in-place installation
if [ -f $sroot/admin-serv/config/adm.conf ]; then
+ dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'`
+ if [ -f $sroot/$dsinst/config/dse.ldif ]; then
+ user=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'`
+ group=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'`
+ fi
+
SSLOff
- dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'`
if [ -f $sroot/$dsinst/config/dse.ldif ]; then
# it is an in=place installation
ldaphost=`getValFromAdminConf "ldapHost:" "adm.conf"`
@@ -380,8 +397,6 @@ if [ -f $sroot/admin-serv/config/adm.conf ]; then
adminport=`getValFromAdminConf "\<port:" "adm.conf"`
adminid=`getValFromAdmpw "admpw"`
sysuser=`getValFromAdminConf "nsSuiteSpotUser:" "local.conf"`
- suitespotuser=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'`
- suitespotgroup=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'`
admindomain=`echo $ldaphost | awk -F. '{print $5 ? $2 "." $3 "." $4 "." $5: $4 ? $2 "." $3 "." $4 : $3 ? $2 "." $3 : $2 ? $2 : ""}'`
if [ "$admindomain" = "" ]; then
admindomain=`domainname`
@@ -405,8 +420,8 @@ if [ -f $sroot/admin-serv/config/adm.conf ]; then
inffile=$sroot/setup/myinstall.inf
echo "[General]" > $inffile
echo "FullMachineName= $ldaphost" >> $inffile
- echo "SuiteSpotUserID= $suitespotuser" >> $inffile
- echo "SuitespotGroup= $suitespotgroup" >> $inffile
+ echo "SuiteSpotUserID= $user" >> $inffile
+ echo "SuitespotGroup= $group" >> $inffile
echo "ServerRoot= $sroot" >> $inffile
echo "ConfigDirectoryLdapURL= ldap://$ldaphost:$ldapport/o=NetscapeRoot" >> $inffile
echo "ConfigDirectoryAdminID= $adminid" >> $inffile
| 0 |
ae8bac2a32815e92b6691266b722d539f0752c15
|
389ds/389-ds-base
|
149510
Fix ACL unit test compile errors and warnings. All tests pass 100% now.
|
commit ae8bac2a32815e92b6691266b722d539f0752c15
Author: Rob Crittenden <[email protected]>
Date: Mon Mar 7 15:35:39 2005 +0000
149510
Fix ACL unit test compile errors and warnings. All tests pass 100% now.
diff --git a/lib/libaccess/utest/Makefile b/lib/libaccess/utest/Makefile
index bfcabb2eb..fda7ee785 100644
--- a/lib/libaccess/utest/Makefile
+++ b/lib/libaccess/utest/Makefile
@@ -39,12 +39,12 @@ XSRC = \
../aclspace.cpp \
../lasgroup.cpp \
../lasuser.cpp \
- ../lasprogram.cpp \
../nseframe.cpp \
../aclcache.cpp \
../register.cpp \
../symbols.cpp \
../method.cpp \
+ ../access_plhash.cpp \
../authdb.cpp
COBJ = $(CSRC:%.cpp=%.o)
@@ -68,7 +68,6 @@ XLIBS+= $(OBJDIR)/lib/base/plist.o \
$(OBJDIR)/lib/base/ereport.o \
$(OBJDIR)/lib/base/system.o \
$(OBJDIR)/lib/base/shexp.o \
- $(OBJDIR)/lib/base/pblock.o \
$(OBJDIR)/lib/base/file.o \
$(OBJDIR)/lib/base/systhr.o \
$(OBJDIR)/lib/base/nscperror.o \
@@ -79,7 +78,7 @@ all: $(COBJ) $(TSRC) acltest
./acltest > test.out
diff test.ref test.out
@echo
- @echo "The unit test is passed if there is no diff output, and the"
+ @echo "The unit test has passed if there is no diff output and the"
@echo "Purify window shows no errors and 0 bytes leaked."
@echo
@echo "Run - gmake coverage - manually to get code coverage analysis."
diff --git a/lib/libaccess/utest/acltest.cpp b/lib/libaccess/utest/acltest.cpp
index a4a7b1869..ba7790bab 100644
--- a/lib/libaccess/utest/acltest.cpp
+++ b/lib/libaccess/utest/acltest.cpp
@@ -5,8 +5,6 @@
* END COPYRIGHT BLOCK **/
#include <stdio.h>
#include <netsite.h>
-#include <base/session.h>
-#include <base/daemon.h>
#include <base/systhr.h>
#include <libaccess/nserror.h>
#include <libaccess/acl.h>
@@ -42,7 +40,7 @@ static int parse_dburl (NSErr_t *errp, ACLDbType_t dbtype,
}
-main()
+int main(int argc, char **argv)
{
ACLListHandle_t *acl_list;
int result;
@@ -232,6 +230,7 @@ main()
eval.subject = NULL;
eval.resource = NULL;
+ eval.default_result = ACL_RES_DENY;
for (i=0; i<10; i++) {
sprintf(filename, "aclfile%d", i);
@@ -437,44 +436,6 @@ skip_test:
printf("%s = %d\n\n", filename, result);
}
- /*
- * Program LAS Unit Tests
- */
- char *groups[32] = {
- "http-foo",
- "http-bar",
- "http-grog",
- NULL
- };
- char *programs[32] = {
- "foo, fubar, frobozz",
- "bar, shoo, fly",
- "grog, beer",
- NULL
- };
- struct program_groups program_groups;
- program_groups.groups = groups;
- program_groups.programs = programs;
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"foo", (PList_t)&program_groups, NULL, NULL);
- printf("program = foo %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"nomatch", (PList_t)&program_groups, NULL, NULL);
- printf("program = nomatch %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar,http-grog", &cachable, &las_cookie, (PList_t)"beer", (PList_t)&program_groups, NULL, NULL);
- printf("program = beer %d\n\n", result);
-
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo, http-bar, http-grog", &cachable, &las_cookie, (PList_t)"http-grog", (PList_t)&program_groups, NULL, NULL);
- printf("program = http-grog %d\n\n", result);
-
- result = LASProgramEval(NULL, "program", CMP_OP_EQ, "http-foo", &cachable, &las_cookie, (PList_t)"ubar", (PList_t)&program_groups, NULL, NULL);
- printf("program = ubar %d\n\n", result);
-
-
/*
* DNS LAS Unit Tests
*/
diff --git a/lib/libaccess/utest/onetest.cpp b/lib/libaccess/utest/onetest.cpp
index 8068828e5..478605a61 100644
--- a/lib/libaccess/utest/onetest.cpp
+++ b/lib/libaccess/utest/onetest.cpp
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <netsite.h>
#include <libaccess/nserror.h>
-#include <base/session.h>
#include <libaccess/acl.h>
#include "../aclpriv.h"
#include <libaccess/aclproto.h>
@@ -15,18 +14,13 @@
#include <base/ereport.h>
extern ACLListHandle_t *ACL_ParseFile(NSErr_t *errp, char *filename);
-extern ACLEvalDestroyContext(NSErr_t *errp, ACLEvalHandle_t *acleval);
-main(int arc, char **argv)
+int main(int arc, char **argv)
{
int result;
- int cachable;
- void *las_cookie=NULL;
ACLEvalHandle_t eval;
char *rights[2];
- char filename[20];
- int i;
char *bong;
char *bong_type;
char *acl_tag;
@@ -40,7 +34,6 @@ main(int arc, char **argv)
eval.acllist = ACL_ParseFile((NSErr_t *)NULL, argv[1]);
result = ACL_EvalTestRights(NULL, &eval, &rights[0], NULL, &bong, &bong_type, &acl_tag, &expr_num);
- ACLEvalDestroyContext(NULL, &eval);
ACL_ListDestroy(NULL, eval.acllist);
printf("%s = %d\n\n", argv[1], result);
diff --git a/lib/libaccess/utest/test.ref b/lib/libaccess/utest/test.ref
index 329c32727..1a2d060f6 100644
--- a/lib/libaccess/utest/test.ref
+++ b/lib/libaccess/utest/test.ref
@@ -1,10 +1,3 @@
-#
-# BEGIN COPYRIGHT BLOCK
-# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
-# Copyright (C) 2005 Red Hat, Inc.
-# All rights reserved.
-# END COPYRIGHT BLOCK
-#
Failed ACL_FileMergeFile() test.
Method one is #1, rv=0
Method two is #2, rv=0
@@ -68,16 +61,6 @@ aclfile18 = 0
aclfile19 = 1
-program = foo -1
-
-program = nomatch -2
-
-program = beer -1
-
-program = http-grog -2
-
-program = ubar -2
-
dnsalias = *? -1
dnsalias = aruba.mcom.com brain251.mcom.com? -1
diff --git a/lib/libaccess/utest/twotest.cpp b/lib/libaccess/utest/twotest.cpp
index f26bbc18d..8972ade76 100644
--- a/lib/libaccess/utest/twotest.cpp
+++ b/lib/libaccess/utest/twotest.cpp
@@ -5,7 +5,6 @@
* END COPYRIGHT BLOCK **/
#include <stdio.h>
#include <netsite.h>
-#include <base/session.h>
#include <base/plist.h>
#include <base/ereport.h>
#include <libaccess/nserror.h>
@@ -16,18 +15,13 @@
extern ACLListHandle_t *ACL_ParseFile(NSErr_t *errp, char *filename);
-extern ACLEvalDestroyContext(NSErr_t *errp, ACLEvalHandle_t *acleval);
-main(int arc, char **argv)
+int main(int arc, char **argv)
{
int result;
- int cachable;
- void *las_cookie=NULL;
ACLEvalHandle_t eval;
char *rights[2];
char *map_generic[7];
- char filename[20];
- int i;
char *bong;
char *bong_type;
char *acl_tag;
@@ -50,7 +44,6 @@ main(int arc, char **argv)
eval.acllist = ACL_ParseFile((NSErr_t *)NULL, argv[1]);
result = ACL_EvalTestRights(NULL, &eval, &rights[0], map_generic, &bong, &bong_type, &acl_tag, &expr_num);
- ACLEvalDestroyContext(NULL, &eval);
ACL_ListDestroy(NULL, eval.acllist);
printf("%s = %d\n\n", argv[1], result);
diff --git a/lib/libaccess/utest/ustubs.cpp b/lib/libaccess/utest/ustubs.cpp
index 88b6ac35c..877ca31fb 100644
--- a/lib/libaccess/utest/ustubs.cpp
+++ b/lib/libaccess/utest/ustubs.cpp
@@ -35,7 +35,11 @@ extern int XP_GetError();
extern int acl_usr_cache_init();
extern int acl_usr_cache_set_group();
extern int acl_usr_cache_group_check();
-extern int sema_destroy();
+extern int acl_usr_cache_group_len_check();
+extern int acl_usr_cache_enabled();
+extern int get_userdn_ldap (NSErr_t *errp, PList_t subject,
+ PList_t resource, PList_t auth_info,
+ PList_t global_auth, void *unused);
extern char *ldapu_err2string(int err);
extern int ACL_CacheFlush(void);
NSPR_END_EXTERN_C
@@ -54,11 +58,6 @@ void init_ldb_rwlock ()
{
}
-sema_destroy()
-{
- return 0;
-}
-
#ifdef notdef
char *system_errmsg()
{
@@ -75,27 +74,44 @@ ACL_CacheFlushRegister(AclCacheFlushFunc_t flush_func)
return 0;
}
-acl_usr_cache_init()
+int acl_usr_cache_init()
{
return 0;
}
-acl_usr_cache_group_check()
+int acl_usr_cache_group_check()
{
return 0;
}
-acl_usr_cache_set_group()
+int acl_usr_cache_set_group()
{
return 0;
}
-XP_SetError()
+int acl_usr_cache_group_len_check()
{
return 0;
}
-XP_GetError()
+int acl_usr_cache_enabled()
+{
+ return 0;
+}
+
+int get_userdn_ldap (NSErr_t *errp, PList_t subject,
+ PList_t resource, PList_t auth_info,
+ PList_t global_auth, void *unused)
+{
+ return LAS_EVAL_TRUE;
+}
+
+int XP_SetError()
+{
+ return 0;
+}
+
+int XP_GetError()
{
return 0;
}
@@ -129,7 +145,7 @@ int crit_owner_is_me(CRITICAL id)
return 1;
}
-symTableFindSym()
+int symTableFindSym()
{
return 0;
}
@@ -171,11 +187,13 @@ LASUserGetUser()
return "hmiller";
}
+int
LASIpGetIp()
{
return(0x11223344);
}
+int
LASDnsGetDns(char **dnsv)
{
*dnsv = "aruba.mcom.com";
@@ -188,11 +206,13 @@ ACL_DestroyList()
return(0);
}
+int
aclCheckHosts()
{
return(0);
}
+int
aclCheckUsers()
{
return(0);
| 0 |
e6ba94f61c4105403c46c76cd192061955bfd71b
|
389ds/389-ds-base
|
Ticket #48837 - Replication: total init aborted
Bug Description: Commit 2ecc93781abc786be6a8b8443faf2598a6c30f97 to fix
ticket 48822 broke the logic and forced plugin_call_exop_plugins to
return an error even if the underlying extended plugin were successful.
Fix Description:
In plugin_call_exop_plugins,
- this patch honours the return value from the plugins.
- LDAP_SUCCESS is translated to SLAPI_PLUGIN_EXTENDED_SENT_RESULT.
The extop plugin multimaster_extop_NSDS50ReplicationEntry is fixed to
return SLAPI_PLUGIN_EXTENDED_SENT_RESULT in the case of success.
https://fedorahosted.org/389/ticket/48837
Reviewed by [email protected] and [email protected] (Thank you, Ludwig and William!)
|
commit e6ba94f61c4105403c46c76cd192061955bfd71b
Author: Noriko Hosoi <[email protected]>
Date: Mon May 16 17:08:21 2016 -0700
Ticket #48837 - Replication: total init aborted
Bug Description: Commit 2ecc93781abc786be6a8b8443faf2598a6c30f97 to fix
ticket 48822 broke the logic and forced plugin_call_exop_plugins to
return an error even if the underlying extended plugin were successful.
Fix Description:
In plugin_call_exop_plugins,
- this patch honours the return value from the plugins.
- LDAP_SUCCESS is translated to SLAPI_PLUGIN_EXTENDED_SENT_RESULT.
The extop plugin multimaster_extop_NSDS50ReplicationEntry is fixed to
return SLAPI_PLUGIN_EXTENDED_SENT_RESULT in the case of success.
https://fedorahosted.org/389/ticket/48837
Reviewed by [email protected] and [email protected] (Thank you, Ludwig and William!)
diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c
index 7f7bb15c2..12b244d84 100644
--- a/ldap/servers/plugins/replication/repl5_total.c
+++ b/ldap/servers/plugins/replication/repl5_total.c
@@ -866,8 +866,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
rc, connid, opid);
}
- if (rc != 0)
- {
+ if (rc) {
/* just disconnect from the supplier. bulk import is stopped when
connection object is destroyed */
slapi_pblock_get (pb, SLAPI_CONNECTION, &conn);
@@ -881,6 +880,8 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
{
slapi_entry_free (e);
}
+ } else {
+ rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
}
return rc;
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index f196d2c6a..5d63baafc 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -527,23 +527,19 @@ plugin_determine_exop_plugins( const char *oid, struct slapdplugin **plugin)
int
plugin_call_exop_plugins( Slapi_PBlock *pb, struct slapdplugin *p )
{
- int rc = LDAP_SUCCESS;
- int lderr = SLAPI_PLUGIN_EXTENDED_NOT_HANDLED;
-
+ int rc;
slapi_pblock_set( pb, SLAPI_PLUGIN, p );
set_db_default_result_handlers( pb );
- if ( (rc = (*p->plg_exhandler)( pb )) == SLAPI_PLUGIN_EXTENDED_SENT_RESULT ) {
- return( rc ); /* result sent */
- } else if ( rc != SLAPI_PLUGIN_EXTENDED_NOT_HANDLED ) {
- /*
- * simple merge: report last real error
+ rc = (*p->plg_exhandler)( pb );
+ if (LDAP_SUCCESS == rc) {
+ /*
+ * Some plugin may return LDAP_SUCCESS in the success case.
+ * It is translated to SLAPI_PLUGIN_EXTENDED_SENT_RESULT to
+ * reduce the unnecessary error logs.
*/
- if ( rc != LDAP_SUCCESS ) {
- lderr = rc;
- }
+ rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
}
-
- return( lderr );
+ return (rc);
}
| 0 |
a4e4edc6ac37d03ac38c264be2ddbd8e08f8cb16
|
389ds/389-ds-base
|
Ticket #20 - Allow automember to work on entries that have already been added
Bug Description: Currently only ADD's will trigger the automember update. Modifies
are not checked due to performance reasons.
Fix Description: Created 3 new tasks:
[1] Rebuild Membership Task - this task takes a filter, base, scope.
Then it will look through the database for matches and then do
the automember update. This is designed to catch entries that were
modified that match the automembership criteria.
[2] Export Updates Task - this will write an ldif file of the changes
that the "Rebuild Memebership Task" would do, if it was run.
[3] Map Updates Task - this takes an ldif of new entries, and then writes
an ldif file of the changes that would take place if those entries
were added.
So tasks 2 & 3 just provide the changes that would take place, but they don't
change any data in the database. This is a customer RFE.
https://fedorahosted.org/389/ticket/20
Reviewed by: richm & noriko (Thanks!)
|
commit a4e4edc6ac37d03ac38c264be2ddbd8e08f8cb16
Author: Mark Reynolds <[email protected]>
Date: Wed Apr 4 17:25:17 2012 -0400
Ticket #20 - Allow automember to work on entries that have already been added
Bug Description: Currently only ADD's will trigger the automember update. Modifies
are not checked due to performance reasons.
Fix Description: Created 3 new tasks:
[1] Rebuild Membership Task - this task takes a filter, base, scope.
Then it will look through the database for matches and then do
the automember update. This is designed to catch entries that were
modified that match the automembership criteria.
[2] Export Updates Task - this will write an ldif file of the changes
that the "Rebuild Memebership Task" would do, if it was run.
[3] Map Updates Task - this takes an ldif of new entries, and then writes
an ldif file of the changes that would take place if those entries
were added.
So tasks 2 & 3 just provide the changes that would take place, but they don't
change any data in the database. This is a customer RFE.
https://fedorahosted.org/389/ticket/20
Reviewed by: richm & noriko (Thanks!)
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index 391dde75a..d6383740c 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -103,9 +103,28 @@ static struct automemberRegexRule *automember_parse_regex_rule(char *rule_string
static void automember_free_regex_rule(struct automemberRegexRule *rule);
static int automember_parse_grouping_attr(char *value, char **grouping_attr,
char **grouping_value);
-static void automember_update_membership(struct configEntry *config, Slapi_Entry *e);
+static void automember_update_membership(struct configEntry *config, Slapi_Entry *e, PRFileDesc *ldif_fd);
static void automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
- char *grouping_attr, char *grouping_value);
+ char *grouping_attr, char *grouping_value, PRFileDesc *ldif_fd);
+const char *fetch_attr(Slapi_Entry *e, const char *attrname, const char *default_val);
+
+/*
+ * task functions
+ */
+static int automember_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg);
+static int automember_task_add_export_updates(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg);
+static int automember_task_add_map_entries(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg);
+void automember_rebuild_task_thread(void *arg);
+void automember_export_task_thread(void *arg);
+void automember_map_task_thread(void *arg);
+void automember_task_destructor(Slapi_Task *task);
+void automember_task_export_destructor(Slapi_Task *task);
+void automember_task_map_destructor(Slapi_Task *task);
+
+#define DEFAULT_FILE_MODE PR_IRUSR | PR_IWUSR
/*
* Config cache locking functions
@@ -325,6 +344,10 @@ automember_start(Slapi_PBlock * pb)
goto done;
}
+ slapi_task_register_handler("automember rebuild membership", automember_task_add);
+ slapi_task_register_handler("automember export updates", automember_task_add_export_updates);
+ slapi_task_register_handler("automember map updates", automember_task_add_map_entries);
+
g_automember_config_lock = slapi_new_rwlock();
if (!g_automember_config_lock) {
@@ -1379,7 +1402,7 @@ automember_parse_grouping_attr(char *value, char **grouping_attr, char **groupin
* the rules in config, then performs the updates.
*/
static void
-automember_update_membership(struct configEntry *config, Slapi_Entry *e)
+automember_update_membership(struct configEntry *config, Slapi_Entry *e, PRFileDesc *ldif_fd)
{
PRCList *rule = NULL;
struct automemberRegexRule *curr_rule = NULL;
@@ -1533,14 +1556,14 @@ automember_update_membership(struct configEntry *config, Slapi_Entry *e)
/* Add to each default group. */
for (i = 0; config->default_groups && config->default_groups[i]; i++) {
automember_add_member_value(e, config->default_groups[i],
- config->grouping_attr, config->grouping_value);
+ config->grouping_attr, config->grouping_value, ldif_fd);
}
} else {
/* Update the target groups. */
dnitem = (struct automemberDNListItem *)PR_LIST_HEAD(&targets);
while ((PRCList *)dnitem != &targets) {
automember_add_member_value(e, slapi_sdn_get_dn(dnitem->dn),
- config->grouping_attr, config->grouping_value);
+ config->grouping_attr, config->grouping_value, ldif_fd);
dnitem = (struct automemberDNListItem *)PR_NEXT_LINK((PRCList *)dnitem);
}
}
@@ -1567,8 +1590,8 @@ automember_update_membership(struct configEntry *config, Slapi_Entry *e)
* Adds a member entry to a group.
*/
static void
-automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
- char *grouping_attr, char *grouping_value)
+automember_add_member_value(Slapi_Entry *member_e, const char *group_dn, char *grouping_attr,
+ char *grouping_value, PRFileDesc *ldif_fd)
{
Slapi_PBlock *mod_pb = slapi_pblock_new();
int result = LDAP_SUCCESS;
@@ -1586,6 +1609,19 @@ automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
freeit = 1;
}
+ /*
+ * If ldif_fd is set, we are performing an export task. Write the changes to the
+ * file instead of performing them
+ */
+ if(ldif_fd){
+ PR_fprintf(ldif_fd, "dn: %s\n", group_dn);
+ PR_fprintf(ldif_fd, "changetype: modify\n");
+ PR_fprintf(ldif_fd, "add: %s\n", grouping_attr);
+ PR_fprintf(ldif_fd, "%s: %s\n", grouping_attr, member_value);
+ PR_fprintf(ldif_fd, "\n");
+ goto out;
+ }
+
if (member_value) {
/* Set up the operation. */
vals[0] = member_value;
@@ -1621,6 +1657,7 @@ automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
grouping_value, slapi_entry_get_dn(member_e));
}
+out:
/* Cleanup */
if (freeit) {
slapi_ch_free_string(&member_value);
@@ -1853,7 +1890,7 @@ automember_add_post_op(Slapi_PBlock *pb)
if (slapi_dn_issuffix(slapi_sdn_get_dn(sdn), config->scope) &&
(slapi_filter_test_simple(e, config->filter) == 0)) {
/* Find out what membership changes are needed and make them. */
- automember_update_membership(config, e);
+ automember_update_membership(config, e, NULL);
}
list = PR_NEXT_LINK(list);
@@ -1907,6 +1944,671 @@ automember_del_post_op(Slapi_PBlock *pb)
return 0;
}
+typedef struct _task_data
+{
+ char *filter_str;
+ char *ldif_out;
+ char *ldif_in;
+ Slapi_DN *base_dn;
+ char *bind_dn;
+ int scope;
+} task_data;
+
+/*
+ * extract a single value from the entry (as a string) -- if it's not in the
+ * entry, the default will be returned (which can be NULL).
+ * you do not need to free anything returned by this.
+ */
+const char *
+fetch_attr(Slapi_Entry *e, const char *attrname, const char *default_val)
+{
+ Slapi_Value *val = NULL;
+ Slapi_Attr *attr;
+
+ if(slapi_entry_attr_find(e, attrname, &attr) != 0){
+ return default_val;
+ }
+ slapi_attr_first_value(attr, &val);
+
+ return slapi_value_get_string(val);
+}
+
+void
+automember_task_destructor(Slapi_Task *task)
+{
+ if (task) {
+ task_data *mydata = (task_data *)slapi_task_get_data(task);
+ if (mydata) {
+ slapi_ch_free_string(&mydata->bind_dn);
+ slapi_sdn_free(&mydata->base_dn);
+ slapi_ch_free_string(&mydata->filter_str);
+ slapi_ch_free((void **)&mydata);
+ }
+ }
+}
+
+void
+automember_task_export_destructor(Slapi_Task *task)
+{
+ if (task) {
+ task_data *mydata = (task_data *)slapi_task_get_data(task);
+ if (mydata) {
+ slapi_ch_free_string(&mydata->ldif_out);
+ slapi_ch_free_string(&mydata->bind_dn);
+ slapi_sdn_free(&mydata->base_dn);
+ slapi_ch_free_string(&mydata->filter_str);
+ slapi_ch_free((void **)&mydata);
+ }
+ }
+}
+
+void
+automember_task_map_destructor(Slapi_Task *task)
+{
+ if (task) {
+ task_data *mydata = (task_data *)slapi_task_get_data(task);
+ if (mydata) {
+ slapi_ch_free_string(&mydata->ldif_out);
+ slapi_ch_free_string(&mydata->ldif_in);
+ slapi_ch_free_string(&mydata->bind_dn);
+ slapi_ch_free((void **)&mydata);
+ }
+ }
+}
+
+/*
+ * automember_task_add
+ *
+ * This task is designed to "retro-fit" entries that existed prior to
+ * enabling this plugin. This can be an expensive task to run, but it's
+ * better than processing every modify operation in an attempt to catch
+ * entries that have not been processed.
+ *
+ * task entry:
+ *
+ * dn: cn=my rebuild task, cn=automember rebuild membership,cn=tasks,cn=config
+ * objectClass: top
+ * objectClass: extensibleObject
+ * cn: my rebuild task
+ * basedn: dc=example,dc=com
+ * filter: (uid=*)
+ * scope: sub
+ *
+ * basedn and filter are required. If scope is omitted, the default is sub
+ */
+static int
+automember_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg)
+{
+ int rv = SLAPI_DSE_CALLBACK_OK;
+ task_data *mytaskdata = NULL;
+ Slapi_Task *task = NULL;
+ Slapi_DN *basedn = NULL;
+ PRThread *thread = NULL;
+ char *bind_dn = NULL;
+ const char *base_dn;
+ const char *filter;
+ const char *scope;
+
+ *returncode = LDAP_SUCCESS;
+
+ /*
+ * Make sure the plugin is started
+ */
+ if(!g_plugin_started){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ /*
+ * Grab the task params
+ */
+ if((base_dn = fetch_attr(e, "basedn", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ } else {
+ /* convert the base_dn to a slapi dn */
+ basedn = slapi_sdn_new_dn_byval(base_dn);
+ }
+ if((filter = fetch_attr(e, "filter", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ scope = fetch_attr(e, "scope", "sub");
+ /*
+ * setup our task data
+ */
+ mytaskdata = (task_data*)slapi_ch_malloc(sizeof(task_data));
+ if (mytaskdata == NULL){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+
+ slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &bind_dn);
+ mytaskdata->bind_dn = slapi_ch_strdup(bind_dn);
+ mytaskdata->base_dn = basedn;
+ mytaskdata->filter_str = slapi_ch_strdup(filter);
+ if(scope){
+ if(strcasecmp(scope,"sub")== 0){
+ mytaskdata->scope = 2;
+ } else if(strcasecmp(scope,"one")== 0){
+ mytaskdata->scope = 1;
+ } else if(strcasecmp(scope,"base")== 0){
+ mytaskdata->scope = 0;
+ } else {
+ /* Hmm, possible typo, use subtree */
+ mytaskdata->scope = 2;
+ }
+ } else {
+ /* subtree by default */
+ mytaskdata->scope = 2;
+ }
+ task = slapi_new_task(slapi_entry_get_ndn(e));
+ slapi_task_set_destructor_fn(task, automember_task_destructor);
+ slapi_task_set_data(task, mytaskdata);
+ /*
+ * Start the task as a separate thread
+ */
+ thread = PR_CreateThread(PR_USER_THREAD, automember_rebuild_task_thread,
+ (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
+ PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
+ if (thread == NULL){
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "unable to create task thread!\n");
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ slapi_task_finish(task, *returncode);
+ } else {
+ rv = SLAPI_DSE_CALLBACK_OK;
+ }
+
+out:
+ return rv;
+}
+
+/*
+ * automember_rebuild_task_thread()
+ *
+ * Search using the basedn, filter, and scope provided from the task data.
+ * Then loop of each entry, and apply the membership if applicable.
+ */
+void automember_rebuild_task_thread(void *arg){
+ Slapi_Task *task = (Slapi_Task *)arg;
+ struct configEntry *config = NULL;
+ Slapi_PBlock *search_pb = NULL;
+ Slapi_Entry **entries = NULL;
+ task_data *td = NULL;
+ PRCList *list = NULL;
+ int result = 0;
+ int i = 0;
+
+ /*
+ * Fetch our task data from the task
+ */
+ td = (task_data *)slapi_task_get_data(task);
+ slapi_task_begin(task, 1);
+ slapi_task_log_notice(task, "Automember rebuild task starting (base dn: (%s) filter (%s)...\n",
+ slapi_sdn_get_dn(td->base_dn),td->filter_str);
+ slapi_task_log_status(task, "Automember rebuild task starting (base dn: (%s) filter (%s)...\n",
+ slapi_sdn_get_dn(td->base_dn),td->filter_str);
+ /*
+ * Set the bind dn in the local thread data
+ */
+ slapi_td_set_dn(slapi_ch_strdup(td->bind_dn));
+ /*
+ * Search the database
+ */
+ search_pb = slapi_pblock_new();
+ slapi_search_internal_set_pb_ext(search_pb, td->base_dn, td->scope, td->filter_str, NULL,
+ 0, NULL, NULL, automember_get_plugin_id(), 0);
+ slapi_search_internal_pb(search_pb);
+ slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
+ if (LDAP_SUCCESS != result){
+ slapi_task_log_notice(task, "Automember rebuild membership task unable to search"
+ " on base (%s) filter (%s) error (%d)\n", slapi_sdn_get_dn(td->base_dn),
+ td->filter_str, result);
+ slapi_task_log_status(task, "Automember rebuild membership task unable to search"
+ " on base (%s) filter (%s) error (%d)\n", slapi_sdn_get_dn(td->base_dn),
+ td->filter_str, result);
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "Task: unable to search on base (%s) filter (%s) error (%d)\n",
+ slapi_sdn_get_dn(td->base_dn), td->filter_str, result);
+ goto out;
+ }
+ slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
+ /*
+ * Grab the config read lock, and loop over the entries
+ */
+ automember_config_read_lock();
+ for (i = 0; entries && (entries[i] != NULL); i++){
+ /* make sure the plugin is still up, as this loop could run for awhile */
+ if (!g_plugin_started) {
+ automember_config_unlock();
+ result = -1;
+ goto out;
+ }
+ if (!PR_CLIST_IS_EMPTY(g_automember_config)) {
+ list = PR_LIST_HEAD(g_automember_config);
+ while (list != g_automember_config) {
+ config = (struct configEntry *)list;
+ automember_update_membership(config, entries[i], NULL);
+ list = PR_NEXT_LINK(list);
+ }
+ }
+ }
+ automember_config_unlock();
+ slapi_free_search_results_internal(search_pb);
+
+out:
+ if(result){
+ /* error */
+ slapi_task_log_notice(task, "Automember rebuild task aborted. Error (%d)", result);
+ slapi_task_log_status(task, "Automember rebuild task aborted. Error (%d)", result);
+ } else {
+ slapi_task_log_notice(task, "Automember rebuild task finished. Processed (%d) entries.", i);
+ slapi_task_log_status(task, "Automember rebuild task finished. Processed (%d) entries.", i);
+ }
+ slapi_task_inc_progress(task);
+ slapi_task_finish(task, result);
+}
+
+/*
+ * Export an ldif of the changes that would be made if we ran the automember rebuild membership task
+ *
+ * task entry:
+ *
+ * dn: cn=my export task, cn=automember export updates,cn=tasks,cn=config
+ * objectClass: top
+ * objectClass: extensibleObject
+ * cn: my export task
+ * basedn: dc=example,dc=com
+ * filter: (uid=*)
+ * scope: sub
+ * ldif: /tmp/automem-updates.ldif
+ */
+static int
+automember_task_add_export_updates(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg)
+{
+ int rv = SLAPI_DSE_CALLBACK_OK;
+ task_data *mytaskdata = NULL;
+ Slapi_Task *task = NULL;
+ Slapi_DN *basedn = NULL;
+ PRThread *thread = NULL;
+ char *bind_dn = NULL;
+ const char *base_dn = NULL;
+ const char *filter = NULL;
+ const char *ldif = NULL;
+ const char *scope = NULL;
+
+ *returncode = LDAP_SUCCESS;
+
+ /*
+ * Make sure the plugin is started
+ */
+ if(!g_plugin_started){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+
+ if((ldif = fetch_attr(e, "ldif", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ if((base_dn = fetch_attr(e, "basedn", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ } else {
+ /* convert the base dn to a slapi dn */
+ basedn = slapi_sdn_new_dn_byval(base_dn);
+ }
+ if((filter = fetch_attr(e, "filter", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ scope = fetch_attr(e, "scope", "sub");
+
+ slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &bind_dn);
+
+ mytaskdata = (task_data*)slapi_ch_malloc(sizeof(task_data));
+ if (mytaskdata == NULL){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ mytaskdata->bind_dn = slapi_ch_strdup(bind_dn);
+ mytaskdata->ldif_out = slapi_ch_strdup(ldif);
+ mytaskdata->base_dn = basedn;
+ mytaskdata->filter_str = slapi_ch_strdup(filter);
+ if(scope){
+ if(strcasecmp(scope,"sub")== 0){
+ mytaskdata->scope = 2;
+ } else if(strcasecmp(scope,"one")== 0){
+ mytaskdata->scope = 1;
+ } else if(strcasecmp(scope,"base")== 0){
+ mytaskdata->scope = 0;
+ } else {
+ /* Hmm, possible typo, use subtree */
+ mytaskdata->scope = 2;
+ }
+ } else {
+ /* subtree by default */
+ mytaskdata->scope = 2;
+ }
+
+ task = slapi_new_task(slapi_entry_get_ndn(e));
+ slapi_task_set_destructor_fn(task, automember_task_export_destructor);
+ slapi_task_set_data(task, mytaskdata);
+ /*
+ * Start the task as a separate thread
+ */
+ thread = PR_CreateThread(PR_USER_THREAD, automember_export_task_thread,
+ (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
+ PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
+ if (thread == NULL){
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "unable to create export task thread!\n");
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ slapi_task_finish(task, *returncode);
+ } else {
+ rv = SLAPI_DSE_CALLBACK_OK;
+ }
+
+out:
+ return rv;
+}
+
+void automember_export_task_thread(void *arg){
+ Slapi_Task *task = (Slapi_Task *)arg;
+ Slapi_PBlock *search_pb = NULL;
+ Slapi_Entry **entries = NULL;
+ int result = SLAPI_DSE_CALLBACK_OK;
+ struct configEntry *config = NULL;
+ PRCList *list = NULL;
+ task_data *td = NULL;
+ PRFileDesc *ldif_fd;
+ int i = 0;
+
+ td = (task_data *)slapi_task_get_data(task);
+ slapi_task_begin(task, 1);
+ slapi_task_log_notice(task, "Automember export task starting. Exporting changes to (%s)", td->ldif_out);
+ slapi_task_log_status(task, "Automember export task starting. Exporting changes to (%s)", td->ldif_out);
+
+ /* make sure we can open the ldif file */
+ if (( ldif_fd = PR_Open( td->ldif_out, PR_CREATE_FILE | PR_WRONLY, DEFAULT_FILE_MODE )) == NULL ){
+ slapi_task_log_notice(task, "Automember export task could not open ldif file \"%s\" for writing %d\n",
+ td->ldif_out, PR_GetError() );
+ slapi_task_log_status(task, "Automember export task could not open ldif file \"%s\" for writing %d\n",
+ td->ldif_out, PR_GetError() );
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "Could not open ldif file \"%s\" for writing %d\n",
+ td->ldif_out, PR_GetError() );
+ result = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+
+ /*
+ * Set the bind dn in the local thread data
+ */
+ slapi_td_set_dn(slapi_ch_strdup(td->bind_dn));
+ /*
+ * Search the database
+ */
+ search_pb = slapi_pblock_new();
+ slapi_search_internal_set_pb_ext(search_pb, td->base_dn, td->scope, td->filter_str, NULL,
+ 0, NULL, NULL, automember_get_plugin_id(), 0);
+ slapi_search_internal_pb(search_pb);
+ slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
+ if (LDAP_SUCCESS != result){
+ slapi_task_log_notice(task, "Automember task failed to search on base (%s) filter (%s) error (%d)\n",
+ slapi_sdn_get_dn(td->base_dn), td->filter_str, result);
+ slapi_task_log_status(task, "Automember task failed to search on base (%s) filter (%s) error (%d)\n",
+ slapi_sdn_get_dn(td->base_dn), td->filter_str, result);
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "Task: unable to search on base (%s) filter (%s) error (%d)\n",
+ slapi_sdn_get_dn(td->base_dn), td->filter_str, result);
+ goto out;
+ }
+ slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
+ /*
+ * Grab the config read lock, and loop over the entries
+ */
+ automember_config_read_lock();
+ for (i = 0; entries && (entries[i] != NULL); i++){
+ /* make sure the plugin is still up, as this loop could run for awhile */
+ if (!g_plugin_started) {
+ automember_config_unlock();
+ result = -1;
+ goto out;
+ }
+ if (!PR_CLIST_IS_EMPTY(g_automember_config)) {
+ list = PR_LIST_HEAD(g_automember_config);
+ while (list != g_automember_config) {
+ config = (struct configEntry *)list;
+ automember_update_membership(config, entries[i], ldif_fd);
+ list = PR_NEXT_LINK(list);
+ }
+ }
+ }
+ automember_config_unlock();
+ slapi_free_search_results_internal(search_pb);
+
+out:
+ if(ldif_fd){
+ PR_Close(ldif_fd);
+ }
+ if(result){
+ /* error */
+ slapi_task_log_notice(task, "Automember export task aborted. Error (%d)", result);
+ slapi_task_log_status(task, "Automember export task aborted. Error (%d)", result);
+ } else {
+ slapi_task_log_notice(task, "Automember export task finished. Processed (%d) entries.", i);
+ slapi_task_log_status(task, "Automember export task finished. Processed (%d) entries.", i);
+ }
+ slapi_task_inc_progress(task);
+ slapi_task_finish(task, result);
+}
+
+/*
+ * Export an ldif of the changes that would be made from the entries
+ * in the provided ldif file
+ *
+ * task entry:
+ *
+ * dn: cn=my map task, cn=automember map updates,cn=tasks,cn=config
+ * objectClass: top
+ * objectClass: extensibleObject
+ * cn: my export task
+ * ldif_in: /tmp/entries.ldif
+ * ldif_out: /tmp/automem-updates.ldif
+ */
+static int
+automember_task_add_map_entries(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
+ int *returncode, char *returntext, void *arg)
+{
+ int rv = SLAPI_DSE_CALLBACK_OK;
+ task_data *mytaskdata = NULL;
+ Slapi_Task *task = NULL;
+ PRThread *thread = NULL;
+ char *bind_dn;
+ const char *ldif_out;
+ const char *ldif_in;
+
+ *returncode = LDAP_SUCCESS;
+ /*
+ * Make sure the plugin is started
+ */
+ if(!g_plugin_started){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ /*
+ * Get the params
+ */
+ if((ldif_in = fetch_attr(e, "ldif_in", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ if((ldif_out = fetch_attr(e, "ldif_out", 0)) == NULL){
+ *returncode = LDAP_OBJECT_CLASS_VIOLATION;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ /*
+ * Setup the task data
+ */
+ mytaskdata = (task_data*)slapi_ch_malloc(sizeof(task_data));
+ if (mytaskdata == NULL){
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &bind_dn);
+ mytaskdata->bind_dn = slapi_ch_strdup(bind_dn);
+ mytaskdata->ldif_out = slapi_ch_strdup(ldif_out);
+ mytaskdata->ldif_in = slapi_ch_strdup(ldif_in);
+
+ task = slapi_new_task(slapi_entry_get_ndn(e));
+ slapi_task_set_destructor_fn(task, automember_task_map_destructor);
+ slapi_task_set_data(task, mytaskdata);
+ /*
+ * Start the task as a separate thread
+ */
+ thread = PR_CreateThread(PR_USER_THREAD, automember_map_task_thread,
+ (void *)task, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
+ PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
+ if (thread == NULL){
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "unable to create map task thread!\n");
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rv = SLAPI_DSE_CALLBACK_ERROR;
+ slapi_task_finish(task, *returncode);
+ } else {
+ rv = SLAPI_DSE_CALLBACK_OK;
+ }
+
+out:
+
+ return rv;
+}
+
+/*
+ * Read in the text entries from ldif_in, and convert them to slapi_entries.
+ * Then, write to ldif_out what the updates would be if these entries were added
+ */
+void automember_map_task_thread(void *arg){
+ Slapi_Task *task = (Slapi_Task *)arg;
+ Slapi_Entry *e = NULL;
+ int result = SLAPI_DSE_CALLBACK_OK;
+ struct configEntry *config = NULL;
+ PRCList *list = NULL;
+ task_data *td = NULL;
+ PRFileDesc *ldif_fd_out = NULL;
+ char *entrystr = NULL;
+#if defined(USE_OPENLDAP)
+ int buflen = 0;
+ LDIFFP *ldif_fd_in = NULL;
+#else
+ PRFileDesc *ldif_fd_in = NULL;
+#endif
+ int lineno = 0;
+ int rc = 0;
+
+ td = (task_data *)slapi_task_get_data(task);
+ slapi_task_begin(task, 1);
+ slapi_task_log_notice(task, "Automember map task starting... Reading entries from (%s)"
+ " and writing the updates to (%s)",td->ldif_in, td->ldif_out);
+ slapi_task_log_status(task, "Automember map task starting... Reading entries from (%s)"
+ " and writing the updates to (%s)",td->ldif_in, td->ldif_out);
+
+ /* make sure we can open the ldif files */
+ if(( ldif_fd_out = PR_Open( td->ldif_out, PR_CREATE_FILE | PR_WRONLY, DEFAULT_FILE_MODE )) == NULL ){
+ slapi_task_log_notice(task, "The ldif file %s could not be accessed, error %d. Aborting task.\n",
+ td->ldif_out, rc);
+ slapi_task_log_status(task, "The ldif file %s could not be accessed, error %d. Aborting task.\n",
+ td->ldif_out, rc);
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "Could not open ldif file \"%s\" for writing %d\n",
+ td->ldif_out, PR_GetError() );
+ result = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+
+#if defined(USE_OPENLDAP)
+ if(( ldif_fd_in = ldif_open(td->ldif_in, "r")) == NULL ){
+#else
+ if(( ldif_fd_in = PR_Open( td->ldif_in, PR_RDONLY, DEFAULT_FILE_MODE )) == NULL ){
+#endif
+ slapi_task_log_notice(task, "The ldif file %s could not be accessed, error %d. Aborting task.\n",
+ td->ldif_in, rc);
+ slapi_task_log_status(task, "The ldif file %s could not be accessed, error %d. Aborting task.\n",
+ td->ldif_in, rc);
+ slapi_log_error( SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM,
+ "Could not open ldif file \"%s\" for reading %d\n",
+ td->ldif_out, PR_GetError() );
+ result = SLAPI_DSE_CALLBACK_ERROR;
+ goto out;
+ }
+ /*
+ * Convert each LDIF entry to a slapi_entry
+ */
+ automember_config_read_lock();
+#if defined(USE_OPENLDAP)
+ while (ldif_read_record(ldif_fd_in, &lineno, &entrystr, &buflen)){
+ buflen = 0;
+#else
+ while ((entrystr = ldif_get_entry(ldif_fd_in, &lineno)) != NULL){
+#endif
+ e = slapi_str2entry( entrystr, 0 );
+ if ( e != NULL ){
+ if (!g_plugin_started) {
+ automember_config_unlock();
+ result = -1;
+ goto out;
+ }
+ if (!PR_CLIST_IS_EMPTY(g_automember_config)) {
+ list = PR_LIST_HEAD(g_automember_config);
+ while (list != g_automember_config) {
+ config = (struct configEntry *)list;
+ automember_update_membership(config, e, ldif_fd_out);
+ list = PR_NEXT_LINK(list);
+ }
+ }
+ slapi_entry_free(e);
+ } else {
+ /* invalid entry */
+ slapi_task_log_notice(task, "Automember map task, skipping invalid entry.");
+ slapi_task_log_status(task, "Automember map task, skipping invalid entry.");
+ }
+ slapi_ch_free((void **)&entrystr);
+ }
+ automember_config_unlock();
+
+out:
+ if(ldif_fd_out){
+ PR_Close(ldif_fd_out);
+ }
+ if(ldif_fd_in){
+#if defined(USE_OPENLDAP)
+ ldif_close(ldif_fd_in);
+#else
+ PR_Close(ldif_fd_in);
+#endif
+ }
+ slapi_task_inc_progress(task);
+ slapi_task_finish(task, result);
+}
+
/*
* automember_modrdn_post_op()
*
| 0 |
44e10f3486e46d4d940dc5bad85aaf786805eb06
|
389ds/389-ds-base
|
Have to explicitly set protocol version to 3
openldap requires that the protocol version be explicitly set to 3
mozldap defaults to 3, but it doesn't hurt to set it again
|
commit 44e10f3486e46d4d940dc5bad85aaf786805eb06
Author: Rich Megginson <[email protected]>
Date: Fri Sep 3 11:27:39 2010 -0600
Have to explicitly set protocol version to 3
openldap requires that the protocol version be explicitly set to 3
mozldap defaults to 3, but it doesn't hurt to set it again
diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c
index 77b08cddb..3d65efc67 100644
--- a/ldap/servers/slapd/ldaputil.c
+++ b/ldap/servers/slapd/ldaputil.c
@@ -593,6 +593,7 @@ slapi_ldap_init_ext(
LDAP *ld = NULL;
int rc = 0;
int secureurl = 0;
+ int ldap_version3 = LDAP_VERSION3;
/* We need to provide a sasl path used for client connections, especially
if the server is not set up to be a sasl server - since mozldap provides
@@ -723,6 +724,10 @@ slapi_ldap_init_ext(
ld = prldap_init(hostname, port, shared);
}
#endif /* !USE_OPENLDAP */
+
+ /* must explicitly set version to 3 */
+ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &ldap_version3);
+
/* Update snmp interaction table */
if (hostname) {
if (ld == NULL) {
| 0 |
ca9ee573084edc961f505bb6bf23d44a7349f32c
|
389ds/389-ds-base
|
Issue 6404 - UI - Add npm pretter package
Description:
Add prettier to the porject to catch and fix code stylings
npm run prettier
npm run prettier:fix
relates: https://github.com/389ds/389-ds-base/issues/6404
Reviewed by: spichugi(Thanks!)
|
commit ca9ee573084edc961f505bb6bf23d44a7349f32c
Author: Mark Reynolds <[email protected]>
Date: Wed Nov 13 14:11:40 2024 -0500
Issue 6404 - UI - Add npm pretter package
Description:
Add prettier to the porject to catch and fix code stylings
npm run prettier
npm run prettier:fix
relates: https://github.com/389ds/389-ds-base/issues/6404
Reviewed by: spichugi(Thanks!)
diff --git a/src/cockpit/389-console/package-lock.json b/src/cockpit/389-console/package-lock.json
index 855d2e688..e59d75ae3 100644
--- a/src/cockpit/389-console/package-lock.json
+++ b/src/cockpit/389-console/package-lock.json
@@ -20,6 +20,7 @@
"@patternfly/react-table": "^4.50.1",
"eslint-plugin-react-hooks": "^4.2.0",
"gettext-parser": "^2.0.0",
+ "prettier": "^3.3.3",
"prop-types": "^15.7.2",
"react": "17.0.2",
"react-dom": "17.0.2"
@@ -5034,6 +5035,21 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/prettier": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
+ "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
diff --git a/src/cockpit/389-console/package.json b/src/cockpit/389-console/package.json
index a4f09a777..31d5bafa9 100644
--- a/src/cockpit/389-console/package.json
+++ b/src/cockpit/389-console/package.json
@@ -15,8 +15,10 @@
"build": "./build.js",
"eslint": "eslint --ext .js --ext .jsx src/",
"eslint:fix": "eslint --fix --ext .js --ext .jsx src/",
- "stylelint": "stylelint src/*{.css,scss}",
- "stylelint:fix": "stylelint --fix src/*{.css,scss}"
+ "stylelint": "stylelint src/css/*{.css,scss}",
+ "stylelint:fix": "stylelint --fix src/css/*{.css,scss}",
+ "prettier": "prettier --check src/",
+ "prettier:fix": "prettier --write src/"
},
"devDependencies": {
"argparse": "^2.0.1",
@@ -59,6 +61,7 @@
"@patternfly/react-table": "^4.50.1",
"eslint-plugin-react-hooks": "^4.2.0",
"gettext-parser": "^2.0.0",
+ "prettier": "^3.3.3",
"prop-types": "^15.7.2",
"react": "17.0.2",
"react-dom": "17.0.2"
diff --git a/src/cockpit/389-console/src/css/_fonts.scss b/src/cockpit/389-console/src/css/_fonts.scss
index dcf5804b3..0f0fb3b36 100644
--- a/src/cockpit/389-console/src/css/_fonts.scss
+++ b/src/cockpit/389-console/src/css/_fonts.scss
@@ -15,7 +15,7 @@ $relative: true
src: url('#{$filePath}.woff2') format('woff2');
font-style: #{$style};
font-weight: $weightValue;
- text-rendering: optimizeLegibility;
+ text-rendering: optimizelegibility;
}
}
| 0 |
d7ba8408289601753b8f8f5298ac70ca1326b3b0
|
389ds/389-ds-base
|
Issue 6791 - crash in liblmdb during instance shutdown (#6793)
Sometime ns-slapd process crashes during the shutdown.
The core stacks shows that a thread attempts to use liblmdb after lmdb environment get closed
in one of thread specific data destructor callback.
The fix ensure that lmdb is not called after its environment get closed
Issue: #6791
Reviewed by: @droideck, @tbordaz (Thanks!)
|
commit d7ba8408289601753b8f8f5298ac70ca1326b3b0
Author: progier389 <[email protected]>
Date: Fri Jun 6 15:26:52 2025 +0200
Issue 6791 - crash in liblmdb during instance shutdown (#6793)
Sometime ns-slapd process crashes during the shutdown.
The core stacks shows that a thread attempts to use liblmdb after lmdb environment get closed
in one of thread specific data destructor callback.
The fix ensure that lmdb is not called after its environment get closed
Issue: #6791
Reviewed by: @droideck, @tbordaz (Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
index 7df538ed6..a794430e2 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_instance.c
@@ -97,6 +97,9 @@ typedef struct {
static dbmdb_dbi_t *dbi_slots; /* The alloced slots */
static int dbi_nbslots; /* Number of available slots in dbi_slots */
+static int32_t g_mdb_env_is_open = false;
+static void dbmdb_set_is_env_open(bool is_open);
+
/*
* twalk_r is not available before glibc-2.30 so lets replace it by twalk
* and a global variable (it is possible because there is a single call
@@ -729,6 +732,7 @@ int dbmdb_make_env(dbmdb_ctx_t *ctx, int readOnly, mdb_mode_t mode)
rc = mdb_env_open(env, ctx->home, flags, mode);
}
if (rc ==0) {
+ dbmdb_set_is_env_open(true);
rc = mdb_env_info(env, &envinfo);
}
if (rc ==0) { /* Update the INFO file with the real size provided by the db */
@@ -761,6 +765,7 @@ int dbmdb_make_env(dbmdb_ctx_t *ctx, int readOnly, mdb_mode_t mode)
}
if (rc != 0 && env) {
ctx->env = NULL;
+ dbmdb_set_is_env_open(false);
mdb_env_close(env);
}
return rc;
@@ -777,6 +782,7 @@ void dbmdb_ctx_close(dbmdb_ctx_t *ctx)
*/
}
if (ctx->env) {
+ dbmdb_set_is_env_open(false);
mdb_env_close(ctx->env);
ctx->env = NULL;
}
@@ -1750,7 +1756,7 @@ dbmdb_privdb_put(mdb_privdb_t *db, int dbi_idx, MDB_val *key, MDB_val *data)
}
-/* Create a private database environment */
+/* Create a private database environment (used to build entryrdn during import) */
mdb_privdb_t *
dbmdb_privdb_create(dbmdb_ctx_t *ctx, size_t dbsize, ...)
{
@@ -1833,3 +1839,15 @@ bail:
}
return db;
}
+
+bool
+dbmdb_is_env_open()
+{
+ return (bool) slapi_atomic_load_32(&g_mdb_env_is_open, __ATOMIC_ACQUIRE);
+}
+
+static void
+dbmdb_set_is_env_open(bool is_open)
+{
+ slapi_atomic_store_32(&g_mdb_env_is_open, (int32_t)is_open, __ATOMIC_RELEASE);
+}
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_layer.h b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_layer.h
index fe230d60e..fdc4a9288 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_layer.h
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_layer.h
@@ -504,6 +504,7 @@ int dbmdb_cmp_vals(MDB_val *v1, MDB_val *v2);
dbmdb_stats_t *dbdmd_gather_stats(dbmdb_ctx_t *conf, backend *be);
void dbmdb_free_stats(dbmdb_stats_t **stats);
int dbmdb_reset_vlv_file(backend *be, const char *filename);
+bool dbmdb_is_env_open(void);
/* mdb_txn.c */
void shutdown_mdbtxn(void);
diff --git a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_txn.c b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_txn.c
index 74088db89..7d2dfe36e 100644
--- a/ldap/servers/slapd/back-ldbm/db-mdb/mdb_txn.c
+++ b/ldap/servers/slapd/back-ldbm/db-mdb/mdb_txn.c
@@ -47,7 +47,9 @@ cleanup_mdbtxn_stack(void *arg)
slapi_ch_free((void**)&anchor);
while (txn) {
txn2 = txn->parent;
- TXN_ABORT(TXN(txn));
+ if (dbmdb_is_env_open()) {
+ TXN_ABORT(TXN(txn));
+ }
slapi_ch_free((void**)&txn);
txn = txn2;
}
| 0 |
555551993e029ba7947228f2d75f83b7f90002c6
|
389ds/389-ds-base
|
Ticket 48247 - Change the default user to 'dirsrv'
Description: Change the default user to 'dirsrv' instead of using nobody.
Then when we remove the last instance remove the user if
lib389 added it.
Also made some minor fixes.
https://fedorahosted.org/389/ticket/48247
Reviewed by: rmeggins(Thanks!)
|
commit 555551993e029ba7947228f2d75f83b7f90002c6
Author: Mark Reynolds <[email protected]>
Date: Fri Aug 14 15:54:05 2015 -0400
Ticket 48247 - Change the default user to 'dirsrv'
Description: Change the default user to 'dirsrv' instead of using nobody.
Then when we remove the last instance remove the user if
lib389 added it.
Also made some minor fixes.
https://fedorahosted.org/389/ticket/48247
Reviewed by: rmeggins(Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 614d64749..8dfe28fe0 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -39,6 +39,7 @@ import logging
import decimal
import glob
import tarfile
+import subprocess
from ldap.ldapobject import SimpleLDAPObject
from ldapurl import LDAPUrl
@@ -193,6 +194,8 @@ class DirSrv(SimpleLDAPObject):
self.inst -> equivalent to self.serverid
self.sroot/self.inst -> nsslapd-instancedir
self.dbdir -> dirname(nsslapd-directory)
+ self.bakdir -> nsslapd-bakdir
+ self.ldifdir -> nsslapd-ldifdir
@param - self
@@ -211,12 +214,16 @@ class DirSrv(SimpleLDAPObject):
'nsslapd-accesslog',
'nsslapd-auditlog',
'nsslapd-certdir',
- 'nsslapd-schemadir'])
+ 'nsslapd-schemadir',
+ 'nsslapd-bakdir',
+ 'nsslapd-ldifdir'])
self.errlog = ent.getValue('nsslapd-errorlog')
self.accesslog = ent.getValue('nsslapd-accesslog')
self.auditlog = ent.getValue('nsslapd-auditlog')
self.confdir = ent.getValue('nsslapd-certdir')
self.schemadir = ent.getValue('nsslapd-schemadir')
+ self.bakdir = ent.getValue('nsslapd-bakdir')
+ self.ldifdir = ent.getValue('nsslapd-ldifdir')
if self.isLocal:
if not self.confdir or not os.access(self.confdir + '/dse.ldif', os.R_OK):
@@ -606,8 +613,8 @@ class DirSrv(SimpleLDAPObject):
for instance in glob.glob(pattern):
serverid = os.path.basename(instance)[len(DEFAULT_ENV_HEAD):]
- # skip removed instance
- if '.removed' in serverid:
+ # skip removed instance and admin server entry
+ if '.removed' in serverid or 'dirsrv-admin' in instance:
continue
# it is found, store its properties in the list
@@ -804,6 +811,10 @@ class DirSrv(SimpleLDAPObject):
@raise None
'''
+
+ # Grab all the instances now, before we potentially remove the last one
+ insts = self.list(all=True)
+
if self.state == DIRSRV_STATE_ONLINE:
self.close()
@@ -824,6 +835,21 @@ class DirSrv(SimpleLDAPObject):
except:
log.exception("error executing %r" % cmd)
+ # If this was the last instance being deleted, remove the DEFAULT_USER
+ # if lib389 created the default user
+ if os.getuid() == 0:
+ # Only the root user could of added the entry
+ if len(insts) == 1:
+ # No more instances (this was the last one)
+ if pwd.getpwnam(DEFAULT_USER).pw_gecos == DEFAULT_USER_COMMENT:
+ # We created this user, so we will delete it
+ cmd = ['/usr/sbin/userdel', DEFAULT_USER]
+ try:
+ subprocess.call(cmd)
+ except subprocess.CalledProcessError as e:
+ log.exception('Failed to delete default user (%s): error %s' %
+ (DEFAULT_USER, e.output))
+
self.state = DIRSRV_STATE_ALLOCATED
def open(self):
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index 96b008e8d..efabfc68c 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -157,15 +157,16 @@ PLUGIN_WHOAMI = 'whoami'
#
# Constants
#
-DEFAULT_USER = "nobody"
+DEFAULT_USER = "dirsrv"
DEFAULT_USERHOME = "/tmp/lib389_home"
+DEFAULT_USER_COMMENT = "lib389 DS user"
DATA_DIR = "data"
TMP_DIR = "tmp"
VALGRIND_WRAPPER = "ns-slapd.valgrind"
DISORDERLY_SHUTDOWN = 'Detected Disorderly Shutdown last time Directory Server was running, recovering database'
#
-# LOG: see https://access.redhat.com/site/documentation/en-US/Red_Hat_Directory_Server/9.0/html/Administration_Guide/Configuring_Logs.html
+# LOG: see https://access.redhat.com/documentation/en-US/Red_Hat_Directory_Server/10/html/Administration_Guide/Configuring_Logs.html
# The default log level is 16384
#
(
diff --git a/src/lib389/lib389/tools.py b/src/lib389/lib389/tools.py
index aa04165d5..d681172ed 100644
--- a/src/lib389/lib389/tools.py
+++ b/src/lib389/lib389/tools.py
@@ -848,7 +848,7 @@ class DirSrvTools(object):
except KeyError:
print "Adding user %s" % user
cmd = [USERADD, '-g', group,
- '-c', "lib389 DS user",
+ '-c', DEFAULT_USER_COMMENT,
'-r',
'-d', home,
'-s', NOLOGIN,
@@ -858,6 +858,7 @@ class DirSrvTools(object):
@staticmethod
def lib389User(user=DEFAULT_USER):
DirSrvTools.makeGroup(group=user)
+ time.sleep(1) # Need a little time for the group to get fully created
DirSrvTools.makeUser(user=user, group=user, home=DEFAULT_USERHOME)
@staticmethod
| 0 |
4a103859b7100bc30046ecba3efca2e8f0b09c7d
|
389ds/389-ds-base
|
Bug 610177 - fix coverity Defect Type: Uninitialized variables issues
https://bugzilla.redhat.com/show_bug.cgi?id=610177
Resolves: bug 610177
Bug Description: fix coverity Defect Type: Uninitialized variables issues
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: Initialize variables to 0, NULL, or an appropriate error
code. Got rid of the unused lexer code.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
|
commit 4a103859b7100bc30046ecba3efca2e8f0b09c7d
Author: Rich Megginson <[email protected]>
Date: Thu Jul 1 11:39:02 2010 -0600
Bug 610177 - fix coverity Defect Type: Uninitialized variables issues
https://bugzilla.redhat.com/show_bug.cgi?id=610177
Resolves: bug 610177
Bug Description: fix coverity Defect Type: Uninitialized variables issues
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: Initialize variables to 0, NULL, or an appropriate error
code. Got rid of the unused lexer code.
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/Makefile.am b/Makefile.am
index 67ccd0f25..24fdd0eaf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -533,7 +533,6 @@ libns_dshttpd_la_SOURCES = lib/libaccess/access_plhash.cpp \
lib/base/ereport.cpp \
lib/base/file.cpp \
lib/base/fsmutex.cpp \
- lib/base/lexer.cpp \
lib/base/net.cpp \
lib/base/nscperror.c \
lib/base/plist.cpp \
diff --git a/Makefile.in b/Makefile.in
old mode 100755
new mode 100644
index 0bab8528b..23cbdcf6d
--- a/Makefile.in
+++ b/Makefile.in
@@ -335,7 +335,6 @@ am_libns_dshttpd_la_OBJECTS = \
lib/base/libns_dshttpd_la-ereport.lo \
lib/base/libns_dshttpd_la-file.lo \
lib/base/libns_dshttpd_la-fsmutex.lo \
- lib/base/libns_dshttpd_la-lexer.lo \
lib/base/libns_dshttpd_la-net.lo \
lib/base/libns_dshttpd_la-nscperror.lo \
lib/base/libns_dshttpd_la-plist.lo \
@@ -1608,7 +1607,6 @@ libns_dshttpd_la_SOURCES = lib/libaccess/access_plhash.cpp \
lib/base/ereport.cpp \
lib/base/file.cpp \
lib/base/fsmutex.cpp \
- lib/base/lexer.cpp \
lib/base/net.cpp \
lib/base/nscperror.c \
lib/base/plist.cpp \
@@ -3156,8 +3154,6 @@ lib/base/libns_dshttpd_la-file.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
-lib/base/libns_dshttpd_la-lexer.lo: lib/base/$(am__dirstamp) \
- lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-net.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-nscperror.lo: lib/base/$(am__dirstamp) \
@@ -5084,8 +5080,6 @@ mostlyclean-compile:
-rm -f lib/base/libns_dshttpd_la-file.lo
-rm -f lib/base/libns_dshttpd_la-fsmutex.$(OBJEXT)
-rm -f lib/base/libns_dshttpd_la-fsmutex.lo
- -rm -f lib/base/libns_dshttpd_la-lexer.$(OBJEXT)
- -rm -f lib/base/libns_dshttpd_la-lexer.lo
-rm -f lib/base/libns_dshttpd_la-net.$(OBJEXT)
-rm -f lib/base/libns_dshttpd_la-net.lo
-rm -f lib/base/libns_dshttpd_la-nscperror.$(OBJEXT)
@@ -5587,7 +5581,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-ereport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-fsmutex.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-net.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-nscperror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-plist.Plo@am__quote@
@@ -9265,13 +9258,6 @@ lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/fsmutex.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lib/base/libns_dshttpd_la-fsmutex.lo `test -f 'lib/base/fsmutex.cpp' || echo '$(srcdir)/'`lib/base/fsmutex.cpp
-lib/base/libns_dshttpd_la-lexer.lo: lib/base/lexer.cpp
-@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lib/base/libns_dshttpd_la-lexer.lo -MD -MP -MF "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo" -c -o lib/base/libns_dshttpd_la-lexer.lo `test -f 'lib/base/lexer.cpp' || echo '$(srcdir)/'`lib/base/lexer.cpp; \
-@am__fastdepCXX_TRUE@ then mv -f "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo" "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Plo"; else rm -f "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/base/lexer.cpp' object='lib/base/libns_dshttpd_la-lexer.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lib/base/libns_dshttpd_la-lexer.lo `test -f 'lib/base/lexer.cpp' || echo '$(srcdir)/'`lib/base/lexer.cpp
-
lib/base/libns_dshttpd_la-net.lo: lib/base/net.cpp
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lib/base/libns_dshttpd_la-net.lo -MD -MP -MF "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo" -c -o lib/base/libns_dshttpd_la-net.lo `test -f 'lib/base/net.cpp' || echo '$(srcdir)/'`lib/base/net.cpp; \
@am__fastdepCXX_TRUE@ then mv -f "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo" "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Plo"; else rm -f "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo"; exit 1; fi
diff --git a/include/base/lexer.h b/include/base/lexer.h
deleted file mode 100644
index e8fd8bb9c..000000000
--- a/include/base/lexer.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * 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; version 2 of the License.
- *
- * 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., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef __lexer_h
-#define __lexer_h
-
-#ifndef _POOL_H_
-#include "base/pool.h"
-#endif /* _POOL_H_ */
-
-/* Define error codes */
-#define LEXERR_MALLOC -1 /* insufficient dynamic memory */
-
-
-typedef struct LEXStream_s LEXStream_t;
-typedef int (*LEXStreamGet_t)(LEXStream_t *);
-struct LEXStream_s {
- LEXStream_t * lst_next; /* link for "include" parent stream */
- void * lst_strmid; /* client stream identifier */
- LEXStreamGet_t lst_get; /* pointer to stream "get" function */
- char * lst_buf; /* stream buffer pointer */
- char * lst_cp; /* current position in buffer */
- int lst_len; /* remaining bytes in buffer */
- int lst_buflen; /* buffer length */
- int lst_flags; /* bit flags */
-#define LST_FREEBUF 0x1 /* free lst_buf in stream destroy */
-};
-NSPR_BEGIN_EXTERN_C
-
-/* Functions in lexer.c */
-NSAPI_PUBLIC
-int lex_class_check(void * chtab, char code, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_class_create(int classc, char * classv[], void **pchtab);
-
-NSAPI_PUBLIC void lex_class_destroy(void * chtab);
-
-NSAPI_PUBLIC
-LEXStream_t * lex_stream_create(LEXStreamGet_t strmget, void * strmid,
- char * buf, int buflen);
-
-NSAPI_PUBLIC void lex_stream_destroy(LEXStream_t * lst);
-
-NSAPI_PUBLIC int
-lex_token_new(pool_handle_t * pool, int initlen, int growlen, void **token);
-
-NSAPI_PUBLIC int lex_token_start(void * token);
-
-NSAPI_PUBLIC
-char * lex_token_info(void * token, int * tdatalen, int * tbufflen);
-
-NSAPI_PUBLIC char * lex_token(void * token);
-
-NSAPI_PUBLIC void lex_token_destroy(void * token);
-
-NSAPI_PUBLIC
-char * lex_token_get(void * token, int * tdatalen, int * tbufflen);
-
-NSAPI_PUBLIC char * lex_token_take(void * token);
-
-NSAPI_PUBLIC
-int lex_token_append(void * token, int nbytes, char * src);
-
-NSAPI_PUBLIC
-int lex_next_char(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_scan_over(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token);
-
-NSAPI_PUBLIC
-int lex_scan_string(LEXStream_t * lst, void * token, int flags);
-
-NSAPI_PUBLIC
-int lex_scan_to(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token);
-
-NSAPI_PUBLIC
-int lex_skip_over(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_skip_to(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSPR_END_EXTERN_C
-
-#endif /* __lexer_h */
diff --git a/include/libaccess/aclstruct.h b/include/libaccess/aclstruct.h
index 6d464ffc7..9f5da2506 100644
--- a/include/libaccess/aclstruct.h
+++ b/include/libaccess/aclstruct.h
@@ -52,7 +52,6 @@
#include "base/systems.h"
#include "base/file.h"
-#include "base/lexer.h"
#include "nsauth.h" /* authentication types */
#include "symbols.h" /* typed symbol support */
#include "ipfstruct.h" /* IP address filter structures */
@@ -288,7 +287,6 @@ typedef struct ACLFile_s ACLFile_t;
struct ACLFile_s {
ACLFile_t * acf_next; /* list link */
char * acf_filename; /* pointer to filename string */
- LEXStream_t * acf_lst; /* LEX stream handle */
SYS_FILE acf_fd; /* file descriptor */
int acf_flags; /* bit flags (unused) */
int acf_lineno; /* current line number */
diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c
index 01c05fd22..190e26df8 100644
--- a/ldap/servers/plugins/bitwise/bitwise.c
+++ b/ldap/servers/plugins/bitwise/bitwise.c
@@ -123,7 +123,7 @@ internal_bitwise_filter_match(void* obj, Slapi_Entry* entry, Slapi_Attr* attr, i
if (errno == ERANGE) {
rc = LDAP_CONSTRAINT_VIOLATION;
} else {
- int result;
+ int result = 0;
/* The Microsoft Windows AD bitwise operators do not work exactly
as the plain old C bitwise operators work. For the AND case
the matching rule is true only if all bits from the given value
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index b5aace632..bc79ee5ce 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -1101,7 +1101,7 @@ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) {
static int cos_cache_add_dn_defs(char *dn, cosDefinitions **pDefs, int *vattr_cacheable)
{
Slapi_PBlock *pDnSearch = 0;
- struct dn_defs_info info;
+ struct dn_defs_info info = {NULL, 0, 0};
pDnSearch = slapi_pblock_new();
if (pDnSearch) {
info.ret=-1; /* assume no good defs */
@@ -1314,7 +1314,7 @@ static int cos_cache_add_dn_tmpls(char *dn, cosAttrValue *pCosSpecifier, cosAttr
{
void *plugin_id;
int scope;
- struct tmpl_info info;
+ struct tmpl_info info = {NULL, 0, 0};
Slapi_PBlock *pDnSearch = 0;
LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_dn_tmpls\n",0,0,0);
@@ -1714,7 +1714,7 @@ int cos_cache_getref(cos_cache **pptheCache)
*/
int cos_cache_addref(cos_cache *ptheCache)
{
- int ret;
+ int ret = 0;
cosCache *pCache = (cosCache*)ptheCache;
LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_addref\n",0,0,0);
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index bd285184d..aacdc557b 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -639,7 +639,7 @@ perform_operation(Repl_Connection *conn, int optype, const char *dn,
int deleteoldrdn, LDAPControl *update_control,
const char *extop_oid, struct berval *extop_payload, int *message_id)
{
- int rc;
+ int rc = -1;
ConnResult return_value = CONN_OPERATION_FAILED;
LDAPControl *server_controls[3];
/* LDAPControl **loc_returned_controls; */
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 6475eb89b..e4c6e2bd1 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -1384,7 +1384,7 @@ reset_events (Private_Repl_Protocol *prp)
ConnResult
replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op, int *message_id)
{
- ConnResult return_value;
+ ConnResult return_value = CONN_OPERATION_FAILED;
LDAPControl *update_control;
char *parentuniqueid;
LDAPMod **modrdn_mods = NULL;
@@ -2202,7 +2202,7 @@ examine_update_vector(Private_Repl_Protocol *prp, RUV *remote_ruv)
static PRBool
ignore_error_and_keep_going(int error)
{
- int return_value;
+ int return_value = PR_FALSE;
switch (error)
{
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index a1e74c444..8aabfdbba 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -306,7 +306,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
const char *extop_oid, struct berval *extop_payload, char **retoidp,
struct berval **retdatap, LDAPControl ***returned_controls)
{
- int rc = LDAP_SUCCESS;
+ int rc = -1;
ConnResult return_value;
LDAPControl **loc_returned_controls;
const char *op_string = NULL;
@@ -316,7 +316,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
if (windows_conn_connected(conn))
{
- int msgid;
+ int msgid = -2; /* should match no messages */
conn->last_operation = optype;
switch (optype)
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 65de19dd4..3c6b4d4c4 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -1640,7 +1640,7 @@ is_straight_mapped_attr(const char *type, int is_user /* or group */, int is_nt4
static int
is_single_valued_attr(const char *type)
{
- int found;
+ int found = 0;
size_t offset = 0;
char *this_attr = NULL;
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c
index a6646d897..4a884b79c 100644
--- a/ldap/servers/plugins/views/views.c
+++ b/ldap/servers/plugins/views/views.c
@@ -1296,7 +1296,7 @@ static int views_dn_views_cb (Slapi_Entry* e, void *callback_data) {
static int views_cache_add_dn_views(char *dn, viewEntry **pViews)
{
Slapi_PBlock *pDnSearch = 0;
- struct dn_views_info info;
+ struct dn_views_info info = {NULL, -1};
pDnSearch = slapi_pblock_new();
if (pDnSearch) {
info.ret=-1;
diff --git a/ldap/servers/slapd/back-ldbm/idl.c b/ldap/servers/slapd/back-ldbm/idl.c
index be5644675..ca3707682 100644
--- a/ldap/servers/slapd/back-ldbm/idl.c
+++ b/ldap/servers/slapd/back-ldbm/idl.c
@@ -1272,7 +1272,7 @@ void idl_insert(IDList **idl, ID id)
static int
idl_insert_maxids( IDList **idl, ID id, int maxids )
{
- ID i, j;
+ ID i = 0, j = 0;
NIDS nids;
if ( ALLIDS( *idl ) ) {
diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c
index 6456f2993..98d9a9619 100644
--- a/ldap/servers/slapd/backend_manager.c
+++ b/ldap/servers/slapd/backend_manager.c
@@ -391,7 +391,7 @@ be_unbindall(Connection *conn, Operation *op)
if ( plugin_call_plugins( &pb, SLAPI_PLUGIN_PRE_UNBIND_FN ) == 0 )
{
- int rc;
+ int rc = 0;
slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
if(backends[i]->be_state != BE_STATE_DELETED &&
backends[i]->be_unbind!=NULL)
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index a67ec2ac4..f24c9189a 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -613,7 +613,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
Slapi_DN *subtree = NULL;
const char *tmp_ndn;
int be_list_count = 0;
- int be_list_size;
+ int be_list_size = 0;
backend **be_list = NULL;
char **be_names = NULL;
int * be_states = NULL;
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index 4d1ac6a3d..19805a8ca 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -2238,7 +2238,7 @@ getPending (
{
LDAPMessage *res; /* LDAP async results */
int ret; /* Return values */
- int expected; /* Expect this type */
+ int expected = 0; /* Expect this type */
char *verb; /* LDAP verb expected */
int type; /* Message type */
int errcodep; /* Async error code */
diff --git a/lib/base/lexer.cpp b/lib/base/lexer.cpp
deleted file mode 100644
index 237edf0d5..000000000
--- a/lib/base/lexer.cpp
+++ /dev/null
@@ -1,1015 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * 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; version 2 of the License.
- *
- * 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., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-
-/*
- * Description (lexer.c)
- *
- * This module provides functions to assist parsers in lexical
- * analysis. The idea is to provide a slightly higher-level
- * interface than that of ctype.h.
- */
-
-#include "netsite.h"
-#include "prlog.h"
-
-#include "lexer_pvt.h"
-#include "base/lexer.h"
-
-/*
- * Description (lex_class_check)
- *
- * This function checks whether a given character belongs to one or
- * specified character classes.
- *
- * Arguments:
- *
- * chtab - character class table pointer
- * code - character code to be tested
- * cbits - bit mask of character classes
- *
- * Returns:
- *
- * The return value is zero if the code is not in any of the character
- * classes. It is non-zero, if the code is in at least one of the
- * classes.
- */
-NSAPI_PUBLIC
-int lex_class_check(void * chtab, char code, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- int rv = 0; /* return value */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- bp = lct->lct_bv + code * lct->lct_bvbytes;
-
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & cbits) {
- rv = 1;
- break;
- }
- cbits >>= 8;
- }
-
- return rv;
-}
-
-/*
- * Description (lex_class_create)
- *
- * This function creates a new character class table. A
- * character class table is used to map a character code to a
- * set of character classes. The mapping for a given character
- * is expressed as a bit vector, where each bit indicates the
- * membership of that character in one of the character classes.
- *
- * Arguments:
- *
- * classc - the number of character classes being defined
- * classv - pointers to null-terminated strings containing
- * the character codes in each character class
- * pchtab - indicates where to store a returned handle for
- * the character class table
- *
- * Returns:
- *
- * If successful, the return value is the number of character
- * classes specified (classc), and a handle for the created table
- * is returned through pchtab.
- *
- * Usage Notes:
- *
- * Null (\000) can never be in any character classes, since it
- * marks the end of the classv[] strings.
- *
- * classv[] can included NULL pointers, in which case bits will be
- * allocated for corresponding empty character classes.
- */
-NSAPI_PUBLIC
-int lex_class_create(int classc, char * classv[], void **pchtab)
-{
- int ncodes = 128; /* number of character encodings */
- int bvbytes; /* bytes per bit vector */
- LEXClassTab_t * ct; /* class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* class string pointer */
- int bitmask; /* class bit mask */
- int bnum; /* byte number in bit vector */
- int ci; /* character index */
- int i; /* class index */
-
- /* Get number of bytes per bit vector */
- PR_ASSERT(classc > 0);
- bvbytes = (classc + 7) >> 3;
-
- /* Allocate the character class table */
- ct = (LEXClassTab_t *)calloc(1, sizeof(LEXClassTab_t) + ncodes * bvbytes);
- if (ct == NULL) {
-
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
-
- /* Initialize the class table */
- ct->lct_classc = classc;
- ct->lct_bvbytes = bvbytes;
- ct->lct_bv = (unsigned char *)(ct + 1);
-
- /* Initialize the bit vectors */
- for (i = 0; i < classc; ++i) {
-
- cp = classv[i];
- if (cp != NULL) {
-
- bitmask = 1 << (i & 7);
- bnum = i >> 7;
-
- while ((ci = *cp++) != 0) {
- bp = ct->lct_bv + ci + bnum;
- *bp |= bitmask;
- }
- }
- }
-
- /* Return pointer to table */
- PR_ASSERT(pchtab != NULL);
- *pchtab = (void *)ct;
-
- return classc;
-}
-
-NSAPI_PUBLIC
-void lex_class_destroy(void * chtab)
-{
- FREE((void *)chtab);
-}
-
-NSAPI_PUBLIC
-LEXStream_t * lex_stream_create(LEXStreamGet_t strmget, void * strmid,
- char * buf, int buflen)
-{
- LEXStream_t * lst; /* stream structure pointer */
-
- /* Allocate the stream structure */
- lst = (LEXStream_t *)MALLOC(sizeof(LEXStream_t));
- if (lst == NULL) {
- /* Error - insufficient memory */
- return 0;
- }
-
- lst->lst_strmid = strmid;
- lst->lst_get = strmget;
-
- /*
- * Allocate a buffer for the stream if there's a positive length
- * but a NULL buffer pointer.
- */
- if ((buflen > 0) && (buf == NULL)) {
-
- buf = (char *)MALLOC(buflen);
- if (buf == NULL) {
- FREE((void *)lst);
- return 0;
- }
-
- /* Also initialize the current position and residual length */
- lst->lst_cp = buf;
- lst->lst_len = 0;
- lst->lst_flags = LST_FREEBUF;
- }
-
- lst->lst_buf = buf;
- lst->lst_buflen = buflen;
-
- return lst;
-}
-
-NSAPI_PUBLIC
-void lex_stream_destroy(LEXStream_t * lst)
-{
- if ((lst->lst_flags & LST_FREEBUF) && (lst->lst_buf != NULL)) {
- FREE(lst->lst_buf);
- }
- FREE((void *)lst);
-}
-
-/*
- * Description (lex_token_new)
- *
- * This function creates a new token object. A token object is
- * used to accumulate text in an associated buffer. If the
- * 'growlen' argument is specified as a value that is greater
- * than zero, then the token buffer will be reallocated as
- * necessary to accomodate more text. The initial size of
- * the token buffer is given by 'initlen', which may be zero,
- * and should be zero if lex_token_setbuf() is used.
- *
- * The token object is allocated from the memory pool given
- * by the 'pool' argument. The default pool for the current
- * thread is used if 'pool' is null.
- *
- * Arguments:
- *
- * pool - handle for memory pool to be used
- * initlen - initial length of token buffer
- * growlen - amount to grow a full token buffer
- * token - pointer to returned token handle
- *
- * Returns:
- *
- * If successful, the function return value is zero and a handle
- * for the new token is returned via 'token'. Otherwise a negative
- * error code is returned.
- */
-
-NSAPI_PUBLIC
-int lex_token_new(pool_handle_t * pool, int initlen, int growlen, void **token)
-{
- LEXToken_t * lt; /* new token pointer */
-
- /* Allocate the token structure */
- if (pool) {
- lt = (LEXToken_t *)pool_calloc(pool, 1, sizeof(LEXToken_t));
- }
- else {
- lt = (LEXToken_t *)CALLOC(sizeof(LEXToken_t));
- }
- if (lt == NULL) {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
-
- /* Save the memory pool handle for future allocations */
- lt->lt_mempool = pool;
-
- /* Allocate the initial token buffer if initlen > 0 */
- if (initlen > 0) {
- if (pool) {
- lt->lt_buf = (char *)pool_malloc(pool, initlen);
- }
- else {
- lt->lt_buf = (char *)MALLOC(initlen);
- }
- if (lt->lt_buf == NULL) {
- /* Error - insufficient memory */
- if (pool) {
- pool_free(pool, (void *)lt);
- }
- else {
- FREE((void *)lt);
- }
- return LEXERR_MALLOC;
- }
-
- lt->lt_initlen = initlen;
- lt->lt_buflen = initlen;
- lt->lt_buf[0] = 0;
- }
-
- if (growlen > 0) lt->lt_inclen = growlen;
-
- PR_ASSERT(token != NULL);
- *token = (void *)lt;
-
- return 0;
-}
-
-/*
- * Description (lex_token_start)
- *
- * This function discards any current contents of the token buffer
- * associated with a specified token object, so that any new data
- * appended to the token will start at the beginning of the token
- * buffer. If there is no token buffer currently associated with
- * the token, and the 'initlen' value specified to lex_token_new()
- * was greater than zero, then a new token buffer is allocated.
- * This function enables a token and optionally its token buffer
- * to be reused.
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * If successful, the function return value is zero. Otherwise
- * a negative error code is returned.
- */
-
-NSAPI_PUBLIC int
-lex_token_start(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- /* Do we need to allocate a token buffer? */
- if ((lt->lt_buf == NULL) && (lt->lt_initlen > 0)) {
-
- /* Allocate the initial token buffer */
- if (lt->lt_mempool) {
- lt->lt_buf = (char *)pool_malloc(lt->lt_mempool, lt->lt_initlen);
- }
- else {
- lt->lt_buf = (char *)MALLOC(lt->lt_initlen);
- }
- if (lt->lt_buf == NULL) {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
- lt->lt_buflen = lt->lt_initlen;
- }
-
- lt->lt_len = 0;
- lt->lt_buf[0] = 0;
-
- return 0;
-}
-
-/*
- * Description (lex_token_info)
- *
- * This function returns information about the token buffer currently
- * associated with a token object. This includes a pointer to the
- * token data, if any, the current length of the token data, and the
- * current size of the token buffer.
- *
- * Arguments:
- *
- * token - handle for token object
- * tdatalen - pointer to returned token data length
- * (may be null)
- * tbufflen - pointer to returned token buffer length
- * (may be null)
- *
- * Returns:
- *
- * The function return value is a pointer to the beginning of the
- * token data, or null if there is no token buffer associated with
- * the token. The token data length and token buffer length are
- * returned via 'tdatalen' and 'tbufflen', respectively.
- */
-
-NSAPI_PUBLIC
-char * lex_token_info(void * token, int * tdatalen, int * tbufflen)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- if (tdatalen) *tdatalen = lt->lt_len;
- if (tbufflen) *tbufflen = lt->lt_buflen;
-
- return lt->lt_buf;
-}
-
-/*
- * Description (lex_token)
- *
- * This function returns a pointer to the current token buffer, if any.
- * If the length of the token is also needed, use lex_token_info().
- * This function would normally be used when the token is a
- * null-terminated string. See also lex_token_take().
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * A pointer to the beginning of the current token is returned.
- * The pointer is null if no token buffer is currently associated
- * with the token object.
- */
-
-NSAPI_PUBLIC
-char * lex_token(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- return lt->lt_buf;
-}
-
-/*
- * Description (lex_token_destroy)
- *
- * This function destroys a specified token object. The memory
- * associated with the token object and its token buffer, if any,
- * is freed to whence it came. Note that token objects can be
- * associated with a memory pool, and destroyed implicitly when
- * the pool is destroyed via pool_destroy().
- *
- * Arguments:
- *
- * token - handle for token object
- */
-
-NSAPI_PUBLIC
-void lex_token_destroy(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- if (lt) {
- if (lt->lt_mempool) {
- if (lt->lt_buf) {
- pool_free(lt->lt_mempool, (void *)(lt->lt_buf));
- }
- pool_free(lt->lt_mempool, (void *)lt);
- }
- else {
- if (lt->lt_buf) {
- FREE(lt->lt_buf);
- }
- FREE(lt);
- }
- }
-}
-
-/*
- * Description (lex_token_get)
- *
- * This function returns a pointer to the current token buffer,
- * leaving the token with no associated token buffer. The caller
- * assumes ownership of the returned token buffer. The length
- * of the token data and the length of the token buffer are returned
- * if requested. Note that lex_token_take() performs a similar
- * operation.
- *
- * Arguments:
- *
- * token - handle for token object
- * tdatalen - pointer to returned token data length
- * (may be null)
- * tbufflen - pointer to returned token buffer length
- * (may be null)
- *
- * Returns:
- *
- * The function return value is a pointer to the beginning of the
- * token data, or null if there is no token buffer associated with
- * the token. The token data length and token buffer length are
- * returned via 'tdatalen' and 'tbufflen', respectively.
- */
-
-NSAPI_PUBLIC
-char * lex_token_get(void * token, int * tdatalen, int * tbufflen)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- char * tokenstr;
-
- tokenstr = lt->lt_buf;
- if (tdatalen) *tdatalen = lt->lt_len;
- if (tbufflen) *tbufflen = lt->lt_buflen;
-
- lt->lt_buf = NULL;
- lt->lt_buflen = 0;
- lt->lt_len = 0;
-
- return tokenstr;
-}
-
-/*
- * Description (lex_token_take)
- *
- * This function returns a pointer to the current token buffer,
- * leaving the token with no associated token buffer. The caller
- * assumes ownership of the returned token buffer. Note that
- * lex_token_get() performs a similar operation, but returns more
- * information.
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * A pointer to the beginning of the current token is returned.
- * The pointer is null if no token buffer is currently associated
- * with the token object.
- */
-
-NSAPI_PUBLIC
-char * lex_token_take(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- char * tokenstr;
-
- tokenstr = lt->lt_buf;
-
- lt->lt_buf = NULL;
- lt->lt_buflen = 0;
- lt->lt_len = 0;
-
- return tokenstr;
-}
-
-/*
- * Description (lex_token_append)
- *
- * This function appends data to the end of a token. If 'growlen'
- * was specified as a greater-than-zero value for lex_token_new(),
- * then the token buffer may be reallocated to accomodate the
- * new data if necessary. A null byte is maintained in the token
- * buffer following the token data, but it is not included in the
- * token data length.
- *
- * Arguments:
- *
- * token - handle for token object
- * nbytes - number of bytes of new data
- * src - pointer to new data
- *
- * Returns:
- *
- * If successful, the function return value is the new length of
- * the token data. Otherwise a negative error code is returned.
- */
-
-NSAPI_PUBLIC
-int lex_token_append(void * token, int nbytes, char * src)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- int bufsize;
- int length;
-
- PR_ASSERT(nbytes >= 0);
- PR_ASSERT((src != NULL) || (nbytes == 0));
-
- if (nbytes > 0) {
-
- bufsize = lt->lt_buflen;
- length = lt->lt_len + nbytes;
-
- if (length >= bufsize) {
-
- while (length >= bufsize) {
- bufsize += lt->lt_inclen;
- }
-
- if (lt->lt_mempool) {
- if (lt->lt_buf) {
- lt->lt_buf = (char *)pool_realloc(lt->lt_mempool,
- lt->lt_buf, bufsize);
- }
- else {
- lt->lt_buf = (char *)pool_malloc(lt->lt_mempool, bufsize);
- }
- }
- else {
- if (lt->lt_buf) {
- lt->lt_buf = (char *)REALLOC(lt->lt_buf, bufsize);
- }
- else {
- lt->lt_buf = (char *)MALLOC(bufsize);
- }
- }
- }
-
- if (lt->lt_buf) {
-
- memcpy((void *)(lt->lt_buf + lt->lt_len), (void *)src, nbytes);
- lt->lt_buf[length] = 0;
- lt->lt_len = length;
- lt->lt_buflen = bufsize;
- }
- else {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
- }
-
- return lt->lt_len;
-}
-
-NSAPI_PUBLIC
-int lex_next_char(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv; /* return value */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- /* Get the next character from the buffer */
- rv = *lst->lst_cp;
-
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
-
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- /* Update the buffer pointer and length */
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- break;
- }
- bitmask >>= 8;
- }
-
- return rv;
-}
-
-NSAPI_PUBLIC
-int lex_scan_over(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned char * bp; /* bit vector pointer */
- unsigned long bitmask; /* class bit mask temporary */
- int cv = 0; /* current character value */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- cv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + cv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) goto more_token;
- bitmask >>= 8;
- }
-
- done = 1;
- break;
-
- more_token:
- slen += 1;
- cp += 1;
- }
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-/*
- * Description (lex_scan_string)
- *
- * This function parses a quoted string into the specified token.
- * The current character in the LEX stream is taken to be the
- * beginning quote character. The quote character may be included
- * in the string by preceding it with a '\'. Any newline
- * characters to be included in the string must also be preceded
- * by '\'. The string is terminated by another occurrence of the
- * quote character, or an unquoted newline, or EOF.
- *
- * Arguments:
- *
- * lst - pointer to LEX stream structure
- * token - handle for token
- * flags - bit flags (unused - must be zero)
- *
- * Returns:
- *
- * The terminating character is returned, or zero if EOF. The
- * string is returned in the token, without the beginning and
- * ending quote characters. An error is indicated by a negative
- * return value.
- */
-
-NSAPI_PUBLIC
-int lex_scan_string(LEXStream_t * lst, void * token, int flags)
-{
- char * cp; /* current pointer in stream buffer */
- int cv; /* current character value */
- int rv; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int cquote = 0; /* character quote indication */
- int qchar = -1; /* quote character */
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
-
- /* Get the next character */
- cv = *cp;
-
- /* Pick up the quote character if we don't have it yet */
- if (qchar < 0) {
- qchar = cv;
-
- /* Don't include it in the string */
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- cp += 1;
- continue;
- }
-
- /* cquote is 1 if the last character was '\' */
- if (cquote == 0) {
-
- /* Is this a string terminator? */
- if ((cv == qchar) || (cv == '\n')) {
-
- /* Append whatever we have to this point */
- if (slen > 0) goto append_it;
-
- /*
- * If the terminator is the expected quote character,
- * just skip it. If it's anything else, leave it as
- * the current character.
- */
- if (cv == qchar) {
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- }
-
- done = 1;
- goto append_it;
- }
-
- /* Got the character quote character? */
- if (cv == '\\') {
-
- /* Append anything we have so far first */
- if (slen > 0) goto append_it;
-
- /* Then skip the character */
- cquote = 1;
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- cp += 1;
- continue;
- }
- }
- else {
-
- /* Include any character following '\' */
- cquote = 0;
- }
-
- /* Include this character in the string */
- slen += 1;
- cp += 1;
- }
-
- append_it:
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-NSAPI_PUBLIC
-int lex_scan_to(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int cv = 0; /* current character value */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- cv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + cv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- done = 1;
- goto append_it;
- }
- bitmask >>= 8;
- }
-
- slen += 1;
- cp += 1;
- }
-
- append_it:
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-NSAPI_PUBLIC
-int lex_skip_over(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- rv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) goto next_ch;
- bitmask >>= 8;
- }
-
- done = 1;
- break;
-
- next_ch:
- slen += 1;
- cp += 1;
- }
-
- if (slen > 0) {
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return rv;
-}
-
-NSAPI_PUBLIC
-int lex_skip_to(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- rv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- done = 1;
- goto update_it;
- }
- bitmask >>= 8;
- }
- slen += 1;
- cp += 1;
- }
-
- update_it:
- /* Update the stream buffer pointer and length */
- if (slen > 0) {
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return rv;
-}
diff --git a/ltmain.sh b/ltmain.sh
old mode 100755
new mode 100644
| 0 |
171a347644f416113ccb5620b2ccf7c2a84756bf
|
389ds/389-ds-base
|
Bump version to 2.4.3
|
commit 171a347644f416113ccb5620b2ccf7c2a84756bf
Author: Mark Reynolds <[email protected]>
Date: Thu Aug 3 13:14:40 2023 -0400
Bump version to 2.4.3
diff --git a/VERSION.sh b/VERSION.sh
index f765f1139..9176fbd3b 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=4
-VERSION_MAINT=2
+VERSION_MAINT=3
# 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)
| 0 |
0ad1dd2ed0d54fd7c08fea8d3d344b91aff5f6a8
|
389ds/389-ds-base
|
Ticket 50257 - lib389 - password policy user vs subtree checks are broken
Description: We were not properly checking for user verses subtree policies.
This patch cleaned up alot of flawed code, and properly uses
DSLdapObjects to find policies and process them.
https://pagure.io/389-ds-base/issue/50257
Reviewed by: firstyear(Thanks!)
|
commit 0ad1dd2ed0d54fd7c08fea8d3d344b91aff5f6a8
Author: Mark Reynolds <[email protected]>
Date: Sat Mar 2 11:12:49 2019 -0500
Ticket 50257 - lib389 - password policy user vs subtree checks are broken
Description: We were not properly checking for user verses subtree policies.
This patch cleaned up alot of flawed code, and properly uses
DSLdapObjects to find policies and process them.
https://pagure.io/389-ds-base/issue/50257
Reviewed by: firstyear(Thanks!)
diff --git a/src/lib389/lib389/_mapped_object.py b/src/lib389/lib389/_mapped_object.py
index a035f6566..203b81532 100644
--- a/src/lib389/lib389/_mapped_object.py
+++ b/src/lib389/lib389/_mapped_object.py
@@ -928,6 +928,25 @@ class DSLdapObjects(DSLogging):
insts = []
return insts
+ def exists(self, selector=[], dn=None):
+ """Check if a child entry exists
+
+ :returns: True if it exists
+ """
+ results = []
+ try:
+ if dn is not None:
+ results = self._get_dn(dn)
+ else:
+ results = self._get_selector(selector)
+ except:
+ return False
+
+ if len(results) == 1:
+ return True
+ else:
+ return False
+
def get(self, selector=[], dn=None, json=False):
"""Get a child entry (DSLdapObject, Replica, etc.) with dn or selector
using a base DN and objectClasses of our object (DSLdapObjects, Replicas, etc.)
diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py
index 6175cc30a..d94e4e436 100644
--- a/src/lib389/lib389/cli_base/__init__.py
+++ b/src/lib389/lib389/cli_base/__init__.py
@@ -271,6 +271,7 @@ def _generic_del_attr(inst, basedn, log, manager_class, args=None):
# Missing value
raise ValueError("Missing attribute to delete")
+
def _generic_modify_change_to_mod(change):
values = change.split(":")
if len(values) <= 2:
@@ -295,6 +296,7 @@ def _generic_modify_change_to_mod(change):
else:
raise ValueError("Unknown action '%s'. Expected add, delete, replace" % change)
+
def _generic_modify(inst, basedn, log, manager_class, selector, args=None):
# Here, we should have already selected the type etc. mc should be a
# type of DSLdapObject (singular)
diff --git a/src/lib389/lib389/cli_conf/pwpolicy.py b/src/lib389/lib389/cli_conf/pwpolicy.py
index ae97626ca..1413f3049 100644
--- a/src/lib389/lib389/cli_conf/pwpolicy.py
+++ b/src/lib389/lib389/cli_conf/pwpolicy.py
@@ -12,50 +12,8 @@ from lib389.utils import ensure_str, ensure_list_str
from lib389.pwpolicy import PwPolicyEntries, PwPolicyManager
from lib389.idm.account import Account
-arg_to_attr = {
- 'pwdlocal': 'nsslapd-pwpolicy-local',
- 'pwdscheme': 'passwordstoragescheme',
- 'pwdchange': 'passwordChange',
- 'pwdmustchange': 'passwordMustChange',
- 'pwdhistory': 'passwordHistory',
- 'pwdhistorycount': 'passwordInHistory',
- 'pwdadmin': 'passwordAdminDN',
- 'pwdtrack': 'passwordTrackUpdateTime',
- 'pwdwarning': 'passwordWarning',
- 'pwdisglobal': 'passwordIsGlobalPolicy',
- 'pwdexpire': 'passwordExp',
- 'pwdmaxage': 'passwordMaxAge',
- 'pwdminage': 'passwordMinAge',
- 'pwdgracelimit': 'passwordGraceLimit',
- 'pwdsendexpiring': 'passwordSendExpiringTime',
- 'pwdlockout': 'passwordLockout',
- 'pwdunlock': 'passwordUnlock',
- 'pwdlockoutduration': 'passwordLockoutDuration',
- 'pwdmaxfailures': 'passwordMaxFailure',
- 'pwdresetfailcount': 'passwordResetFailureCount',
- 'pwdchecksyntax': 'passwordCheckSyntax',
- 'pwdminlen': 'passwordMinLength',
- 'pwdmindigits': 'passwordMinDigits',
- 'pwdminalphas': 'passwordMinAlphas',
- 'pwdminuppers': 'passwordMinUppers',
- 'pwdminlowers': 'passwordMinLowers',
- 'pwdminspecials': 'passwordMinSpecials',
- 'pwdmin8bits': 'passwordMin8bit',
- 'pwdmaxrepeats': 'passwordMaxRepeats',
- 'pwdpalindrome': 'passwordPalindrome',
- 'pwdmaxseq': 'passwordMaxSequence',
- 'pwdmaxseqsets': 'passwordMaxSeqSets',
- 'pwdmaxclasschars': 'passwordMaxClassChars',
- 'pwdmincatagories': 'passwordMinCategories',
- 'pwdmintokenlen': 'passwordMinTokenLength',
- 'pwdbadwords': 'passwordBadWords',
- 'pwduserattrs': 'passwordUserAttributes',
- 'pwddictcheck': 'passwordDictCheck',
- 'pwddictpath': 'passwordDictPath',
- 'pwdallowhash': 'nsslapd-allow-hashed-passwords'
- }
-
-def _args_to_attrs(args):
+
+def _args_to_attrs(args, arg_to_attr):
attrs = {}
for arg in vars(args):
val = getattr(args, arg)
@@ -68,50 +26,44 @@ def _get_policy_type(inst, dn=None):
pwp_manager = PwPolicyManager(inst)
if dn is None:
return "Global Password Policy"
- elif pwp_manager.is_user_policy(dn):
- return "User Policy"
elif pwp_manager.is_subtree_policy(dn):
return "Subtree Policy"
else:
- raise ValueError("The policy wasn't set up for the target dn entry or it is invalid")
+ return "User Policy"
def _get_pw_policy(inst, targetdn, log, use_json=None):
pwp_manager = PwPolicyManager(inst)
policy_type = _get_policy_type(inst, targetdn)
-
+ attr_list = pwp_manager.get_attr_list()
if "global" in policy_type.lower():
targetdn = 'cn=config'
- pwp_manager.pwp_attributes.extend(['passwordIsGlobalPolicy', 'nsslapd-pwpolicy_local'])
+ attr_list.extend(['passwordIsGlobalPolicy', 'nsslapd-pwpolicy_local'])
+ attrs = inst.config.get_attrs_vals_utf8(attr_list)
else:
- targetdn = pwp_manager.get_pwpolicy_entry(targetdn).dn
-
- entries = inst.search_s(targetdn, ldap.SCOPE_BASE, 'objectclass=*', pwp_manager.pwp_attributes)
- entry = entries[0]
+ policy = pwp_manager.get_pwpolicy_entry(targetdn)
+ targetdn = policy.dn
+ attrs = policy.get_attrs_vals_utf8(attr_list)
if use_json:
- str_attrs = {}
- for k in entry.data:
- str_attrs[ensure_str(k)] = ensure_list_str(entry.data[k])
-
- # ensure all the keys are lowercase
- str_attrs = dict((k.lower(), v) for k, v in str_attrs.items())
-
- print(json.dumps({"type": "entry", "pwp_type": policy_type, "dn": ensure_str(targetdn), "attrs": str_attrs}))
+ print(json.dumps({"type": "entry", "pwp_type": policy_type, "dn": ensure_str(targetdn), "attrs": attrs}))
else:
if "global" in policy_type.lower():
response = "Global Password Policy: cn=config\n------------------------------------\n"
else:
response = "Local {} Policy: {}\n------------------------------------\n".format(policy_type, targetdn)
- for k in entry.data:
- response += "{}: {}\n".format(k, ensure_str(entry.data[k][0]))
+ for key, value in list(attrs.items()):
+ if len(value) == 0:
+ value = ""
+ else:
+ value = value[0]
+ response += "{}: {}\n".format(key, value)
print(response)
def list_policies(inst, basedn, log, args):
log = log.getChild('list_policies')
targetdn = args.DN[0]
- pwp_manager = PwPolicyManager(inst)
if args.json:
result = {'type': 'list', 'items': []}
@@ -125,26 +77,16 @@ def list_policies(inst, basedn, log, args):
# User pwpolicy entry is under the container that is under the parent,
# so we need to go one level up
- if pwp_manager.is_user_policy(targetdn):
- policy_type = _get_policy_type(inst, user_entry.dn)
+ pwp_entries = PwPolicyEntries(inst, targetdn)
+ for pwp_entry in pwp_entries.list():
+ dn_comps = ldap.dn.explode_dn(pwp_entry.get_attr_val_utf8_l('cn'))
+ dn_comps.pop(0)
+ entrydn = ",".join(dn_comps)
+ policy_type = _get_policy_type(inst, entrydn)
if args.json:
- result['items'].append([user_entry.dn, policy_type])
+ result['items'].append([entrydn, policy_type])
else:
- result += "%s (%s)\n" % (user_entry.dn, policy_type.lower())
- else:
- pwp_entries = PwPolicyEntries(inst, targetdn)
- for pwp_entry in pwp_entries.list():
- cn = pwp_entry.get_attr_val_utf8_l('cn')
- if pwp_entry.is_subtree_policy():
- entrydn = cn.replace('cn=nspwpolicyentry_subtree,', '')
- else:
- entrydn = cn.replace('cn=nspwpolicyentry_user,', '')
- policy_type = _get_policy_type(inst, entrydn)
-
- if args.json:
- result['items'].append([entrydn, policy_type])
- else:
- result += "%s (%s)\n" % (entrydn, policy_type.lower())
+ result += "%s (%s)\n" % (entrydn, policy_type.lower())
if args.json:
print(json.dumps(result))
@@ -165,8 +107,8 @@ def get_global_policy(inst, basedn, log, args):
def create_subtree_policy(inst, basedn, log, args):
log = log.getChild('create_subtree_policy')
# Gather the attributes
- attrs = _args_to_attrs(args)
pwp_manager = PwPolicyManager(inst)
+ attrs = _args_to_attrs(args, pwp_manager.arg_to_attr)
pwp_manager.create_subtree_policy(args.DN[0], attrs)
print('Successfully created subtree password policy')
@@ -174,9 +116,8 @@ def create_subtree_policy(inst, basedn, log, args):
def create_user_policy(inst, basedn, log, args):
log = log.getChild('create_user_policy')
- # Gather the attributes
- attrs = _args_to_attrs(args)
pwp_manager = PwPolicyManager(inst)
+ attrs = _args_to_attrs(args, pwp_manager.arg_to_attr)
pwp_manager.create_user_policy(args.DN[0], attrs)
print('Successfully created user password policy')
@@ -184,9 +125,8 @@ def create_user_policy(inst, basedn, log, args):
def set_global_policy(inst, basedn, log, args):
log = log.getChild('set_global_policy')
- # Gather the attributes
- attrs = _args_to_attrs(args)
pwp_manager = PwPolicyManager(inst)
+ attrs = _args_to_attrs(args, pwp_manager.arg_to_attr)
pwp_manager.set_global_policy(attrs)
print('Successfully updated global password policy')
@@ -195,9 +135,8 @@ def set_global_policy(inst, basedn, log, args):
def set_local_policy(inst, basedn, log, args):
log = log.getChild('set_local_policy')
targetdn = args.DN[0]
- # Gather the attributes
- attrs = _args_to_attrs(args)
pwp_manager = PwPolicyManager(inst)
+ attrs = _args_to_attrs(args, pwp_manager.arg_to_attr)
pwp_entry = pwp_manager.get_pwpolicy_entry(args.DN[0])
policy_type = _get_policy_type(inst, targetdn)
diff --git a/src/lib389/lib389/pwpolicy.py b/src/lib389/lib389/pwpolicy.py
index d665d1f72..19ca29dc6 100644
--- a/src/lib389/lib389/pwpolicy.py
+++ b/src/lib389/lib389/pwpolicy.py
@@ -13,9 +13,6 @@ from lib389.idm.account import Account
from lib389.idm.nscontainer import nsContainers, nsContainer
from lib389.cos import CosPointerDefinitions, CosPointerDefinition, CosTemplates
-USER_POLICY = 1
-SUBTREE_POLICY = 2
-
class PwPolicyManager(object):
"""Manages user, subtree and global password policies
@@ -27,88 +24,66 @@ class PwPolicyManager(object):
def __init__(self, instance):
self._instance = instance
self.log = instance.log
- self.pwp_attributes = [
- 'passwordstoragescheme',
- 'passwordChange',
- 'passwordMustChange',
- 'passwordHistory',
- 'passwordInHistory',
- 'passwordAdminDN',
- 'passwordTrackUpdateTime',
- 'passwordWarning',
- 'passwordMaxAge',
- 'passwordMinAge',
- 'passwordExp',
- 'passwordGraceLimit',
- 'passwordSendExpiringTime',
- 'passwordLockout',
- 'passwordUnlock',
- 'passwordMaxFailure',
- 'passwordLockoutDuration',
- 'passwordResetFailureCount',
- 'passwordCheckSyntax',
- 'passwordMinLength',
- 'passwordMinDigits',
- 'passwordMinAlphas',
- 'passwordMinUppers',
- 'passwordMinLowers',
- 'passwordMinSpecials',
- 'passwordMaxRepeats',
- 'passwordMin8bit',
- 'passwordMinCategories',
- 'passwordMinTokenLength',
- 'passwordDictPath',
- 'passwordDictCheck',
- 'passwordPalindrome',
- 'passwordMaxSequence',
- 'passwordMaxClassChars',
- 'passwordMaxSeqSets',
- 'passwordBadWords',
- 'passwordUserAttributes',
- 'passwordIsGlobalPolicy',
- 'nsslapd-pwpolicy-local',
- 'nsslapd-allow-hashed-passwords'
- ]
-
- def is_user_policy(self, dn):
- """Check if the entry has a user password policy
-
- :param dn: Entry DN with PwPolicy set up
- :type dn: str
-
- :returns: True if the entry has a user policy, False otherwise
- """
-
- # CoSTemplate entry also can have 'pwdpolicysubentry', so we better validate this part too
- entry = Account(self._instance, dn)
- try:
- if entry.present("objectclass", "costemplate"):
- # It is a CoSTemplate entry, not user policy
- return False
-
- # Check if it's a subtree or a user policy
- if entry.present("pwdpolicysubentry"):
- return True
- else:
- return False
- except ldap.NO_SUCH_OBJECT:
- return False
+ self.arg_to_attr = {
+ 'pwdlocal': 'nsslapd-pwpolicy-local',
+ 'pwdscheme': 'passwordstoragescheme',
+ 'pwdchange': 'passwordChange',
+ 'pwdmustchange': 'passwordMustChange',
+ 'pwdhistory': 'passwordHistory',
+ 'pwdhistorycount': 'passwordInHistory',
+ 'pwdadmin': 'passwordAdminDN',
+ 'pwdtrack': 'passwordTrackUpdateTime',
+ 'pwdwarning': 'passwordWarning',
+ 'pwdisglobal': 'passwordIsGlobalPolicy',
+ 'pwdexpire': 'passwordExp',
+ 'pwdmaxage': 'passwordMaxAge',
+ 'pwdminage': 'passwordMinAge',
+ 'pwdgracelimit': 'passwordGraceLimit',
+ 'pwdsendexpiring': 'passwordSendExpiringTime',
+ 'pwdlockout': 'passwordLockout',
+ 'pwdunlock': 'passwordUnlock',
+ 'pwdlockoutduration': 'passwordLockoutDuration',
+ 'pwdmaxfailures': 'passwordMaxFailure',
+ 'pwdresetfailcount': 'passwordResetFailureCount',
+ 'pwdchecksyntax': 'passwordCheckSyntax',
+ 'pwdminlen': 'passwordMinLength',
+ 'pwdmindigits': 'passwordMinDigits',
+ 'pwdminalphas': 'passwordMinAlphas',
+ 'pwdminuppers': 'passwordMinUppers',
+ 'pwdminlowers': 'passwordMinLowers',
+ 'pwdminspecials': 'passwordMinSpecials',
+ 'pwdmin8bits': 'passwordMin8bit',
+ 'pwdmaxrepeats': 'passwordMaxRepeats',
+ 'pwdpalindrome': 'passwordPalindrome',
+ 'pwdmaxseq': 'passwordMaxSequence',
+ 'pwdmaxseqsets': 'passwordMaxSeqSets',
+ 'pwdmaxclasschars': 'passwordMaxClassChars',
+ 'pwdmincatagories': 'passwordMinCategories',
+ 'pwdmintokenlen': 'passwordMinTokenLength',
+ 'pwdbadwords': 'passwordBadWords',
+ 'pwduserattrs': 'passwordUserAttributes',
+ 'pwddictcheck': 'passwordDictCheck',
+ 'pwddictpath': 'passwordDictPath',
+ 'pwdallowhash': 'nsslapd-allow-hashed-passwords'
+ }
+
+ def get_attr_list(self):
+ attr_list = []
+ for arg, attr in list(self.arg_to_attr.items()):
+ attr_list.append(attr)
+ return attr_list
def is_subtree_policy(self, dn):
- """Check if the entry has a subtree password policy
+ """Check if the entry has a subtree password policy. If we can find a
+ template entry it is subtree policy
:param dn: Entry DN with PwPolicy set up
:type dn: str
:returns: True if the entry has a subtree policy, False otherwise
"""
-
- # CoSTemplate entry also can have 'pwdpolicysubentry', so we better validate this part too
- cos_pointer_def = CosPointerDefinition(self._instance, 'cn=nsPwPolicy_CoS,%s' % dn)
- if cos_pointer_def.exists():
- return True
- else:
- return False
+ cos_templates = CosTemplates(self._instance, 'cn=nsPwPolicyContainer,{}'.format(dn))
+ return cos_templates.exists('cn=nsPwTemplateEntry,%s' % dn)
def create_user_policy(self, dn, properties):
"""Creates all entries which are needed for the user
@@ -127,9 +102,9 @@ class PwPolicyManager(object):
if not user_entry.exists():
raise ValueError('Can not create user password policy because the target dn does not exist')
- rdns = ldap.dn.explode_dn(user_entry.dn)
- rdns.pop(0)
- parentdn = ",".join(rdns)
+ dn_comps = ldap.dn.explode_dn(user_entry.dn)
+ dn_comps.pop(0)
+ parentdn = ",".join(dn_comps)
# Create the pwp container if needed
pwp_containers = nsContainers(self._instance, basedn=parentdn)
@@ -139,9 +114,13 @@ class PwPolicyManager(object):
properties['cn'] = 'cn=nsPwPolicyEntry_user,%s' % dn
pwp_entries = PwPolicyEntries(self._instance, pwp_container.dn)
pwp_entry = pwp_entries.create(properties=properties)
-
- # Add policy to the entry
- user_entry.replace('pwdpolicysubentry', pwp_entry.dn)
+ try:
+ # Add policy to the entry
+ user_entry.replace('pwdpolicysubentry', pwp_entry.dn)
+ except ldap.LDAPError as e:
+ # failure, undo what we have done
+ pwp_entry.delete()
+ raise e
# make sure that local policies are enabled
self.set_global_policy({'nsslapd-pwpolicy-local': 'on'})
@@ -170,22 +149,31 @@ class PwPolicyManager(object):
pwp_container = pwp_containers.ensure_state(properties={'cn': 'nsPwPolicyContainer'})
# Create policy entry
+ pwp_entry = None
properties['cn'] = 'cn=nsPwPolicyEntry_subtree,%s' % dn
pwp_entries = PwPolicyEntries(self._instance, pwp_container.dn)
pwp_entry = pwp_entries.create(properties=properties)
-
- # The CoS template entry (nsPwTemplateEntry)
- # that has the pwdpolicysubentry value pointing to the above (nsPwPolicyEntry) entry
- cos_templates = CosTemplates(self._instance, pwp_container.dn)
- cos_template = cos_templates.create(properties={'cosPriority': '1',
- 'pwdpolicysubentry': pwp_entry.dn,
- 'cn': 'cn=nsPwTemplateEntry,%s' % dn})
-
- # The CoS specification entry at the subtree level
- cos_pointer_defs = CosPointerDefinitions(self._instance, dn)
- cos_pointer_defs.create(properties={'cosAttribute': 'pwdpolicysubentry default operational',
- 'cosTemplateDn': cos_template.dn,
- 'cn': 'nsPwPolicy_CoS'})
+ try:
+ # The CoS template entry (nsPwTemplateEntry) that has the pwdpolicysubentry
+ # value pointing to the above (nsPwPolicyEntry) entry
+ cos_template = None
+ cos_templates = CosTemplates(self._instance, pwp_container.dn)
+ cos_template = cos_templates.create(properties={'cosPriority': '1',
+ 'pwdpolicysubentry': pwp_entry.dn,
+ 'cn': 'cn=nsPwTemplateEntry,%s' % dn})
+
+ # The CoS specification entry at the subtree level
+ cos_pointer_defs = CosPointerDefinitions(self._instance, dn)
+ cos_pointer_defs.create(properties={'cosAttribute': 'pwdpolicysubentry default operational',
+ 'cosTemplateDn': cos_template.dn,
+ 'cn': 'nsPwPolicy_CoS'})
+ except ldap.LDAPError as e:
+ # Something went wrong, remove what we have done
+ if pwp_entry is not None:
+ pwp_entry.delete()
+ if cos_template is not None:
+ cos_template.delete()
+ raise e
# make sure that local policies are enabled
self.set_global_policy({'nsslapd-pwpolicy-local': 'on'})
@@ -201,23 +189,28 @@ class PwPolicyManager(object):
:returns: PwPolicyEntry instance
"""
- # Verify target dn exists before getting started
entry = Account(self._instance, dn)
if not entry.exists():
raise ValueError('Can not get the password policy entry because the target dn does not exist')
- # Check if it's a subtree or a user policy
- if self.is_user_policy(entry.dn):
- pwp_entry_dn = entry.get_attr_val_utf8("pwdpolicysubentry")
- elif self.is_subtree_policy(entry.dn):
- pwp_container = nsContainer(self._instance, 'cn=nsPwPolicyContainer,%s' % dn)
-
- pwp_entries = PwPolicyEntries(self._instance, pwp_container.dn)
- pwp_entry_dn = pwp_entries.get('cn=nsPwPolicyEntry_subtree,%s' % dn).dn
- else:
- raise ValueError("The policy wasn't set up for the target dn entry or it is invalid")
-
- return PwPolicyEntry(self._instance, pwp_entry_dn)
+ # Get the parent DN
+ dn_comps = ldap.dn.explode_dn(entry.dn)
+ dn_comps.pop(0)
+ parentdn = ",".join(dn_comps)
+
+ # Get the parent's policies
+ pwp_entries = PwPolicyEntries(self._instance, parentdn)
+ policies = pwp_entries.list()
+ for policy in policies:
+ dn_comps = ldap.dn.explode_dn(policy.get_attr_val_utf8_l('cn'))
+ dn_comps.pop(0)
+ pwp_dn = ",".join(dn_comps)
+ if pwp_dn == dn.lower():
+ # This DN does have a policy associated with it
+ return policy
+
+ # Did not find a policy for this entry
+ raise ValueError("No password policy was found for this entry")
def delete_local_policy(self, dn):
"""Delete a local password policy entry
@@ -227,43 +220,59 @@ class PwPolicyManager(object):
"""
subtree = False
- # Verify target dn exists before getting started
+
+ # Verify target dn exists, and has a policy
entry = Account(self._instance, dn)
if not entry.exists():
raise ValueError('The target entry dn does not exist')
+ pwp_entry = self.get_pwpolicy_entry(entry.dn)
+ # Subtree or user policy?
if self.is_subtree_policy(entry.dn):
parentdn = dn
subtree = True
- elif self.is_user_policy(entry.dn):
- rdns = ldap.dn.explode_dn(entry.dn)
- rdns.pop(0)
- parentdn = ",".join(rdns)
else:
- raise ValueError("The policy wasn't set up for the target dn entry or the policy is invalid")
+ dn_comps = ldap.dn.explode_dn(dn)
+ dn_comps.pop(0)
+ parentdn = ",".join(dn_comps)
+ # Starting deleting the policy, ignore the parts that might already have been removed
pwp_container = nsContainer(self._instance, 'cn=nsPwPolicyContainer,%s' % parentdn)
-
- pwp_entries = PwPolicyEntries(self._instance, pwp_container.dn)
if subtree:
- pwp_entry = pwp_entries.get('cn=nsPwPolicyEntry_subtree,%s' % dn)
+ try:
+ # Delete template
+ cos_templates = CosTemplates(self._instance, pwp_container.dn)
+ cos_template = cos_templates.get('cn=nsPwTemplateEntry,%s' % dn)
+ cos_template.delete()
+ except ldap.NO_SUCH_OBJECT:
+ # Already deleted
+ pass
+ try:
+ # Delete definition
+ cos_pointer_def = CosPointerDefinition(self._instance, 'cn=nsPwPolicy_CoS,%s' % dn)
+ cos_pointer_def.delete()
+ except ldap.NO_SUCH_OBJECT:
+ # Already deleted
+ pass
else:
- pwp_entry = pwp_entries.get('cn=nsPwPolicyEntry_user,%s' % dn)
-
- if self.is_subtree_policy(entry.dn):
- cos_templates = CosTemplates(self._instance, pwp_container.dn)
- cos_template = cos_templates.get('cn=nsPwTemplateEntry,%s' % dn)
- cos_template.delete()
-
- cos_pointer_def = CosPointerDefinition(self._instance, 'cn=nsPwPolicy_CoS,%s' % dn)
- cos_pointer_def.delete()
- else:
- entry.remove("pwdpolicysubentry", pwp_entry.dn)
+ try:
+ # Cleanup user entry
+ entry.remove("pwdpolicysubentry", pwp_entry.dn)
+ except ldap.NO_SUCH_ATTRIBUTE:
+ # Policy already removed from user
+ pass
+
+ # Remove the local policy
+ try:
+ pwp_entry.delete()
+ except ldap.NO_SUCH_OBJECT:
+ # Already deleted
+ pass
- pwp_entry.delete()
try:
pwp_container.delete()
- except ldap.NOT_ALLOWED_ON_NONLEAF:
+ except (ldap.NOT_ALLOWED_ON_NONLEAF, ldap.NO_SUCH_OBJECT):
+ # There are other policies still using this container, no problem
pass
def set_global_policy(self, properties):
diff --git a/src/lib389/lib389/tests/cli/__init__.py b/src/lib389/lib389/tests/cli/__init__.py
index d6173dcc3..56da03a0b 100644
--- a/src/lib389/lib389/tests/cli/__init__.py
+++ b/src/lib389/lib389/tests/cli/__init__.py
@@ -78,19 +78,34 @@ def topology_be_001003006(request):
def check_output(some_string, missing=False, ignorecase=True):
"""Check the output of captured STDOUT. This assumes "sys.stdout = io.StringIO()"
- otherwise there would be nothing to read
- :param some_string - text to search for in output
+ otherwise there would be nothing to read. Flush IO after performing check.
+ :param some_string - text, or list of strings, to search for in output
:param missing - test if some_string is NOT present in output
:param ignorecase - Set whether to ignore the character case in both the output
and some_string
"""
output = sys.stdout.getvalue()
+ is_list = isinstance(some_string, list)
+
if ignorecase:
output = output.lower()
- some_string = some_string.lower()
+ if is_list:
+ some_string = [text.lower() for text in some_string]
+ else:
+ some_string = some_string.lower()
+
if missing:
- assert(some_string not in output)
+ if is_list:
+ for text in some_string:
+ assert(text not in output)
+ else:
+ assert(some_string not in output)
else:
- assert(some_string in output)
- # clear buffer
+ if is_list:
+ for text in some_string:
+ assert(text in output)
+ else:
+ assert(some_string in output)
+
+ # Clear the buffer
sys.stdout = io.StringIO()
diff --git a/src/lib389/lib389/tests/cli/conf_pwpolicy_test.py b/src/lib389/lib389/tests/cli/conf_pwpolicy_test.py
new file mode 100644
index 000000000..71caefc35
--- /dev/null
+++ b/src/lib389/lib389/tests/cli/conf_pwpolicy_test.py
@@ -0,0 +1,151 @@
+import io
+import sys
+import pytest
+
+from lib389.cli_conf.pwpolicy import (create_user_policy, create_subtree_policy,
+ list_policies, set_local_policy,
+ get_local_policy, del_local_policy,
+ get_global_policy, set_global_policy)
+
+from lib389.cli_base import LogCapture, FakeArgs
+from lib389.tests.cli import check_output
+from lib389.topologies import topology_st
+from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
+from lib389.idm.organizationalunit import OrganizationalUnits
+from lib389._constants import (DEFAULT_SUFFIX)
+from lib389.utils import ds_is_older
+
+pytestmark = pytest.mark.skipif(ds_is_older('1.4.0'), reason="Not implemented")
+
+USER_DN = "uid=testuser,ou=people,{}".format(DEFAULT_SUFFIX)
+USER_OUTPUT = "{} (user policy)".format(USER_DN)
+OU_DN = "ou=people,{}".format(DEFAULT_SUFFIX)
+OU_OUTPUT = "{} (subtree policy)".format(OU_DN)
+
+
[email protected](scope="function")
+def test_args(dn):
+ args = FakeArgs()
+ args.suffix = False
+ args.json = False
+ args.verbose = False
+ args.DN = [dn]
+ return args
+
+
[email protected](scope="function")
+def do_setup(topology_st, request):
+ """Create a user and make sure ou=pople exists
+ """
+ sys.stdout = io.StringIO()
+
+ users = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX)
+ users.ensure_state(properties=TEST_USER_PROPERTIES)
+
+ ou = OrganizationalUnits(topology_st.standalone, DEFAULT_SUFFIX)
+ ou.ensure_state(properties={'ou': 'people'})
+
+
+def test_pwp_cli(topology_st, do_setup):
+ """Test creating, listing, getting, and deleting a backend (and subsuffix)
+ :id: 800f432a-52ab-4661-ac66-a2bdd9b984da
+ :setup: Standalone instance
+ :steps:
+ 1. Create User policy
+ 2. Create Subtree policy
+ 3. List policies
+ 4. Set user policy
+ 5. Get user policy
+ 6. Set subtree policy
+ 7. Get subtree policy
+ 8. Delete user policy
+ 9. Delete subtree policy
+ 10. List local policies - make sure none are returned
+ 11. Get global policy
+ 12. Set global policy
+ 13. Verify global policy update
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ 5. Success
+ 6. Success
+ 7. Success
+ 8. Success
+ 9. Success
+ 10. Success
+ 11. Success
+ 12. Success
+ 13. Success
+ """
+ topology_st.logcap = LogCapture()
+ sys.stdout = io.StringIO()
+
+ # Create User Policy
+ args = test_args(USER_DN)
+ args.pwdchange = 'on'
+ create_user_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # Create Subtree Policy
+ args = test_args(OU_DN)
+ args.pwdchange = 'off'
+ create_subtree_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # List policies
+ args = test_args(DEFAULT_SUFFIX)
+ list_policies(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output([USER_OUTPUT, OU_OUTPUT])
+
+ # Set User Policy
+ args = test_args(USER_DN)
+ args.pwdhistory = 'on'
+ set_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # Get User Policy
+ args = test_args(USER_DN)
+ get_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output("passwordHistory: on")
+
+ # Set Subtree Policy
+ args = test_args(OU_DN)
+ args.pwdexpire = 'on'
+ set_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # Get Subtree Policy
+ args = test_args(OU_DN)
+ get_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output("passwordExp: on")
+
+ # Delete User Policy (and verify)
+ args = test_args(USER_DN)
+ del_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ with pytest.raises(ValueError):
+ get_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # Delete Subtree Policy (and verify)
+ args = test_args(OU_DN)
+ del_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ with pytest.raises(ValueError):
+ get_local_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # List policies (or lack there of)
+ args = test_args(DEFAULT_SUFFIX)
+ list_policies(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output([USER_OUTPUT, OU_OUTPUT], missing=True)
+
+ # Get global policy
+ args = test_args(DEFAULT_SUFFIX)
+ get_global_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output('passwordLockout: off')
+
+ # Set global policy
+ args = test_args(DEFAULT_SUFFIX)
+ args.pwdlockout = "on"
+ set_global_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+
+ # Check update was applied
+ get_global_policy(topology_st.standalone, None, topology_st.logcap.log, args)
+ check_output('passwordLockout: on')
| 0 |
f9c92691277f7ebb468cc22e3bff74a2b6c14c5a
|
389ds/389-ds-base
|
Ticket 550 - posix winsync will not create memberuid values if group entry become posix group in the same sync interval
Description: Posix winsync plugin can create memberUid values according the uniquemember values.
prerequisite is that the group is already a posix group. Will add the posix attributes
(gid) and the group members on the AD on the same time, so it occurs in the same sync
interval and the memberUid values will not generated.
This was from the ticket reporter: cgrzemba.
This patch has been modified to work with 1.3.1
Also fixed a compiler warning in pw.c(different issue)
https://fedorahosted.org/389/ticket/550
Reviewed by: noriko & richm(Thanks!!)
|
commit f9c92691277f7ebb468cc22e3bff74a2b6c14c5a
Author: Mark Reynolds <[email protected]>
Date: Tue Apr 2 16:59:19 2013 -0400
Ticket 550 - posix winsync will not create memberuid values if group entry become posix group in the same sync interval
Description: Posix winsync plugin can create memberUid values according the uniquemember values.
prerequisite is that the group is already a posix group. Will add the posix attributes
(gid) and the group members on the AD on the same time, so it occurs in the same sync
interval and the memberUid values will not generated.
This was from the ticket reporter: cgrzemba.
This patch has been modified to work with 1.3.1
Also fixed a compiler warning in pw.c(different issue)
https://fedorahosted.org/389/ticket/550
Reviewed by: noriko & richm(Thanks!!)
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-func.c b/ldap/servers/plugins/posix-winsync/posix-group-func.c
index 9d744ba2f..7e069be36 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-func.c
+++ b/ldap/servers/plugins/posix-winsync/posix-group-func.c
@@ -628,7 +628,7 @@ propogateDeletionsUpward(Slapi_Entry *entry, const Slapi_DN *base_sdn, Slapi_Val
}
int
-modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify)
+modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify, int newposixgroup)
{
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "modGroupMembership: ==>\n");
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME, "modGroupMembership: Modding %s\n",
@@ -636,7 +636,7 @@ modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify)
int posixGroup = hasObjectClass(entry, "posixGroup");
- if (!(posixGroup || hasObjectClass(entry, "ntGroup"))) {
+ if (!(posixGroup || hasObjectClass(entry, "ntGroup")) && !newposixgroup) {
slapi_log_error(SLAPI_LOG_PLUGIN, POSIX_WINSYNC_PLUGIN_NAME,
"modGroupMembership end: Not a posixGroup or ntGroup\n");
return 0;
diff --git a/ldap/servers/plugins/posix-winsync/posix-group-func.h b/ldap/servers/plugins/posix-winsync/posix-group-func.h
index 0f0ae37b3..85e5235c4 100644
--- a/ldap/servers/plugins/posix-winsync/posix-group-func.h
+++ b/ldap/servers/plugins/posix-winsync/posix-group-func.h
@@ -11,7 +11,7 @@ Slapi_PBlock * dnHasObjectClass( const char *baseDN, const char *objectClass, Sl
char * searchUid(const char *udn);
int dn_in_set(const char* uid, char **uids);
*/
-int modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify);
+int modGroupMembership(Slapi_Entry *entry, Slapi_Mods *smods, int *do_modify, int newposixgroup);
int addGroupMembership(Slapi_Entry *entry, Slapi_Entry *ad_entry);
char * searchUid(const char *udn);
void memberUidLock();
diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c
index 92a3a79b7..f40f5ff91 100644
--- a/ldap/servers/plugins/posix-winsync/posix-winsync.c
+++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c
@@ -958,11 +958,6 @@ posix_winsync_pre_ds_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry, Sla
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
"_pre_ds_mod_group_cb present %d modify %d before\n", is_present_local,
do_modify_local);
- if (posix_winsync_config_get_mapMemberUid() || posix_winsync_config_get_mapNestedGrouping()) {
- memberUidLock();
- modGroupMembership(ds_entry, smods, do_modify);
- memberUidUnlock();
- }
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
"_pre_ds_mod_group_cb present %d modify %d\n", is_present_local,
@@ -985,19 +980,18 @@ posix_winsync_pre_ds_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry, Sla
"_pre_ds_mod_group_cb add oc:posixGroup\n");
slapi_mods_add_mod_values(smods, LDAP_MOD_REPLACE, "objectClass",
valueset_get_valuearray(oc_vs));
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "_pre_ds_mod_group_cb step\n");
slapi_value_free(&oc_nv);
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "_pre_ds_mod_group_cb step\n");
slapi_valueset_free(oc_vs);
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "_pre_ds_mod_group_cb step\n");
}
slapi_value_free(&voc);
}
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "_pre_ds_mod_group_cb step\n");
+ if (posix_winsync_config_get_mapMemberUid() || posix_winsync_config_get_mapNestedGrouping()) {
+ memberUidLock();
+ modGroupMembership(ds_entry, smods, do_modify, do_modify_local);
+ memberUidUnlock();
+ }
+ slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "_pre_ds_mod_group_cb step\n");
if (slapi_is_loglevel_set(SLAPI_LOG_PLUGIN)) {
for (mod = slapi_mods_get_first_mod(smods); mod; mod = slapi_mods_get_next_mod(smods)) {
slapi_mod_dump(mod, 0);
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index ae9490335..eb4ebd4c9 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -1535,7 +1535,7 @@ pw_get_admin_users(passwdPolicy *pwp)
const Slapi_DN *sdn = pwp->pw_admin;
char **uniquemember_vals = NULL;
char **member_vals = NULL;
- char *binddn = slapi_sdn_get_dn(sdn);
+ const char *binddn = slapi_sdn_get_dn(sdn);
int uniquemember_count = 0;
int member_count = 0;
int nentries = 0;
| 0 |
f874c39f2a93041b65a8461849678acd30a0bfe0
|
389ds/389-ds-base
|
Ticket 50439 - fix waitpid issue when pid does not exist
Bug Description: In some situations, waitpid will fail with
a no child process error, when the pid file has a value but
no pid exists.
Fix Description: Catch the exception, because in this case
we have no pids to wait upon, so there is no harm to skip this.
https://pagure.io/389-ds-base/issue/50439
Author: William Brown <[email protected]>
Review by: ???
|
commit f874c39f2a93041b65a8461849678acd30a0bfe0
Author: William Brown <[email protected]>
Date: Thu Jun 20 15:20:34 2019 +0200
Ticket 50439 - fix waitpid issue when pid does not exist
Bug Description: In some situations, waitpid will fail with
a no child process error, when the pid file has a value but
no pid exists.
Fix Description: Catch the exception, because in this case
we have no pids to wait upon, so there is no harm to skip this.
https://pagure.io/389-ds-base/issue/50439
Author: William Brown <[email protected]>
Review by: ???
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 1c5741503..c7324f1ff 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -213,7 +213,10 @@ def pid_exists(pid):
else:
raise
# Tell the OS to reap this please ...
- os.waitpid(pid, os.WNOHANG)
+ try:
+ os.waitpid(pid, os.WNOHANG)
+ except ChildProcessError:
+ pass
return True
def pid_from_file(pidfile):
| 0 |
c66b5e9f83a81d75d8137e86b5e7631507592099
|
389ds/389-ds-base
|
Ticket 47823 - attribute uniqueness enforced on all subtrees
Bug Description:
Attribute uniqueness plugin enforces uniqueness on
each defined subtrees where the modified/added entry is located.
We need the ability to check uniqueness across all the defined subtrees.
It requires a new configuration attribute for the plugin.
The name of the new configuration attribute is more explicit ('uniqueness-across-all-subtrees')
than the old style: nsslapd-pluginarg0, nsslapd-pluginarg1,...
The new attribute is only supported in new configuration style
* uniqueness-attribute-name: uid
* uniqueness-subtrees: dc=people,dc=example,dc=com
* uniqueness-subtrees: dc=sales, dc=example,dc=com
* uniqueness-across-all-subtrees: on
Fix Description:
The fix support new configuration style but still support the old one:
* nsslapd-pluginarg0: uid
* nsslapd-pluginarg1: dc=people,dc=example,dc=com
* nsslapd-pluginarg2: dc=sales, dc=example,dc=com
A mix of configuration style likely results in invalid configuration, that
prevent to start the plugin -> prevent to start the server
https://fedorahosted.org/389/ticket/47823
Reviewed by: Rich Megginson (thanks Rich for reviews and tips !!)
Platforms tested: F17/F20
Flag Day: no
Doc impact: yes
|
commit c66b5e9f83a81d75d8137e86b5e7631507592099
Author: Thierry bordaz (tbordaz) <[email protected]>
Date: Mon Jul 7 15:29:58 2014 +0200
Ticket 47823 - attribute uniqueness enforced on all subtrees
Bug Description:
Attribute uniqueness plugin enforces uniqueness on
each defined subtrees where the modified/added entry is located.
We need the ability to check uniqueness across all the defined subtrees.
It requires a new configuration attribute for the plugin.
The name of the new configuration attribute is more explicit ('uniqueness-across-all-subtrees')
than the old style: nsslapd-pluginarg0, nsslapd-pluginarg1,...
The new attribute is only supported in new configuration style
* uniqueness-attribute-name: uid
* uniqueness-subtrees: dc=people,dc=example,dc=com
* uniqueness-subtrees: dc=sales, dc=example,dc=com
* uniqueness-across-all-subtrees: on
Fix Description:
The fix support new configuration style but still support the old one:
* nsslapd-pluginarg0: uid
* nsslapd-pluginarg1: dc=people,dc=example,dc=com
* nsslapd-pluginarg2: dc=sales, dc=example,dc=com
A mix of configuration style likely results in invalid configuration, that
prevent to start the plugin -> prevent to start the server
https://fedorahosted.org/389/ticket/47823
Reviewed by: Rich Megginson (thanks Rich for reviews and tips !!)
Platforms tested: F17/F20
Flag Day: no
Doc impact: yes
diff --git a/dirsrvtests/tickets/ticket47823_test.py b/dirsrvtests/tickets/ticket47823_test.py
new file mode 100644
index 000000000..2322e71c3
--- /dev/null
+++ b/dirsrvtests/tickets/ticket47823_test.py
@@ -0,0 +1,1046 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import socket
+import pytest
+import re
+import shutil
+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
+
+PROVISIONING_CN = "provisioning"
+PROVISIONING_DN = "cn=%s,%s" % (PROVISIONING_CN, SUFFIX)
+
+ACTIVE_CN = "accounts"
+STAGE_CN = "staged users"
+DELETE_CN = "deleted users"
+ACTIVE_DN = "cn=%s,%s" % (ACTIVE_CN, SUFFIX)
+STAGE_DN = "cn=%s,%s" % (STAGE_CN, PROVISIONING_DN)
+DELETE_DN = "cn=%s,%s" % (DELETE_CN, PROVISIONING_DN)
+
+STAGE_USER_CN = "stage guy"
+STAGE_USER_DN = "cn=%s,%s" % (STAGE_USER_CN, STAGE_DN)
+
+ACTIVE_USER_CN = "active guy"
+ACTIVE_USER_DN = "cn=%s,%s" % (ACTIVE_USER_CN, ACTIVE_DN)
+
+ACTIVE_USER_1_CN = "test_1"
+ACTIVE_USER_1_DN = "cn=%s,%s" % (ACTIVE_USER_1_CN, ACTIVE_DN)
+ACTIVE_USER_2_CN = "test_2"
+ACTIVE_USER_2_DN = "cn=%s,%s" % (ACTIVE_USER_2_CN, ACTIVE_DN)
+
+STAGE_USER_1_CN = ACTIVE_USER_1_CN
+STAGE_USER_1_DN = "cn=%s,%s" % (STAGE_USER_1_CN, STAGE_DN)
+STAGE_USER_2_CN = ACTIVE_USER_2_CN
+STAGE_USER_2_DN = "cn=%s,%s" % (STAGE_USER_2_CN, STAGE_DN)
+
+ALL_CONFIG_ATTRS = ['nsslapd-pluginarg0', 'nsslapd-pluginarg1', 'nsslapd-pluginarg2',
+ 'uniqueness-attribute-name', 'uniqueness-subtrees', 'uniqueness-across-all-subtrees']
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ At the beginning, It may exists a standalone instance.
+ It may also exists a backup for the standalone instance.
+
+ Principle:
+ If standalone instance exists:
+ restart it
+ If backup of standalone exists:
+ create/rebind to standalone
+
+ restore standalone instance from backup
+ else:
+ Cleanup everything
+ remove instance
+ remove backup
+ Create instance
+ Create backup
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ 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 = standalone.checkBackupFS()
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+ if instance_standalone:
+ # assuming the instance is already stopped, just wait 5 sec max
+ standalone.stop(timeout=5)
+ try:
+ standalone.start(timeout=10)
+ except ldap.SERVER_DOWN:
+ pass
+
+ if backup_standalone:
+ # The backup exist, assuming it is correct
+ # we just re-init the instance with it
+ if not instance_standalone:
+ standalone.create()
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # restore standalone instance from backup
+ standalone.stop(timeout=10)
+ standalone.restoreFS(backup_standalone)
+ standalone.start(timeout=10)
+
+ else:
+ # We should be here only in two conditions
+ # - This is the first time a test involve standalone instance
+ # - Something weird happened (instance/backup destroyed)
+ # so we discard everything and recreate all
+
+ # 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:
+ standalone.clearBackupFS()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # Time to create the backups
+ standalone.stop(timeout=10)
+ standalone.backupfile = standalone.backupFS()
+ standalone.start(timeout=10)
+
+ #
+ # Here we have standalone instance up and running
+ # Either coming from a backup recovery
+ # or from a fresh (re)init
+ # Time to return the topology
+ return TopologyStandalone(standalone)
+
+def _header(topology, label):
+ topology.standalone.log.info("\n\n###############################################")
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("####### %s" % label)
+ topology.standalone.log.info("#######")
+ topology.standalone.log.info("###############################################")
+
+def _uniqueness_config_entry(topology, name=None):
+ if not name:
+ return None
+
+ ent = topology.standalone.getEntry("cn=%s,%s" % (PLUGIN_ATTR_UNIQUENESS, DN_PLUGIN), ldap.SCOPE_BASE,
+ "(objectclass=nsSlapdPlugin)",
+ ['objectClass', 'cn', 'nsslapd-pluginPath', 'nsslapd-pluginInitfunc',
+ 'nsslapd-pluginType', 'nsslapd-pluginEnabled', 'nsslapd-plugin-depends-on-type',
+ 'nsslapd-pluginId', 'nsslapd-pluginVersion', 'nsslapd-pluginVendor',
+ 'nsslapd-pluginDescription'])
+ ent.dn = "cn=%s uniqueness,%s" % (name, DN_PLUGIN)
+ return ent
+
+def _build_config(topology, attr_name='cn', subtree_1=None, subtree_2=None, type_config='old', across_subtrees=False):
+ assert topology
+ assert attr_name
+ assert subtree_1
+
+ if type_config == 'old':
+ # enable the 'cn' uniqueness on Active
+ config = _uniqueness_config_entry(topology, attr_name)
+ config.setValue('nsslapd-pluginarg0', attr_name)
+ config.setValue('nsslapd-pluginarg1', subtree_1)
+ if subtree_2:
+ config.setValue('nsslapd-pluginarg2', subtree_2)
+ else:
+ # prepare the config entry
+ config = _uniqueness_config_entry(topology, attr_name)
+ config.setValue('uniqueness-attribute-name', attr_name)
+ config.setValue('uniqueness-subtrees', subtree_1)
+ if subtree_2:
+ config.setValue('uniqueness-subtrees', subtree_2)
+ if across_subtrees:
+ config.setValue('uniqueness-across-all-subtrees', 'on')
+ return config
+
+def _active_container_invalid_cfg_add(topology):
+ '''
+ Check uniqueness is not enforced with ADD (invalid config)
+ '''
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_2_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_2_CN,
+ 'cn': [ACTIVE_USER_1_CN, ACTIVE_USER_2_CN]})))
+
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(ACTIVE_USER_2_DN)
+
+def _active_container_add(topology, type_config='old'):
+ '''
+ Check uniqueness in a single container (Active)
+ Add an entry with a given 'cn', then check we can not add an entry with the same 'cn' value
+
+ '''
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config=type_config, across_subtrees=False)
+
+ # remove the 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.restart(timeout=120)
+
+ topology.standalone.log.info('Uniqueness not enforced: create the entries')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_2_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_2_CN,
+ 'cn': [ACTIVE_USER_1_CN, ACTIVE_USER_2_CN]})))
+
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(ACTIVE_USER_2_DN)
+
+
+ topology.standalone.log.info('Uniqueness enforced: checks second entry is rejected')
+
+ # enable the 'cn' uniqueness on Active
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+
+ try:
+ topology.standalone.add_s(Entry((ACTIVE_USER_2_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_2_CN,
+ 'cn': [ACTIVE_USER_1_CN, ACTIVE_USER_2_CN]})))
+ except ldap.CONSTRAINT_VIOLATION:
+ # yes it is expected
+ pass
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+
+
+
+def _active_container_mod(topology, type_config='old'):
+ '''
+ Check uniqueness in a single container (active)
+ Add and entry with a given 'cn', then check we can not modify an entry with the same 'cn' value
+
+ '''
+
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config=type_config, across_subtrees=False)
+
+ # enable the 'cn' uniqueness on Active
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+
+ topology.standalone.log.info('Uniqueness enforced: checks MOD ADD entry is rejected')
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_2_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_2_CN,
+ 'cn': ACTIVE_USER_2_CN})))
+
+ try:
+ topology.standalone.modify_s(ACTIVE_USER_2_DN, [(ldap.MOD_ADD, 'cn', ACTIVE_USER_1_CN)])
+ except ldap.CONSTRAINT_VIOLATION:
+ # yes it is expected
+ pass
+
+ topology.standalone.log.info('Uniqueness enforced: checks MOD REPLACE entry is rejected')
+ try:
+ topology.standalone.modify_s(ACTIVE_USER_2_DN, [(ldap.MOD_REPLACE, 'cn', [ACTIVE_USER_1_CN, ACTIVE_USER_2_CN])])
+ except ldap.CONSTRAINT_VIOLATION:
+ # yes it is expected
+ pass
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(ACTIVE_USER_2_DN)
+
+def _active_container_modrdn(topology, type_config='old'):
+ '''
+ Check uniqueness in a single container
+ Add and entry with a given 'cn', then check we can not modrdn an entry with the same 'cn' value
+
+ '''
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config=type_config, across_subtrees=False)
+
+ # enable the 'cn' uniqueness on Active
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+
+ topology.standalone.log.info('Uniqueness enforced: checks MODRDN entry is rejected')
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': [ACTIVE_USER_1_CN, 'dummy']})))
+
+ topology.standalone.add_s(Entry((ACTIVE_USER_2_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_2_CN,
+ 'cn': ACTIVE_USER_2_CN})))
+
+ try:
+ topology.standalone.rename_s(ACTIVE_USER_2_DN, 'cn=dummy', delold=0)
+ except ldap.CONSTRAINT_VIOLATION:
+ # yes it is expected
+ pass
+
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(ACTIVE_USER_2_DN)
+
+def _active_stage_containers_add(topology, type_config='old', across_subtrees=False):
+ '''
+ Check uniqueness in several containers
+ Add an entry on a container with a given 'cn'
+ with across_subtrees=False check we CAN add an entry with the same 'cn' value on the other container
+ with across_subtrees=True check we CAN NOT add an entry with the same 'cn' value on the other container
+
+ '''
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=STAGE_DN, type_config=type_config, across_subtrees=False)
+
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+ try:
+
+ # adding an entry on a separated contains with the same 'cn'
+ topology.standalone.add_s(Entry((STAGE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': STAGE_USER_1_CN,
+ 'cn': ACTIVE_USER_1_CN})))
+ except ldap.CONSTRAINT_VIOLATION:
+ assert across_subtrees
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(STAGE_USER_1_DN)
+
+def _active_stage_containers_mod(topology, type_config='old', across_subtrees=False):
+ '''
+ Check uniqueness in a several containers
+ Add an entry on a container with a given 'cn', then check we CAN mod an entry with the same 'cn' value on the other container
+
+ '''
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=STAGE_DN, type_config=type_config, across_subtrees=False)
+
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+ # adding an entry on active with a different 'cn'
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': ACTIVE_USER_2_CN})))
+
+ # adding an entry on a stage with a different 'cn'
+ topology.standalone.add_s(Entry((STAGE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': STAGE_USER_1_CN,
+ 'cn': STAGE_USER_1_CN})))
+
+ try:
+
+ # modify add same value
+ topology.standalone.modify_s(STAGE_USER_1_DN, [(ldap.MOD_ADD, 'cn', [ACTIVE_USER_2_CN])])
+ except ldap.CONSTRAINT_VIOLATION:
+ assert across_subtrees
+
+ topology.standalone.delete_s(STAGE_USER_1_DN)
+ topology.standalone.add_s(Entry((STAGE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': STAGE_USER_1_CN,
+ 'cn': STAGE_USER_2_CN})))
+ try:
+ # modify replace same value
+ topology.standalone.modify_s(STAGE_USER_1_DN, [(ldap.MOD_REPLACE, 'cn', [STAGE_USER_2_CN, ACTIVE_USER_1_CN])])
+ except ldap.CONSTRAINT_VIOLATION:
+ assert across_subtrees
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+ topology.standalone.delete_s(STAGE_USER_1_DN)
+
+def _active_stage_containers_modrdn(topology, type_config='old', across_subtrees=False):
+ '''
+ Check uniqueness in a several containers
+ Add and entry with a given 'cn', then check we CAN modrdn an entry with the same 'cn' value on the other container
+
+ '''
+
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=STAGE_DN, type_config=type_config, across_subtrees=False)
+
+ # enable the 'cn' uniqueness on Active and Stage
+ topology.standalone.add_s(config)
+ topology.standalone.restart(timeout=120)
+ topology.standalone.add_s(Entry((ACTIVE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': ACTIVE_USER_1_CN,
+ 'cn': [ACTIVE_USER_1_CN, 'dummy']})))
+
+ topology.standalone.add_s(Entry((STAGE_USER_1_DN, {
+ 'objectclass': "top person".split(),
+ 'sn': STAGE_USER_1_CN,
+ 'cn': STAGE_USER_1_CN})))
+
+
+ try:
+
+ topology.standalone.rename_s(STAGE_USER_1_DN, 'cn=dummy', delold=0)
+
+ # check stage entry has 'cn=dummy'
+ stage_ent = topology.standalone.getEntry("cn=dummy,%s" % (STAGE_DN), ldap.SCOPE_BASE, "objectclass=*", ['cn'])
+ assert stage_ent.hasAttr('cn')
+ found = False
+ for value in stage_ent.getValues('cn'):
+ if value == 'dummy':
+ found = True
+ assert found
+
+ # check active entry has 'cn=dummy'
+ active_ent = topology.standalone.getEntry(ACTIVE_USER_1_DN, ldap.SCOPE_BASE, "objectclass=*", ['cn'])
+ assert active_ent.hasAttr('cn')
+ found = False
+ for value in stage_ent.getValues('cn'):
+ if value == 'dummy':
+ found = True
+ assert found
+
+ topology.standalone.delete_s("cn=dummy,%s" % (STAGE_DN))
+ except ldap.CONSTRAINT_VIOLATION:
+ assert across_subtrees
+ topology.standalone.delete_s(STAGE_USER_1_DN)
+
+
+
+ # cleanup the stuff now
+ topology.standalone.delete_s(config.dn)
+ topology.standalone.delete_s(ACTIVE_USER_1_DN)
+
+def _config_file(topology, action='save'):
+ dse_ldif = topology.standalone.confdir + '/dse.ldif'
+ sav_file = topology.standalone.confdir + '/dse.ldif.ticket47823'
+ if action == 'save':
+ shutil.copy(dse_ldif, sav_file)
+ else:
+ shutil.copy(sav_file, dse_ldif)
+
+def _pattern_errorlog(file, log_pattern):
+ try:
+ _pattern_errorlog.last_pos += 1
+ except AttributeError:
+ _pattern_errorlog.last_pos = 0
+
+ found = None
+ log.debug("_pattern_errorlog: start at offset %d" % _pattern_errorlog.last_pos)
+ file.seek(_pattern_errorlog.last_pos)
+
+ # Use a while true iteration because 'for line in file: hit a
+ # python bug that break file.tell()
+ while True:
+ line = file.readline()
+ log.debug("_pattern_errorlog: [%d] %s" % (file.tell(), line))
+ found = log_pattern.search(line)
+ if ((line == '') or (found)):
+ break
+
+ log.debug("_pattern_errorlog: end at offset %d" % file.tell())
+ _pattern_errorlog.last_pos = file.tell()
+ return found
+
+def test_ticket47823_init(topology):
+ """
+
+ """
+
+ # Enabled the plugins
+ topology.standalone.plugins.enable(name=PLUGIN_ATTR_UNIQUENESS)
+ topology.standalone.restart(timeout=120)
+
+ topology.standalone.add_s(Entry((PROVISIONING_DN, {'objectclass': "top nscontainer".split(),
+ 'cn': PROVISIONING_CN})))
+ topology.standalone.add_s(Entry((ACTIVE_DN, {'objectclass': "top nscontainer".split(),
+ 'cn': ACTIVE_CN})))
+ topology.standalone.add_s(Entry((STAGE_DN, {'objectclass': "top nscontainer".split(),
+ 'cn': STAGE_CN})))
+ topology.standalone.add_s(Entry((DELETE_DN, {'objectclass': "top nscontainer".split(),
+ 'cn': DELETE_CN})))
+ topology.standalone.errorlog_file = open(topology.standalone.errlog, "r")
+
+ topology.standalone.stop(timeout=120)
+ time.sleep(1)
+ topology.standalone.start(timeout=120)
+ time.sleep(3)
+
+
+def test_ticket47823_one_container_add(topology):
+ '''
+ Check uniqueness in a single container
+ Add and entry with a given 'cn', then check we can not add an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (ADD) ")
+
+ _active_container_add(topology, type_config='old')
+
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (ADD) ")
+
+ _active_container_add(topology, type_config='new')
+
+def test_ticket47823_one_container_mod(topology):
+ '''
+ Check uniqueness in a single container
+ Add and entry with a given 'cn', then check we can not modify an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (MOD)")
+
+ _active_container_mod(topology, type_config='old')
+
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (MOD)")
+
+ _active_container_mod(topology, type_config='new')
+
+
+
+def test_ticket47823_one_container_modrdn(topology):
+ '''
+ Check uniqueness in a single container
+ Add and entry with a given 'cn', then check we can not modrdn an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (MODRDN)")
+
+ _active_container_modrdn(topology, type_config='old')
+
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (MODRDN)")
+
+ _active_container_modrdn(topology, type_config='new')
+
+def test_ticket47823_multi_containers_add(topology):
+ '''
+ Check uniqueness in a several containers
+ Add and entry with a given 'cn', then check we can not add an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (ADD) ")
+
+ _active_stage_containers_add(topology, type_config='old', across_subtrees=False)
+
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (ADD) ")
+
+ _active_stage_containers_add(topology, type_config='new', across_subtrees=False)
+
+def test_ticket47823_multi_containers_mod(topology):
+ '''
+ Check uniqueness in a several containers
+ Add an entry on a container with a given 'cn', then check we CAN mod an entry with the same 'cn' value on the other container
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (MOD) on separated container")
+
+
+ topology.standalone.log.info('Uniqueness not enforced: if same \'cn\' modified (add/replace) on separated containers')
+ _active_stage_containers_mod(topology, type_config='old', across_subtrees=False)
+
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (MOD) on separated container")
+
+
+ topology.standalone.log.info('Uniqueness not enforced: if same \'cn\' modified (add/replace) on separated containers')
+ _active_stage_containers_mod(topology, type_config='new', across_subtrees=False)
+
+def test_ticket47823_multi_containers_modrdn(topology):
+ '''
+ Check uniqueness in a several containers
+ Add and entry with a given 'cn', then check we CAN modrdn an entry with the same 'cn' value on the other container
+
+ '''
+ _header(topology, "With former config (args), check attribute uniqueness with 'cn' (MODRDN) on separated containers")
+
+ topology.standalone.log.info('Uniqueness not enforced: checks MODRDN entry is accepted on separated containers')
+ _active_stage_containers_modrdn(topology, type_config='old', across_subtrees=False)
+
+ topology.standalone.log.info('Uniqueness not enforced: checks MODRDN entry is accepted on separated containers')
+ _active_stage_containers_modrdn(topology, type_config='old')
+
+def test_ticket47823_across_multi_containers_add(topology):
+ '''
+ Check uniqueness across several containers, uniquely with the new configuration
+ Add and entry with a given 'cn', then check we can not add an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (ADD) across several containers")
+
+ _active_stage_containers_add(topology, type_config='old', across_subtrees=True)
+
+def test_ticket47823_across_multi_containers_mod(topology):
+ '''
+ Check uniqueness across several containers, uniquely with the new configuration
+ Add and entry with a given 'cn', then check we can not modifiy an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (MOD) across several containers")
+
+ _active_stage_containers_mod(topology, type_config='old', across_subtrees=True)
+
+def test_ticket47823_across_multi_containers_modrdn(topology):
+ '''
+ Check uniqueness across several containers, uniquely with the new configuration
+ Add and entry with a given 'cn', then check we can not modrdn an entry with the same 'cn' value
+
+ '''
+ _header(topology, "With new config (args), check attribute uniqueness with 'cn' (MODRDN) across several containers")
+
+ _active_stage_containers_modrdn(topology, type_config='old', across_subtrees=True)
+
+def test_ticket47823_invalid_config_1(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using old config: arg0 is missing
+ '''
+ _header(topology, "Invalid config (old): arg0 is missing")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='old', across_subtrees=False)
+
+ del config.data['nsslapd-pluginarg0']
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: attribute name not defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_2(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using old config: arg1 is missing
+ '''
+ _header(topology, "Invalid config (old): arg1 is missing")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='old', across_subtrees=False)
+
+ del config.data['nsslapd-pluginarg1']
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: No valid subtree is defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_3(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using old config: arg0 is missing
+ '''
+ _header(topology, "Invalid config (old): arg0 is missing but new config attrname exists")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='old', across_subtrees=False)
+
+ del config.data['nsslapd-pluginarg0']
+ config.data['uniqueness-attribute-name'] = 'cn'
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: objectclass for subtree entries is not defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_4(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using old config: arg1 is missing
+ '''
+ _header(topology, "Invalid config (old): arg1 is missing but new config exist")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='old', across_subtrees=False)
+
+ del config.data['nsslapd-pluginarg1']
+ config.data['uniqueness-subtrees'] = ACTIVE_DN
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: No valid subtree is defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_5(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using new config: uniqueness-attribute-name is missing
+ '''
+ _header(topology, "Invalid config (new): uniqueness-attribute-name is missing")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='new', across_subtrees=False)
+
+ del config.data['uniqueness-attribute-name']
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: attribute name not defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_6(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using new config: uniqueness-subtrees is missing
+ '''
+ _header(topology, "Invalid config (new): uniqueness-subtrees is missing")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1=ACTIVE_DN, subtree_2=None, type_config='new', across_subtrees=False)
+
+ del config.data['uniqueness-subtrees']
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: objectclass for subtree entries is not defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+
+def test_ticket47823_invalid_config_7(topology):
+ '''
+ Check that an invalid config is detected. No uniqueness enforced
+ Using new config: uniqueness-subtrees is missing
+ '''
+ _header(topology, "Invalid config (new): uniqueness-subtrees are invalid")
+
+ _config_file(topology, action='save')
+
+ # create an invalid config without arg0
+ config = _build_config(topology, attr_name='cn', subtree_1="this_is dummy DN", subtree_2="an other=dummy DN", type_config='new', across_subtrees=False)
+
+ # replace 'cn' uniqueness entry
+ try:
+ topology.standalone.delete_s(config.dn)
+
+ except ldap.NO_SUCH_OBJECT:
+ pass
+ topology.standalone.add_s(config)
+
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+
+ # Check the server did not restart
+ try:
+ topology.standalone.restart(timeout=5)
+ ent = topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ if ent:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert not ent
+ except ldap.SERVER_DOWN:
+ pass
+
+ # Check the expected error message
+ regex = re.compile("Config info: No valid subtree is defined")
+ res =_pattern_errorlog(topology.standalone.errorlog_file, regex)
+ if not res:
+ # be sure to restore a valid config before assert
+ _config_file(topology, action='restore')
+ assert res
+
+ # Check we can restart the server
+ _config_file(topology, action='restore')
+ topology.standalone.start(timeout=5)
+ try:
+ topology.standalone.getEntry(config.dn, ldap.SCOPE_BASE, "(objectclass=nsSlapdPlugin)", ALL_CONFIG_ATTRS)
+ except ldap.NO_SUCH_OBJECT:
+ pass
+def test_ticket47823_final(topology):
+ topology.standalone.stop(timeout=10)
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket47823_init(topo)
+
+ # run old/new config style that makes uniqueness checking on one subtree
+ test_ticket47823_one_container_add(topo)
+ test_ticket47823_one_container_mod(topo)
+ test_ticket47823_one_container_modrdn(topo)
+
+ # run old config style that makes uniqueness checking on each defined subtrees
+ test_ticket47823_multi_containers_add(topo)
+ test_ticket47823_multi_containers_mod(topo)
+ test_ticket47823_multi_containers_modrdn(topo)
+ test_ticket47823_across_multi_containers_add(topo)
+ test_ticket47823_across_multi_containers_mod(topo)
+ test_ticket47823_across_multi_containers_modrdn(topo)
+
+ test_ticket47823_invalid_config_1(topo)
+ test_ticket47823_invalid_config_2(topo)
+ test_ticket47823_invalid_config_3(topo)
+ test_ticket47823_invalid_config_4(topo)
+ test_ticket47823_invalid_config_5(topo)
+ test_ticket47823_invalid_config_6(topo)
+ test_ticket47823_invalid_config_7(topo)
+
+ test_ticket47823_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in
index 85662a3ca..c613c233a 100644
--- a/ldap/ldif/template-dse.ldif.in
+++ b/ldap/ldif/template-dse.ldif.in
@@ -626,8 +626,9 @@ nsslapd-pluginpath: libattr-unique-plugin
nsslapd-plugininitfunc: NSUniqueAttr_Init
nsslapd-plugintype: betxnpreoperation
nsslapd-pluginenabled: off
-nsslapd-pluginarg0: uid
-nsslapd-pluginarg1: %ds_suffix%
+uniqueness-attribute-name: uid
+uniqueness-subtrees: %ds_suffix%
+uniqueness-across-all-subtrees: off
nsslapd-plugin-depends-on-type: database
dn: cn=7-bit check,cn=plugins,cn=config
diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c
index d4f0c84e7..f4a9a8dea 100644
--- a/ldap/servers/plugins/uiduniq/uid.c
+++ b/ldap/servers/plugins/uiduniq/uid.c
@@ -99,7 +99,23 @@ pluginDesc = {
"Enforce unique attribute values"
};
static void* plugin_identity = NULL;
-
+typedef struct attr_uniqueness_config {
+ char *attr;
+ Slapi_DN **subtrees;
+ PRBool unique_in_all_subtrees;
+ char *top_entry_oc;
+ char *subtree_entries_oc;
+ struct attr_uniqueness_config *next;
+} attr_uniqueness_config_t;
+
+#define ATTR_UNIQUENESS_ATTRIBUTE_NAME "uniqueness-attribute-name"
+#define ATTR_UNIQUENESS_SUBTREES "uniqueness-subtrees"
+#define ATTR_UNIQUENESS_ACROSS_ALL_SUBTREES "uniqueness-across-all-subtrees"
+#define ATTR_UNIQUENESS_TOP_ENTRY_OC "uniqueness-top-entry-oc"
+#define ATTR_UNIQUENESS_SUBTREE_ENTRIES_OC "uniqueness-subtree-entries-oc"
+
+static int getArguments(Slapi_PBlock *pb, char **attrName, char **markerObjectClass, char **requiredObjectClass);
+static struct attr_uniqueness_config *uniqueness_entry_to_config(Slapi_PBlock *pb, Slapi_Entry *config_entry);
/*
* More information about constraint failure
@@ -107,6 +123,262 @@ static void* plugin_identity = NULL;
static char *moreInfo =
"Another entry with the same attribute value already exists (attribute: \"%s\")";
+static void
+free_uniqueness_config(struct attr_uniqueness_config *config)
+{
+ int i;
+
+ slapi_ch_free_string((char **) &config->attr);
+ for (i = 0; config->subtrees && config->subtrees[i]; i++) {
+ slapi_sdn_free(&config->subtrees[i]);
+ }
+ slapi_ch_free((void **) &config->subtrees);
+ slapi_ch_free_string((char **) &config->top_entry_oc);
+ slapi_ch_free_string((char **) &config->subtree_entries_oc);
+}
+
+/*
+ * New styles:
+ * ----------
+ *
+ * uniqueness-attribute-name: uid
+ * uniqueness-subtrees: dc=people,dc=example,dc=com
+ * uniqueness-subtrees: dc=sales, dc=example,dc=com
+ * uniqueness-across-all-subtrees: on
+ *
+ * or
+ *
+ * uniqueness-attribute-name: uid
+ * uniqueness-top-entry-oc: organizationalUnit
+ * uniqueness-subtree-entries-oc: person
+ *
+ * If both are present:
+ * - uniqueness-subtrees
+ * - uniqueness-top-entry-oc/uniqueness-subtree-entries-oc
+ * Then uniqueness-subtrees has the priority
+ *
+ * Old styles:
+ * ----------
+ *
+ * nsslapd-pluginarg0: uid
+ * nsslapd-pluginarg1: dc=people,dc=example,dc=com
+ * nsslapd-pluginarg2: dc=sales, dc=example,dc=com
+ *
+ * or
+ *
+ * nsslapd-pluginarg0: attribute=uid
+ * nsslapd-pluginarg1: markerobjectclass=organizationalUnit
+ * nsslapd-pluginarg2: requiredobjectclass=person
+ *
+ * From a Slapi_Entry of the config entry, it creates a attr_uniqueness_config.
+ * It returns a (attr_uniqueness_config *) if the configuration is valid
+ * Else it returns NULL
+ */
+static struct attr_uniqueness_config *
+uniqueness_entry_to_config(Slapi_PBlock *pb, Slapi_Entry *config_entry)
+{
+ attr_uniqueness_config_t *tmp_config = NULL;
+ char **values = NULL;
+ int argc;
+ char **argv = NULL;
+ int rc = SLAPI_PLUGIN_SUCCESS;
+ int i;
+ int nb_subtrees = 0;
+
+ if (config_entry == NULL) {
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+
+ /* We are going to fill tmp_config in a first phase */
+ if ((tmp_config = (attr_uniqueness_config_t *) slapi_ch_calloc(1, sizeof (attr_uniqueness_config_t))) == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "load_config failed to allocate configuration\n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ } else {
+ /* set these to -1 for config validation */
+
+ }
+
+ /* Check if this is new/old config style */
+ slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc);
+ if (argc == 0) {
+ /* This is new config style
+ * uniqueness-attribute-name: uid
+ * uniqueness-subtrees: dc=people,dc=example,dc=com
+ * uniqueness-subtrees: dc=sales, dc=example,dc=com
+ * uniqueness-across-all-subtrees: on
+ *
+ * or
+ *
+ * uniqueness-attribute-name: uid
+ * uniqueness-top-entry-oc: organizationalUnit
+ * uniqueness-subtree-entries-oc: person
+ */
+
+ /* Attribute name of the attribute we are going to check value uniqueness */
+ tmp_config->attr = slapi_entry_attr_get_charptr(config_entry, ATTR_UNIQUENESS_ATTRIBUTE_NAME);
+
+ /* Subtrees where uniqueness is tested */
+ values = slapi_entry_attr_get_charray(config_entry, ATTR_UNIQUENESS_SUBTREES);
+ if (values) {
+
+
+ for (i = 0; values && values[i]; i++);
+ if ((tmp_config->subtrees = (Slapi_DN **) slapi_ch_calloc(i + 1, sizeof (Slapi_DN *))) == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Config info: Fail to allocate subtree array \n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+ /* copy the valid subtree DN into the config */
+ for (i = 0, nb_subtrees = 0; values && values[i]; i++) {
+ if (slapi_dn_syntax_check(pb, values[i], 1)) { /* syntax check failed */
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Config info: Invalid DN (skipped): %s\n", values[i]);
+ continue;
+ }
+ tmp_config->subtrees[nb_subtrees] = slapi_sdn_new_dn_byval(values[i]);
+ nb_subtrees++;
+
+ }
+
+ slapi_ch_array_free(values);
+ values = NULL;
+ }
+
+ /* Uniqueness may be enforced accross all the subtrees, by default it is not */
+ tmp_config->unique_in_all_subtrees = slapi_entry_attr_get_bool(config_entry, ATTR_UNIQUENESS_ACROSS_ALL_SUBTREES);
+
+ /* enforce uniqueness only if the modified entry has this objectclass */
+ tmp_config->top_entry_oc = slapi_entry_attr_get_charptr(config_entry, ATTR_UNIQUENESS_TOP_ENTRY_OC);
+
+ /* enforce uniqueness, in the modified entry subtree, only to entries having this objectclass */
+ tmp_config->subtree_entries_oc = slapi_entry_attr_get_charptr(config_entry, ATTR_UNIQUENESS_SUBTREE_ENTRIES_OC);
+
+ } else {
+ int result;
+ char *attrName = NULL;
+ char *markerObjectClass = NULL;
+ char *requiredObjectClass = NULL;
+
+ /* using the old style of configuration */
+ result = getArguments(pb, &attrName, &markerObjectClass, &requiredObjectClass);
+ if (LDAP_OPERATIONS_ERROR == result) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name, "Config fail: unable to parse old style\n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+
+ }
+ if (UNTAGGED_PARAMETER == result) {
+ /* This is
+ * nsslapd-pluginarg0: uid
+ * nsslapd-pluginarg1: dc=people,dc=example,dc=com
+ * nsslapd-pluginarg2: dc=sales, dc=example,dc=com
+ *
+ * config attribute are in argc/argv
+ *
+ * attrName is set
+ * markerObjectClass/requiredObjectClass are NOT set
+ */
+
+ if (slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc) || slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv)) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name, "Config fail: Only attribute name is valid\n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+ /* Store attrName in the config */
+ tmp_config->attr = slapi_ch_strdup(attrName);
+ argc--;
+ argv++; /* First argument was attribute name and remaining are subtrees */
+
+ /* Store the subtrees */
+ nb_subtrees = 0;
+ if ((tmp_config->subtrees = (Slapi_DN **) slapi_ch_calloc(argc + 1, sizeof (Slapi_DN *))) == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Config info: Fail to allocate subtree array\n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+
+ for (; argc > 0; argc--, argv++) {
+ if (slapi_dn_syntax_check(pb, *argv, 1)) { /* syntax check failed */
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Config info: Invalid DN (skipped): %s\n", *argv);
+ continue;
+ }
+ tmp_config->subtrees[nb_subtrees] = slapi_sdn_new_dn_byval(*argv);
+ nb_subtrees++;
+ }
+
+ /* this interface does not configure accross subtree uniqueness*/
+ tmp_config->unique_in_all_subtrees = PR_FALSE;
+
+ /* Not really usefull, but it clarifies the config */
+ tmp_config->subtree_entries_oc = NULL;
+ tmp_config->top_entry_oc = NULL;
+ } else {
+ /* This is
+ * nsslapd-pluginarg0: attribute=uid
+ * nsslapd-pluginarg1: markerobjectclass=organizationalUnit
+ * nsslapd-pluginarg2: requiredobjectclass=person
+ *
+ * config attributes are in
+ * - attrName
+ * - markerObjectClass
+ * - requiredObjectClass
+ */
+ /* Store attrName in the config */
+ tmp_config->attr = slapi_ch_strdup(attrName);
+
+ /* There is no subtrees */
+ tmp_config->subtrees = NULL;
+
+ /* this interface does not configure accross subtree uniqueness*/
+ tmp_config->unique_in_all_subtrees = PR_FALSE;
+
+ /* set the objectclasses retrieved by getArgument */
+ tmp_config->subtree_entries_oc = slapi_ch_strdup(requiredObjectClass);
+ tmp_config->top_entry_oc = slapi_ch_strdup(markerObjectClass);
+
+ }
+
+ }
+
+ /* Time to check that the new configuration is valid */
+ if (tmp_config->attr == NULL) {
+ slapi_log_error( SLAPI_LOG_FATAL, plugin_name, "Config info: attribute name not defined \n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+ if (tmp_config->subtrees == NULL) {
+ /* Uniqueness is enforced on entries matching objectclass */
+ if (tmp_config->subtree_entries_oc == NULL) {
+ slapi_log_error( SLAPI_LOG_FATAL, plugin_name, "Config info: objectclass for subtree entries is not defined\n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+ } else if (tmp_config->subtrees[0] == NULL) {
+ /* Uniqueness is enforced on subtrees but none are defined */
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "Config info: No valid subtree is defined \n");
+ rc = SLAPI_PLUGIN_FAILURE;
+ goto done;
+ }
+
+done:
+ if (rc != SLAPI_PLUGIN_SUCCESS) {
+ if (tmp_config) {
+ free_uniqueness_config(tmp_config);
+ slapi_ch_free((void **) &tmp_config);
+ }
+ return NULL;
+ } else {
+
+ return tmp_config;
+ }
+}
+
static void
freePblock( Slapi_PBlock *spb ) {
if ( spb )
@@ -390,29 +662,49 @@ search_one_berval(Slapi_DN *baseDN, const char *attrName,
* LDAP_OPERATIONS_ERROR - a server failure.
*/
static int
-searchAllSubtrees(int argc, char *argv[], const char *attrName,
+searchAllSubtrees(Slapi_DN **subtrees, const char *attrName,
Slapi_Attr *attr, struct berval **values, const char *requiredObjectClass,
- Slapi_DN *dn)
+ Slapi_DN *dn, PRBool unique_in_all_subtrees)
{
int result = LDAP_SUCCESS;
+ int i;
+ if (unique_in_all_subtrees) {
+ PRBool in_a_subtree = PR_FALSE;
+
+ /* we need to check that the added values of this attribute
+ * are unique in all the monitored subtrees
+ */
+
+ /* First check the target entry is in one of
+ * the monitored subtree, so adding 'values' would
+ * violate constraint
+ */
+ for (i = 0;subtrees && subtrees[i]; i++) {
+ if (slapi_sdn_issuffix(dn, subtrees[i])) {
+ in_a_subtree = PR_TRUE;
+ break;
+ }
+ }
+ if (! in_a_subtree) {
+ return result;
+ }
+ }
+
/*
* For each DN in the managed list, do uniqueness checking if
* the target DN is a subnode in the tree.
*/
- for(;argc > 0;argc--,argv++)
+ for(i = 0;subtrees && subtrees[i]; i++)
{
- Slapi_DN *sufdn = slapi_sdn_new_dn_byref(*argv);
+ Slapi_DN *sufdn = subtrees[i];
/*
* The DN should already be normalized, so we don't have to
* worry about that here.
*/
- if (slapi_sdn_issuffix(dn, sufdn)) {
+ if (unique_in_all_subtrees || 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;
@@ -561,8 +853,7 @@ preop_add(Slapi_PBlock *pb)
int isupdatedn;
Slapi_Entry *e;
Slapi_Attr *attr;
- int argc;
- char **argv = NULL;
+ struct attr_uniqueness_config *config = NULL;
/*
* If this is a replication update, just be a noop.
@@ -573,28 +864,19 @@ preop_add(Slapi_PBlock *pb)
{
break;
}
-
- /*
- * Get the arguments
- */
- result = getArguments(pb, &attrName, &markerObjectClass,
- &requiredObjectClass);
- if (UNTAGGED_PARAMETER == result)
- {
- slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name,
- "ADD parameter untagged: %s\n", attrName);
- result = LDAP_SUCCESS;
- /* Statically defined subtrees to monitor */
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc);
- if (err) { result = uid_op_error(53); break; }
-
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv);
- if (err) { result = uid_op_error(54); break; }
- argc--; argv++; /* First argument was attribute name */
- } else if (0 != result)
- {
- break;
- }
+ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &config);
+ if (config == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "preop_modrdn fail to retrieve the config\n");
+ result = LDAP_OPERATIONS_ERROR;
+ break;
+ }
+
+ /*
+ * Get the arguments
+ */
+ attrName = config->attr;
+ markerObjectClass = config->top_entry_oc;
+ requiredObjectClass = config->subtree_entries_oc;
/*
* Get the target DN for this add operation
@@ -642,8 +924,8 @@ preop_add(Slapi_PBlock *pb)
} else
{
/* Subtrees listed on invocation line */
- result = searchAllSubtrees(argc, argv, attrName, attr, NULL,
- requiredObjectClass, sdn);
+ result = searchAllSubtrees(config->subtrees, attrName, attr, NULL,
+ requiredObjectClass, sdn, config->unique_in_all_subtrees);
}
END
@@ -696,6 +978,7 @@ preop_modify(Slapi_PBlock *pb)
int checkmodsCapacity = 0;
char *errtext = NULL;
char *attrName = NULL;
+ struct attr_uniqueness_config *config = NULL;
#ifdef DEBUG
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name,
@@ -712,8 +995,6 @@ preop_modify(Slapi_PBlock *pb)
LDAPMod *mod;
Slapi_DN *sdn = NULL;
int isupdatedn;
- int argc;
- char **argv = NULL;
/*
* If this is a replication update, just be a noop.
@@ -725,27 +1006,20 @@ preop_modify(Slapi_PBlock *pb)
break;
}
+ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &config);
+ if (config == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "preop_modrdn fail to retrieve the config\n");
+ result = LDAP_OPERATIONS_ERROR;
+ break;
+ }
/*
* Get the arguments
*/
- result = getArguments(pb, &attrName, &markerObjectClass,
- &requiredObjectClass);
- if (UNTAGGED_PARAMETER == result)
- {
- result = LDAP_SUCCESS;
- /* Statically defined subtrees to monitor */
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc);
- if (err) { result = uid_op_error(53); break; }
-
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv);
- if (err) { result = uid_op_error(54); break; }
- argc--; /* First argument was attribute name */
- argv++;
- } else if (0 != result)
- {
- break;
- }
+ attrName = config->attr;
+ markerObjectClass = config->top_entry_oc;
+ requiredObjectClass = config->subtree_entries_oc;
+
err = slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &mods);
if (err) { result = uid_op_error(61); break; }
@@ -809,8 +1083,8 @@ preop_modify(Slapi_PBlock *pb)
} else
{
/* Subtrees listed on invocation line */
- result = searchAllSubtrees(argc, argv, attrName, NULL,
- mod->mod_bvalues, requiredObjectClass, sdn);
+ result = searchAllSubtrees(config->subtrees, attrName, NULL,
+ mod->mod_bvalues, requiredObjectClass, sdn, config->unique_in_all_subtrees);
}
}
END
@@ -852,6 +1126,7 @@ preop_modrdn(Slapi_PBlock *pb)
Slapi_Value *sv_requiredObjectClass = NULL;
char *errtext = NULL;
char *attrName = NULL;
+ struct attr_uniqueness_config *config = NULL;
#ifdef DEBUG
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_name,
@@ -868,8 +1143,6 @@ preop_modrdn(Slapi_PBlock *pb)
int deloldrdn = 0;
int isupdatedn;
Slapi_Attr *attr;
- int argc;
- char **argv = NULL;
/*
* If this is a replication update, just be a noop.
@@ -881,26 +1154,18 @@ preop_modrdn(Slapi_PBlock *pb)
break;
}
- /*
- * Get the arguments
- */
- result = getArguments(pb, &attrName, &markerObjectClass,
- &requiredObjectClass);
- if (UNTAGGED_PARAMETER == result)
- {
- result = LDAP_SUCCESS;
- /* Statically defined subtrees to monitor */
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc);
- if (err) { result = uid_op_error(53); break; }
-
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv);
- if (err) { result = uid_op_error(54); break; }
- argc--; /* First argument was attribute name */
- argv++;
- } else if (0 != result)
- {
- break;
- }
+ slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &config);
+ if (config == NULL) {
+ slapi_log_error(SLAPI_LOG_FATAL, plugin_name, "preop_modrdn fail to retrieve the config\n");
+ result = LDAP_OPERATIONS_ERROR;
+ break;
+ }
+ /*
+ * Get the arguments
+ */
+ attrName = config->attr;
+ markerObjectClass = config->top_entry_oc;
+ requiredObjectClass = config->subtree_entries_oc;
/* Create a Slapi_Value for the requiredObjectClass to use
* for checking the entry. */
@@ -978,8 +1243,8 @@ preop_modrdn(Slapi_PBlock *pb)
} else
{
/* Subtrees listed on invocation line */
- result = searchAllSubtrees(argc, argv, attrName, attr, NULL,
- requiredObjectClass, sdn);
+ result = searchAllSubtrees(config->subtrees, attrName, attr, NULL,
+ requiredObjectClass, sdn, config->unique_in_all_subtrees);
}
END
/* Clean-up */
@@ -1021,16 +1286,15 @@ NSUniqueAttr_Init(Slapi_PBlock *pb)
int preadd = SLAPI_PLUGIN_PRE_ADD_FN;
int premod = SLAPI_PLUGIN_PRE_MODIFY_FN;
int premdn = SLAPI_PLUGIN_PRE_MODRDN_FN;
+ struct attr_uniqueness_config *config = NULL;
BEGIN
- int argc;
- char **argv;
/* Declare plugin version */
err = slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION,
SLAPI_PLUGIN_VERSION_01);
if (err) break;
-
+
/*
* Get plugin identity and store it for later use
* Used for internal operations
@@ -1049,24 +1313,12 @@ NSUniqueAttr_Init(Slapi_PBlock *pb)
}
slapi_ch_free_string(&plugin_type);
- /*
- * Get and normalize arguments
- */
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, &argc);
- if (err) break;
-
- err = slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, &argv);
- if (err) break;
-
- /* First argument is the unique attribute name */
- if (argc < 1) { err = -1; break; }
- argv++; argc--;
-
- for(;argc > 0;argc--, argv++) {
- char *normdn = slapi_create_dn_string_case("%s", *argv);
- slapi_ch_free_string(argv);
- *argv = normdn;
+ /* load the config into the config list */
+ if ((config = uniqueness_entry_to_config(pb, plugin_entry)) == NULL) {
+ err = SLAPI_PLUGIN_FAILURE;
+ break;
}
+ slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, (void*) config);
/* Provide descriptive information */
err = slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION,
@@ -1088,6 +1340,11 @@ NSUniqueAttr_Init(Slapi_PBlock *pb)
if (err) {
slapi_log_error(SLAPI_LOG_PLUGIN, "NSUniqueAttr_Init",
"Error: %d\n", err);
+ if (config) {
+ slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, NULL);
+ free_uniqueness_config(config);
+ slapi_ch_free((void **) &config);
+ }
err = -1;
}
else
| 0 |
f38b124f05a169acfd55a279b9f6c178b58e73fc
|
389ds/389-ds-base
|
Issue 4588 - BUG - unable to compile without xcrypt (#4589)
Bug Description: If xcrypt is not available, especially on some
distros with older libraries, 389 was unable to build.
Fix Description: Detect if we have xcrypt, and if not, add
stubs that always error instead.
fixes: https://github.com/389ds/389-ds-base/issues/4588
Author: William Brown <[email protected]>
Review by: @progier389, @jchapma, @droideck (Thanks!)
|
commit f38b124f05a169acfd55a279b9f6c178b58e73fc
Author: Firstyear <[email protected]>
Date: Wed Feb 3 09:48:48 2021 +1000
Issue 4588 - BUG - unable to compile without xcrypt (#4589)
Bug Description: If xcrypt is not available, especially on some
distros with older libraries, 389 was unable to build.
Fix Description: Detect if we have xcrypt, and if not, add
stubs that always error instead.
fixes: https://github.com/389ds/389-ds-base/issues/4588
Author: William Brown <[email protected]>
Review by: @progier389, @jchapma, @droideck (Thanks!)
diff --git a/ldap/servers/plugins/pwdstorage/gost_yescrypt.c b/ldap/servers/plugins/pwdstorage/gost_yescrypt.c
index 2af1c2919..67b39395e 100644
--- a/ldap/servers/plugins/pwdstorage/gost_yescrypt.c
+++ b/ldap/servers/plugins/pwdstorage/gost_yescrypt.c
@@ -7,11 +7,12 @@
#include <config.h>
#endif
-#include <crypt.h>
-#include <errno.h>
-
#include "pwdstorage.h"
+#include <crypt.h>
+
+#ifdef XCRYPT_VERSION_STR
+#include <errno.h>
int
gost_yescrypt_pw_cmp(const char *userpwd, const char *dbpwd)
{
@@ -62,3 +63,25 @@ gost_yescrypt_pw_enc(const char *pwd)
return enc;
}
+
+#else
+
+/*
+ * We do not have xcrypt, so always fail all checks.
+ */
+int
+gost_yescrypt_pw_cmp(const char *userpwd __attribute__((unused)), const char *dbpwd __attribute__((unused)))
+{
+ slapi_log_err(SLAPI_LOG_ERR, GOST_YESCRYPT_SCHEME_NAME,
+ "Unable to use gost_yescrypt_pw_cmp, xcrypt is not available.\n");
+ return 1;
+}
+
+char *
+gost_yescrypt_pw_enc(const char *pwd __attribute__((unused)))
+{
+ slapi_log_err(SLAPI_LOG_ERR, GOST_YESCRYPT_SCHEME_NAME,
+ "Unable to use gost_yescrypt_pw_enc, xcrypt is not available.\n");
+ return NULL;
+}
+#endif
| 0 |
003812911f56619f0db58ba627037644fb0f68fb
|
389ds/389-ds-base
|
Bug 750625 - Fix Coverity (11054) Dereference after null check
https://bugzilla.redhat.com/show_bug.cgi?id=750625
slapd/pw.c (new_passwdPolicy)
Bug Description: Passing null variable "pb" to function "get_entry",
which dereferences it.
Fix Description: if NULL pblock is passed, new_passworPolicy does not
go forward, but returns immediately.
|
commit 003812911f56619f0db58ba627037644fb0f68fb
Author: Noriko Hosoi <[email protected]>
Date: Tue Nov 1 17:52:03 2011 -0700
Bug 750625 - Fix Coverity (11054) Dereference after null check
https://bugzilla.redhat.com/show_bug.cgi?id=750625
slapd/pw.c (new_passwdPolicy)
Bug Description: Passing null variable "pb" to function "get_entry",
which dereferences it.
Fix Description: if NULL pblock is passed, new_passworPolicy does not
go forward, but returns immediately.
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 8138d0551..ed8d2c886 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -343,20 +343,21 @@ pw_encodevals_ext( Slapi_PBlock *pb, const Slapi_DN *sdn, Slapi_Value **vals )
passwdPolicy *pwpolicy=NULL;
char *(*pws_enc) ( char *pwd ) = NULL;
- if ( vals == NULL ) {
+ if ( (NULL == pb) || (NULL == vals) ) {
return( 0 );
}
/* new_passwdPolicy gives us a local policy if sdn and pb are set and
can be used to find a local policy, else we get the global policy */
- pwpolicy = new_passwdPolicy(pb, sdn ? (char*)slapi_sdn_get_ndn(sdn) : NULL );
+ pwpolicy = new_passwdPolicy(pb, sdn ? (char*)slapi_sdn_get_ndn(sdn) : NULL);
+ if (pwpolicy) {
+ if (pwpolicy->pw_storagescheme) {
+ pws_enc = pwpolicy->pw_storagescheme->pws_enc;
+ }
- if (pwpolicy->pw_storagescheme) {
- pws_enc = pwpolicy->pw_storagescheme->pws_enc;
+ delete_passwdPolicy(&pwpolicy);
}
- delete_passwdPolicy(&pwpolicy);
-
/* Password scheme encryption function was not found */
if ( pws_enc == NULL ) {
return( 0 );
@@ -1527,19 +1528,23 @@ new_passwdPolicy(Slapi_PBlock *pb, const char *dn)
char ebuf[ BUFSIZ ];
int optype = -1;
+ /* RFE - is there a way to make this work for non-existent entries
+ * when we don't pass in pb? We'll need to do this if we add support
+ * for password policy plug-ins. */
+ if (NULL == pb) {
+ LDAPDebug0Args(LDAP_DEBUG_ANY,
+ "new_passwdPolicy: NULL pblock was passed.\n");
+ return NULL;
+ }
slapdFrontendConfig = getFrontendConfig();
pwdpolicy = (passwdPolicy *)slapi_ch_calloc(1, sizeof(passwdPolicy));
- if (pb) {
- slapi_pblock_get( pb, SLAPI_OPERATION_TYPE, &optype );
- }
+ slapi_pblock_get( pb, SLAPI_OPERATION_TYPE, &optype );
if (dn && (slapdFrontendConfig->pwpolicy_local == 1)) {
/* If we're doing an add, COS does not apply yet so we check
parents for the pwdpolicysubentry. We look only for virtual
attributes, because real ones are for single-target policy. */
- /* NGK - is there a way to make this work for non-existent entries when we don't pass in pb? We'll
- * need to do this if we add support for password policy plug-ins. */
if (optype == SLAPI_OPERATION_ADD) {
char *parentdn = slapi_ch_strdup(dn);
char *nextdn = NULL;
| 0 |
3516495c77c89594c7f6b817fa1db7ac72a2c516
|
389ds/389-ds-base
|
Ticket 51037 - RFE AD filter rewriter for ObjectSID
Bug Description:
AD provides flexibility, to AD clients, to use string representation of objectSID
(for example S-1-5-21-1305200397-1234-1234-1234)
To support AD client using 'ObjectSid' shortcut, we need a 389-ds filter rewriters that
translate the filter '(objectSid=S-1-5-21-1305200397-1234-1234-1234)' into '(objectSid=<objectsid blob>)'
before processing the filter
see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-ada3/afac8414-c614-4c6a-b316-41f5978308bd
Fix Description:
This patch uses the new ability to registers rewriters (https://pagure.io/389-ds-base/issue/50980)
It implements a new callback filter rewriter adfilter_rewrite_objectsid in librewriters.so
https://pagure.io/389-ds-base/issue/51037
Reviewed by: Mark Reynolds, Alexander Bokovoy, Simon Pichugin, William Brown (Thanks !)
Platforms tested: F30
Flag Day: no
Doc impact: no
|
commit 3516495c77c89594c7f6b817fa1db7ac72a2c516
Author: Thierry Bordaz <[email protected]>
Date: Tue Apr 21 14:26:17 2020 +0200
Ticket 51037 - RFE AD filter rewriter for ObjectSID
Bug Description:
AD provides flexibility, to AD clients, to use string representation of objectSID
(for example S-1-5-21-1305200397-1234-1234-1234)
To support AD client using 'ObjectSid' shortcut, we need a 389-ds filter rewriters that
translate the filter '(objectSid=S-1-5-21-1305200397-1234-1234-1234)' into '(objectSid=<objectsid blob>)'
before processing the filter
see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-ada3/afac8414-c614-4c6a-b316-41f5978308bd
Fix Description:
This patch uses the new ability to registers rewriters (https://pagure.io/389-ds-base/issue/50980)
It implements a new callback filter rewriter adfilter_rewrite_objectsid in librewriters.so
https://pagure.io/389-ds-base/issue/51037
Reviewed by: Mark Reynolds, Alexander Bokovoy, Simon Pichugin, William Brown (Thanks !)
Platforms tested: F30
Flag Day: no
Doc impact: no
diff --git a/dirsrvtests/tests/suites/rewriters/adfilter_test.py b/dirsrvtests/tests/suites/rewriters/adfilter_test.py
index d2256d631..3f86314ec 100644
--- a/dirsrvtests/tests/suites/rewriters/adfilter_test.py
+++ b/dirsrvtests/tests/suites/rewriters/adfilter_test.py
@@ -1,33 +1,35 @@
import pytest
import glob
+import base64
+import re
from lib389.tasks import *
+from lib389.rewriters import *
+from lib389.idm.user import UserAccounts
from lib389.utils import *
from lib389.topologies import topology_st
from lib389._constants import DEFAULT_SUFFIX, HOST_STANDALONE, PORT_STANDALONE
+samba_missing = False
+try:
+ from samba.dcerpc import security
+ from samba.ndr import ndr_pack, ndr_unpack
+except:
+ samba_missing = True
+ pass
+
log = logging.getLogger(__name__)
# Skip on versions 1.4.2 and before. Rewriters are expected in 1.4.3
pytestmark = [pytest.mark.tier2,
pytest.mark.skipif(ds_is_older('1.4.3'), reason="Not implemented")]
PW = 'password'
-configuration_container = 'cn=Configuration,%s' % DEFAULT_SUFFIX
-schema_container = "cn=Schema,%s" % configuration_container
-
-def _create_ad_objects_container(inst):
- inst.add_s(Entry((
- configuration_container, {
- 'objectClass': 'top nsContainer'.split(),
- 'cn': 'Configuration'
- })))
- inst.add_s(Entry((
- schema_container, {
- 'objectClass': 'top nsContainer'.split(),
- 'cn': 'Schema'
- })))
-def _create_user(inst, name, salt):
+#
+# Necessary because objectcategory relies on cn=xxx RDN
+# while userAccount creates uid=xxx RDN
+#
+def _create_user(inst, schema_container, name, salt):
dn = 'cn=%s,%s' % (name, schema_container)
inst.add_s(Entry((
dn, {
@@ -40,7 +42,6 @@ def _create_user(inst, name, salt):
})))
-
def test_adfilter_objectCategory(topology_st):
"""
Test adfilter objectCategory rewriter function
@@ -48,15 +49,12 @@ def test_adfilter_objectCategory(topology_st):
librewriters = os.path.join( topology_st.standalone.ds_paths.lib_dir, 'dirsrv/librewriters.so')
assert librewriters
- # register objectCategory rewriter
- topology_st.standalone.add_s(Entry((
- "cn=adfilter,cn=rewriters,cn=config", {
- "objectClass": "top rewriterEntry".split(),
- "cn": "adfilter",
- "nsslapd-libpath": librewriters,
- "nsslapd-filterrewriter": "adfilter_rewrite_objectCategory",
- }
- )))
+
+ rewriters = AdRewriters(topology_st.standalone)
+ ad_rewriter = rewriters.ensure_state(properties={"cn": "adfilter", "nsslapd-libpath": librewriters})
+ ad_rewriter.add('nsslapd-filterrewriter', "adfilter_rewrite_objectCategory")
+ ad_rewriter.create_containers(DEFAULT_SUFFIX)
+ schema_container = ad_rewriter.get_schema_dn()
objectcategory_attr = '( NAME \'objectCategory\' DESC \'test of objectCategory\' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )'
topology_st.standalone.schema.add_schema('attributetypes', [ensure_bytes(objectcategory_attr)])
@@ -64,9 +62,8 @@ def test_adfilter_objectCategory(topology_st):
topology_st.standalone.restart(60)
# Add a user
- _create_ad_objects_container(topology_st.standalone)
for i in range(0, 20):
- _create_user(topology_st.standalone, "user_%d" % i, str(i))
+ _create_user(topology_st.standalone, schema_container, "user_%d" % i, str(i))
# Check EQUALITY filter rewrite => it should match only one entry
for i in range(0, 20):
@@ -83,3 +80,98 @@ def test_adfilter_objectCategory(topology_st):
log.info('Test PASSED')
+def sid_to_objectsid(sid):
+ return base64.b64encode(ndr_pack(security.dom_sid(sid))).decode('utf-8')
+
+def objectsid_to_sid(objectsid):
+ sid = ndr_unpack(security.dom_sid, base64.b64decode(objectsid))
+ return str(sid)
+
[email protected](samba_missing, reason="It is missing samba python bindings")
+def test_adfilter_objectSid(topology_st):
+ """
+ Test adfilter objectCategory rewriter function
+
+ :id: fc5880ff-4305-47ba-84fb-38429e264e9e
+
+ :setup: Standalone instance
+
+ :steps:
+ 1. add a objectsid rewriter (from librewriters.so)
+ 2. add a dummy schema definition of objectsid to prevent nsslapd-verify-filter-schema
+ 3. restart the server (to load the rewriter)
+ 4. Add "samba" container/users
+ 5. Searches using objectsid in string format
+
+ :expectedresults:
+ 1. Add operation should PASS.
+ 2. Add operations should PASS.
+ 3. restart should PASS
+ 4. Add "samba" users should PASS
+ 5. Search returns only one entry
+ """
+ librewriters = os.path.join( topology_st.standalone.ds_paths.lib_dir, 'dirsrv/librewriters.so')
+ assert librewriters
+
+ rewriters = AdRewriters(topology_st.standalone)
+ ad_rewriter = rewriters.ensure_state(properties={"cn": "adfilter", "nsslapd-libpath": librewriters})
+ ad_rewriter.add('nsslapd-filterrewriter', "adfilter_rewrite_objectsid")
+ ad_rewriter.create_containers(DEFAULT_SUFFIX)
+ schema_container = ad_rewriter.get_schema_dn()
+
+ # to prevent nsslapd-verify-filter-schema to reject searches with objectsid
+ objectcategory_attr = '( NAME \'objectsid\' DESC \'test of objectsid\' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )'
+ topology_st.standalone.schema.add_schema('attributetypes', [ensure_bytes(objectcategory_attr)])
+
+ topology_st.standalone.restart()
+
+ # Contains a list of b64encoded SID from https://github.com/SSSD/sssd/blob/master/src/tests/intg/data/ad_data.ldif
+ SIDs = ["AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EUAQAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8E9gEAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EAwIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EBAIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EBgIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EBwIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EBQIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EAAIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EAQIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EAgIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ECAIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EKQIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EOwIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EPAIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ECQIAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8E8gEAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ETQQAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ETgQAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EeUMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EekMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8Ee0MBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EfEMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ETwQAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8EUQQAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ESUMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ESkMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ES0MBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8ETEMBAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8E9AEAAA==",
+ "AQUAAAAAAAUVAAAADcfLTVzC66zo0l8E9QEAAA=="]
+
+ # Add a container and "samba" like users containing objectsid
+ users = UserAccounts(topology_st.standalone, schema_container, rdn=None)
+ i = 0
+ for sid in SIDs:
+ decoded = base64.b64decode(sid)
+ user = users.create_test_user(uid=i)
+ user.add('objectclass', 'extensibleobject')
+ user.replace('objectsid', decoded)
+ user.replace('objectSidString', objectsid_to_sid(sid))
+ i = i + 1
+
+ # Check that objectsid rewrite can retrieve the "samba" user
+ # using either a string objectsid (i.e. S-1-5...) or a blob objectsid
+ for sid_blob in SIDs:
+ sid_string = objectsid_to_sid(sid_blob)
+ ents_sid_string = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(objectsid=%s)' % sid_string)
+ assert len(ents_sid_string) == 1
+
diff --git a/ldap/schema/01core389.ldif b/ldap/schema/01core389.ldif
index b5478cbe6..d1063a491 100644
--- a/ldap/schema/01core389.ldif
+++ b/ldap/schema/01core389.ldif
@@ -315,8 +315,8 @@ attributeTypes: ( 2.16.840.1.113730.3.1.2084 NAME 'nsSymmetricKey' DESC 'A symme
attributeTypes: ( 2.16.840.1.113730.3.1.2364 NAME 'nsds5replicaLastInitStatusJSON' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2365 NAME 'nsds5replicaLastUpdateStatusJSON' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2367 NAME 'nsslapd-libPath' DESC 'Rewriter shared library path' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2368 NAME 'nsslapd-filterrewriter' DESC 'Filter rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2369 NAME 'nsslapd-returnedAttrRewriter' DESC 'Returned attribute rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2368 NAME 'nsslapd-filterrewriter' DESC 'Filter rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2369 NAME 'nsslapd-returnedAttrRewriter' DESC 'Returned attribute rewriter function name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN '389 Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2370 NAME 'nsslapd-enable-upgrade-hash' DESC 'Upgrade password hash on bind' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
#
# objectclasses
diff --git a/src/lib389/lib389/rewriters.py b/src/lib389/lib389/rewriters.py
new file mode 100644
index 000000000..885725c88
--- /dev/null
+++ b/src/lib389/lib389/rewriters.py
@@ -0,0 +1,92 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2020 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+import collections
+import ldap
+import copy
+import os.path
+from lib389.utils import *
+from lib389._entry import Entry
+from lib389.idm.nscontainer import nsContainers
+from lib389._mapped_object import DSLdapObjects, DSLdapObject
+from lib389._constants import DEFAULT_SUFFIX
+
+class Rewriter(DSLdapObject):
+ """A single instance of a rewriter entry
+
+ :param instance: An instance
+ :type instance: lib389.DirSrv
+ :param dn: Entry DN
+ :type dn: str
+ """
+
+ def __init__(self, instance, dn=None):
+ super(Rewriter, self).__init__(instance, dn)
+ self._rdn_attribute = 'cn'
+ self._must_attributes = ['nsslapd-libpath']
+ self._create_objectclasses = ['top', 'rewriterEntry']
+
+
+class Rewriters(DSLdapObjects):
+ """A DSLdapObjects entity which represents rewriter entry
+
+ :param instance: An instance
+ :type instance: lib389.DirSrv
+ :param basedn: Base DN for all account entries below
+ :type basedn: str
+ """
+
+ def __init__(self, instance, basedn=None):
+ super(Rewriters, self).__init__(instance=instance)
+ self._objectclasses = ['top', 'rewriterEntry']
+ self._filterattrs = ['cn', 'nsslapd-libpath']
+ self._childobject = Rewriter
+ self._basedn = 'cn=rewriters,cn=config'
+ self._list_attrlist = ['dn', 'nsslapd-libpath']
+
+
+class AdRewriter(Rewriter):
+ """An instance of AD rewriter entry
+
+ :param instance: An instance
+ :type instance: lib389.DirSrv
+ :param dn: Entry DN
+ :type dn: str
+ """
+
+ def __init__(self, instance, dn="cn=adrewriter,cn=rewriter,cn=config"):
+ super(AdRewriter, self).__init__(instance, dn)
+ self._configuration_dn = None
+ self._schema_dn = None
+
+ def create_containers(self, suffix):
+ conf_conts = nsContainers(self._instance, suffix)
+ conf_cont = conf_conts.ensure_state(properties={'cn': 'Configuration'})
+ schema_conts = nsContainers(self._instance, conf_cont.dn)
+ schema_cont = schema_conts.ensure_state(properties={'cn': 'Schema'})
+ self._configuration_dn = conf_cont.dn
+ self._schema_dn = schema_cont.dn
+
+ def get_schema_dn(self):
+ return self._schema_dn
+
+
+class AdRewriters(Rewriters):
+ """A DSLdapObjects entity which represents AD rewriter entry
+
+ :param instance: An instance
+ :type instance: lib389.DirSrv
+ :param basedn: Base DN for all account entries below
+ :type basedn: str
+ """
+
+ def __init__(self, instance, basedn=None):
+ super(AdRewriters, self).__init__(instance=instance)
+ self._childobject = AdRewriter
+
+
diff --git a/src/rewriters/adfilter.c b/src/rewriters/adfilter.c
index 35125fcf3..f3cec165e 100644
--- a/src/rewriters/adfilter.c
+++ b/src/rewriters/adfilter.c
@@ -21,9 +21,315 @@
static char *rewriter_name = "filter rewriter adfilter";
#define OBJECTCATEGORY "objectCategory"
+#define OBJECTSID "objectSid"
-/* Rewrite ObjectCategory as described in [1]
+/**********************************************************
+ * Rewrite ObjectSID
+ */
+
+#define SID_ID_AUTHS 6
+#define SID_SUB_AUTHS 15
+typedef struct dom_sid {
+ uint8_t sid_rev_num;
+ int8_t num_auths; /* [range(0,15)] */
+ uint8_t id_auth[SID_ID_AUTHS]; /* highest order byte has index 0 */
+ uint32_t sub_auths[SID_SUB_AUTHS]; /* host byte-order */
+} dom_sid_t;
+
+typedef struct bin_sid {
+ uint8_t *sid;
+ size_t length;
+} bin_sid_t;
+
+/*
+ * Borrowed from SSSD
+ * src/lib/idmap/sss_idmap_conv.c:sss_idmap_dom_sid_to_bin_sid
+ * returns:
+ * -1: if this is not a SID in dom_sid format
+ * 0: success
+ * 1: internal error
+ */
+static int32_t
+dom_sid_to_bin_sid(dom_sid_t *dom_sid, bin_sid_t *res)
+{
+ bin_sid_t bin_sid = {0};
+ size_t p = 0;
+ uint32_t val;
+
+ if (res == NULL) {
+ return 1;
+ }
+ if (dom_sid->num_auths > SID_SUB_AUTHS) {
+ return -1;
+ }
+ bin_sid.length = 2 + SID_ID_AUTHS + dom_sid->num_auths * sizeof(uint32_t);
+
+ bin_sid.sid = (uint8_t *) slapi_ch_calloc(1, bin_sid.length);
+ if (bin_sid.sid == NULL) {
+ return 1;
+ }
+
+ bin_sid.sid[p] = dom_sid->sid_rev_num;
+ p++;
+
+ bin_sid.sid[p] = dom_sid->num_auths;
+ p++;
+
+ for (size_t i = 0; i < SID_ID_AUTHS; i++) {
+ bin_sid.sid[p] = dom_sid->id_auth[i];
+ p++;
+ }
+
+ for (size_t i = 0; i < dom_sid->num_auths; i++) {
+ if ((p + sizeof(uint32_t)) > bin_sid.length) {
+ return -1;
+ }
+ val = htole32(dom_sid->sub_auths[i]);
+ memcpy(&bin_sid.sid[p], &val, sizeof(val));
+ p += sizeof(val);
+ }
+ res->sid = bin_sid.sid;
+ res->length = bin_sid.length;
+
+ return 0;
+}
+/*
+ * Borrowed from SSSD
+ * src/lib/idmap/sss_idmap_conv.c:sss_idmap_sid_to_dom_sid
+ * returns:
+ * -1: if this is not a SID in string format
+ * 0: success
+ * 1: internal error
+ */
+static int32_t
+str_sid_to_dom_sid(char *sid_string, dom_sid_t *res)
+{
+ dom_sid_t sid = {0};
+ uint64_t ul;
+ char *r, *end;
+
+ if (res == NULL) {
+ return 1;
+ }
+
+ if ((sid_string == NULL) || strncasecmp(sid_string, "S-", 2)) {
+ return -1;
+ }
+
+ /* Here we have a string SID i.e.: S-1-2-4..
+ * S-X-2-3-4.. X is sid_rev_num 8bits
+ */
+ if (!isdigit(sid_string[2])) {
+ return -1;
+ }
+ ul = (uint64_t) strtoul(sid_string + 2, &r, 10);
+ if (r == NULL || *r != '-' || ul > UINT8_MAX) {
+ return -1;
+ }
+ sid.sid_rev_num = (uint8_t) ul;
+ r++;
+
+ /* r points to 2-3-4..
+ * '2' is used for the id_auth
+ */
+ ul = strtoul(r, &r, 10);
+ if (r == NULL || ul > UINT32_MAX) {
+ return -1;
+ }
+
+ /* id_auth in the string should always be <2^32 in decimal */
+ /* store values in the same order as the binary representation */
+ sid.id_auth[0] = 0;
+ sid.id_auth[1] = 0;
+ sid.id_auth[2] = (ul & 0xff000000) >> 24;
+ sid.id_auth[3] = (ul & 0x00ff0000) >> 16;
+ sid.id_auth[4] = (ul & 0x0000ff00) >> 8;
+ sid.id_auth[5] = (ul & 0x000000ff);
+
+ /* Now r point the the sub_auth
+ * There are maximum of 15 sub_auth (SID_SUB_AUTHS): -3-4-5...*/
+ if (*r == '\0') {
+ /* no sub auths given */
+ return 0;
+ }
+ if (*r != '-') {
+ return -1;
+ }
+ do {
+ if (sid.num_auths >= SID_SUB_AUTHS) {
+ return -1;
+ }
+
+ r++;
+ if (!isdigit(*r)) {
+ return -1;
+ }
+
+ ul = strtoul(r, &end, 10);
+ if (ul > UINT32_MAX || end == NULL || (*end != '\0' && *end != '-')) {
+ return -1;
+ }
+
+ sid.sub_auths[sid.num_auths++] = ul;
+
+ r = end;
+ } while (*r != '\0');
+
+ memcpy(res, &sid, sizeof(sid));
+ return 0;
+}
+
+/*
+ * Callback to rewrite string objectSid
+ * Borrowed from SSSD sss_idmap_sid_to_bin_sid
+ */
+static int
+substitute_string_objectsid(Slapi_Filter *f, void *arg)
+{
+ char *filter_type;
+ struct berval *bval;
+ char *newval;
+ char logbuf[1024] = {0};
+ int32_t rc;
+ char *objectsid_string_header="S-";
+ dom_sid_t dom_sid = {0};
+ bin_sid_t bin_sid = {0};
+ int32_t loglevel;
+
+ /* If (objectSid=S-1-2-3-4..) --> (objectSid=<binary representation of S-1-2-3-4..> */
+ if ((slapi_filter_get_ava(f, &filter_type, &bval) == 0) &&
+ (slapi_filter_get_choice(f) == LDAP_FILTER_EQUALITY) &&
+ (bval->bv_val) &&
+ (strcasecmp(filter_type, OBJECTSID) == 0) &&
+ (strncasecmp(bval->bv_val, objectsid_string_header, strlen(objectsid_string_header)) == 0)) {
+ /* This filter component is "(objectsid=S-..) let's try to convert it */
+
+ rc = str_sid_to_dom_sid(bval->bv_val, &dom_sid);
+ switch (rc) {
+ case -1:
+ /* This is not a valid string objectSid */
+ slapi_log_err(SLAPI_LOG_ERR, rewriter_name, "substitute_string_objectsid component %s : is not a valid string sid\n",
+ slapi_filter_to_string(f, logbuf, sizeof (logbuf)));
+
+ /* do not rewrite this component but continue with the others */
+ return SLAPI_FILTER_SCAN_CONTINUE;
+ case 1:
+ /* internal error while converting string objectSid */
+ slapi_log_err(SLAPI_LOG_ERR, rewriter_name, "substitute_string_objectsid component %s : fail to convert into dom_sid a string sid\n",
+ slapi_filter_to_string(f, logbuf, sizeof (logbuf)));
+
+ /* do not rewrite this component but continue with the others */
+ return SLAPI_FILTER_SCAN_CONTINUE;
+ default:
+ /* go through */
+ break;
+ }
+ rc = dom_sid_to_bin_sid(&dom_sid, &bin_sid);
+ switch (rc) {
+ case -1:
+ /* This is not a valid dom objectSid */
+ slapi_log_err(SLAPI_LOG_ERR, rewriter_name, "substitute_string_objectsid component %s : is not a valid dom sid\n",
+ slapi_filter_to_string(f, logbuf, sizeof (logbuf)));
+
+ /* do not rewrite this component but continue with the others */
+ return SLAPI_FILTER_SCAN_CONTINUE;
+ case 1:
+ /* internal error while converting dom objectSid */
+ slapi_log_err(SLAPI_LOG_ERR, rewriter_name, "substitute_string_objectsid component %s : fail to convert into binary sid a dom sid\n",
+ slapi_filter_to_string(f, logbuf, sizeof (logbuf)));
+
+ /* do not rewrite this component but continue with the others */
+ return SLAPI_FILTER_SCAN_CONTINUE;
+ default:
+ /* go through */
+ break;
+ }
+ loglevel = LDAP_DEBUG_ANY;
+ if (loglevel_is_set(loglevel)) {
+ char logbuf[100] = {0};
+ char filterbuf[1024] = {0};
+ char *valueb64, *valueb64_sav;
+ size_t lenb64;
+ size_t maxcopy;
+
+ if (sizeof(logbuf) <= ((bin_sid.length * 2) + 1)) {
+ maxcopy = (sizeof(logbuf)/2) - 1;
+ } else {
+ maxcopy = bin_sid.length;
+ }
+
+ for (size_t i = 0, j = 0; i < maxcopy; i++) {
+ PR_snprintf(logbuf + j, 3, "%02x", bin_sid.sid[i]);
+ j += 2;
+ }
+ lenb64 = LDIF_SIZE_NEEDED(strlen("encodedb64"), bin_sid.length);
+ valueb64 = valueb64_sav = (char *) slapi_ch_calloc(1, lenb64 + 1);
+ slapi_ldif_put_type_and_value_with_options(&valueb64, "encodedb64", (const char *)bin_sid.sid, bin_sid.length, LDIF_OPT_NOWRAP);
+
+ slapi_log_err(SLAPI_LOG_INFO, rewriter_name, "substitute_string_objectsid component %s : 0x%s (%s)\n",
+ slapi_filter_to_string(f, filterbuf, sizeof (filterbuf)),
+ logbuf,
+ valueb64_sav);
+ slapi_ch_free_string(&valueb64_sav);
+ }
+ slapi_ch_free_string(&bval->bv_val);
+ /* It consums the value returned by dom_sid_to_bin_sid
+ * setting it into the bval it will be later freed
+ * when the filter will be freed
+ */
+ bval->bv_val = bin_sid.sid;
+ bval->bv_len = bin_sid.length;
+ }
+
+ /* Return continue because we should
+ * substitute 'from' in all filter components
+ */
+ return SLAPI_FILTER_SCAN_CONTINUE;
+}
+
+/*
+ * This is a filter rewriter function for 'ObjectSid' attribute
+ *
+ * Its rewriter config entry looks like
+ * dn: cn=adfilter,cn=rewriters,cn=config
+ * objectClass: top
+ * objectClass: extensibleObject
+ * cn: adfilter
+ * nsslapd-libpath: /lib/dirsrv/librewriters
+ * nsslapd-filterrewriter: adfilter_rewrite_objectsid
+ */
+int32_t
+adfilter_rewrite_objectsid(Slapi_PBlock *pb)
+{
+ Slapi_Filter *clientFilter = NULL;
+ Slapi_DN *sdn = NULL;
+ int error_code = 0;
+ int rc;
+ char *strFilter;
+
+ slapi_pblock_get(pb, SLAPI_SEARCH_FILTER, &clientFilter);
+ slapi_pblock_get(pb, SLAPI_SEARCH_STRFILTER, &strFilter);
+ slapi_pblock_get(pb, SLAPI_SEARCH_TARGET_SDN, &sdn);
+
+ if (strFilter && (strcasestr(strFilter, OBJECTSID) == NULL)) {
+ /* accelerator: returns if filter string does not contain objectSID */
+ return SEARCH_REWRITE_CALLBACK_CONTINUE;
+ }
+ /* Now apply substitute_string_objectsid on each filter component */
+ rc = slapi_filter_apply(clientFilter, substitute_string_objectsid, NULL /* no arg */, &error_code);
+ if (rc == SLAPI_FILTER_SCAN_NOMORE) {
+ return SEARCH_REWRITE_CALLBACK_CONTINUE; /* Let's others rewriter play */
+ } else {
+ slapi_log_err(SLAPI_LOG_ERR,
+ "adfilter_rewrite_objectSid", "Could not update the search filter - error %d (%d)\n",
+ rc, error_code);
+ return SEARCH_REWRITE_CALLBACK_ERROR; /* operation error */
+ }
+}
+
+/*********************************************************
+ * Rewrite OBJECTCATEGORY as described in [1]
* [1] https://social.technet.microsoft.com/wiki/contents/articles/5392.active-directory-ldap-syntax-filters.aspx#Filter_on_objectCategory_and_objectClass
* static char *objectcategory_shortcuts[] = {"person", "computer", "user", "contact", "group", "organizationalPerson", NULL};
*/
@@ -77,7 +383,7 @@ substitute_shortcut(Slapi_Filter *f, void *arg)
* objectClass: top
* objectClass: extensibleObject
* cn: adfilter
- * nsslapd-libpath: librewriters
+ * nsslapd-libpath: /lib/dirsrv/librewriters
* nsslapd-filterrewriter: adfilter_rewrite_objectCategory
*/
int32_t
| 0 |
afb1e338abc29e84b94dbb15d472276ef0b72eaa
|
389ds/389-ds-base
|
Ticket 47888 - Add CI test
Description: Add CI test for testing AES conversion with an empty backend
Reviewed by: mreynolds
|
commit afb1e338abc29e84b94dbb15d472276ef0b72eaa
Author: Mark Reynolds <[email protected]>
Date: Sun Mar 27 18:16:51 2016 -0400
Ticket 47888 - Add CI test
Description: Add CI test for testing AES conversion with an empty backend
Reviewed by: mreynolds
diff --git a/dirsrvtests/tests/tickets/ticket47462_test.py b/dirsrvtests/tests/tickets/ticket47462_test.py
index c88cf438c..f290647bf 100644
--- a/dirsrvtests/tests/tickets/ticket47462_test.py
+++ b/dirsrvtests/tests/tickets/ticket47462_test.py
@@ -239,6 +239,15 @@ def test_ticket47462(topology):
log.fatal('Failed to add test user: ' + e.message['desc'])
assert False
+ #
+ # Add a backend (that has no entries)
+ #
+ try:
+ topology.master1.backend.create("o=empty", {BACKEND_NAME: "empty"})
+ except ldap.LDAPError as e:
+ log.fatal('Failed to create extra/empty backend: ' + e.message['desc'])
+ assert False
+
#
# Run the upgrade...
#
| 0 |
ba4254538f0f4b688cdc8e4aacd9fda3142d35fe
|
389ds/389-ds-base
|
Ticket 50567, 50568 - strict host check disable and display container version
Bug Description: This is a minor fix to disable strict host checking
by default as it causes some installs to unexpectedly fail. We also
display the container version by default to aid future issue reports.
Fix Description: strict host check to false, and print paths.version.
https://pagure.io/389-ds-base/issue/50568
https://pagure.io/389-ds-base/issue/50567
Author: William Brown <[email protected]>
Review by: mreynolds (Thanks!)
|
commit ba4254538f0f4b688cdc8e4aacd9fda3142d35fe
Author: William Brown <[email protected]>
Date: Thu Aug 29 10:28:08 2019 +1000
Ticket 50567, 50568 - strict host check disable and display container version
Bug Description: This is a minor fix to disable strict host checking
by default as it causes some installs to unexpectedly fail. We also
display the container version by default to aid future issue reports.
Fix Description: strict host check to false, and print paths.version.
https://pagure.io/389-ds-base/issue/50568
https://pagure.io/389-ds-base/issue/50567
Author: William Brown <[email protected]>
Review by: mreynolds (Thanks!)
diff --git a/src/lib389/cli/dscontainer b/src/lib389/cli/dscontainer
index e4bb0730e..7503b828d 100755
--- a/src/lib389/cli/dscontainer
+++ b/src/lib389/cli/dscontainer
@@ -67,6 +67,7 @@ def begin_magic():
#
# We wouldn't need this *except* for testing containers that build to /opt/dirsrv
paths = Paths(serverid='localhost')
+ log.info("389 Directory Server Version: %s" % paths.version)
# Make sure that /data/config, /data/ssca and /data/config exist, because
# k8s may not template them out.
diff --git a/src/lib389/lib389/instance/options.py b/src/lib389/lib389/instance/options.py
index 5ee69a351..702b60a2c 100644
--- a/src/lib389/lib389/instance/options.py
+++ b/src/lib389/lib389/instance/options.py
@@ -114,7 +114,7 @@ class General2Base(Options2):
self._type['full_machine_name'] = str
self._helptext['full_machine_name'] = "Sets the fully qualified hostname (FQDN) of this system. When installing this instance with GSSAPI authentication behind a load balancer, set this parameter to the FQDN of the load balancer and, additionally, set \"strict_host_checking\" to \"false\"."
- self._options['strict_host_checking'] = True
+ self._options['strict_host_checking'] = False
self._type['strict_host_checking'] = bool
self._helptext['strict_host_checking'] = "Sets whether the server verifies the forward and reverse record set in the \"full_machine_name\" parameter. When installing this instance with GSSAPI authentication behind a load balancer, set this parameter to \"false\". Container installs imply \"false\"."
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index 9a9cd824c..58012b334 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -244,7 +244,7 @@ class SetupDs(object):
# Set the defaults
general = {'config_version': 2, 'full_machine_name': socket.getfqdn(),
- 'strict_host_checking': True, 'selinux': True, 'systemd': ds_paths.with_systemd,
+ 'strict_host_checking': False, 'selinux': True, 'systemd': ds_paths.with_systemd,
'defaults': '999999999', 'start': True}
slapd = {'self_sign_cert_valid_months': 24,
@@ -288,24 +288,6 @@ class SetupDs(object):
if val != "":
general['full_machine_name'] = val
- # Strict host name checking
- msg = ("\nUse strict hostname verification (set to \"no\" if using GSSAPI behind a load balancer) [yes]: ")
- while 1:
- val = input(msg).rstrip().lower()
- if val != "":
- if val == "no" or val == "n":
- slapd['strict_host_checking'] = False
- break
- if val == "yes" or val == "y":
- # Use default
- break
-
- # Unknown value
- print ("Value \"{}\" is invalid, please use \"yes\" or \"no\"".format(val))
- continue
- else:
- break
-
# Instance name - adjust defaults once set
while 1:
slapd['instance_name'] = general['full_machine_name'].split('.', 1)[0]
| 0 |
8eb2ceeb145512395b670f4f7830dfdf830954df
|
389ds/389-ds-base
|
147368 - Made org chart brand agnostic
|
commit 8eb2ceeb145512395b670f4f7830dfdf830954df
Author: Nathan Kinder <[email protected]>
Date: Mon Feb 7 19:03:27 2005 +0000
147368 - Made org chart brand agnostic
diff --git a/ldap/clients/orgchart/botframe.html b/ldap/clients/orgchart/botframe.html
index 68c5e6fc0..7a8330765 100644
--- a/ldap/clients/orgchart/botframe.html
+++ b/ldap/clients/orgchart/botframe.html
@@ -2,7 +2,7 @@
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
- <title>Brandx Directory Server Org Chart</title>
+ <title>Directory Server Org Chart</title>
<LINK REL=stylesheet TYPE="text/css" HREF="styles.css">
</head>
<body bgcolor="#FFFFFF">
@@ -16,7 +16,7 @@ To find a person in your corporate organization chart, enter their<br>
name in the search box above, then click "Go"<br><br>
Below is a sample of an organization chart, with a description of the<br>
types of actions you can take<BR><BR>
-Thank you for using Brandx Directory Server Org Chart!
+Thank you for using the Directory Server Org Chart!
</td>
</tr>
</table>
diff --git a/ldap/clients/orgchart/config.tmpl b/ldap/clients/orgchart/config.tmpl
index 6ebf6890b..c5bfd749f 100644
--- a/ldap/clients/orgchart/config.tmpl
+++ b/ldap/clients/orgchart/config.tmpl
@@ -28,7 +28,7 @@ ldap-bind-pass
# disabled means never show this icon. Period. So MyOrgChart will not even show this icon as a setting.
#
-icons-aim-visible no
+icons-aim-visible disabled
icons-email-visible layer
icons-phonebook-visible forefront
icons-locator-visible disabled
diff --git a/ldap/clients/orgchart/index.html b/ldap/clients/orgchart/index.html
index a65783393..1bb68ae1e 100644
--- a/ldap/clients/orgchart/index.html
+++ b/ldap/clients/orgchart/index.html
@@ -2,7 +2,7 @@
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Expires" CONTENT="Thu, 01 Feb 1996 00:00:00 GMT">
- <TITLE>Brandx Directory Server Org Chart</TITLE>
+ <TITLE>Directory Server Org Chart</TITLE>
<SCRIPT LANGUAGE="javascript">
diff --git a/ldap/clients/orgchart/myorg.pl b/ldap/clients/orgchart/myorg.pl
index d3e9e78ed..0161415da 100755
--- a/ldap/clients/orgchart/myorg.pl
+++ b/ldap/clients/orgchart/myorg.pl
@@ -16,7 +16,7 @@ print "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
-<title>Customize: Brandx Directory Server Org Chart</title>
+<title>Customize: Directory Server Org Chart</title>
<LINK REL=stylesheet TYPE=\"text/css\" HREF=\"../html/styles.css\">
";
#-------------------------------------
diff --git a/ldap/clients/orgchart/nslogo.gif b/ldap/clients/orgchart/nslogo.gif
deleted file mode 100644
index e688bb41e..000000000
Binary files a/ldap/clients/orgchart/nslogo.gif and /dev/null differ
diff --git a/ldap/clients/orgchart/org.pl b/ldap/clients/orgchart/org.pl
index abbf4276a..c7eec21c6 100755
--- a/ldap/clients/orgchart/org.pl
+++ b/ldap/clients/orgchart/org.pl
@@ -786,7 +786,7 @@ function showLayer(cn,title,mail,dn,locator,aimid)
clearTimeout(timer);
hideLayer();
- finalhtml = '<TABLE border=1 CELLPADDING=15 BGCOLOR=\"#CBCBFD\"><TR><TD><TABLE BORDER=0>';
+ finalhtml = '<TABLE border=1 CELLPADDING=15 BGCOLOR=\"#CCCCCC\"><TR><TD><TABLE BORDER=0>';
finalhtml += '<TR><TD COLSPAN=2 NOWRAP>$fontstring<B>' + unescape(cn) + '</B></font></TD></TR>';
finalhtml += '<TR><TD COLSPAN=2 NOWRAP>$fontstring' + title + '</font></TD></TR>';
finalhtml += '<TR><TD COLSPAN=2 NOWRAP>';
@@ -1983,7 +1983,7 @@ sub output_html_header()
print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n";
print "<HTML>\n";
print "<HEAD>\n";
- print " <title>Brandx Directory Server Org Chart</title>\n";
+ print " <title>Directory Server Org Chart</title>\n";
if ( $js_output ne "with-javascript" )
{
diff --git a/ldap/clients/orgchart/styles.css b/ldap/clients/orgchart/styles.css
index 37b683e65..73bc65024 100644
--- a/ldap/clients/orgchart/styles.css
+++ b/ldap/clients/orgchart/styles.css
@@ -1,5 +1,5 @@
/* ======================================================================= *
- * Style sheet for the Netscape Directory Server Org Chart application *
+ * Style sheet for the Directory Server Org Chart application *
* ======================================================================= */
.bgColor7 {background-color: #66ccff;}
@@ -7,7 +7,7 @@
/* All Links */
A:link { font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px}
-A:active { color: #FF0000;}
+A:active { color: #000000;}
@@ -31,13 +31,13 @@ td.bold {
td.startPage {
font-family: verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
- color:#003366;
+ color:#000000;
vertical-align : middle;
}
-A.searchlinknorm:link {color: #CCFFFF}
-A.searchlinknorm:visited {color: #CCFFFF}
-A.searchlinknorm:active {color: #CCFFFF}
+A.searchlinknorm:link {color: #FFFFFF}
+A.searchlinknorm:visited {color: #FFFFFF}
+A.searchlinknorm:active {color: #FFFFFF}
A.searchlinkspec:link {color: #FF0000}
A.searchlinkspec:visited {color: #FF0000}
@@ -47,7 +47,7 @@ A.searchlinkspec:active {color: #CCFFFF}
/* *********Search frame*************/
body.Search {
- background-color: #003366;
+ background-color: #000000;
font-family: Verdana, Arial, Helvetica, san-serif;
color: #ccffff;
font-size: 12px;
@@ -55,9 +55,9 @@ body.Search {
td.appName {
font-family: verdana, Arial, Helvetica, sans-serif;
- font-size: 12px;
+ font-size: 16px;
vertical-align : middle;
- color: #ccffff;
+ color: #ffffff;
font-weight: bold;
}
@@ -65,7 +65,8 @@ td.appName {
font-family: verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
vertical-align: middle;
- color: #ccffff;
+ color: #ffffff;
+ font-weight: bold;
}
/* *********Search results frame*************/
@@ -79,7 +80,7 @@ th.resultsHeader {
td.pageHeader {
font-family: Verdana, Arial, Helvetica, san-serif;
- color: #003366;
+ color: #000000;
font-size: 14px;
font-weight : bold;
}
@@ -127,7 +128,7 @@ body.orgWindow {
td.prefsPageHead {
font-family: verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
- color:#003366;
+ color:#000000;
font-weight: bold;
vertical-align : middle;
border : none;
@@ -136,7 +137,7 @@ td.prefsPageHead {
td.prefsPageData {
font-family: verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
- color:#003366;
+ color:#000000;
vertical-align : middle;
border : none;
}
diff --git a/ldap/clients/orgchart/topframe.html b/ldap/clients/orgchart/topframe.html
index 4f5e17f9b..c6e1b637a 100644
--- a/ldap/clients/orgchart/topframe.html
+++ b/ldap/clients/orgchart/topframe.html
@@ -54,7 +54,7 @@ function doSearch(searchstring)
<TABLE BORDER="0" width="100%" cellpadding=0 cellspacing=0>
<TR>
-<TD ALIGN=LEFT VALIGN=CENTER class="appName" nowrap> Brandx Directory Server Org Chart</TD>
+<TD ALIGN=LEFT VALIGN=CENTER class="appName" nowrap> Directory Server Org Chart</TD>
<TD ALIGN=LEFT VALIGN=CENTER width="75%">
<TABLE BORDER=0>
<TR><TD nowrap VALIGN=CENTER ALIGN=CENTER>
@@ -75,8 +75,6 @@ function doSearch(searchstring)
<TD ALIGN=RIGHT>
<a href="../bin/myorg" target="output_window" class="searchlinknorm">Customize</a>
</TD>
-<TD ALIGN=RIGHT VALIGN=CENTER> <IMG SRC="nslogo.gif"></TD>
-
</TR>
</TABLE>
</CENTER>
| 0 |
b1034b6c140fe5dbaf2dc4948b32a92072c402cd
|
389ds/389-ds-base
|
Always use the internal regex functions : checkin lost in the AOL/RH move.
|
commit b1034b6c140fe5dbaf2dc4948b32a92072c402cd
Author: David Boreham <[email protected]>
Date: Fri Jan 28 20:16:03 2005 +0000
Always use the internal regex functions : checkin lost in the AOL/RH move.
diff --git a/ldap/include/regex.h b/ldap/include/regex.h
index 8d8f1e3ce..cc1c3e1d7 100644
--- a/ldap/include/regex.h
+++ b/ldap/include/regex.h
@@ -38,21 +38,21 @@ extern "C" {
#endif
#ifdef NEEDPROTOS
-int slapd_re_init( void );
-void slapd_re_lock( void );
-int slapd_re_unlock( void );
-char * LDAP_CALL slapd_re_comp( char *pat );
-int LDAP_CALL slapd_re_exec( char *lp );
-void LDAP_CALL slapd_re_modw( char *s );
-int LDAP_CALL slapd_re_subs( char *src, char *dst );
+int re_init( void );
+void re_lock( void );
+int re_unlock( void );
+char * LDAP_CALL re_comp( char *pat );
+int LDAP_CALL re_exec( char *lp );
+void LDAP_CALL re_modw( char *s );
+int LDAP_CALL re_subs( char *src, char *dst );
#else /* NEEDPROTOS */
-int slapd_re_init();
-void slapd_re_lock();
-int slapd_re_unlock();
-char * LDAP_CALL slapd_re_comp();
-int LDAP_CALL slapd_re_exec();
-void LDAP_CALL slapd_re_modw();
-int LDAP_CALL slapd_re_subs();
+int re_init();
+void re_lock();
+int re_unlock();
+char * LDAP_CALL re_comp();
+int LDAP_CALL re_exec();
+void LDAP_CALL re_modw();
+int LDAP_CALL re_subs();
#endif /* NEEDPROTOS */
#define re_fail( m, p )
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index d06a15f52..36609f8ff 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -12,9 +12,6 @@
#if defined(IRIX)
#include <unistd.h>
#endif
-#if defined( MACOS ) || defined( DOS ) || defined( _WIN32 ) || defined( NEED_BSDREGEX )
-#include "regex.h"
-#endif
static int string_filter_approx( struct berval *bvfilter,
Slapi_Value **bvals, Slapi_Value **retVal );
diff --git a/ldap/servers/slapd/getfilelist.c b/ldap/servers/slapd/getfilelist.c
index f24ed85a3..aa1b0152e 100644
--- a/ldap/servers/slapd/getfilelist.c
+++ b/ldap/servers/slapd/getfilelist.c
@@ -22,9 +22,6 @@
#include "prio.h"
#include "slap.h"
#include "avl.h"
-#if defined( MACOS ) || defined( DOS ) || defined( _WIN32 ) || defined( NEED_BSDREGEX )
-#include "regex.h"
-#endif
struct data_wrapper {
char **list;
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index b9f9fbcff..6a966039a 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -6,9 +6,6 @@
#include "slap.h"
#include "slapi-plugin.h"
#include "fe.h"
-#if defined( MACOS ) || defined( DOS ) || defined( _WIN32 ) || defined( NEED_BSDREGEX )
-#include "regex.h"
-#endif
/*
* Map SASL identities to LDAP searches
| 0 |
14a10a34b3ff10d5146d73e67aa54c8945cfa37d
|
389ds/389-ds-base
|
Revert "Ticket 49372 - filter optimisation improvements for common queries"
This reverts commit 4cd1a24b3ce88968ff5f9a2b87efdc84dee176da.
|
commit 14a10a34b3ff10d5146d73e67aa54c8945cfa37d
Author: Mark Reynolds <[email protected]>
Date: Fri Aug 24 16:24:21 2018 -0400
Revert "Ticket 49372 - filter optimisation improvements for common queries"
This reverts commit 4cd1a24b3ce88968ff5f9a2b87efdc84dee176da.
diff --git a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
index e61ece10a..7cb15fd25 100644
--- a/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
+++ b/dirsrvtests/tests/suites/filter/rfc3673_all_oper_attrs_test.py
@@ -148,12 +148,9 @@ def test_search_basic(topology_st, test_user, user_aci, add_attr,
else:
expected_attrs = sorted(oper_attr_list)
- log.info("suffix: %s filter: %s" % (search_suffix, search_filter))
entries = topology_st.standalone.search_s(search_suffix, ldap.SCOPE_BASE,
'(objectclass=*)',
search_filter)
- log.info("results: %s" % entries)
- assert len(entries) > 0
found_attrs = sorted(entries[0].data.keys())
if add_attr == '*':
@@ -162,7 +159,7 @@ def test_search_basic(topology_st, test_user, user_aci, add_attr,
assert all(attr in found_attrs
for attr in ['objectClass', expected_attrs[0]])
else:
- assert set(expected_attrs).issubset(set(found_attrs))
+ assert cmp(found_attrs, expected_attrs) == 0
if __name__ == '__main__':
diff --git a/ldap/admin/src/scripts/ns-slapd-gdb.py b/ldap/admin/src/scripts/ns-slapd-gdb.py
index eb99a6f45..3273d431d 100644
--- a/ldap/admin/src/scripts/ns-slapd-gdb.py
+++ b/ldap/admin/src/scripts/ns-slapd-gdb.py
@@ -16,22 +16,9 @@
import itertools
import re
-from enum import IntEnum
-
import gdb
from gdb.FrameDecorator import FrameDecorator
-class LDAPFilter(IntEnum):
- PRESENT = 0x87
- APPROX = 0xa8
- LE = 0xa6
- GE = 0xa5
- SUBSTRINGS = 0xa4
- EQUALITY = 0xa3
- NOT = 0xa2
- OR = 0xa1
- AND = 0xa0
-
class DSAccessLog (gdb.Command):
"""Display the Directory Server access log."""
def __init__ (self):
@@ -127,64 +114,7 @@ class DSIdleFilter():
frame_iter = map(DSIdleFilterDecorator, frame_iter)
return frame_iter
-class DSFilterPrint (gdb.Command):
- """Display a filter's contents"""
- def __init__ (self):
- super (DSFilterPrint, self).__init__ ("ds-filter-print", gdb.COMMAND_DATA)
-
- def display_filter(self, filter_element, depth=0):
- pad = " " * depth
- # Extract the choice, that determines what we access next.
- f_choice = filter_element['f_choice']
- f_un = filter_element['f_un']
- f_flags = filter_element['f_flags']
- if f_choice == LDAPFilter.PRESENT:
- print("%s(%s=*) flags:%s" % (pad, f_un['f_un_type'], f_flags))
- elif f_choice == LDAPFilter.APPROX:
- print("%sAPPROX ???" % pad)
- elif f_choice == LDAPFilter.LE:
- print("%sLE ???" % pad)
- elif f_choice == LDAPFilter.GE:
- print("%sGE ???" % pad)
- elif f_choice == LDAPFilter.SUBSTRINGS:
- f_un_sub = f_un['f_un_sub']
- value = f_un_sub['sf_initial']
- print("%s(%s=%s*) flags:%s" % (pad, f_un_sub['sf_type'], value, f_flags))
- elif f_choice == LDAPFilter.EQUALITY:
- f_un_ava = f_un['f_un_ava']
- value = f_un_ava['ava_value']['bv_val']
- print("%s(%s=%s) flags:%s" % (pad, f_un_ava['ava_type'], value, f_flags))
- elif f_choice == LDAPFilter.NOT:
- print("%sNOT ???" % pad)
- elif f_choice == LDAPFilter.OR:
- print("%s(| flags:%s" % (pad, f_flags))
- filter_child = f_un['f_un_complex'].dereference()
- self.display_filter(filter_child, depth + 4)
- print("%s)" % pad)
- elif f_choice == LDAPFilter.AND:
- # Our child filter is in f_un_complex.
- print("%s(& flags:%s" % (pad, f_flags))
- filter_child = f_un['f_un_complex'].dereference()
- self.display_filter(filter_child, depth + 4)
- print("%s)" % pad)
- else:
- print("Corrupted filter, no such value %s" % f_choice)
-
- f_next = filter_element['f_next']
- if f_next != 0:
- self.display_filter(f_next.dereference(), depth)
-
- def invoke (self, arg, from_tty):
- # Select our program state
- gdb.newest_frame()
- cur_frame = gdb.selected_frame()
- # We are given the name of a filter, so we need to look up that symbol.
- filter_val = cur_frame.read_var(arg)
- filter_root = filter_val.dereference()
- self.display_filter(filter_root)
-
DSAccessLog()
DSBacktrace()
DSIdleFilter()
-DSFilterPrint()
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 71e2a8fe0..b9a092c8d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -2072,13 +2072,8 @@ 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,
+ parententry, filter, 1 /* ManageDSAIT */,
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 966131cab..7f3600ec1 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -32,7 +32,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, Slapi_Filter *filter, int *lookup_returned_allidsp, int *err);
+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(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);
@@ -959,25 +959,13 @@ build_candidate_list(Slapi_PBlock *pb, backend *be, struct backentry *e, const c
break;
case LDAP_SCOPE_ONELEVEL:
- /* modify the filter to be: (&(parentid=idofbase)(|(originalfilter)(objectclass=referral))) */
- filter = create_onelevel_filter(filter, e, managedsait);
- /* Now optimise the filter for use */
- slapi_filter_optimise(filter);
-
- *candidates = onelevel_candidates(pb, be, base, filter, lookup_returned_allidsp, &err);
- /* Give the optimised filter back to search filter for free */
- slapi_pblock_set(pb, SLAPI_SEARCH_FILTER, filter);
+ *candidates = onelevel_candidates(pb, be, base, e, filter, managedsait,
+ lookup_returned_allidsp, &err);
break;
case LDAP_SCOPE_SUBTREE:
- /* make (|(originalfilter)(objectclass=referral)) */
- filter = create_subtree_filter(filter, managedsait);
- /* Now optimise the filter for use */
- slapi_filter_optimise(filter);
-
- *candidates = subtree_candidates(pb, be, base, e, filter, lookup_returned_allidsp, &err);
- /* Give the optimised filter back to search filter for free */
- slapi_pblock_set(pb, SLAPI_SEARCH_FILTER, filter);
+ *candidates = subtree_candidates(pb, be, base, e, filter, managedsait,
+ lookup_returned_allidsp, &err);
break;
default:
@@ -1036,15 +1024,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)
+create_referral_filter(Slapi_Filter *filter, Slapi_Filter **focref, Slapi_Filter **forr)
{
char *buf = slapi_ch_strdup("objectclass=referral");
- Slapi_Filter *focref = slapi_str2filter(buf);
- Slapi_Filter *forr = slapi_filter_join(LDAP_FILTER_OR, filter, focref);
+ *focref = slapi_str2filter(buf);
+ *forr = slapi_filter_join(LDAP_FILTER_OR, filter, *focref);
slapi_ch_free((void **)&buf);
- return forr;
+ return *forr;
}
/*
@@ -1058,20 +1046,20 @@ create_referral_filter(Slapi_Filter *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)
+create_onelevel_filter(Slapi_Filter *filter, const struct backentry *baseEntry, int managedsait, Slapi_Filter **fid2kids, Slapi_Filter **focref, Slapi_Filter **fand, Slapi_Filter **forr)
{
Slapi_Filter *ftop = filter;
char buf[40];
if (!managedsait) {
- ftop = create_referral_filter(filter);
+ ftop = create_referral_filter(filter, focref, forr);
}
sprintf(buf, "parentid=%lu", (u_long)(baseEntry != NULL ? baseEntry->ep_id : 0));
- Slapi_Filter *fid2kids = slapi_str2filter(buf);
- Slapi_Filter *fand = slapi_filter_join(LDAP_FILTER_AND, ftop, fid2kids);
+ *fid2kids = slapi_str2filter(buf);
+ *fand = slapi_filter_join(LDAP_FILTER_AND, ftop, *fid2kids);
- return fand;
+ return *fand;
}
/*
@@ -1082,16 +1070,38 @@ 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;
- candidates = filter_candidates(pb, be, base, filter, NULL, 0, err);
+ /*
+ * 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);
*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);
}
@@ -1106,12 +1116,12 @@ onelevel_candidates(
* This function is exported for the VLV code to use.
*/
Slapi_Filter *
-create_subtree_filter(Slapi_Filter *filter, int managedsait)
+create_subtree_filter(Slapi_Filter *filter, int managedsait, Slapi_Filter **focref, Slapi_Filter **forr)
{
Slapi_Filter *ftop = filter;
if (!managedsait) {
- ftop = create_referral_filter(filter);
+ ftop = create_referral_filter(filter, focref, forr);
}
return ftop;
@@ -1128,9 +1138,13 @@ 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;
@@ -1139,8 +1153,13 @@ 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, filter, NULL, 0, err, allidslimit);
+ candidates = filter_candidates_ext(pb, be, base, ftop, NULL, 0, err, allidslimit);
+ slapi_filter_free(forr, 0);
+ slapi_filter_free(focref, 0);
/* set 'allids before scoping' flag */
if (NULL != allids_before_scopingp) {
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index 6d772cd6b..f8b86d92e 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -568,9 +568,9 @@ int bedse_add_index_entry(int argc, char **argv);
/*
* ldbm_search.c
*/
-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);
+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);
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 0c09cb805..c4c0875ad 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -93,8 +93,13 @@ 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))) */
- p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, base, 0 /* managedsait */);
- slapi_filter_optimise(p->vlv_slapifilter);
+ {
+ 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);
+ }
}
/*
@@ -168,16 +173,22 @@ vlvSearch_init(struct vlvSearch *p, Slapi_PBlock *pb, const Slapi_Entry *e, ldbm
/* make (&(parentid=idofbase)(|(originalfilter)(objectclass=referral))) */
{
- p->vlv_slapifilter = create_onelevel_filter(p->vlv_slapifilter, e, 0 /* managedsait */);
- slapi_filter_optimise(p->vlv_slapifilter);
+ 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 */
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 */
- p->vlv_slapifilter = create_subtree_filter(p->vlv_slapifilter, 0 /* managedsait */);
- slapi_filter_optimise(p->vlv_slapifilter);
+ 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 */
} break;
}
}
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index e61e9d9ec..151c8ae41 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -1635,13 +1635,6 @@ dse_search(Slapi_PBlock *pb) /* JCM There should only be one exit point from thi
*/
isrootdse = slapi_sdn_isempty(basesdn);
- /*
- * 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: {
Slapi_Entry *baseentry = NULL;
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 87ec0dee0..393a4dcee 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -29,6 +29,7 @@ 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);
/*
@@ -74,12 +75,7 @@ get_filter(Connection *conn, BerElement *ber, int scope, struct slapi_filter **f
slapi_filter_to_string(*filt, logbuf, logbufsize));
}
- /*
- * 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); */
+ filter_optimize(*filt);
if (NULL != logbuf) {
slapi_log_err(SLAPI_LOG_DEBUG, "get_filter", " after optimize: %s\n",
@@ -862,22 +858,19 @@ 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;
@@ -890,8 +883,6 @@ 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;
}
@@ -1536,175 +1527,47 @@ 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) {
- /* Cut our current AND/OR out */
- if (*f_prev != NULL) {
- (*f_prev)->f_next = (*f_cur)->f_next;
- } else if (*list == *f_cur) {
- *list = (*f_cur)->f_next;
- }
- (*f_next) = (*f_cur)->f_next;
-
- /* Look ahead to the end of our list, without the f_cur. */
- Slapi_Filter *f_cur_tail = *list;
- while (f_cur_tail->f_next != NULL) {
- f_cur_tail = f_cur_tail->f_next;
- }
- /* Now append our descendant into the tail */
- f_cur_tail->f_next = (*f_cur)->f_list;
- /* Finally free the remainder */
- slapi_filter_free(*f_cur, 0);
-}
-
-/* slapi_filter_optimise
+/* filter_optimize
* ---------------
- * 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.
+ * 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
*/
-void
-slapi_filter_optimise(Slapi_Filter *f)
+static void
+filter_optimize(Slapi_Filter *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) {
+ if (!f)
return;
- }
switch (f->f_choice) {
case LDAP_FILTER_AND:
- /* 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;
+ 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;
break;
}
- }
- if (f_op_head != NULL) {
- f_op_tail->f_next = f->f_list;
- f->f_list = f_op_head;
+ f_prev = f_child;
}
}
- /* 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:
- slapi_filter_optimise(f->f_next);
+ filter_optimize(f->f_next);
break;
}
}
diff --git a/ldap/servers/slapd/index_subsystem.c b/ldap/servers/slapd/index_subsystem.c
index 7d7e1b782..97cb7b489 100644
--- a/ldap/servers/slapd/index_subsystem.c
+++ b/ldap/servers/slapd/index_subsystem.c
@@ -191,10 +191,6 @@ index_subsys_assign_filter_decoders(Slapi_PBlock *pb)
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) {
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 837ca8edd..d93693b6b 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -383,7 +383,6 @@ 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 */
| 0 |
8b25700231e939250bd20329dd9eaee5febfcb60
|
389ds/389-ds-base
|
Issue 4262 - Fix Index out of bound in fractional test (#4828)
Bug description:
In master branch there are by default 2 groups while
in 1.4.3 it exists only one. So the index '1'
in the retrieved groups raise 'invalid index' exception
in 1.4.3.
Fix description:
Retrieve the specific group bug739172_01group
to test its membership
relates: https://github.com/389ds/389-ds-base/issues/4262
Reviewed by:
Platforms tested: 8.5, fedora
foo
|
commit 8b25700231e939250bd20329dd9eaee5febfcb60
Author: tbordaz <[email protected]>
Date: Fri Jul 2 18:02:54 2021 +0200
Issue 4262 - Fix Index out of bound in fractional test (#4828)
Bug description:
In master branch there are by default 2 groups while
in 1.4.3 it exists only one. So the index '1'
in the retrieved groups raise 'invalid index' exception
in 1.4.3.
Fix description:
Retrieve the specific group bug739172_01group
to test its membership
relates: https://github.com/389ds/389-ds-base/issues/4262
Reviewed by:
Platforms tested: 8.5, fedora
foo
diff --git a/dirsrvtests/tests/suites/fractional/fractional_test.py b/dirsrvtests/tests/suites/fractional/fractional_test.py
index 7382e7987..0926cbadd 100644
--- a/dirsrvtests/tests/suites/fractional/fractional_test.py
+++ b/dirsrvtests/tests/suites/fractional/fractional_test.py
@@ -311,7 +311,8 @@ def test_newly_added_attribute_nsds5replicatedattributelisttotal(_create_entries
check_all_replicated()
user = f'uid=test_user_1000,ou=People,{DEFAULT_SUFFIX}'
for instance in (SUPPLIER1, SUPPLIER2, CONSUMER1, CONSUMER2):
- assert Groups(instance, DEFAULT_SUFFIX).list()[1].get_attr_val_utf8("member") == user
+ g = Groups(instance, DEFAULT_SUFFIX).get('bug739172_01group')
+ assert g.get_attr_val_utf8("member") == user
assert UserAccount(instance, user).get_attr_val_utf8("sn") == "test_user_1000"
# The attributes mentioned in the nsds5replicatedattributelist
# excluded from incremental updates.
| 0 |
c302c633daa121285be606671f25bc3ed6f1deb0
|
389ds/389-ds-base
|
5011 - test_replica_backup_and_restore random failure (#5028)
* 5011 - test_replica_backup_and_restore random failure
|
commit c302c633daa121285be606671f25bc3ed6f1deb0
Author: progier389 <[email protected]>
Date: Thu Nov 25 12:09:33 2021 +0100
5011 - test_replica_backup_and_restore random failure (#5028)
* 5011 - test_replica_backup_and_restore random failure
diff --git a/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py b/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
index 9cebe1cf4..a621455e6 100644
--- a/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
+++ b/dirsrvtests/tests/suites/fourwaymmr/fourwaymmr_test.py
@@ -429,6 +429,16 @@ def test_bob_acceptance_tests(topo_m4):
repl.wait_for_replication(topo_m4.ms["supplier2"], topo_m4.ms["supplier1"])
+def list_agmt_towards(topo_m4, serverid):
+ # Note: all instances must be started to use that.
+ res = []
+ for inst in topo_m4:
+ for agmt in Agreements(inst).list():
+ if agmt.get_attr_val_utf8(AGMT_PORT) == topo_m4.ms[serverid].port:
+ res.append(agmt)
+ return res
+
+
@pytest.mark.bz830335
def test_replica_backup_and_restore(topo_m4):
"""Test Backup and restore
@@ -475,6 +485,9 @@ def test_replica_backup_and_restore(topo_m4):
for i in users.list(): topo_m4.ms["supplier1"].delete_s(i.dn)
repl.wait_for_replication(topo_m4.ms["supplier1"], topo_m4.ms["supplier2"])
repl.test_replication(topo_m4.ms["supplier1"], topo_m4.ms["supplier2"], 30)
+ # disable the agmt (while server is up) to avoid the DEL get replayed too early
+ for agmt in list_agmt_towards(topo_m4, "supplier1"):
+ agmt.pause()
topo_m4.ms["supplier1"].stop()
topo_m4.ms["supplier1"].ldif2db(
bename=None,
@@ -490,6 +503,10 @@ def test_replica_backup_and_restore(topo_m4):
testuser = UserAccount(topo_m4.ms["supplier1"], i.dn)
assert testuser.exists()
+ # Re enable the agmts
+ for agmt in list_agmt_towards(topo_m4, "supplier1"):
+ agmt.resume()
+
# Here the changelog of supplier1 has been cleared.
# Let's wait the supplier2 resync supplier1 BEFORE doing
# any update to supplier1.
| 0 |
5337dcfa67827ac46df68a2f817eade638eb352d
|
389ds/389-ds-base
|
Ticket #47391 - deleting and adding userpassword fails to update the password (additional fix)
Bug description: ldapmodify with changetype "modify" is supposed
to skip checking unhashed password in acl_check_mods. "delete"
and "replace" were being skipped, but not "add".
Fix description: "add" also skips to check unhashed password.
https://fedorahosted.org/389/ticket/47391
Reviewed by Rich (Thank you!!)
|
commit 5337dcfa67827ac46df68a2f817eade638eb352d
Author: Noriko Hosoi <[email protected]>
Date: Mon Jun 17 13:02:10 2013 -0700
Ticket #47391 - deleting and adding userpassword fails to update the password (additional fix)
Bug description: ldapmodify with changetype "modify" is supposed
to skip checking unhashed password in acl_check_mods. "delete"
and "replace" were being skipped, but not "add".
Fix description: "add" also skips to check unhashed password.
https://fedorahosted.org/389/ticket/47391
Reviewed by Rich (Thank you!!)
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index 2f417f33b..e001aea2e 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -1358,6 +1358,9 @@ acl_check_mods(
for (mod = slapi_mods_get_first_mod(&smods);
mod != NULL;
mod = slapi_mods_get_next_mod(&smods)) {
+ if (0 == strcmp(mod->mod_type, PSEUDO_ATTR_UNHASHEDUSERPASSWORD)) {
+ continue;
+ }
switch (mod->mod_op & ~LDAP_MOD_BVALUES ) {
case LDAP_MOD_DELETE:
@@ -1386,9 +1389,7 @@ acl_check_mods(
}
if (lastmod &&
(strcmp (mod->mod_type, "modifiersname")== 0 ||
- strcmp (mod->mod_type, "modifytimestamp")== 0 ||
- strcmp (mod->mod_type, PSEUDO_ATTR_UNHASHEDUSERPASSWORD)== 0)
- ) {
+ strcmp (mod->mod_type, "modifytimestamp")== 0)) {
/* skip pseudo attr(s) */
continue;
}
@@ -1401,9 +1402,9 @@ acl_check_mods(
while(k != -1) {
attrVal = slapi_value_get_berval(sval);
rv = slapi_access_allowed (pb, e,
- mod->mod_type,
- (struct berval *)attrVal, /* XXXggood had to cast away const - BAD */
- ACLPB_SLAPI_ACL_WRITE_DEL); /* was SLAPI_ACL_WRITE */
+ mod->mod_type,
+ (struct berval *)attrVal, /* XXXggood had to cast away const - BAD */
+ ACLPB_SLAPI_ACL_WRITE_DEL); /* was SLAPI_ACL_WRITE */
if ( rv != LDAP_SUCCESS) {
acl_gen_err_msg (
SLAPI_ACL_WRITE,
@@ -1435,7 +1436,7 @@ acl_check_mods(
}
break;
- default:
+ default: /* including LDAP_MOD_ADD */
break;
} /* switch */
| 0 |
0d446f9385c7746eb0f0391c8cd7935aa7279502
|
389ds/389-ds-base
|
Resolves: bug 260341
Bug Description: Migration script references a non-existing directory
Reviewed by: nhosoi (Thanks!)
Fix Description: This fixes a couple of problems.
1) Use the inst_dir from the directory server as the instance dir where the ldif2db script is found.
2) The password for migratecred should be quoted before being passed to the shell, in case there are shell meta chars in there
3) If using cross platform migration, and no LDIF files were found to migrate, this will cause an error message to be printed and migration will be aborted.
Platforms tested: RHEL4 i386, RHEL5 x86_64
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
|
commit 0d446f9385c7746eb0f0391c8cd7935aa7279502
Author: Rich Megginson <[email protected]>
Date: Thu Aug 30 00:06:51 2007 +0000
Resolves: bug 260341
Bug Description: Migration script references a non-existing directory
Reviewed by: nhosoi (Thanks!)
Fix Description: This fixes a couple of problems.
1) Use the inst_dir from the directory server as the instance dir where the ldif2db script is found.
2) The password for migratecred should be quoted before being passed to the shell, in case there are shell meta chars in there
3) If using cross platform migration, and no LDIF files were found to migrate, this will cause an error message to be printed and migration will be aborted.
Platforms tested: RHEL4 i386, RHEL5 x86_64
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index a0488e131..ff701d443 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -152,8 +152,8 @@ sub getNewDbDir {
sub migrateCredentials {
my ($ent, $attr, $mig, $inst) = @_;
my $oldval = $ent->getValues($attr);
- debug(3, "Executing @bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval . . .\n");
- my $newval = `@bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval`;
+ debug(3, "Executing @bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c \'$oldval\' . . .\n");
+ my $newval = `@bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c \'$oldval\'`;
debug(3, "Converted old value [$oldval] to new value [$newval] for attr $attr in entry ", $ent->getDN(), "\n");
return $newval;
}
@@ -235,18 +235,15 @@ sub migrateDatabases {
my $olddefault = "$mig->{actualsroot}/$inst/db"; # old default db home directory
my @errs;
+ # the ldif2db command will be in nsslapd-instancedir
+ my $cfgent = $dest->search("cn=config", "base", "(objectclass=*)");
+ my $inst_dir = $cfgent->getValues('nsslapd-instancedir');
# first, look for an LDIF file in that directory with the same name as the
# database
my $foundldif;
for (glob("$mig->{oldsroot}/$inst/db/*.ldif")) {
my $dbname = basename($_, '.ldif');
- my $cmd = "";
- if ("@with_fhs_opt@") {
- $cmd = "/opt/@PACKAGE_NAME@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
- } else {
- $cmd = "@serverdir@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
- }
-
+ my $cmd = "$inst_dir/ldif2db -n \"$dbname\" -i \"$_\"";
debug(1, "migrateDatabases: executing command $cmd\n");
$? = 0; # clear error condition
my $output = `$cmd 2>&1`;
@@ -259,6 +256,8 @@ sub migrateDatabases {
if ($foundldif) {
return (); # done - can do nothing else for cross-platform
+ } elsif ($mig->{crossplatform}) { # cross platform requires LDIF files
+ return ('ldif_required_for_cross_platform', "$mig->{oldsroot}/$inst/db");
}
# if no LDIF files, just copy over the database directories
diff --git a/ldap/admin/src/scripts/migrate-ds.res b/ldap/admin/src/scripts/migrate-ds.res
index 9629e9bd7..05d1677d2 100644
--- a/ldap/admin/src/scripts/migrate-ds.res
+++ b/ldap/admin/src/scripts/migrate-ds.res
@@ -17,3 +17,8 @@ error_copying_keydb = Could not copy the private key database file '%s' to '%s'.
error_copying_secmoddb = Could not copy the security module database file '%s' to '%s'. Error: %s\n
error_copying_pinfile = Could not copy the key database PIN file '%s' to '%s'. Error: %s\n
error_copying_certmap = Could not copy the client certificate mapping file '%s' to '%s'. Error: %s\n
+ldif_required_for_cross_platform = No LDIF files were found in %s.\n
+LDIF files are required in order to do cross platform migration. The\
+database files are not binary compatible, and the new databases must\
+be initialized from an LDIF export of the old databases. Please refer\
+to the migration instructions for help with how to do this.\n\n
| 0 |
19e75b97d2d54f082d518843e3d09f2da2deb1a6
|
389ds/389-ds-base
|
Ticket #48896 - CI test: test case for ticket 48896
Description: Default Setting for passwordMinTokenLength does not work
|
commit 19e75b97d2d54f082d518843e3d09f2da2deb1a6
Author: Noriko Hosoi <[email protected]>
Date: Wed Jun 22 18:17:15 2016 -0700
Ticket #48896 - CI test: test case for ticket 48896
Description: Default Setting for passwordMinTokenLength does not work
diff --git a/dirsrvtests/tests/tickets/ticket48896_test.py b/dirsrvtests/tests/tickets/ticket48896_test.py
new file mode 100644
index 000000000..b2675ecb3
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket48896_test.py
@@ -0,0 +1,181 @@
+# --- 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 ---
+#
+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 *
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+CONFIG_DN = 'cn=config'
+UID = 'buser123'
+TESTDN = 'uid=%s,' % UID + DEFAULT_SUFFIX
+
+logging.getLogger(__name__).setLevel(logging.DEBUG)
+log = logging.getLogger(__name__)
+
+installation1_prefix = None
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
[email protected](scope="module")
+def topology(request):
+ global installation1_prefix
+ if installation1_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation1_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 check_attr_val(topology, dn, attr, expected):
+ try:
+ centry = topology.standalone.search_s(dn, ldap.SCOPE_BASE, 'cn=*')
+ if centry:
+ val = centry[0].getValue(attr)
+ if val == expected:
+ log.info('Default value of %s is %s' % (attr, expected))
+ else:
+ log.info('Default value of %s is not %s, but %s' % (attr, expected, val))
+ assert False
+ else:
+ log.fatal('Failed to get %s' % dn)
+ assert False
+ except ldap.LDAPError as e:
+ log.fatal('Failed to search ' + dn + ': ' + e.message['desc'])
+ assert False
+
+def replace_pw(server, curpw, newpw, expstr, rc):
+ log.info('Binding as {%s, %s}' % (TESTDN, curpw))
+ server.simple_bind_s(TESTDN, curpw)
+
+ hit = 0
+ log.info('Replacing password: %s -> %s, which should %s' % (curpw, newpw, expstr))
+ try:
+ server.modify_s(TESTDN, [(ldap.MOD_REPLACE, 'userPassword', newpw)])
+ except Exception as e:
+ log.info("Exception (expected): %s" % type(e).__name__)
+ hit = 1
+ assert isinstance(e, rc)
+
+ if (0 != rc) and (0 == hit):
+ log.info('Expected to fail with %d, but passed' % rc)
+ assert False
+
+ log.info('PASSED')
+
+def test_ticket48896(topology):
+ """
+ """
+ log.info('Testing Ticket 48896 - Default Setting for passwordMinTokenLength does not work')
+
+ log.info("Setting global password policy with password syntax.")
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+ topology.standalone.modify_s(CONFIG_DN, [(ldap.MOD_REPLACE, 'passwordCheckSyntax', 'on'),
+ (ldap.MOD_REPLACE, 'nsslapd-pwpolicy-local', 'on')])
+
+ config = topology.standalone.search_s(CONFIG_DN, ldap.SCOPE_BASE, 'cn=*')
+ mintokenlen = config[0].getValue('passwordMinTokenLength')
+ history = config[0].getValue('passwordInHistory')
+
+ log.info('Default passwordMinTokenLength == %s' % mintokenlen)
+ log.info('Default passwordInHistory == %s' % history)
+
+ log.info('Adding a user.')
+ curpw = 'password'
+ topology.standalone.add_s(Entry((TESTDN,
+ {'objectclass': "top person organizationalPerson inetOrgPerson".split(),
+ 'cn': 'test user',
+ 'sn': 'user',
+ 'userPassword': curpw})))
+
+ newpw = 'Abcd012+'
+ exp = 'be ok'
+ rc = 0
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = 'user'
+ exp = 'fail'
+ rc = ldap.CONSTRAINT_VIOLATION
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = UID
+ exp = 'fail'
+ rc = ldap.CONSTRAINT_VIOLATION
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = 'Tuse!1234'
+ exp = 'fail'
+ rc = ldap.CONSTRAINT_VIOLATION
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = 'Tuse!0987'
+ exp = 'fail'
+ rc = ldap.CONSTRAINT_VIOLATION
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = 'Tabc!1234'
+ exp = 'fail'
+ rc = ldap.CONSTRAINT_VIOLATION
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ curpw = 'Abcd012+'
+ newpw = 'Direc+ory389'
+ exp = 'be ok'
+ rc = 0
+ replace_pw(topology.standalone, curpw, newpw, exp, rc)
+
+ log.info('SUCCESS')
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
| 0 |
269ff667c03b4aed20d8bfbb7143684db69088e0
|
389ds/389-ds-base
|
Fix format error in print statement
One line commit rule
|
commit 269ff667c03b4aed20d8bfbb7143684db69088e0
Author: Mark Reynolds <[email protected]>
Date: Wed Jul 20 18:39:40 2016 -0400
Fix format error in print statement
One line commit rule
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 7d2661b01..f19a1d032 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -1427,7 +1427,7 @@ class DirSrv(SimpleLDAPObject):
"""Return the server identifier."""
return self.serverid
- def get_ldif_dir(self, prefix=None):
+ def get_ldif_dir(self):
"""Return the server instance ldif directory."""
try:
ldif_dir = self.getEntry(DN_CONFIG).__getattr__('nsslapd-ldifdir')
@@ -1436,7 +1436,7 @@ class DirSrv(SimpleLDAPObject):
return ldif_dir
- def get_bak_dir(self, prefix=None):
+ def get_bak_dir(self):
"""Return the server instance ldif directory."""
try:
bak_dir = self.getEntry(DN_CONFIG).__getattr__('nsslapd-bakdir')
@@ -2106,7 +2106,7 @@ class DirSrv(SimpleLDAPObject):
break
except ldap.LDAPError as e:
log.fatal('testReplication() failed to modify (%s),' +
- ' error (%d)' % (suffix, str(e)))
+ ' error (%s)' % (suffix, str(e)))
return False
loop += 1
time.sleep(2)
| 0 |
52c46931868eb0457d255edeae32d72398f79a42
|
389ds/389-ds-base
|
Summary: Re-generated autotools build files.
|
commit 52c46931868eb0457d255edeae32d72398f79a42
Author: Nathan Kinder <[email protected]>
Date: Mon Oct 1 19:04:02 2007 +0000
Summary: Re-generated autotools build files.
diff --git a/Makefile.in b/Makefile.in
index eb2f75304..b89a7856a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -850,6 +850,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@
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 8261fda7c..afaae43a5 100755
--- a/configure
+++ b/configure
@@ -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_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec 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 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_bitwise_TRUE enable_bitwise_FALSE with_fhs_opt configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir perldir infdir defaultuser defaultgroup instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir perlexec 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 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.
@@ -3836,6 +3836,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
@@ -3870,6 +3871,7 @@ done
fi
SED=$lt_cv_path_SED
+
echo "$as_me:$LINENO: result: $SED" >&5
echo "${ECHO_T}$SED" >&6
@@ -4310,7 +4312,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4313 "configure"' > conftest.$ac_ext
+ echo '#line 4315 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5445,7 +5447,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:5448:" \
+echo "$as_me:5450:" \
"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
@@ -6508,11 +6510,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:6511: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6513: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6515: \$? = $ac_status" >&5
+ echo "$as_me:6517: \$? = $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.
@@ -6776,11 +6778,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:6779: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6781: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6783: \$? = $ac_status" >&5
+ echo "$as_me:6785: \$? = $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.
@@ -6880,11 +6882,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:6883: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6885: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6887: \$? = $ac_status" >&5
+ echo "$as_me:6889: \$? = $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
@@ -8345,10 +8347,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 8354 "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
@@ -9225,7 +9248,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9228 "configure"
+#line 9251 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9325,7 +9348,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9328 "configure"
+#line 9351 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9656,6 +9679,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
@@ -9789,11 +9815,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.
@@ -9805,7 +9831,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
@@ -9885,7 +9911,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
@@ -11665,11 +11691,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:11668: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11694: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11672: \$? = $ac_status" >&5
+ echo "$as_me:11698: \$? = $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.
@@ -11769,11 +11795,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:11772: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11798: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11776: \$? = $ac_status" >&5
+ echo "$as_me:11802: \$? = $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
@@ -12301,10 +12327,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 12334 "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
@@ -12688,6 +12735,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
@@ -12821,11 +12871,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.
@@ -12837,7 +12887,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
@@ -12917,7 +12967,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
@@ -13339,11 +13389,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:13342: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13392: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13346: \$? = $ac_status" >&5
+ echo "$as_me:13396: \$? = $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.
@@ -13443,11 +13493,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:13446: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13496: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13450: \$? = $ac_status" >&5
+ echo "$as_me:13500: \$? = $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
@@ -14888,10 +14938,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 14945 "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
@@ -15275,6 +15346,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
@@ -15408,11 +15482,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.
@@ -15424,7 +15498,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
@@ -15504,7 +15578,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
@@ -15646,11 +15720,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:15649: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15723: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15653: \$? = $ac_status" >&5
+ echo "$as_me:15727: \$? = $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.
@@ -15914,11 +15988,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:15917: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15991: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15921: \$? = $ac_status" >&5
+ echo "$as_me:15995: \$? = $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.
@@ -16018,11 +16092,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:16021: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16095: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16025: \$? = $ac_status" >&5
+ echo "$as_me:16099: \$? = $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
@@ -17483,10 +17557,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 17564 "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
@@ -17870,6 +17965,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
@@ -18003,11 +18101,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.
@@ -18019,7 +18117,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
@@ -18099,7 +18197,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
@@ -18351,6 +18449,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
@@ -18484,11 +18585,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.
@@ -18500,7 +18601,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
@@ -18580,7 +18681,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
@@ -25919,6 +26020,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/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.
| 0 |
120b10733354094739d0ace8225b9db3ca9f7986
|
389ds/389-ds-base
|
Ticket 49101 - Python 2 generate example entries
Bug Description: In order to move to the new python installer, we need feature
parity with the existing perl installer. Currently, we are missing one feature,
which is sample entry creation. We need this for our test cases to run.
However, we also don't want to be stuck on the current set of sample entries.
They suck pretty hard, and the acis are just plain terrible. Yet our tests and
customers may depend on them.
Fix Description: This contains multiple parts to solve the problem.
First, we add a set of identity management objects for groups, ous, users,
services accounts and more. This will greatly simplify our test code, and what
we can create.
Next, we add a set of managers that can apply version configs or sample entries.
We then wire in the capability for instance.create() to use the python installer,
be it via explicit request or environment variable (PYINSTALL) being set.
This way, we can now use the python installer experimentally during tests. A number
of my tests show this already passes.
The great benefit of using python to create the sample entries and configs, is
that they are programatic, versioned, can be unit tested, refactored, they are
portable, no more text file manipulation. We can also use the same code for *upgrade*
as we use for installs, making our tools and proceedures more consistent and
reliable.
A key point of this is that we will be able to install a 1.3.7 server, but with
1.3.6 defaults, or a 1.4.x server with 1.3.7 settings etc. New installs can be
kept in sync with older replicas. Once they are upgraded, we can then do proper
upgrades with the same code that does installs.
This also paves the way for us to add basic user and object management tools for
those unwilling to go the whole way into an IPA install.
https://fedorahosted.org/389/ticket/49101
Author: wibrown
Review by: spichugi (Thanks)
|
commit 120b10733354094739d0ace8225b9db3ca9f7986
Author: William Brown <[email protected]>
Date: Tue Jan 31 13:05:10 2017 +1000
Ticket 49101 - Python 2 generate example entries
Bug Description: In order to move to the new python installer, we need feature
parity with the existing perl installer. Currently, we are missing one feature,
which is sample entry creation. We need this for our test cases to run.
However, we also don't want to be stuck on the current set of sample entries.
They suck pretty hard, and the acis are just plain terrible. Yet our tests and
customers may depend on them.
Fix Description: This contains multiple parts to solve the problem.
First, we add a set of identity management objects for groups, ous, users,
services accounts and more. This will greatly simplify our test code, and what
we can create.
Next, we add a set of managers that can apply version configs or sample entries.
We then wire in the capability for instance.create() to use the python installer,
be it via explicit request or environment variable (PYINSTALL) being set.
This way, we can now use the python installer experimentally during tests. A number
of my tests show this already passes.
The great benefit of using python to create the sample entries and configs, is
that they are programatic, versioned, can be unit tested, refactored, they are
portable, no more text file manipulation. We can also use the same code for *upgrade*
as we use for installs, making our tools and proceedures more consistent and
reliable.
A key point of this is that we will be able to install a 1.3.7 server, but with
1.3.6 defaults, or a 1.4.x server with 1.3.7 settings etc. New installs can be
kept in sync with older replicas. Once they are upgraded, we can then do proper
upgrades with the same code that does installs.
This also paves the way for us to add basic user and object management tools for
those unwilling to go the whole way into an IPA install.
https://fedorahosted.org/389/ticket/49101
Author: wibrown
Review by: spichugi (Thanks)
diff --git a/src/lib389/Makefile b/src/lib389/Makefile
index e8d7e9093..e6a577de5 100644
--- a/src/lib389/Makefile
+++ b/src/lib389/Makefile
@@ -9,7 +9,7 @@ build:
$(PYTHON) setup.py build
install:
- $(PYTHON) setup.py install --force --root=/
+ $(PYTHON) setup.py install --skip-build --force --root=/
rpmbuild-prep:
mkdir -p ./dist/
diff --git a/src/lib389/examples/ds-setup.inf b/src/lib389/examples/ds-setup.inf
index 3da0a51fb..1f1778bf9 100644
--- a/src/lib389/examples/ds-setup.inf
+++ b/src/lib389/examples/ds-setup.inf
@@ -29,12 +29,11 @@ secure_port=636
root_dn=cn=Directory Manager
root_password=password
prefix=/opt/dirsrv
-defaults=latest
[backend-userRoot]
suffix=dc=example,dc=com
; this is controlled by slapd.InstallLdifFile == none, suggest or path in setup-ds.pl
-sample_entries=yes
+sample_entries=999999999
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index 4394ecec7..c7cf0bb4b 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -880,7 +880,7 @@ class DirSrv(SimpleLDAPObject, object):
# This may conflict in some tests, we may need to use /etc/host
# aliases or we may need to use server id
self.krb5_realm.create_principal(principal='ldap/%s' % self.host)
- ktab = '%s/etc/dirsrv/slapd-%s/ldap.keytab' % (self.prefix, self.serverid)
+ ktab = '%s/ldap.keytab' % (self.ds_paths.config_dir)
self.krb5_realm.create_keytab(principal='ldap/%s' % self.host, keytab=ktab)
with open('%s/dirsrv-%s' % (self.ds_paths.initconfig_dir, self.serverid), 'a') as sfile:
sfile.write("\nKRB5_KTNAME=%s/etc/dirsrv/slapd-%s/"
@@ -890,7 +890,57 @@ class DirSrv(SimpleLDAPObject, object):
# Restart the instance
- def create(self):
+ def _createPythonDirsrv(self, version):
+ """
+ Create a new dirsrv instance based on the new python installer, rather
+ than setup-ds.pl
+
+ version represents the config default and sample entry version to use.
+ """
+ from lib389.instance.setup import SetupDs
+ from lib389.instance.options import General2Base, Slapd2Base
+ # Import the new setup ds library.
+ sds = SetupDs(verbose=self.verbose, dryrun=False, log=self.log)
+ # Configure the options.
+ general_options = General2Base(self.log)
+ general_options.set('strict_host_checking', False)
+ general_options.verify()
+ general = general_options.collect()
+
+ slapd_options = Slapd2Base(self.log)
+ slapd_options.set('instance_name', self.serverid)
+ slapd_options.set('port', self.port)
+ slapd_options.set('secure_port', self.sslport)
+ slapd_options.set('root_password', self.bindpw)
+ slapd_options.set('root_dn', self.binddn)
+ slapd_options.set('defaults', version)
+
+ slapd_options.verify()
+ slapd = slapd_options.collect()
+
+ # In order to work by "default" for tests, we need to create a backend.
+ userroot = {
+ 'cn': 'userRoot',
+ 'nsslapd-suffix': self.creation_suffix,
+ BACKEND_SAMPLE_ENTRIES: version,
+ }
+ backends = [userroot,]
+
+ # Go!
+ sds.create_from_args(general, slapd, backends, None)
+ if self.realm is not None:
+ # This may conflict in some tests, we may need to use /etc/host
+ # aliases or we may need to use server id
+ self.krb5_realm.create_principal(principal='ldap/%s' % self.host)
+ ktab = '%s/ldap.keytab' % (self.ds_paths.config_dir)
+ self.krb5_realm.create_keytab(principal='ldap/%s' % self.host, keytab=ktab)
+ with open('%s/dirsrv-%s' % (self.ds_paths.initconfig_dir, self.serverid), 'a') as sfile:
+ sfile.write("\nKRB5_KTNAME=%s/etc/dirsrv/slapd-%s/"
+ "ldap.keytab\nexport KRB5_KTNAME\n" %
+ (self.prefix, self.serverid))
+ self.restart()
+
+ def create(self, pyinstall=False, version=INSTALL_LATEST_CONFIG):
"""
Creates an instance with the parameters sets in dirsrv
The state change from DIRSRV_STATE_ALLOCATED ->
@@ -918,8 +968,16 @@ class DirSrv(SimpleLDAPObject, object):
raise ValueError("SER_SERVERID_PROP is missing, " +
"it is required to create an instance")
+ # Check how we want to be installed.
+ env_pyinstall = False
+ if os.getenv('PYINSTALL', False) is not False:
+ env_pyinstall = True
# Time to create the instance and retrieve the effective sroot
- self._createDirsrv()
+
+ if (env_pyinstall or pyinstall):
+ self._createPythonDirsrv(version)
+ else:
+ self._createDirsrv()
# Retrieve sroot from the sys/priv config file
props = self.list()
@@ -1544,6 +1602,9 @@ class DirSrv(SimpleLDAPObject, object):
def get_config_dir(self):
return self.ds_paths.config_dir
+ def get_cert_dir(self):
+ return self.ds_paths.cert_dir
+
def get_sysconf_dir(self):
return self.ds_paths.sysconf_dir
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index 0e7c742b1..96e551732 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -15,6 +15,8 @@ from lib389.properties import *
LEAF_TYPE
) = list(range(3))
+INSTALL_LATEST_CONFIG = '999999999'
+
REPLICAROLE_MASTER = "master"
REPLICAROLE_HUB = "hub"
REPLICAROLE_CONSUMER = "consumer"
diff --git a/src/lib389/lib389/_mapped_object.py b/src/lib389/lib389/_mapped_object.py
index c05282a5e..7d3afa1c9 100644
--- a/src/lib389/lib389/_mapped_object.py
+++ b/src/lib389/lib389/_mapped_object.py
@@ -265,6 +265,13 @@ class DSLdapObject(DSLogging):
def set_values(self, values, action=ldap.MOD_REPLACE):
pass
+ # If the account can be bound to, this will attempt to do so. We don't check
+ # for exceptions, just pass them back!
+ def bind(self, password=None):
+ conn = self._instance.openConnection()
+ conn.simple_bind_s(self.dn, password)
+ return conn
+
def delete(self):
"""
Deletes the object defined by self._dn.
diff --git a/src/lib389/lib389/backend.py b/src/lib389/lib389/backend.py
index ef6b4ad6f..aa540e56b 100644
--- a/src/lib389/lib389/backend.py
+++ b/src/lib389/lib389/backend.py
@@ -21,6 +21,8 @@ from lib389.exceptions import NoSuchEntryError, InvalidArgumentError
# We need to be a factor to the backend monitor
from lib389.monitor import MonitorBackend
+# This is for sample entry creation.
+from lib389.configurations import get_sample_entries
class BackendLegacy(object):
proxied_methods = 'search_s getEntry'.split()
@@ -392,8 +394,14 @@ class Backend(DSLdapObject):
# Check if a mapping tree for this suffix exists.
self._mts = MappingTrees(self._instance)
- def create_sample_entries(self):
- self._log.debug('Creating sample entries ....')
+ def create_sample_entries(self, version):
+ self._log.debug('Creating sample entries at version %s....' % version)
+ # Grab the correct sample entry config
+ centries = get_sample_entries(version)
+ # apply it.
+ basedn = self.get_attr_val('nsslapd-suffix')
+ cent = centries(self._instance, basedn)
+ cent.apply()
def _validate(self, rdn, properties, basedn):
# We always need to call the super validate first. This way we can
@@ -443,8 +451,8 @@ class Backend(DSLdapObject):
'nsslapd-state' : 'backend',
'nsslapd-backend' : self._nprops_stash['cn'] ,
})
- if sample_entries is True:
- self.create_sample_entries()
+ if sample_entries is not False:
+ self.create_sample_entries(sample_entries)
return self
def delete(self):
diff --git a/src/lib389/lib389/cli_base/__init__.py b/src/lib389/lib389/cli_base/__init__.py
index a46f99199..a3e59ac50 100644
--- a/src/lib389/lib389/cli_base/__init__.py
+++ b/src/lib389/lib389/cli_base/__init__.py
@@ -160,5 +160,3 @@ class FakeArgs(object):
def __init__(self):
pass
-
-# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/src/lib389/lib389/configurations/__init__.py b/src/lib389/lib389/configurations/__init__.py
new file mode 100644
index 000000000..c7b90677f
--- /dev/null
+++ b/src/lib389/lib389/configurations/__init__.py
@@ -0,0 +1,25 @@
+# --- 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 ---
+
+from lib389._constants import INSTALL_LATEST_CONFIG
+from .config_001003006 import c001003006, c001003006_sample_entries
+
+def get_config(version):
+ if (version == INSTALL_LATEST_CONFIG):
+ return c001003006
+ if (version == '001003006'):
+ return c001003006
+ raise Exception('version %s no match' % version)
+
+def get_sample_entries(version):
+ if (version == INSTALL_LATEST_CONFIG):
+ return c001003006_sample_entries
+ if (version == '001003006'):
+ return c001003006_sample_entries
+ raise Exception('version %s no match' % version)
+
diff --git a/src/lib389/lib389/configurations/config.py b/src/lib389/lib389/configurations/config.py
new file mode 100644
index 000000000..ba289bdb8
--- /dev/null
+++ b/src/lib389/lib389/configurations/config.py
@@ -0,0 +1,44 @@
+# --- 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 ---
+
+# These are the operation runners for configuring a server to look like a certain
+# version.
+
+# Generally these are one way, upgrade only.
+
+class baseconfig(object):
+ def __init__(self, instance):
+ self._instance = instance
+
+ def apply_config(self, install=False, upgrade=False, interactive=False):
+ # Go through the list of operations
+ # Can we assert the types?
+ for op in self._operations:
+ op.apply(install, upgrade, interactive)
+
+# This just serves as a base
+class configoperation(object):
+ def __init__(self, instance):
+ self._instance = instance
+ self.install = True
+ self.upgrade = True
+ self.description = None
+
+ def apply(self, install, upgrade, interactive):
+ # How do we want to handle interactivity?
+ if not ((install and self.install) or (upgrade and self.upgrade)):
+ instance.debug()
+ return False
+ if interactive:
+ raise Exception('Interaction not yet supported')
+ self._apply()
+
+ def _apply(self):
+ # The consumer must over-ride this.
+ raise Exception('Not implemented!')
+
diff --git a/src/lib389/lib389/configurations/config_001003006.py b/src/lib389/lib389/configurations/config_001003006.py
new file mode 100644
index 000000000..1765dd174
--- /dev/null
+++ b/src/lib389/lib389/configurations/config_001003006.py
@@ -0,0 +1,104 @@
+# --- 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 ---
+
+from ldap import dn
+
+from .config import baseconfig, configoperation
+from .sample import sampleentries
+
+from lib389.idm.domain import Domain
+from lib389.idm.organisationalunit import OrganisationalUnits
+from lib389.idm.group import UniqueGroups, UniqueGroup
+
+class c001003006_sample_entries(sampleentries):
+ def __init__(self, instance, basedn):
+ super(c001003006_sample_entries, self).__init__(instance, basedn)
+ self.description = """Apply sample entries matching the 1.3.6 sample data and access controls."""
+
+ # All the checks are done, apply them.
+ def _apply(self):
+ # Create the base domain object
+ domain = Domain(self._instance)
+ domain._dn = self._basedn
+ # Explode the dn to get the first bit.
+ avas = dn.str2dn(self._basedn)
+ dc_ava = avas[0][0][1]
+
+ domain.create(properties={
+ # I think in python 2 this forces unicode return ...
+ 'dc': dc_ava,
+ 'description': self._basedn,
+ 'aci' : '(targetattr ="*")(version 3.0;acl "Directory Administrators Group";allow (all) (groupdn = "ldap:///cn=Directory Administrators, %{BASEDN}");)'.format(BASEDN=self._basedn)
+ })
+ # Create the OUs
+ ous = OrganisationalUnits(self._instance, self._basedn)
+ ous.create(properties = {
+ 'ou': 'Groups',
+ })
+ ous.create(properties = {
+ 'ou': 'People',
+ 'aci' : [
+ '(targetattr ="userpassword || telephonenumber || facsimiletelephonenumber")(version 3.0;acl "Allow self entry modification";allow (write)(userdn = "ldap:///self");)',
+ '(targetattr !="cn || sn || uid")(targetfilter ="(ou=Accounting)")(version 3.0;acl "Accounting Managers Group Permissions";allow (write)(groupdn = "ldap:///cn=Accounting Managers,ou=groups,%{BASEDN}");)'.format(BASEDN=self._basedn),
+ '(targetattr !="cn || sn || uid")(targetfilter ="(ou=Human Resources)")(version 3.0;acl "HR Group Permissions";allow (write)(groupdn = "ldap:///cn=HR Managers,ou=groups,%{BASEDN}");)'.format(BASEDN=self._basedn),
+ '(targetattr !="cn ||sn || uid")(targetfilter ="(ou=Product Testing)")(version 3.0;acl "QA Group Permissions";allow (write)(groupdn = "ldap:///cn=QA Managers,ou=groups,%{BASEDN}");)'.format(BASEDN=self._basedn),
+ '(targetattr !="cn || sn || uid")(targetfilter ="(ou=Product Development)")(version 3.0;acl "Engineering Group Permissions";allow (write)(groupdn = "ldap:///cn=PD Managers,ou=groups,%{BASEDN}");)'.format(BASEDN=self._basedn),
+ ]
+ })
+ ous.create(properties = {
+ 'ou': 'Special Users',
+ 'description' : 'Special Administrative Accounts',
+ })
+ # Create the groups.
+ ugs = UniqueGroups(self._instance, self._basedn)
+ ugs.create(properties = {
+ 'cn': 'Accounting Managers',
+ 'description': 'People who can manage accounting entries',
+ 'ou': 'groups',
+ 'uniqueMember' : self._instance.binddn,
+ })
+ ugs.create(properties = {
+ 'cn': 'HR Managers',
+ 'description': 'People who can manage HR entries',
+ 'ou': 'groups',
+ 'uniqueMember' : self._instance.binddn,
+ })
+ ugs.create(properties = {
+ 'cn': 'QA Managers',
+ 'description': 'People who can manage QA entries',
+ 'ou': 'groups',
+ 'uniqueMember' : self._instance.binddn,
+ })
+ ugs.create(properties = {
+ 'cn': 'PD Managers',
+ 'description': 'People who can manage engineer entries',
+ 'ou': 'groups',
+ 'uniqueMember' : self._instance.binddn,
+ })
+ # Create the directory Admin group.
+ # We can't use the group factory here, as we need a custom DN override.
+ da_ug = UniqueGroup(self._instance)
+ da_ug._dn = 'cn=Directory Administrators,%s' % self._basedn
+ da_ug.create(properties={
+ 'cn': 'Directory Administrators',
+ 'uniqueMember' : self._instance.binddn,
+ })
+ # DONE!
+
+### Operations to be filled in soon!
+
+class c001003006(baseconfig):
+ def __init__(self, instance):
+ super(c001003006, self).__init__(instance)
+ self._operations = [
+ # Create our sample entries.
+ # op001003006_sample_entries(self._instance),
+ ]
+
+
+
diff --git a/src/lib389/lib389/configurations/sample.py b/src/lib389/lib389/configurations/sample.py
new file mode 100644
index 000000000..d0fbd16de
--- /dev/null
+++ b/src/lib389/lib389/configurations/sample.py
@@ -0,0 +1,19 @@
+# --- 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 ---
+
+class sampleentries(object):
+ def __init__(self, instance, basedn):
+ self._instance = instance
+ self._basedn = basedn
+ self.description = None
+
+ def apply(self):
+ self._apply()
+
+ def _apply(self):
+ raise Exception('Not implemented')
diff --git a/src/lib389/lib389/idm/__init__.py b/src/lib389/lib389/idm/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/lib389/lib389/idm/domain.py b/src/lib389/lib389/idm/domain.py
new file mode 100644
index 000000000..480c1c869
--- /dev/null
+++ b/src/lib389/lib389/idm/domain.py
@@ -0,0 +1,21 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+class Domain(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(Domain, self).__init__(instance, dn, batch)
+ self._rdn_attribute = 'dc'
+ self._must_attributes = ['dc']
+ self._create_objectclasses = [
+ 'top',
+ 'domain',
+ ]
+ self._protected = True
+
diff --git a/src/lib389/lib389/idm/group.py b/src/lib389/lib389/idm/group.py
new file mode 100644
index 000000000..e4c102b8a
--- /dev/null
+++ b/src/lib389/lib389/idm/group.py
@@ -0,0 +1,84 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+MUST_ATTRIBUTES = [
+ 'cn',
+]
+RDN = 'cn'
+
+class Group(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(Group, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ # Can I generate these from schema?
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'groupOfNames',
+ ]
+ self._protected = False
+
+ def is_member(self, dn):
+ # Check if dn is a member
+ return self.present('member', dn)
+
+ def add_member(self, dn):
+ self.add('member', dn)
+
+ def remove_member(self, dn):
+ self.remove('member', dn)
+
+class Groups(DSLdapObjects):
+ def __init__(self, instance, basedn, batch=False):
+ super(Groups, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'groupOfNames',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = Group
+ self._basedn = 'ou=Groups,%s' % basedn
+
+class UniqueGroup(DSLdapObject):
+ # WARNING!!!
+ # Use group, not unique group!!!
+ def __init__(self, instance, dn=None, batch=False):
+ super(UniqueGroup, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'groupOfUniqueNames',
+ ]
+ self._protected = False
+
+ def is_member(self, dn):
+ # Check if dn is a member
+ return self.present('uniquemember', dn)
+
+ def add_member(self, dn):
+ self.add('uniquemember', dn)
+
+ def remove_member(self, dn):
+ self.remove('uniquemember', dn)
+
+class UniqueGroups(DSLdapObjects):
+ # WARNING!!!
+ # Use group, not unique group!!!
+ def __init__(self, instance, basedn, batch=False):
+ super(UniqueGroups, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'groupOfUniqueNames',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = UniqueGroup
+ self._basedn = 'ou=Groups,%s' % basedn
+
+
+
diff --git a/src/lib389/lib389/idm/organisationalunit.py b/src/lib389/lib389/idm/organisationalunit.py
new file mode 100644
index 000000000..a3854c965
--- /dev/null
+++ b/src/lib389/lib389/idm/organisationalunit.py
@@ -0,0 +1,38 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+MUST_ATTRIBUTES = [
+ 'ou',
+]
+RDN = 'ou'
+
+class OrganisationalUnit(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(OrganisationalUnit, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ # Can I generate these from schema?
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'organizationalunit',
+ ]
+ self._protected = False
+
+class OrganisationalUnits(DSLdapObjects):
+ def __init__(self, instance, basedn, batch=False):
+ super(OrganisationalUnits, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'organizationalunit',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = OrganisationalUnit
+ self._basedn = basedn
+
+
diff --git a/src/lib389/lib389/idm/posixgroup.py b/src/lib389/lib389/idm/posixgroup.py
new file mode 100644
index 000000000..aebfb5f20
--- /dev/null
+++ b/src/lib389/lib389/idm/posixgroup.py
@@ -0,0 +1,49 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+MUST_ATTRIBUTES = [
+ 'cn',
+ 'gidNumber',
+]
+RDN = 'cn'
+
+class PosixGroup(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(PosixGroup, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ # Can I generate these from schema?
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'groupOfNames',
+ 'posixGroup',
+ ]
+ self._protected = False
+
+ def check_member(self, dn):
+ return dn in self.get_attr_vals('member')
+
+ def add_member(self, dn):
+ # Assert the DN exists?
+ self.add('member', dn)
+
+
+class PosixGroups(DSLdapObjects):
+ def __init__(self, instance, basedn, batch=False):
+ super(PosixGroups, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'groupOfNames',
+ 'posixGroup',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = PosixGroup
+ self._basedn = 'ou=Groups,%s' % basedn
+
+
diff --git a/src/lib389/lib389/idm/services.py b/src/lib389/lib389/idm/services.py
new file mode 100644
index 000000000..b59e34588
--- /dev/null
+++ b/src/lib389/lib389/idm/services.py
@@ -0,0 +1,36 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+RDN = 'cn'
+MUST_ATTRIBUTES = [
+ 'cn',
+]
+
+class ServiceAccount(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(ServiceAccount, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'netscapeServer',
+ ]
+ self._protected = False
+
+class ServiceAccounts(DSLdapObjects):
+ def __init__(self, instance, basedn, batch=False):
+ super(ServiceAccounts, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'netscapeServer',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = ServiceAccount
+ self._basedn = 'ou=Services,%s' % basedn
+
diff --git a/src/lib389/lib389/idm/user.py b/src/lib389/lib389/idm/user.py
new file mode 100644
index 000000000..5b7e4be9a
--- /dev/null
+++ b/src/lib389/lib389/idm/user.py
@@ -0,0 +1,63 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016, William Brown <william at blackhats.net.au>
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+
+from lib389._mapped_object import DSLdapObject, DSLdapObjects
+
+MUST_ATTRIBUTES = [
+ 'uid',
+ 'cn',
+ 'sn',
+ 'uidNumber',
+ 'gidNumber',
+ 'homeDirectory',
+]
+RDN = 'uid'
+
+class UserAccount(DSLdapObject):
+ def __init__(self, instance, dn=None, batch=False):
+ super(UserAccount, self).__init__(instance, dn, batch)
+ self._rdn_attribute = RDN
+ # Can I generate these from schema?
+ self._must_attributes = MUST_ATTRIBUTES
+ self._create_objectclasses = [
+ 'top',
+ 'account',
+ 'posixaccount',
+ 'inetOrgPerson',
+ 'person',
+ 'inetUser',
+ 'organizationalPerson',
+ # This may not always work at sites?
+ # Can we get this into core?
+ # 'ldapPublicKey',
+ ]
+ self._protected = False
+
+ def _validate(self, rdn, properties, basedn):
+ if properties.has_key('ntUserDomainId') and 'ntUser' not in self._create_objectclasses:
+ self._create_objectclasses.append('ntUser')
+
+ return super(UserAccount, self)._validate(rdn, properties, basedn)
+
+ # Add a set password function....
+ # Can't I actually just set, and it will hash?
+
+class UserAccounts(DSLdapObjects):
+ def __init__(self, instance, basedn, batch=False):
+ super(UserAccounts, self).__init__(instance, batch)
+ self._objectclasses = [
+ 'account',
+ 'posixaccount',
+ 'inetOrgPerson',
+ 'person',
+ 'organizationalPerson',
+ ]
+ self._filterattrs = [RDN]
+ self._childobject = UserAccount
+ self._basedn = 'ou=People,%s' % basedn
+
diff --git a/src/lib389/lib389/instance/options.py b/src/lib389/lib389/instance/options.py
index b1a541898..07bb19675 100644
--- a/src/lib389/lib389/instance/options.py
+++ b/src/lib389/lib389/instance/options.py
@@ -10,6 +10,7 @@ import socket
import sys
import os
from lib389.paths import Paths
+from lib389._constants import INSTALL_LATEST_CONFIG
MAJOR, MINOR, _, _, _ = sys.version_info
@@ -118,9 +119,13 @@ class General2Base(Options2):
self._type['selinux'] = bool
self._helptext['selinux'] = "Enable SELinux detection and integration. Normally, this should always be True, and will correctly detect when SELinux is not present."
- self._options['defaults'] = '99999'
+ self._options['systemd'] = ds_paths.with_systemd
+ self._type['systemd'] = bool
+ self._helptext['systemd'] = "Enable systemd platform features. This is autodetected on your platform. You should not alter this value without good reason."
+
+ self._options['defaults'] = INSTALL_LATEST_CONFIG
self._type['defaults'] = str
- self._helptext['defaults'] = "Set the configuration defaults version. If set to 99999, always use the latest values available for the slapd section. This allows pinning default values in cn=config to specific Directory Server releases."
+ self._helptext['defaults'] = "Set the configuration defaults version. If set to %{LATEST}, always use the latest values available for the slapd section. This allows pinning default values in cn=config to specific Directory Server releases. This maps to our versions such as 1.3.5 -> 001003005 -> 1003005".format(LATEST=INSTALL_LATEST_CONFIG)
#
@@ -258,7 +263,4 @@ class Slapd2Base(Options2):
# This does the final format and return of options.
return self._format(self._options)
-# We use inheritence to "overlay" from base types and options, and we can then
-# stack progressive versions "options" on top.
-# This class is for
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
index c4bebd8f3..c18f41995 100644
--- a/src/lib389/lib389/instance/setup.py
+++ b/src/lib389/lib389/instance/setup.py
@@ -14,6 +14,7 @@ import pwd
import grp
import re
import socket
+import subprocess
from lib389 import _ds_shutil_copytree
from lib389._constants import *
@@ -136,7 +137,7 @@ class SetupDs(object):
# TODO: Add the other BACKEND_ types
be[BACKEND_NAME] = section.replace('backend-', '')
be[BACKEND_SUFFIX] = config.get(section, 'suffix')
- be[BACKEND_SAMPLE_ENTRIES] = config.getboolean(section, 'sample_entries')
+ be[BACKEND_SAMPLE_ENTRIES] = config.get(section, 'sample_entries')
backends.append(be)
if self.verbose:
@@ -263,8 +264,10 @@ class SetupDs(object):
assert(slapd['port'] is not None)
assert(socket_check_open('::1', slapd['port']) is False)
- assert(slapd['secure_port'] is not None)
- assert(socket_check_open('::1', slapd['secure_port']) is False)
+ ## This causes some problems in tests :(
+ # assert(slapd['secure_port'] is not None)
+ if slapd['secure_port'] is not None:
+ assert(socket_check_open('::1', slapd['secure_port']) is False)
if self.verbose:
self.log.info("PASSED: network avaliability checking")
@@ -279,13 +282,13 @@ class SetupDs(object):
# Check we have privs to run
if self.verbose:
- self.log.info("READY: preparing installation")
+ self.log.info("READY: preparing installation for %s" % slapd['instance_name'])
self._prepare_ds(general, slapd, backends)
# Call our child api to prepare itself.
self._prepare(extra)
if self.verbose:
- self.log.info("READY: beginning installation")
+ self.log.info("READY: beginning installation for %s" % slapd['instance_name'])
if self.dryrun:
self.log.info("NOOP: dry run requested")
@@ -294,7 +297,7 @@ class SetupDs(object):
self._install_ds(general, slapd, backends)
# Call the child api to do anything it needs.
self._install(extra)
- self.log.info("FINISH: completed installation")
+ self.log.info("FINISH: completed installation for %s" % slapd['instance_name'])
def _install_ds(self, general, slapd, backends):
"""
@@ -345,14 +348,19 @@ class SetupDs(object):
shutil.copy2(srcfile, dstfile)
os.chown(slapd['schema_dir'], slapd['user_uid'], slapd['group_gid'])
- # Selinux fixups?
- # Restorecon of paths?
+ # If we are on the correct platform settings, systemd
+ if general['systemd'] and not self.containerised:
+ # Should create the symlink we need, but without starting it.
+ subprocess.check_call(["/usr/bin/systemctl",
+ "enable",
+ "dirsrv@%s" % slapd['instance_name']])
+ # Else we need to detect other init scripts?
+
# Bind sockets to our type?
# Create certdb in sysconfidir
if self.verbose:
self.log.info("ACTION: Creating certificate database is %s" % slapd['cert_dir'])
- # nss_create_new_database(slapd['cert_dir'])
# Create dse.ldif with a temporary root password.
# The template is in slapd['data_dir']/dirsrv/data/template-dse.ldif
@@ -404,6 +412,14 @@ class SetupDs(object):
ds_instance.allocate(args)
# Does this work?
assert(ds_instance.exists())
+ # Create the nssdb
+ assert(ds_instance.nss_ssl.reinit())
+ # Do we want to selfsign a CA and cert?
+
+ ## LAST CHANCE, FIX PERMISSIONS.
+ # Selinux fixups?
+ # Restorecon of paths?
+
# Start the server
ds_instance.start(timeout=60)
ds_instance.open()
@@ -430,3 +446,4 @@ class SetupDs(object):
for path in ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
'ldif_dir', 'lock_dir', 'log_dir', 'run_dir'):
print(path)
+
diff --git a/src/lib389/lib389/nss_ssl.py b/src/lib389/lib389/nss_ssl.py
index 347f24682..bf9876b06 100644
--- a/src/lib389/lib389/nss_ssl.py
+++ b/src/lib389/lib389/nss_ssl.py
@@ -39,8 +39,8 @@ class NssSsl(object):
@property
def _certdb(self):
- # return "sql:%s" % self.dirsrv.confdir
- return self.dirsrv.confdir
+ # return "sql:%s" % self.dirsrv.get_cert_dir()
+ return self.dirsrv.get_cert_dir()
def _generate_noise(self, fpath):
noise = password_generate(256)
@@ -56,23 +56,23 @@ class NssSsl(object):
for f in ('key3.db', 'cert8.db', 'key4.db', 'cert9.db', 'secmod.db', 'pkcs11.txt'):
try:
# Perhaps we should be backing these up instead ...
- os.remove("%s/%s" % (self.dirsrv.confdir, f ))
+ os.remove("%s/%s" % (self.dirsrv.get_cert_dir(), f ))
except:
pass
# In the future we may add the needed option to avoid writing the pin
# files.
# Write the pin.txt, and the pwdfile.txt
- if not os.path.exists('%s/%s' % (self.dirsrv.confdir, PIN_TXT)):
- with open('%s/%s' % (self.dirsrv.confdir, PIN_TXT), 'w') as f:
+ if not os.path.exists('%s/%s' % (self.dirsrv.get_cert_dir(), PIN_TXT)):
+ with open('%s/%s' % (self.dirsrv.get_cert_dir(), PIN_TXT), 'w') as f:
f.write('Internal (Software) Token:%s' % self.dbpassword)
- if not os.path.exists('%s/%s' % (self.dirsrv.confdir, PWD_TXT)):
- with open('%s/%s' % (self.dirsrv.confdir, PWD_TXT), 'w') as f:
+ if not os.path.exists('%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT)):
+ with open('%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT), 'w') as f:
f.write('%s' % self.dbpassword)
# Init the db.
# 48886; This needs to be sql format ...
- cmd = ['/usr/bin/certutil', '-N', '-d', self._certdb, '-f', '%s/%s' % (self.dirsrv.confdir, PWD_TXT)]
+ cmd = ['/usr/bin/certutil', '-N', '-d', self._certdb, '-f', '%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT)]
self.dirsrv.log.debug("nss cmd: %s" % cmd)
result = check_output(cmd)
self.dirsrv.log.debug("nss output: %s" % result)
@@ -82,12 +82,12 @@ class NssSsl(object):
"""
Check that a nss db exists at the certpath
"""
- key3 = os.path.exists("%s/key3.db" % (self.dirsrv.confdir))
- cert8 = os.path.exists("%s/cert8.db" % (self.dirsrv.confdir))
- key4 = os.path.exists("%s/key4.db" % (self.dirsrv.confdir))
- cert9 = os.path.exists("%s/cert9.db" % (self.dirsrv.confdir))
- secmod = os.path.exists("%s/secmod.db" % (self.dirsrv.confdir))
- pkcs11 = os.path.exists("%s/pkcs11.txt" % (self.dirsrv.confdir))
+ key3 = os.path.exists("%s/key3.db" % (self.dirsrv.get_cert_dir()))
+ cert8 = os.path.exists("%s/cert8.db" % (self.dirsrv.get_cert_dir()))
+ key4 = os.path.exists("%s/key4.db" % (self.dirsrv.get_cert_dir()))
+ cert9 = os.path.exists("%s/cert9.db" % (self.dirsrv.get_cert_dir()))
+ secmod = os.path.exists("%s/secmod.db" % (self.dirsrv.get_cert_dir()))
+ pkcs11 = os.path.exists("%s/pkcs11.txt" % (self.dirsrv.get_cert_dir()))
if ((key3 and cert8 and secmod) or (key4 and cert9 and pkcs11)):
return True
@@ -99,7 +99,7 @@ class NssSsl(object):
"""
# Create noise.
- self._generate_noise('%s/noise.txt' % self.dirsrv.confdir)
+ self._generate_noise('%s/noise.txt' % self.dirsrv.get_cert_dir())
# Now run the command. Can we do this with NSS native?
cmd = [
'/usr/bin/certutil',
@@ -118,9 +118,9 @@ class NssSsl(object):
'-d',
self._certdb,
'-z',
- '%s/noise.txt' % self.dirsrv.confdir,
+ '%s/noise.txt' % self.dirsrv.get_cert_dir(),
'-f',
- '%s/%s' % (self.dirsrv.confdir, PWD_TXT),
+ '%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT),
]
result = check_output(cmd)
self.dirsrv.log.debug("nss output: %s" % result)
@@ -135,10 +135,10 @@ class NssSsl(object):
'-a',
]
certdetails = check_output(cmd)
- with open('%s/ca.crt' % self.dirsrv.confdir, 'w') as f:
+ with open('%s/ca.crt' % self.dirsrv.get_cert_dir(), 'w') as f:
f.write(certdetails)
if os.path.isfile('/usr/sbin/cacertdir_rehash'):
- check_output(['/usr/sbin/cacertdir_rehash', self.dirsrv.confdir])
+ check_output(['/usr/sbin/cacertdir_rehash', self.dirsrv.get_cert_dir()])
return True
def _rsa_cert_list(self):
@@ -148,7 +148,7 @@ class NssSsl(object):
'-d',
self._certdb,
'-f',
- '%s/%s' % (self.dirsrv.confdir, PWD_TXT),
+ '%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT),
]
result = check_output(cmd)
@@ -175,7 +175,7 @@ class NssSsl(object):
'-d',
self._certdb,
'-f',
- '%s/%s' % (self.dirsrv.confdir, PWD_TXT),
+ '%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT),
]
result = check_output(cmd)
@@ -224,7 +224,7 @@ class NssSsl(object):
"""
# Create noise.
- self._generate_noise('%s/noise.txt' % self.dirsrv.confdir)
+ self._generate_noise('%s/noise.txt' % self.dirsrv.get_cert_dir())
# Now run the command. Can we do this with NSS native?
cmd = [
'/usr/bin/certutil',
@@ -244,9 +244,9 @@ class NssSsl(object):
'-d',
self._certdb,
'-z',
- '%s/noise.txt' % self.dirsrv.confdir,
+ '%s/noise.txt' % self.dirsrv.get_cert_dir(),
'-f',
- '%s/%s' % (self.dirsrv.confdir, PWD_TXT),
+ '%s/%s' % (self.dirsrv.get_cert_dir(), PWD_TXT),
]
result = check_output(cmd)
diff --git a/src/lib389/lib389/paths.py b/src/lib389/lib389/paths.py
index ca1586e3f..f0a4c1b9c 100644
--- a/src/lib389/lib389/paths.py
+++ b/src/lib389/lib389/paths.py
@@ -111,6 +111,7 @@ class Paths(object):
self._instance = instance
def _get_defaults_loc(self, search_paths):
+ ## THIS IS HOW WE HANDLE A PREFIX INSTALL
prefix = os.getenv('PREFIX')
if prefix is not None:
spath = os.path.join(prefix, 'share/dirsrv/inf/defaults.inf')
diff --git a/src/lib389/lib389/tests/configurations/__init__.py b/src/lib389/lib389/tests/configurations/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/lib389/lib389/tests/configurations/config_001003006_test.py b/src/lib389/lib389/tests/configurations/config_001003006_test.py
new file mode 100644
index 000000000..8a7546cc9
--- /dev/null
+++ b/src/lib389/lib389/tests/configurations/config_001003006_test.py
@@ -0,0 +1,98 @@
+# --- 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 ---
+#
+import ldap
+
+import logging
+import sys
+import time
+
+import pytest
+
+from lib389 import DirSrv
+from lib389._constants import *
+from lib389.properties import *
+
+DEBUGGING = os.getenv('DEBUGGING', default=False)
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+log = logging.getLogger(__name__)
+
+### WARNING:
+# We can't use topology here, as we need to force python install!
+
+REQUIRED_DNS = [
+ 'dc=example,dc=com',
+ 'ou=Groups,dc=example,dc=com',
+ 'ou=People,dc=example,dc=com',
+ 'ou=Special Users,dc=example,dc=com',
+ 'cn=Accounting Managers,ou=Groups,dc=example,dc=com',
+ 'cn=HR Managers,ou=Groups,dc=example,dc=com',
+ 'cn=QA Managers,ou=Groups,dc=example,dc=com',
+ 'cn=PD Managers,ou=Groups,dc=example,dc=com',
+ 'cn=Directory Administrators,dc=example,dc=com',
+]
+
+class TopologyMain(object):
+ def __init__(self, standalones=None, masters=None,
+ consumers=None, hubs=None):
+ if standalones:
+ if isinstance(standalones, dict):
+ self.ins = standalones
+ else:
+ self.standalone = standalones
+ if masters:
+ self.ms = masters
+ if consumers:
+ self.cs = consumers
+ if hubs:
+ self.hs = hubs
+
[email protected](scope="module")
+def topology_st(request):
+ """Create DS standalone instance"""
+
+ if DEBUGGING:
+ standalone = DirSrv(verbose=True)
+ else:
+ standalone = DirSrv(verbose=False)
+ args_instance[SER_HOST] = HOST_STANDALONE1
+ args_instance[SER_PORT] = PORT_STANDALONE1
+ # args_instance[SER_SECURE_PORT] = SECUREPORT_STANDALONE1
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE1
+ 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(pyinstall=True, version=INSTALL_LATEST_CONFIG)
+ standalone.open()
+
+ def fin():
+ if DEBUGGING:
+ standalone.stop()
+ else:
+ standalone.delete()
+
+ request.addfinalizer(fin)
+
+ return TopologyMain(standalones=standalone)
+
+def test_install_sample_entries(topology_st):
+ # Assert that our entries match.
+
+ entries = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE)
+
+ for entry in entries:
+ assert(entry.dn in REQUIRED_DNS)
+ # We can make this assert the full object content, plugins and more later.
+
+ assert(True)
diff --git a/src/lib389/lib389/tests/idm/__init__.py b/src/lib389/lib389/tests/idm/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/lib389/lib389/tests/idm/services.py b/src/lib389/lib389/tests/idm/services.py
new file mode 100644
index 000000000..6b6c457a5
--- /dev/null
+++ b/src/lib389/lib389/tests/idm/services.py
@@ -0,0 +1,55 @@
+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 *
+
+from lib389.idm.organisationalunit import OrganisationalUnits
+from lib389.idm.services import ServiceAccounts
+
+from lib389.topologies import topology_st as topology
+
+DEBUGGING = os.getenv('DEBUGGING', False)
+
+if DEBUGGING is not False:
+ DEBUGGING = True
+
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+
+log = logging.getLogger(__name__)
+
+def test_services(topology):
+ """
+ Test and assert that a simple service account can be bound to and created.
+
+ These are really useful in simple tests.
+ """
+ ous = OrganisationalUnits(topology.standalone, DEFAULT_SUFFIX)
+ services = ServiceAccounts(topology.standalone, DEFAULT_SUFFIX)
+
+ # Create the OU for them.
+ ous.create(properties={
+ 'ou': 'Services',
+ 'description': 'Computer Service accounts which request DS bind',
+ })
+ # Now, we can create the services from here.
+ service = services.create(properties={
+ 'cn': 'testbind',
+ 'userPassword': 'Password1'
+ })
+
+ conn = service.bind('Password1')
+ conn.unbind_s()
+
+
+
diff --git a/src/lib389/lib389/tests/idm/users_and_groups.py b/src/lib389/lib389/tests/idm/users_and_groups.py
new file mode 100644
index 000000000..f072dfd6d
--- /dev/null
+++ b/src/lib389/lib389/tests/idm/users_and_groups.py
@@ -0,0 +1,101 @@
+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 *
+
+from lib389.idm.user import UserAccounts
+from lib389.idm.group import Groups
+
+from lib389.topologies import topology_st as topology
+
+DEBUGGING = os.getenv('DEBUGGING', False)
+
+if DEBUGGING is not False:
+ DEBUGGING = True
+
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+
+log = logging.getLogger(__name__)
+
+
+def test_users_and_groups(topology):
+ """
+ Ensure that user and group management works as expected.
+ """
+ if DEBUGGING:
+ # Add debugging steps(if any)...
+ pass
+
+ users = UserAccounts(topology.standalone, DEFAULT_SUFFIX)
+ groups = Groups(topology.standalone, DEFAULT_SUFFIX)
+
+ # No user should exist
+
+ assert(len(users.list()) == 0)
+
+ # Create a user
+
+ user_properties = {
+ 'uid': 'testuser',
+ 'cn' : 'testuser',
+ 'sn' : 'user',
+ 'uidNumber' : '1000',
+ 'gidNumber' : '2000',
+ 'homeDirectory' : '/home/testuser'
+ }
+ users.create(properties=user_properties)
+
+ assert(len(users.list()) == 1)
+
+ testuser = users.get('testuser')
+
+ # Set password
+ testuser.set('userPassword', 'password')
+ # bind
+
+ conn = testuser.bind('password')
+ conn.unbind_s()
+
+ # create group
+ group_properties = {
+ 'cn' : 'group1',
+ 'description' : 'testgroup'
+ }
+
+ group = groups.create(properties=group_properties)
+
+ # user shouldn't be a member
+ assert(not group.is_member(testuser.dn))
+
+ # add user as member
+ group.add_member(testuser.dn)
+ # check they are a member
+ assert(group.is_member(testuser.dn))
+ # remove user from group
+ group.remove_member(testuser.dn)
+ # check they are not a member
+ assert(not group.is_member(testuser.dn))
+
+ group.delete()
+ testuser.delete()
+
+ log.info('Test PASSED')
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s %s" % CURRENT_FILE)
+
diff --git a/src/lib389/lib389/tests/instance/setup_test.py b/src/lib389/lib389/tests/instance/setup_test.py
index 382a922f0..04ae34fd7 100644
--- a/src/lib389/lib389/tests/instance/setup_test.py
+++ b/src/lib389/lib389/tests/instance/setup_test.py
@@ -49,8 +49,6 @@ def topology(request):
return TopologyInstance(instance)
def test_setup_ds_minimal_dry(topology):
- if MAJOR < 3:
- return
# Create the setupDs
lc = LogCapture()
# Give it the right types.
@@ -78,8 +76,6 @@ def test_setup_ds_minimal_dry(topology):
assert(len(insts) == 0)
def test_setup_ds_minimal(topology):
- if MAJOR < 3:
- return
# Create the setupDs
lc = LogCapture()
# Give it the right types.
diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
index 1e3e98e6c..0d0e26101 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -775,23 +775,20 @@ def socket_check_open(host, port):
def ensure_bytes(val):
- if MAJOR >= 3 and val != None and type(val) != bytes:
+ if val != None and type(val) != bytes:
return val.encode()
return val
def ensure_str(val):
- if MAJOR >= 3 and val != None and type(val) != str:
+ if val != None and type(val) != str:
return val.decode('utf-8')
return val
def ensure_list_bytes(val):
- if MAJOR >= 3:
- return [ensure_bytes(v) for v in val]
- return val
+ # if MAJOR >= 3:
+ return [ensure_bytes(v) for v in val]
def ensure_list_str(val):
- if MAJOR >= 3:
- return [ensure_str(v) for v in val]
- return val
+ return [ensure_str(v) for v in val]
diff --git a/src/lib389/python-lib389.spec b/src/lib389/python-lib389.spec
index 6b8cb7bdb..b65fc4593 100644
--- a/src/lib389/python-lib389.spec
+++ b/src/lib389/python-lib389.spec
@@ -71,20 +71,26 @@ and configuring the 389 Directory Server.
%autosetup -n %{name}-%{tarver}
%build
-%py2_build
+# JFC you need epel only devel packages for this, python 3 is the worst
%if 0%{?rhel} >= 8 || 0%{?fedora}
+%py2_build
%py3_build
+%else
+%{__python} setup.py build
%endif
%install
-%py2_install
%if 0%{?rhel} >= 8 || 0%{?fedora}
+%py2_install
%py3_install
+%else
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
%endif
%files -n python2-%{srcname}
%license LICENSE
%doc README
+%doc %{_datadir}/%{srcname}/examples/*
%{python2_sitelib}/*
# We don't provide the cli tools for python2
%exclude %{_sbindir}/*
@@ -93,6 +99,7 @@ and configuring the 389 Directory Server.
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README
+%doc %{_datadir}/%{srcname}/examples/*
%{python3_sitelib}/*
%{_sbindir}/*
%endif
| 0 |
29c09a5bcc7d54be1aa6880b4f2a423edd3dc463
|
389ds/389-ds-base
|
Ticket #48243 - replica upgrade failed in starting dirsrv service due to upgrade scripts did not run
Description: In the upgrade process, there is a combination of requirements:
. the server is running.
. the server instance service is disabled.
. upgrade scripts are expected to run against the instance.
. the server is restarted once the upgrade is done.
. the server instance service remains disabled.
To fulfill the requirements,
. spec file is modified to enumerate slapd dir (except .remove) in the
/etc/dirsrv for getting the server instance.
. Start/Update perl scripts are modified not to create a symlink in
/etc/systemd/system/dirsrv.target.wants for the upgrade case, which
means the service remains disabled.
https://fedorahosted.org/389/ticket/48243
Reviewed by [email protected] (Thank you, Mark!!)
|
commit 29c09a5bcc7d54be1aa6880b4f2a423edd3dc463
Author: Noriko Hosoi <[email protected]>
Date: Tue Aug 18 13:43:55 2015 -0700
Ticket #48243 - replica upgrade failed in starting dirsrv service due to upgrade scripts did not run
Description: In the upgrade process, there is a combination of requirements:
. the server is running.
. the server instance service is disabled.
. upgrade scripts are expected to run against the instance.
. the server is restarted once the upgrade is done.
. the server instance service remains disabled.
To fulfill the requirements,
. spec file is modified to enumerate slapd dir (except .remove) in the
/etc/dirsrv for getting the server instance.
. Start/Update perl scripts are modified not to create a symlink in
/etc/systemd/system/dirsrv.target.wants for the upgrade case, which
means the service remains disabled.
https://fedorahosted.org/389/ticket/48243
Reviewed by [email protected] (Thank you, Mark!!)
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
index e4a4ed03e..cdde339fb 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -1098,6 +1098,7 @@ sub updateTmpfilesDotD {
}
sub updateSystemD {
+ my $noservicelink = shift;
my $inf = shift;
my $unitdir = "@systemdsystemunitdir@";
my $confbasedir = "@systemdsystemconfdir@";
@@ -1129,7 +1130,7 @@ sub updateSystemD {
next;
} else {
my $servicelink = "$confdir/$pkgname\@$inst.service";
- if (! -l $servicelink) {
+ if (! -l $servicelink && ! $noservicelink) {
if (!symlink($servicefile, $servicelink)) {
debug(1, "error updating link $servicelink to $servicefile - $!\n");
push @errs, [ 'error_linking_file', $servicefile, $servicelink, $! ];
@@ -1216,7 +1217,7 @@ sub createDSInstance {
return @errs;
}
- if (@errs = updateSystemD($inf)) {
+ if (@errs = updateSystemD(0, $inf)) {
return @errs;
}
@@ -1452,7 +1453,7 @@ sub removeDSInstance {
}
# update systemd files
- push @errs, updateSystemD();
+ push @errs, updateSystemD(0);
# if we got here, report success
if (@errs) {
diff --git a/ldap/admin/src/scripts/DSMigration.pm.in b/ldap/admin/src/scripts/DSMigration.pm.in
index e59e6670d..630ab43f9 100644
--- a/ldap/admin/src/scripts/DSMigration.pm.in
+++ b/ldap/admin/src/scripts/DSMigration.pm.in
@@ -1132,7 +1132,7 @@ sub migrateDS {
}
# do the systemd stuff
- @errs = DSCreate::updateSystemD($inf);
+ @errs = DSCreate::updateSystemD(0, $inf);
if (@errs) {
$mig->msg(@errs);
goto cleanup;
diff --git a/ldap/admin/src/scripts/DSUpdate.pm.in b/ldap/admin/src/scripts/DSUpdate.pm.in
index 1809ad921..be1e67c4c 100644
--- a/ldap/admin/src/scripts/DSUpdate.pm.in
+++ b/ldap/admin/src/scripts/DSUpdate.pm.in
@@ -408,7 +408,7 @@ sub updateDSInstance {
push @errs, updateTmpfilesDotD($inf);
- push @errs, updateSystemD($inf);
+ push @errs, updateSystemD(1, $inf);
return @errs;
}
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 64541f11d..ecdecb56c 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -263,6 +263,7 @@ rm -rf $RPM_BUILD_ROOT
%post
output=/dev/null
+output2=/dev/null
%systemd_post %{pkgname}-snmp.service
# reload to pick up any changes to systemd files
/bin/systemctl daemon-reload >$output 2>&1 || :
@@ -275,12 +276,17 @@ instances="" # instances that require a restart after upgrade
ninst=0 # number of instances found in total
if [ -n "$DEBUGPOSTTRANS" ] ; then
output=$DEBUGPOSTTRANS
+ output2=${DEBUGPOSTTRANS}.upgrade
fi
-echo looking for services in %{_sysconfdir}/systemd/system/%{groupname}.wants/* >> $output 2>&1 || :
-for service in %{_sysconfdir}/systemd/system/%{groupname}.wants/* ; do
- if [ ! -f "$service" ] ; then continue ; fi # in case nothing matches
- inst=`echo $service | sed -e 's,%{_sysconfdir}/systemd/system/%{groupname}.wants/,,'`
- echo found instance $inst - getting status >> $output 2>&1 || :
+echo looking for instances in %{_sysconfdir}/%{pkgname} > $output 2>&1 || :
+instbase="%{_sysconfdir}/%{pkgname}"
+for dir in $instbase/slapd-* ; do
+ echo dir = $dir >> $output 2>&1 || :
+ if [ ! -d "$dir" ] ; then continue ; fi
+ case "$dir" in *.removed) continue ;; esac
+ basename=`basename $dir`
+ inst="%{pkgname}@`echo $basename | sed -e 's/slapd-//g'`"
+ echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
@@ -305,9 +311,9 @@ echo remove pid files . . . >> $output 2>&1 || :
echo upgrading instances . . . >> $output 2>&1 || :
DEBUGPOSTSETUPOPT=`/usr/bin/echo $DEBUGPOSTSETUP | /usr/bin/sed -e "s/[^d]//g"`
if [ -n "$DEBUGPOSTSETUPOPT" ] ; then
- %{_sbindir}/setup-ds.pl -l $output -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
+ %{_sbindir}/setup-ds.pl -l $output2 -$DEBUGPOSTSETUPOPT -u -s General.UpdateMode=offline >> $output 2>&1 || :
else
- %{_sbindir}/setup-ds.pl -l $output -u -s General.UpdateMode=offline >> $output 2>&1 || :
+ %{_sbindir}/setup-ds.pl -l $output2 -u -s General.UpdateMode=offline >> $output 2>&1 || :
fi
# restart instances that require it
| 0 |
4cfefd799cbdfa228b0c9b91a5cc3c5c6a4e42da
|
389ds/389-ds-base
|
Issue 5279 - dscontainer: TypeError: unsupported operand type(s) for /: 'str' and 'int'
Bug Description:
When DS_STARTUP_TIMEOUT is specified, dscontainer fails with:
TypeError: unsupported operand type(s) for /: 'str' and 'int'
Fix Description:
os.getenv returns a string when a variable is present, so the value
must be converted to int.
Fixes: https://github.com/389ds/389-ds-base/issues/5279
Reviewed by: @Firstyear (Thanks!)
|
commit 4cfefd799cbdfa228b0c9b91a5cc3c5c6a4e42da
Author: Viktor Ashirov <[email protected]>
Date: Wed May 4 11:59:30 2022 +0200
Issue 5279 - dscontainer: TypeError: unsupported operand type(s) for /: 'str' and 'int'
Bug Description:
When DS_STARTUP_TIMEOUT is specified, dscontainer fails with:
TypeError: unsupported operand type(s) for /: 'str' and 'int'
Fix Description:
os.getenv returns a string when a variable is present, so the value
must be converted to int.
Fixes: https://github.com/389ds/389-ds-base/issues/5279
Reviewed by: @Firstyear (Thanks!)
diff --git a/src/lib389/cli/dscontainer b/src/lib389/cli/dscontainer
index 839471ef9..c279cad5c 100755
--- a/src/lib389/cli/dscontainer
+++ b/src/lib389/cli/dscontainer
@@ -358,7 +358,7 @@ binddn = cn=Directory Manager
# Wait on the health check to show we are ready for ldapi.
healthy = False
startup_timeout = os.getenv("DS_STARTUP_TIMEOUT", 60)
- max_failure_count = int(startup_timeout / 3)
+ max_failure_count = int(int(startup_timeout) / 3)
for i in range(0, max_failure_count):
if ds_proc is None:
log.warning("ns-slapd pid has disappeared ...")
| 0 |
489b585a67bf9b91c33a93cf8b0c6c7bca398bee
|
389ds/389-ds-base
|
Issue 4812 - Scalability with high number of connections (#5090)
Description: Listener thread poll established connections. When the
number of connections is high and/or there is a high incoming traffic,
this single thread becomes a bottleneck. The thread is eating a lot of
cpu to go through the huge array of established connection but it is not
running fast enough if there is a big incoming traffic and finally
limits the capacity of the server.
Fix: Create multi connection table active lists where each list is
managed by a dedicated listener thread.
Relates: https://github.com/389ds/389-ds-base/issues/4812
Reviewed by: @Firstyear, @progier389 , @tbordaz (Thanks)
|
commit 489b585a67bf9b91c33a93cf8b0c6c7bca398bee
Author: James Chapman <[email protected]>
Date: Fri Jun 10 16:09:24 2022 +0100
Issue 4812 - Scalability with high number of connections (#5090)
Description: Listener thread poll established connections. When the
number of connections is high and/or there is a high incoming traffic,
this single thread becomes a bottleneck. The thread is eating a lot of
cpu to go through the huge array of established connection but it is not
running fast enough if there is a big incoming traffic and finally
limits the capacity of the server.
Fix: Create multi connection table active lists where each list is
managed by a dedicated listener thread.
Relates: https://github.com/389ds/389-ds-base/issues/4812
Reviewed by: @Firstyear, @progier389 , @tbordaz (Thanks)
diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index ee1ea7d41..94dfabb34 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -46,6 +46,7 @@ static const char *requires_restart[] = {
"cn=config:nsslapd-changelogmaxage",
"cn=config:nsslapd-db-locks",
"cn=config:nsslapd-maxdescriptors",
+ "cn=config:nsslapd-numlisteners",
"cn=config:" CONFIG_RETURN_EXACT_CASE_ATTRIBUTE,
"cn=config:" CONFIG_SCHEMA_IGNORE_TRAILING_SPACES,
"cn=config,cn=ldbm:nsslapd-idlistscanlimit",
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 3c69ef1f9..577b27b96 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -1199,7 +1199,7 @@ connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, int *
/* Connection is closed */
disconnect_server_nomutex(conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, 0);
conn->c_gettingber = 0;
- signal_listner();
+ signal_listner(conn->c_ct_list);
ret = CONN_DONE;
goto done;
}
@@ -1355,7 +1355,7 @@ connection_make_readable(Connection *conn)
pthread_mutex_lock(&(conn->c_mutex));
conn->c_gettingber = 0;
pthread_mutex_unlock(&(conn->c_mutex));
- signal_listner();
+ signal_listner(conn->c_ct_list);
}
void
@@ -1731,7 +1731,7 @@ connection_threadmain(void *arg)
pthread_mutex_unlock(&(conn->c_mutex));
/* once the connection is readable, another thread may access conn,
* so need locking from here on */
- signal_listner();
+ signal_listner(conn->c_ct_list);
} else { /* more data in conn - just put back on work_q - bypass poll */
bypasspollcnt++;
pthread_mutex_lock(&(conn->c_mutex));
@@ -1809,7 +1809,7 @@ connection_threadmain(void *arg)
slapi_counter_decrement(g_get_per_thread_snmp_vars()->ops_tbl.dsConnectionsInMaxThreads);
connection_release_nolock(conn);
pthread_mutex_unlock(&(conn->c_mutex));
- signal_listner();
+ signal_listner(conn->c_ct_list);
slapi_pblock_destroy(pb);
return;
}
@@ -1896,13 +1896,13 @@ connection_threadmain(void *arg)
* before that call.
*/
if (need_wakeup) {
- signal_listner();
+ signal_listner(conn->c_ct_list);
need_wakeup = 0;
}
} else if (1 == is_timedout) {
/* covscan reports this code is unreachable (2019/6/4) */
connection_make_readable_nolock(conn);
- signal_listner();
+ signal_listner(conn->c_ct_list);
}
}
pthread_mutex_unlock(&(conn->c_mutex));
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index feb9c0d75..9912e4979 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -124,13 +124,18 @@ Connection_Table *
connection_table_new(int table_size)
{
Connection_Table *ct;
- int i = 0;
+ size_t i = 0;
+ int ct_list = 0;
+ int free_idx = 0;
ber_len_t maxbersize = config_get_maxbersize();
-
ct = (Connection_Table *)slapi_ch_calloc(1, sizeof(Connection_Table));
ct->size = table_size;
- ct->c = (Connection *)slapi_ch_calloc(1, table_size * sizeof(Connection));
- ct->fd = (struct POLL_STRUCT *)slapi_ch_calloc(1, table_size * sizeof(struct POLL_STRUCT));
+ ct->list_num = SLAPD_DEFAULT_NUM_LISTENERS;
+
+ ct->list_size = table_size/ct->list_num + 1; /* +1 to avoid rounding issue */
+ ct->num_active = (int *)slapi_ch_calloc(1, ct->list_num * sizeof(int));
+ ct->c = (Connection **)slapi_ch_calloc(1, table_size * sizeof(Connection));
+ ct->fd = (struct POLL_STRUCT **)slapi_ch_calloc(1, table_size * sizeof(struct POLL_STRUCT));
ct->table_mutex = PR_NewLock();
/* Allocate the freelist */
ct->c_freelist = (Connection **)slapi_ch_calloc(1, table_size * sizeof(Connection *));
@@ -141,53 +146,57 @@ connection_table_new(int table_size)
pthread_mutexattr_t monitor_attr = {0};
pthread_mutexattr_init(&monitor_attr);
pthread_mutexattr_settype(&monitor_attr, PTHREAD_MUTEX_RECURSIVE);
+ for (ct_list = 0; ct_list < ct->list_num; ct_list++) {
+ ct->c[ct_list] = (Connection *)slapi_ch_calloc(1, ct->list_size * sizeof(Connection));
+ ct->fd[ct_list] = (struct POLL_STRUCT *)slapi_ch_calloc(1, ct->list_size * sizeof(struct POLL_STRUCT));
+ /* We rely on the fact that we called calloc, which zeros the block, so we don't
+ * init any structure element unless a zero value is troublesome later
+ */
+ for (i = 0; i < ct->list_size; i++) {
+ /*
+ * Technically this is a no-op due to calloc, but we should always be
+ * careful with things like this ....
+ */
+ ct->c[ct_list][i].c_state = CONN_STATE_FREE;
+ /* Start the conn setup. */
+
+ LBER_SOCKET invalid_socket;
+ /* DBDB---move this out of here once everything works */
+ ct->c[ct_list][i].c_sb = ber_sockbuf_alloc();
+ invalid_socket = SLAPD_INVALID_SOCKET;
+ ct->c[ct_list][i].c_sd = SLAPD_INVALID_SOCKET;
+ ber_sockbuf_ctrl(ct->c[ct_list][i].c_sb, LBER_SB_OPT_SET_FD, &invalid_socket);
+ ber_sockbuf_ctrl(ct->c[ct_list][i].c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &maxbersize);
+ /* all connections start out invalid */
+ ct->fd[ct_list][i].fd = SLAPD_INVALID_SOCKET;
+
+ /* The connection table has a double linked list running through it.
+ * This is used to find out which connections should be looked at
+ * in the poll loop. Slot 0 in the table is always the head of
+ * the linked list. Each slot has a c_next and c_prev which are
+ * pointers back into the array of connection slots. */
+ ct->c[ct_list][i].c_next = NULL;
+ ct->c[ct_list][i].c_prev = NULL;
+ ct->c[ct_list][i].c_ci = i;
+ ct->c[ct_list][i].c_fdi = SLAPD_INVALID_SOCKET_INDEX;
+
+ if (pthread_mutex_init(&(ct->c[ct_list][i].c_mutex), &monitor_attr) != 0) {
+ slapi_log_err(SLAPI_LOG_ERR, "connection_table_get_connection", "pthread_mutex_init failed\n");
+ exit(1);
+ }
- /* We rely on the fact that we called calloc, which zeros the block, so we don't
- * init any structure element unless a zero value is troublesome later
- */
- for (i = 0; i < table_size; i++) {
- /*
- * Technically this is a no-op due to calloc, but we should always be
- * careful with things like this ....
- */
- ct->c[i].c_state = CONN_STATE_FREE;
- /* Start the conn setup. */
-
- LBER_SOCKET invalid_socket;
- /* DBDB---move this out of here once everything works */
- ct->c[i].c_sb = ber_sockbuf_alloc();
- invalid_socket = SLAPD_INVALID_SOCKET;
- ct->c[i].c_sd = SLAPD_INVALID_SOCKET;
- ber_sockbuf_ctrl(ct->c[i].c_sb, LBER_SB_OPT_SET_FD, &invalid_socket);
- ber_sockbuf_ctrl(ct->c[i].c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &maxbersize);
- /* all connections start out invalid */
- ct->fd[i].fd = SLAPD_INVALID_SOCKET;
-
- /* The connection table has a double linked list running through it.
- * This is used to find out which connections should be looked at
- * in the poll loop. Slot 0 in the table is always the head of
- * the linked list. Each slot has a c_next and c_prev which are
- * pointers back into the array of connection slots. */
- ct->c[i].c_next = NULL;
- ct->c[i].c_prev = NULL;
- ct->c[i].c_ci = i;
- ct->c[i].c_fdi = SLAPD_INVALID_SOCKET_INDEX;
-
- if (pthread_mutex_init(&(ct->c[i].c_mutex), &monitor_attr) != 0) {
- slapi_log_err(SLAPI_LOG_ERR, "connection_table_get_connection", "pthread_mutex_init failed\n");
- exit(1);
- }
+ ct->c[ct_list][i].c_pdumutex = PR_NewLock();
+ if (ct->c[ct_list][i].c_pdumutex == NULL) {
+ slapi_log_err(SLAPI_LOG_ERR, "connection_table_get_connection", "PR_NewLock failed\n");
+ exit(1);
+ }
- ct->c[i].c_pdumutex = PR_NewLock();
- if (ct->c[i].c_pdumutex == NULL) {
- slapi_log_err(SLAPI_LOG_ERR, "connection_table_get_connection", "PR_NewLock failed\n");
- exit(1);
- }
+ /* Ready to rock, mark as such. */
+ ct->c[ct_list][i].c_state = CONN_STATE_INIT;
- /* Ready to rock, mark as such. */
- ct->c[i].c_state = CONN_STATE_INIT;
- /* Prepare the connection into the freelist. */
- ct->c_freelist[i] = &(ct->c[i]);
+ /* Map multiple ct lists to a single freelist. */
+ ct->c_freelist[free_idx++] = &(ct->c[ct_list][i]);
+ }
}
return ct;
@@ -198,26 +207,31 @@ connection_table_free(Connection_Table *ct)
{
/* Release the freelist */
slapi_ch_free((void **)&ct->c_freelist);
- /* Now release the connections. */
- for (size_t i = 0; i < ct->size; i++) {
- /* Free the contents of the connection structure */
- Connection *c = &(ct->c[i]);
- connection_done(c);
+ for (size_t ct_list = 0; ct_list < ct->list_num; ct_list++) {
+ /* Now release the connections. */
+ for (size_t i = 0; i < ct->list_size; i++) {
+ /* Free the contents of the connection structure */
+ Connection *c = &(ct->c[ct_list][i]);
+ connection_done(c);
+ }
}
slapi_ch_free((void **)&ct->c);
slapi_ch_free((void **)&ct->fd);
PR_DestroyLock(ct->table_mutex);
+ slapi_ch_free((void *)&ct->num_active);
slapi_ch_free((void **)&ct);
}
void
connection_table_abandon_all_operations(Connection_Table *ct)
{
- for (size_t i = 0; i < ct->size; i++) {
- if (ct->c[i].c_state != CONN_STATE_FREE) {
- pthread_mutex_lock(&(ct->c[i].c_mutex));
- connection_abandon_operations(&ct->c[i]);
- pthread_mutex_unlock(&(ct->c[i].c_mutex));
+ for (size_t ct_list = 0; ct_list < ct->list_num; ct_list++) {
+ for (size_t i = 0; i < ct->list_size; i++) {
+ if (ct->c[ct_list][i].c_state != CONN_STATE_FREE) {
+ pthread_mutex_lock(&(ct->c[ct_list][i].c_mutex));
+ connection_abandon_operations(&ct->c[ct_list][i]);
+ pthread_mutex_unlock(&(ct->c[ct_list][i].c_mutex));
+ }
}
}
}
@@ -225,12 +239,14 @@ connection_table_abandon_all_operations(Connection_Table *ct)
void
connection_table_disconnect_all(Connection_Table *ct)
{
- for (size_t i = 0; i < ct->size; i++) {
- if (ct->c[i].c_state != CONN_STATE_FREE) {
- Connection *c = &(ct->c[i]);
- pthread_mutex_lock(&(c->c_mutex));
- disconnect_server_nomutex(c, c->c_connid, -1, SLAPD_DISCONNECT_ABORT, ECANCELED);
- pthread_mutex_unlock(&(c->c_mutex));
+ for (size_t ct_list = 0; ct_list < ct->list_num; ct_list++) {
+ for (size_t i = 0; i < ct->list_size; i++) {
+ if (ct->c[ct_list][i].c_state != CONN_STATE_FREE) {
+ Connection *c = &(ct->c[ct_list][i]);
+ pthread_mutex_lock(&(c->c_mutex));
+ disconnect_server_nomutex(c, c->c_connid, -1, SLAPD_DISCONNECT_ABORT, ECANCELED);
+ pthread_mutex_unlock(&(c->c_mutex));
+ }
}
}
}
@@ -294,9 +310,9 @@ connection_table_get_connection(Connection_Table *ct, int sd)
/* active connection iteration functions */
Connection *
-connection_table_get_first_active_connection(Connection_Table *ct)
+connection_table_get_first_active_connection(Connection_Table *ct, size_t listnum)
{
- return ct->c[0].c_next;
+ return ct->c[listnum][0].c_next;
}
Connection *
@@ -314,14 +330,17 @@ connection_table_iterate_active_connections(Connection_Table *ct, void *arg, Con
*/
Connection *current_conn = NULL;
int ret = 0;
+ size_t i = 0;
PR_Lock(ct->table_mutex);
- current_conn = connection_table_get_first_active_connection(ct);
- while (current_conn) {
- ret = f(current_conn, arg);
- if (ret) {
- break;
+ for (i = 0; i < ct->list_num; i++) {
+ current_conn = connection_table_get_first_active_connection(ct, i);
+ while (current_conn) {
+ ret = f(current_conn, arg);
+ if (ret) {
+ break;
+ }
+ current_conn = connection_table_get_next_active_connection(ct, current_conn);
}
- current_conn = connection_table_get_next_active_connection(ct, current_conn);
}
PR_Unlock(ct->table_mutex);
return ret;
@@ -332,22 +351,25 @@ static void
connection_table_dump_active_connection(Connection *c)
{
slapi_log_err(SLAPI_LOG_DEBUG, "connection_table_dump_active_connection", "conn=%p fd=%d refcnt=%d c_flags=%d\n"
- "mutex=%p next=%p prev=%p\n\n",
+ "mutex=%p next=%p prev=%p ctlist=%d\n\n",
c, c->c_sd, c->c_refcnt, c->c_flags,
- c->c_mutex, c->c_next, c->c_prev);
+ c->c_mutex, c->c_next, c->c_prev, c->c_ct_list);
}
static void
connection_table_dump_active_connections(Connection_Table *ct)
{
Connection *c;
+ int i = 0;
PR_Lock(ct->table_mutex);
- slapi_log_err(SLAPI_LOG_DEBUG, "connection_table_dump_active_connections", "********** BEGIN DUMP ************\n");
- c = connection_table_get_first_active_connection(ct);
- while (c) {
- connection_table_dump_active_connection(c);
- c = connection_table_get_next_active_connection(ct, c);
+ for (i = 0; i < ct->numlists; i++) {
+ slapi_log_err(SLAPI_LOG_DEBUG, "connection_table_dump_active_connections", "********** BEGIN DUMP ************\n");
+ c = connection_table_get_first_active_connection(ct, i);
+ while (c) {
+ connection_table_dump_active_connection(c);
+ c = connection_table_get_next_active_connection(ct, c);
+ }
}
slapi_log_err(SLAPI_LOG_DEBUG, "connection_table_dump_active_connections", "********** END DUMP ************\n");
@@ -366,6 +388,7 @@ connection_table_dump_active_connections(Connection_Table *ct)
* the connection slot to the freelist for re-use.
*/
int
+
connection_table_move_connection_out_of_active_list(Connection_Table *ct, Connection *c)
{
int c_sd; /* for logging */
@@ -414,6 +437,10 @@ connection_table_move_connection_out_of_active_list(Connection_Table *ct, Connec
/* We need to lock here because we're modifying the linked list */
PR_Lock(ct->table_mutex);
+ /* Decrement the number of active connections on the ct list this connection was assigned. */
+ (*(ct->num_active + c->c_ct_list))--;
+ c->c_ct_list = -1;
+
c->c_prev->c_next = c->c_next;
if (c->c_next) {
@@ -471,12 +498,16 @@ connection_table_move_connection_on_to_active_list(Connection_Table *ct, Connect
connection_table_dump_active_connection(c);
#endif
- c->c_next = ct->c[0].c_next;
+ /* Get the least used ct list and incremant its number of active connections. */
+ c->c_ct_list = connection_table_get_list(ct);
+ (*(ct->num_active + c->c_ct_list))++;
+
+ c->c_next = ct->c[c->c_ct_list][0].c_next;
if (c->c_next != NULL) {
c->c_next->c_prev = c;
}
- c->c_prev = &(ct->c[0]);
- ct->c[0].c_next = c;
+ c->c_prev = &(ct->c[c->c_ct_list][0]);
+ ct->c[c->c_ct_list][0].c_next = c;
PR_Unlock(ct->table_mutex);
@@ -485,6 +516,22 @@ connection_table_move_connection_on_to_active_list(Connection_Table *ct, Connect
#endif
}
+/* Find a connection table list with the lowest number of connections. */
+int
+connection_table_get_list(Connection_Table *ct)
+{
+ size_t i;
+ int list = 0;
+ int lowest = ct->num_active[0];
+ for (i = 1; i < ct->list_num; i++) {
+ if (*(ct->num_active + i) < lowest) {
+ lowest = *(ct->num_active + i);
+ list = i;
+ }
+ }
+ return list;
+}
+
/*
* Replace the following attributes within the entry 'e' with
* information about the connection table:
@@ -501,7 +548,9 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
char maxthreadbuf[BUFSIZ];
struct berval val;
struct berval *vals[2];
- int i, nconns, nreadwaiters;
+ size_t ct_list;
+ size_t i;
+ int nconns, nreadwaiters;
struct tm utm;
vals[0] = &val;
@@ -510,90 +559,92 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
attrlist_delete(&e->e_attrs, "connection");
nconns = 0;
nreadwaiters = 0;
- for (i = 0; i < (ct != NULL ? ct->size : 0); i++) {
- PR_Lock(ct->table_mutex);
- if (ct->c[i].c_state == CONN_STATE_FREE) {
+ for (ct_list = 0; ct_list < (ct != NULL ? ct->list_num : 0); ct_list++) {
+ for (i = 0; i < (ct != NULL ? ct->list_size : 0); i++) {
+ PR_Lock(ct->table_mutex);
+ if (ct->c[ct_list][i].c_state == CONN_STATE_FREE) {
+ PR_Unlock(ct->table_mutex);
+ continue;
+ }
+ /* Can't take c_mutex if holding table_mutex; temporarily unlock */
PR_Unlock(ct->table_mutex);
- continue;
- }
- /* Can't take c_mutex if holding table_mutex; temporarily unlock */
- PR_Unlock(ct->table_mutex);
- pthread_mutex_lock(&(ct->c[i].c_mutex));
- if (ct->c[i].c_sd != SLAPD_INVALID_SOCKET) {
- char buf2[SLAPI_TIMESTAMP_BUFSIZE+1];
- size_t lendn = ct->c[i].c_dn ? strlen(ct->c[i].c_dn) : 6; /* "NULLDN" */
- size_t lenip = ct->c[i].c_ipaddr ? strlen(ct->c[i].c_ipaddr) : 0;
- size_t lenconn = 1;
- uint64_t connid = ct->c[i].c_connid;
- char *bufptr = &buf[0];
- char *newbuf = NULL;
- int maxthreadstate = 0;
-
- /* Get the connid length */
- while (connid > 9) {
- lenconn++;
- connid /= 10;
- }
+ pthread_mutex_lock(&(ct->c[ct_list][i].c_mutex));
+ if (ct->c[ct_list][i].c_sd != SLAPD_INVALID_SOCKET) {
+ char buf2[SLAPI_TIMESTAMP_BUFSIZE+1];
+ size_t lendn = ct->c[ct_list][i].c_dn ? strlen(ct->c[ct_list][i].c_dn) : 6; /* "NULLDN" */
+ size_t lenip = ct->c[ct_list][i].c_ipaddr ? strlen(ct->c[ct_list][i].c_ipaddr) : 0;
+ size_t lenconn = 1;
+ uint64_t connid = ct->c[ct_list][i].c_connid;
+ char *bufptr = &buf[0];
+ char *newbuf = NULL;
+ int maxthreadstate = 0;
+
+ /* Get the connid length */
+ while (connid > 9) {
+ lenconn++;
+ connid /= 10;
+ }
- if (ct->c[i].c_flags & CONN_FLAG_MAX_THREADS) {
- maxthreadstate = 1;
- }
+ if (ct->c[ct_list][i].c_flags & CONN_FLAG_MAX_THREADS) {
+ maxthreadstate = 1;
+ }
- nconns++;
- if (ct->c[i].c_gettingber) {
- nreadwaiters++;
- }
+ nconns++;
+ if (ct->c[ct_list][i].c_gettingber) {
+ nreadwaiters++;
+ }
- gmtime_r(&ct->c[i].c_starttime, &utm);
- strftime(buf2, SLAPI_TIMESTAMP_BUFSIZE, "%Y%m%d%H%M%SZ", &utm);
+ gmtime_r(&ct->c[ct_list][i].c_starttime, &utm);
+ strftime(buf2, SLAPI_TIMESTAMP_BUFSIZE, "%Y%m%d%H%M%SZ", &utm);
- /*
- * Max threads per connection stats
- *
- * Appended output "1:2:3"
- *
- * 1 = Connection max threads state: 1 is in max threads, 0 is not
- * 2 = The number of times this thread has hit max threads
- * 3 = The number of operations attempted that were blocked
- * by max threads.
- */
- snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%" PRIu64 ":%" PRIu64 "",
- maxthreadstate, ct->c[i].c_maxthreadscount,
- ct->c[i].c_maxthreadsblocked);
-
- if ((lenconn + lenip + lendn + strlen(maxthreadbuf)) > (BUFSIZ - 54)) {
/*
- * 54 = 8 for the colon separators +
- * 6 for the "i" counter +
- * 15 for buf2 (date) +
- * 10 for c_opsinitiated +
- * 10 for c_opscompleted +
- * 1 for c_gettingber +
- * 3 for "ip=" +
- * 1 for NULL terminator
- */
- newbuf = (char *)slapi_ch_malloc(lenconn + lendn + lenip + strlen(maxthreadbuf) + 54);
- bufptr = newbuf;
- }
+ * Max threads per connection stats
+ *
+ * Appended output "1:2:3"
+ *
+ * 1 = Connection max threads state: 1 is in max threads, 0 is not
+ * 2 = The number of times this thread has hit max threads
+ * 3 = The number of operations attempted that were blocked
+ * by max threads.
+ */
+ snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%" PRIu64 ":%" PRIu64 "",
+ maxthreadstate, ct->c[ct_list][i].c_maxthreadscount,
+ ct->c[ct_list][i].c_maxthreadsblocked);
+
+ if ((lenconn + lenip + lendn + strlen(maxthreadbuf)) > (BUFSIZ - 54)) {
+ /*
+ * 54 = 8 for the colon separators +
+ * 6 for the "i" counter +
+ * 15 for buf2 (date) +
+ * 10 for c_opsinitiated +
+ * 10 for c_opscompleted +
+ * 1 for c_gettingber +
+ * 3 for "ip=" +
+ * 1 for NULL terminator
+ */
+ newbuf = (char *)slapi_ch_malloc(lenconn + lendn + lenip + strlen(maxthreadbuf) + 54);
+ bufptr = newbuf;
+ }
- sprintf(bufptr, "%d:%s:%d:%d:%s%s:%s:%s:%" PRIu64 ":ip=%s",
- i,
- buf2,
- ct->c[i].c_opsinitiated,
- ct->c[i].c_opscompleted,
- ct->c[i].c_gettingber ? "r" : "-",
- "",
- ct->c[i].c_dn ? ct->c[i].c_dn : "NULLDN",
- maxthreadbuf,
- ct->c[i].c_connid,
- ct->c[i].c_ipaddr);
- val.bv_val = bufptr;
- val.bv_len = strlen(bufptr);
- attrlist_merge(&e->e_attrs, "connection", vals);
- slapi_ch_free_string(&newbuf);
+ sprintf(bufptr, "%zu:%s:%d:%d:%s%s:%s:%s:%" PRIu64 ":ip=%s",
+ i,
+ buf2,
+ ct->c[ct_list][i].c_opsinitiated,
+ ct->c[ct_list][i].c_opscompleted,
+ ct->c[ct_list][i].c_gettingber ? "r" : "-",
+ "",
+ ct->c[ct_list][i].c_dn ? ct->c[ct_list][i].c_dn : "NULLDN",
+ maxthreadbuf,
+ ct->c[ct_list][i].c_connid,
+ ct->c[ct_list][i].c_ipaddr);
+ val.bv_val = bufptr;
+ val.bv_len = strlen(bufptr);
+ attrlist_merge(&e->e_attrs, "connection", vals);
+ slapi_ch_free_string(&newbuf);
+ }
+ pthread_mutex_unlock(&(ct->c[ct_list][i].c_mutex));
}
- pthread_mutex_unlock(&(ct->c[i].c_mutex));
}
snprintf(buf, sizeof(buf), "%d", nconns);
@@ -630,23 +681,25 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
void
connection_table_dump_activity_to_errors_log(Connection_Table *ct)
{
- int i;
-
- for (i = 0; i < ct->size; i++) {
- Connection *c = &(ct->c[i]);
- if (c->c_state) {
- /* Find the connection we are referring to */
- int j = c->c_fdi;
- pthread_mutex_lock(&(c->c_mutex));
- if ((c->c_sd != SLAPD_INVALID_SOCKET) &&
- (j >= 0) && (c->c_prfd == ct->fd[j].fd)) {
- int r = ct->fd[j].out_flags & SLAPD_POLL_FLAGS;
- if (r) {
- slapi_log_err(SLAPI_LOG_CONNS, "connection_table_dump_activity_to_errors_log",
- "activity on %d%s\n", i, r ? "r" : "");
+ size_t i;
+ size_t l;
+ for (l = 0; l < ct->list_num; l++) {
+ for (i = 0; i < ct->list_size; i++) {
+ Connection *c = &(ct->c[l][i]);
+ if (c->c_state) {
+ /* Find the connection we are referring to */
+ int ct_list = c->c_fdi;
+ pthread_mutex_lock(&(c->c_mutex));
+ if ((c->c_sd != SLAPD_INVALID_SOCKET) &&
+ (ct_list >= 0) && (c->c_prfd == ct->fd[l][ct_list].fd)) {
+ int r = ct->fd[l][ct_list].out_flags & SLAPD_POLL_FLAGS;
+ if (r) {
+ slapi_log_err(SLAPI_LOG_CONNS, "connection_table_dump_activity_to_errors_log",
+ "activity on %zu%s\n", i, r ? "r" : "");
+ }
}
+ pthread_mutex_unlock(&(c->c_mutex));
}
- pthread_mutex_unlock(&(c->c_mutex));
}
}
}
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index d8dfea511..e6e4341e6 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -66,6 +66,7 @@
int slapd_wakeup_timer = SLAPD_WAKEUP_TIMER; /* time in ms to wakeup */
int slapd_accept_wakeup_timer = SLAPD_ACCEPT_WAKEUP_TIMER; /* time in ms to wakeup */
+int slapd_ct_thread_wakeup_timer = SLAPD_WAKEUP_TIMER; /* time in ms to wakeup */
#ifdef notdef /* GGOODREPL */
/*
* time in secs to do housekeeping:
@@ -74,17 +75,18 @@ int slapd_accept_wakeup_timer = SLAPD_ACCEPT_WAKEUP_TIMER; /* time in ms to wake
short slapd_housekeeping_timer = 10;
#endif /* notdef GGOODREPL */
-PRFileDesc *signalpipe[2];
-static int writesignalpipe = SLAPD_INVALID_SOCKET;
-static int readsignalpipe = SLAPD_INVALID_SOCKET;
#define FDS_SIGNAL_PIPE 0
+static signal_pipe signalpipes[SLAPD_DEFAULT_NUM_LISTENERS]; /* One signal pipe per CT list */
+static PRInt32 ct_shutdown = 0;
static PRThread *disk_thread_p = NULL;
static PRThread *accept_thread_p = NULL;
static pthread_cond_t diskmon_cvar;
static pthread_mutex_t diskmon_mutex;
void disk_monitoring_stop(void);
+static void init_ct_list_threads(void);
+static void ct_thread_cleanup(void);
typedef struct listener_info
{
@@ -116,7 +118,7 @@ static const char *netaddr2string(const PRNetAddr *addr, char *addrbuf, size_t a
static void set_shutdown(int);
static void setup_pr_ct_firsttime_pds(Connection_Table *ct);
static PRIntn setup_pr_accept_pds(PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix, struct POLL_STRUCT **fds);
-static PRIntn setup_pr_read_pds(Connection_Table *ct);
+static PRIntn setup_pr_read_pds(Connection_Table *ct, int num_ct_lists);
#ifdef HPUX10
static void *catch_signals();
@@ -152,8 +154,8 @@ accept_and_configure(int s __attribute__((unused)), PRFileDesc *pr_acceptfd, PRN
* This is the shiny new re-born daemon function, without all the hair
*/
static int handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local, Connection **newconn);
-static void handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll);
-static int clear_signal(struct POLL_STRUCT *fds);
+static void handle_pr_read_ready(Connection_Table *ct, int list_id, PRIntn num_poll);
+static int clear_signal(struct POLL_STRUCT *fds, int list_id);
static void unfurl_banners(Connection_Table *ct, daemon_ports_t *ports, PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix);
static int write_pid_file(void);
static int init_shutdown_detect(void);
@@ -768,6 +770,7 @@ handle_listeners(struct POLL_STRUCT *fds)
{
Connection_Table *ct = the_connection_table;
size_t idx;
+ int ctlist = 0;
for (idx = 0; idx < listeners; ++idx) {
int fdidx = listener_idxs[idx].idx;
PRFileDesc *listenfd = listener_idxs[idx].listenfd;
@@ -778,14 +781,14 @@ handle_listeners(struct POLL_STRUCT *fds)
PR_ASSERT(listenfd == fds[fdidx].fd);
if (SLAPD_POLL_LISTEN_READY(fds[fdidx].out_flags)) {
/* accept() the new connection, put it on the active list for handle_pr_read_ready */
- int rc = handle_new_connection(ct, SLAPD_INVALID_SOCKET, listenfd, secure, local, NULL);
- if (rc) {
+ ctlist = handle_new_connection(ct, SLAPD_INVALID_SOCKET, listenfd, secure, local, NULL);
+ if (ctlist < 0) {
slapi_log_err(SLAPI_LOG_CONNS, "handle_listeners", "Error accepting new connection listenfd=%d\n",
PR_FileDesc2NativeHandle(listenfd));
continue;
} else {
/* Wake up the main event loop to handle this immediately. */
- signal_listner();
+ signal_listner(ctlist);
}
}
}
@@ -922,8 +925,6 @@ slapd_daemon(daemon_ports_t *ports)
PRFileDesc **s_tcps = NULL;
PRFileDesc **i_unix = NULL;
PRFileDesc **fdesp = NULL;
- PRIntn num_poll = 0;
- PRIntervalTime pr_timeout = PR_MillisecondsToInterval(slapd_wakeup_timer);
uint64_t threads;
int in_referral_mode = config_check_referral_mode();
int connection_table_size = get_configured_connection_table_size();
@@ -972,6 +973,7 @@ slapd_daemon(daemon_ports_t *ports)
exit(1);
}
+ init_ct_list_threads();
init_op_threads();
/* Start the SNMP collator if counters are enabled. */
@@ -1112,33 +1114,10 @@ slapd_daemon(daemon_ports_t *ports)
"MAINPID=%lu",
(unsigned long)getpid());
#endif
-
/* The meat of the operation is in a loop on a call to select */
while (!g_get_shutdown()) {
- int select_return = 0;
- PRErrorCode prerr;
- num_poll = setup_pr_read_pds(the_connection_table);
- select_return = POLL_FN(the_connection_table->fd, num_poll, pr_timeout);
- switch (select_return) {
- case 0: /* Timeout */
- break;
- case -1: /* Error */
- prerr = PR_GetError();
- slapi_log_err(SLAPI_LOG_TRACE, "slapd_daemon", "PR_Poll() failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
- prerr, slapd_system_strerror(prerr));
- break;
- default: /* some new data ready */
- /* handle new connections from the listeners */
- /*
- * Now done in accept_thread
- * handle_listeners(the_connection_table);
- */
- /* handle new data ready */
- handle_pr_read_ready(the_connection_table, connection_table_size);
- clear_signal(the_connection_table->fd);
- break;
- }
+ usleep(1000);
}
/* We get here when the server is shutting down */
/* Do what we have to do before death */
@@ -1154,6 +1133,7 @@ slapd_daemon(daemon_ports_t *ports)
}
op_thread_cleanup();
+ ct_thread_cleanup();
housekeeping_stop(); /* Run this after op_thread_cleanup() logged sth */
disk_monitoring_stop();
@@ -1187,28 +1167,31 @@ slapd_daemon(daemon_ports_t *ports)
PRPollDesc xpd;
char x;
int spe = 0;
+ int i = 0;
/* try to read from the signal pipe, in case threads are
* blocked on it. */
- xpd.fd = signalpipe[0];
- xpd.in_flags = PR_POLL_READ;
- xpd.out_flags = 0;
- spe = PR_Poll(&xpd, 1, PR_INTERVAL_NO_WAIT);
- if (spe > 0) {
- spe = PR_Read(signalpipe[0], &x, 1);
- if (spe < 0) {
+ for(i = 0; i < the_connection_table->list_num; i++) {
+ xpd.fd = signalpipes[i].signalpipe[0];
+ xpd.in_flags = PR_POLL_READ;
+ xpd.out_flags = 0;
+ spe = PR_Poll(&xpd, 1, PR_INTERVAL_NO_WAIT);
+ if (spe > 0) {
+ spe = PR_Read(signalpipes[i].signalpipe[0], &x, 1);
+ if (spe < 0) {
+ PRErrorCode prerr = PR_GetError();
+ slapi_log_err(SLAPI_LOG_ERR, "slapd_daemon", "listener could not clear signal pipe, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+ prerr, slapd_system_strerror(prerr));
+ break;
+ }
+ } else if (spe == -1) {
PRErrorCode prerr = PR_GetError();
- slapi_log_err(SLAPI_LOG_ERR, "slapd_daemon", "listener could not clear signal pipe, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+ slapi_log_err(SLAPI_LOG_ERR, "slapd_daemon", "PR_Poll() failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
prerr, slapd_system_strerror(prerr));
break;
+ } else {
+ /* no data */
}
- } else if (spe == -1) {
- PRErrorCode prerr = PR_GetError();
- slapi_log_err(SLAPI_LOG_ERR, "slapd_daemon", "PR_Poll() failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
- prerr, slapd_system_strerror(prerr));
- break;
- } else {
- /* no data */
}
DS_Sleep(PR_INTERVAL_NO_WAIT);
if (threads != g_get_active_threadcnt()) {
@@ -1283,30 +1266,98 @@ slapd_daemon(daemon_ports_t *ports)
}
}
+
+void
+ct_thread_cleanup(void)
+{
+ int i = 0;
+ int list_threads = the_connection_table->list_num;
+ slapi_log_err(SLAPI_LOG_INFO, "ct_thread_cleanup",
+ "slapd shutting down - signaling connection table threads\n");
+
+ PR_AtomicIncrement(&ct_shutdown);
+ for (i = 0; i < list_threads; i++) {
+ g_decr_active_threadcnt();
+ }
+}
+
+void
+ct_list_thread(uint64_t threadnum)
+{
+ uint64_t threadid = (uint64_t) threadnum;
+
+ while (!ct_shutdown) {
+ int select_return = 0;
+ PRIntn num_poll = 0;
+ PRIntervalTime pr_timeout = PR_MillisecondsToInterval(slapd_ct_thread_wakeup_timer);
+ PRErrorCode prerr;
+ num_poll = setup_pr_read_pds(the_connection_table, threadid);
+ select_return = POLL_FN(the_connection_table->fd[threadid], num_poll, pr_timeout);
+ switch (select_return) {
+ case 0: /* Timeout */
+ break;
+ case -1: /* Error */
+ prerr = PR_GetError();
+ slapi_log_err(SLAPI_LOG_TRACE, "ct_list_thread", "PR_Poll() failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+ prerr, slapd_system_strerror(prerr));
+ break;
+ default: /* some new data ready */
+ /* handle new data ready */
+ handle_pr_read_ready(the_connection_table, threadid, 0);
+ clear_signal(the_connection_table->fd[threadid], threadid);
+ break;
+ }
+ }
+}
+
+/* Create thread for each connection table list */
+void
+init_ct_list_threads(void)
+{
+ int ctlists = the_connection_table->list_num;
+
+ /* start the connection table threads, one thread per CT list */
+ for (uint64_t i = 0; i < ctlists; i++) {
+ if(PR_CreateThread(PR_SYSTEM_THREAD,
+ (VFP)(void *)ct_list_thread, (void *) i,
+ PR_PRIORITY_URGENT, PR_GLOBAL_THREAD,
+ PR_JOINABLE_THREAD,
+ SLAPD_DEFAULT_THREAD_STACKSIZE) == NULL) {
+ int prerr = PR_GetError();
+ slapi_log_err(SLAPI_LOG_ERR, "init_ct_list_threads",
+ "PR_CreateThread failed - Shutting Down (" SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+ prerr, slapd_pr_strerror(prerr));
+ g_set_shutdown(SLAPI_SHUTDOWN_EXIT);
+ } else {
+ g_incr_active_threadcnt();
+ }
+ }
+}
+
int
-signal_listner()
+signal_listner(int list_num)
{
/* Replaces previous macro---called to bump the thread out of select */
- if (write(writesignalpipe, "", 1) != 1) {
+ if (write(signalpipes[list_num].writesignalpipe, "", 1) != 1) {
/* this now means that the pipe is full
- * this is not a problem just go-on
- */
+ * this is not a problem just go-on
+ */
slapi_log_err(SLAPI_LOG_CONNS,
- "signal_listner", "Listener could not write to signal pipe %d\n",
- errno);
+ "signal_listner", "Listener could not write to signal pipe %d\n",
+ errno);
}
return (0);
}
static int
-clear_signal(struct POLL_STRUCT *fds)
+clear_signal(struct POLL_STRUCT *fds, int list_num)
{
if (fds[FDS_SIGNAL_PIPE].out_flags & SLAPD_POLL_FLAGS) {
char buf[200];
- slapi_log_err(SLAPI_LOG_CONNS, "clear_signal", "Listener got signaled\n");
- if (read(readsignalpipe, buf, 200) < 1) {
- slapi_log_err(SLAPI_LOG_ERR, "clear_signal", "Listener could not clear signal pipe\n");
+ if (read(signalpipes[list_num].readsignalpipe, buf, 200) < 1) {
+ slapi_log_err(SLAPI_LOG_ERR, "clear_signal", "Listener %d could not clear signal pipe\n",
+ list_num);
}
}
return 0;
@@ -1407,18 +1458,21 @@ setup_pr_accept_pds(PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_uni
static void
setup_pr_ct_firsttime_pds(Connection_Table *ct)
{
- for (size_t i = 0; i < ct->size; i++) {
- ct->c[i].c_fdi = SLAPD_INVALID_SOCKET_INDEX;
- }
- /* The fds entry for the signalpipe is always FDS_SIGNAL_PIPE (== 0) */
- PRIntn count = FDS_SIGNAL_PIPE;
- ct->fd[count].fd = signalpipe[0];
- ct->fd[count].in_flags = SLAPD_POLL_FLAGS;
- ct->fd[count].out_flags = 0;
+ for (size_t j = 0; j < ct->list_num; j++) {
+ for (size_t i = 0; i < ct->list_size; i++) {
+ ct->c[j][i].c_fdi = SLAPD_INVALID_SOCKET_INDEX;
+ }
+
+ /* The fds entry for the signalpipe is always FDS_SIGNAL_PIPE (== 0) */
+ PRIntn count = FDS_SIGNAL_PIPE;
+ ct->fd[j][count].fd = signalpipes[j].signalpipe[0];
+ ct->fd[j][count].in_flags = SLAPD_POLL_FLAGS;
+ ct->fd[j][count].out_flags = 0;
+ }
}
static PRIntn
-setup_pr_read_pds(Connection_Table *ct)
+setup_pr_read_pds(Connection_Table *ct, int listnum)
{
Connection *c = NULL;
Connection *next = NULL;
@@ -1431,7 +1485,7 @@ setup_pr_read_pds(Connection_Table *ct)
* out which connections we should poll over. If a connection
* is no longer in use, we should remove it from the linked
* list. */
- c = connection_table_get_first_active_connection(ct);
+ c = connection_table_get_first_active_connection(ct, listnum);
while (c && count < ct->size) {
next = connection_table_get_next_active_connection(ct, c);
if (c->c_state == CONN_STATE_FREE) {
@@ -1467,8 +1521,8 @@ setup_pr_read_pds(Connection_Table *ct)
add_fd = 0; /* do not poll on this fd */
}
if (add_fd) {
- ct->fd[count].fd = c->c_prfd;
- ct->fd[count].in_flags = SLAPD_POLL_FLAGS;
+ ct->fd[listnum][count].fd = c->c_prfd;
+ ct->fd[listnum][count].in_flags = SLAPD_POLL_FLAGS;
/* slot i of the connection table is mapped to slot
* count of the fds array */
c->c_fdi = count;
@@ -1510,7 +1564,7 @@ daemon_register_reslimits(void)
}
static void
-handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll __attribute__((unused)))
+handle_pr_read_ready(Connection_Table *ct, int list_num, PRIntn num_poll __attribute__((unused)))
{
Connection *c;
time_t curtime = slapi_current_rel_time_t();
@@ -1526,7 +1580,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll __attribute__((unused
* This function is called for all connections, so we traverse the entire
* active connection list to find any errors, activity, etc.
*/
- for (c = connection_table_get_first_active_connection(ct); c != NULL;
+ for (c = connection_table_get_first_active_connection(ct, list_num); c != NULL;
c = connection_table_get_next_active_connection(ct, c)) {
if (c->c_state != CONN_STATE_FREE) {
/* this check can be done without acquiring the mutex */
@@ -1540,7 +1594,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll __attribute__((unused
short readready;
if (c->c_fdi != SLAPD_INVALID_SOCKET_INDEX) {
- out_flags = ct->fd[c->c_fdi].out_flags;
+ out_flags = ct->fd[list_num][c->c_fdi].out_flags;
} else {
out_flags = 0;
}
@@ -1780,7 +1834,9 @@ handle_closed_connection(Connection *conn)
ber_sockbuf_remove_io(conn->c_sb, &openldap_sockbuf_io, LBER_SBIOD_LEVEL_PROVIDER);
}
-/* NOTE: this routine is not reentrant */
+/* NOTE: this routine is not reentrant
+ * this function returns the connection table list the new connection is in
+ */
static int
handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local, Connection **newconn)
{
@@ -1890,7 +1946,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
* This must be done as the very last thing before we unlock the mutex, because once it
* is added to the active list, it is live. */
if (conn != NULL && conn->c_next == NULL && conn->c_prev == NULL) {
- /* Now give the new connection to the connection code */
+ /* Now give the new connection to the connection code*/
connection_table_move_connection_on_to_active_list(the_connection_table, conn);
}
@@ -1901,7 +1957,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
if (newconn) {
*newconn = conn;
}
- return 0;
+ return conn->c_ct_list;
}
static int
@@ -2372,27 +2428,33 @@ netaddr2string(const PRNetAddr *addr, char *addrbuf, size_t addrbuflen)
static int
createsignalpipe(void)
{
- if (PR_CreatePipe(&signalpipe[0], &signalpipe[1]) != 0) {
- PRErrorCode prerr = PR_GetError();
- slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
- "PR_CreatePipe() failed, %s error %d (%s)\n",
- SLAPI_COMPONENT_NAME_NSPR, prerr, slapd_pr_strerror(prerr));
- return (-1);
- }
- writesignalpipe = PR_FileDesc2NativeHandle(signalpipe[1]);
- readsignalpipe = PR_FileDesc2NativeHandle(signalpipe[0]);
- if (fcntl(writesignalpipe, F_SETFD, O_NONBLOCK) == -1) {
- slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
- "Failed to set FD for write pipe (%d).\n", errno);
- }
- if (fcntl(readsignalpipe, F_SETFD, O_NONBLOCK) == -1) {
- slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
- "Failed to set FD for read pipe (%d).\n", errno);
+ int i;
+ /* there is a signal pipe for each ct list/thread mapping */
+ for (i = 0; i < the_connection_table->list_num; i++) {
+ if (PR_CreatePipe(&signalpipes[i].signalpipe[0], &signalpipes[i].signalpipe[1]) != 0) {
+ PRErrorCode prerr = PR_GetError();
+ slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
+ "PR_CreatePipe() failed, %s error %d (%s)\n",
+ SLAPI_COMPONENT_NAME_NSPR, prerr, slapd_pr_strerror(prerr));
+ return (-1);
+ }
+
+ signalpipes[i].readsignalpipe = PR_FileDesc2NativeHandle(signalpipes[i].signalpipe[0]);
+ signalpipes[i].writesignalpipe = PR_FileDesc2NativeHandle(signalpipes[i].signalpipe[1]);
+
+ if (fcntl(signalpipes[i].readsignalpipe, F_SETFD, O_NONBLOCK) == -1) {
+ slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
+ "Failed to set FD for read pipe (%d).\n", errno);
+ }
+
+ if (fcntl(signalpipes[i].writesignalpipe, F_SETFD, O_NONBLOCK) == -1) {
+ slapi_log_err(SLAPI_LOG_ERR, "createsignalpipe",
+ "Failed to set FD for write pipe (%d).\n", errno);
+ }
}
return (0);
}
-
#ifdef HPUX10
#include <pthread.h> /* for sigwait */
/*
@@ -2457,7 +2519,6 @@ get_configured_connection_table_size(void)
if (maxdesc >= 0 && size > maxdesc) {
size = maxdesc;
}
-
return size;
}
diff --git a/ldap/servers/slapd/fe.h b/ldap/servers/slapd/fe.h
index 3b1207c21..44ae723e1 100644
--- a/ldap/servers/slapd/fe.h
+++ b/ldap/servers/slapd/fe.h
@@ -80,17 +80,27 @@ int connection_call_io_layer_callbacks(Connection *c);
struct connection_table
{
int size;
+ int list_size; /* Size of each connection table list. */
+ int list_num; /* Number of connection table lists. */
+ int *num_active; /* list_num size buffer to track the number of connections on each connection table list. */
/* An array of connections, file descriptors, and a mapping between them. */
- Connection *c;
+ Connection **c;
/* An array of free connections awaiting allocation. */;
Connection **c_freelist;
size_t conn_next_offset;
size_t conn_free_offset;
- struct POLL_STRUCT *fd;
+ struct POLL_STRUCT **fd;
PRLock *table_mutex;
};
typedef struct connection_table Connection_Table;
+typedef struct signal_pipe
+{
+ PRFileDesc *signalpipe[2];
+ int readsignalpipe;
+ int writesignalpipe;
+} signal_pipe;
+
extern Connection_Table *the_connection_table; /* JCM - Exported from globals.c for daemon.c, monitor.c, puke, gag, etc */
Connection_Table *connection_table_new(int table_size);
@@ -102,15 +112,16 @@ int connection_table_move_connection_out_of_active_list(Connection_Table *ct, Co
void connection_table_move_connection_on_to_active_list(Connection_Table *ct, Connection *c);
void connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e);
void connection_table_dump_activity_to_errors_log(Connection_Table *ct);
-Connection *connection_table_get_first_active_connection(Connection_Table *ct);
+Connection *connection_table_get_first_active_connection(Connection_Table *ct, size_t listnum);
Connection *connection_table_get_next_active_connection(Connection_Table *ct, Connection *c);
typedef int (*Connection_Table_Iterate_Function)(Connection *c, void *arg);
int connection_table_iterate_active_connections(Connection_Table *ct, void *arg, Connection_Table_Iterate_Function f);
+int connection_table_get_list(Connection_Table *ct);
/*
* daemon.c
*/
-int signal_listner(void);
+int signal_listner(int listnum);
int daemon_pre_setuid_init(daemon_ports_t *ports);
void slapd_sockets_ports_free(daemon_ports_t *ports_info);
void slapd_daemon(daemon_ports_t *ports);
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 3cbe629e6..8d24ef526 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -281,6 +281,7 @@ typedef void (*VFPV)(); /* takes undefined arguments */
#define SLAPD_DEFAULT_MAXSIMPLEPAGED_PER_CONN_STR "-1"
/* We'd like this number to be prime for the hash into the Connection table */
#define SLAPD_DEFAULT_CONNTABLESIZE 4093 /* connection table size */
+#define SLAPD_DEFAULT_NUM_LISTENERS 1 /* connection table lists */
#define SLAPD_DEFAULT_LDAPSSOTOKEN_TTL 3600
#define SLAPD_DEFAULT_LDAPSSOTOKEN_TTL_STR "3600"
@@ -1706,6 +1707,7 @@ typedef struct conn
Conn_IO_Layer_cb c_pop_io_layer_cb; /* callback to pop an IO layer off of the conn->c_prfd */
void *c_io_layer_cb_data; /* callback data */
struct connection_table *c_ct; /* connection table that this connection belongs to */
+ int c_ct_list; /* ct active list this conn is part of */
int c_ns_close_jobs; /* number of current close jobs */
char *c_ipaddr; /* ip address str - used by monitor */
/* per conn static config */
| 0 |
c0fd0171fed64b026bc80bad872b6641a0c4d86f
|
389ds/389-ds-base
|
crash looking up compat syntax; numeric string syntax using integer; make octet string ordering work correctly
https://bugzilla.redhat.com/show_bug.cgi?id=559315
Resolves: bug 559315
Bug Description: Searching some attributes are now case sensitive when they were previously case-insensitive
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: slapi_matchingrule_is_compat() was not checking for NULL; the matching rule syntax plugin was registering with the INTEGER syntax oid; the bin_filter_ava() function needs to be ordering aware to implement the octetStringOrderingMatch; in default_mr_filter_create(), make sure the requested matching rule is provided by the given plugin
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
|
commit c0fd0171fed64b026bc80bad872b6641a0c4d86f
Author: Rich Megginson <[email protected]>
Date: Mon Feb 22 13:59:01 2010 -0700
crash looking up compat syntax; numeric string syntax using integer; make octet string ordering work correctly
https://bugzilla.redhat.com/show_bug.cgi?id=559315
Resolves: bug 559315
Bug Description: Searching some attributes are now case sensitive when they were previously case-insensitive
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: slapi_matchingrule_is_compat() was not checking for NULL; the matching rule syntax plugin was registering with the INTEGER syntax oid; the bin_filter_ava() function needs to be ordering aware to implement the octetStringOrderingMatch; in default_mr_filter_create(), make sure the requested matching rule is provided by the given plugin
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/syntaxes/bin.c b/ldap/servers/plugins/syntaxes/bin.c
index b1b46593f..3d2d88ac0 100644
--- a/ldap/servers/plugins/syntaxes/bin.c
+++ b/ldap/servers/plugins/syntaxes/bin.c
@@ -249,26 +249,44 @@ static int
bin_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
Slapi_Value **bvals, int ftype, Slapi_Value **retVal )
{
- int i;
+ int i;
- for ( i = 0; bvals[i] != NULL; i++ ) {
+ for ( i = 0; bvals[i] != NULL; i++ ) {
const struct berval *bv = slapi_value_get_berval(bvals[i]);
-
- if ( ( bv->bv_len == bvfilter->bv_len ) &&
- ( 0 == memcmp( bv->bv_val, bvfilter->bv_val, bvfilter->bv_len ) ) )
- {
- if(retVal!=NULL)
- {
- *retVal= bvals[i];
- }
- return( 0 );
+ int rc = slapi_berval_cmp(bv, bvfilter);
+
+ switch ( ftype ) {
+ case LDAP_FILTER_GE:
+ if ( rc >= 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
+ case LDAP_FILTER_LE:
+ if ( rc <= 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
+ case LDAP_FILTER_EQUALITY:
+ if ( rc == 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
}
- }
- if(retVal!=NULL)
- {
- *retVal= NULL;
- }
- return( -1 );
+ }
+ if(retVal!=NULL)
+ {
+ *retVal= NULL;
+ }
+ return( -1 );
}
static int
diff --git a/ldap/servers/plugins/syntaxes/numericstring.c b/ldap/servers/plugins/syntaxes/numericstring.c
index d1bf475d5..0cb4876d3 100644
--- a/ldap/servers/plugins/syntaxes/numericstring.c
+++ b/ldap/servers/plugins/syntaxes/numericstring.c
@@ -148,7 +148,7 @@ numstr_init( Slapi_PBlock *pb )
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
(void *) names );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
- (void *) INTEGER_SYNTAX_OID );
+ (void *) NUMERICSTRING_SYNTAX_OID );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
(void *) numstr_compare );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
diff --git a/ldap/servers/slapd/match.c b/ldap/servers/slapd/match.c
index 241b182cf..91fa0a8f3 100644
--- a/ldap/servers/slapd/match.c
+++ b/ldap/servers/slapd/match.c
@@ -322,7 +322,7 @@ int slapi_matchingrule_is_compat(const char *mr_oid_or_name, const char *syntax_
return 1;
}
for (mr_syntax = mrl->mr_entry->mr_compat_syntax;
- mr_syntax;
+ mr_syntax && *mr_syntax;
mr_syntax++) {
if (!strcmp(*mr_syntax, syntax_oid)) {
return 1;
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index 194f8aef3..7590f2685 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -170,7 +170,7 @@ plugin_mr_bind (char* oid, struct slapdplugin* plugin)
PR_Lock (global_mr_oids_lock);
i->oi_next = global_mr_oids;
global_mr_oids = i;
- PR_Unlock (global_mr_oids_lock);
+ PR_Unlock (global_mr_oids_lock);
LDAPDebug (LDAP_DEBUG_FILTER, "<= plugin_mr_bind\n", 0, 0, 0);
}
@@ -449,6 +449,15 @@ default_mr_filter_create(Slapi_PBlock *pb)
LDAPDebug2Args(LDAP_DEBUG_FILTER, "=> default_mr_filter_create(oid %s; type %s)\n",
mrOID, mrTYPE);
+ /* check to make sure this create function is supposed to be used with the
+ given oid */
+ if (!charray_inlist(pi->plg_mr_names, mrOID)) {
+ LDAPDebug2Args(LDAP_DEBUG_FILTER,
+ "=> default_mr_filter_create: cannot use matching rule %s with plugin %s\n",
+ mrOID, pi->plg_name);
+ goto done;
+ }
+
ftype = plugin_mr_get_type(pi);
/* map the ftype to the op type */
if (ftype == LDAP_FILTER_GE) {
| 0 |
24be8a640a6af74459f2b97692aaf43f26d5ab04
|
389ds/389-ds-base
|
Removed extra $(NS64TAG) from sh_release_config; $(NSCONFIG) contains _64.
sh_release_config:=$(sh_components_share)/$(SH_VERSION)/$(NSCONFIG)$(NSOBJDIR_TAG)
|
commit 24be8a640a6af74459f2b97692aaf43f26d5ab04
Author: Noriko Hosoi <[email protected]>
Date: Fri Apr 7 18:03:29 2006 +0000
Removed extra $(NS64TAG) from sh_release_config; $(NSCONFIG) contains _64.
sh_release_config:=$(sh_components_share)/$(SH_VERSION)/$(NSCONFIG)$(NSOBJDIR_TAG)
diff --git a/ns_usesh.mk b/ns_usesh.mk
index 1735acc8a..8fff42c66 100644
--- a/ns_usesh.mk
+++ b/ns_usesh.mk
@@ -121,7 +121,7 @@ sh_component_name:=smartheap6
# define the paths to the component parts
sh_path_root:=$(NSCP_DISTDIR)/$(sh_component_name)
sh_components_share=/share/builds/components/$(sh_component_name)
-sh_release_config:=$(sh_components_share)/$(SH_VERSION)/$(NSCONFIG)$(NS64TAG)$(NSOBJDIR_TAG)
+sh_release_config:=$(sh_components_share)/$(SH_VERSION)/$(NSCONFIG)$(NSOBJDIR_TAG)
SH_INCLUDE:=$(sh_path_root)/include
SH_LIBPATH:=$(sh_path_root)/lib
# hack below because I couldn't find this defined anywhere in the nsxxx.mk headers
| 0 |
a05cf36a63a3602895c2310703297af7bfcd0772
|
389ds/389-ds-base
|
Ticket 49099 - fix configure.ac due to NS change
Bug Description: During the ns change, apparently make clean
and autoreconf were not enough to check this was fine. I missed
some removal of options.
Fix Description: Remove the enable_nunc_stans line, and libevent.m4
https://pagure.io/389-ds-base/issue/49099
Author: wibrown
Review by: mreynolds (Thanks!)
|
commit a05cf36a63a3602895c2310703297af7bfcd0772
Author: William Brown <[email protected]>
Date: Thu May 11 11:26:06 2017 +1000
Ticket 49099 - fix configure.ac due to NS change
Bug Description: During the ns change, apparently make clean
and autoreconf were not enough to check this was fine. I missed
some removal of options.
Fix Description: Remove the enable_nunc_stans line, and libevent.m4
https://pagure.io/389-ds-base/issue/49099
Author: wibrown
Review by: mreynolds (Thanks!)
diff --git a/Makefile.am b/Makefile.am
index 65f4356d3..8e7539008 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,12 +39,8 @@ else
SDS_INCLUDES = -I$(srcdir)/src/libsds/include/ -I$(srcdir)/src/libsds/external/
endif
-if enable_nunc_stans
NUNCSTANS_INCLUDES = -I$(srcdir)/src/nunc-stans/include/
NUNC_STANS_ON = 1
-else
-NUNC_STANS_ON = 0
-endif
# the -U undefines these symbols - should use the corresponding DS_ ones instead - see configure.ac
DS_DEFINES = -DBUILD_NUM=$(BUILDNUM) -DVENDOR="\"$(vendor)\"" -DBRAND="\"$(brand)\"" -DCAPBRAND="\"$(capbrand)\"" \
diff --git a/configure.ac b/configure.ac
index bfccc2c7b..a64c9bd9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -704,6 +704,7 @@ AM_CONDITIONAL([FREEBSD],[test "$platform" = "freebsd"])
AM_CONDITIONAL([SPARC],[test "x$TARGET" = xSPARC])
# Check for library dependencies
+m4_include(m4/event.m4)
m4_include(m4/nspr.m4)
m4_include(m4/nss.m4)
m4_include(m4/openldap.m4)
| 0 |
8069de9c75fd3ae1cd0cb79104c864d54a404c78
|
389ds/389-ds-base
|
Issue 4666 - BUG - cb_ping_farm can fail with anonymous binds disabled (#4669)
Bug Description: cb_ping_farm had a combination of issues that made it
possible to fail in high load or odd situations. First it used anonymous
binds instead of the same credentials as the chaining process. Second
it used a NULL search DN, meaning it would use the default BASE configured
in /etc/openldap/ldap.conf. Depending on per-site configuration this
could cause the cb_ping_farm check to fail infinitly until restart
of the instance.
Fix Description: Change chaining cb_ping_farm to bind with the same
credentials as the chaining configuration, and change the target base
dn to the DN of the suffix that we are chaining to.
fixes: https://github.com/389ds/389-ds-base/issues/4666
Author: William Brown <[email protected]>
Review by: @progier389
|
commit 8069de9c75fd3ae1cd0cb79104c864d54a404c78
Author: Firstyear <[email protected]>
Date: Wed Mar 24 08:59:15 2021 +1000
Issue 4666 - BUG - cb_ping_farm can fail with anonymous binds disabled (#4669)
Bug Description: cb_ping_farm had a combination of issues that made it
possible to fail in high load or odd situations. First it used anonymous
binds instead of the same credentials as the chaining process. Second
it used a NULL search DN, meaning it would use the default BASE configured
in /etc/openldap/ldap.conf. Depending on per-site configuration this
could cause the cb_ping_farm check to fail infinitly until restart
of the instance.
Fix Description: Change chaining cb_ping_farm to bind with the same
credentials as the chaining configuration, and change the target base
dn to the DN of the suffix that we are chaining to.
fixes: https://github.com/389ds/389-ds-base/issues/4666
Author: William Brown <[email protected]>
Review by: @progier389
diff --git a/dirsrvtests/tests/suites/chaining_plugin/anonymous_access_denied_basic.py b/dirsrvtests/tests/suites/chaining_plugin/anonymous_access_denied_basic.py
new file mode 100644
index 000000000..1d0334010
--- /dev/null
+++ b/dirsrvtests/tests/suites/chaining_plugin/anonymous_access_denied_basic.py
@@ -0,0 +1,149 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2021 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
+import time
+import shutil
+from lib389.idm.account import Accounts, Account
+from lib389.topologies import topology_i2 as topology
+from lib389.backend import Backends
+from lib389._constants import DEFAULT_SUFFIX
+from lib389.plugins import ChainingBackendPlugin
+from lib389.chaining import ChainingLinks
+from lib389.mappingTree import MappingTrees
+from lib389.idm.services import ServiceAccounts, ServiceAccount
+from lib389.idm.domain import Domain
+
+PW = 'thnaoehtnuaoenhtuaoehtnu'
+
+pytestmark = pytest.mark.tier1
+
+def test_chaining_paged_search(topology):
+ """ Check that when the chaining target has anonymous access
+ disabled that the ping still functions and allows the search
+ to continue with an appropriate bind user.
+
+ :id: 00bf31db-d93b-4224-8e70-86abb2d4cd17
+ :setup: Two standalones in chaining.
+ :steps:
+ 1. Configure chaining between the nodes
+ 2. Do a chaining search (w anon allow) to assert it works
+ 3. Configure anon dis allowed on st2
+ 4. Restart both
+ 5. Check search still works
+
+ :expectedresults:
+ 1. Success
+ 2. Success
+ 3. Success
+ 4. Success
+ 5. Success
+ """
+ st1 = topology.ins["standalone1"]
+ st2 = topology.ins["standalone2"]
+
+ ### We setup so that st1 -> st2
+
+ # Setup a chaining user on st2 to authenticate to.
+ sa = ServiceAccounts(st2, DEFAULT_SUFFIX).create(properties = {
+ 'cn': 'sa',
+ 'userPassword': PW
+ })
+
+ # Add a proxy user.
+ sproxy = ServiceAccounts(st2, DEFAULT_SUFFIX).create(properties = {
+ 'cn': 'proxy',
+ 'userPassword': PW
+ })
+
+ # Add the read and proxy ACI
+ dc = Domain(st2, DEFAULT_SUFFIX)
+ dc.add('aci',
+ f"""(targetattr="objectClass || cn || uid")(version 3.0; acl "Enable sa read"; allow (read, search, compare)(userdn="ldap:///{sa.dn}");)"""
+ )
+ # Add the proxy ACI
+ dc.add('aci',
+ f"""(targetattr="*")(version 3.0; acl "Enable proxy access"; allow (proxy)(userdn="ldap:///{sproxy.dn}");)"""
+ )
+
+ # Clear all the BE in st1
+ bes1 = Backends(st1)
+ for be in bes1.list():
+ be.delete()
+
+ # Setup st1 to chain to st2
+ chain_plugin_1 = ChainingBackendPlugin(st1)
+ chain_plugin_1.enable()
+
+ # Chain with the proxy user.
+ chains = ChainingLinks(st1)
+ chain = chains.create(properties={
+ 'cn': 'demochain',
+ 'nsfarmserverurl': st2.toLDAPURL(),
+ 'nsslapd-suffix': DEFAULT_SUFFIX,
+ 'nsmultiplexorbinddn': sproxy.dn,
+ 'nsmultiplexorcredentials': PW,
+ 'nsCheckLocalACI': 'on',
+ 'nsConnectionLife': '30',
+ })
+
+ mts = MappingTrees(st1)
+ # Due to a bug in lib389, we need to delete and recreate the mt.
+ for mt in mts.list():
+ mt.delete()
+ mts.ensure_state(properties={
+ 'cn': DEFAULT_SUFFIX,
+ 'nsslapd-state': 'backend',
+ 'nsslapd-backend': 'demochain',
+ 'nsslapd-distribution-plugin': 'libreplication-plugin',
+ 'nsslapd-distribution-funct': 'repl_chain_on_update',
+ })
+
+ # Enable pwpolicy (Not sure if part of the issue).
+ st1.config.set('passwordIsGlobalPolicy', 'on')
+ st2.config.set('passwordIsGlobalPolicy', 'on')
+
+ # Restart to enable everything.
+ st1.restart()
+
+ # Get a proxy auth connection.
+ sa1 = ServiceAccount(st1, sa.dn)
+ sa1_conn = sa1.bind(password=PW)
+
+ # Now do a search from st1 -> st2
+ sa1_dc = Domain(sa1_conn, DEFAULT_SUFFIX)
+ assert sa1_dc.exists()
+
+ # Now on st2 disable anonymous access.
+ st2.config.set('nsslapd-allow-anonymous-access', 'rootdse')
+
+ # Stop st2 to force the connection to be dead.
+ st2.stop()
+ # Restart st1 - this means it must re-do the ping/keepalive.
+ st1.restart()
+
+ # do a bind - this should fail, and forces the conn offline.
+ with pytest.raises(ldap.OPERATIONS_ERROR):
+ sa1.bind(password=PW)
+
+ # Allow time to attach lldb if needed.
+ # print("🔥🔥🔥")
+ # time.sleep(45)
+
+ # Bring st2 online.
+ st2.start()
+
+ # Wait a bit
+ time.sleep(5)
+
+ # Get a proxy auth connection (again)
+ sa1_conn = sa1.bind(password=PW)
+ # Now do a search from st1 -> st2
+ sa1_dc = Domain(sa1_conn, DEFAULT_SUFFIX)
+ assert sa1_dc.exists()
diff --git a/ldap/servers/plugins/chainingdb/cb_conn_stateless.c b/ldap/servers/plugins/chainingdb/cb_conn_stateless.c
index a2003221e..c5866f51a 100644
--- a/ldap/servers/plugins/chainingdb/cb_conn_stateless.c
+++ b/ldap/servers/plugins/chainingdb/cb_conn_stateless.c
@@ -846,23 +846,45 @@ cb_stale_all_connections(cb_backend_instance *cb)
int
cb_ping_farm(cb_backend_instance *cb, cb_outgoing_conn *cnx, time_t end_time)
{
-
+ int version = LDAP_VERSION3;
char *attrs[] = {"1.1", NULL};
int rc;
+ int ret;
struct timeval timeout;
LDAP *ld;
LDAPMessage *result;
time_t now;
int secure;
- if (cb->max_idle_time <= 0) /* Heart-beat disabled */
+ char *plain = NULL;
+ const char *target = NULL;
+
+ if (cb->max_idle_time <= 0) {
+ /* Heart-beat disabled */
return LDAP_SUCCESS;
+ }
+
+ const Slapi_DN *target_sdn = slapi_be_getsuffix(cb->inst_be, 0);
+
+ if (target_sdn == NULL) {
+ return LDAP_NO_SUCH_ATTRIBUTE;
+ }
+
+ target = slapi_sdn_get_dn(target_sdn);
- if (cnx && (cnx->status != CB_CONNSTATUS_OK)) /* Known problem */
+ if (cnx && (cnx->status != CB_CONNSTATUS_OK)) {
+ /* Known problem */
return LDAP_SERVER_DOWN;
+ }
now = slapi_current_rel_time_t();
- if (end_time && ((now <= end_time) || (end_time < 0)))
+ if (end_time && ((now <= end_time) || (end_time < 0))) {
return LDAP_SUCCESS;
+ }
+
+ ret = pw_rever_decode(cb->pool->password, &plain, CB_CONFIG_USERPASSWORD);
+ if (ret == -1) {
+ return LDAP_INVALID_CREDENTIALS;
+ }
secure = cb->pool->secure;
if (cb->pool->starttls) {
@@ -870,16 +892,38 @@ cb_ping_farm(cb_backend_instance *cb, cb_outgoing_conn *cnx, time_t end_time)
}
ld = slapi_ldap_init(cb->pool->hostname, cb->pool->port, secure, 0);
if (NULL == ld) {
+ if (ret == 0) {
+ slapi_ch_free_string(&plain);
+ }
+ cb_update_failed_conn_cpt(cb);
+ return LDAP_SERVER_DOWN;
+ }
+ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);
+ /* Don't chase referrals */
+ ldap_set_option(ld, LDAP_OPT_REFERRALS, LDAP_OPT_OFF);
+
+ /* Authenticate as the multiplexor user */
+ LDAPControl **serverctrls = NULL;
+ rc = slapi_ldap_bind(ld, cb->pool->binddn, plain,
+ cb->pool->mech, NULL, &serverctrls,
+ &(cb->pool->conn.bind_timeout), NULL);
+ if (ret == 0) {
+ slapi_ch_free_string(&plain);
+ }
+
+ if (LDAP_SUCCESS != rc) {
+ slapi_ldap_unbind(ld);
cb_update_failed_conn_cpt(cb);
return LDAP_SERVER_DOWN;
}
+ ldap_controls_free(serverctrls);
+
+ /* Setup to search the base of the suffix */
timeout.tv_sec = cb->max_test_time;
timeout.tv_usec = 0;
- /* NOTE: This will fail if we implement the ability to disable
- anonymous bind */
- rc = ldap_search_ext_s(ld, NULL, LDAP_SCOPE_BASE, "objectclass=*", attrs, 1, NULL,
+ rc = ldap_search_ext_s(ld, target, LDAP_SCOPE_BASE, "objectclass=*", attrs, 1, NULL,
NULL, &timeout, 1, &result);
if (LDAP_SUCCESS != rc) {
slapi_ldap_unbind(ld);
| 0 |
a326dc36c37e93343980d0a4843951a702106849
|
389ds/389-ds-base
|
Bug(s) fixed: 211426
Bug Description: autotools: support dirsec packages, mozldap6, svrcore
Reviewed by: nkinder (Thanks!)
Fix Description: Look for the dirsec-nspr and dirsec-nss if nspr and nss
are not found in pkg-config. Look for mozldap6 then mozldap in
pkg-config. Look for svrcore-devel in pkg-config, then look for it in
the system directories.
Nathan pointed out that we do not support mozldap v5.x anymore, so we should just look for mozldap6 with pkg-config. I also added an explicit check of the vendor version in the header file to make sure we are using 600 or greater.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
|
commit a326dc36c37e93343980d0a4843951a702106849
Author: Rich Megginson <[email protected]>
Date: Thu Oct 19 16:53:05 2006 +0000
Bug(s) fixed: 211426
Bug Description: autotools: support dirsec packages, mozldap6, svrcore
Reviewed by: nkinder (Thanks!)
Fix Description: Look for the dirsec-nspr and dirsec-nss if nspr and nss
are not found in pkg-config. Look for mozldap6 then mozldap in
pkg-config. Look for svrcore-devel in pkg-config, then look for it in
the system directories.
Nathan pointed out that we do not support mozldap v5.x anymore, so we should just look for mozldap6 with pkg-config. I also added an explicit check of the vendor version in the header file to make sure we are using 600 or greater.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
diff --git a/configure b/configure
index 7e082c634..de3148243 100755
--- a/configure
+++ b/configure
@@ -23574,6 +23574,11 @@ fi
nspr_lib=`$PKG_CONFIG --libs-only-L nspr`
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`
+ echo "$as_me:$LINENO: result: using system dirsec NSPR" >&5
+echo "${ECHO_T}using system dirsec NSPR" >&6
else
{ { echo "$as_me:$LINENO: error: NSPR not found, specify with --with-nspr." >&5
echo "$as_me: error: NSPR not found, specify with --with-nspr." >&2;}
@@ -23733,6 +23738,11 @@ fi
nss_lib=`$PKG_CONFIG --libs-only-L nss`
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`
+ echo "$as_me:$LINENO: result: using system dirsec NSS" >&5
+echo "${ECHO_T}using system dirsec NSS" >&6
else
{ { echo "$as_me:$LINENO: error: NSS not found, specify with --with-nss." >&5
echo "$as_me: error: NSS not found, specify with --with-nss." >&2;}
@@ -23887,9 +23897,11 @@ echo "${ECHO_T}no" >&6
fi
if test -n "$PKG_CONFIG"; then
- if $PKG_CONFIG --exists mozldap; then
- nspr_inc=`$PKG_CONFIG --cflags-only-I mozldap`
- nspr_lib=`$PKG_CONFIG --libs-only-L mozldap`
+ if $PKG_CONFIG --exists mozldap6; then
+ ldapsdk_inc=`$PKG_CONFIG --cflags-only-I mozldap6`
+ ldapsdk_lib=`$PKG_CONFIG --libs-only-L mozldap6`
+ echo "$as_me:$LINENO: result: using system mozldap6" >&5
+echo "${ECHO_T}using system mozldap6" >&6
else
{ { echo "$as_me:$LINENO: error: LDAPSDK not found, specify with --with-ldapsdk-inc|-lib." >&5
echo "$as_me: error: LDAPSDK not found, specify with --with-ldapsdk-inc|-lib." >&2;}
@@ -23902,6 +23914,74 @@ if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then
echo "$as_me: error: LDAPSDK not found, specify with --with-ldapsdk-inc|-lib." >&2;}
{ (exit 1); exit 1; }; }
fi
+save_cppflags="$CPPFLAGS"
+CPPFLAGS="$ldapsdk_inc $nss_inc $nspr_inc"
+echo "$as_me:$LINENO: checking for ldap.h" >&5
+echo $ECHO_N "checking for ldap.h... $ECHO_C" >&6
+if test "${ac_cv_header_ldap_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ldap-standard.h>
+#if LDAP_VENDOR_VERSION < 600
+#error The LDAP C SDK version is not supported
+#endif
+
+
+#include <ldap.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_ldap_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_ldap_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_ldap_h" >&5
+echo "${ECHO_T}$ac_cv_header_ldap_h" >&6
+if test $ac_cv_header_ldap_h = yes; then
+ isversion6=1
+else
+ isversion6=
+fi
+
+
+CPPFLAGS="$save_cppflags"
+
+if test -z "$isversion6" ; then
+ { { echo "$as_me:$LINENO: error: The LDAPSDK version in $ldapsdk_inc/ldap-standard.h is not supported" >&5
+echo "$as_me: error: The LDAPSDK version in $ldapsdk_inc/ldap-standard.h is not supported" >&2;}
+ { (exit 1); exit 1; }; }
+fi
# BEGIN COPYRIGHT BLOCK
# Copyright (C) 2006 Red Hat, Inc.
@@ -24204,9 +24284,280 @@ echo "${ECHO_T}no" >&6
fi;
if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
- { { echo "$as_me:$LINENO: error: svrcore not found, specify with --with-svrcore." >&5
+ echo "$as_me:$LINENO: checking for svrcore with pkg-config" >&5
+echo $ECHO_N "checking for svrcore with pkg-config... $ECHO_C" >&6
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+
+if test -n "$PKG_CONFIG"; then
+ echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ if test -n "$PKG_CONFIG"; then
+ if $PKG_CONFIG --exists svrcore-devel; then
+ svrcore_inc=`$PKG_CONFIG --cflags-only-I svrcore-devel`
+ svrcore_lib=`$PKG_CONFIG --libs-only-L svrcore-devel`
+ echo "$as_me:$LINENO: result: using system svrcore" >&5
+echo "${ECHO_T}using system svrcore" >&6
+ fi
+ fi
+fi
+
+if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
+ echo "$as_me:$LINENO: checking for SVRCORE_GetRegisteredPinObj in -lsvrcore" >&5
+echo $ECHO_N "checking for SVRCORE_GetRegisteredPinObj in -lsvrcore... $ECHO_C" >&6
+if test "${ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvrcore $nss_inc $nspr_inc $nss_lib -lnss3 -lsoftokn3 $nspr_lib -lplds4 -lplc4 -lnspr4 $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char SVRCORE_GetRegisteredPinObj ();
+int
+main ()
+{
+SVRCORE_GetRegisteredPinObj ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj" >&5
+echo "${ECHO_T}$ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj" >&6
+if test $ac_cv_lib_svrcore_SVRCORE_GetRegisteredPinObj = yes; then
+ havesvrcore=1
+fi
+
+ if test -n "$havesvrcore" ; then
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$nss_inc $nspr_inc"
+ if test "${ac_cv_header_svrcore_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for svrcore.h" >&5
+echo $ECHO_N "checking for svrcore.h... $ECHO_C" >&6
+if test "${ac_cv_header_svrcore_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_svrcore_h" >&5
+echo "${ECHO_T}$ac_cv_header_svrcore_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking svrcore.h usability" >&5
+echo $ECHO_N "checking svrcore.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <svrcore.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking svrcore.h presence" >&5
+echo $ECHO_N "checking svrcore.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <svrcore.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: svrcore.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: svrcore.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: svrcore.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: svrcore.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: svrcore.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: svrcore.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: svrcore.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: svrcore.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: svrcore.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to http://bugzilla.redhat.com/ ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for svrcore.h" >&5
+echo $ECHO_N "checking for svrcore.h... $ECHO_C" >&6
+if test "${ac_cv_header_svrcore_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_svrcore_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_svrcore_h" >&5
+echo "${ECHO_T}$ac_cv_header_svrcore_h" >&6
+
+fi
+if test $ac_cv_header_svrcore_h = yes; then
+ havesvrcore=1
+else
+ havesvrcore=
+fi
+
+
+ CPPFLAGS="$save_cppflags"
+ fi
+ if test -z "$havesvrcore" ; then
+ { { echo "$as_me:$LINENO: error: svrcore not found, specify with --with-svrcore." >&5
echo "$as_me: error: svrcore not found, specify with --with-svrcore." >&2;}
{ (exit 1); exit 1; }; }
+ fi
fi
# BEGIN COPYRIGHT BLOCK
diff --git a/m4/mozldap.m4 b/m4/mozldap.m4
index 22bfb9d62..c93619872 100644
--- a/m4/mozldap.m4
+++ b/m4/mozldap.m4
@@ -74,9 +74,10 @@ if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then
AC_MSG_CHECKING(for mozldap with pkg-config)
AC_PATH_PROG(PKG_CONFIG, pkg-config)
if test -n "$PKG_CONFIG"; then
- if $PKG_CONFIG --exists mozldap; then
- nspr_inc=`$PKG_CONFIG --cflags-only-I mozldap`
- nspr_lib=`$PKG_CONFIG --libs-only-L mozldap`
+ if $PKG_CONFIG --exists mozldap6; then
+ ldapsdk_inc=`$PKG_CONFIG --cflags-only-I mozldap6`
+ ldapsdk_lib=`$PKG_CONFIG --libs-only-L mozldap6`
+ AC_MSG_RESULT([using system mozldap6])
else
AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib].])
fi
@@ -85,3 +86,19 @@ fi
if test -z "$ldapsdk_inc" -o -z "$ldapsdk_lib"; then
AC_MSG_ERROR([LDAPSDK not found, specify with --with-ldapsdk[-inc|-lib].])
fi
+dnl make sure the ldap sdk version is 6 or greater - we do not support
+dnl the old 5.x or prior versions - the ldap server code expects the new
+dnl ber types and other code used with version 6
+save_cppflags="$CPPFLAGS"
+CPPFLAGS="$ldapsdk_inc $nss_inc $nspr_inc"
+AC_CHECK_HEADER([ldap.h], [isversion6=1], [isversion6=],
+[#include <ldap-standard.h>
+#if LDAP_VENDOR_VERSION < 600
+#error The LDAP C SDK version is not supported
+#endif
+])
+CPPFLAGS="$save_cppflags"
+
+if test -z "$isversion6" ; then
+ AC_MSG_ERROR([The LDAPSDK version in $ldapsdk_inc/ldap-standard.h is not supported])
+fi
diff --git a/m4/nspr.m4 b/m4/nspr.m4
index d9d4d83a3..81230f66d 100644
--- a/m4/nspr.m4
+++ b/m4/nspr.m4
@@ -78,6 +78,10 @@ if test -z "$nspr_inc" -o -z "$nspr_lib"; then
nspr_inc=`$PKG_CONFIG --cflags-only-I nspr`
nspr_lib=`$PKG_CONFIG --libs-only-L nspr`
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`
+ AC_MSG_RESULT([using system dirsec NSPR])
else
AC_MSG_ERROR([NSPR not found, specify with --with-nspr.])
fi
diff --git a/m4/nss.m4 b/m4/nss.m4
index 827127725..a1bf803da 100644
--- a/m4/nss.m4
+++ b/m4/nss.m4
@@ -78,6 +78,10 @@ if test -z "$nss_inc" -o -z "$nss_lib"; then
nss_inc=`$PKG_CONFIG --cflags-only-I nss`
nss_lib=`$PKG_CONFIG --libs-only-L nss`
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`
+ AC_MSG_RESULT([using system dirsec NSS])
else
AC_MSG_ERROR([NSS not found, specify with --with-nss.])
fi
diff --git a/m4/svrcore.m4 b/m4/svrcore.m4
index 420c58385..3ae9662b9 100644
--- a/m4/svrcore.m4
+++ b/m4/svrcore.m4
@@ -63,6 +63,32 @@ AC_ARG_WITH(svrcore-lib,
],
AC_MSG_RESULT(no))
+dnl svrcore not given - look for pkg-config
if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
- AC_MSG_ERROR([svrcore not found, specify with --with-svrcore.])
+ AC_MSG_CHECKING(for svrcore with pkg-config)
+ AC_PATH_PROG(PKG_CONFIG, pkg-config)
+ if test -n "$PKG_CONFIG"; then
+ if $PKG_CONFIG --exists svrcore-devel; then
+ svrcore_inc=`$PKG_CONFIG --cflags-only-I svrcore-devel`
+ svrcore_lib=`$PKG_CONFIG --libs-only-L svrcore-devel`
+ AC_MSG_RESULT([using system svrcore])
+ fi
+ fi
+fi
+
+if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then
+dnl just see if svrcore is already a system library
+ AC_CHECK_LIB([svrcore], [SVRCORE_GetRegisteredPinObj], [havesvrcore=1],
+ [], [$nss_inc $nspr_inc $nss_lib -lnss3 -lsoftokn3 $nspr_lib -lplds4 -lplc4 -lnspr4])
+ if test -n "$havesvrcore" ; then
+dnl just see if svrcore is already a system header file
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$nss_inc $nspr_inc"
+ AC_CHECK_HEADER([svrcore.h], [havesvrcore=1], [havesvrcore=])
+ CPPFLAGS="$save_cppflags"
+ fi
+dnl for svrcore to be present, both the library and the header must exist
+ if test -z "$havesvrcore" ; then
+ AC_MSG_ERROR([svrcore not found, specify with --with-svrcore.])
+ fi
fi
| 0 |
2e5a30d6c9d6553f9e3aa8e3c1ae0c995d156e11
|
389ds/389-ds-base
|
Ticket 534 - RFE: Add SASL mappings fallback
Bug Description: The function for removing entries from the list of SASL
mappings causes segmentation faults.
Fix Description: Use correct double-linked list deletion routine in the
function.
https://fedorahosted.org/389/ticket/534
Reviewed by: mreynolds
|
commit 2e5a30d6c9d6553f9e3aa8e3c1ae0c995d156e11
Author: Mark Reynolds <[email protected]>
Date: Wed Mar 27 17:32:21 2013 -0400
Ticket 534 - RFE: Add SASL mappings fallback
Bug Description: The function for removing entries from the list of SASL
mappings causes segmentation faults.
Fix Description: Use correct double-linked list deletion routine in the
function.
https://fedorahosted.org/389/ticket/534
Reviewed by: mreynolds
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index 60bf4a778..9652c14c5 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -138,14 +138,16 @@ sasl_map_remove_list_entry(sasl_map_private *priv, char *removeme)
prev = current->prev;
if (prev) {
/* Unlink it */
- if(next){
- next->prev = prev;
+ if (next) {
+ next->prev = prev;
}
prev->next = next;
} else {
/* That was the first list entry */
- priv->map_data_list = current->next;
- priv->map_data_list->prev = NULL;
+ if (next) {
+ next->prev = NULL;
+ }
+ priv->map_data_list = next;
}
/* Payload free */
sasl_map_free_data(¤t);
| 0 |
efc96f10defe0c622c50d8fa9ddcea0773b5e850
|
389ds/389-ds-base
|
Ticket 49689 - Fix local "make install" after adding cockpit subpackage
Bug Description: When doing a local "make install" the cockpit UI files
are not copied to the "buildroot", which then leads to
rsync failing.
Fix Description: If the "source directory" is not the same as the current
directory, then its a local "make install" and not a
"make rpms". In that case just copy over the cockpit ui
directory to the local buildroot. This makes it easy to
test Cockpit UI changes using "make install".
https://pagure.io/389-ds-base/issue/49689
Reviewed by: mreynolds(one line commit rule)
|
commit efc96f10defe0c622c50d8fa9ddcea0773b5e850
Author: Mark Reynolds <[email protected]>
Date: Tue May 22 12:27:50 2018 -0400
Ticket 49689 - Fix local "make install" after adding cockpit subpackage
Bug Description: When doing a local "make install" the cockpit UI files
are not copied to the "buildroot", which then leads to
rsync failing.
Fix Description: If the "source directory" is not the same as the current
directory, then its a local "make install" and not a
"make rpms". In that case just copy over the cockpit ui
directory to the local buildroot. This makes it easy to
test Cockpit UI changes using "make install".
https://pagure.io/389-ds-base/issue/49689
Reviewed by: mreynolds(one line commit rule)
diff --git a/Makefile.am b/Makefile.am
index 5e72f1afd..ec227618b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -753,6 +753,7 @@ libexec_SCRIPTS = ldap/admin/src/scripts/ds_selinux_enabled \
wrappers/ds_systemd_ask_password_acl
install-data-hook:
+ if [ "$(srcdir)" != "." ]; then cp -r $(srcdir)/src/cockpit src ; fi
rsync -rupE src/cockpit/389-console/ $(DESTDIR)$(cockpitdir)
if ENABLE_PERL
| 0 |
396c9320f51c751e040da97ba8396c0f36de88f1
|
389ds/389-ds-base
|
Ticket #183 - passwordMaxFailure should lockout password one sooner - and should be configurable to avoid regressions
Bug Description: DS doesn't return error LDAP_CONSTRAINT_VIOLATION until after the retry limit is exceeded
Fix Description: DS has essentially locked the account, but we didn't log the error until
the next bind. Added a new config option "passwordLegacyPolicy: on|off"
that will trigger the error LDAP_CONSTRAINT_VIOLATION, if "legacy" is off,
when the limit is actually reached. The default is to continue to do
things the "old" way, or legacy "on".
https://fedorahosted.org/389/ticket/183
reviewed by: Noriko (Thanks!)
|
commit 396c9320f51c751e040da97ba8396c0f36de88f1
Author: Mark Reynolds <[email protected]>
Date: Thu Apr 5 22:40:01 2012 -0400
Ticket #183 - passwordMaxFailure should lockout password one sooner - and should be configurable to avoid regressions
Bug Description: DS doesn't return error LDAP_CONSTRAINT_VIOLATION until after the retry limit is exceeded
Fix Description: DS has essentially locked the account, but we didn't log the error until
the next bind. Added a new config option "passwordLegacyPolicy: on|off"
that will trigger the error LDAP_CONSTRAINT_VIOLATION, if "legacy" is off,
when the limit is actually reached. The default is to continue to do
things the "old" way, or legacy "on".
https://fedorahosted.org/389/ticket/183
reviewed by: Noriko (Thanks!)
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 8bcd54447..d5b8fafb2 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -373,6 +373,9 @@ static struct config_get_and_set {
{CONFIG_PW_ISGLOBAL_ATTRIBUTE, config_set_pw_is_global_policy,
NULL, 0,
(void**)&global_slapdFrontendConfig.pw_is_global_policy, CONFIG_ON_OFF, NULL},
+ {CONFIG_PW_IS_LEGACY, config_set_pw_is_legacy_policy,
+ NULL, 0,
+ (void**)&global_slapdFrontendConfig.pw_policy.pw_is_legacy, CONFIG_ON_OFF, NULL},
{CONFIG_AUDITLOG_MAXNUMOFLOGSPERDIR_ATTRIBUTE, NULL,
log_set_numlogsperdir, SLAPD_AUDIT_LOG,
(void**)&global_slapdFrontendConfig.auditlog_maxnumlogs, CONFIG_INT, NULL},
@@ -1017,6 +1020,7 @@ FrontendConfig_init () {
cfg->pw_policy.pw_lockduration = 3600; /* 60 minutes */
cfg->pw_policy.pw_resetfailurecount = 600; /* 10 minutes */
cfg->pw_policy.pw_gracelimit = 0;
+ cfg->pw_policy.pw_is_legacy = LDAP_ON;
cfg->pw_is_global_policy = LDAP_OFF;
cfg->accesslog_logging_enabled = LDAP_ON;
@@ -2416,6 +2420,20 @@ config_set_pw_is_global_policy( const char *attrname, char *value, char *errorbu
return retVal;
}
+int
+config_set_pw_is_legacy_policy( const char *attrname, char *value, char *errorbuf, int apply ) {
+ int retVal = LDAP_SUCCESS;
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+
+ retVal = config_set_onoff ( attrname,
+ value,
+ &(slapdFrontendConfig->pw_policy.pw_is_legacy),
+ errorbuf,
+ apply);
+
+ return retVal;
+}
+
int
config_set_pw_exp( const char *attrname, char *value, char *errorbuf, int apply ) {
int retVal = LDAP_SUCCESS;
@@ -4234,6 +4252,18 @@ config_get_pw_is_global_policy() {
return retVal;
}
+int
+config_get_pw_is_legacy_policy() {
+ slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
+ int retVal;
+
+ CFG_LOCK_READ(slapdFrontendConfig);
+ retVal = slapdFrontendConfig->pw_policy.pw_is_legacy;
+ CFG_UNLOCK_READ(slapdFrontendConfig);
+
+ return retVal;
+}
+
int
config_get_pw_exp() {
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 9bbcf53ff..d291be3cf 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -340,6 +340,7 @@ int config_set_pw_unlock(const char *attrname, char *value, char *errorbuf, int
int config_set_pw_lockduration(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_pw_resetfailurecount(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_pw_is_global_policy(const char *attrname, char *value, char *errorbuf, int apply );
+int config_set_pw_is_legacy_policy(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_pw_gracelimit(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_useroc(const char *attrname, char *value, char *errorbuf, int apply );
int config_set_return_exact_case(const char *attrname, char *value, char *errorbuf, int apply );
diff --git a/ldap/servers/slapd/pw.h b/ldap/servers/slapd/pw.h
index 83f000327..a470fdd4f 100644
--- a/ldap/servers/slapd/pw.h
+++ b/ldap/servers/slapd/pw.h
@@ -96,6 +96,6 @@ int check_pw_storagescheme_value( const char *attr_name, char *value, long minva
* Public functions from pw_retry.c:
*/
Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn );
-void set_retry_cnt_mods ( Slapi_PBlock *pb, Slapi_Mods *smods, int count);
+int set_retry_cnt_mods ( Slapi_PBlock *pb, Slapi_Mods *smods, int count);
#endif /* _SLAPD_PW_H_ */
diff --git a/ldap/servers/slapd/pw_retry.c b/ldap/servers/slapd/pw_retry.c
index 524462290..09d0ed07a 100644
--- a/ldap/servers/slapd/pw_retry.c
+++ b/ldap/servers/slapd/pw_retry.c
@@ -50,8 +50,8 @@
/* prototypes */
/****************************************************************************/
/* Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn ); */
-static void set_retry_cnt ( Slapi_PBlock *pb, int count);
-static void set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time);
+static int set_retry_cnt ( Slapi_PBlock *pb, int count);
+static int set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time);
/*
* update_pw_retry() is called when bind operation fails
@@ -72,6 +72,7 @@ int update_pw_retry ( Slapi_PBlock *pb )
char *cur_time_str = NULL;
char *retryCountResetTime;
int passwordRetryCount;
+ int rc = 0;
/* get the entry */
e = get_entry ( pb, NULL );
@@ -93,18 +94,18 @@ int update_pw_retry ( Slapi_PBlock *pb )
{
/* set passwordRetryCount to 1 */
/* reset retryCountResetTime */
- set_retry_cnt_and_time ( pb, 1, cur_time );
+ rc = set_retry_cnt_and_time ( pb, 1, cur_time );
slapi_ch_free((void **) &cur_time_str );
slapi_entry_free( e );
- return ( 0 ); /* success */
+ return ( rc ); /* success */
} else {
slapi_ch_free((void **) &cur_time_str );
}
} else {
/* initialize passwordRetryCount and retryCountResetTime */
- set_retry_cnt_and_time ( pb, 1, cur_time );
+ rc = set_retry_cnt_and_time ( pb, 1, cur_time );
slapi_entry_free( e );
- return ( 0 ); /* success */
+ return ( rc ); /* success */
}
passwordRetryCount = slapi_entry_attr_get_int(e, "passwordRetryCount");
if (passwordRetryCount >= 0)
@@ -112,24 +113,25 @@ int update_pw_retry ( Slapi_PBlock *pb )
retry_cnt = passwordRetryCount + 1;
if ( retry_cnt == 1 ) {
/* set retryCountResetTime */
- set_retry_cnt_and_time ( pb, retry_cnt, cur_time );
+ rc = set_retry_cnt_and_time ( pb, retry_cnt, cur_time );
} else {
/* set passwordRetryCount to retry_cnt */
- set_retry_cnt ( pb, retry_cnt );
+ rc = set_retry_cnt ( pb, retry_cnt );
}
}
slapi_entry_free( e );
- return 0; /* success */
+ return rc; /* success */
}
static
-void set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time ) {
+int set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time ) {
const char *dn = NULL;
Slapi_DN *sdn = NULL;
Slapi_Mods smods;
time_t reset_time;
char *timestr;
passwdPolicy *pwpolicy = NULL;
+ int rc = 0;
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
dn = slapi_sdn_get_dn(sdn);
@@ -144,14 +146,16 @@ void set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time ) {
slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "retryCountResetTime", timestr);
slapi_ch_free((void **)×tr);
- set_retry_cnt_mods(pb, &smods, count);
+ rc = set_retry_cnt_mods(pb, &smods, count);
pw_apply_mods(sdn, &smods);
slapi_mods_done(&smods);
delete_passwdPolicy(&pwpolicy);
+
+ return rc;
}
-void set_retry_cnt_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
+int set_retry_cnt_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
{
char *timestr;
time_t unlock_time;
@@ -159,6 +163,7 @@ void set_retry_cnt_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
const char *dn = NULL;
Slapi_DN *sdn = NULL;
passwdPolicy *pwpolicy = NULL;
+ int rc = 0;
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
dn = slapi_sdn_get_dn(sdn);
@@ -182,23 +187,26 @@ void set_retry_cnt_mods(Slapi_PBlock *pb, Slapi_Mods *smods, int count)
timestr= format_genTime ( unlock_time );
slapi_mods_add_string(smods, LDAP_MOD_REPLACE, "accountUnlockTime", timestr);
slapi_ch_free((void **)×tr);
+ rc = LDAP_CONSTRAINT_VIOLATION;
}
}
delete_passwdPolicy(&pwpolicy);
- return;
+ return rc;
}
static
-void set_retry_cnt ( Slapi_PBlock *pb, int count)
+int set_retry_cnt ( Slapi_PBlock *pb, int count)
{
Slapi_DN *sdn = NULL;
Slapi_Mods smods;
+ int rc = 0;
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
slapi_mods_init(&smods, 0);
- set_retry_cnt_mods(pb, &smods, count);
+ rc = set_retry_cnt_mods(pb, &smods, count);
pw_apply_mods(sdn, &smods);
slapi_mods_done(&smods);
+ return rc;
}
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 6f36a6098..4712ea108 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -377,7 +377,15 @@ send_ldap_result_ext(
dn = slapi_sdn_get_dn(sdn);
pwpolicy = new_passwdPolicy(pb, dn);
if (pwpolicy && (pwpolicy->pw_lockout == 1)) {
- update_pw_retry ( pb );
+ if(update_pw_retry( pb ) == LDAP_CONSTRAINT_VIOLATION && !pwpolicy->pw_is_legacy){
+ /*
+ * If we are not using the legacy pw policy behavior,
+ * convert the error 49 to 19 (constraint violation)
+ * and log a message
+ */
+ err = LDAP_CONSTRAINT_VIOLATION;
+ text = "Invalid credentials, you now have exceeded the password retry limit.";
+ }
}
}
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index f7c0bf2f5..669e304f8 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1952,6 +1952,7 @@ typedef struct _slapdEntryPoints {
#define CONFIG_PW_RESETFAILURECOUNT_ATTRIBUTE "passwordResetFailureCount"
#define CONFIG_PW_ISGLOBAL_ATTRIBUTE "passwordIsGlobalPolicy"
#define CONFIG_PW_GRACELIMIT_ATTRIBUTE "passwordGraceLimit"
+#define CONFIG_PW_IS_LEGACY "passwordLegacyPolicy"
#define CONFIG_ACCESSLOG_BUFFERING_ATTRIBUTE "nsslapd-accesslog-logbuffering"
#define CONFIG_CSNLOGGING_ATTRIBUTE "nsslapd-csnlogging"
#define CONFIG_RETURN_EXACT_CASE_ATTRIBUTE "nsslapd-return-exact-case"
@@ -2039,6 +2040,7 @@ typedef struct passwordpolicyarray {
long pw_lockduration;
long pw_resetfailurecount;
int pw_gracelimit;
+ int pw_is_legacy;
struct pw_scheme *pw_storagescheme;
} passwdPolicy;
| 0 |
eac3f15f2209719e05640e1576b4273d03bef079
|
389ds/389-ds-base
|
Bug 571677 - Busy replica on consumers when directly deleting a replication conflict
https://bugzilla.redhat.com/show_bug.cgi?id=571677
Resolves: bug 571677
Bug Description: Busy replica on consumers when directly deleting a replication conflict
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: In some cases, urp fixup operations can be called from
the bepreop stage of other operations. The ldbm_back_delete() and
ldbm_back_modify() code lock the target entry in the cache. If a bepreop
then attempts to operate on the same entry and acquire the lock on the
entry, deadlock will occur.
The modrdn code does not acquire the cache lock on the target entries
before calling the bepreops. The modify and delete code does not acquire
the cache lock on the target entries before calling the bepostops.
I tried unlocking the target entry before calling the bepreops, then locking
the entry just after. This causes the problem to disappear, but I do not
know if this will lead to race conditions. The modrdn has been working this
way forever, and there are no known race conditions with that code.
I think the most robust fix for this issue would be to introduce some sort
of semaphore instead of a simple mutex on the cached entry. Then
cache_lock_entry would look something like this:
if entry->sem == 0
entry->sem++ /* acquire entry */
entry->locking_thread = this_thread
else if entry->locking_thread == this_thread
entry->sem++ /* increment count on this entry */
else
wait_for_sem(entry->sem) /* wait until released */
and cache_unlock_entry would look something like this:
entry->sem--;
if entry->sem == 0
entry->locking_thread = 0
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
|
commit eac3f15f2209719e05640e1576b4273d03bef079
Author: Rich Megginson <[email protected]>
Date: Tue Mar 23 19:08:13 2010 -0600
Bug 571677 - Busy replica on consumers when directly deleting a replication conflict
https://bugzilla.redhat.com/show_bug.cgi?id=571677
Resolves: bug 571677
Bug Description: Busy replica on consumers when directly deleting a replication conflict
Reviewed by: nhosoi (Thanks!)
Branch: HEAD
Fix Description: In some cases, urp fixup operations can be called from
the bepreop stage of other operations. The ldbm_back_delete() and
ldbm_back_modify() code lock the target entry in the cache. If a bepreop
then attempts to operate on the same entry and acquire the lock on the
entry, deadlock will occur.
The modrdn code does not acquire the cache lock on the target entries
before calling the bepreops. The modify and delete code does not acquire
the cache lock on the target entries before calling the bepostops.
I tried unlocking the target entry before calling the bepreops, then locking
the entry just after. This causes the problem to disappear, but I do not
know if this will lead to race conditions. The modrdn has been working this
way forever, and there are no known race conditions with that code.
I think the most robust fix for this issue would be to introduce some sort
of semaphore instead of a simple mutex on the cached entry. Then
cache_lock_entry would look something like this:
if entry->sem == 0
entry->sem++ /* acquire entry */
entry->locking_thread = this_thread
else if entry->locking_thread == this_thread
entry->sem++ /* increment count on this entry */
else
wait_for_sem(entry->sem) /* wait until released */
and cache_unlock_entry would look something like this:
entry->sem--;
if entry->sem == 0
entry->locking_thread = 0
Platforms tested: RHEL5 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 98374ee5a..3ede0f37e 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -178,6 +178,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
/* Don't call pre-op for Tombstone entries */
if (!delete_tombstone_entry)
{
+ int rc = 0;
/*
* Some present state information is passed through the PBlock to the
* backend pre-op plugin. To ensure a consistent snapshot of this state
@@ -191,7 +192,12 @@ ldbm_back_delete( Slapi_PBlock *pb )
goto error_return;
}
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
- if(plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN)==-1)
+ /* have to unlock the entry here, in case the bepreop attempts
+ to modify the same entry == deadlock */
+ cache_unlock_entry( &inst->inst_cache, e );
+ rc = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_DELETE_FN);
+ cache_lock_entry( &inst->inst_cache, e );
+ if (rc == -1)
{
/*
* Plugin indicated some kind of failure,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index cf41a64b6..a368f1c7d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -294,7 +294,11 @@ ldbm_back_modify( Slapi_PBlock *pb )
/* ec is the entry that our bepreop should get to mess with */
slapi_pblock_set( pb, SLAPI_MODIFY_EXISTING_ENTRY, ec->ep_entry );
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &ldap_result_code);
+ /* have to unlock the entry here, in case the bepreop attempts
+ to modify the same entry == deadlock */
+ cache_unlock_entry( &inst->inst_cache, e );
plugin_call_plugins(pb, SLAPI_PLUGIN_BE_PRE_MODIFY_FN);
+ cache_lock_entry( &inst->inst_cache, e );
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &ldap_result_code);
/* The Plugin may have messed about with some of the PBlock parameters... ie. mods */
slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index a3f192975..6d0a440be 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -1008,6 +1008,7 @@ common_return:
CACHE_RETURN( &inst->inst_cache, &ec );
}
+ moddn_unlock_and_return_entries(be,&e,&existingentry);
/*
* The bepostop is called even if the operation fails.
*/
@@ -1021,7 +1022,6 @@ common_return:
slapi_mods_done(&smods_operation_wsi);
slapi_mods_done(&smods_generated);
slapi_mods_done(&smods_generated_wsi);
- moddn_unlock_and_return_entries(be,&e,&existingentry);
slapi_ch_free((void**)&child_entries);
slapi_ch_free((void**)&child_dns);
if (ldap_result_matcheddn && 0 != strcmp(ldap_result_matcheddn, "NULL"))
| 0 |
3f8914aa28d13c8ec5e43cfad66bf97f7d65267a
|
389ds/389-ds-base
|
Ticket 48830 - Convert lib389 to ip route tools
Bug Description: lib389 is using the deprecated ifconfig for a check.
Fix Description: replace this with the correct call to ip route tools instead
https://fedorahosted.org/389/ticket/48830
Author: wibrown
Review by: spichugi (Thanks!)
|
commit 3f8914aa28d13c8ec5e43cfad66bf97f7d65267a
Author: William Brown <[email protected]>
Date: Wed May 11 13:40:31 2016 +1000
Ticket 48830 - Convert lib389 to ip route tools
Bug Description: lib389 is using the deprecated ifconfig for a check.
Fix Description: replace this with the correct call to ip route tools instead
https://fedorahosted.org/389/ticket/48830
Author: wibrown
Review by: spichugi (Thanks!)
diff --git a/src/lib389/lib389/utils.py b/src/lib389/lib389/utils.py
index 1ede4e3cb..17aff84db 100644
--- a/src/lib389/lib389/utils.py
+++ b/src/lib389/lib389/utils.py
@@ -371,9 +371,9 @@ def isLocalHost(host_name):
# next, see if this IP addr is one of our
# local addresses
- p = my_popen(['/sbin/ifconfig', '-a'], stdout=PIPE)
+ p = my_popen(['/sbin/ip', 'addr'], stdout=PIPE)
child_stdout = p.stdout.read()
- found = ('inet addr:' + ip_addr) in child_stdout
+ found = ('inet ' + ip_addr) in child_stdout
p.wait()
return found
| 0 |
ab84ab89d6a31b49bd8166d8839a3c398ac22b67
|
389ds/389-ds-base
|
Ticket 47721 - Schema Replication Issue (follow up)
Fix Description:
Forget to change (char *) into (const char *)
https://fedorahosted.org/389/ticket/47721
Reviewed by: Rich Megginson
Platforms tested: F19
Flag Day: no
Doc impact: no
|
commit ab84ab89d6a31b49bd8166d8839a3c398ac22b67
Author: Thierry bordaz (tbordaz) <[email protected]>
Date: Fri Apr 25 11:53:27 2014 +0200
Ticket 47721 - Schema Replication Issue (follow up)
Fix Description:
Forget to change (char *) into (const char *)
https://fedorahosted.org/389/ticket/47721
Reviewed by: Rich Megginson
Platforms tested: F19
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 447e0c4ca..8744a6d7d 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -205,7 +205,7 @@ static PRBool check_replicated_schema(LDAPMod **mods, char *replica_role, char *
static void modify_schema_get_new_definitions(Slapi_PBlock *pb, LDAPMod **mods, struct schema_mods_indexes **at_list, struct schema_mods_indexes **oc_list);
static void modify_schema_apply_new_definitions(char *attr_name, struct schema_mods_indexes *list);
static void modify_schema_free_new_definitions(struct schema_mods_indexes *def_list);
-static int schema_oc_compare(struct objclass *oc_1, struct objclass *oc_2, char *description);
+static int schema_oc_compare(struct objclass *oc_1, struct objclass *oc_2, const char *description);
static int schema_at_compare(struct asyntaxinfo *at_1, struct asyntaxinfo *at_2, char *message, int debug_logging);
static int schema_at_superset_check(struct asyntaxinfo *at_list1, struct asyntaxinfo *at_list2, char *message, int replica_role);
static int schema_at_superset_check_syntax_oids(char *oid1, char *oid2);
@@ -6175,15 +6175,15 @@ slapi_schema_get_superior_name(const char *ocname_or_oid)
static int
schema_oc_superset_check(struct objclass *oc_list1, struct objclass *oc_list2, char *message, int replica_role) {
struct objclass *oc_1, *oc_2;
- char *description;
+ const char *description;
int debug_logging = 0;
int rc;
int repl_schema_policy;
if (message == NULL) {
- description = "";
+ description = (const char *) "";
} else {
- description = message;
+ description = (const char *) message;
}
/* by default assum oc_list1 == oc_list2 */
@@ -6272,12 +6272,12 @@ schema_list_oc2learn(struct objclass *oc_remote_list, struct objclass *oc_local_
struct schema_mods_indexes *head = NULL, *mods_index;
int index = 0;
int repl_schema_policy;
- char *message;
+ const char *message;
if (replica_role == REPL_SCHEMA_AS_SUPPLIER) {
- message = "remote consumer";
+ message = (const char *) "remote consumer";
} else {
- message = "remote supplier";
+ message = (const char *) "remote supplier";
}
slapi_rwlock_rdlock( schema_policy_lock );
@@ -6377,7 +6377,7 @@ schema_list_attr2learn(struct asyntaxinfo *at_list_local, struct asyntaxinfo *at
* else it returns 0
*/
static PRBool
-schema_oc_compare_strict(struct objclass *oc_1, struct objclass *oc_2, char *description)
+schema_oc_compare_strict(struct objclass *oc_1, struct objclass *oc_2, const char *description)
{
int found;
int i,j;
@@ -6486,7 +6486,7 @@ schema_oc_compare_strict(struct objclass *oc_1, struct objclass *oc_2, char *des
* 0: if oc_1 and at_2 are equivalent
*/
static int
-schema_oc_compare(struct objclass *oc_1, struct objclass *oc_2, char *description)
+schema_oc_compare(struct objclass *oc_1, struct objclass *oc_2, const char *description)
{
if (schema_oc_compare_strict(oc_1, oc_2, description) > 0) {
return 1;
| 0 |
78003de289556ca6cdbe81fd200f80f4e8f69cbb
|
389ds/389-ds-base
|
Ticket 50303 - Add task creation date to task data
Description: Add a new attribute to the slapi task entry containing
the start date. This provides a nice convenience without
having to change LDAP clients.
https://pagure.io/389-ds-base/issue/50303
Reviewed by: firstyear & spichugi(Thanks!)
|
commit 78003de289556ca6cdbe81fd200f80f4e8f69cbb
Author: Mark Reynolds <[email protected]>
Date: Wed Mar 27 11:03:07 2019 -0400
Ticket 50303 - Add task creation date to task data
Description: Add a new attribute to the slapi task entry containing
the start date. This provides a nice convenience without
having to change LDAP clients.
https://pagure.io/389-ds-base/issue/50303
Reviewed by: firstyear & spichugi(Thanks!)
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
index 5b6b90ead..46fc164bd 100644
--- a/dirsrvtests/tests/suites/basic/basic_test.py
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
@@ -248,24 +248,32 @@ def test_basic_import_export(topology_st, import_example_ldif):
log.info('Running test_basic_import_export...')
- tmp_dir = '/tmp'
-
#
# Test online/offline LDIF imports
#
topology_st.standalone.start()
# Generate a test ldif (50k entries)
+ log.info("Generating LDIF...")
ldif_dir = topology_st.standalone.get_ldif_dir()
import_ldif = ldif_dir + '/basic_import.ldif'
dbgen(topology_st.standalone, 50000, import_ldif, DEFAULT_SUFFIX)
# Online
+ log.info("Importing LDIF online...")
r = ImportTask(topology_st.standalone)
r.import_suffix_from_ldif(ldiffile=import_ldif, suffix=DEFAULT_SUFFIX)
+
+ # Good as place as any to quick test the task has some expected attributes
+ assert r.present('nstaskcreated')
+ assert r.present('nstasklog')
+ assert r.present('nstaskcurrentitem')
+ assert r.present('nstasktotalitems')
+
r.wait()
# Offline
+ log.info("Importing LDIF offline...")
topology_st.standalone.stop()
if not topology_st.standalone.ldif2db(DEFAULT_BENAME, None, None, None, import_ldif):
log.fatal('test_basic_import_export: Offline import failed')
@@ -277,14 +285,15 @@ def test_basic_import_export(topology_st, import_example_ldif):
#
# Online export
+ log.info("Exporting LDIF online...")
export_ldif = ldif_dir + '/export.ldif'
-
r = ExportTask(topology_st.standalone)
r.export_suffix_to_ldif(ldiffile=export_ldif, suffix=DEFAULT_SUFFIX)
r.wait()
# Offline export
+ log.info("Exporting LDIF offline...")
topology_st.standalone.stop()
if not topology_st.standalone.db2ldif(DEFAULT_BENAME, (DEFAULT_SUFFIX,),
None, None, None, export_ldif):
@@ -296,6 +305,7 @@ def test_basic_import_export(topology_st, import_example_ldif):
#
# Cleanup - Import the Example LDIF for the other tests in this suite
#
+ log.info("Restore datrabase, import initial LDIF...")
ldif = '%s/dirsrv/data/Example.ldif' % topology_st.standalone.get_data_dir()
import_ldif = topology_st.standalone.get_ldif_dir() + "/Example.ldif"
shutil.copyfile(ldif, import_ldif)
@@ -361,6 +371,7 @@ def test_basic_backup(topology_st, import_example_ldif):
log.info('test_basic_backup: PASSED')
+
def test_basic_db2index(topology_st, import_example_ldif):
"""Assert db2index can operate correctly.
@@ -897,7 +908,7 @@ def create_users(topology_st):
log.info('Adding 5 test users')
for name in user_names:
- user = users.create(properties={
+ users.create(properties={
'uid': name,
'sn': name,
'cn': name,
@@ -1015,6 +1026,7 @@ def test_connection_buffer_size(topology_st):
with pytest.raises(ldap.OPERATIONS_ERROR):
topology_st.standalone.config.replace('nsslapd-connection-buffer', value)
+
@pytest.mark.bz1637439
def test_critical_msg_on_empty_range_idl(topology_st):
"""Doing a range index lookup should not report a critical message even if IDL is empty
@@ -1087,6 +1099,7 @@ def test_critical_msg_on_empty_range_idl(topology_st):
# Step 5
assert not topology_st.standalone.searchErrorsLog('CRIT - list_candidates - NULL idl was recieved from filter_candidates_ext.')
+
def audit_pattern_found(server, log_pattern):
file_obj = open(server.ds_paths.audit_log, "r")
@@ -1102,6 +1115,7 @@ def audit_pattern_found(server, log_pattern):
return found
+
@pytest.mark.ds50026
def test_ticketldbm_audit(topology_st):
"""When updating LDBM config attributes, those attributes/values are not listed
@@ -1208,5 +1222,3 @@ if __name__ == '__main__':
# -s for DEBUG mode
CURRENT_FILE = os.path.realpath(__file__)
pytest.main("-s %s" % CURRENT_FILE)
-
-
diff --git a/ldap/schema/02common.ldif b/ldap/schema/02common.ldif
index 62e77a762..23d38f7ee 100644
--- a/ldap/schema/02common.ldif
+++ b/ldap/schema/02common.ldif
@@ -137,6 +137,13 @@ attributeTypes: ( 2.16.840.1.113730.3.1.3023 NAME 'nsViewFilter' DESC 'Netscape
attributeTypes: ( 2.16.840.1.113730.3.1.2063 NAME 'nsEncryptionAlgorithm' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.2094 NAME 'nsslapd-parent-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.2401 NAME 'ConflictCSN' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2085 NAME 'isReplicated' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2354 NAME 'nsTaskLog' DESC 'Slapi Task log' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2355 NAME 'nsTaskStatus' DESC 'Slapi Task status' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2356 NAME 'nsTaskExitCode' DESC 'Slapi Task exit code' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2357 NAME 'nsTaskCurrentItem' DESC 'Slapi Task item' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2358 NAME 'nsTaskTotalItems' DESC 'Slapi Task total items' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2359 NAME 'nsTaskCreated' DESC 'Slapi Task creation date' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE X-ORIGIN '389 Directory Server' )
#
# objectclasses:
#
@@ -169,4 +176,5 @@ objectClasses: ( 2.16.840.1.113730.3.2.503 NAME 'nsDSWindowsReplicationAgreement
objectClasses: ( 2.16.840.1.113730.3.2.128 NAME 'costemplate' DESC 'Netscape defined objectclass' SUP top MAY ( cn $ cospriority ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.304 NAME 'nsView' DESC 'Netscape defined objectclass' SUP top AUXILIARY MAY ( nsViewFilter $ description ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.316 NAME 'nsAttributeEncryption' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsEncryptionAlgorithm ) X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2085 NAME 'isReplicated' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.335 NAME 'nsSlapiTask' DESC 'Slapi_Task objectclass' SUP top MUST ( cn ) MAY ( ttl $ nsTaskLog $ nsTaskStatus $ nsTaskExitCode $ nsTaskCurrentItem $ nsTaskTotalItems $ nsTaskCreated ) X-ORIGIN '389 Directory Server' )
+
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 75535711b..98426e457 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1731,13 +1731,13 @@ struct slapi_task
int task_flags; /* (see above) */
char *task_status; /* transient status info */
char *task_log; /* appended warnings, etc */
+ char task_date[SLAPI_TIMESTAMP_BUFSIZE]; /* Date/time when task was created */
void *task_private; /* allow opaque data to be stashed in the task */
TaskCallbackFn cancel; /* task has been cancelled by user */
TaskCallbackFn destructor; /* task entry is being destroyed */
int task_refcount;
- void *origin_plugin; /* If this is a plugin create task, store the plugin object */
- PRLock *task_log_lock; /* To protect task_log to be realloced if
- it's in use */
+ void *origin_plugin; /* If this is a plugin create task, store the plugin object */
+ PRLock *task_log_lock; /* To protect task_log to be realloced if it's in use */
} slapi_task;
/* End of interface to support online tasks **********************************/
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index b42e87240..6e223fe4b 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -45,6 +45,7 @@ static int shutting_down = 0;
#define TASK_EXITCODE_NAME "nsTaskExitCode"
#define TASK_PROGRESS_NAME "nsTaskCurrentItem"
#define TASK_WORK_NAME "nsTaskTotalItems"
+#define TASK_DATE_NAME "nsTaskCreated"
#define DEFAULT_TTL "3600" /* seconds */
#define TASK_SYSCONFIG_FILE_ATTR "sysconfigfile" /* sysconfig reload task file attr */
@@ -347,6 +348,7 @@ slapi_task_status_changed(Slapi_Task *task)
sprintf(s3, "%d", task->task_work);
NEXTMOD(TASK_PROGRESS_NAME, s2);
NEXTMOD(TASK_WORK_NAME, s3);
+ NEXTMOD(TASK_DATE_NAME, task->task_date);
/* only add the exit code when the job is done */
if ((task->task_state == SLAPI_TASK_FINISHED) ||
(task->task_state == SLAPI_TASK_CANCELLED)) {
@@ -604,6 +606,9 @@ new_task(const char *rawdn, void *plugin)
return NULL;
}
+ /* Set the task creation time */
+ slapi_timestamp_utc_hr(task->task_date, SLAPI_TIMESTAMP_BUFSIZE);
+
/* Now take our lock to setup everything correctly. */
PR_Lock(task->task_log_lock);
@@ -687,7 +692,7 @@ destroy_task(time_t when, void *arg)
slapi_delete_internal_pb(pb);
slapi_pblock_destroy(pb);
- slapi_ch_free((void **)&task->task_dn);
+ slapi_ch_free_string(&task->task_dn);
slapi_ch_free((void **)&task);
}
| 0 |
4c333c131975debacd65bdb5a96b7a56e9012048
|
389ds/389-ds-base
|
Bug 504817 - Handle LDAPv2 quoted RDN values correctly
The bug fix for bug 438139 introduced a regression that causes the
server to not handle LDAPv2 quoted RDN values correctly. We were
including the '"' characters used to contain an unescaped value in
the actual value itself.
The proper thing to do is to eliminate any '"' characters that are
not escaped when we unescape the value. I have tested this new fix
with the oringinal issue from bug 438139 to ensure that it does not
introduce a regression for that bug.
|
commit 4c333c131975debacd65bdb5a96b7a56e9012048
Author: Nathan Kinder <[email protected]>
Date: Wed Nov 11 09:43:09 2009 -0800
Bug 504817 - Handle LDAPv2 quoted RDN values correctly
The bug fix for bug 438139 introduced a regression that causes the
server to not handle LDAPv2 quoted RDN values correctly. We were
including the '"' characters used to contain an unescaped value in
the actual value itself.
The proper thing to do is to eliminate any '"' characters that are
not escaped when we unescape the value. I have tested this new fix
with the oringinal issue from bug 438139 to ensure that it does not
introduce a regression for that bug.
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 2f55ee49d..c8d9a7445 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -211,42 +211,40 @@ strcpy_unescape_value( char *d, const char *s )
{
switch ( *s )
{
+ case '"':
+ break;
case '\\':
- if ( gotesc ) {
- gotesc = 0;
- } else {
- gotesc = 1;
- if ( s+2 < end ) {
- int n = hexchar2int( s[1] );
- /* If 8th bit is on, the char is not ASCII (not UTF-8).
- * Thus, not UTF-8 */
- if ( n >= 0 && n < 8 ) {
- int n2 = hexchar2int( s[2] );
- if ( n2 >= 0 ) {
- n = (n << 4) + n2;
- if (n == 0) { /* don't change \00 */
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s;
- } else { /* change \xx to a single char */
- *d++ = (char)n;
- s += 2;
- }
- gotesc = 0;
+ gotesc = 1;
+ if ( s+2 < end ) {
+ int n = hexchar2int( s[1] );
+ /* If 8th bit is on, the char is not ASCII (not UTF-8).
+ * Thus, not UTF-8 */
+ if ( n >= 0 && n < 8 ) {
+ int n2 = hexchar2int( s[2] );
+ if ( n2 >= 0 ) {
+ n = (n << 4) + n2;
+ if (n == 0) { /* don't change \00 */
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s;
+ } else { /* change \xx to a single char */
+ *d++ = (char)n;
+ s += 2;
}
+ gotesc = 0;
}
}
- if (gotesc) {
- *d++ = *s;
- }
}
- break;
- default:
+ /* This is an escaped single character (like \"), so
+ * just copy the special character and not the escape. */
if (gotesc) {
- d--;
+ s++;
+ *d++ = *s;
+ gotesc = 0;
}
+ break;
+ default:
*d++ = *s;
- gotesc = 0;
break;
}
}
| 0 |
3d47ae8ffd9bdc59735c98025f034de23221d661
|
389ds/389-ds-base
|
165228 - Don't have RPM auto-generate provides list
|
commit 3d47ae8ffd9bdc59735c98025f034de23221d661
Author: Nathan Kinder <[email protected]>
Date: Wed Sep 7 16:14:16 2005 +0000
165228 - Don't have RPM auto-generate provides list
diff --git a/ldapserver.spec.tmpl b/ldapserver.spec.tmpl
index a00ed16a5..5b469e90e 100644
--- a/ldapserver.spec.tmpl
+++ b/ldapserver.spec.tmpl
@@ -55,6 +55,8 @@ BuildPreReq: perl, fileutils, make
# Without Autoreq: 0, rpmbuild finds all sorts of crazy
# dependencies that we don't care about, and refuses to install
Autoreq: 0
+# Don't automatically generate provides list
+AutoProv: 0
# Without Requires: something, rpmbuild will abort!
Requires: perl
Prefix: /opt/%{name}
| 0 |
78fc627accacfa4061ce48977e22301f81ea8d73
|
389ds/389-ds-base
|
Ticket 49932 - Crash in delete_passwdPolicy when persistent search connections are terminated unexpectedly
Bug Description: We clone a pblock in a psearch search, and under certain
error conditions this pblock is freed, but it frees the
password policy struct which can lead to a double free
when the original pblock is destroyed.
Fix Description: During the cloning, set the pwppolicy struct to NULL
so the clone allocates its own policy if needed
https://pagure.io/389-ds-base/issue/49932
Reviewed by: ?
|
commit 78fc627accacfa4061ce48977e22301f81ea8d73
Author: Mark Reynolds <[email protected]>
Date: Thu Aug 30 14:28:10 2018 -0400
Ticket 49932 - Crash in delete_passwdPolicy when persistent search connections are terminated unexpectedly
Bug Description: We clone a pblock in a psearch search, and under certain
error conditions this pblock is freed, but it frees the
password policy struct which can lead to a double free
when the original pblock is destroyed.
Fix Description: During the cloning, set the pwppolicy struct to NULL
so the clone allocates its own policy if needed
https://pagure.io/389-ds-base/issue/49932
Reviewed by: ?
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 4514c3ce6..bc18a7b18 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -322,6 +322,8 @@ slapi_pblock_clone(Slapi_PBlock *pb)
if (pb->pb_intop != NULL) {
_pblock_assert_pb_intop(new_pb);
*(new_pb->pb_intop) = *(pb->pb_intop);
+ /* set pwdpolicy to NULL so this clone allocates its own policy */
+ new_pb->pb_intop->pwdpolicy = NULL;
}
if (pb->pb_intplugin != NULL) {
_pblock_assert_pb_intplugin(new_pb);
| 0 |
c89726733ac7ad3e5278a1d4303ae45745e13953
|
389ds/389-ds-base
|
fix member variable name error in slapi_uniqueIDFormat
|
commit c89726733ac7ad3e5278a1d4303ae45745e13953
Author: Rich Megginson <[email protected]>
Date: Tue Nov 15 20:10:00 2011 -0700
fix member variable name error in slapi_uniqueIDFormat
diff --git a/ldap/servers/slapd/uniqueid.c b/ldap/servers/slapd/uniqueid.c
index a65bbc675..7764465eb 100644
--- a/ldap/servers/slapd/uniqueid.c
+++ b/ldap/servers/slapd/uniqueid.c
@@ -181,8 +181,8 @@ int slapi_uniqueIDFormat (const Slapi_UniqueID *uId, char **buff){
*ptr++ = '-';
ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_mid)[0], ptr, 0);
ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_mid)[1], ptr, 0);
- ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_high_and_version)[0], ptr, 0);
- ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_high_and_version)[1], ptr, 0);
+ ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_hi_and_version)[0], ptr, 0);
+ ptr = slapi_u8_to_hex(((uint8_t *)&uuid_tmp.time_hi_and_version)[1], ptr, 0);
*ptr++ = '-';
ptr = slapi_u8_to_hex(uuid_tmp.clock_seq_hi_and_reserved, ptr, 0);
ptr = slapi_u8_to_hex(uuid_tmp.clock_seq_low, ptr, 0);
| 0 |
dd4b9de117646b6c74f15089973cb923186037e0
|
389ds/389-ds-base
|
Resolves: #244749
Summary: Configure Pass Thru Auth (comment #4)
Description: modifying check_and_add_entry to support ldifmodify format.
plus added minor fixes for comparing entries
|
commit dd4b9de117646b6c74f15089973cb923186037e0
Author: Noriko Hosoi <[email protected]>
Date: Wed Jun 20 23:52:46 2007 +0000
Resolves: #244749
Summary: Configure Pass Thru Auth (comment #4)
Description: modifying check_and_add_entry to support ldifmodify format.
plus added minor fixes for comparing entries
diff --git a/ldap/admin/src/scripts/Util.pm.in b/ldap/admin/src/scripts/Util.pm.in
index 7897c5ab8..2c3c283e6 100644
--- a/ldap/admin/src/scripts/Util.pm.in
+++ b/ldap/admin/src/scripts/Util.pm.in
@@ -96,40 +96,44 @@ sub debug {
# delete the subtree starting from the passed entry
sub delete_all
{
- my ($conn, $bentry) = @_;
- my $sentry = $conn->search($bentry->{dn},
- "subtree", "(objectclass=*)", 0, ("dn"));
- my @mystack = ();
- while ($sentry) {
- push @mystack, $sentry->getDN();
- $sentry = $conn->nextEntry();
- }
- # reverse order
- my $dn = pop @mystack;
- while ($dn) {
- $conn->delete($dn);
- my $rc = $conn->getErrorCode();
- if ( $rc != 0 ) {
- $conn->printError();
- print "ERROR: unable to delete entry $dn, error code: $rc\n";
- return 1;
- }
- $dn = pop @mystack;
- }
- return 0;
+ my ($conn, $bentry) = @_;
+ my $sentry = $conn->search($bentry->{dn},
+ "subtree", "(objectclass=*)", 0, ("dn"));
+ my @mystack = ();
+ while ($sentry) {
+ push @mystack, $sentry->getDN();
+ $sentry = $conn->nextEntry();
+ }
+ # reverse order
+ my $dn = pop @mystack;
+ while ($dn) {
+ $conn->delete($dn);
+ my $rc = $conn->getErrorCode();
+ if ( $rc != 0 ) {
+ $conn->printError();
+ print "ERROR: unable to delete entry $dn, error code: $rc\n";
+ return 1;
+ }
+ $dn = pop @mystack;
+ }
+ return 0;
}
my %ignorelist = (
- "modifytimestamp", "modifyTimestamp",
- "createtimestamp", "createTimestamp",
- "installationtimestamp", "installationTimestamp",
- "creatorsname", "creatorsName",
- "modifiersname", "modifiersName",
- "numsubordinates", "numSubordinates"
+ "nsslapd-directory", "nsslapd-directory",
+ "nsslapd-require-index", "nsslapd-require-index",
+ "nsslapd-readonly", "nsslapd-readonly",
+ "modifytimestamp", "modifyTimestamp",
+ "createtimestamp", "createTimestamp",
+ "installationtimestamp", "installationTimestamp",
+ "creatorsname", "creatorsName",
+ "modifiersname", "modifiersName",
+ "numsubordinates", "numSubordinates"
);
my %speciallist = (
- "uniquemember", 1
+ "uniquemember", 1,
+ "aci", 1
);
# compare 2 entries
@@ -138,60 +142,60 @@ my %speciallist = (
# return -1 if they do not match.
sub comp_entries
{
- my ($e0, $e1) = @_;
- my $rc = 0;
- foreach my $akey ( keys %{$e0} )
- {
- next if ( $ignorelist{lc($akey)} );
- my $aval0 = $e0->{$akey};
- my $aval1 = $e1->{$akey};
- my $a0max = $#{$aval0};
- my $a1max = $#{$aval1};
- my $amin = $#{$aval0};
- if ( $a0max != $a1max )
- {
- if ( $speciallist{lc($akey)} )
- {
- $rc = 1;
- if ( $a0max < $a1max )
- {
- $amin = $a0max;
- }
- else
- {
- $amin = $a1max;
- }
- }
- else
- {
- $rc = -1;
- return $rc;
- }
+ my ($e0, $e1) = @_;
+ my $rc = 0;
+ foreach my $akey ( keys %{$e0} )
+ {
+ next if ( $ignorelist{lc($akey)} );
+ my $aval0 = $e0->{$akey};
+ my $aval1 = $e1->{$akey};
+ my $a0max = $#{$aval0};
+ my $a1max = $#{$aval1};
+ my $amin = $#{$aval0};
+ if ( $a0max != $a1max )
+ {
+ if ( $speciallist{lc($akey)} )
+ {
+ $rc = 1;
+ if ( $a0max < $a1max )
+ {
+ $amin = $a0max;
+ }
+ else
+ {
+ $amin = $a1max;
+ }
+ }
+ else
+ {
+ $rc = -1;
+ return $rc;
+ }
+ }
+ my @sval0 = sort { $a cmp $b } @{$aval0};
+ my @sval1 = sort { $a cmp $b } @{$aval1};
+ for ( my $i = 0; $i <= $amin; $i++ )
+ {
+ my $isspecial = -1;
+ if ( $sval0[$i] ne $sval1[$i] )
+ {
+ if ( 0 > $isspecial )
+ {
+ $isspecial = $speciallist{lc($akey)};
+ }
+ if ( $isspecial )
+ {
+ $rc = 1;
+ }
+ else
+ {
+ $rc = -1;
+ return $rc;
+ }
+ }
}
- my @sval0 = sort { $a cmp $b } @{$aval0};
- my @sval1 = sort { $a cmp $b } @{$aval1};
- for ( my $i = 0; $i <= $amin; $i++ )
- {
- my $isspecial = -1;
- if ( $sval0[$i] ne $sval1[$i] )
- {
- if ( 0 > $isspecial )
- {
- $isspecial = $speciallist{lc($akey)};
- }
- if ( $isspecial )
- {
- $rc = 1;
- }
- else
- {
- $rc = -1;
- return $rc;
- }
- }
- }
- }
- return $rc;
+ }
+ return $rc;
}
# if the entry does not exist on the server, add the entry.
@@ -207,92 +211,170 @@ sub comp_entries
# $verbose prints out more info
sub check_and_add_entry
{
- my ($context, $aentry) = @_;
- my $conn = $context->[0];
- my $fresh = $context->[1];
- my $verbose = $context->[2];
- my $sentry = $conn->search($aentry->{dn}, "base", "(objectclass=*)");
- do
- {
- my $needtoadd = 1;
- my $needtomod = 0;
- my $rval = -1;
- if ( $sentry && !$fresh )
- {
- $rval = comp_entries( $sentry, $aentry );
- }
- if ( 0 == $rval && !$fresh )
- {
- # the identical entry exists on the configuration DS.
- # no need to add the entry.
- $needtoadd = 0;
- goto out;
- }
- elsif ( (1 == $rval) && !$fresh )
- {
- $needtoadd = 0;
- $needtomod = 1;
- }
- elsif ( $sentry && $sentry->{dn} )
- {
- # $fresh || $rval == -1
- # an entry having the same DN exists, but the attributes do not
- # match. remove the entry and the subtree underneath.
- if ( $verbose )
- {
- print "Deleting an entry dn: $sentry->{dn} ...\n";
- }
- $rval = delete_all($conn, $sentry);
- if ( 0 != $rval )
- {
- return 0;
- }
- }
-
- if ( 1 == $needtoadd )
- {
- $conn->add($aentry);
- my $rc = $conn->getErrorCode();
- if ( $rc != 0 )
- {
- print "ERROR: adding an entry $aentry->{dn} failed, error code: $rc\n";
- print "[entry]\n";
- $aentry->printLDIF();
- $conn->close();
- return 0;
- }
-# if ( $verbose )
-# {
-# print "Entry $aentry->{dn} is added\n";
-# }
- }
- elsif ( 1 == $needtomod ) # $sentry exists
- {
- foreach my $attr ( keys %speciallist )
- {
- foreach my $nval ( @{$aentry->{$attr}} )
- {
- $sentry->addValue( $attr, $nval );
- }
- }
- $conn->update($sentry);
- my $rc = $conn->getErrorCode();
- if ( $rc != 0 )
- {
- print "ERROR: updating an entry $sentry->{dn} failed, error code: $rc\n";
- print "[entry]\n";
- $aentry->printLDIF();
- $conn->close();
- return 0;
- }
- }
- if ( $sentry )
- {
- $sentry = $conn->nextEntry(); # supposed to have no more entries
- }
- } until ( !$sentry );
+ my ($context, $aentry) = @_;
+ my $conn = $context->[0];
+ my $fresh = $context->[1];
+ my $verbose = $context->[2];
+ my @ctypes = $aentry->getValues("changetype");
+ my $sentry = $conn->search($aentry->{dn}, "base", "(objectclass=*)");
+ do
+ {
+ my $needtoadd;
+ my $MOD_NONE = 0;
+ my $MOD_ADD = 1;
+ my $MOD_REPLACE = 2;
+ my $MOD_SPECIAL = 3;
+ # $needtomod stores either of the above $MOD_ values
+ # note: delete is not supported
+ my $needtomod;
+ if ( 0 > $#ctypes ) # aentry: complete entry
+ {
+ $needtoadd = 1;
+ $needtomod = 0; #$MOD_NONE
+
+ my $rc = -1;
+ if ( $sentry && !$fresh )
+ {
+ $rc = comp_entries( $sentry, $aentry );
+ }
+ if ( 0 == $rc && !$fresh )
+ {
+ # the identical entry exists on the configuration DS.
+ # no need to add the entry.
+ $needtoadd = 0;
+ goto out;
+ }
+ elsif ( (1 == $rc) && !$fresh )
+ {
+ $needtoadd = 0;
+ $needtomod = $MOD_ADD;
+ }
+ elsif ( $sentry && $sentry->{dn} )
+ {
+ # $fresh || $rc == -1
+ # an entry having the same DN exists, but the attributes do not
+ # match. remove the entry and the subtree underneath.
+ if ( $verbose )
+ {
+ print "Deleting an entry dn: $sentry->{dn} ...\n";
+ }
+ $rc = delete_all($conn, $sentry);
+ if ( 0 != $rc )
+ {
+ return 0;
+ }
+ }
+ }
+ else # aentry: modify format
+ {
+ $needtoadd = 0;
+ if ( $sentry )
+ {
+ my @atypes = $aentry->getValues("add");
+ if ( 0 <= $#atypes )
+ {
+ $needtomod = $MOD_ADD;
+ }
+ else
+ {
+ @atypes = $aentry->getValues("replace");
+ if ( 0 <= $#atypes )
+ {
+ $needtomod = $MOD_REPLACE;
+ }
+ else
+ {
+ @atypes = $aentry->getValues("delete");
+ if ( 0 <= $#atypes )
+ {
+ print "\"delete\" is not supported; ignoring...\n";
+ }
+ $needtomod = $MOD_NONE;
+ }
+ }
+ }
+ else
+ {
+ $needtomod = $MOD_NONE;
+ }
+ }
+
+ if ( 1 == $needtoadd )
+ {
+ $conn->add($aentry);
+ my $rc = $conn->getErrorCode();
+ if ( $rc != 0 )
+ {
+ print "ERROR: adding an entry $aentry->{dn} failed, error code: $rc\n";
+ print "[entry]\n";
+ $aentry->printLDIF();
+ $conn->close();
+ return 0;
+ }
+ debug("Entry $aentry->{dn} is added\n");
+ }
+ elsif ( 0 < $needtomod ) # $sentry exists
+ {
+ if ( $needtomod == $MOD_SPECIAL )
+ {
+ foreach my $attr ( keys %speciallist )
+ {
+ foreach my $nval ( @{$aentry->{$attr}} )
+ {
+ $sentry->addValue( $attr, $nval );
+ }
+ }
+ $conn->update($sentry);
+ }
+ elsif ( $needtomod == $MOD_ADD )
+ {
+ foreach my $attr ( keys %{$aentry} )
+ {
+ next if $attr =~ /add|changetype/;
+ foreach my $nval ( @{$aentry->{$attr}} )
+ {
+ $sentry->addValue( $attr, $nval );
+ }
+ }
+ $conn->update($sentry);
+ }
+ elsif ( $needtomod == $MOD_REPLACE )
+ {
+ my $entry = new Mozilla::LDAP::Entry();
+ $entry->setDN($aentry->getDN());
+ foreach my $attr ( keys %{$aentry} )
+ {
+ next if $attr =~ /replace|changetype/;
+ foreach my $nval ( @{$aentry->{$attr}} )
+ {
+ $entry->addValue( $attr, $nval );
+ }
+ }
+ $conn->update($entry);
+ }
+ else
+ {
+ print "ERROR: needtomod == $needtomod is not supported.\n";
+ $conn->close();
+ return 0;
+ }
+ my $rc = $conn->getErrorCode();
+ if ( $rc != 0 )
+ {
+ print "ERROR: updating an entry $sentry->{dn} failed, error code: $rc\n";
+ print "[entry]\n";
+ $aentry->printLDIF();
+ $conn->close();
+ return 0;
+ }
+ }
+ if ( $sentry )
+ {
+ $sentry = $conn->nextEntry(); # supposed to have no more entries
+ }
+ } until ( !$sentry );
out:
- return 1;
+ return 1;
}
# the default callback used with getMappedEntries
@@ -370,8 +452,8 @@ sub getMappedEntries {
$ldiffiles = [ $ldiffiles ];
}
- foreach my $ldiffile (@{$ldiffiles}) {
- open(MYLDIF, "< $ldiffile") or die "Can't open $ldiffile : $!";
+ foreach my $ldiffile (@{$ldiffiles}) {
+ open(MYLDIF, "< $ldiffile") or die "Can't open $ldiffile : $!";
my $in = new Mozilla::LDAP::LDIF(*MYLDIF);
debug("Processing $ldiffile ...");
ENTRY: while (my $entry = Mozilla::LDAP::LDIF::readOneEntry($in)) {
@@ -420,11 +502,11 @@ sub getMappedEntries {
}
}
- close(MYLDIF);
+ close(MYLDIF);
last if ($error); # do not process any more ldiffiles if an error occurred
- }
+ }
- return @entries;
+ return @entries;
}
# you should only use this function if you know for sure
@@ -544,8 +626,8 @@ sub addSuffix {
# process map table
# [map table sample]
-# fqdn = FullMachineName
-# hostname = `use Sys::Hostname; $returnvalue = hostname();`
+# fqdn = FullMachineName
+# hostname = `use Sys::Hostname; $returnvalue = hostname();`
# ds_console_jar ="%normbrand%-ds-%ds_version%.jar"
#
# * If the right-hand value is in ` (backquote), the value is eval'ed by perl.
@@ -560,7 +642,7 @@ sub addSuffix {
# The %token% tokens are replaced in getMappedEntries
sub process_maptbl
{
- my ($mapper, @infdata) = @_;
+ my ($mapper, @infdata) = @_;
if (defined($mapper->{""})) {
$mapper = $mapper->{""}; # side effect of Inf with no sections
@@ -605,7 +687,7 @@ sub process_maptbl
}
}
}
- return $mapper;
+ return $mapper;
}
sub getHashedPassword {
| 0 |
334ba3fb918ad645d0b4ebb6dc3ec16eed89e522
|
389ds/389-ds-base
|
Issue 50716 - CVE-2019-14824 (BZ#1748199) - deref plugin displays restricted attributes
Description:
Add test case
Author: Mark Reynolds
Relates: https://pagure.io/389-ds-base/issue/50716
|
commit 334ba3fb918ad645d0b4ebb6dc3ec16eed89e522
Author: Viktor Ashirov <[email protected]>
Date: Thu Nov 14 12:39:20 2019 +0100
Issue 50716 - CVE-2019-14824 (BZ#1748199) - deref plugin displays restricted attributes
Description:
Add test case
Author: Mark Reynolds
Relates: https://pagure.io/389-ds-base/issue/50716
diff --git a/dirsrvtests/tests/suites/plugins/deref_aci_test.py b/dirsrvtests/tests/suites/plugins/deref_aci_test.py
new file mode 100644
index 000000000..ee64ff19f
--- /dev/null
+++ b/dirsrvtests/tests/suites/plugins/deref_aci_test.py
@@ -0,0 +1,141 @@
+import os
+import logging
+import pytest
+import ldap
+from lib389._constants import DEFAULT_SUFFIX, PASSWORD
+from lib389.idm.organizationalunit import OrganizationalUnits
+from lib389.idm.user import UserAccounts, TEST_USER_PROPERTIES
+from lib389.idm.group import Groups
+from lib389.topologies import topology_st as topo
+
+pytestmark = pytest.mark.tier1
+
+DEBUGGING = os.getenv("DEBUGGING", default=None)
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+log = logging.getLogger(__name__)
+
+ACCTS_DN = "ou=accounts,dc=example,dc=com"
+USERS_DN = "ou=users,ou=accounts,dc=example,dc=com"
+GROUPS_DN = "ou=groups,ou=accounts,dc=example,dc=com"
+ADMIN_GROUP_DN = "cn=admins,ou=groups,ou=accounts,dc=example,dc=com"
+ADMIN_DN = "uid=admin,ou=users,ou=accounts,dc=example,dc=com"
+
+ACCTS_ACI = ('(targetattr="userPassword")(version 3.0; acl "allow password ' +
+ 'search"; allow(search) userdn = "ldap:///all";)')
+USERS_ACI = ('(targetattr = "cn || createtimestamp || description || displayname || entryusn || gecos ' +
+ '|| gidnumber || givenname || homedirectory || initials || ' +
+ 'loginshell || manager || modifytimestamp || objectclass || sn || title || uid || uidnumber")' +
+ '(targetfilter = "(objectclass=posixaccount)")' +
+ '(version 3.0;acl "Read Attributes";allow (compare,read,search) userdn = "ldap:///anyone";)')
+GROUPS_ACIS = [
+ (
+ '(targetattr = "businesscategory || cn || createtimestamp || description |' +
+ '| entryusn || gidnumber || mepmanagedby || modifytimestamp || o || objectclass || ou || own' +
+ 'er || seealso")(targetfilter = "(objectclass=posixgroup)")(version 3.0;acl' +
+ '"permission:System: Read Groups";allow (compare,re' +
+ 'ad,search) userdn = "ldap:///anyone";)'
+ ),
+ (
+ '(targetattr = "member || memberof || memberuid")(targetfilter = '+
+ '"(objectclass=posixgroup)")(version 3.0;acl' +
+ '"permission:System: Read Group Membership";allow (compare,read' +
+ ',search) userdn = "ldap:///all";)'
+ )
+]
+
+
+def test_deref_and_access_control(topo):
+ """Test that the deref plugin honors access control rules correctly
+
+ The setup mimics a generic IPA DIT with its ACI's. The userpassword
+ attribute should not be returned
+
+ :id: bedb6af2-b765-479d-808c-df0348e0ec95
+ :setup: Standalone Instance
+ :steps:
+ 1. Create container entries with aci's
+ 2. Perform deref search and make sure userpassword is not returned
+ :expectedresults:
+ 1. Success
+ 2. Success
+ """
+
+ topo.standalone.config.set('nsslapd-schemacheck', 'off')
+ if DEBUGGING:
+ topo.standalone.config.enable_log('audit')
+ topo.standalone.config.set('nsslapd-errorlog-level', '128')
+
+ # Accounts
+ ou1 = OrganizationalUnits(topo.standalone, DEFAULT_SUFFIX)
+ ou1.create(properties={
+ 'ou': 'accounts',
+ 'aci': ACCTS_ACI
+ })
+
+ # Users
+ ou2 = OrganizationalUnits(topo.standalone, ACCTS_DN)
+ ou2.create(properties={
+ 'ou': 'users',
+ 'aci': USERS_ACI
+ })
+
+ # Groups
+ ou3 = OrganizationalUnits(topo.standalone, ACCTS_DN)
+ ou3.create(properties={
+ 'ou': 'groups',
+ 'aci': GROUPS_ACIS
+ })
+
+ # Create User
+ users = UserAccounts(topo.standalone, USERS_DN, rdn=None)
+ user_props = TEST_USER_PROPERTIES.copy()
+ user_props.update(
+ {
+ 'uid': 'user',
+ 'objectclass': ['posixAccount', 'extensibleObject'],
+ 'userpassword': PASSWORD
+ }
+ )
+ user = users.create(properties=user_props)
+
+ # Create Admin user
+ user_props = TEST_USER_PROPERTIES.copy()
+ user_props.update(
+ {
+ 'uid': 'admin',
+ 'objectclass': ['posixAccount', 'extensibleObject', 'inetuser'],
+ 'userpassword': PASSWORD,
+ 'memberOf': ADMIN_GROUP_DN
+ }
+ )
+ users.create(properties=user_props)
+
+ # Create Admin group
+ groups = Groups(topo.standalone, GROUPS_DN, rdn=None)
+ group_props = {
+ 'cn': 'admins',
+ 'gidNumber': '123',
+ 'objectclass': ['posixGroup', 'extensibleObject'],
+ 'member': ADMIN_DN
+ }
+ groups.create(properties=group_props)
+
+ # Bind as user, then perform deref search on admin user
+ user.rebind(PASSWORD)
+ result, control_response = topo.standalone.dereference(
+ 'member:cn,userpassword',
+ base=ADMIN_GROUP_DN,
+ scope=ldap.SCOPE_BASE)
+
+ log.info('Check, that the dereference search result does not have userpassword')
+ assert result[0][2][0].entry[0]['attrVals'][0]['type'] != 'userpassword'
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main(["-s", CURRENT_FILE])
diff --git a/src/lib389/lib389/_controls.py b/src/lib389/lib389/_controls.py
index 7cbe78c7d..2f8d9acaa 100644
--- a/src/lib389/lib389/_controls.py
+++ b/src/lib389/lib389/_controls.py
@@ -101,7 +101,7 @@ class DereferenceControl(LDAPControl):
def encodeControlValue(self):
cv = DerefControlValue()
cvi = 0
- for derefSpec in self.deref.split(';'):
+ for derefSpec in self.deref.decode('utf-8').split(';'):
derefAttr, attributes = derefSpec.split(':')
attributes = attributes.split(',')
al = AttributeList()
| 0 |
fce54405cd02c98d108604e0180b8643bb994a25
|
389ds/389-ds-base
|
Resolves: bug 230808
Bug Description: Split core schema
Reviewed by: prowley (Thanks!)
Files: see diff
Branch: HEAD
Fix Description: Moved all schema not required to start the server from
00core.ldif into a new file called 01common.ldif. Andrew and Satish
already did the work to determine which schema are required to start the
server, which is the schema needed to be in 00core.ldif.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
|
commit fce54405cd02c98d108604e0180b8643bb994a25
Author: Rich Megginson <[email protected]>
Date: Sat Mar 3 00:32:16 2007 +0000
Resolves: bug 230808
Bug Description: Split core schema
Reviewed by: prowley (Thanks!)
Files: see diff
Branch: HEAD
Fix Description: Moved all schema not required to start the server from
00core.ldif into a new file called 01common.ldif. Andrew and Satish
already did the work to determine which schema are required to start the
server, which is the schema needed to be in 00core.ldif.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
diff --git a/Makefile.am b/Makefile.am
index 88017cc6d..654de4f1d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -128,6 +128,7 @@ sampledata_DATA = $(srcdir)/ldap/ldif/Ace.ldif \
$(srcdir)/ldap/servers/slapd/tools/rsearch/scripts/dbgen-OrgUnits
schema_DATA = $(srcdir)/ldap/schema/00core.ldif \
+ $(srcdir)/ldap/schema/01common.ldif \
$(srcdir)/ldap/schema/05rfc2247.ldif \
$(srcdir)/ldap/schema/05rfc2927.ldif \
$(srcdir)/ldap/schema/10presence.ldif \
diff --git a/Makefile.in b/Makefile.in
index cae05b96e..4d9a57b14 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -857,6 +857,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@
@@ -1043,6 +1044,7 @@ sampledata_DATA = $(srcdir)/ldap/ldif/Ace.ldif \
$(srcdir)/ldap/servers/slapd/tools/rsearch/scripts/dbgen-OrgUnits
schema_DATA = $(srcdir)/ldap/schema/00core.ldif \
+ $(srcdir)/ldap/schema/01common.ldif \
$(srcdir)/ldap/schema/05rfc2247.ldif \
$(srcdir)/ldap/schema/05rfc2927.ldif \
$(srcdir)/ldap/schema/10presence.ldif \
diff --git a/aclocal.m4 b/aclocal.m4
index ea0061527..c7c1c6fbc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1597,7 +1597,7 @@ linux*)
# 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' ' '`
+ 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
@@ -4305,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
@@ -4438,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.
@@ -4454,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
@@ -4534,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
@@ -6370,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
@@ -6402,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 c160ade93..f21980e9a 100755
--- a/configure
+++ b/configure
@@ -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 configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE 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_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 configdir sampledatadir propertydir schemadir serverdir serverplugindir scripttemplatedir instconfigdir WINNT_TRUE WINNT_FALSE LIBSOCKET LIBNSL LIBDL LIBCSTD LIBCRUN initdir HPUX_TRUE HPUX_FALSE 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.
@@ -3832,6 +3832,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
@@ -3866,6 +3867,7 @@ done
fi
SED=$lt_cv_path_SED
+
echo "$as_me:$LINENO: result: $SED" >&5
echo "${ECHO_T}$SED" >&6
@@ -4306,7 +4308,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4309 "configure"' > conftest.$ac_ext
+ echo '#line 4311 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -5441,7 +5443,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:5444:" \
+echo "$as_me:5446:" \
"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
@@ -6504,11 +6506,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:6507: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6509: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6511: \$? = $ac_status" >&5
+ echo "$as_me:6513: \$? = $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.
@@ -6772,11 +6774,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:6775: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6777: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6779: \$? = $ac_status" >&5
+ echo "$as_me:6781: \$? = $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.
@@ -6876,11 +6878,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:6879: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6881: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6883: \$? = $ac_status" >&5
+ echo "$as_me:6885: \$? = $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
@@ -8345,7 +8347,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 8348 "configure"' > conftest.$ac_ext
+ echo '#line 8350 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8364,7 +8366,7 @@ linux*)
# 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' ' '`
+ 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
@@ -9242,7 +9244,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9245 "configure"
+#line 9247 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9342,7 +9344,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9345 "configure"
+#line 9347 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -9673,6 +9675,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
@@ -9806,11 +9811,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.
@@ -9822,7 +9827,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
@@ -9902,7 +9907,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
@@ -11682,11 +11687,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:11685: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11690: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:11689: \$? = $ac_status" >&5
+ echo "$as_me:11694: \$? = $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.
@@ -11786,11 +11791,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:11789: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:11794: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:11793: \$? = $ac_status" >&5
+ echo "$as_me:11798: \$? = $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
@@ -12322,7 +12327,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 12325 "configure"' > conftest.$ac_ext
+ echo '#line 12330 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -12341,7 +12346,7 @@ linux*)
# 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' ' '`
+ 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
@@ -12726,6 +12731,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
@@ -12859,11 +12867,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.
@@ -12875,7 +12883,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
@@ -12955,7 +12963,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
@@ -13377,11 +13385,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:13380: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13388: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13384: \$? = $ac_status" >&5
+ echo "$as_me:13392: \$? = $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.
@@ -13481,11 +13489,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:13484: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13492: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13488: \$? = $ac_status" >&5
+ echo "$as_me:13496: \$? = $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
@@ -14930,7 +14938,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 14933 "configure"' > conftest.$ac_ext
+ echo '#line 14941 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14949,7 +14957,7 @@ linux*)
# 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' ' '`
+ 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
@@ -15334,6 +15342,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
@@ -15467,11 +15478,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.
@@ -15483,7 +15494,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
@@ -15563,7 +15574,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
@@ -15705,11 +15716,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:15708: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15719: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15712: \$? = $ac_status" >&5
+ echo "$as_me:15723: \$? = $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.
@@ -15973,11 +15984,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:15976: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:15987: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:15980: \$? = $ac_status" >&5
+ echo "$as_me:15991: \$? = $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.
@@ -16077,11 +16088,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:16080: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16091: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16084: \$? = $ac_status" >&5
+ echo "$as_me:16095: \$? = $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
@@ -17546,7 +17557,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 17549 "configure"' > conftest.$ac_ext
+ echo '#line 17560 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -17565,7 +17576,7 @@ linux*)
# 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' ' '`
+ 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
@@ -17950,6 +17961,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
@@ -18083,11 +18097,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.
@@ -18099,7 +18113,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
@@ -18179,7 +18193,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
@@ -18431,6 +18445,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
@@ -18564,11 +18581,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.
@@ -18580,7 +18597,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
@@ -18660,7 +18677,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
@@ -25826,6 +25843,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/ldap/schema/00core.ldif b/ldap/schema/00core.ldif
index be0399a66..47625eeb8 100644
--- a/ldap/schema/00core.ldif
+++ b/ldap/schema/00core.ldif
@@ -40,7 +40,8 @@
#
# Recommended core schema from the X.500 and LDAP standards (RFCs), and
# schema used by the Directory Server itself.
-#
+# This is the schema that is required to bootstrap the server, to start it
+# and enable it to read in the other config and schema.
dn: cn=schema
objectclass: top
objectclass: ldapSubentry
@@ -55,90 +56,16 @@ aci: (target="ldap:///cn=schema")(targetattr !="aci")(version 3.0;acl "anonymous
# attribute types:
#
attributeTypes: ( 2.5.4.0 NAME 'objectClass' DESC 'Standard LDAP attribute type' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.1 NAME 'aliasedObjectName' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.2 NAME 'knowledgeInformation' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
attributeTypes: ( 2.5.4.41 NAME 'name' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} X-ORIGIN 'RFC 2256')
attributeTypes: ( 2.5.4.49 NAME ( 'dn' 'distinguishedName' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 2256' )
attributeTypes: ( 2.5.4.3 NAME ( 'cn' 'commonName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.4 NAME ( 'sn' 'surName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.5 NAME 'serialNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.6 NAME ( 'c' 'countryName' ) DESC 'Standard LDAP attribute type' SUP name SINGLE-VALUE X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.7 NAME ( 'l' 'locality' 'localityname' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.8 NAME ( 'st' 'stateOrProvinceName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.9 NAME ( 'street' 'streetaddress' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.10 NAME ( 'o' 'organizationname' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.12 NAME 'title' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
attributeTypes: ( 2.5.4.13 NAME 'description' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.14 NAME 'searchGuide' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.15 NAME 'businessCategory' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.16 NAME 'postalAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.17 NAME 'postalCode' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.18 NAME 'postOfficeBox' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.19 NAME 'physicalDeliveryOfficeName' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.20 NAME 'telephoneNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.21 NAME 'telexNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.22 NAME 'teletexTerminalIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.23 NAME ( 'facsimileTelephoneNumber' 'fax' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.24 NAME 'x121Address' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.25 NAME 'internationaliSDNNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.26 NAME 'registeredAddress' DESC 'Standard LDAP attribute type' SUP postalAddress X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.27 NAME 'destinationIndicator' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.28 NAME 'preferredDeliveryMethod' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.29 NAME 'presentationAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.30 NAME 'supportedApplicationContext' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.31 NAME 'member' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.32 NAME 'owner' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.33 NAME 'roleOccupant' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
attributeTypes: ( 2.5.4.34 NAME 'seeAlso' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
attributeTypes: ( 2.5.4.35 NAME 'userPassword' DESC 'Standard LDAP attribute type' EQUALITY octetStringMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.36 NAME 'userCertificate' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.37 NAME 'cACertificate' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.38 NAME 'authorityRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.39 NAME 'certificateRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.40 NAME 'crossCertificatePair' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.42 NAME 'givenName' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.43 NAME 'initials' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.44 NAME 'generationQualifier' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.45 NAME 'x500UniqueIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.46 NAME 'dnQualifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.47 NAME 'enhancedSearchGuide' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.48 NAME 'protocolInformation' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.50 NAME 'uniqueMember' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.51 NAME 'houseIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.52 NAME 'supportedAlgorithms' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.53 NAME 'deltaRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 2.5.4.54 NAME 'dmdName' SUP name X-ORIGIN 'RFC 2256' )
-attributeTypes: ( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.3 NAME ( 'mail' 'rfc822mailbox' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.6 NAME 'roomNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.10 NAME 'manager' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.20 NAME 'homePhone' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.21 NAME 'secretary' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.39 NAME 'homePostalAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.41 NAME ( 'mobile' 'mobileTelephoneNumber' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.42 NAME ( 'pager' 'pagerTelephoneNumber' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.43 NAME ( 'co' 'friendlycountryname' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.55 NAME 'audio' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 0.9.2342.19200300.100.1.60 NAME 'jpegPhoto' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.28 X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 1.3.6.1.4.1.250.1.57 NAME ( 'labeledUri' 'labeledurl' ) DESC 'Uniform Resource Identifier with optional label' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2079' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1 NAME 'carLicense' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2 NAME 'departmentNumber' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.3 NAME 'employeeNumber' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.4 NAME 'employeeType' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.5 NAME 'changeNumber' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.6 NAME 'targetDn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.7 NAME 'changeType' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.8 NAME 'changes' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.9 NAME 'newRdn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.10 NAME 'deleteOldRdn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.11 NAME 'newSuperior' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.34 NAME 'ref' DESC 'LDAP referrals attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'LDAPv3 referrals Internet Draft' )
attributeTypes: ( 2.5.18.1 NAME 'createTimestamp' DESC 'Standard LDAP attribute type' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.18.2 NAME 'modifyTimestamp' DESC 'Standard LDAP attribute type' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.18.3 NAME 'creatorsName' DESC 'Standard LDAP attribute type' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.18.4 NAME 'modifiersName' DESC 'Standard LDAP attribute type' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 2.5.18.10 NAME 'subschemaSubentry' DESC 'Standard LDAP attribute type' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.21.5 NAME 'attributeTypes' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.21.6 NAME 'objectClasses' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.21.4 NAME 'matchingRules' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
@@ -146,74 +73,8 @@ attributeTypes: ( 2.5.21.8 NAME 'matchingRuleUse' DESC 'Standard LDAP attribute
attributeTypes: ( 2.5.21.1 NAME 'dITStructureRules' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.21.2 NAME 'dITContentRules' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
attributeTypes: ( 2.5.21.7 NAME 'nameForms' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.5 NAME 'namingContexts' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.7 NAME 'supportedExtension' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.13 NAME 'supportedControl' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.14 NAME 'supportedSASLMechanisms' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.15 NAME 'supportedLDAPVersion' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'RFC 2252' )
-attributeTypes: ( 1.3.6.1.4.1.4203.1.3.5 NAME 'supportedFeatures' DESC 'features supported by the server' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )
-attributeTypes: ( 2.16.840.1.113730.3.1.36 NAME 'nsLicensedFor' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.37 NAME 'nsLicenseStartTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.38 NAME 'nsLicenseEndTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.39 NAME 'preferredLanguage' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.40 NAME 'userSMIMECertificate' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2798' )
attributeTypes: ( 2.16.840.1.113730.3.1.55 NAME 'aci' DESC 'Netscape defined access control information attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.70 NAME 'serverRoot' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.71 NAME 'serverProductName' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.72 NAME 'serverVersionNumber' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.73 NAME 'installationTimeStamp' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.74 NAME 'administratorContactInfo' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.75 NAME 'adminUrl' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.76 NAME 'serverHostName' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
-attributeTypes: ( 2.16.840.1.113730.3.1.77 NAME 'changeTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.91 NAME 'passwordExpirationTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.92 NAME ( 'passwordExpWarned' 'pwdExpirationWarned' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.93 NAME 'passwordRetryCount' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.94 NAME 'retryCountResetTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.95 NAME 'accountUnlockTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.96 NAME ( 'passwordHistory' 'pwdHistory' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.97 NAME ( 'passwordMaxAge' 'pwdMaxAge' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.98 NAME 'passwordExp' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.99 NAME ( 'passwordMinLength' 'pwdMinLength' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.100 NAME 'passwordKeepHistory' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.101 NAME ( 'passwordInHistory' 'pwdInHistory' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.102 NAME ( 'passwordChange' 'pwdAllowUserChange' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.103 NAME ( 'passwordCheckSyntax' 'pwdCheckSyntax' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.104 NAME ( 'passwordWarning' 'pwdExpireWarning' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.105 NAME ( 'passwordLockout' 'pwdLockOut' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.106 NAME ( 'passwordMaxFailure' 'pwdMaxFailure' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.107 NAME 'passwordResetDuration' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.108 NAME 'passwordUnlock' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.109 NAME ( 'passwordLockoutDuration' 'pwdLockoutDuration' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.997 NAME 'pwdpolicysubentry' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.998 NAME ( 'passwordGraceUserTime' 'pwdGraceUserTime' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.999 NAME ( 'passwordGraceLimit' 'pwdGraceLoginLimit' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2075 NAME ( 'passwordMinDigits' 'pwdMinDigits' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2076 NAME ( 'passwordMinAlphas' 'pwdMinAlphas' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2077 NAME ( 'passwordMinUppers' 'pwdMinUppers' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2078 NAME ( 'passwordMinLowers' 'pwdMinLowers' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2079 NAME ( 'passwordMinSpecials' 'pwdMinSpecials' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2080 NAME ( 'passwordMin8bit' 'pwdMin8bit' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2081 NAME ( 'passwordMaxRepeats' 'pwdMaxRepeats' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2082 NAME ( 'passwordMinCategories' 'pwdMinCategories' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2083 NAME ( 'passwordMinTokenLength' 'pwdMinTokenLength' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.198 NAME 'memberURL' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.199 NAME 'memberCertificateDescription' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.207 NAME 'vlvBase' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.208 NAME 'vlvScope' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.209 NAME 'vlvFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.210 NAME 'vlvSort' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.213 NAME 'vlvEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.214 NAME 'passwordAllowChangeTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.215 NAME 'oid' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.216 NAME 'userPKCS12' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2798' )
-attributeTypes: ( 2.16.840.1.113730.3.1.219 NAME 'vlvUses' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.220 NAME ( 'passwordMustChange' 'pwdMustChange' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.221 NAME 'passwordStorageScheme' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.222 NAME ( 'passwordMinAge' 'pwdMinAge' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.223 NAME ( 'passwordResetFailureCount' 'pwdFailureCountInterval' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.224 NAME 'nsslapd-pluginPath' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.225 NAME 'nsslapd-pluginInitfunc' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.226 NAME 'nsslapd-pluginType' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
@@ -230,7 +91,6 @@ attributeTypes: ( 2.16.840.1.113730.3.1.236 NAME 'nsSNMPDescription' DESC 'Netsc
attributeTypes: ( 2.16.840.1.113730.3.1.237 NAME 'nsSNMPMasterHost' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.238 NAME 'nsSNMPMasterPort' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.593 NAME 'nsSNMPName' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.241 NAME 'displayName' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
attributeTypes: ( 2.16.840.1.113730.3.1.242 NAME 'nsSystemIndex' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.327 NAME 'nsIndexType' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.328 NAME 'nsMatchingRule' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
@@ -238,29 +98,7 @@ attributeTypes: ( 2.16.840.1.113730.3.1.542 NAME 'nsUniqueId' DESC 'Netscape def
attributeTypes: ( 2.16.840.1.113730.3.1.543 NAME 'nsState' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.544 NAME 'nsParentUniqueId' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.545 NAME 'nscpEntryDN' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.550 NAME 'cosAttribute' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.551 NAME 'cosspecifier' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.552 NAME 'costargettree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.553 NAME 'costemplatedn' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.35 NAME 'changeLog' DESC 'the distinguished name of the entry which contains the set of entries comprising this servers changelog' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.200 NAME 'changeLogMaximumAge' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.201 NAME 'changeLogMaximumSize' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.205 NAME 'changeLogMaximumConcurrentWrites' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.250.1.2 NAME 'multiLineDescription' DESC 'Pilot attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Internet White Pages Pilot' )
-attributeTypes: ( 1.3.6.1.4.1.250.1.60 NAME ( 'ttl' 'timeToLive' ) DESC 'time to live in seconds for cached objects' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'LDAP Caching Internet Draft' )
-attributeTypes: ( 0.9.2342.19200300.100.1.7 NAME 'photo' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 1274' )
-attributeTypes: ( 2.16.840.1.113730.3.1.612 NAME 'generation' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 1.3.1.1.4.1.453.16.2.103 NAME 'numSubordinates' DESC 'count of immediate subordinates' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'numSubordinates Internet Draft' )
-attributeTypes: ( 2.5.18.9 NAME 'hasSubordinates' DESC 'if TRUE, subordinate entries may exist' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'numSubordinates Internet Draft' )
-attributeTypes: ( 2.16.840.1.113730.3.1.569 NAME 'cosPriority' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.570 NAME 'nsLookThroughLimit' DESC 'Binder-based search operation look through 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.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.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' )
-attributeTypes: ( 2.16.840.1.113730.3.1.577 NAME 'cosIndirectSpecifier' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.578 NAME 'nsDS5ReplicaHost' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.579 NAME 'nsDS5ReplicaPort' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.580 NAME 'nsDS5ReplicaTransportInfo' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
@@ -280,9 +118,6 @@ attributeTypes: ( 2.16.840.1.113730.3.1.592 NAME 'nsDS5ReplicaAutoReferral' DESC
attributeTypes: ( 2.16.840.1.113730.3.1.607 NAME 'nsDS5Flags' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.608 NAME 'nsDS5Task' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.609 NAME 'nsds5BeginReplicaRefresh' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.610 NAME 'nsAccountLock' DESC 'Operational attribute for Account Inactivation' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.613 NAME 'copiedFrom' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.614 NAME 'copyingFrom' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.682 NAME 'nsds5ReplicaPurgeDelay' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.684 NAME 'nsds5ReplicaChangeCount' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.683 NAME 'nsds5ReplicaTombstonePurgeInterval' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
@@ -292,7 +127,6 @@ attributeTypes: ( 2.16.840.1.113730.3.1.687 NAME 'nsds5replicaChangesSentSinceSt
attributeTypes: ( 2.16.840.1.113730.3.1.688 NAME 'nsds5replicaLastUpdateStatus' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.689 NAME 'nsds5replicaUpdateInProgress' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.802 NAME 'nsds5ReplicaLegacyConsumer' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.803 NAME 'nsBackendSuffix' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.804 NAME 'nsSchemaCSN' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.805 NAME 'nsds5replicaTimeout' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.807 NAME 'nsds5replicaLastInitStart' DESC 'Netscape defined attribute type' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE NO-USER-MODIFICATION X-ORIGIN 'Netscape Directory Server' )
@@ -301,88 +135,14 @@ attributeTypes: ( 2.16.840.1.113730.3.1.809 NAME 'nsds5replicaLastInitStatus' DE
attributeTypes: ( 2.16.840.1.113730.3.1.1097 NAME 'nsds5replicaBusyWaitTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.1098 NAME 'nsds5replicaSessionPauseTime' DESC 'Netscape defined attribute type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
attributeTypes: ( 2.16.840.1.113730.3.1.9999999 NAME 'nsds5debugreplicatimeout' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.973 NAME 'nsds5ReplConflict' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1000 NAME 'nsds7WindowsReplicaSubtree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1001 NAME 'nsds7DirectoryReplicaSubtree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1002 NAME 'nsds7NewWinUserSyncEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1003 NAME 'nsds7NewWinGroupSyncEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1004 NAME 'nsds7WindowsDomain' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.1005 NAME 'nsds7DirsyncCookie' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 1.3.6.1.1.4 NAME 'vendorName' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' )
-attributeTypes: ( 1.3.6.1.1.5 NAME 'vendorVersion' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' )
-attributeTypes: ( 2.16.840.1.113730.3.1.3023 NAME 'nsViewFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2063 NAME 'nsEncryptionAlgorithm' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2064 NAME 'nsSaslMapRegexString' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2065 NAME 'nsSaslMapBaseDNTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
-attributeTypes: ( 2.16.840.1.113730.3.1.2066 NAME 'nsSaslMapFilterTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
#
-# objectclasses:
+# objectclasses
#
objectClasses: ( 2.5.6.0 NAME 'top' DESC 'Standard LDAP objectclass' ABSTRACT MUST objectClass X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.1 NAME 'alias' DESC 'Standard LDAP objectclass' SUP top ABSTRACT MUST ( aliasedObjectName ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 1.3.6.1.4.1.1466.101.120.111 NAME 'extensibleObject' DESC 'LDAPv3 extensible object' SUP top AUXILIARY X-ORIGIN 'RFC 2252' )
-objectClasses: ( 2.5.6.2 NAME 'country' DESC 'Standard LDAP objectclass' SUP top MUST ( c ) MAY ( searchGuide $ description ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.3 NAME 'locality' DESC 'Standard LDAP attribute type' SUP top MAY ( description $ l $ searchGuide $ seeAlso $ st $ street ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.4 NAME 'organization' DESC 'Standard LDAP objectclass' SUP top MUST ( o ) MAY ( businessCategory $ description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ searchGuide $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ userPassword $ x121Address ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.5 NAME 'organizationalUnit' DESC 'Standard LDAP objectclass' SUP top MUST ( ou ) MAY ( businessCategory $ description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ searchGuide $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ userPassword $ x121Address ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.6 NAME 'person' DESC 'Standard LDAP objectclass' SUP top MUST ( sn $ cn ) MAY ( description $ seeAlso $ telephoneNumber $ userPassword ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.7 NAME 'organizationalPerson' DESC 'Standard LDAP objectclass' SUP person MAY ( destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ ou $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ st $ street $ teletexTerminalIdentifier $ telexNumber $ title $ x121Address ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.16.840.1.113730.3.2.2 NAME 'inetOrgPerson' DESC 'Internet extended organizational person objectclass' SUP organizationalPerson MAY ( audio $ businessCategory $ carLicense $ departmentNumber $ displayName $ employeeType $ employeeNumber $ givenName $ homePhone $ homePostalAddress $ initials $ jpegPhoto $ labeledURI $ manager $ mobile $ pager $ photo $ preferredLanguage $ mail $ o $ roomNumber $ secretary $ uid $ x500uniqueIdentifier $ userCertificate $ userSMimeCertificate $ userPKCS12 ) X-ORIGIN 'RFC 2798' )
-objectClasses: ( 2.5.6.8 NAME 'organizationalRole' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ ou $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ roleOccupant $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ x121Address ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.9 NAME 'groupOfNames' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( member $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.17 NAME 'groupOfUniqueNames' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( uniqueMember $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.16.840.1.113730.3.2.31 NAME 'groupOfCertificates' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( memberCertificateDescription $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.33 NAME 'groupOfURLs' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( memberURL $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.5.6.10 NAME 'residentialPerson' DESC 'Standard LDAP objectclass' SUP person MUST ( l ) MAY ( businessCategory $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ st $ street $ teletexTerminalIdentifier $ telexNumber $ x121Address ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.11 NAME 'applicationProcess' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ l $ ou $ seeAlso ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.16.840.1.113730.3.2.35 NAME 'LDAPServer' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( description $ l $ ou $ seeAlso $ generation $ changeLogMaximumAge $ changeLogMaximumSize ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.5.6.12 NAME 'applicationEntity' DESC 'Standard LDAP objectclass' SUP top MUST ( presentationAddress $ cn ) MAY ( description $ l $ o $ ou $ seeAlso $ supportedApplicationContext ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.13 NAME 'dSA' DESC 'Standard LDAP objectclass' SUP applicationEntity MAY ( knowledgeInformation ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.14 NAME 'device' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ l $ o $ ou $ owner $ seeAlso $ serialNumber ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.15 NAME 'strongAuthenticationUser' DESC 'Standard LDAP objectclass' SUP top AUXILIARY MUST ( userCertificate ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.16 NAME 'certificationAuthority' DESC 'Standard LDAP objectclass' SUP top AUXILIARY MUST ( authorityRevocationList $ certificateRevocationList $ cACertificate ) MAY crossCertificatePair X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.16.2 NAME 'certificationAuthority-V2' DESC 'Standard LDAP objectclass' SUP certificationAuthority MAY deltaRevocationList X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.18 NAME 'userSecurityInformation' SUP top AUXILIARY MAY ( supportedAlgorithms ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.19 NAME 'cRLDistributionPoint' SUP top STRUCTURAL MUST ( cn ) MAY ( certificateRevocationList $ authorityRevocationList $ deltaRevocationList ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 2.5.6.20 NAME 'dmd' SUP top STRUCTURAL MUST ( dmdName ) MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description ) X-ORIGIN 'RFC 2256' )
-objectClasses: ( 1.3.6.1.4.1.250.3.15 NAME 'labeledURIObject' DESC 'object that contains the URI attribute type' SUP top AUXILIARY MAY ( labeledURI ) X-ORIGIN 'RFC 2079' )
-objectClasses: ( 1.3.6.1.4.1.250.3.18 NAME 'cacheObject' DESC 'object that contains the TTL (time to live) attribute type' SUP top MAY ( ttl ) X-ORIGIN 'LDAP Caching Internet Draft' )
objectClasses: ( 2.5.20.1 NAME 'subschema' DESC 'Standard LDAP objectclass' SUP top AUXILIARY MAY ( dITStructureRules $ nameForms $ dITContentRules $ objectClasses $ attributeTypes $ matchingRules $ matchingRuleUse ) X-ORIGIN 'RFC 2252' )
-objectClasses: ( 2.16.840.1.113730.3.2.10 NAME 'netscapeServer' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( description $ serverRoot $ serverProductName $ serverVersionNumber $ installationTimeStamp $ administratorContactInfo $ userpassword $ adminURL $ serverHostName ) X-ORIGIN 'Netscape Administration Services' )
-objectClasses: ( 2.16.840.1.113730.3.2.7 NAME 'nsLicenseUser' DESC 'Netscape defined objectclass' SUP top MAY ( nsLicensedFor $ nsLicenseStartTime $ nsLicenseEndTime ) X-ORIGIN 'Netscape Administration Services' )
-objectClasses: ( 2.16.840.1.113730.3.2.1 NAME 'changeLogEntry' DESC 'LDAP changelog objectclass' SUP top MUST ( targetdn $ changeTime $ changenumber $ changeType ) MAY ( changes $ newrdn $ deleteoldrdn $ newsuperior ) X-ORIGIN 'Changelog Internet Draft' )
-objectClasses: ( 2.16.840.1.113730.3.2.6 NAME 'referral' DESC 'LDAP referrals objectclass' SUP top MAY ( ref ) X-ORIGIN 'LDAPv3 referrals Internet Draft' )
-objectClasses: ( 2.16.840.1.113730.3.2.12 NAME 'passwordObject' DESC 'Netscape defined password policy objectclass' SUP top MAY ( pwdpolicysubentry $ passwordExpirationTime $ passwordExpWarned $ passwordRetryCount $ retryCountResetTime $ accountUnlockTime $ passwordHistory $ passwordAllowChangeTime $ passwordGraceUserTime ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.13 NAME 'passwordPolicy' DESC 'Netscape defined password policy objectclass' SUP top MAY ( passwordMaxAge $ passwordExp $ passwordMinLength $ passwordKeepHistory $ passwordInHistory $ passwordChange $ passwordWarning $ passwordLockout $ passwordMaxFailure $ passwordResetDuration $ passwordUnlock $ passwordLockoutDuration $ passwordCheckSyntax $ passwordMustChange $ passwordStorageScheme $ passwordMinAge $ passwordResetFailureCount $ passwordGraceLimit $ passwordMinDigits $ passwordMinAlphas $ passwordMinUppers $ passwordMinLowers $ passwordMinSpecials $ passwordMin8bit $ passwordMaxRepeats $ passwordMinCategories $ passwordMinTokenLength ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.30 NAME 'glue' DESC 'Netscape defined objectclass' SUP top X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.32 NAME 'netscapeMachineData' DESC 'Netscape defined objectclass' SUP top X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.38 NAME 'vlvSearch' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ vlvBase $ vlvScope $ vlvFilter ) MAY ( multiLineDescription ) X-ORIGIN 'Netscape Directory Server' )
-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.113719.2.142.6.1.1 NAME 'ldapSubEntry' DESC 'LDAP Subentry class, version 1' SUP top STRUCTURAL MAY ( cn ) X-ORIGIN 'LDAP Subentry Internet Draft' )
objectClasses: ( 2.16.840.1.113730.3.2.40 NAME 'directoryServerFeature' DESC 'Netscape defined objectclass' SUP top MAY ( oid $ cn $ multiLineDescription ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.41 NAME 'nsslapdPlugin' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsslapd-pluginPath $ nsslapd-pluginInitFunc $ nsslapd-pluginType $ nsslapd-pluginId $ nsslapd-pluginVersion $ nsslapd-pluginVendor $ nsslapd-pluginDescription $ nsslapd-pluginEnabled ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.42 NAME 'vlvIndex' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ vlvSort ) MAY ( vlvEnabled $ vlvUses ) 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: ( 2.16.840.1.113730.3.2.44 NAME 'nsIndex' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsSystemIndex ) MAY ( description $ nsIndexType $ nsMatchingRule ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.84 NAME 'cosDefinition' DESC 'Netscape defined objectclass' SUP top MAY ( costargettree $ costemplatedn $ cosspecifier $ cosattribute $ aci $ cn $ uid ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113719.2.142.6.1.1 NAME 'ldapSubEntry' DESC 'LDAP Subentry class, version 1' SUP top STRUCTURAL MAY ( cn ) X-ORIGIN 'LDAP Subentry Internet Draft' )
-objectClasses: ( 2.16.840.1.113730.3.2.93 NAME 'nsRoleDefinition' DESC 'Netscape defined objectclass' SUP ldapSubEntry MAY ( description ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.94 NAME 'nsSimpleRoleDefinition' DESC 'Netscape defined objectclass' SUP nsRoleDefinition X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.95 NAME 'nsComplexRoleDefinition' DESC 'Netscape defined objectclass' SUP nsRoleDefinition X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.96 NAME 'nsManagedRoleDefinition' DESC 'Netscape defined objectclass' SUP nsSimpleRoleDefinition X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.97 NAME 'nsFilteredRoleDefinition' DESC 'Netscape defined objectclass' SUP nsComplexRoleDefinition MUST ( nsRoleFilter ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.98 NAME 'nsNestedRoleDefinition' DESC 'Netscape defined objectclass' SUP nsComplexRoleDefinition MUST ( nsRoleDN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.99 NAME 'cosSuperDefinition' DESC 'Netscape defined objectclass' SUP ldapSubEntry MUST (cosattribute) MAY ( description ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.100 NAME 'cosClassicDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn $ cosspecifier ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.101 NAME 'cosPointerDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.102 NAME 'cosIndirectDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosIndirectSpecifier ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.503 NAME 'nsDSWindowsReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime $ nsds7WindowsReplicaSubtree $ nsds7DirectoryReplicaSubtree $ nsds7NewWinUserSyncEnabled $ nsds7NewWinGroupSyncEnabled $ nsds7WindowsDomain $ nsds7DirsyncCookie) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.104 NAME 'nsContainer' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $ nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $ nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $ nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.109 NAME 'nsBackendInstance' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
objectClasses: ( 2.16.840.1.113730.3.2.110 NAME 'nsMappingTree' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.113 NAME 'nsTombstone' DESC 'Netscape defined objectclass' SUP top MAY ( nsParentUniqueId $ nscpEntryDN ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.128 NAME 'costemplate' DESC 'Netscape defined objectclass' SUP top MAY ( cn $ cospriority ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.304 NAME 'nsView' DESC 'Netscape defined objectclass' SUP top AUXILIARY MAY ( nsViewFilter $ description ) X-ORIGIN 'Netscape Directory Server' )
-objectClasses: ( 2.16.840.1.113730.3.2.316 NAME 'nsAttributeEncryption' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsEncryptionAlgorithm ) 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 ) X-ORIGIN 'Netscape Directory Server' )
diff --git a/ldap/schema/01common.ldif b/ldap/schema/01common.ldif
new file mode 100644
index 000000000..1084f006f
--- /dev/null
+++ b/ldap/schema/01common.ldif
@@ -0,0 +1,292 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# 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; version 2 of the License.
+#
+# 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., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA.
+#
+# In addition, as a special exception, Red Hat, Inc. gives You the additional
+# right to link the code of this Program with code not covered under the GNU
+# General Public License ("Non-GPL Code") and to distribute linked combinations
+# including the two, subject to the limitations in this paragraph. Non-GPL Code
+# permitted under this exception must only link to the code of this Program
+# through those well defined interfaces identified in the file named EXCEPTION
+# found in the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline functions from
+# the Approved Interfaces without causing the resulting work to be covered by
+# the GNU General Public License. Only Red Hat, Inc. may make changes or
+# additions to the list of Approved Interfaces. You must obey the GNU General
+# Public License in all respects for all of the Program code and other code used
+# in conjunction with the Program except the Non-GPL Code covered by this
+# exception. If you modify this file, you may extend this exception to your
+# version of the file, but you are not obligated to do so. If you do not wish to
+# provide this exception without modification, you must delete this exception
+# statement from your version and license this file solely under the GPL without
+# exception.
+#
+#
+# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
+# Copyright (C) 2005 Red Hat, Inc.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+# Core schema, highly recommended but not required to start the Directory Server itself.
+#
+dn: cn=schema
+#
+# attributes
+#
+attributeTypes: ( 2.5.4.1 NAME 'aliasedObjectName' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.2 NAME 'knowledgeInformation' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.4 NAME ( 'sn' 'surName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.5 NAME 'serialNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.6 NAME ( 'c' 'countryName' ) DESC 'Standard LDAP attribute type' SUP name SINGLE-VALUE X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.7 NAME ( 'l' 'locality' 'localityname' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.8 NAME ( 'st' 'stateOrProvinceName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.9 NAME ( 'street' 'streetaddress' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.10 NAME ( 'o' 'organizationname' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.12 NAME 'title' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.14 NAME 'searchGuide' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.15 NAME 'businessCategory' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.16 NAME 'postalAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.17 NAME 'postalCode' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.18 NAME 'postOfficeBox' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.19 NAME 'physicalDeliveryOfficeName' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.20 NAME 'telephoneNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.21 NAME 'telexNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.22 NAME 'teletexTerminalIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.23 NAME ( 'facsimileTelephoneNumber' 'fax' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.24 NAME 'x121Address' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.25 NAME 'internationaliSDNNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.26 NAME 'registeredAddress' DESC 'Standard LDAP attribute type' SUP postalAddress X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.27 NAME 'destinationIndicator' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.28 NAME 'preferredDeliveryMethod' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.29 NAME 'presentationAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.30 NAME 'supportedApplicationContext' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.31 NAME 'member' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.32 NAME 'owner' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.33 NAME 'roleOccupant' DESC 'Standard LDAP attribute type' SUP distinguishedName X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.36 NAME 'userCertificate' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.37 NAME 'cACertificate' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.38 NAME 'authorityRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.39 NAME 'certificateRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.40 NAME 'crossCertificatePair' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.42 NAME 'givenName' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.43 NAME 'initials' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.44 NAME 'generationQualifier' DESC 'Standard LDAP attribute type' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.45 NAME 'x500UniqueIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.46 NAME 'dnQualifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.47 NAME 'enhancedSearchGuide' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.48 NAME 'protocolInformation' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.50 NAME 'uniqueMember' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.51 NAME 'houseIdentifier' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.52 NAME 'supportedAlgorithms' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.53 NAME 'deltaRevocationList' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 2.5.4.54 NAME 'dmdName' SUP name X-ORIGIN 'RFC 2256' )
+attributeTypes: ( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.3 NAME ( 'mail' 'rfc822mailbox' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.6 NAME 'roomNumber' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.10 NAME 'manager' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.20 NAME 'homePhone' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.21 NAME 'secretary' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.39 NAME 'homePostalAddress' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.41 NAME ( 'mobile' 'mobileTelephoneNumber' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.42 NAME ( 'pager' 'pagerTelephoneNumber' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.43 NAME ( 'co' 'friendlycountryname' ) DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.55 NAME 'audio' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 0.9.2342.19200300.100.1.60 NAME 'jpegPhoto' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.28 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 1.3.6.1.4.1.250.1.57 NAME ( 'labeledUri' 'labeledurl' ) DESC 'Uniform Resource Identifier with optional label' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'RFC 2079' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1 NAME 'carLicense' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2 NAME 'departmentNumber' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.3 NAME 'employeeNumber' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.4 NAME 'employeeType' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.5 NAME 'changeNumber' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.6 NAME 'targetDn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.7 NAME 'changeType' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.8 NAME 'changes' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.9 NAME 'newRdn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.10 NAME 'deleteOldRdn' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.11 NAME 'newSuperior' DESC 'Changelog attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.34 NAME 'ref' DESC 'LDAP referrals attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'LDAPv3 referrals Internet Draft' )
+attributeTypes: ( 2.5.18.10 NAME 'subschemaSubentry' DESC 'Standard LDAP attribute type' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.5 NAME 'namingContexts' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.6 NAME 'altServer' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.7 NAME 'supportedExtension' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.13 NAME 'supportedControl' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.14 NAME 'supportedSASLMechanisms' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.15 NAME 'supportedLDAPVersion' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 USAGE dSAOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.1466.101.120.16 NAME 'ldapSyntaxes' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'RFC 2252' )
+attributeTypes: ( 1.3.6.1.4.1.4203.1.3.5 NAME 'supportedFeatures' DESC 'features supported by the server' EQUALITY objectIdentifierMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 USAGE dSAOperation )
+attributeTypes: ( 2.16.840.1.113730.3.1.36 NAME 'nsLicensedFor' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.37 NAME 'nsLicenseStartTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.38 NAME 'nsLicenseEndTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.39 NAME 'preferredLanguage' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.40 NAME 'userSMIMECertificate' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.70 NAME 'serverRoot' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.71 NAME 'serverProductName' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.72 NAME 'serverVersionNumber' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.73 NAME 'installationTimeStamp' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.74 NAME 'administratorContactInfo' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.75 NAME 'adminUrl' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.76 NAME 'serverHostName' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Administration Services' )
+attributeTypes: ( 2.16.840.1.113730.3.1.77 NAME 'changeTime' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.91 NAME 'passwordExpirationTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.92 NAME ( 'passwordExpWarned' 'pwdExpirationWarned' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.93 NAME 'passwordRetryCount' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.94 NAME 'retryCountResetTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.95 NAME 'accountUnlockTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.96 NAME ( 'passwordHistory' 'pwdHistory' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.97 NAME ( 'passwordMaxAge' 'pwdMaxAge' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.98 NAME 'passwordExp' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.99 NAME ( 'passwordMinLength' 'pwdMinLength' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.100 NAME 'passwordKeepHistory' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.101 NAME ( 'passwordInHistory' 'pwdInHistory' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.102 NAME ( 'passwordChange' 'pwdAllowUserChange' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.103 NAME ( 'passwordCheckSyntax' 'pwdCheckSyntax' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.104 NAME ( 'passwordWarning' 'pwdExpireWarning' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.105 NAME ( 'passwordLockout' 'pwdLockOut' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.106 NAME ( 'passwordMaxFailure' 'pwdMaxFailure' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.107 NAME 'passwordResetDuration' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.108 NAME 'passwordUnlock' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.109 NAME ( 'passwordLockoutDuration' 'pwdLockoutDuration' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.997 NAME 'pwdpolicysubentry' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.998 NAME ( 'passwordGraceUserTime' 'pwdGraceUserTime' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.999 NAME ( 'passwordGraceLimit' 'pwdGraceLoginLimit' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2075 NAME ( 'passwordMinDigits' 'pwdMinDigits' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2076 NAME ( 'passwordMinAlphas' 'pwdMinAlphas' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2077 NAME ( 'passwordMinUppers' 'pwdMinUppers' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2078 NAME ( 'passwordMinLowers' 'pwdMinLowers' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2079 NAME ( 'passwordMinSpecials' 'pwdMinSpecials' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2080 NAME ( 'passwordMin8bit' 'pwdMin8bit' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2081 NAME ( 'passwordMaxRepeats' 'pwdMaxRepeats' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2082 NAME ( 'passwordMinCategories' 'pwdMinCategories' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2083 NAME ( 'passwordMinTokenLength' 'pwdMinTokenLength' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.198 NAME 'memberURL' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.199 NAME 'memberCertificateDescription' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.207 NAME 'vlvBase' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.208 NAME 'vlvScope' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.209 NAME 'vlvFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.210 NAME 'vlvSort' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.213 NAME 'vlvEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.214 NAME 'passwordAllowChangeTime' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.216 NAME 'userPKCS12' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.219 NAME 'vlvUses' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.220 NAME ( 'passwordMustChange' 'pwdMustChange' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.221 NAME 'passwordStorageScheme' DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.222 NAME ( 'passwordMinAge' 'pwdMinAge' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.223 NAME ( 'passwordResetFailureCount' 'pwdFailureCountInterval' ) DESC 'Netscape defined password policy attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.241 NAME 'displayName' DESC 'inetOrgPerson attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2798' )
+attributeTypes: ( 2.16.840.1.113730.3.1.550 NAME 'cosAttribute' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.551 NAME 'cosspecifier' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.552 NAME 'costargettree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.553 NAME 'costemplatedn' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.35 NAME 'changeLog' DESC 'the distinguished name of the entry which contains the set of entries comprising this servers changelog' EQUALITY distinguishedNameMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 X-ORIGIN 'Changelog Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.200 NAME 'changeLogMaximumAge' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.201 NAME 'changeLogMaximumSize' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.205 NAME 'changeLogMaximumConcurrentWrites' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.250.1.60 NAME ( 'ttl' 'timeToLive' ) DESC 'time to live in seconds for cached objects' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'LDAP Caching Internet Draft' )
+attributeTypes: ( 0.9.2342.19200300.100.1.7 NAME 'photo' DESC 'Standard LDAP attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 X-ORIGIN 'RFC 1274' )
+attributeTypes: ( 2.16.840.1.113730.3.1.612 NAME 'generation' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 1.3.1.1.4.1.453.16.2.103 NAME 'numSubordinates' DESC 'count of immediate subordinates' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'numSubordinates Internet Draft' )
+attributeTypes: ( 2.5.18.9 NAME 'hasSubordinates' DESC 'if TRUE, subordinate entries may exist' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation X-ORIGIN 'numSubordinates Internet Draft' )
+attributeTypes: ( 2.16.840.1.113730.3.1.569 NAME 'cosPriority' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.570 NAME 'nsLookThroughLimit' DESC 'Binder-based search operation look through 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.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.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' )
+attributeTypes: ( 2.16.840.1.113730.3.1.577 NAME 'cosIndirectSpecifier' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.610 NAME 'nsAccountLock' DESC 'Operational attribute for Account Inactivation' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.613 NAME 'copiedFrom' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.614 NAME 'copyingFrom' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.803 NAME 'nsBackendSuffix' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.973 NAME 'nsds5ReplConflict' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE directoryOperation X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1000 NAME 'nsds7WindowsReplicaSubtree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1001 NAME 'nsds7DirectoryReplicaSubtree' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1002 NAME 'nsds7NewWinUserSyncEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1003 NAME 'nsds7NewWinGroupSyncEnabled' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1004 NAME 'nsds7WindowsDomain' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.1005 NAME 'nsds7DirsyncCookie' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 1.3.6.1.1.4 NAME 'vendorName' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' )
+attributeTypes: ( 1.3.6.1.1.5 NAME 'vendorVersion' EQUALITY 1.3.6.1.4.1.1466.109.114.1 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-ORIGIN 'RFC 3045' )
+attributeTypes: ( 2.16.840.1.113730.3.1.3023 NAME 'nsViewFilter' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2063 NAME 'nsEncryptionAlgorithm' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2064 NAME 'nsSaslMapRegexString' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2065 NAME 'nsSaslMapBaseDNTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+attributeTypes: ( 2.16.840.1.113730.3.1.2066 NAME 'nsSaslMapFilterTemplate' DESC 'Netscape defined attribute type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'Netscape Directory Server' )
+#
+# objectclasses:
+#
+objectClasses: ( 2.5.6.1 NAME 'alias' DESC 'Standard LDAP objectclass' SUP top ABSTRACT MUST ( aliasedObjectName ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 1.3.6.1.4.1.1466.101.120.111 NAME 'extensibleObject' DESC 'LDAPv3 extensible object' SUP top AUXILIARY X-ORIGIN 'RFC 2252' )
+objectClasses: ( 2.5.6.2 NAME 'country' DESC 'Standard LDAP objectclass' SUP top MUST ( c ) MAY ( searchGuide $ description ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.3 NAME 'locality' DESC 'Standard LDAP attribute type' SUP top MAY ( description $ l $ searchGuide $ seeAlso $ st $ street ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.4 NAME 'organization' DESC 'Standard LDAP objectclass' SUP top MUST ( o ) MAY ( businessCategory $ description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ searchGuide $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ userPassword $ x121Address ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.5 NAME 'organizationalUnit' DESC 'Standard LDAP objectclass' SUP top MUST ( ou ) MAY ( businessCategory $ description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ searchGuide $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ userPassword $ x121Address ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.6 NAME 'person' DESC 'Standard LDAP objectclass' SUP top MUST ( sn $ cn ) MAY ( description $ seeAlso $ telephoneNumber $ userPassword ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.7 NAME 'organizationalPerson' DESC 'Standard LDAP objectclass' SUP person MAY ( destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ ou $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ st $ street $ teletexTerminalIdentifier $ telexNumber $ title $ x121Address ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.16.840.1.113730.3.2.2 NAME 'inetOrgPerson' DESC 'Internet extended organizational person objectclass' SUP organizationalPerson MAY ( audio $ businessCategory $ carLicense $ departmentNumber $ displayName $ employeeType $ employeeNumber $ givenName $ homePhone $ homePostalAddress $ initials $ jpegPhoto $ labeledURI $ manager $ mobile $ pager $ photo $ preferredLanguage $ mail $ o $ roomNumber $ secretary $ uid $ x500uniqueIdentifier $ userCertificate $ userSMimeCertificate $ userPKCS12 ) X-ORIGIN 'RFC 2798' )
+objectClasses: ( 2.5.6.8 NAME 'organizationalRole' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ l $ ou $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ roleOccupant $ seeAlso $ st $ street $ telephoneNumber $ teletexTerminalIdentifier $ telexNumber $ x121Address ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.9 NAME 'groupOfNames' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( member $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.17 NAME 'groupOfUniqueNames' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( uniqueMember $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.16.840.1.113730.3.2.31 NAME 'groupOfCertificates' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( memberCertificateDescription $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.33 NAME 'groupOfURLs' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( memberURL $ businessCategory $ description $ o $ ou $ owner $ seeAlso ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.5.6.10 NAME 'residentialPerson' DESC 'Standard LDAP objectclass' SUP person MUST ( l ) MAY ( businessCategory $ destinationIndicator $ facsimileTelephoneNumber $ internationaliSDNNumber $ physicalDeliveryOfficeName $ postOfficeBox $ postalAddress $ postalCode $ preferredDeliveryMethod $ registeredAddress $ st $ street $ teletexTerminalIdentifier $ telexNumber $ x121Address ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.11 NAME 'applicationProcess' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ l $ ou $ seeAlso ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.16.840.1.113730.3.2.35 NAME 'LDAPServer' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( description $ l $ ou $ seeAlso $ generation $ changeLogMaximumAge $ changeLogMaximumSize ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.5.6.12 NAME 'applicationEntity' DESC 'Standard LDAP objectclass' SUP top MUST ( presentationAddress $ cn ) MAY ( description $ l $ o $ ou $ seeAlso $ supportedApplicationContext ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.13 NAME 'dSA' DESC 'Standard LDAP objectclass' SUP applicationEntity MAY ( knowledgeInformation ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.14 NAME 'device' DESC 'Standard LDAP objectclass' SUP top MUST ( cn ) MAY ( description $ l $ o $ ou $ owner $ seeAlso $ serialNumber ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.15 NAME 'strongAuthenticationUser' DESC 'Standard LDAP objectclass' SUP top AUXILIARY MUST ( userCertificate ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.16 NAME 'certificationAuthority' DESC 'Standard LDAP objectclass' SUP top AUXILIARY MUST ( authorityRevocationList $ certificateRevocationList $ cACertificate ) MAY crossCertificatePair X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.16.2 NAME 'certificationAuthority-V2' DESC 'Standard LDAP objectclass' SUP certificationAuthority MAY deltaRevocationList X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.18 NAME 'userSecurityInformation' SUP top AUXILIARY MAY ( supportedAlgorithms ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.19 NAME 'cRLDistributionPoint' SUP top STRUCTURAL MUST ( cn ) MAY ( certificateRevocationList $ authorityRevocationList $ deltaRevocationList ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 2.5.6.20 NAME 'dmd' SUP top STRUCTURAL MUST ( dmdName ) MAY ( userPassword $ searchGuide $ seeAlso $ businessCategory $ x121Address $ registeredAddress $ destinationIndicator $ preferredDeliveryMethod $ telexNumber $ teletexTerminalIdentifier $ telephoneNumber $ internationaliSDNNumber $ facsimileTelephoneNumber $ street $ postOfficeBox $ postalCode $ postalAddress $ physicalDeliveryOfficeName $ st $ l $ description ) X-ORIGIN 'RFC 2256' )
+objectClasses: ( 1.3.6.1.4.1.250.3.15 NAME 'labeledURIObject' DESC 'object that contains the URI attribute type' SUP top AUXILIARY MAY ( labeledURI ) X-ORIGIN 'RFC 2079' )
+objectClasses: ( 1.3.6.1.4.1.250.3.18 NAME 'cacheObject' DESC 'object that contains the TTL (time to live) attribute type' SUP top MAY ( ttl ) X-ORIGIN 'LDAP Caching Internet Draft' )
+objectClasses: ( 2.16.840.1.113730.3.2.10 NAME 'netscapeServer' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( description $ serverRoot $ serverProductName $ serverVersionNumber $ installationTimeStamp $ administratorContactInfo $ userpassword $ adminURL $ serverHostName ) X-ORIGIN 'Netscape Administration Services' )
+objectClasses: ( 2.16.840.1.113730.3.2.7 NAME 'nsLicenseUser' DESC 'Netscape defined objectclass' SUP top MAY ( nsLicensedFor $ nsLicenseStartTime $ nsLicenseEndTime ) X-ORIGIN 'Netscape Administration Services' )
+objectClasses: ( 2.16.840.1.113730.3.2.1 NAME 'changeLogEntry' DESC 'LDAP changelog objectclass' SUP top MUST ( targetdn $ changeTime $ changenumber $ changeType ) MAY ( changes $ newrdn $ deleteoldrdn $ newsuperior ) X-ORIGIN 'Changelog Internet Draft' )
+objectClasses: ( 2.16.840.1.113730.3.2.6 NAME 'referral' DESC 'LDAP referrals objectclass' SUP top MAY ( ref ) X-ORIGIN 'LDAPv3 referrals Internet Draft' )
+objectClasses: ( 2.16.840.1.113730.3.2.12 NAME 'passwordObject' DESC 'Netscape defined password policy objectclass' SUP top MAY ( pwdpolicysubentry $ passwordExpirationTime $ passwordExpWarned $ passwordRetryCount $ retryCountResetTime $ accountUnlockTime $ passwordHistory $ passwordAllowChangeTime $ passwordGraceUserTime ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.13 NAME 'passwordPolicy' DESC 'Netscape defined password policy objectclass' SUP top MAY ( passwordMaxAge $ passwordExp $ passwordMinLength $ passwordKeepHistory $ passwordInHistory $ passwordChange $ passwordWarning $ passwordLockout $ passwordMaxFailure $ passwordResetDuration $ passwordUnlock $ passwordLockoutDuration $ passwordCheckSyntax $ passwordMustChange $ passwordStorageScheme $ passwordMinAge $ passwordResetFailureCount $ passwordGraceLimit $ passwordMinDigits $ passwordMinAlphas $ passwordMinUppers $ passwordMinLowers $ passwordMinSpecials $ passwordMin8bit $ passwordMaxRepeats $ passwordMinCategories $ passwordMinTokenLength ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.30 NAME 'glue' DESC 'Netscape defined objectclass' SUP top X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.32 NAME 'netscapeMachineData' DESC 'Netscape defined objectclass' SUP top X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.38 NAME 'vlvSearch' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ vlvBase $ vlvScope $ vlvFilter ) MAY ( multiLineDescription ) X-ORIGIN 'Netscape Directory Server' )
+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.39 NAME 'nsslapdConfig' DESC 'Netscape defined objectclass' SUP top MAY ( cn ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.42 NAME 'vlvIndex' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ vlvSort ) MAY ( vlvEnabled $ vlvUses ) 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: ( 2.16.840.1.113730.3.2.84 NAME 'cosDefinition' DESC 'Netscape defined objectclass' SUP top MAY ( costargettree $ costemplatedn $ cosspecifier $ cosattribute $ aci $ cn $ uid ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113719.2.142.6.1.1 NAME 'ldapSubEntry' DESC 'LDAP Subentry class, version 1' SUP top STRUCTURAL MAY ( cn ) X-ORIGIN 'LDAP Subentry Internet Draft' )
+objectClasses: ( 2.16.840.1.113730.3.2.93 NAME 'nsRoleDefinition' DESC 'Netscape defined objectclass' SUP ldapSubEntry MAY ( description ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.94 NAME 'nsSimpleRoleDefinition' DESC 'Netscape defined objectclass' SUP nsRoleDefinition X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.95 NAME 'nsComplexRoleDefinition' DESC 'Netscape defined objectclass' SUP nsRoleDefinition X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.96 NAME 'nsManagedRoleDefinition' DESC 'Netscape defined objectclass' SUP nsSimpleRoleDefinition X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.97 NAME 'nsFilteredRoleDefinition' DESC 'Netscape defined objectclass' SUP nsComplexRoleDefinition MUST ( nsRoleFilter ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.98 NAME 'nsNestedRoleDefinition' DESC 'Netscape defined objectclass' SUP nsComplexRoleDefinition MUST ( nsRoleDN ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.99 NAME 'cosSuperDefinition' DESC 'Netscape defined objectclass' SUP ldapSubEntry MUST (cosattribute) MAY ( description ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.100 NAME 'cosClassicDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn $ cosspecifier ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.101 NAME 'cosPointerDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosTemplateDn ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.102 NAME 'cosIndirectDefinition' DESC 'Netscape defined objectclass' SUP cosSuperDefinition MAY ( cosIndirectSpecifier ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.103 NAME 'nsDS5ReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.503 NAME 'nsDSWindowsReplicationAgreement' DESC 'Netscape defined objectclass' SUP top MUST ( cn ) MAY ( nsDS5ReplicaHost $ nsDS5ReplicaPort $ nsDS5ReplicaTransportInfo $ nsDS5ReplicaBindDN $ nsDS5ReplicaCredentials $ nsDS5ReplicaBindMethod $ nsDS5ReplicaRoot $ nsDS5ReplicatedAttributeList $ nsDS5ReplicaUpdateSchedule $ nsds5BeginReplicaRefresh $ description $ nsds50ruv $ nsruvReplicaLastModified $ nsds5ReplicaTimeout $ nsds5replicaChangesSentSinceStartup $ nsds5replicaLastUpdateEnd $ nsds5replicaLastUpdateStart $ nsds5replicaLastUpdateStatus $ nsds5replicaUpdateInProgress $ nsds5replicaLastInitEnd $ nsds5replicaLastInitStart $ nsds5replicaLastInitStatus $ nsds5debugreplicatimeout $ nsds5replicaBusyWaitTime $ nsds5replicaSessionPauseTime $ nsds7WindowsReplicaSubtree $ nsds7DirectoryReplicaSubtree $ nsds7NewWinUserSyncEnabled $ nsds7NewWinGroupSyncEnabled $ nsds7WindowsDomain $ nsds7DirsyncCookie) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.104 NAME 'nsContainer' DESC 'Netscape defined objectclass' SUP top MUST ( CN ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.108 NAME 'nsDS5Replica' DESC 'Netscape defined objectclass' SUP top MUST ( nsDS5ReplicaRoot $ nsDS5ReplicaId ) MAY (cn $ nsDS5ReplicaType $ nsDS5ReplicaBindDN $ nsState $ nsDS5ReplicaName $ nsDS5Flags $ nsDS5Task $ nsDS5ReplicaReferral $ nsDS5ReplicaAutoReferral $ nsds5ReplicaPurgeDelay $ nsds5ReplicaTombstonePurgeInterval $ nsds5ReplicaChangeCount $ nsds5ReplicaLegacyConsumer) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.113 NAME 'nsTombstone' DESC 'Netscape defined objectclass' SUP top MAY ( nsParentUniqueId $ nscpEntryDN ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.128 NAME 'costemplate' DESC 'Netscape defined objectclass' SUP top MAY ( cn $ cospriority ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.304 NAME 'nsView' DESC 'Netscape defined objectclass' SUP top AUXILIARY MAY ( nsViewFilter $ description ) X-ORIGIN 'Netscape Directory Server' )
+objectClasses: ( 2.16.840.1.113730.3.2.316 NAME 'nsAttributeEncryption' DESC 'Netscape defined objectclass' SUP top MUST ( cn $ nsEncryptionAlgorithm ) 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 ) X-ORIGIN 'Netscape Directory Server' )
| 0 |
c980d65142ab7f2403443dffee4c612a2c305db1
|
389ds/389-ds-base
|
Resolves: bug 425849
Bug Description: migrate-ds-admin.pl spins at 100% cpu
Reviewed by: nkinder (Thanks!)
Fix Description: It was spinning because inst_dir was not being set, so it kept trying to find the parent directory of a non-existent directory. In migration, the old instance has no instance dir - we will fill that in during instance creation, so just skip it if not set. I also found and fixed another bug in migration with the usage of file_name_is_absolute - have to use the full module name and function name.
Platforms tested: RHEL4 32bit and 64bit
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
|
commit c980d65142ab7f2403443dffee4c612a2c305db1
Author: Rich Megginson <[email protected]>
Date: Mon Dec 17 23:49:50 2007 +0000
Resolves: bug 425849
Bug Description: migrate-ds-admin.pl spins at 100% cpu
Reviewed by: nkinder (Thanks!)
Fix Description: It was spinning because inst_dir was not being set, so it kept trying to find the parent directory of a non-existent directory. In migration, the old instance has no instance dir - we will fill that in during instance creation, so just skip it if not set. I also found and fixed another bug in migration with the usage of file_name_is_absolute - have to use the full module name and function name.
Platforms tested: RHEL4 32bit and 64bit
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none
diff --git a/ldap/admin/src/scripts/Util.pm.in b/ldap/admin/src/scripts/Util.pm.in
index f7b0d6e85..80f7bd970 100644
--- a/ldap/admin/src/scripts/Util.pm.in
+++ b/ldap/admin/src/scripts/Util.pm.in
@@ -842,7 +842,9 @@ sub createInfFromConfig {
$conn->close();
- print $outfh "inst_dir = $inst_dir\n";
+ if ($inst_dir) {
+ print $outfh "inst_dir = $inst_dir\n";
+ }
print $outfh "Suffix = $suffix\n";
close $outfh;
| 0 |
12d2fc9b4af9510d97118af50502a1bfc7b3ef8d
|
389ds/389-ds-base
|
Fix coverity issues
Fixed coverity issues 13169, 13170, 13171
Reviewed by: richm(Thanks!)
|
commit 12d2fc9b4af9510d97118af50502a1bfc7b3ef8d
Author: Mark Reynolds <[email protected]>
Date: Mon May 6 14:12:19 2013 -0400
Fix coverity issues
Fixed coverity issues 13169, 13170, 13171
Reviewed by: richm(Thanks!)
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 7b335938c..fa7e5aadd 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -2611,7 +2611,7 @@ static int
schema_add_objectclass ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
size_t errorbufsize, int schema_ds4x_compat )
{
- struct objclass *pnew_oc;
+ struct objclass *pnew_oc = NULL;
char *newoc_ldif;
int j, rc=0;
@@ -2620,6 +2620,7 @@ schema_add_objectclass ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
if ( LDAP_SUCCESS != (rc = parse_oc_str ( newoc_ldif, &pnew_oc,
errorbuf, errorbufsize, 0, 1 /* user defined */,
schema_ds4x_compat))) {
+ oc_free( &pnew_oc );
return rc;
}
@@ -4271,6 +4272,7 @@ parse_objclass_str ( const char *input, struct objclass **oc, char *errorbuf,
}
} else {
/* we still need to set the originals */
+ charray_free(OrigRequiredAttrsArray);
OrigRequiredAttrsArray = charray_dup(objClass->oc_at_oids_must);
}
if (psup_oc->oc_allowed && objClass->oc_at_oids_may) {
@@ -4287,6 +4289,7 @@ parse_objclass_str ( const char *input, struct objclass **oc, char *errorbuf,
}
} else {
/* we still need to set the originals */
+ charray_free(OrigAllowedAttrsArray);
OrigAllowedAttrsArray = charray_dup(objClass->oc_at_oids_may);
}
} else {
| 0 |
b6b7199470671315d693ddec8db7c4ffbc4a1ee8
|
389ds/389-ds-base
|
Ticket #47763 - winsync plugin modify is broken
Description: Thanks to Carsten Grzemba for the patch. Made minimum
changes such as replacing the direct access to the bv_len in Slapi_Value
with slapi_value_get_length.
Note: Regarding attr_compare_equal, since there is no strong reason
to switch to this new attr_compare_equal, we continue using the original
code. The newly provided code is in "#if 0".
https://fedorahosted.org/389/ticket/47763
Reviewed by [email protected] (Thanks, Rich!)
|
commit b6b7199470671315d693ddec8db7c4ffbc4a1ee8
Author: Noriko Hosoi <[email protected]>
Date: Wed Jun 11 14:27:23 2014 -0700
Ticket #47763 - winsync plugin modify is broken
Description: Thanks to Carsten Grzemba for the patch. Made minimum
changes such as replacing the direct access to the bv_len in Slapi_Value
with slapi_value_get_length.
Note: Regarding attr_compare_equal, since there is no strong reason
to switch to this new attr_compare_equal, we continue using the original
code. The newly provided code is in "#if 0".
https://fedorahosted.org/389/ticket/47763
Reviewed by [email protected] (Thanks, Rich!)
diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c
index 58b6cd836..d43e76dc2 100644
--- a/ldap/servers/plugins/posix-winsync/posix-winsync.c
+++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c
@@ -143,7 +143,7 @@ enum
* -1 - some sort of error
*/
static int
-check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
+_check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
{
int rc = 1;
Slapi_ValueSet *values = NULL;
@@ -162,7 +162,7 @@ check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
}
slapi_ch_free_string(&strval);
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "<-- check_account_lock - entry [%s] has real "
+ "<-- _check_account_lock - entry [%s] has real "
"attribute nsAccountLock and entry %s locked\n",
slapi_entry_get_dn_const(ds_entry), rc ? "is not" : "is");
return rc;
@@ -189,13 +189,13 @@ check_account_lock(Slapi_Entry *ds_entry, int *isvirt)
slapi_vattr_values_free(&values, &actual_type_name, attr_free_flags);
}
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "<-- check_account_lock - entry [%s] has virtual "
+ "<-- _check_account_lock - entry [%s] has virtual "
"attribute nsAccountLock and entry %s locked\n",
slapi_entry_get_dn_const(ds_entry), rc ? "is not" : "is");
} else {
rc = 1; /* no attr == entry is enabled */
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
- "<-- check_account_lock - entry [%s] does not "
+ "<-- _check_account_lock - entry [%s] does not "
"have attribute nsAccountLock - entry is not locked\n",
slapi_entry_get_dn_const(ds_entry));
}
@@ -232,7 +232,7 @@ sync_acct_disable(void *cbdata, /* the usual domain config data */
int isvirt = 0;
/* get the account lock state of the ds entry */
- if (0 == check_account_lock(ds_entry, &isvirt)) {
+ if (0 == _check_account_lock(ds_entry, &isvirt)) {
ds_is_enabled = 0;
}
if (isvirt)
@@ -379,6 +379,54 @@ sync_acct_disable(void *cbdata, /* the usual domain config data */
return;
}
+#if 0
+/*
+ * attr_compare_equal provided in
+ * https://fedorahosted.org/389/attachment/ticket/47763/0025-posix-winsync.rawentry.patch
+ * Since there is no strong reason to switch to this new attr_compare_equal,
+ * continue using the original code.
+ */
+/*
+ * Compare the first value of attr a and b.
+ *
+ * If the sizes of each value are equal AND the first values match, return TRUE.
+ * Otherwise, return FALSE.
+ *
+ * NOTE: For now only handle single values
+ */
+static int
+attr_compare_equal(Slapi_Attr *a, Slapi_Attr *b)
+{
+ /* For now only handle single values */
+ Slapi_Value *va = NULL;
+ Slapi_Value *vb = NULL;
+ int num_a = 0;
+ int num_b = 0;
+ int match = 1;
+
+ slapi_attr_get_numvalues(a, &num_a);
+ slapi_attr_get_numvalues(b, &num_b);
+
+ if (num_a == num_b) {
+ slapi_attr_first_value(a, &va);
+ slapi_attr_first_value(b, &vb);
+
+ /* If either val is less than n, then check if the length, then values are
+ * equal. If both are n or greater, then only compare the first n chars.
+ * If n is 0, then just compare the entire attribute. */
+ if (slapi_value_get_length(va) == slapi_value_get_length(vb)) {
+ if (slapi_attr_value_find(b, slapi_value_get_berval(va)) != 0) {
+ match = 0;
+ }
+ } else {
+ match = 0;
+ }
+ } else {
+ match = 0;
+ }
+ return match;
+}
+#else /* Original code */
/* Returns non-zero if the attribute value sets are identical. */
static int
attr_compare_equal(Slapi_Attr *a, Slapi_Attr *b)
@@ -396,6 +444,7 @@ attr_compare_equal(Slapi_Attr *a, Slapi_Attr *b)
}
return 1;
}
+#endif
/* look in the parent nodes of ds_entry for nis domain entry */
char *
@@ -804,10 +853,10 @@ posix_winsync_pre_ds_mod_user_cb(void *cbdata, const Slapi_Entry *rawentry, Slap
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
"--> _pre_ds_mod_user_cb -- begin\n");
- if ((NULL == rawentry) || (NULL == ad_entry) || (NULL == ds_entry)) {
+ if ((NULL == ad_entry) || (NULL == ds_entry)) {
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
"<-- _pre_ds_mod_user_cb -- Empty %s entry.\n",
- (NULL==rawentry)?"rawentry":(NULL==ad_entry)?"ad entry":"ds entry");
+ (NULL==ad_entry)?"ad entry":"ds entry");
plugin_op_finished();
return;
}
@@ -926,7 +975,7 @@ posix_winsync_pre_ds_mod_user_cb(void *cbdata, const Slapi_Entry *rawentry, Slap
}
slapi_value_free(&voc);
}
- sync_acct_disable(cbdata, rawentry, ds_entry, ACCT_DISABLE_TO_DS, NULL, smods, do_modify);
+ sync_acct_disable(cbdata, ad_entry, ds_entry, ACCT_DISABLE_TO_DS, NULL, smods, do_modify);
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "<-- _pre_ds_mod_user_cb %s %s\n",
slapi_sdn_get_dn(slapi_entry_get_sdn_const(ds_entry)), (do_modify) ? "modified"
: "not modified");
@@ -978,14 +1027,16 @@ posix_winsync_pre_ds_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry, Sla
Slapi_Attr *local_attr = NULL;
char *local_type = NULL;
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "1.\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
+ "_pre_ds_mod_group_cb -- found AD attr %s\n", type);
slapi_attr_get_valueset(attr, &vs);
local_type = slapi_ch_strdup(attr_map[i].ldap_attribute_name);
slapi_entry_attr_find(ds_entry, local_type, &local_attr);
is_present_local = (NULL == local_attr) ? 0 : 1;
if (is_present_local) {
int values_equal = 0;
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "2.\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
+ "_pre_ds_mod_group_cb -- compare with DS attr %s\n", local_type);
values_equal = attr_compare_equal(attr, local_attr);
if (!values_equal) {
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
@@ -998,13 +1049,15 @@ posix_winsync_pre_ds_mod_group_cb(void *cbdata, const Slapi_Entry *rawentry, Sla
*do_modify = 1;
}
} else {
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "3.\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
+ "_pre_ds_mod_group_cb -- add attr\n");
slapi_mods_add_mod_values(smods, LDAP_MOD_ADD, local_type,
valueset_get_valuearray(vs));
*do_modify = do_modify_local = 1;
}
- slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "4.\n");
+ slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
+ "_pre_ds_mod_group_cb -- values compared\n");
slapi_ch_free((void**) &local_type);
slapi_valueset_free(vs);
@@ -1150,7 +1203,7 @@ posix_winsync_pre_ds_add_user_cb(void *cbdata, const Slapi_Entry *rawentry, Slap
}
}
}
- sync_acct_disable(cbdata, rawentry, ds_entry, ACCT_DISABLE_TO_DS, ds_entry, NULL, NULL);
+ sync_acct_disable(cbdata, ad_entry, ds_entry, ACCT_DISABLE_TO_DS, ds_entry, NULL, NULL);
plugin_op_finished();
slapi_log_error(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name, "<-- _pre_ds_add_user_cb -- end\n");
| 0 |
6ff44aec5d1652ca5c497c82e17ccda513107418
|
389ds/389-ds-base
|
Ticket 49226 - Memory leak in ldap-agent-bin
Bug Description: We had a leak "somewhere" in the ldap-agent-bin
code. This wasn't able to be easily traced, due to the output of:
Direct leak of 29 byte(s) in 1 object(s) allocated from:
#0 0x7f7c696e7880 in malloc (/lib64/libasan.so.4+0xde880)
#1 0x7f7c691afca4 in ber_memalloc_x (/lib64/liblber-2.4.so.2+0x7ca4)
#2 0x60400000034f (<unknown module>)
Fix Description: The issue was that we were not freeing the attr
and val from ldap_parse_line while parsing our entries.
https://pagure.io/389-ds-base/issue/49226
Author: wibrown
Review by: nhosoi (Thanks for the "coverity" check!)
|
commit 6ff44aec5d1652ca5c497c82e17ccda513107418
Author: William Brown <[email protected]>
Date: Thu Apr 20 13:42:08 2017 +1000
Ticket 49226 - Memory leak in ldap-agent-bin
Bug Description: We had a leak "somewhere" in the ldap-agent-bin
code. This wasn't able to be easily traced, due to the output of:
Direct leak of 29 byte(s) in 1 object(s) allocated from:
#0 0x7f7c696e7880 in malloc (/lib64/libasan.so.4+0xde880)
#1 0x7f7c691afca4 in ber_memalloc_x (/lib64/liblber-2.4.so.2+0x7ca4)
#2 0x60400000034f (<unknown module>)
Fix Description: The issue was that we were not freeing the attr
and val from ldap_parse_line while parsing our entries.
https://pagure.io/389-ds-base/issue/49226
Author: wibrown
Review by: nhosoi (Thanks for the "coverity" check!)
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
index 94207f78d..816613653 100644
--- a/ldap/servers/snmp/main.c
+++ b/ldap/servers/snmp/main.c
@@ -47,6 +47,16 @@ main (int argc, char *argv[]) {
pid_t child_pid = 0;
FILE *pid_fp;
+ /* Pause for the debugger if DEBUG_SLEEP is set in the environment */
+ {
+ char *s = getenv( "DEBUG_SLEEP" );
+ if ( (s != NULL) && isdigit(*s) ) {
+ int secs = atoi(s);
+ printf("%s pid is %d\n", argv[0], getpid());
+ sleep(secs);
+ }
+ }
+
/* Load options */
while ((--argc > 0) && ((*++argv)[0] == '-')) {
while ((c = *++argv[0])) {
@@ -61,8 +71,9 @@ main (int argc, char *argv[]) {
}
}
- if (argc != 1)
+ if (argc != 1) {
exit_usage();
+ }
/* load config file */
if ((config_file = strdup(*argv)) == NULL) {
@@ -416,15 +427,20 @@ load_config(char *conf_path)
printf("ldap-agent: error parsing ldif line from [%s]\n", serv_p->dse_ldif);
}
- if ((strcmp(attr, "dn") == 0) &&
- (strcmp(val, "cn=config") == 0)) {
+ if ((strcmp(attr, "dn") == 0) && (strcmp(val, "cn=config") == 0)) {
char *dse_line = NULL;
-
-
+ /* Free both outer values and attr */
+ free(attr);
+ free(val);
+ attr = NULL;
+ val = NULL;
+
/* Look for port and rundir attributes */
while ((dse_line = ldif_getline(&entryp)) != NULL) {
- ldif_parse_line(dse_line, &attr, &val, &vlen);
- if (strcmp(attr, "nsslapd-snmp-index") == 0) {
+ if (ldif_parse_line(dse_line, &attr, &val, &vlen) != 0) {
+ /* can't parse these, try next line instead */
+ continue;
+ } else if (strcmp(attr, "nsslapd-snmp-index") == 0) {
snmp_index = atol(val);
got_snmp_index = 1;
} else if (strcmp(attr, "nsslapd-port") == 0) {
@@ -447,6 +463,10 @@ load_config(char *conf_path)
}
got_rundir = 1;
}
+ free(attr);
+ free(val);
+ attr = NULL;
+ val = NULL;
/* Stop processing this entry if we found the
* port and rundir and snmp_index settings */
@@ -458,6 +478,11 @@ load_config(char *conf_path)
* cn=config entry, so we can stop reading through
* the dse.ldif now. */
break;
+ } else {
+ free(attr);
+ free(val);
+ attr = NULL;
+ val = NULL;
}
}
| 0 |
d98699a0e394e7582fcae90a39cb976dbe8b7a8c
|
389ds/389-ds-base
|
Ticket 50786 - connection table freelist
Bug Description: The connection table previously to find an available
slot would iterate over the table attempting to find a free connection.
Under high congestion this yields poor performance as we may need to walk
O(n) slots to find the "one free", and the algorithm allowed the table to
be walked twice, making it potentially a O(2n) worst case. To make this
worse, the walking attempted to "trylock" - better than before (which
really locked!), but the trylock still issues atomics that are costly.
Fix Description: Implement a freelist - at start up all connections are
free, and as they are allocated they are removed from the list. As they
are disconnected they are re-added. This makes the lookup of a connection
O(1), removes spurious atomic and locking behaviour, and helps to minimise
time under the conntable lock. In some test cases this is shown to
improve server throughput by at minimum 6%
https://pagure.io/389-ds-base/issue/50786
Author: William Brown <[email protected]>
Review by: tbordaz, lkrispen
|
commit d98699a0e394e7582fcae90a39cb976dbe8b7a8c
Author: William Brown <[email protected]>
Date: Mon Dec 16 16:09:48 2019 +1000
Ticket 50786 - connection table freelist
Bug Description: The connection table previously to find an available
slot would iterate over the table attempting to find a free connection.
Under high congestion this yields poor performance as we may need to walk
O(n) slots to find the "one free", and the algorithm allowed the table to
be walked twice, making it potentially a O(2n) worst case. To make this
worse, the walking attempted to "trylock" - better than before (which
really locked!), but the trylock still issues atomics that are costly.
Fix Description: Implement a freelist - at start up all connections are
free, and as they are allocated they are removed from the list. As they
are disconnected they are re-added. This makes the lookup of a connection
O(1), removes spurious atomic and locking behaviour, and helps to minimise
time under the conntable lock. In some test cases this is shown to
improve server throughput by at minimum 6%
https://pagure.io/389-ds-base/issue/50786
Author: William Brown <[email protected]>
Review by: tbordaz, lkrispen
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index da954ada6..006e22d8b 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -156,20 +156,6 @@ connection_done(Connection *conn)
/* Finally, flag that we are clean - basically write a 0 ...*/
conn->c_state = CONN_STATE_FREE;
-
- /*
- * WARNING: There is a memory leak here! During a shutdown, connections
- * can still have events in ns add io timeout job because of post connection
- * or closing. The issue is that we can track the *jobs*, we only have the
- * connection, and we can have 1:N connection:jobs. So we can lose IO jobs
- * here. Thankfully, it's only for existing connections, and they are closed
- * anyway, so it's just a mem / mutex leak.
- *
- * To fix it, involves the rewrite of connection handling, which will happen
- * soon anyway, so please be patient while I undertake this!
- *
- * - wibrown December 2016.
- */
}
/*
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index 270788e71..b23dc3435 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -1,6 +1,7 @@
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
+ * Copyright (C) 2019 William Brown <[email protected]>
* All rights reserved.
*
* License: GPL (version 3 or any later version).
@@ -11,7 +12,111 @@
#include <config.h>
#endif
-/* Connection Table */
+/*
+ * Connection Table
+ *
+ * The connection table exists to serve a few purposes:
+ * 1. To prevent memory allocations of a (reasonably) large structures in a high-churn part
+ * of the codebase. (Connection from slap.h).
+ * 2. To allow monitoring to iterate over the current set of active connections that exist
+ * in the server.
+ * 3. To provide free connection slots to connections that have just been accepted.
+ *
+ * Requirement number 2 is the very interesting one, as it means that we need a central location
+ * to store the connections to allow metric gatherings. Requirement 1 means less today in 2019
+ * due to the improvements in malloc, and to aid tools like ASAN.
+ *
+ * == history ==
+ * The connection table previously used a simple method to allocate. The connection table can only
+ * be allocated by one acceptor at a time, which is protected by the connection table lock. The
+ * table is iterated over and each connection was locked to determine if it was in use. This iteration
+ * especially on high CT sizes could be very long, especially as:
+ *
+ * 1. The CT was always iterated from 0 -> size, meaning the "bottom end" of the table was always
+ * likely to be full, causing delays.
+ * 2. The connection lock itself is what is used to protect that sockets IO, so if a connection was
+ * writing at the time, the CT would delay waiting on the connection IO, only to find that the
+ * connection was allocated anyway.
+ *
+ * Clearly this is an issue. In mid 2019 this behaviour was subtley altered, such that when we
+ * attempted to lock we used pthread try_lock (nspr locks did not have this capability). If the try
+ * lock fails this means a connection must be in use, so we can skip it. This yielded a 30%
+ * improvement in throughput.
+ *
+ * == current ==
+ * The new design is to create a parallel freelist of open slots into the table, which is protected
+ * under the connection table lock. This should move the allocation algorithm from O(n) worst case
+ * to O(1) worst case as we always recieve and empty slot *or* ct full. It also reduces lock/atomic
+ * contention on the CPU to improve things.
+ *
+ * The freelist is a ringbuffer of pointers to the connection table. On a small scale it looks like:
+ *
+ * |--------------------------------------------|
+ * | slot 1 | slot 2 | slot 3 | slot 4 | slot 5 |
+ * | _ ptr | _ ptr | _ ptr | _ ptr | _ ptr |
+ * |--------------------------------------------|
+ * ^ ^- conn_next
+ * |
+ * \-- conn_free
+ *
+ * As we allocate, we shift conn_next through the list, yielding the ptr that was stored (and
+ * setting it to NULL as we proceed)
+ *
+ * |--------------------------------------------|
+ * | slot 1 | slot 2 | slot 3 | slot 4 | slot 5 |
+ * | _NULL | _NULL | _ ptr | _ ptr | _ ptr |
+ * |--------------------------------------------|
+ * ^ ^- conn_next
+ * |
+ * \-- conn_free
+ *
+ * When a connection is "freed" we return it to conn_free, which is then also slid up.
+ *
+ * |--------------------------------------------|
+ * | slot 1 | slot 2 | slot 3 | slot 4 | slot 5 |
+ * | _ ptr | _NULL | _ ptr | _ ptr | _ ptr |
+ * |--------------------------------------------|
+ * ^ ^- conn_next
+ * |
+ * \-- conn_free
+ *
+ * If all connections are exhausted, conn_next will == conn_next, as conn_next must have proceeded
+ * to the end of the ring, and then wrapped back allocating all previous until we meet with conn_free.
+ *
+ * |--------------------------------------------|
+ * | slot 1 | slot 2 | slot 3 | slot 4 | slot 5 |
+ * | _NULL | _NULL | _NULL | _NULL | _NULL |
+ * |--------------------------------------------|
+ * ^ ^- conn_next
+ * |
+ * \-- conn_free
+ *
+ * This means allocations of conns will keep failing until a connection is returned.
+ *
+ * |--------------------------------------------|
+ * | slot 1 | slot 2 | slot 3 | slot 4 | slot 5 |
+ * | _NULL | _ ptr | _NULL | _NULL | _NULL |
+ * |--------------------------------------------|
+ * ^- conn_next ^
+ * |
+ * \-- conn_free
+ *
+ * And now conn_next can begin to allocate again.
+ *
+ *
+ * -- invariants
+ * * when conn_free is slid back to meet conn_next, there can be no situation where another
+ * connection is returned, as none must allocated -if they were allocated, conn_free would have
+ * moved_along.
+ * * the ring buffer must be as large as conntable.
+ * * We do not check conn_next == conn_free (that's the starting state), but we check if the
+ * slot at conn_next is NULL, which must imply that conn_free has nothing to return.
+ * * connection_table_move_connection_out_of_active_list is the only function able to return a
+ * connection to the freelist, as it is the function that is called when the event system has
+ * determined all IO's are complete, or unable to complete. This function is what prepares the
+ * connection for re-use, which is why it's the only place the freelist can be appended to.
+ *
+ */
#include "fe.h"
@@ -27,6 +132,11 @@ connection_table_new(int table_size)
ct->c = (Connection *)slapi_ch_calloc(1, table_size * sizeof(Connection));
ct->fd = (struct POLL_STRUCT *)slapi_ch_calloc(1, table_size * sizeof(struct POLL_STRUCT));
ct->table_mutex = PR_NewLock();
+ /* Allocate the freelist */
+ ct->c_freelist = (Connection **)slapi_ch_calloc(1, table_size * sizeof(Connection *));
+ /* NEVER use slot 0, this is a list pointer */
+ ct->conn_next_offset = 1;
+ ct->conn_free_offset = 1;
/* We rely on the fact that we called calloc, which zeros the block, so we don't
* init any structure element unless a zero value is troublesome later
@@ -56,15 +166,20 @@ connection_table_new(int table_size)
* careful with things like this ....
*/
ct->c[i].c_state = CONN_STATE_FREE;
+ /* Prepare the connection into the freelist. */
+ ct->c_freelist[i] = &(ct->c[i]);
}
+
return ct;
}
void
connection_table_free(Connection_Table *ct)
{
- int i;
- for (i = 0; i < ct->size; i++) {
+ /* Release the freelist */
+ slapi_ch_free((void **)&ct->c_freelist);
+ /* Now release the connections. */
+ for (size_t i = 0; i < ct->size; i++) {
/* Free the contents of the connection structure */
Connection *c = &(ct->c[i]);
connection_done(c);
@@ -78,8 +193,7 @@ connection_table_free(Connection_Table *ct)
void
connection_table_abandon_all_operations(Connection_Table *ct)
{
- int i;
- for (i = 0; i < ct->size; i++) {
+ for (size_t i = 0; i < ct->size; i++) {
if (ct->c[i].c_state != CONN_STATE_FREE) {
pthread_mutex_lock(&(ct->c[i].c_mutex));
connection_abandon_operations(&ct->c[i]);
@@ -114,40 +228,20 @@ connection_table_disconnect_all(Connection_Table *ct)
Connection *
connection_table_get_connection(Connection_Table *ct, int sd)
{
- Connection *c = NULL;
- size_t index = 0;
- size_t count = 0;
-
PR_Lock(ct->table_mutex);
- /*
- * We attempt to loop over the ct twice, because connection_is_free uses trylock
- * and some resources *might* free in the time needed to loop around.
- */
- size_t ct_max_loops = ct->size * 2;
-
- /*
- * This uses sd as entropy to randomly start inside the ct rather than
- * always head-loading the list. Not my idea, but it's probably okay ...
- */
- index = sd % ct->size;
-
- for (count = 0; count < ct_max_loops; count++, index = (index + 1) % ct->size) {
- /* Do not use slot 0, slot 0 is head of the list of active connections */
- if (index == 0) {
- continue;
- } else if (ct->c[index].c_state == CONN_STATE_FREE) {
- break;
- } else if (connection_is_free(&(ct->c[index]), 1 /*use lock */)) {
- /* Connection must be allocated, check if it's okay */
- break;
+ PR_ASSERT(ct->conn_next_offset != 0);
+ Connection *c = ct->c_freelist[ct->conn_next_offset];
+ if (c != NULL) {
+ /* We allocated it, so now NULL the slot and move forward. */
+ ct->c_freelist[ct->conn_next_offset] = NULL;
+ /* Handle overflow. */
+ ct->conn_next_offset = (ct->conn_next_offset + 1) % ct->size;
+ if (ct->conn_next_offset == 0) {
+ /* Never use slot 0 */
+ ct->conn_next_offset += 1;
}
- }
-
- /* If count exceeds max loops, we didn't find something into index. */
- if (count < ct_max_loops) {
- /* Found an available Connection */
- c = &(ct->c[index]);
+ /* Now prep the slot for usage. */
PR_ASSERT(c->c_next == NULL);
PR_ASSERT(c->c_prev == NULL);
PR_ASSERT(c->c_extension == NULL);
@@ -183,6 +277,7 @@ connection_table_get_connection(Connection_Table *ct, int sd)
slapi_log_err(SLAPI_LOG_CONNS, "connection_table_get_connection", "Max open connections reached\n");
}
+ /* We could move this to before the c alloc as there is no point to remain here. */
PR_Unlock(ct->table_mutex);
return c;
@@ -257,6 +352,10 @@ connection_table_dump_active_connections(Connection_Table *ct)
* of connections. This function removes a connection (by index) from that
* list. This list is used to find the connections that should be used in the
* poll call.
+ *
+ * We only remove from the active list when the connection is ready to be reused,
+ * in other words, this is the "connection free" function. This is where we readd
+ * the connection slot to the freelist for re-use.
*/
int
connection_table_move_connection_out_of_active_list(Connection_Table *ct, Connection *c)
@@ -315,8 +414,20 @@ connection_table_move_connection_out_of_active_list(Connection_Table *ct, Connec
connection_release_nolock(c);
+ /* Clean the pointer. */
connection_cleanup(c);
+ /* Finally, place the connection back into the freelist for use */
+ PR_ASSERT(c->c_refcnt == 0);
+ PR_ASSERT(ct->conn_free_offset != 0);
+ PR_ASSERT(ct->c_freelist[ct->conn_free_offset] == NULL);
+ ct->c_freelist[ct->conn_free_offset] = c;
+ ct->conn_free_offset = (ct->conn_free_offset + 1) % ct->size;
+ if (ct->conn_free_offset == 0) {
+ /* Never use slot 0 */
+ ct->conn_free_offset += 1;
+ }
+
PR_Unlock(ct->table_mutex);
slapi_log_err(SLAPI_LOG_CONNS, "connection_table_move_connection_out_of_active_list",
diff --git a/ldap/servers/slapd/fe.h b/ldap/servers/slapd/fe.h
index e96ebb436..2d9a0931b 100644
--- a/ldap/servers/slapd/fe.h
+++ b/ldap/servers/slapd/fe.h
@@ -82,6 +82,10 @@ struct connection_table
int size;
/* An array of connections, file descriptors, and a mapping between them. */
Connection *c;
+ /* An array of free connections awaiting allocation. */;
+ Connection **c_freelist;
+ size_t conn_next_offset;
+ size_t conn_free_offset;
struct POLL_STRUCT *fd;
int n_tcps; /* standard socket start index in fd */
int n_tcpe; /* standard socket last ( +1 ) index in fd */
| 0 |
b29236c54890c2609992504d5a4ab33fec8f21ef
|
389ds/389-ds-base
|
Ticket 48750 - Clean up logging to improve command experience
Bug Description: Previously the loging was a bit too verbose by default. It
made for a lot of noise in command usage.
Fix Description: This makes more log items require .verbose, and adds the
verbose flag to the clitools package.
https://fedorahosted.org/389/ticket/48750
Author: wibrown
Review by: spichugi (Thanks!)
|
commit b29236c54890c2609992504d5a4ab33fec8f21ef
Author: William Brown <[email protected]>
Date: Wed Mar 2 17:03:01 2016 +1000
Ticket 48750 - Clean up logging to improve command experience
Bug Description: Previously the loging was a bit too verbose by default. It
made for a lot of noise in command usage.
Fix Description: This makes more log items require .verbose, and adds the
verbose flag to the clitools package.
https://fedorahosted.org/389/ticket/48750
Author: wibrown
Review by: spichugi (Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index c7be46583..5ff387781 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -535,6 +535,11 @@ class DirSrv(SimpleLDAPObject):
self.agmt = {}
self.state = DIRSRV_STATE_ALLOCATED
+ if self.verbose:
+ self.log.info("Allocate %s with %s:%s" % (self.__class__,
+ self.host,
+ (self.sslport or
+ self.port)))
def openConnection(self, saslmethod=None, certdir=None):
# Open a new connection to our LDAP server
@@ -686,7 +691,6 @@ class DirSrv(SimpleLDAPObject):
did not find it.
'''
added = False
- print(pattern)
for instance in glob.glob(pattern):
serverid = os.path.basename(instance)[len(DEFAULT_ENV_HEAD):]
@@ -730,7 +734,8 @@ class DirSrv(SimpleLDAPObject):
# first identify the directories we will scan
confdir = os.getenv('INITCONFIGDIR')
if confdir:
- self.log.info("$INITCONFIGDIR set to: %s" % confdir)
+ if self.verbose:
+ self.log.info("$INITCONFIGDIR set to: %s" % confdir)
if not os.path.isdir(confdir):
raise ValueError("$INITCONFIGDIR incorrect directory (%s)" %
confdir)
@@ -741,8 +746,9 @@ class DirSrv(SimpleLDAPObject):
privconfig_head = os.path.join(os.getenv('HOME'), ENV_LOCAL_DIR)
if not os.path.isdir(sysconfig_head):
privconfig_head = None
- self.log.info("dir (sys) : %s" % sysconfig_head)
- if privconfig_head:
+ if self.verbose:
+ self.log.info("dir (sys) : %s" % sysconfig_head)
+ if privconfig_head and self.verbose:
self.log.info("dir (priv): %s" % privconfig_head)
# list of the found instances
@@ -760,7 +766,7 @@ class DirSrv(SimpleLDAPObject):
pattern = "%s*" % os.path.join(privconfig_head,
DEFAULT_ENV_HEAD)
found = search_dir(instances, pattern, serverid)
- if len(instances) > 0:
+ if self.verbose and len(instances) > 0:
self.log.info("List from %s" % privconfig_head)
for instance in instances:
self.log.info("list instance %r\n" % instance)
@@ -776,7 +782,7 @@ class DirSrv(SimpleLDAPObject):
pattern = "%s*" % os.path.join(sysconfig_head,
DEFAULT_ENV_HEAD)
search_dir(instances, pattern, serverid)
- if len(instances) > 0:
+ if self.verbose and len(instances) > 0:
self.log.info("List from %s" % privconfig_head)
for instance in instances:
self.log.info("list instance %r\n" % instance)
@@ -787,14 +793,14 @@ class DirSrv(SimpleLDAPObject):
pattern = "%s*" % os.path.join(privconfig_head,
DEFAULT_ENV_HEAD)
search_dir(instances, pattern)
- if len(instances) > 0:
+ if self.verbose and len(instances) > 0:
self.log.info("List from %s" % privconfig_head)
for instance in instances:
self.log.info("list instance %r\n" % instance)
pattern = "%s*" % os.path.join(sysconfig_head, DEFAULT_ENV_HEAD)
search_dir(instances, pattern)
- if len(instances) > 0:
+ if self.verbose and len(instances) > 0:
self.log.info("List from %s" % privconfig_head)
for instance in instances:
self.log.info("list instance %r\n" % instance)
@@ -1430,7 +1436,8 @@ class DirSrv(SimpleLDAPObject):
XXX This cannot return None
"""
- log.debug("Retrieving entry with %r" % [args])
+ if self.verbose:
+ log.debug("Retrieving entry with %r" % [args])
if len(args) == 1 and 'scope' not in kwargs:
args += (ldap.SCOPE_BASE, )
@@ -1440,7 +1447,8 @@ class DirSrv(SimpleLDAPObject):
if not obj:
raise NoSuchEntryError("no such entry for %r" % [args])
- log.info("Retrieved entry %r" % obj)
+ if self.verbose:
+ log.info("Retrieved entry %r" % obj)
if isinstance(obj, Entry):
return obj
else: # assume list/tuple
diff --git a/src/lib389/lib389/_constants.py b/src/lib389/lib389/_constants.py
index 23d8cbfc2..5fdbe7b09 100644
--- a/src/lib389/lib389/_constants.py
+++ b/src/lib389/lib389/_constants.py
@@ -505,20 +505,4 @@ args_instance = {SER_DEPLOYED_DIR: os.environ.get('PREFIX', None),
SER_CREATION_SUFFIX: DEFAULT_SUFFIX}
# Helper for linking dse.ldif values to the parse_config function
-<<<<<<< HEAD
-args_dse_keys = {SER_HOST: 'nsslapd-localhost',
- SER_PORT: 'nsslapd-port',
- SER_SECURE_PORT: 'nsslapd-secureport',
- SER_ROOT_DN: 'nsslapd-rootdn',
- SER_CREATION_SUFFIX: 'nsslapd-defaultnamingcontext',
- SER_USER_ID: 'nsslapd-localuser'}
-=======
args_dse_keys = SER_PROPNAME_TO_ATTRNAME
-# {SER_HOST: 'nsslapd-localhost',
-# SER_PORT: 'nsslapd-port',
-# SER_SECURE_PORT: 'nsslapd-secureport',
-# SER_ROOT_DN: 'nsslapd-rootdn',
-# SER_CREATION_SUFFIX: 'nsslapd-defaultnamingcontext',
-# SER_USER_ID: 'nsslapd-localuser',
-# }
->>>>>>> cee015a... Ticket 48751 - Improve lib389 ldapi support
diff --git a/src/lib389/lib389/clitools/__init__.py b/src/lib389/lib389/clitools/__init__.py
index acd6bd073..f12bdc2bc 100644
--- a/src/lib389/lib389/clitools/__init__.py
+++ b/src/lib389/lib389/clitools/__init__.py
@@ -18,9 +18,11 @@ from lib389._constants import *
class CliTool(object):
def __init__(self, args=None):
- self.ds = DirSrv()
if args is not None:
self.args = args
+ self.ds = DirSrv(verbose=args.verbose)
+ else:
+ self.ds = DirSrv()
def populate_instance_dict(self, instance):
insts = self.ds.list(serverid=instance)
@@ -38,10 +40,12 @@ class CliTool(object):
binddn = self.args.binddn
# There is a dict get key thing somewhere ...
if self.inst.get(SER_ROOT_PW, None) is None:
+ print("")
prompt_txt = ('Enter password for %s on instance %s: ' %
(binddn,
self.inst[SER_SERVERID_PROP]))
self.inst[SER_ROOT_PW] = getpass(prompt_txt)
+ print("")
return
def connect(self):
@@ -68,6 +72,7 @@ def _clitools_parser():
parser.add_argument('-D', '--binddn',
help='The bind dn to use for operations. Defaults to ' +
'rooddn', default=None)
+ parser.add_argument('-v', '--verbose', help="Display verbose debug information", action='store_true', default=False)
return parser
clitools_parser = _clitools_parser()
diff --git a/src/lib389/lib389/clitools/ds_list_instances.py b/src/lib389/lib389/clitools/ds_list_instances.py
index 433edbe40..5d5c07cd2 100644
--- a/src/lib389/lib389/clitools/ds_list_instances.py
+++ b/src/lib389/lib389/clitools/ds_list_instances.py
@@ -15,10 +15,14 @@ from clitools import CliTool
class ListTool(CliTool):
def list_instances(self):
# Remember, the prefix can be set with the os environment
- instances = self.ds.list(all=True)
- print('Instances on this system:')
- for instance in instances:
- print(instance[CONF_SERVER_ID])
+ try:
+ instances = self.ds.list(all=True)
+ print('Instances on this system:')
+ for instance in instances:
+ print(instance[CONF_SERVER_ID])
+ except IOError as e:
+ print(e)
+ print("Perhaps you need to be a different user?")
if __name__ == '__main__':
listtool = ListTool()
diff --git a/src/lib389/lib389/clitools/ds_schema_attributetype_query.py b/src/lib389/lib389/clitools/ds_schema_attributetype_query.py
index 6acc93bb8..13ea479d8 100644
--- a/src/lib389/lib389/clitools/ds_schema_attributetype_query.py
+++ b/src/lib389/lib389/clitools/ds_schema_attributetype_query.py
@@ -22,9 +22,11 @@ class SchemaTool(CliTool):
attributetype, must, may = \
self.ds.schema.query_attributetype(self.args.attributetype)
print(attributetype)
+ print("")
print('MUST')
for objectclass in must:
print(objectclass)
+ print("")
print('MAY')
for objectclass in may:
print(objectclass)
@@ -34,11 +36,11 @@ class SchemaTool(CliTool):
if __name__ == '__main__':
# Do some arg parse stuff
# You can always add a child parser here too ...
- parser = ArgumentParser(parents=[clitools_parser])
+ parser = clitools_parser.add_argument_group('schema', 'schema options')
parser.add_argument('--attributetype',
'-a',
help='The name of the attribute type to query',
required=True)
- args = parser.parse_args()
+ args = clitools_parser.parse_args()
schematool = SchemaTool(args)
schematool.schema_attributetype_query()
| 0 |
70d06dab96468e0c6712482186f22de8e2c33e17
|
389ds/389-ds-base
|
Ticket #48939 - nsslapd-workingdir is empty when ns-slapd is started by systemd
Description: Thanks to [email protected] for suggesting to reset the
working dir in the error cases. I've added more error checks and
resetting the nsslapd-workingdir values.
https://fedorahosted.org/389/ticket/48939
Reviewed by [email protected] (Thank you, Mark!!)
|
commit 70d06dab96468e0c6712482186f22de8e2c33e17
Author: Noriko Hosoi <[email protected]>
Date: Wed Jul 27 11:23:17 2016 -0700
Ticket #48939 - nsslapd-workingdir is empty when ns-slapd is started by systemd
Description: Thanks to [email protected] for suggesting to reset the
working dir in the error cases. I've added more error checks and
resetting the nsslapd-workingdir values.
https://fedorahosted.org/389/ticket/48939
Reviewed by [email protected] (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/detach.c b/ldap/servers/slapd/detach.c
index cd13a997a..2f5667f47 100644
--- a/ldap/servers/slapd/detach.c
+++ b/ldap/servers/slapd/detach.c
@@ -59,14 +59,41 @@ set_workingdir()
errorlog = config_get_errorlog();
if (NULL == errorlog) {
rc = chdir("/");
+ if (0 == rc) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ }
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
+ }
} else {
ptr = strrchr(errorlog, '/');
if (ptr) {
*ptr = '\0';
}
rc = chdir(errorlog);
- if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
- LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ if (0 == rc) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, errorlog, errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ rc = chdir("/");
+ if (0 == rc) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ }
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
+ }
+ }
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", errorlog);
+ rc = chdir("/");
+ if (0 == rc) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ }
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
+ }
}
slapi_ch_free_string(&errorlog);
}
@@ -75,8 +102,18 @@ set_workingdir()
if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, workingdir, errorbuf, 0) == LDAP_OPERATIONS_ERROR) {
LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
rc = chdir("/");
+ if (0 == rc) {
+ if (config_set_workingdir(CONFIG_WORKINGDIR_ATTRIBUTE, "/", errorbuf, 1) == LDAP_OPERATIONS_ERROR) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: set workingdir failed with \"%s\"\n", errorbuf);
+ }
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", "/");
+ }
} else {
rc = chdir(workingdir);
+ if (rc) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "detach: failed to chdir to %s\n", workingdir);
+ }
}
slapi_ch_free_string(&workingdir);
}
@@ -115,7 +152,7 @@ detach( int slapd_exemode, int importexport_encrypt,
}
if (set_workingdir()) {
- LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: chdir to workingdir failed.\n");
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: set_workingdir failed.\n");
}
if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
@@ -142,7 +179,7 @@ detach( int slapd_exemode, int importexport_encrypt,
return 1;
}
if (set_workingdir()) {
- LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: chdir to workingdir failed.\n");
+ LDAPDebug0Args(LDAP_DEBUG_ANY, "detach: set_workingdir failed.\n");
}
}
| 0 |
3c182986c43e1204345fa56dedf5657b9f0493b6
|
389ds/389-ds-base
|
Resolves: 454348
Summary: Index nscpEntryDN attribute when importing tombstones.
|
commit 3c182986c43e1204345fa56dedf5657b9f0493b6
Author: Nathan Kinder <[email protected]>
Date: Fri Nov 21 16:38:34 2008 +0000
Resolves: 454348
Summary: Index nscpEntryDN attribute when importing tombstones.
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 20da84fa5..c912023c7 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -1233,6 +1233,7 @@ void import_worker(void *param)
FifoItem *fi = NULL;
int is_objectclass_attribute;
int is_nsuniqueid_attribute;
+ int is_nscpentrydn_attribute;
void *attrlist_cursor;
PR_ASSERT(NULL != info);
@@ -1250,14 +1251,16 @@ void import_worker(void *param)
}
/*
- * If the entry is a Tombstone, then we only add it to the nsuniqeid index
- * and the idlist for (objectclass=tombstone). These two flags are just
- * handy for working out what to do in this case.
+ * If the entry is a Tombstone, then we only add it to the nsuniqeid index,
+ * the nscpEntryDN index, and the idlist for (objectclass=tombstone). These
+ * flags are just handy for working out what to do in this case.
*/
is_objectclass_attribute =
(strcasecmp(info->index_info->name, "objectclass") == 0);
is_nsuniqueid_attribute =
(strcasecmp(info->index_info->name, SLAPI_ATTR_UNIQUEID) == 0);
+ is_nscpentrydn_attribute =
+ (strcasecmp(info->index_info->name, SLAPI_ATTR_NSCP_ENTRYDN) == 0);
if (1 != idl_get_idl_new()) {
/* Is there substring indexing going on here ? */
@@ -1364,8 +1367,8 @@ void import_worker(void *param)
}
}
} else {
- /* This is a Tombstone entry... we only add it to the nsuniqeid
- * index and the idlist for (objectclass=nstombstone).
+ /* This is a Tombstone entry... we only add it to the nsuniqueid
+ * index, the nscpEntryDN index, and the idlist for (objectclass=nstombstone).
*/
if (job->flags & FLAG_ABORT) {
goto error;
@@ -1387,6 +1390,29 @@ void import_worker(void *param)
goto error;
}
}
+ if (is_nscpentrydn_attribute) {
+ attrlist_cursor = NULL;
+ while ((attr = attrlist_find_ex(ep->ep_entry->e_attrs,
+ SLAPI_ATTR_NSCP_ENTRYDN,
+ NULL,
+ NULL,
+ &attrlist_cursor)) != NULL) {
+
+ if (job->flags & FLAG_ABORT) {
+ goto error;
+ }
+ if(valueset_isempty(&(attr->a_present_values))) continue;
+ svals = attr_get_present_values(attr);
+ ret = index_addordel_values_ext_sv(be, info->index_info->name,
+ svals, NULL, ep->ep_id, BE_INDEX_ADD | (job->encrypt ? 0 : BE_INDEX_DONT_ENCRYPT), NULL, &idl_disposition,
+ substring_key_buffer);
+
+ if (0 != ret) {
+ /* Something went wrong, eg disk filled up */
+ goto error;
+ }
+ }
+ }
}
import_decref_entry(ep);
info->last_ID_processed = id;
| 0 |
8e3f945ed9447b5360d3ec855848dd5a11dfcc34
|
389ds/389-ds-base
|
Issue 5997 - test_inactivty_and_expiration CI testcase is wrong (#5999)
Problem: test case is not doing what it is supposed to do because the inactivity limit is often smaller
than the server restart time so in most case the test only checks the account inactivity limit.
But once timing issue are fixed, there is a second issue #5998 (looks like the tested feature does not
work as intended!)
Solution:
Increase the inactivity limit to 1 minute
Make sure we wait enough time to trigger the inactivity limit since last password change but not
since last bind.
Mark the test as xfail because of issue #5998 that is not fixed by this PR
Issue #5997
reviewed by: @droideck (Thanks!)
|
commit 8e3f945ed9447b5360d3ec855848dd5a11dfcc34
Author: progier389 <[email protected]>
Date: Fri Dec 1 12:07:20 2023 +0100
Issue 5997 - test_inactivty_and_expiration CI testcase is wrong (#5999)
Problem: test case is not doing what it is supposed to do because the inactivity limit is often smaller
than the server restart time so in most case the test only checks the account inactivity limit.
But once timing issue are fixed, there is a second issue #5998 (looks like the tested feature does not
work as intended!)
Solution:
Increase the inactivity limit to 1 minute
Make sure we wait enough time to trigger the inactivity limit since last password change but not
since last bind.
Mark the test as xfail because of issue #5998 that is not fixed by this PR
Issue #5997
reviewed by: @droideck (Thanks!)
diff --git a/dirsrvtests/tests/suites/plugins/accpol_check_all_state_attrs_test.py b/dirsrvtests/tests/suites/plugins/accpol_check_all_state_attrs_test.py
index 971620a83..ec518ca7f 100644
--- a/dirsrvtests/tests/suites/plugins/accpol_check_all_state_attrs_test.py
+++ b/dirsrvtests/tests/suites/plugins/accpol_check_all_state_attrs_test.py
@@ -12,10 +12,19 @@ import pytest
import os
import time
from lib389.topologies import topology_st as topo
-from lib389._constants import DN_CONFIG, DEFAULT_SUFFIX, PLUGIN_ACCT_POLICY, DN_PLUGIN, PASSWORD
+from lib389._constants import (
+ DEFAULT_SUFFIX,
+ DN_CONFIG,
+ DN_PLUGIN,
+ LOG_DEFAULT,
+ LOG_PLUGIN,
+ PASSWORD,
+ PLUGIN_ACCT_POLICY,
+)
from lib389.idm.user import (UserAccount, UserAccounts)
from lib389.plugins import (AccountPolicyPlugin, AccountPolicyConfig)
from lib389.idm.domain import Domain
+from datetime import datetime, timedelta
log = logging.getLogger(__name__)
@@ -27,7 +36,7 @@ NEW_PASSWORD = 'password123'
USER_SELF_MOD_ACI = '(targetattr="userpassword")(version 3.0; acl "pwp test"; allow (all) userdn="ldap:///self";)'
ANON_ACI = "(targetattr=\"*\")(version 3.0; acl \"Anonymous Read access\"; allow (read,search,compare) userdn = \"ldap:///anyone\";)"
-
[email protected](reason='https://github.com/389ds/389-ds-base/issues/5998')
def test_inactivty_and_expiration(topo):
"""Test account expiration works when we are checking all state attributes
@@ -52,11 +61,14 @@ def test_inactivty_and_expiration(topo):
7. Success
"""
+ INACTIVITY_LIMIT = 60
+
# Configure instance
inst = topo.standalone
inst.config.set('passwordexp', 'on')
inst.config.set('passwordmaxage', '2')
inst.config.set('passwordGraceLimit', '5')
+ inst.config.set('nsslapd-errorlog-level', str(LOG_PLUGIN + LOG_DEFAULT))
# Add aci so user and update password
suffix = Domain(inst, DEFAULT_SUFFIX)
@@ -78,6 +90,7 @@ def test_inactivty_and_expiration(topo):
# Reset test user password to reset passwordExpirationtime
conn = test_user.bind(PASSWORD)
test_user = UserAccount(conn, TEST_ENTRY_DN)
+ date_pw_is_set = datetime.now()
test_user.replace('userpassword', NEW_PASSWORD)
# Sleep a little bit, we'll sleep the remaining 10 seconds later
@@ -93,7 +106,7 @@ def test_inactivty_and_expiration(topo):
accp.set('altstateattrname', 'passwordexpirationtime')
accp.set('specattrname', 'acctPolicySubentry')
accp.set('limitattrname', 'accountInactivityLimit')
- accp.set('accountInactivityLimit', '10')
+ accp.set('accountInactivityLimit', str(INACTIVITY_LIMIT))
accp.set('checkAllStateAttrs', 'on')
inst.restart()
@@ -101,9 +114,16 @@ def test_inactivty_and_expiration(topo):
conn = test_user.bind(NEW_PASSWORD)
test_user = UserAccount(conn, TEST_ENTRY_DN)
- # Sleep to exceed passwordexprattiontime over 10 seconds, but less than
- # 10 seconds for lastLoginTime
- time.sleep(7)
+ # Sleep to exceed passwordexprattiontime over INACTIVITY_LIMIT seconds, but less than
+ # INACTIVITY_LIMIT seconds for lastLoginTime
+ # Based on real time because inst.restart() time is unknown
+ limit = timedelta(seconds=INACTIVITY_LIMIT+1)
+ now = datetime.now()
+ if now - date_pw_is_set >= limit:
+ pytest.mark.skip(reason="instance restart time was greater than inactivity limit")
+ return
+ deltat = limit + date_pw_is_set - now
+ time.sleep(deltat.total_seconds())
# Try to bind, but password expiration should reject this as lastLogintTime
# has not exceeded the inactivity limit
| 0 |
ba636587e77423c7773df60894344dea0377c36f
|
389ds/389-ds-base
|
Ticket 48767 - flow control in replication also blocks receiving results
Bug Description: In ticket 47942 a flow control was introduced to reduce
the load of a replication consumer. It adds some pauses
in the asynch sending of updates. Unfortunately while it
pauses it holds the reader lock, so that the result reader
thread is also paused.
Fix Description: If we need to pause the sending of updates then also release
the Result Data lock so the reader thread is not blocked.
https://fedorahosted.org/389/ticket/48767
Reviewed by: nhosi(Thanks!)
|
commit ba636587e77423c7773df60894344dea0377c36f
Author: Mark Reynolds <[email protected]>
Date: Mon Jul 11 10:30:04 2016 -0400
Ticket 48767 - flow control in replication also blocks receiving results
Bug Description: In ticket 47942 a flow control was introduced to reduce
the load of a replication consumer. It adds some pauses
in the asynch sending of updates. Unfortunately while it
pauses it holds the reader lock, so that the result reader
thread is also paused.
Fix Description: If we need to pause the sending of updates then also release
the Result Data lock so the reader thread is not blocked.
https://fedorahosted.org/389/ticket/48767
Reviewed by: nhosi(Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index d6fb89865..27bac5d91 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -479,9 +479,11 @@ repl5_inc_flow_control_results(Repl_Agmt *agmt, result_data *rd)
if ((rd->last_message_id_received <= rd->last_message_id_sent) &&
((rd->last_message_id_sent - rd->last_message_id_received) >= agmt_get_flowcontrolwindow(agmt))) {
rd->flowcontrol_detection++;
+ PR_Unlock(rd->lock);
DS_Sleep(PR_MillisecondsToInterval(agmt_get_flowcontrolpause(agmt)));
+ } else {
+ PR_Unlock(rd->lock);
}
- PR_Unlock(rd->lock);
}
static int
| 0 |
b169df29848448c69d42388f213bfeca64b04efc
|
389ds/389-ds-base
|
Issue 5284 - Replication broken after password change (#5286)
Problem: A cached version of decoded password within agmt connection
is not updated when password get changed.
Solution: Store also the encoded version beside the decoded one
and replace both password verfsion if the encoded one does not
match the agmt password.
Issue: 5284
Reviewed by @firstyear
|
commit b169df29848448c69d42388f213bfeca64b04efc
Author: progier389 <[email protected]>
Date: Tue May 10 16:25:11 2022 +0200
Issue 5284 - Replication broken after password change (#5286)
Problem: A cached version of decoded password within agmt connection
is not updated when password get changed.
Solution: Store also the encoded version beside the decoded one
and replace both password verfsion if the encoded one does not
match the agmt password.
Issue: 5284
Reviewed by @firstyear
diff --git a/dirsrvtests/tests/suites/replication/regression_m2_test.py b/dirsrvtests/tests/suites/replication/regression_m2_test.py
index efc979a8b..a6f8f15c8 100644
--- a/dirsrvtests/tests/suites/replication/regression_m2_test.py
+++ b/dirsrvtests/tests/suites/replication/regression_m2_test.py
@@ -18,11 +18,13 @@ from lib389.idm.user import TEST_USER_PROPERTIES, UserAccounts
from lib389.pwpolicy import PwPolicyManager
from lib389.utils import *
from lib389._constants import *
+from lib389.idm.domain import Domain
from lib389.idm.organizationalunit import OrganizationalUnits
from lib389.idm.user import UserAccount
from lib389.idm.group import Groups, Group
from lib389.idm.domain import Domain
from lib389.idm.directorymanager import DirectoryManager
+from lib389.idm.services import ServiceAccounts, ServiceAccount
from lib389.replica import Replicas, ReplicationManager, ReplicaRole
from lib389.agreement import Agreements
from lib389 import pid_from_file
@@ -49,6 +51,105 @@ else:
log = logging.getLogger(__name__)
+class _AgmtHelper:
+ """test_change_repl_passwd helper (Easy access to bind and agmt entries)"""
+
+ def __init__(self, from_inst, to_inst, cn = None):
+ self.from_inst = from_inst
+ self.to_inst = to_inst
+ if cn:
+ self.usedn = True
+ self.cn = cn
+ self.binddn = f'cn={cn},cn=config'
+ else:
+ self.usedn = False
+ self.cn = f'{self.from_inst.host}:{self.from_inst.sslport}'
+ self.binddn = f'cn={self.cn}, ou=Services, {DEFAULT_SUFFIX}'
+ self.original_state = []
+ self._pass = False
+
+ def _save_vals(self, entry, attrslist, name):
+ """Get current property value for cn and requested attributes"""
+ repl_prop = []
+ del_prop = []
+ for attr in attrslist:
+ try:
+ val = entry.get_attr_val_utf8(attr)
+ if val is None:
+ del_prop.append((attr,))
+ else:
+ repl_prop.append((attr,val))
+ except ldap.NO_SUCH_OBJECT:
+ del_prop.append((attr,))
+ self.original_state.append((entry, repl_prop, del_prop))
+
+ def init(self, request):
+ """Initialize the _AgmtHelper"""
+ agmt = self.get_agmt()
+ replica = Replicas(self.to_inst).get(DEFAULT_SUFFIX)
+ bind_entry = self.get_bind_entry()
+ # Preserve current configuartion
+ self._save_vals(agmt, ('nsds5ReplicaCredentials', 'nsds5ReplicaBindDN'), 'agmt')
+ self._save_vals(replica, ('nsds5ReplicaBindDN', 'nsDS5ReplicaBindDNGroup'), 'replica')
+ if not self.usedn:
+ self._save_vals(bind_entry, ('userPassword',), 'bind_entry')
+
+ if self.usedn:
+ # if using bind group, the topology is already initted (by topo_m2)
+ # if using bind dn, should create the bind entry and configure the agmt and replica
+ passwd='replrepl'
+ # Creates the bind entry
+ bind_entry.ensure_state(properties={
+ 'cn' : self.cn,
+ 'userPassword': passwd
+ })
+ # Modify the replica
+ replica.replace('nsds5ReplicaBindDN', self.binddn)
+ replica.remove_all('nsds5ReplicaBindDNGroup')
+ # Modify the agmt
+ agmt.replace_many( ('nsds5ReplicaCredentials', passwd),
+ ('nsds5ReplicaBindDN', self.binddn))
+ # Add a finalizer to restore the original configuration
+ def fin():
+ if not self._pass and "-x" in sys.argv:
+ # Keep config as is if debugging a failed test
+ return
+ # remove the added bind entry
+ if self.usedn:
+ bind_entry.delete()
+ # Restore the original entries
+ for entry, repl_prop, del_prop, in self.original_state:
+ log.debug(f"dn: {entry.dn} repl_prop={repl_prop} del_prop={del_prop}")
+ if repl_prop:
+ entry.replace_many(*repl_prop)
+ if del_prop:
+ for attr, in del_prop:
+ entry.remove_all(attr)
+ request.addfinalizer(fin)
+
+
+ def get_bind_entry(self):
+ """Get bind entry (on consumer)"""
+ return ServiceAccount(self.to_inst, dn=self.binddn)
+
+ def get_agmt(self):
+ """Get agmt entry (on supplier)"""
+ agmts = Agreements(self.from_inst)
+ for agmt in agmts.list():
+ port = agmt.get_attr_val_utf8('nsDS5ReplicaPort')
+ if port == str(self.to_inst.port) or port == str(self.to_inst.sslport):
+ return agmt
+ raise AssertionError(f'no agmt toward {self.to_inst.serverid} found on {self.from_inst.serverid}')
+
+ def change_pw(self, passwd):
+ """Change bind entry and agmt entry password"""
+ self.get_bind_entry().replace('userPassword', passwd)
+ self.get_agmt().replace('nsds5ReplicaCredentials', passwd)
+
+ def testok(self):
+ self._pass = True
+
+
def find_start_location(file, no):
log_pattern = re.compile("slapd_daemon - slapd started.")
count = 0
@@ -833,6 +934,62 @@ def test_online_init_should_create_keepalive_entries(topo_m2):
verify_keepalive_entries(topo_m2, True);
+# Parameters for test_change_repl_passwd
[email protected](
+ "bind_cn",
+ [
+ pytest.param( None, id="using-bind-group"),
+ pytest.param( "replMgr", id="using-bind-dn"),
+ ],
+)
+
+
[email protected]
+def test_change_repl_passwd(topo_m2, request, bind_cn):
+ """Replication may break after changing password.
+ Testing when agmt bind group are used.
+
+ :id: a305913a-cc76-11ec-b324-482ae39447e5
+ :setup: 2 Supplier Instances
+ :steps:
+ 1. Insure agmt from supplier1 to supplier2 is properly set to use bind group
+ 2. Insure agmt from supplier2 to supplier1 is properly set to use bind group
+ 3. Check that replication is working
+ 4. Modify supplier1 agreement password and the associated bind entry
+ 5. Modify supplier2 agreement password and the associated bind entry
+ 6. Check that replication is working
+ :expectedresults:
+ 1. Step should run sucessfully without errors
+ 2. Step should run sucessfully without errors
+ 3. Replication should work
+ 4. Step should run sucessfully without errors
+ 5. Step should run sucessfully without errors
+ 6. Replication should work
+ """
+
+ m1 = topo_m2.ms["supplier1"]
+ m2 = topo_m2.ms["supplier2"]
+ # Step 1
+ a1 = _AgmtHelper(m1, m2, cn=bind_cn)
+ a1.init(request)
+ # Step 2
+ a2 = _AgmtHelper(m2, m1, cn=bind_cn)
+ a2.init(request)
+ # Step 3
+ repl = ReplicationManager(DEFAULT_SUFFIX)
+ repl.wait_for_replication(m1, m2)
+ # Step 4
+ TEST_ENTRY_NEW_PASS = 'new_pass2'
+ a1.change_pw(TEST_ENTRY_NEW_PASS)
+ # Step 5
+ a2.change_pw(TEST_ENTRY_NEW_PASS)
+ # Step 6
+ repl.wait_for_replication(m1, m2)
+ # Mark test as successul before exiting
+ a1.testok()
+ a2.testok()
+
+
@pytest.mark.ds49915
@pytest.mark.bz1626375
def test_online_reinit_may_hang(topo_with_sigkill):
@@ -883,6 +1040,13 @@ def test_online_reinit_may_hang(topo_with_sigkill):
pass
+##############################################################################
+#### WARNING ! New tests must be added before test_online_reinit_may_hang ####
+#### because topo_with_sigkill and topo_m2 fixtures are not compatible as ####
+#### topo_with_sigkill stops and destroy topo_m2 instances. ####
+##############################################################################
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index b6bc21c46..0e3e87908 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -57,7 +57,8 @@ typedef struct repl_connection
PRLock *lock;
struct timeval timeout;
int flag_agmt_changed;
- char *plain;
+ char *plain; /* Clear password */
+ char *creds; /* Encrypted password */
void *tot_init_callback; /* Used during total update to do flow control */
} repl_connection;
@@ -205,6 +206,7 @@ conn_new(Repl_Agmt *agmt)
rpc->timeout.tv_usec = 0;
rpc->flag_agmt_changed = 0;
rpc->plain = NULL;
+ rpc->creds = NULL;
return rpc;
loser:
conn_delete_internal(rpc);
@@ -1117,7 +1119,11 @@ conn_connect_with_bootstrap(Repl_Connection *conn, PRBool bootstrap)
conn->timeout.tv_sec = agmt_get_timeout(conn->agmt);
conn->flag_agmt_changed = 0;
conn->port = agmt_get_port(conn->agmt); /* port could be updated */
+ }
+ if (conn->plain && conn->creds && strcmp(creds->bv_val, conn->creds)) {
+ /* Password has changed. */
+ slapi_ch_free_string(&conn->plain);
}
if (conn->plain == NULL) {
@@ -1142,6 +1148,8 @@ conn_connect_with_bootstrap(Repl_Connection *conn, PRBool bootstrap)
goto done;
} /* Else, does not mean that the plain is correct, only means the we had no internal
decoding pb */
+ slapi_ch_free_string(&conn->creds);
+ conn->creds = slapi_ch_strdup(creds->bv_val);
conn->plain = slapi_ch_strdup(plain);
if (!pw_ret) {
slapi_ch_free_string(&plain);
| 0 |
bc338326a2a00fb9fb9a5cc329301c7f8712d9d7
|
389ds/389-ds-base
|
Fix for 157021: server doesn't correctly process modifies to windows sync agreements
|
commit bc338326a2a00fb9fb9a5cc329301c7f8712d9d7
Author: David Boreham <[email protected]>
Date: Fri May 6 03:35:52 2005 +0000
Fix for 157021: server doesn't correctly process modifies to windows sync agreements
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 69d8da75d..dfebcddd4 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -565,6 +565,7 @@ ReplicaId agmt_get_consumerRID(Repl_Agmt *ra);
void windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
+int windows_handle_modify_agreement(Repl_Agmt *ra, const char *type, Slapi_Entry *e);
void windows_agreement_delete(Repl_Agmt *ra);
Repl_Connection *windows_conn_new(Repl_Agmt *agmt);
diff --git a/ldap/servers/plugins/replication/repl5_agmtlist.c b/ldap/servers/plugins/replication/repl5_agmtlist.c
index f1d6d5ce9..b8abe4c06 100644
--- a/ldap/servers/plugins/replication/repl5_agmtlist.c
+++ b/ldap/servers/plugins/replication/repl5_agmtlist.c
@@ -433,7 +433,7 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry
/* ignore modifier's name and timestamp attributes and the description. */
continue;
}
- else
+ else if (0 == windows_handle_modify_agreement(agmt, mods[i]->mod_type, e))
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "
"modification of %s attribute is not allowed\n", mods[i]->mod_type);
diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c
index 7ddbae431..c1a28c937 100644
--- a/ldap/servers/plugins/replication/windows_private.c
+++ b/ldap/servers/plugins/replication/windows_private.c
@@ -75,51 +75,95 @@ true_value_from_string(char *val)
}
}
-void
-windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e)
+static int
+windows_parse_config_entry(Repl_Agmt *ra, const char *type, Slapi_Entry *e)
{
char *tmpstr = NULL;
- agmt_set_priv(ra,windows_private_new());
+ int retval = 0;
- /* DN of entry at root of replicated area */
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsReplicaArea);
- if (NULL != tmpstr)
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7WindowsReplicaArea))
{
- windows_private_set_windows_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsReplicaArea);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_windows_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7DirectoryReplicaArea);
- if (NULL != tmpstr)
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7DirectoryReplicaArea))
{
- windows_private_set_directory_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7DirectoryReplicaArea);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_directory_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
-
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewUsers);
- if (NULL != tmpstr && true_value_from_string(tmpstr))
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7CreateNewUsers))
{
- windows_private_set_create_users(ra, PR_TRUE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewUsers);
+ if (NULL != tmpstr && true_value_from_string(tmpstr))
+ {
+ windows_private_set_create_users(ra, PR_TRUE);
+ }
+ else
+ {
+ windows_private_set_create_users(ra, PR_FALSE);
+ }
+ retval = 1;
slapi_ch_free((void**)&tmpstr);
}
- else
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7CreateNewGroups))
{
- windows_private_set_create_users(ra, PR_FALSE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewGroups);
+ if (NULL != tmpstr && true_value_from_string(tmpstr))
+ {
+ windows_private_set_create_groups(ra, PR_TRUE);
+ }
+ else
+ {
+ windows_private_set_create_groups(ra, PR_FALSE);
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewGroups);
- if (NULL != tmpstr && true_value_from_string(tmpstr))
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7WindowsDomain))
{
- windows_private_set_create_groups(ra, PR_TRUE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsDomain);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_windows_domain(ra,tmpstr);
+ }
+ retval = 1;
slapi_ch_free((void**)&tmpstr);
}
- else
+ return retval;
+}
+
+/* Returns non-zero if the modify was ok, zero if not */
+int
+windows_handle_modify_agreement(Repl_Agmt *ra, const char *type, Slapi_Entry *e)
+{
+ /* Is this a Windows agreement ? */
+ if (get_agmt_agreement_type(ra) == REPLICA_TYPE_WINDOWS)
{
- windows_private_set_create_groups(ra, PR_FALSE);
- }
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsDomain);
- if (NULL != tmpstr)
+ return windows_parse_config_entry(ra,type,e);
+ } else
{
- windows_private_set_windows_domain(ra,tmpstr);
+ return 0;
}
}
+void
+windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e)
+{
+ agmt_set_priv(ra,windows_private_new());
+
+ windows_parse_config_entry(ra,NULL,e);
+}
+
const char* windows_private_get_purl(const Repl_Agmt *ra)
{
const char* windows_purl;
| 0 |
cfb7dc2b9f3f572dc9374b4098af001cf9f07525
|
389ds/389-ds-base
|
Ticket 49765 - Async operations can hang when the server is running nunc-stans
Bug Description:
The fix https://pagure.io/389-ds-base/issue/48184 allowed to schedule
several NS handlers where each handler waits for the dispatch of the
previous handler before being schedule.
In case the current handler is never called (connection inactivity)
those that are waiting can wait indefinitely (until timeout or connection
closure). But those that are waiting delay the processing of the operation
when the scheduling is called by connection_threadmain.
The some operations can appear hanging.
This scenario happens with async operations
Fix Description:
Instead of waiting for the completion of the scheduled handler,
evaluates if the scheduled handler needs to be cleared (ns_job_done)
or the waiting handler to be canceled.
https://pagure.io/389-ds-base/issue/49765
Reviewed by: Mark Reynolds (thanks Mark !)
Platforms tested: F26
Flag Day: no
Doc impact: no
|
commit cfb7dc2b9f3f572dc9374b4098af001cf9f07525
Author: Thierry Bordaz <[email protected]>
Date: Thu Jun 7 16:19:34 2018 +0200
Ticket 49765 - Async operations can hang when the server is running nunc-stans
Bug Description:
The fix https://pagure.io/389-ds-base/issue/48184 allowed to schedule
several NS handlers where each handler waits for the dispatch of the
previous handler before being schedule.
In case the current handler is never called (connection inactivity)
those that are waiting can wait indefinitely (until timeout or connection
closure). But those that are waiting delay the processing of the operation
when the scheduling is called by connection_threadmain.
The some operations can appear hanging.
This scenario happens with async operations
Fix Description:
Instead of waiting for the completion of the scheduled handler,
evaluates if the scheduled handler needs to be cleared (ns_job_done)
or the waiting handler to be canceled.
https://pagure.io/389-ds-base/issue/49765
Reviewed by: Mark Reynolds (thanks Mark !)
Platforms tested: F26
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 87d198538..71a409557 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -152,12 +152,21 @@ accept_and_configure(int s __attribute__((unused)), PRFileDesc *pr_acceptfd, PRN
*/
static int handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, int secure, int local, Connection **newconn);
static void ns_handle_new_connection(struct ns_job_t *job);
+static void ns_handle_closure(struct ns_job_t *job);
static void handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll);
static int clear_signal(struct POLL_STRUCT *fds);
static void unfurl_banners(Connection_Table *ct, daemon_ports_t *ports, PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_unix);
static int write_pid_file(void);
static int init_shutdown_detect(void);
+#define NS_HANDLER_NEW_CONNECTION 0
+#define NS_HANDLER_READ_CONNECTION 1
+#define NS_HANDLER_CLOSE_CONNECTION 2
+static ns_job_func_t ns_handlers[] = {
+ ns_handle_new_connection,
+ ns_handle_pr_read_ready,
+ ns_handle_closure
+};
/*
* NSPR has different implementations for PRMonitor, depending
* on the availble threading model
@@ -1058,7 +1067,7 @@ slapd_daemon(daemon_ports_t *ports, ns_thrpool_t *tp)
for (size_t ii = 0; ii < listeners; ++ii) {
listener_idxs[ii].ct = the_connection_table; /* to pass to handle_new_connection */
ns_result_t result = ns_add_io_job(tp, listener_idxs[ii].listenfd, NS_JOB_ACCEPT | NS_JOB_PERSIST | NS_JOB_PRESERVE_FD,
- ns_handle_new_connection, &listener_idxs[ii], &(listener_idxs[ii].ns_job));
+ ns_handlers[NS_HANDLER_NEW_CONNECTION], &listener_idxs[ii], &(listener_idxs[ii].ns_job));
if (result != NS_SUCCESS) {
slapi_log_err(SLAPI_LOG_CRIT, "slapd_daemon", "ns_add_io_job failed to create add acceptor %d\n", result);
}
@@ -1684,28 +1693,84 @@ ns_handle_closure(struct ns_job_t *job)
/**
* Schedule more I/O for this connection, or make sure that it
* is closed in the event loop.
+ *
* caller must hold c_mutex
- * It returns
- * 0 on success
- * 1 on need to retry
*/
-static int
-ns_connection_post_io_or_closing_try(Connection *conn)
+void
+ns_connection_post_io_or_closing(Connection *conn)
{
struct timeval tv;
if (!enable_nunc_stans) {
- return 0;
+ return;
}
/*
* A job was already scheduled.
- * Let it be dispatched first
+ * Check if it is the appropriate one
*/
if (conn->c_job != NULL) {
- return 1;
+ if (connection_is_free(conn, 0)) {
+ PRStatus shutdown_status;
+
+ /* The connection being freed,
+ * It means that ns_handle_closure already completed and the connection
+ * is no longer on the active list.
+ * The scheduled job is useless and scheduling a new one as well
+ */
+ shutdown_status = ns_job_done(conn->c_job);
+ if (shutdown_status != PR_SUCCESS) {
+ slapi_log_err(SLAPI_LOG_CRIT, "ns_connection_post_io_or_closing", "Failed cancel a job on a freed connection %d !\n", conn->c_sd);
+ }
+ conn->c_job = NULL;
+ return;
+ }
+ if (CONN_NEEDS_CLOSING(conn)) {
+ if (ns_job_is_func(conn->c_job, ns_handlers[NS_HANDLER_CLOSE_CONNECTION])) {
+ /* Due to the closing state we would schedule a ns_handle_closure
+ * but one is already registered.
+ * Just return;
+ */
+ slapi_log_err(SLAPI_LOG_CONNS, "ns_connection_post_io_or_closing", "Already ns_handle_closure "
+ "job in progress on conn %" PRIu64 " for fd=%d\n",
+ conn->c_connid, conn->c_sd);
+ return;
+ } else {
+ /* Due to the closing state we would schedule a ns_handle_closure
+ * but a different handler is registered. Stop it and schedule (below) ns_handle_closure
+ */
+ ns_job_done(conn->c_job);
+ conn->c_job = NULL;
+ }
+ } else {
+ /* Here the connection is still active => ignore the call and return */
+ if (ns_job_is_func(conn->c_job, ns_handlers[NS_HANDLER_READ_CONNECTION])) {
+ /* Connection is still active and a read_ready is already scheduled
+ * Likely a consequence of async operations
+ * Just let the current read_ready do its job
+ */
+ slapi_log_err(SLAPI_LOG_CONNS, "ns_connection_post_io_or_closing", "Already ns_handle_pr_read_ready "
+ "job in progress on conn %" PRIu64 " for fd=%d\n",
+ conn->c_connid, conn->c_sd);
+ } else {
+ /* Weird situation where the connection is not flagged closing but ns_handle_closure
+ * is scheduled.
+ * We should not try to read it anymore
+ */
+ PR_ASSERT(ns_job_is_func(conn->c_job, ns_handlers[NS_HANDLER_CLOSE_CONNECTION]));
+ }
+ return;
+ }
}
+ /* At this point conn->c_job is NULL
+ * Either it was null when the function was called
+ * Or we cleared it (+ns_job_done) if the wrong (according
+ * to the connection state) handler was scheduled
+ *
+ * Now we need to determine which handler to schedule
+ */
+
if (CONN_NEEDS_CLOSING(conn)) {
/* there should only ever be 0 or 1 active closure jobs */
PR_ASSERT((conn->c_ns_close_jobs == 0) || (conn->c_ns_close_jobs == 1));
@@ -1718,7 +1783,7 @@ ns_connection_post_io_or_closing_try(Connection *conn)
conn->c_ns_close_jobs++; /* now 1 active closure job */
connection_acquire_nolock_ext(conn, 1 /* allow acquire even when closing */); /* event framework now has a reference */
/* Close the job asynchronously. Why? */
- ns_result_t job_result = ns_add_job(conn->c_tp, NS_JOB_TIMER, ns_handle_closure, conn, &(conn->c_job));
+ ns_result_t job_result = ns_add_job(conn->c_tp, NS_JOB_TIMER, ns_handlers[NS_HANDLER_CLOSE_CONNECTION], conn, &(conn->c_job));
if (job_result != NS_SUCCESS) {
if (job_result == NS_SHUTDOWN) {
slapi_log_err(SLAPI_LOG_INFO, "ns_connection_post_io_or_closing", "post closure job "
@@ -1762,7 +1827,7 @@ ns_connection_post_io_or_closing_try(Connection *conn)
#endif
ns_result_t job_result = ns_add_io_timeout_job(conn->c_tp, conn->c_prfd, &tv,
NS_JOB_READ | NS_JOB_PRESERVE_FD,
- ns_handle_pr_read_ready, conn, &(conn->c_job));
+ ns_handlers[NS_HANDLER_READ_CONNECTION], conn, &(conn->c_job));
if (job_result != NS_SUCCESS) {
if (job_result == NS_SHUTDOWN) {
slapi_log_err(SLAPI_LOG_INFO, "ns_connection_post_io_or_closing", "post I/O job for "
@@ -1782,61 +1847,6 @@ ns_connection_post_io_or_closing_try(Connection *conn)
return 0;
}
-/*
- * Tries to schedule I/O for this connection
- * If the connection is already busy with a scheduled I/O
- * it can wait until scheduled I/O is dispatched
- *
- * caller must hold c_mutex
- */
-void
-ns_connection_post_io_or_closing(Connection *conn)
-{
- while (ns_connection_post_io_or_closing_try(conn)) {
- /* Here a job is currently scheduled (c->job is set) and not yet dispatched
- * Job can be either:
- * - ns_handle_closure
- * - ns_handle_pr_read_ready
- */
-
- if (connection_is_free(conn, 0)) {
- PRStatus shutdown_status;
-
- /* The connection being freed,
- * It means that ns_handle_closure already completed and the connection
- * is no longer on the active list.
- * The scheduled job is useless and scheduling a new one as well
- */
- shutdown_status = ns_job_done(conn->c_job);
- if (shutdown_status != PR_SUCCESS) {
- slapi_log_err(SLAPI_LOG_CRIT, "ns_connection_post_io_or_closing", "Failed cancel a job on a freed connection %d !\n", conn->c_sd);
- }
- conn->c_job = NULL;
- return;
- }
- if (g_get_shutdown() && CONN_NEEDS_CLOSING(conn)) {
- PRStatus shutdown_status;
-
- /* This is shutting down cancel any scheduled job to register ns_handle_closure
- */
- shutdown_status = ns_job_done(conn->c_job);
- if (shutdown_status != PR_SUCCESS) {
- slapi_log_err(SLAPI_LOG_CRIT, "ns_connection_post_io_or_closing", "Failed to cancel a job during shutdown %d !\n", conn->c_sd);
- }
- conn->c_job = NULL;
- continue;
- }
-
- /* We are not suppose to work immediately on the connection that is taken by
- * another job
- * release the lock and give some time
- */
- PR_ExitMonitor(conn->c_mutex);
- DS_Sleep(PR_MillisecondsToInterval(100));
- PR_EnterMonitor(conn->c_mutex);
- }
-}
-
/* This function must be called without the thread flag, in the
* event loop. This function may free the connection. This can
* only be done in the event loop thread.
diff --git a/src/nunc-stans/include/nunc-stans.h b/src/nunc-stans/include/nunc-stans.h
index 192e38ec3..a0ddbdb42 100644
--- a/src/nunc-stans/include/nunc-stans.h
+++ b/src/nunc-stans/include/nunc-stans.h
@@ -959,4 +959,7 @@ ns_result_t ns_thrpool_wait(struct ns_thrpool_t *tp);
*/
ns_result_t ns_job_rearm(struct ns_job_t *job);
+int
+ns_job_is_func(struct ns_job_t *job, ns_job_func_t func);
+
#endif /* NS_THRPOOL_H */
diff --git a/src/nunc-stans/ns/ns_thrpool.c b/src/nunc-stans/ns/ns_thrpool.c
index d95b0c38b..774607c88 100644
--- a/src/nunc-stans/ns/ns_thrpool.c
+++ b/src/nunc-stans/ns/ns_thrpool.c
@@ -1237,6 +1237,11 @@ ns_job_rearm(ns_job_t *job)
/* Unreachable code .... */
return NS_INVALID_REQUEST;
}
+int
+ns_job_is_func(struct ns_job_t *job, ns_job_func_t func)
+{
+ return(job && job->func == func);
+}
static void
ns_thrpool_delete(ns_thrpool_t *tp)
| 0 |
f230d32cbb92d87ab4436410bf23acda5fc890fa
|
389ds/389-ds-base
|
ticket: 48497 extended search without MR indexed attribute prevents later indexing with that MR
Bug Description:
When creating a mr_indexer or a mr_filter, we first look if it exists the registered MR (global_mr_oids)
that can handle the required oid.
If there is no registered MR, we look for a MR plugin that can handle this oid.
At the beginning no MR is registered. If the retrieved MR plugin is called to create:
- an indexer it sets in the registered MR the indexer create function(SLAPI_PLUGIN_MR_INDEXER_CREATE_FN)
but not the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN).
- a filter it sets in the registered MR the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN)
but not SLAPI_PLUGIN_MR_INDEXER_CREATE_FN.
The consequence is that the registered MR may be missing filter or indexer create fn.
It ends with different wrong behaviors:
1 - for example if we index (e.g. msMatchingRule: caseExactIA5Match) it registers 'caseExactIA5Match',
MR plugin with the indexer create function.
Then if we issue a filter with ": caseExactIA5Match:' it will not find the registered MR
(because it is missing SLAPI_PLUGIN_MR_FILTER_CREATE_FN), so it will register once
again the same MR plugin but this time with the filter create function.
2 - for example if we issue a filter with ": caseExactIA5Match:' it registers 'caseExactIA5Match',
MR plugin with the filter create function.
Then if we index 'msMatchingRule: caseExactIA5Match', it will retrieve the registered MR plugin
but has it has no indexer create function, it fails to index.
Fix Description:
When registering a MR plugin, sets both indexer and filter create functions
https://fedorahosted.org/389/ticket/48746
Reviewed by: Mark Reynolds, Rich Megginson (thanks Mark, thanks Rich !!)
Platforms tested: F17
Flag Day: no
Doc impact: no
|
commit f230d32cbb92d87ab4436410bf23acda5fc890fa
Author: Thierry Bordaz <[email protected]>
Date: Fri Mar 4 18:48:07 2016 +0100
ticket: 48497 extended search without MR indexed attribute prevents later indexing with that MR
Bug Description:
When creating a mr_indexer or a mr_filter, we first look if it exists the registered MR (global_mr_oids)
that can handle the required oid.
If there is no registered MR, we look for a MR plugin that can handle this oid.
At the beginning no MR is registered. If the retrieved MR plugin is called to create:
- an indexer it sets in the registered MR the indexer create function(SLAPI_PLUGIN_MR_INDEXER_CREATE_FN)
but not the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN).
- a filter it sets in the registered MR the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN)
but not SLAPI_PLUGIN_MR_INDEXER_CREATE_FN.
The consequence is that the registered MR may be missing filter or indexer create fn.
It ends with different wrong behaviors:
1 - for example if we index (e.g. msMatchingRule: caseExactIA5Match) it registers 'caseExactIA5Match',
MR plugin with the indexer create function.
Then if we issue a filter with ": caseExactIA5Match:' it will not find the registered MR
(because it is missing SLAPI_PLUGIN_MR_FILTER_CREATE_FN), so it will register once
again the same MR plugin but this time with the filter create function.
2 - for example if we issue a filter with ": caseExactIA5Match:' it registers 'caseExactIA5Match',
MR plugin with the filter create function.
Then if we index 'msMatchingRule: caseExactIA5Match', it will retrieve the registered MR plugin
but has it has no indexer create function, it fails to index.
Fix Description:
When registering a MR plugin, sets both indexer and filter create functions
https://fedorahosted.org/389/ticket/48746
Reviewed by: Mark Reynolds, Rich Megginson (thanks Mark, thanks Rich !!)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index d25fca9e9..2ff63a685 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -569,6 +569,7 @@ plugin_mr_filter_create (mr_filter_t* f)
pblock_init(&pb);
slapi_pblock_set(&pb, SLAPI_PLUGIN, mrp);
slapi_pblock_set(&pb, SLAPI_PLUGIN_MR_FILTER_CREATE_FN, default_mr_filter_create);
+ slapi_pblock_set(&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, default_mr_indexer_create);
if (!(rc = attempt_mr_filter_create (f, mrp, &pb)))
{
plugin_mr_bind (f->mrf_oid, mrp); /* for future reference */
@@ -639,6 +640,7 @@ default_mr_indexer_create(Slapi_PBlock* pb)
slapi_pblock_set(pb, SLAPI_PLUGIN_MR_INDEX_SV_FN, mr_wrap_mr_index_sv_fn);
slapi_pblock_set(pb, SLAPI_PLUGIN_DESTROY_FN, default_mr_indexer_destroy);
slapi_pblock_set(pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, default_mr_indexer_create);
+ slapi_pblock_set(pb, SLAPI_PLUGIN_MR_FILTER_CREATE_FN, default_mr_filter_create);
rc = 0;
done:
| 0 |
e86013506df7f3da280d67be2b3bd9ab24b241bf
|
389ds/389-ds-base
|
Ticket 413 - "Server is unwilling to perform" when running ldapmodify on nsds5ReplicaStripAttrs
Bug Description: trying to set nsds5ReplicaStripAttrs yields an error 53
Fix Description: Needed to check for this new attribute when in the agmtlist modify
callback. When it doesn't recognize the attribute it returns error 53.
https://fedorahosted.org/389/ticket/413
Reviewed by: Richm(Thanks!)
|
commit e86013506df7f3da280d67be2b3bd9ab24b241bf
Author: Mark Reynolds <[email protected]>
Date: Wed Aug 1 15:45:21 2012 -0400
Ticket 413 - "Server is unwilling to perform" when running ldapmodify on nsds5ReplicaStripAttrs
Bug Description: trying to set nsds5ReplicaStripAttrs yields an error 53
Fix Description: Needed to check for this new attribute when in the agmtlist modify
callback. When it doesn't recognize the attribute it returns error 53.
https://fedorahosted.org/389/ticket/413
Reviewed by: Richm(Thanks!)
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index b04d9c440..d7ba6a651 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -358,6 +358,7 @@ int agmt_has_protocol(Repl_Agmt *agmt);
PRBool agmt_is_enabled(Repl_Agmt *ra);
int agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
char **agmt_get_attrs_to_strip(Repl_Agmt *ra);
+int agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e);
typedef struct replica Replica;
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
index 4beb13a65..2978aba7a 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -2547,3 +2547,27 @@ agmt_get_attrs_to_strip(Repl_Agmt *ra)
return NULL;
}
}
+
+int
+agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e)
+{
+ char *tmpstr = NULL;
+
+ PR_Lock(ra->lock);
+
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs);
+ if (NULL != tmpstr){
+ if(ra->attrs_to_strip){
+ slapi_ch_array_free(&ra->attrs_to_strip);
+ }
+ ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0);
+ PR_Unlock(ra->lock);
+ prot_notify_agmt_changed(ra->protocol, ra->long_name);
+ slapi_ch_free_string(&tmpstr);
+ return 0;
+ }
+
+ PR_Unlock(ra->lock);
+
+ return -1;
+}
diff --git a/ldap/servers/plugins/replication/repl5_agmtlist.c b/ldap/servers/plugins/replication/repl5_agmtlist.c
index 1c18a857d..86f06bf7e 100644
--- a/ldap/servers/plugins/replication/repl5_agmtlist.c
+++ b/ldap/servers/plugins/replication/repl5_agmtlist.c
@@ -499,6 +499,15 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry
rc = SLAPI_DSE_CALLBACK_ERROR;
}
}
+ else if (slapi_attr_types_equivalent(mods[i]->mod_type, type_nsds5ReplicaStripAttrs))
+ {
+ if(agmt_set_attrs_to_strip(agmt, e) != 0){
+ slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "
+ "failed to set replica agmt attributes to strip for %s\n",agmt_get_long_name(agmt));
+ *returncode = LDAP_OPERATIONS_ERROR;
+ rc = SLAPI_DSE_CALLBACK_ERROR;
+ }
+ }
else if (0 == windows_handle_modify_agreement(agmt, mods[i]->mod_type, e))
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "
| 0 |
834c706f04e53bb3ca95caa31c6e1166ad79210e
|
389ds/389-ds-base
|
Do not use syntax plugins directly for filters, indexing
There were many places in the server code that directly used the syntax
plugin for the attribute. If the attribute schema definition specified
a matching rule, we must use that matching rule for matching values of
that attribute, filtering that attribute, and generating index keys for
values of that attribute. New internal and plugin APIs have been added
that use the Slapi_Attr* instead of using the syntax plugin directly.
The new API will determine which matching rule to apply based on the
schema definition.
|
commit 834c706f04e53bb3ca95caa31c6e1166ad79210e
Author: Rich Megginson <[email protected]>
Date: Mon Feb 8 08:57:52 2010 -0700
Do not use syntax plugins directly for filters, indexing
There were many places in the server code that directly used the syntax
plugin for the attribute. If the attribute schema definition specified
a matching rule, we must use that matching rule for matching values of
that attribute, filtering that attribute, and generating index keys for
values of that attribute. New internal and plugin APIs have been added
that use the Slapi_Attr* instead of using the syntax plugin directly.
The new API will determine which matching rule to apply based on the
schema definition.
diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c
index 89aa9f51a..97a9c923c 100644
--- a/ldap/servers/slapd/attr.c
+++ b/ldap/servers/slapd/attr.c
@@ -290,11 +290,17 @@ slapi_attr_init_locking_optional(Slapi_Attr *a, const char *type, PRBool use_loc
{
a->a_plugin = asi->asi_plugin;
a->a_flags = asi->asi_flags;
+ a->a_mr_eq_plugin = asi->asi_mr_eq_plugin;
+ a->a_mr_ord_plugin = asi->asi_mr_ord_plugin;
+ a->a_mr_sub_plugin = asi->asi_mr_sub_plugin;
}
else
{
a->a_plugin = NULL; /* XXX - should be rare */
a->a_flags = 0; /* XXX - should be rare */
+ a->a_mr_eq_plugin = NULL;
+ a->a_mr_ord_plugin = NULL;
+ a->a_mr_sub_plugin = NULL;
}
attr_syntax_return_locking_optional( asi, use_lock );
@@ -779,7 +785,7 @@ attr_add_valuearray(Slapi_Attr *a, Slapi_Value **vals, const char *dn)
* input vals array for duplicates
*/
Avlnode *vtree = NULL;
- rc= valuetree_add_valuearray(a->a_type, a->a_plugin, vals, &vtree, &duplicate_index);
+ rc= valuetree_add_valuearray(a, vals, &vtree, &duplicate_index);
valuetree_free(&vtree);
was_present_null = 1;
} else {
@@ -892,3 +898,71 @@ attr_check_minmax ( const char *attr_name, char *value, long minval, long maxval
return retVal;
}
+
+/**
+ Returns the function which can be used to compare (like memcmp/strcmp)
+ two values of this type of attribute. The comparison function will use
+ the ORDERING matching rule if available, or the default comparison
+ function from the syntax plugin.
+ Note: if there is no ORDERING matching rule, and the syntax does not
+ provide an ordered compare function, this function will return
+ LDAP_PROTOCOL_ERROR and compare_fn will be NULL.
+ Returns LDAP_SUCCESS if successful and sets *compare_fn to the function.
+ */
+int
+attr_get_value_cmp_fn(const Slapi_Attr *attr, value_compare_fn_type *compare_fn)
+{
+ int rc = LDAP_PROTOCOL_ERROR;
+
+ LDAPDebug0Args(LDAP_DEBUG_TRACE,
+ "=> slapi_attr_get_value_cmp_fn\n");
+
+ *compare_fn = NULL;
+
+ if (attr == NULL) {
+ LDAPDebug0Args(LDAP_DEBUG_TRACE,
+ "<= slapi_attr_get_value_cmp_fn no attribute given\n");
+ rc = LDAP_PARAM_ERROR; /* unkonwn */
+ goto done;
+ }
+
+ if (attr->a_mr_ord_plugin && attr->a_mr_ord_plugin->plg_mr_compare) {
+ *compare_fn = (value_compare_fn_type) attr->a_mr_ord_plugin->plg_mr_compare;
+ rc = LDAP_SUCCESS;
+ goto done;
+ }
+
+ if ((attr->a_plugin->plg_syntax_flags & SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING) == 0) {
+ LDAPDebug2Args(LDAP_DEBUG_TRACE,
+ "<= slapi_attr_get_value_cmp_fn syntax [%s] for attribute [%s] does not support ordering\n",
+ attr->a_plugin->plg_syntax_oid, attr->a_type);
+ goto done;
+ }
+
+ if (attr->a_plugin->plg_syntax_filter_ava == NULL) {
+ LDAPDebug2Args(LDAP_DEBUG_TRACE,
+ "<= slapi_attr_get_value_cmp_fn syntax [%s] for attribute [%s] does not support equality matching\n",
+ attr->a_plugin->plg_syntax_oid, attr->a_type);
+ goto done;
+ }
+
+ if (attr->a_plugin->plg_syntax_compare == NULL) {
+ LDAPDebug2Args(LDAP_DEBUG_TRACE,
+ "<= slapi_attr_get_value_cmp_fn syntax [%s] for attribute [%s] does not have a compare function\n",
+ attr->a_plugin->plg_syntax_oid, attr->a_type);
+ goto done;
+ }
+
+ *compare_fn = (value_compare_fn_type)attr->a_plugin->plg_syntax_compare;
+ rc = LDAP_SUCCESS;
+
+done:
+ LDAPDebug0Args(LDAP_DEBUG_TRACE, "<= slapi_attr_get_value_cmp_fn \n");
+ return rc;
+}
+
+const char *
+attr_get_syntax_oid(const Slapi_Attr *attr)
+{
+ return attr->a_plugin->plg_syntax_oid;
+}
diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c
index e88f4ba19..11b272a07 100644
--- a/ldap/servers/slapd/attrsyntax.c
+++ b/ldap/servers/slapd/attrsyntax.c
@@ -674,6 +674,9 @@ attr_syntax_create(
a.asi_origin = (char **)attr_origins;
a.asi_plugin = plugin_syntax_find( attr_syntax );
a.asi_syntaxlength = syntaxlength;
+ a.asi_mr_eq_plugin = plugin_mr_find( mr_equality );
+ a.asi_mr_ord_plugin = plugin_mr_find( mr_ordering );
+ a.asi_mr_sub_plugin = plugin_mr_find( mr_substring );
a.asi_flags = flags;
/*
@@ -760,10 +763,9 @@ slapi_attr_get_oid_copy( const Slapi_Attr *a, char **oidp )
int
slapi_attr_get_syntax_oid_copy( const Slapi_Attr *a, char **oidp )
{
- void *pi = NULL;
-
- if (a && (slapi_attr_type2plugin(a->a_type, &pi) == 0)) {
- *oidp = slapi_ch_strdup(plugin_syntax2oid(pi));
+ const char *oid;
+ if (a && ((oid = attr_get_syntax_oid(a)))) {
+ *oidp = slapi_ch_strdup(oid);
return( 0 );
} else {
*oidp = NULL;
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 06cabf2c1..1153ff378 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -467,7 +467,6 @@ struct attrinfo {
* yet. */
#define IS_INDEXED( a ) ( a & INDEX_ANY )
- void *ai_plugin; /* the syntax plugin for this attribute */
char **ai_index_rules; /* matching rule OIDs */
void *ai_dblayer; /* private data used by the dblayer code */
PRInt32 ai_dblayer_count; /* used by the dblayer code */
@@ -475,7 +474,7 @@ struct attrinfo {
attrcrypt_private *ai_attrcrypt; /* private data used by the attribute encryption code (eg is it enabled or not) */
value_compare_fn_type ai_key_cmp_fn; /* function used to compare two index keys -
The function is the compare function provided by
- ai_plugin - this function is used to order
+ attr_get_value_cmp_fn - this function is used to order
the keys in the index so that we can use ORDERING
searches. In order for this function to be used,
the syntax plugin must define a compare function,
@@ -495,6 +494,7 @@ struct attrinfo {
* len value(s) are stored here. If not specified,
* the default length triplet is 2, 3, 2.
*/
+ Slapi_Attr ai_sattr; /* interface to syntax and matching rule plugins */
};
#define MAXDBCACHE 20
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index d41829f86..b77103b6a 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -61,7 +61,8 @@ static IDList * range_candidates(
char *type,
struct berval *low_val,
struct berval *high_val,
- int *err
+ int *err,
+ const Slapi_Attr *sattr
);
static IDList *
keys2idl(
@@ -194,8 +195,8 @@ ava_candidates(
struct berval *bval;
Slapi_Value **ivals;
IDList *idl;
- void *pi;
int unindexed = 0;
+ Slapi_Attr sattr;
LDAPDebug( LDAP_DEBUG_TRACE, "=> ava_candidates\n", 0, 0, 0 );
@@ -205,6 +206,8 @@ ava_candidates(
return( NULL );
}
+ slapi_attr_init(&sattr, type);
+
#ifdef LDAP_DEBUG
if ( LDAPDebugLevelIsSet( LDAP_DEBUG_TRACE )) {
char *op = NULL;
@@ -231,15 +234,17 @@ ava_candidates(
switch ( ftype ) {
case LDAP_FILTER_GE:
- idl = range_candidates(pb, be, type, bval, NULL, err);
+ idl = range_candidates(pb, be, type, bval, NULL, err, &sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
- return( idl );
+ goto done;
+ break;
case LDAP_FILTER_LE:
- idl = range_candidates(pb, be, type, NULL, bval, err);
+ idl = range_candidates(pb, be, type, NULL, bval, err, &sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
- return( idl );
+ goto done;
+ break;
case LDAP_FILTER_EQUALITY:
indextype = (char*)indextype_EQUALITY;
break;
@@ -248,15 +253,6 @@ ava_candidates(
break;
}
- /*
- * get the keys corresponding to this assertion value
- */
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " slapi_filter_get_ava no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
-
/* This code is result of performance anlysis; we are trying to
* optimize our equality filter processing -- mainly by limiting
* malloc/free calls.
@@ -282,7 +278,7 @@ ava_candidates(
ptr[1]=NULL;
ivals=ptr;
- slapi_call_syntax_assertion2keys_ava_sv( pi, &tmp, (Slapi_Value ***)&ivals, LDAP_FILTER_EQUALITY_FAST);
+ slapi_attr_assertion2keys_ava_sv( &sattr, &tmp, (Slapi_Value ***)&ivals, LDAP_FILTER_EQUALITY_FAST);
idl = keys2idl( be, type, indextype, ivals, err, &unindexed );
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
@@ -306,12 +302,13 @@ ava_candidates(
} else {
slapi_value_init_berval(&sv, bval);
ivals=NULL;
- slapi_call_syntax_assertion2keys_ava_sv( pi, &sv, &ivals, ftype );
+ slapi_attr_assertion2keys_ava_sv( &sattr, &sv, &ivals, ftype );
value_done(&sv);
if ( ivals == NULL || *ivals == NULL ) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= ava_candidates ALLIDS (no keys)\n", 0, 0, 0 );
- return( idl_allids( be ) );
+ idl = idl_allids( be );
+ goto done;
}
idl = keys2idl( be, type, indextype, ivals, err, &unindexed );
if ( unindexed ) {
@@ -322,6 +319,8 @@ ava_candidates(
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
}
+done:
+ attr_done(&sattr);
return( idl );
}
@@ -520,28 +519,18 @@ range_candidates(
char *type,
struct berval *low_val,
struct berval *high_val,
- int *err
+ int *err,
+ const Slapi_Attr *sattr
)
{
IDList *idl;
struct berval *low = NULL, *high = NULL;
struct berval **lows = NULL, **highs = NULL;
- void *pi;
LDAPDebug(LDAP_DEBUG_TRACE, "=> range_candidates attr=%s\n", type, 0, 0);
- /*
- * get the keys corresponding to the assertion values
- */
-
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " slapi_filter_get_ava no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
-
if (low_val != NULL) {
- slapi_call_syntax_assertion2keys_ava(pi, low_val, &lows, LDAP_FILTER_EQUALITY);
+ slapi_attr_assertion2keys_ava(sattr, low_val, &lows, LDAP_FILTER_EQUALITY);
if (lows == NULL || *lows == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
@@ -551,7 +540,7 @@ range_candidates(
}
if (high_val != NULL) {
- slapi_call_syntax_assertion2keys_ava(pi, high_val, &highs, LDAP_FILTER_EQUALITY);
+ slapi_attr_assertion2keys_ava(sattr, high_val, &highs, LDAP_FILTER_EQUALITY);
if (highs == NULL || *highs == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
@@ -698,7 +687,11 @@ list_candidates(
is_bounded_range = 0;
}
if (is_bounded_range) {
- idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err);
+ Slapi_Attr sattr;
+
+ slapi_attr_init(&sattr, tpairs[0]);
+ idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err, &sattr);
+ attr_done(&sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
goto out;
@@ -734,8 +727,12 @@ list_candidates(
}
else if (fpairs[1] == f)
{
+ Slapi_Attr sattr;
+
+ slapi_attr_init(&sattr, tpairs[0]);
tmp = range_candidates(pb, be, tpairs[0],
- vpairs[0], vpairs[1], err);
+ vpairs[0], vpairs[1], err, &sattr);
+ attr_done(&sattr);
if (tmp == NULL && ftype == LDAP_FILTER_AND)
{
LDAPDebug( LDAP_DEBUG_TRACE,
@@ -839,10 +836,10 @@ substring_candidates(
char *type, *initial, *final;
char **any;
IDList *idl;
- void *pi;
Slapi_Value **ivals;
int unindexed = 0;
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
+ Slapi_Attr sattr;
LDAPDebug( LDAP_DEBUG_TRACE, "=> sub_candidates\n", 0, 0, 0 );
@@ -856,12 +853,9 @@ substring_candidates(
* get the index keys corresponding to the substring
* assertion values
*/
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " sub_candidates no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
- slapi_call_syntax_assertion2keys_sub_sv( pi, initial, any, final, &ivals );
+ slapi_attr_init(&sattr, type);
+ slapi_attr_assertion2keys_sub_sv( &sattr, initial, any, final, &ivals );
+ attr_done(&sattr);
if ( ivals == NULL || *ivals == NULL ) {
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
LDAPDebug( LDAP_DEBUG_TRACE,
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index d7afb4716..f26e3d37d 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -54,7 +54,7 @@ static const char *errmsg = "database index operation failed";
static int is_indexed (const char* indextype, int indexmask, char** index_rules);
static Slapi_Value **
valuearray_minus_valuearray(
- void *plugin,
+ const Slapi_Attr *sattr,
Slapi_Value **a,
Slapi_Value **b
);
@@ -1848,8 +1848,7 @@ index_addordel_values_ext_sv(
/* on delete, only remove the equality index if the
* BE_INDEX_EQUALITY flag is set.
*/
- slapi_call_syntax_values2keys_sv( ai->ai_plugin, vals, &ivals,
- LDAP_FILTER_EQUALITY );
+ slapi_attr_values2keys_sv( &ai->ai_sattr, vals, &ivals, LDAP_FILTER_EQUALITY );
err = addordel_values_sv( be, db, basetype, indextype_EQUALITY,
ivals != NULL ? ivals : vals, id, flags, txn, ai, idl_disposition, NULL );
@@ -1866,8 +1865,7 @@ index_addordel_values_ext_sv(
* approximate index entry
*/
if ( ai->ai_indexmask & INDEX_APPROX ) {
- slapi_call_syntax_values2keys_sv( ai->ai_plugin, vals, &ivals,
- LDAP_FILTER_APPROX );
+ slapi_attr_values2keys_sv( &ai->ai_sattr, vals, &ivals, LDAP_FILTER_APPROX );
if ( ivals != NULL ) {
err = addordel_values_sv( be, db, basetype,
@@ -1892,19 +1890,19 @@ index_addordel_values_ext_sv(
/* prepare pblock to pass ai_substr_lens */
pblock_init( &pipb );
slapi_pblock_set( &pipb, SLAPI_SYNTAX_SUBSTRLENS, ai->ai_substr_lens );
- slapi_call_syntax_values2keys_sv_pb( ai->ai_plugin, vals, &ivals,
+ slapi_attr_values2keys_sv_pb( &ai->ai_sattr, vals, &ivals,
LDAP_FILTER_SUBSTRINGS, &pipb );
origvals = ivals;
/* delete only: if the attribute has multiple values,
* figure out the substrings that should remain
- * by slapi_call_syntax_values2keys,
+ * by slapi_attr_values2keys,
* then get rid of them from the being deleted values
*/
if ( evals != NULL ) {
- slapi_call_syntax_values2keys_sv_pb( ai->ai_plugin, evals,
+ slapi_attr_values2keys_sv_pb( &ai->ai_sattr, evals,
&esubvals, LDAP_FILTER_SUBSTRINGS, &pipb );
- substresult = valuearray_minus_valuearray( ai->ai_plugin, ivals, esubvals );
+ substresult = valuearray_minus_valuearray( &ai->ai_sattr, ivals, esubvals );
ivals = substresult;
valuearray_free( &esubvals );
}
@@ -2070,7 +2068,7 @@ bvals_strcasecmp(const struct berval *a, const struct berval *b)
/* the returned array of Slapi_Value needs to be freed. */
static Slapi_Value **
valuearray_minus_valuearray(
- void *plugin,
+ const Slapi_Attr *sattr,
Slapi_Value **a,
Slapi_Value **b
)
@@ -2081,7 +2079,7 @@ valuearray_minus_valuearray(
value_compare_fn_type cmp_fn;
/* get berval comparison function */
- plugin_call_syntax_get_compare_fn(plugin, &cmp_fn);
+ attr_get_value_cmp_fn(sattr, &cmp_fn);
if (cmp_fn == NULL) {
cmp_fn = (value_compare_fn_type)bvals_strcasecmp;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 1042cf7e8..3866e121c 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -61,6 +61,7 @@ attrinfo_delete(struct attrinfo **pp)
slapi_ch_free((void**)&((*pp)->ai_type));
slapi_ch_free((void**)(*pp)->ai_index_rules);
slapi_ch_free((void**)&((*pp)->ai_attrcrypt));
+ attr_done(&((*pp)->ai_sattr));
slapi_ch_free((void**)pp);
*pp= NULL;
}
@@ -194,11 +195,15 @@ attr_index_config(
}
for ( i = 0; attrs[i] != NULL; i++ ) {
int need_compare_fn = 0;
- char *attrsyntax_oid = NULL;
+ const char *attrsyntax_oid = NULL;
a = attrinfo_new();
+ slapi_attr_init(&a->ai_sattr, attrs[i]);
+ /* we can't just set a->ai_type to the type from a->ai_sattr
+ if the type has attroptions or subtypes, ai_sattr.a_type will
+ contain them - but for the purposes of indexing, we don't want
+ them */
a->ai_type = slapi_attr_basetype( attrs[i], NULL, 0 );
- slapi_attr_type2plugin( a->ai_type, &a->ai_plugin );
- attrsyntax_oid = slapi_ch_strdup(plugin_syntax2oid(a->ai_plugin));
+ attrsyntax_oid = attr_get_syntax_oid(&a->ai_sattr);
if ( argc == 1 ) {
a->ai_indexmask = (INDEX_PRESENCE | INDEX_EQUALITY |
INDEX_APPROX | INDEX_SUB);
@@ -301,7 +306,6 @@ attr_index_config(
}
}
- slapi_ch_free_string(&attrsyntax_oid);
/* initialize the IDL code's private data */
return_value = idl_init_private(be, a);
if (0 != return_value) {
@@ -322,11 +326,11 @@ attr_index_config(
}
if (need_compare_fn) {
- int rc = plugin_call_syntax_get_compare_fn( a->ai_plugin, &a->ai_key_cmp_fn );
+ int rc = attr_get_value_cmp_fn( &a->ai_sattr, &a->ai_key_cmp_fn );
if (rc != LDAP_SUCCESS) {
LDAPDebug(LDAP_DEBUG_ANY,
- "The attribute [%s] does not have a valid ORDERING matching rule\n",
- a->ai_type, 0, 0);
+ "The attribute [%s] does not have a valid ORDERING matching rule - error %d:s\n",
+ a->ai_type, rc, ldap_err2string(rc));
a->ai_key_cmp_fn = NULL;
}
}
@@ -358,6 +362,7 @@ attr_create_empty(backend *be,char *type,struct attrinfo **ai)
{
ldbm_instance *inst = (ldbm_instance *) be->be_instance_info;
struct attrinfo *a = attrinfo_new();
+ slapi_attr_init(&a->ai_sattr, type);
a->ai_type = slapi_ch_strdup(type);
if ( avl_insert( &inst->inst_attrs, a, ainfo_cmp, ainfo_dup ) != 0 ) {
/* duplicate - existing version updated */
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 70a2b1fe9..ce79c6fe5 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1408,7 +1408,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
&psrdn, NULL, 0,
run_from_cmdline, NULL);
if (rc) {
- LDAPDebugArg(LDAP_DEBUG_ANY,
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,
"ldbm2ldif: Failed to get dn of ID "
"%d\n", pid);
slapi_ch_free_string(&rdn);
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index a64919c8c..f12d41d53 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -418,12 +418,13 @@ int ldbm_back_rmdb( Slapi_PBlock *pb );
*/
struct sort_spec_thing
{
- char *type;
+ char *type; /* attribute type */
char *matchrule; /* Matching rule string */
int order; /* 0 == ascending, 1 == decending */
struct sort_spec_thing *next; /* Link to the next one */
Slapi_PBlock *mr_pb; /* For matchrule indexing */
value_compare_fn_type compare_fn; /* For non-matchrule indexing */
+ Slapi_Attr sattr;
};
typedef struct sort_spec_thing sort_spec_thing;
typedef struct sort_spec_thing sort_spec;
diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c
index b7114f505..10d441703 100644
--- a/ldap/servers/slapd/back-ldbm/sort.c
+++ b/ldap/servers/slapd/back-ldbm/sort.c
@@ -71,6 +71,7 @@ static void sort_spec_thing_free(sort_spec_thing *s)
destroy_matchrule_indexer(s->mr_pb);
slapi_pblock_destroy (s->mr_pb);
}
+ attr_done(&s->sattr);
slapi_ch_free( (void**)&s);
}
@@ -100,6 +101,7 @@ static sort_spec_thing * sort_spec_thing_new(char *type, char* matchrule, int re
s->type = type;
s->matchrule = matchrule;
s->order = reverse;
+ slapi_attr_init(&s->sattr, type);
return s;
}
@@ -188,12 +190,8 @@ int sort_candidates(backend *be,int lookthrough_limit,time_t time_up, Slapi_PBlo
/* Iterate over the sort types */
for (this_s = s; this_s; this_s=this_s->next) {
if (NULL == this_s->matchrule) {
- void *pi;
int return_value = 0;
- return_value = slapi_attr_type2plugin( this_s->type, &pi );
- if (0 == return_value) {
- return_value = plugin_call_syntax_get_compare_fn( pi, &(this_s->compare_fn) );
- }
+ return_value = attr_get_value_cmp_fn( &this_s->sattr, &(this_s->compare_fn) );
if (return_value != 0 ) {
LDAPDebug( LDAP_DEBUG_TRACE, "Attempting to sort a non-ordered attribute (%s)\n",this_s->type, 0, 0 );
/* DBDB we should set the error type here */
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
index db809c45f..2402017d9 100644
--- a/ldap/servers/slapd/back-ldbm/vlv.c
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
@@ -564,9 +564,9 @@ vlv_create_key(struct vlvIndex* p, struct backentry* e)
int totalattrs;
if (p->vlv_sortkey[sortattr]->sk_matchruleoid==NULL)
{
- /* No matching rule. Syntax Plugin mangles value. */
+ /* No matching rule. mangle values according to matching rule or syntax */
Slapi_Value **va= valueset_get_valuearray(&attr->a_present_values);
- slapi_call_syntax_values2keys_sv( p->vlv_syntax_plugin[sortattr], va, &cvalue, LDAP_FILTER_EQUALITY );
+ slapi_attr_values2keys_sv( attr, va, &cvalue, LDAP_FILTER_EQUALITY );
valuearray_get_bervalarray(cvalue,&value);
/* XXXSD need to free some more stuff */
@@ -933,7 +933,10 @@ vlv_build_candidate_list_byvalue( struct vlvIndex* p, DBC *dbc, PRUint32 length,
invalue[1]= NULL;
if (p->vlv_sortkey[0]->sk_matchruleoid==NULL)
{
- slapi_call_syntax_values2keys(p->vlv_syntax_plugin[0],invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
+ Slapi_Attr sattr;
+ slapi_attr_init(&sattr, p->vlv_sortkey[0]->sk_attrtype);
+ slapi_attr_values2keys(&sattr,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
+ attr_done(&sattr);
}
else
{
@@ -1484,14 +1487,19 @@ vlv_trim_candidates_byvalue(backend *be, const IDList *candidates, const sort_sp
*/
if (sort_control->matchrule==NULL)
{
- void *pi= NULL;
- if(slapi_attr_type2plugin(sort_control->type, &pi)==0)
+ attr_get_value_cmp_fn(&sort_control->sattr, &compare_fn);
+ if (compare_fn == NULL) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
+ "attempt to compare an unordered attribute [%s]\n",
+ sort_control->type);
+ compare_fn = slapi_berval_cmp;
+ }
+
{
struct berval *invalue[2];
invalue[0]= (struct berval *)&vlv_request_control->value; /* jcm: cast away const */
invalue[1]= NULL;
- slapi_call_syntax_values2keys(pi,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
- plugin_call_syntax_get_compare_fn( pi, &compare_fn );
+ slapi_attr_values2keys(&sort_control->sattr,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
if (compare_fn == NULL) {
LDAPDebug(LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
"attempt to compare an unordered attribute",
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index d9a14a427..da59ba3da 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -534,7 +534,6 @@ vlvIndex_new()
p->vlv_sortkey= NULL;
p->vlv_filename= NULL;
p->vlv_mrpb= NULL;
- p->vlv_syntax_plugin= NULL;
p->vlv_indexlength_lock= PR_NewLock();
p->vlv_indexlength_cached= 0;
p->vlv_indexlength= 0;
@@ -572,7 +571,6 @@ vlvIndex_delete(struct vlvIndex** ppvs)
slapi_ch_free((void**)&((*ppvs)->vlv_name));
slapi_ch_free((void**)&((*ppvs)->vlv_filename));
slapi_ch_free((void**)&((*ppvs)->vlv_mrpb));
- slapi_ch_free((void**)&((*ppvs)->vlv_syntax_plugin));
PR_DestroyLock((*ppvs)->vlv_indexlength_lock);
slapi_ch_free((void**)ppvs);
*ppvs= NULL;
@@ -611,10 +609,8 @@ vlvIndex_init(struct vlvIndex* p, backend *be, struct vlvSearch* pSearch, const
int n;
for(n=0;p->vlv_sortkey[n]!=NULL;n++);
p->vlv_mrpb= (Slapi_PBlock**)slapi_ch_calloc(n+1,sizeof(Slapi_PBlock*));
- p->vlv_syntax_plugin= (void **)(Slapi_PBlock**)slapi_ch_calloc(n+1,sizeof(Slapi_PBlock*));
for(n=0;p->vlv_sortkey[n]!=NULL;n++)
{
- slapi_attr_type2plugin( p->vlv_sortkey[n]->sk_attrtype, &p->vlv_syntax_plugin[n] );
if(p->vlv_sortkey[n]->sk_matchruleoid!=NULL)
{
create_matchrule_indexer(&p->vlv_mrpb[n],p->vlv_sortkey[n]->sk_matchruleoid,p->vlv_sortkey[n]->sk_attrtype);
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.h b/ldap/servers/slapd/back-ldbm/vlv_srch.h
index e32cf88be..331dbf7da 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.h
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.h
@@ -106,9 +106,6 @@ struct vlvIndex
/* Attribute Structure maps filename onto index */
struct attrinfo *vlv_attrinfo;
- /* Syntax Plugin. One for each LDAPsortkey */
- void **vlv_syntax_plugin;
-
/* Matching Rule PBlock. One for each LDAPsortkey */
Slapi_PBlock **vlv_mrpb;
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 75b14979a..00558f728 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -465,10 +465,10 @@ typedef struct _str2entry_attr {
struct valuearrayfast sa_present_values;
struct valuearrayfast sa_deleted_values;
int sa_numdups;
- struct slapdplugin *sa_pi;
value_compare_fn_type sa_comparefn;
Avlnode *sa_vtree;
CSN *sa_attributedeletioncsn;
+ Slapi_Attr sa_attr;
} str2entry_attr;
static void
@@ -479,10 +479,10 @@ entry_attr_init(str2entry_attr *sa, const char *type, int state)
valuearrayfast_init(&sa->sa_present_values,NULL);
valuearrayfast_init(&sa->sa_deleted_values,NULL);
sa->sa_numdups= 0;
- sa->sa_pi= NULL;
sa->sa_comparefn = NULL;
sa->sa_vtree= NULL;
sa->sa_attributedeletioncsn= NULL;
+ slapi_attr_init(&sa->sa_attr, type);
}
/*
@@ -829,18 +829,8 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
if ( check_for_duplicate_values )
{
- if ( slapi_attr_type2plugin( type,(void **)&(attrs[nattrs].sa_pi) ) != 0 )
- {
- LDAPDebug( LDAP_DEBUG_ANY,
- "<= str2entry_dupcheck NULL (slapi_attr_type2plugin)\n",
- 0, 0, 0 );
- slapi_entry_free( e ); e = NULL;
- if (retmalloc) slapi_ch_free_string(&valuecharptr);
- if (freetype) slapi_ch_free_string(&type);
- goto free_and_return;
- }
/* Get the comparison function for later use */
- plugin_call_syntax_get_compare_fn( attrs[nattrs].sa_pi, &(attrs[nattrs].sa_comparefn));
+ attr_get_value_cmp_fn( &attrs[nattrs].sa_attr, &(attrs[nattrs].sa_comparefn));
/*
* If the compare function wasn't available,
* we have to revert to AVL-tree-based dup checking,
@@ -904,9 +894,9 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
if (sa->sa_present_values.num > STR2ENTRY_VALUE_DUPCHECK_THRESHOLD)
{
/* Make the tree from the existing attr values */
- rc= valuetree_add_valuearray( sa->sa_type, sa->sa_pi, sa->sa_present_values.va, &sa->sa_vtree, NULL);
+ rc= valuetree_add_valuearray( &sa->sa_attr, sa->sa_present_values.va, &sa->sa_vtree, NULL);
/* Check if the value already exists, in the tree. */
- rc= valuetree_add_value( sa->sa_type, sa->sa_pi, value, &sa->sa_vtree);
+ rc= valuetree_add_value( &sa->sa_attr, value, &sa->sa_vtree);
fast_dup_check = 0;
}
else
@@ -927,7 +917,7 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
else
{
/* Check if the value already exists, in the tree. */
- rc = valuetree_add_value( sa->sa_type, sa->sa_pi, value, &sa->sa_vtree);
+ rc = valuetree_add_value( &sa->sa_attr, value, &sa->sa_vtree);
}
}
@@ -1078,6 +1068,7 @@ free_and_return:
valuearrayfast_done(&attrs[ i ].sa_present_values);
valuearrayfast_done(&attrs[ i ].sa_deleted_values);
valuetree_free( &attrs[ i ].sa_vtree );
+ attr_done( &attrs[ i ].sa_attr );
}
if (tree_attr_checking)
{
diff --git a/ldap/servers/slapd/filtercmp.c b/ldap/servers/slapd/filtercmp.c
index 059168156..20a42a292 100644
--- a/ldap/servers/slapd/filtercmp.c
+++ b/ldap/servers/slapd/filtercmp.c
@@ -85,17 +85,15 @@ static PRUint32 stir(PRUint32 hash, PRUint32 x)
}
#define STIR(h) (h) = stir((h), 0x2EC6DEAD);
-static Slapi_Value **get_normalized_value(struct ava *ava)
+static Slapi_Value **get_normalized_value(const Slapi_Attr *sattr, struct ava *ava)
{
- void *plugin;
Slapi_Value *svlist[2], **keylist, sv;
- slapi_attr_type2plugin(ava->ava_type, &plugin);
sv.bv = ava->ava_value;
sv.v_csnset = NULL;
svlist[0] = &sv;
svlist[1] = NULL;
- if ((slapi_call_syntax_values2keys_sv(plugin, svlist, &keylist,
+ if ((slapi_attr_values2keys_sv(sattr, svlist, &keylist,
LDAP_FILTER_EQUALITY) != 0) ||
!keylist || !keylist[0])
return NULL;
@@ -168,6 +166,7 @@ void filter_compute_hash(struct slapi_filter *f)
Slapi_Value **keylist;
Slapi_PBlock *pb;
struct berval *inval[2], **outval;
+ Slapi_Attr sattr;
if (! hash_filters)
return;
@@ -178,7 +177,9 @@ void filter_compute_hash(struct slapi_filter *f)
case LDAP_FILTER_GE:
case LDAP_FILTER_LE:
case LDAP_FILTER_APPROX:
- keylist = get_normalized_value(&f->f_ava);
+ slapi_attr_init(&sattr, f->f_ava.ava_type);
+ keylist = get_normalized_value(&sattr, &f->f_ava);
+ attr_done(&sattr);
if (keylist) {
h = addhash_str(h, f->f_avtype);
STIR(h);
@@ -349,6 +350,7 @@ int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2)
Slapi_PBlock *pb1, *pb2;
struct berval *inval1[2], *inval2[2], **outval1, **outval2;
int ret;
+ Slapi_Attr sattr;
LDAPDebug(LDAP_DEBUG_TRACE, "=> filter compare\n", 0, 0, 0);
@@ -376,19 +378,22 @@ int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2)
ret = 1;
break;
}
- key1 = get_normalized_value(&f1->f_ava);
+ slapi_attr_init(&sattr, f1->f_ava.ava_type);
+ key1 = get_normalized_value(&sattr, &f1->f_ava);
if (key1) {
- key2 = get_normalized_value(&f2->f_ava);
+ key2 = get_normalized_value(&sattr, &f2->f_ava);
if (key2) {
ret = memcmp(slapi_value_get_string(key1[0]),
slapi_value_get_string(key2[0]),
slapi_value_get_length(key1[0]));
valuearray_free(&key1);
valuearray_free(&key2);
+ attr_done(&sattr);
break;
}
valuearray_free(&key1);
}
+ attr_done(&sattr);
ret = 1;
break;
case LDAP_FILTER_PRESENT:
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 20ead29a9..b5d994ade 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1094,7 +1094,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
}
(*(IFP *)value) = pblock->pb_plugin->plg_syntax_compare;
break;
- case SLAPI_SYNTAX_SUBSTRLENS:
+ case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
(*(int **)value) = pblock->pb_substrlens;
break;
case SLAPI_PLUGIN_SYNTAX_VALIDATE:
@@ -1376,6 +1376,56 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
(*(unsigned int *) value) = pblock->pb_mr_usage;
break;
+ /* new style matching rule syntax plugin functions */
+ case SLAPI_PLUGIN_MR_FILTER_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_ava;
+ break;
+ case SLAPI_PLUGIN_MR_FILTER_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_sub;
+ break;
+ case SLAPI_PLUGIN_MR_VALUES2KEYS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_values2keys;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_ava;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_sub;
+ break;
+ case SLAPI_PLUGIN_MR_FLAGS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(int *)value) = pblock->pb_plugin->plg_mr_flags;
+ break;
+ case SLAPI_PLUGIN_MR_NAMES:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(char ***)value) = pblock->pb_plugin->plg_mr_names;
+ break;
+ case SLAPI_PLUGIN_MR_COMPARE:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_compare;
+ break;
+
/* seq arguments */
case SLAPI_SEQ_TYPE:
(*(int *)value) = pblock->pb_seq_type;
@@ -2371,7 +2421,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
}
pblock->pb_plugin->plg_syntax_compare = (IFP) value;
break;
- case SLAPI_SYNTAX_SUBSTRLENS:
+ case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
pblock->pb_substrlens = (int *) value;
break;
case SLAPI_PLUGIN_SYNTAX_VALIDATE:
@@ -2699,6 +2749,56 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
pblock->pb_mr_usage = *(unsigned int *) value;
break;
+ /* new style matching rule syntax plugin functions */
+ case SLAPI_PLUGIN_MR_FILTER_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_filter_ava = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_FILTER_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_filter_sub = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_VALUES2KEYS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_values2keys = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_assertion2keys_ava = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_assertion2keys_sub = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_FLAGS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_flags = *((int *) value);
+ break;
+ case SLAPI_PLUGIN_MR_NAMES:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_names = (char **) value;
+ break;
+ case SLAPI_PLUGIN_MR_COMPARE:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_compare = (IFP) value;
+ break;
+
/* seq arguments */
case SLAPI_SEQ_TYPE:
pblock->pb_seq_type = *((int *)value);
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index fc07733cd..8f62a7a0f 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -65,8 +65,21 @@ slapi_get_global_mr_plugins()
return get_plugin_list(PLUGIN_LIST_MATCHINGRULE);
}
+struct slapdplugin *
+plugin_mr_find( const char *nameoroid )
+{
+ struct slapdplugin *pi;
+
+ for ( pi = get_plugin_list(PLUGIN_LIST_MATCHINGRULE); pi != NULL; pi = pi->plg_next ) {
+ if ( charray_inlist( pi->plg_mr_names, (char *)nameoroid ) ) {
+ break;
+ }
+ }
+ return ( pi );
+}
+
static struct slapdplugin*
-plugin_mr_find (char* oid)
+plugin_mr_find_registered (char* oid)
{
oid_item_t* i;
init_global_mr_lock();
@@ -77,11 +90,11 @@ plugin_mr_find (char* oid)
{
if (!strcasecmp (oid, i->oi_oid))
{
- LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find(%s) != NULL\n", oid, 0, 0);
+ LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find_registered(%s) != NULL\n", oid, 0, 0);
return i->oi_plugin;
}
}
- LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find(%s) == NULL\n", oid, 0, 0);
+ LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find_registered(%s) == NULL\n", oid, 0, 0);
return NULL;
}
@@ -108,7 +121,7 @@ slapi_mr_indexer_create (Slapi_PBlock* opb)
if (!(rc = slapi_pblock_get (opb, SLAPI_PLUGIN_MR_OID, &oid)))
{
IFP createFn = NULL;
- struct slapdplugin* mrp = plugin_mr_find (oid);
+ struct slapdplugin* mrp = plugin_mr_find_registered (oid);
if (mrp != NULL)
{
if (!(rc = slapi_pblock_set (opb, SLAPI_PLUGIN, mrp)) &&
@@ -172,7 +185,7 @@ int /* an LDAP error code, hopefully LDAP_SUCCESS */
plugin_mr_filter_create (mr_filter_t* f)
{
int rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
- struct slapdplugin* mrp = plugin_mr_find (f->mrf_oid);
+ struct slapdplugin* mrp = plugin_mr_find_registered (f->mrf_oid);
Slapi_PBlock pb;
if (mrp != NULL)
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index e2cc7fb1b..80ce12a75 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -89,7 +89,10 @@ slapi_get_global_syntax_plugins()
char *
plugin_syntax2oid( struct slapdplugin *pi )
{
- return( pi->plg_syntax_oid );
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "the function plugin_syntax2oid is deprecated - please use attr_get_syntax_oid instead\n", 0, 0, 0);
+ PR_ASSERT(0);
+ return( NULL );
}
int
@@ -98,37 +101,9 @@ plugin_call_syntax_get_compare_fn(
value_compare_fn_type *compare_fn
)
{
- struct slapdplugin *pi = vpi;
- *compare_fn = NULL;
-
- LDAPDebug( LDAP_DEBUG_TRACE,
- "=> plugin_call_syntax_get_compare_fn\n",0,0, 0 );
-
- if ( pi == NULL ) {
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= plugin_syntax no plugin for attribute type\n",
- 0, 0, 0 );
- return( LDAP_PROTOCOL_ERROR ); /* syntax unkonwn */
- }
-
- if ( (pi->plg_syntax_flags & SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING) == 0 ) {
- return( LDAP_PROTOCOL_ERROR );
- }
-
- if (pi->plg_syntax_filter_ava == NULL) {
- LDAPDebug( LDAP_DEBUG_ANY, "<= plugin_call_syntax_get_compare_fn: "
- "no filter_ava found for attribute type\n", 0, 0, 0 );
- return( LDAP_PROTOCOL_ERROR );
- }
-
- if (pi->plg_syntax_compare == NULL) {
- return( LDAP_PROTOCOL_ERROR );
- }
-
- *compare_fn = (value_compare_fn_type) pi->plg_syntax_compare;
-
- LDAPDebug( LDAP_DEBUG_TRACE,
- "<= plugin_call_syntax_get_compare_fn \n", 0, 0, 0 );
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "the function plugin_call_syntax_get_compare_fn is deprecated - please use attr_get_value_cmp_fn instead\n", 0, 0, 0);
+ PR_ASSERT(0);
return( 0 );
}
@@ -153,14 +128,15 @@ plugin_call_syntax_filter_ava_sv(
{
int rc;
Slapi_PBlock pipb;
+ IFP ava_fn = NULL;
LDAPDebug( LDAP_DEBUG_FILTER,
"=> plugin_call_syntax_filter_ava %s=%s\n", ava->ava_type,
ava->ava_value.bv_val, 0 );
- if ( a->a_plugin == NULL ) {
+ if ( ( a->a_mr_eq_plugin == NULL ) && ( a->a_mr_ord_plugin == NULL ) && ( a->a_plugin == NULL ) ) {
LDAPDebug( LDAP_DEBUG_FILTER,
- "<= plugin_syntax no plugin for attr (%s)\n",
+ "<= plugin_call_syntax_filter_ava no plugin for attr (%s)\n",
a->a_type, 0, 0 );
return( LDAP_PROTOCOL_ERROR ); /* syntax unkonwn */
}
@@ -172,33 +148,58 @@ plugin_call_syntax_filter_ava_sv(
switch ( ftype ) {
case LDAP_FILTER_GE:
case LDAP_FILTER_LE:
- if ( (a->a_plugin->plg_syntax_flags &
- SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING) == 0 ) {
+ if ((a->a_mr_ord_plugin == NULL) &&
+ ((a->a_plugin->plg_syntax_flags &
+ SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING) == 0)) {
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "<= plugin_call_syntax_filter_ava: attr (%s) has no ordering matching rule, and syntax does not define a compare function\n",
+ a->a_type, 0, 0 );
rc = LDAP_PROTOCOL_ERROR;
break;
}
+ /* if the attribute has an ordering matching rule plugin, use that,
+ otherwise, just use the syntax plugin */
+ if (a->a_mr_ord_plugin != NULL) {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_mr_ord_plugin );
+ ava_fn = a->a_mr_ord_plugin->plg_mr_filter_ava;
+ } else {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_plugin );
+ ava_fn = a->a_plugin->plg_syntax_filter_ava;
+ }
/* FALL */
case LDAP_FILTER_EQUALITY:
case LDAP_FILTER_APPROX:
- if ( a->a_plugin->plg_syntax_filter_ava != NULL )
- {
+ if (NULL == ava_fn) {
+ /* if we have an equality matching rule plugin, use that,
+ otherwise, just use the syntax plugin */
+ if (a->a_mr_eq_plugin) {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_mr_eq_plugin );
+ ava_fn = a->a_mr_eq_plugin->plg_mr_filter_ava;
+ } else {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_plugin );
+ ava_fn = a->a_plugin->plg_syntax_filter_ava;
+ }
+ }
+
+ if ( ava_fn != NULL ) {
/* JCM - Maybe the plugin should use the attr value iterator too... */
Slapi_Value **va;
- if(useDeletedValues)
+ if(useDeletedValues) {
va= valueset_get_valuearray(&a->a_deleted_values);
- else
+ } else {
va= valueset_get_valuearray(&a->a_present_values);
- if(va!=NULL)
- {
- rc = a->a_plugin->plg_syntax_filter_ava( &pipb,
- &ava->ava_value,
- va,
- ftype, retVal );
}
+ if(va!=NULL) {
+ rc = (*ava_fn)( &pipb, &ava->ava_value, va, ftype, retVal );
+ }
+ } else {
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "<= plugin_call_syntax_filter_ava: attr (%s) has no ava filter function\n",
+ a->a_type, 0, 0 );
}
break;
default:
- LDAPDebug( LDAP_DEBUG_ANY, "plugin_call_syntax_filter: "
+ LDAPDebug( LDAP_DEBUG_ANY, "plugin_call_syntax_filter_ava: "
"unknown filter type %d\n", ftype, 0, 0 );
rc = LDAP_PROTOCOL_ERROR;
break;
@@ -228,20 +229,32 @@ plugin_call_syntax_filter_sub_sv(
{
Slapi_PBlock pipb;
int rc;
+ IFP sub_fn = NULL;
LDAPDebug( LDAP_DEBUG_FILTER,
- "=> plugin_call_syntax_filter_sub\n", 0, 0, 0 );
+ "=> plugin_call_syntax_filter_sub_sv\n", 0, 0, 0 );
- if ( a->a_plugin == NULL ) {
+ if ( ( a->a_mr_sub_plugin == NULL ) && ( a->a_plugin == NULL ) ) {
LDAPDebug( LDAP_DEBUG_FILTER,
- "<= plugin_call_syntax_filter no plugin\n", 0, 0, 0 );
+ "<= plugin_call_syntax_filter_sub_sv attribute (%s) has no substring matching rule or syntax plugin\n",
+ a->a_type, 0, 0 );
return( -1 ); /* syntax unkonwn - does not match */
}
- if ( a->a_plugin->plg_syntax_filter_sub != NULL )
+ pblock_init( &pipb );
+ /* use the substr matching rule plugin if available, otherwise, use
+ the syntax plugin */
+ if (a->a_mr_sub_plugin) {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_mr_sub_plugin );
+ sub_fn = a->a_mr_sub_plugin->plg_mr_filter_sub;
+ } else {
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_plugin );
+ sub_fn = a->a_plugin->plg_syntax_filter_sub;
+ }
+
+ if ( sub_fn != NULL )
{
Slapi_Value **va= valueset_get_valuearray(&a->a_present_values);
- pblock_init( &pipb );
if (pb)
{
Operation *op = NULL;
@@ -249,9 +262,7 @@ plugin_call_syntax_filter_sub_sv(
slapi_pblock_get( pb, SLAPI_OPERATION, &op );
slapi_pblock_set( &pipb, SLAPI_OPERATION, op );
}
- slapi_pblock_set( &pipb, SLAPI_PLUGIN, (void *) a->a_plugin );
- rc = a->a_plugin->plg_syntax_filter_sub( &pipb,
- fsub->sf_initial, fsub->sf_any, fsub->sf_final, va);
+ rc = (*sub_fn)( &pipb, fsub->sf_initial, fsub->sf_any, fsub->sf_final, va);
} else {
rc = -1;
}
@@ -554,6 +565,95 @@ slapi_call_syntax_values2keys_sv(
return( rc );
}
+int
+slapi_attr_values2keys_sv_pb(
+ const Slapi_Attr *sattr,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype,
+ Slapi_PBlock *pb
+)
+{
+ int rc;
+ struct slapdplugin *pi = NULL;
+ IFP v2k_fn = NULL;
+
+ LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_attr_values2keys_sv\n",
+ 0, 0, 0 );
+
+ switch (ftype) {
+ case LDAP_FILTER_EQUALITY:
+ case LDAP_FILTER_APPROX:
+ if (sattr->a_mr_eq_plugin) {
+ pi = sattr->a_mr_eq_plugin;
+ v2k_fn = sattr->a_mr_eq_plugin->plg_mr_values2keys;
+ } else if (sattr->a_plugin) {
+ pi = sattr->a_plugin;
+ v2k_fn = sattr->a_plugin->plg_syntax_values2keys;
+ }
+ break;
+ case LDAP_FILTER_SUBSTRINGS:
+ if (sattr->a_mr_sub_plugin) {
+ pi = sattr->a_mr_sub_plugin;
+ v2k_fn = sattr->a_mr_sub_plugin->plg_mr_values2keys;
+ } else if (sattr->a_plugin) {
+ pi = sattr->a_plugin;
+ v2k_fn = sattr->a_plugin->plg_syntax_values2keys;
+ }
+ break;
+ default:
+ LDAPDebug( LDAP_DEBUG_ANY, "<= slapi_attr_values2keys_sv: ERROR: unsupported filter type %d\n",
+ ftype, 0, 0 );
+ rc = LDAP_PROTOCOL_ERROR;
+ goto done;
+ }
+
+ slapi_pblock_set( pb, SLAPI_PLUGIN, pi );
+
+ *ivals = NULL;
+ rc = -1; /* means no values2keys function */
+ if ( ( pi != NULL ) && ( v2k_fn != NULL ) ) {
+ rc = (*v2k_fn)( pb, vals, ivals, ftype );
+ }
+
+done:
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "<= slapi_call_syntax_values2keys %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+int
+slapi_attr_values2keys_sv(
+ const Slapi_Attr *sattr,
+ Slapi_Value **vals,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ Slapi_PBlock pb;
+ pblock_init(&pb);
+ return slapi_attr_values2keys_sv_pb(sattr, vals, ivals, ftype, &pb);
+}
+
+SLAPI_DEPRECATED int
+slapi_attr_values2keys( /* JCM SLOW FUNCTION */
+ const Slapi_Attr *sattr,
+ struct berval **vals,
+ struct berval ***ivals,
+ int ftype
+)
+{
+ int rc;
+ Slapi_Value **svin= NULL;
+ Slapi_Value **svout= NULL;
+ valuearray_init_bervalarray(vals,&svin); /* JCM SLOW FUNCTION */
+ rc= slapi_attr_values2keys_sv(sattr,svin,&svout,ftype);
+ valuearray_get_bervalarray(svout,ivals); /* JCM SLOW FUNCTION */
+ valuearray_free(&svout);
+ valuearray_free(&svin);
+ return rc;
+}
+
/*
* almost identical to slapi_call_syntax_values2keys_sv except accepting
* pblock to pass some info such as substrlen.
@@ -633,6 +733,73 @@ slapi_call_syntax_assertion2keys_ava_sv(
return( rc );
}
+int
+slapi_attr_assertion2keys_ava_sv(
+ const Slapi_Attr *sattr,
+ Slapi_Value *val,
+ Slapi_Value ***ivals,
+ int ftype
+)
+{
+ int rc;
+ Slapi_PBlock pipb;
+ struct slapdplugin *pi = NULL;
+ IFP a2k_fn = NULL;
+
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "=> slapi_attr_assertion2keys_ava_sv\n", 0, 0, 0 );
+
+ switch (ftype) {
+ case LDAP_FILTER_EQUALITY:
+ case LDAP_FILTER_APPROX:
+ case LDAP_FILTER_EQUALITY_FAST:
+ if (sattr->a_mr_eq_plugin) {
+ pi = sattr->a_mr_eq_plugin;
+ a2k_fn = sattr->a_mr_eq_plugin->plg_mr_assertion2keys_ava;
+ } else if (sattr->a_plugin) {
+ pi = sattr->a_plugin;
+ a2k_fn = sattr->a_plugin->plg_syntax_assertion2keys_ava;
+ }
+ break;
+ default:
+ LDAPDebug( LDAP_DEBUG_ANY, "<= slapi_attr_assertion2keys_ava_sv: ERROR: unsupported filter type %d\n",
+ ftype, 0, 0 );
+ rc = LDAP_PROTOCOL_ERROR;
+ goto done;
+ }
+
+ pblock_init( &pipb );
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, pi );
+
+ rc = -1; /* means no assertion2keys function */
+ if ( a2k_fn != NULL ) {
+ rc = (*a2k_fn)( &pipb, val, ivals, ftype );
+ }
+done:
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "<= slapi_attr_assertion2keys_ava_sv %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+SLAPI_DEPRECATED int
+slapi_attr_assertion2keys_ava( /* JCM SLOW FUNCTION */
+ const Slapi_Attr *sattr,
+ struct berval *val,
+ struct berval ***ivals,
+ int ftype
+)
+{
+ int rc;
+ Slapi_Value svin;
+ Slapi_Value **svout= NULL;
+ slapi_value_init_berval(&svin, val);
+ rc= slapi_attr_assertion2keys_ava_sv(sattr,&svin,&svout,ftype);
+ valuearray_get_bervalarray(svout,ivals); /* JCM SLOW FUNCTION */
+ valuearray_free(&svout);
+ value_done(&svin);
+ return rc;
+}
+
SLAPI_DEPRECATED int
slapi_call_syntax_assertion2keys_sub( /* JCM SLOW FUNCTION */
void *vpi,
@@ -681,3 +848,57 @@ slapi_call_syntax_assertion2keys_sub_sv(
return( rc );
}
+int
+slapi_attr_assertion2keys_sub_sv(
+ const Slapi_Attr *sattr,
+ char *initial,
+ char **any,
+ char *final,
+ Slapi_Value ***ivals
+)
+{
+ int rc;
+ Slapi_PBlock pipb;
+ struct slapdplugin *pi = NULL;
+ IFP a2k_fn = NULL;
+
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "=> slapi_attr_assertion2keys_sub_sv\n", 0, 0, 0 );
+
+ if (sattr->a_mr_sub_plugin) {
+ pi = sattr->a_mr_sub_plugin;
+ a2k_fn = sattr->a_mr_sub_plugin->plg_mr_assertion2keys_sub;
+ } else if (sattr->a_plugin) {
+ pi = sattr->a_plugin;
+ a2k_fn = sattr->a_plugin->plg_syntax_assertion2keys_sub;
+ }
+ pblock_init( &pipb );
+ slapi_pblock_set( &pipb, SLAPI_PLUGIN, pi );
+
+ rc = -1; /* means no assertion2keys function */
+ *ivals = NULL;
+ if ( a2k_fn != NULL ) {
+ rc = (*a2k_fn)( &pipb, initial, any, final, ivals );
+ }
+
+ LDAPDebug( LDAP_DEBUG_FILTER,
+ "<= slapi_attr_assertion2keys_sub_sv %d\n", rc, 0, 0 );
+ return( rc );
+}
+
+SLAPI_DEPRECATED int
+slapi_attr_assertion2keys_sub( /* JCM SLOW FUNCTION */
+ const Slapi_Attr *sattr,
+ char *initial,
+ char **any,
+ char *final,
+ struct berval ***ivals
+)
+{
+ int rc;
+ Slapi_Value **svout= NULL;
+ rc= slapi_attr_assertion2keys_sub_sv(sattr,initial,any,final,&svout);
+ valuearray_get_bervalarray(svout,ivals); /* JCM SLOW FUNCTION */
+ valuearray_free(&svout);
+ return rc;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index feca39a67..9133958cf 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -69,6 +69,27 @@ int attr_add_valuearray(Slapi_Attr *a, Slapi_Value **vals, const char *dn);
int attr_replace(Slapi_Attr *a, Slapi_Value **vals);
int attr_check_onoff ( const char *attr_name, char *value, long minval, long maxval, char *errorbuf );
int attr_check_minmax ( const char *attr_name, char *value, long minval, long maxval, char *errorbuf );
+/**
+ * Returns the function which can be used to compare (like memcmp/strcmp)
+ * two values of this type of attribute. The comparison function will use
+ * the ORDERING matching rule if available, or the default comparison
+ * function from the syntax plugin.
+ * Note: if there is no ORDERING matching rule, and the syntax does not
+ * provide an ordered compare function, this function will return
+ * LDAP_PROTOCOL_ERROR and compare_fn will be NULL.
+ * Returns LDAP_SUCCESS if successful and sets *compare_fn to the function.
+ *
+ * \param attr The attribute to use
+ * \param compare_fn address of function pointer to set to the function to use
+ * \return LDAP_SUCCESS - success
+ * LDAP_PARAM_ERROR - attr is NULL
+ * LDAP_PROTOCOL_ERROR - attr does not support an ordering compare function
+ * \see value_compare_fn_type
+ */
+int attr_get_value_cmp_fn(const Slapi_Attr *attr, value_compare_fn_type *compare_fn);
+/* return the OID of the syntax for this attribute */
+const char *attr_get_syntax_oid(const Slapi_Attr *attr);
+
/*
* attrlist.c
@@ -145,8 +166,8 @@ void valuearrayfast_add_value(struct valuearrayfast *vaf,const Slapi_Value *v);
void valuearrayfast_add_value_passin(struct valuearrayfast *vaf,Slapi_Value *v);
void valuearrayfast_add_valuearrayfast(struct valuearrayfast *vaf,const struct valuearrayfast *vaf_add);
-int valuetree_add_value( const char *type, struct slapdplugin *pi, const Slapi_Value *va, Avlnode **valuetreep);
-int valuetree_add_valuearray( const char *type, struct slapdplugin *pi, Slapi_Value **va, Avlnode **valuetreep, int *duplicate_index);
+int valuetree_add_value( const Slapi_Attr *sattr, const Slapi_Value *va, Avlnode **valuetreep);
+int valuetree_add_valuearray( const Slapi_Attr *sattr, Slapi_Value **va, Avlnode **valuetreep, int *duplicate_index);
void valuetree_free( Avlnode **valuetreep );
/* Valueset functions */
@@ -779,6 +800,7 @@ void plugin_print_lists(void);
*/
struct slapdplugin *slapi_get_global_mr_plugins();
int plugin_mr_filter_create (mr_filter_t* f);
+struct slapdplugin *plugin_mr_find( const char *nameoroid );
/*
* plugin_syntax.c
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 98224df61..dadc307d3 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -1180,7 +1180,7 @@ schema_attr_enum_callback(struct asyntaxinfo *asip, void *arg)
}
}
- syntaxoid = plugin_syntax2oid(asip->asi_plugin);
+ syntaxoid = asip->asi_plugin->plg_syntax_oid;
if ( !aew->schema_ds4x_compat &&
asip->asi_syntaxlength != SLAPI_SYNTAXLENGTH_NONE ) {
@@ -3410,7 +3410,7 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
/* We only want to use the parent syntax if a SYNTAX
* wasn't explicitly specified for this attribute. */
} else if (NULL == pSyntax) {
- char *pso = plugin_syntax2oid(asi_parent->asi_plugin);
+ char *pso = asi_parent->asi_plugin->plg_syntax_oid;
if (pso) {
slapi_ch_free ((void **)&pSyntax);
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 08de2c15b..9dea45257 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -453,11 +453,14 @@ struct slapi_attr {
char *a_type;
struct slapi_value_set a_present_values;
unsigned long a_flags; /* SLAPI_ATTR_FLAG_... */
- struct slapdplugin *a_plugin;
+ struct slapdplugin *a_plugin; /* for the attribute syntax */
struct slapi_value_set a_deleted_values;
struct bervals2free *a_listtofree; /* JCM: EVIL... For DS4 Slapi compatibility. */
struct slapi_attr *a_next;
CSN *a_deletioncsn; /* The point in time at which this attribute was last deleted */
+ struct slapdplugin *a_mr_eq_plugin; /* for the attribute EQUALITY matching rule, if any */
+ struct slapdplugin *a_mr_ord_plugin; /* for the attribute ORDERING matching rule, if any */
+ struct slapdplugin *a_mr_sub_plugin; /* for the attribute SUBSTRING matching rule, if any */
};
typedef struct oid_item {
@@ -482,6 +485,9 @@ typedef struct asyntaxinfo {
int asi_syntaxlength; /* length associated w/syntax */
int asi_refcnt; /* outstanding references */
PRBool asi_marked_for_delete; /* delete at next opportunity */
+ 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 */
} asyntaxinfo;
/*
@@ -982,9 +988,28 @@ struct slapdplugin {
struct plg_un_matching_rule {
IFP plg_un_mr_filter_create; /* factory function */
IFP plg_un_mr_indexer_create; /* factory function */
+ /* new style syntax plugin functions */
+ /* not all functions will apply to all matching rule types */
+ /* e.g. a SUBSTR rule will not have a filter_ava func */
+ IFP plg_un_mr_filter_ava;
+ IFP plg_un_mr_filter_sub;
+ IFP plg_un_mr_values2keys;
+ IFP plg_un_mr_assertion2keys_ava;
+ IFP plg_un_mr_assertion2keys_sub;
+ int plg_un_mr_flags;
+ char **plg_un_mr_names;
+ IFP plg_un_mr_compare; /* only for ORDERING */
} plg_un_mr;
#define plg_mr_filter_create plg_un.plg_un_mr.plg_un_mr_filter_create
#define plg_mr_indexer_create plg_un.plg_un_mr.plg_un_mr_indexer_create
+#define plg_mr_filter_ava plg_un.plg_un_mr.plg_un_mr_filter_ava
+#define plg_mr_filter_sub plg_un.plg_un_mr.plg_un_mr_filter_sub
+#define plg_mr_values2keys plg_un.plg_un_mr.plg_un_mr_values2keys
+#define plg_mr_assertion2keys_ava plg_un.plg_un_mr.plg_un_mr_assertion2keys_ava
+#define plg_mr_assertion2keys_sub plg_un.plg_un_mr.plg_un_mr_assertion2keys_sub
+#define plg_mr_flags plg_un.plg_un_mr.plg_un_mr_flags
+#define plg_mr_names plg_un.plg_un_mr.plg_un_mr_names
+#define plg_mr_compare plg_un.plg_un_mr.plg_un_mr_compare
/* syntax plugin structure */
struct plg_un_syntax_struct {
diff --git a/ldap/servers/slapd/slapi-plugin-compat4.h b/ldap/servers/slapd/slapi-plugin-compat4.h
index d54cc7d13..17f35260b 100644
--- a/ldap/servers/slapd/slapi-plugin-compat4.h
+++ b/ldap/servers/slapd/slapi-plugin-compat4.h
@@ -106,6 +106,12 @@ SLAPI_DEPRECATED int slapi_call_syntax_assertion2keys_ava( void *vpi,
struct berval *val, struct berval ***ivals, int ftype );
SLAPI_DEPRECATED int slapi_call_syntax_assertion2keys_sub( void *vpi,
char *initial, char **any, char *final, struct berval ***ivals );
+SLAPI_DEPRECATED int slapi_attr_values2keys( const Slapi_Attr *sattr,
+ struct berval **vals, struct berval ***ivals, int ftype );
+SLAPI_DEPRECATED int slapi_attr_assertion2keys_ava( const Slapi_Attr *sattr,
+ struct berval *val, struct berval ***ivals, int ftype );
+SLAPI_DEPRECATED int slapi_attr_assertion2keys_sub( const Slapi_Attr *sattr,
+ char *initial, char **any, char *final, struct berval ***ivals );
/*
* slapi_entry_attr_hasvalue() has been deprecated in favor of
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 09cc9d464..6ced381ec 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -3263,6 +3263,11 @@ int slapi_attr_add_value(Slapi_Attr *a, const Slapi_Value *v);
* \param pi Address to receive a pointer to the plugin structure.
* \return \c 0 if successful.
* \return \c -1 if the plugin is not found.
+ * \deprecated This function was necessary in order to call syntax plugin
+ * filter and indexing functions - there are new functions
+ * to use instead, such as slapi_attr_values2keys, etc.
+ * This function is still used by internal APIs, but new
+ * code should not use this function
* \see slapi_attr_get_type()
* \see slapi_attr_type_cmp()
* \see slapi_attr_types_equivalent()
@@ -3586,7 +3591,6 @@ int slapi_attr_get_bervals_copy( Slapi_Attr *a, struct berval ***vals );
*/
char * slapi_attr_syntax_normalize( const char *s );
-
/*
* value routines
*/
@@ -4726,6 +4730,9 @@ char * slapi_ch_smprintf(const char *fmt, ...)
/*
* syntax plugin routines
+ * THESE ARE DEPRECATED - the first argument is the syntax plugin
+ * we do not support that style of call anymore - use the slapi_attr_
+ * versions below instead
*/
int slapi_call_syntax_values2keys_sv( void *vpi, Slapi_Value **vals,
Slapi_Value ***ivals, int ftype );
@@ -4736,6 +4743,15 @@ int slapi_call_syntax_assertion2keys_ava_sv( void *vpi, Slapi_Value *val,
int slapi_call_syntax_assertion2keys_sub_sv( void *vpi, char *initial,
char **any, char *final, Slapi_Value ***ivals );
+int slapi_attr_values2keys_sv( const Slapi_Attr *sattr, Slapi_Value **vals,
+ Slapi_Value ***ivals, int ftype );
+int slapi_attr_values2keys_sv_pb( const Slapi_Attr *sattr, Slapi_Value **vals,
+ Slapi_Value ***ivals, int ftype, Slapi_PBlock *pb );
+int slapi_attr_assertion2keys_ava_sv( const Slapi_Attr *sattr, Slapi_Value *val,
+ Slapi_Value ***ivals, int ftype );
+int slapi_attr_assertion2keys_sub_sv( const Slapi_Attr *sattr, char *initial,
+ char **any, char *final, Slapi_Value ***ivals );
+
/*
* internal operation and plugin callback routines
@@ -5450,7 +5466,15 @@ typedef struct slapi_plugindesc {
#define SLAPI_PLUGIN_MR_FILTER_REUSABLE 615
#define SLAPI_PLUGIN_MR_QUERY_OPERATOR 616
#define SLAPI_PLUGIN_MR_USAGE 617
-
+/* new style matching rule syntax plugin functions */
+#define SLAPI_PLUGIN_MR_FILTER_AVA 618
+#define SLAPI_PLUGIN_MR_FILTER_SUB 619
+#define SLAPI_PLUGIN_MR_VALUES2KEYS 620
+#define SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA 621
+#define SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB 622
+#define SLAPI_PLUGIN_MR_FLAGS 623
+#define SLAPI_PLUGIN_MR_NAMES 624
+#define SLAPI_PLUGIN_MR_COMPARE 625
/* Defined values of SLAPI_PLUGIN_MR_QUERY_OPERATOR: */
#define SLAPI_OP_LESS 1
@@ -5484,6 +5508,7 @@ typedef struct slapi_plugindesc {
/* user defined substrlen; not stored in slapdplugin, but pblock itself */
#define SLAPI_SYNTAX_SUBSTRLENS 709
+#define SLAPI_MR_SUBSTRLENS SLAPI_SYNTAX_SUBSTRLENS /* alias */
#define SLAPI_PLUGIN_SYNTAX_VALIDATE 710
/* ACL plugin functions and arguments */
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 7334a7a08..a9cd37ee2 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -616,12 +616,11 @@ typedef struct valuetree_node
* and *valuetreep is set to NULL.
*/
int
-valuetree_add_valuearray( const char *type, struct slapdplugin *pi, Slapi_Value **va, Avlnode **valuetreep, int *duplicate_index )
+valuetree_add_valuearray( const Slapi_Attr *sattr, Slapi_Value **va, Avlnode **valuetreep, int *duplicate_index )
{
int rc= LDAP_SUCCESS;
- PR_ASSERT(type!=NULL);
- PR_ASSERT(pi!=NULL);
+ PR_ASSERT(sattr!=NULL);
PR_ASSERT(valuetreep!=NULL);
if ( duplicate_index ) {
@@ -632,9 +631,9 @@ valuetree_add_valuearray( const char *type, struct slapdplugin *pi, Slapi_Value
{
Slapi_Value **keyvals;
/* Convert the value array into key values */
- if ( slapi_call_syntax_values2keys_sv( pi, (Slapi_Value**)va, &keyvals, LDAP_FILTER_EQUALITY ) != 0 ) /* jcm cast */
+ if ( slapi_attr_values2keys_sv( sattr, (Slapi_Value**)va, &keyvals, LDAP_FILTER_EQUALITY ) != 0 ) /* jcm cast */
{
- LDAPDebug( LDAP_DEBUG_ANY,"slapi_call_syntax_values2keys for attribute %s failed\n", type, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_ANY,"slapi_attr_values2keys_sv for attribute %s failed\n", sattr->a_type, 0, 0 );
rc= LDAP_OPERATIONS_ERROR;
}
else
@@ -645,7 +644,7 @@ valuetree_add_valuearray( const char *type, struct slapdplugin *pi, Slapi_Value
{
if ( keyvals[i] == NULL )
{
- LDAPDebug( LDAP_DEBUG_ANY,"slapi_call_syntax_values2keys for attribute %s did not return enough key values\n", type, 0, 0 );
+ LDAPDebug( LDAP_DEBUG_ANY,"slapi_attr_values2keys_sv for attribute %s did not return enough key values\n", sattr->a_type, 0, 0 );
rc= LDAP_OPERATIONS_ERROR;
}
else
@@ -685,12 +684,12 @@ valuetree_add_valuearray( const char *type, struct slapdplugin *pi, Slapi_Value
}
int
-valuetree_add_value( const char *type, struct slapdplugin *pi, const Slapi_Value *v, Avlnode **valuetreep)
+valuetree_add_value( const Slapi_Attr *sattr, const Slapi_Value *v, Avlnode **valuetreep)
{
Slapi_Value *va[2];
va[0]= (Slapi_Value*)v;
va[1]= NULL;
- return valuetree_add_valuearray( type, pi, va, valuetreep, NULL);
+ return valuetree_add_valuearray( sattr, va, valuetreep, NULL);
}
@@ -714,7 +713,7 @@ valuetree_find( const struct slapi_attr *a, const Slapi_Value *v, Avlnode *value
PR_ASSERT(valuetree!=NULL);
PR_ASSERT(index!=NULL);
- if ( a == NULL || a->a_plugin == NULL || v == NULL || valuetree == NULL )
+ if ( a == NULL || v == NULL || valuetree == NULL )
{
return( LDAP_OPERATIONS_ERROR );
}
@@ -722,12 +721,12 @@ valuetree_find( const struct slapi_attr *a, const Slapi_Value *v, Avlnode *value
keyvals = NULL;
oneval[0] = v;
oneval[1] = NULL;
- if ( slapi_call_syntax_values2keys_sv( a->a_plugin, (Slapi_Value**)oneval, &keyvals, LDAP_FILTER_EQUALITY ) != 0 /* jcm cast */
+ if ( slapi_attr_values2keys_sv( a, (Slapi_Value**)oneval, &keyvals, LDAP_FILTER_EQUALITY ) != 0 /* jcm cast */
|| keyvals == NULL
|| keyvals[0] == NULL )
{
LDAPDebug( LDAP_DEBUG_ANY, "valuetree_find_and_replace: "
- "slapi_call_syntax_values2keys failed for type %s\n",
+ "slapi_attr_values2keys_sv failed for type %s\n",
a->a_type, 0, 0 );
return( LDAP_OPERATIONS_ERROR );
}
@@ -1104,7 +1103,7 @@ valueset_remove_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slapi_Value
*/
Avlnode *vtree = NULL;
int numberofexistingvalues= slapi_valueset_count(vs);
- rc= valuetree_add_valuearray( a->a_type, a->a_plugin, vs->va, &vtree, NULL );
+ rc= valuetree_add_valuearray( a, vs->va, &vtree, NULL );
if ( rc!=LDAP_SUCCESS )
{
/*
@@ -1286,14 +1285,14 @@ valueset_intersectswith_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slap
* Several values to add: use an AVL tree to detect duplicates.
*/
Avlnode *vtree = NULL;
- rc= valuetree_add_valuearray( a->a_type, a->a_plugin, vs->va, &vtree, duplicate_index );
+ rc= valuetree_add_valuearray( a, vs->va, &vtree, duplicate_index );
if(rc==LDAP_OPERATIONS_ERROR)
{
/* There were already duplicate values in the value set */
}
else
{
- rc= valuetree_add_valuearray( a->a_type, a->a_plugin, values, &vtree, duplicate_index );
+ rc= valuetree_add_valuearray( a, values, &vtree, duplicate_index );
/*
* Returns LDAP_OPERATIONS_ERROR if something very bad happens.
* Or LDAP_TYPE_OR_VALUE_EXISTS if a value already exists.
@@ -1356,7 +1355,7 @@ valueset_replace(Slapi_Attr *a, Slapi_ValueSet *vs, Slapi_Value **valstoreplace)
if (numberofvalstoreplace > 1)
{
Avlnode *vtree = NULL;
- rc = valuetree_add_valuearray( a->a_type, a->a_plugin, valstoreplace, &vtree, NULL );
+ rc = valuetree_add_valuearray( a, valstoreplace, &vtree, NULL );
valuetree_free(&vtree);
if ( LDAP_SUCCESS != rc &&
/* bz 247413: don't override LDAP_TYPE_OR_VALUE_EXISTS */
@@ -1396,7 +1395,7 @@ valueset_update_csn_for_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slap
{
int i;
Avlnode *vtree = NULL;
- int rc= valuetree_add_valuearray( a->a_type, a->a_plugin, vs->va, &vtree, NULL );
+ int rc= valuetree_add_valuearray( a, vs->va, &vtree, NULL );
PR_ASSERT(rc==LDAP_SUCCESS);
for (i=0;valuestoupdate[i]!=NULL;++i)
{
| 0 |
a274ac82b315947515fce84b2823eca2f8a8c3df
|
389ds/389-ds-base
|
Ticket 47848 - Add new function to create ldif files
Description: Add function to create simple ldif files and set the
owner and permissions as necessary
https://fedorahosted.org/389/ticket/48248
Reviewed by: rmeggins(Thanks!)
|
commit a274ac82b315947515fce84b2823eca2f8a8c3df
Author: Mark Reynolds <[email protected]>
Date: Thu Aug 13 16:12:23 2015 -0400
Ticket 47848 - Add new function to create ldif files
Description: Add function to create simple ldif files and set the
owner and permissions as necessary
https://fedorahosted.org/389/ticket/48248
Reviewed by: rmeggins(Thanks!)
diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py
index c5a23598a..111b74e36 100644
--- a/src/lib389/lib389/__init__.py
+++ b/src/lib389/lib389/__init__.py
@@ -21,6 +21,7 @@ import sys
import os
import stat
import pwd
+import grp
import os.path
import base64
import urllib
@@ -2334,4 +2335,24 @@ class DirSrv(SimpleLDAPObject):
self.set_option(ldap.OPT_SERVER_CONTROLS, [])
return ldap_result
+ def buildLDIF(self, num, ldif_file, suffix='dc=example,dc=com'):
+ """Generate a simple ldif file using the dbgen.pl script, and set the
+ ownership and permissions to match the user that the server runs as.
+ @param num - number of entries to create
+ @param ldif_file - ldif file name(including the path)
+ @suffix - DN of the parent entry in the ldif file
+ @return - nothing
+ @raise - OSError
+ """
+ try:
+ os.system('dbgen.pl -s %s -n %d -o %s' % (suffix, num, ldif_file))
+ os.chmod(ldif_file, 0o644)
+ if os.getuid() == 0:
+ # root user - chown the ldif to the server user
+ uid = pwd.getpwnam(self.userid).pw_uid
+ gid = grp.getgrnam(self.userid).gr_gid
+ os.chown(ldif_file, uid, gid)
+ except OSError as e:
+ log.exception('Failed to create ldif file (%s): error %d - %s' % (ldif_file, e.errno, e.strerror))
+ raise e
\ No newline at end of file
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.