From 30bd8478cc21598eb9b389f5c9bd741ebc43df1e Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 17 Jun 2000 20:07:51 +0000 Subject: [PATCH] Additional changes from devel --- build/openldap.m4 | 2 +- include/portable.h.in | 3 ++ libraries/libldap_r/thr_posix.c | 4 +++ servers/slapd/acl.c | 50 +++++++++++++++++++++++---------- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/build/openldap.m4 b/build/openldap.m4 index 1ce490ff12..a12b0a2577 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -731,7 +731,7 @@ dnl defines ol_cv_sys_linux_threads to 'yes' or 'no' dnl 'no' implies pthreads implementation is not LinuxThreads. dnl AC_DEFUN([OL_SYS_LINUX_THREADS], [ - AC_CHECK_FUNC(pthread_kill_other_threads_np) + AC_CHECK_FUNCS(pthread_kill_other_threads_np) AC_CACHE_CHECK([for LinuxThreads implementation], [ol_cv_sys_linux_threads], [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np]) diff --git a/include/portable.h.in b/include/portable.h.in index 55786a172a..ff2fe67015 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -212,6 +212,9 @@ /* Define if you have the pthread_kill function. */ #undef HAVE_PTHREAD_KILL +/* Define if you have the pthread_kill_other_threads_np function. */ +#undef HAVE_PTHREAD_KILL_OTHER_THREADS_NP + /* Define if you have the pthread_rwlock_destroy function. */ #undef HAVE_PTHREAD_RWLOCK_DESTROY diff --git a/libraries/libldap_r/thr_posix.c b/libraries/libldap_r/thr_posix.c index 95d30f1b4b..3d0bba9f93 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -41,6 +41,10 @@ ldap_int_thread_initialize( void ) int ldap_int_thread_destroy( void ) { +#ifdef HAVE_PTHREAD_KILL_OTHER_THREADS_NP + /* LinuxThreads: kill clones */ + pthread_kill_other_threads_np(); +#endif return 0; } diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index cc5882a58a..c942737821 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -532,7 +532,7 @@ acl_mask( if ( b->a_dn_at != NULL && op->o_ndn != NULL ) { Attribute *at; struct berval bv; - int match = 0; + int rc, match = 0; const char *text; const char *desc = b->a_dn_at->ad_cname->bv_val; @@ -555,21 +555,41 @@ acl_mask( } if( match ) { - if ( b->a_dn_self && (val == NULL - || value_match( &match, b->a_dn_at, - b->a_dn_at->ad_type->sat_equality, val, &bv, &text ) ) - != LDAP_SUCCESS - || match ) - { - continue; + /* have a dnattr match. if this is a self clause then + * the target must also match the op dn. + */ + if ( b->a_dn_self ) { + /* check if the target is an attribute. */ + if ( val == NULL ) + continue; + /* target is attribute, check if the attribute value + * is the op dn. + */ + rc = value_match( &match, b->a_dn_at, + b->a_dn_at->ad_type->sat_equality, + val, &bv, &text ); + /* on match error or no match, fail the ACL clause */ + if (rc != LDAP_SUCCESS || match != 0 ) + continue; } - } else if ( ! b->a_dn_self || val == NULL - || value_match( &match, b->a_dn_at, - b->a_dn_at->ad_type->sat_equality, val, &bv, &text ) - != LDAP_SUCCESS - || match ) - { - continue; + } else { + /* no dnattr match, check if this is a self clause */ + if ( ! b->a_dn_self ) + continue; + /* this is a self clause, check if the target is an + * attribute. + */ + if ( val == NULL ) + continue; + /* target is attribute, check if the attribute value + * is the op dn. + */ + rc = value_match( &match, b->a_dn_at, + b->a_dn_at->ad_type->sat_equality, + val, &bv, &text ); + /* on match error or no match, fail the ACL clause */ + if (rc != LDAP_SUCCESS || match != 0 ) + continue; } } -- 2.39.5