]> git.sur5r.net Git - openldap/commitdiff
cleanup
authorPierangelo Masarati <ando@openldap.org>
Tue, 13 Dec 2005 15:53:10 +0000 (15:53 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 13 Dec 2005 15:53:10 +0000 (15:53 +0000)
libraries/libldap/controls.c
libraries/libldap/ldap-int.h
libraries/libldap/request.c
libraries/libldap/result.c
libraries/libldap/unbind.c
tests/data/slapd-acl.conf

index 7e9d73662fa69b66d83adf68892938bf8d1dec92..f803b000be6c638dcfa0218b7bac9b2e4f4d2868 100644 (file)
@@ -68,7 +68,7 @@ ldap_int_put_controls(
        LDAPControl *const *c;
 
        assert( ld != NULL );
-       assert( LDAP_VALID(ld) );
+       assert( LDAP_VALID( ld ) );
        assert( ber != NULL );
 
        if( ctrls == NULL ) {
@@ -470,7 +470,7 @@ int ldap_int_client_controls( LDAP *ld, LDAPControl **ctrls )
        LDAPControl *const *c;
 
        assert( ld != NULL );
-       assert( LDAP_VALID(ld) );
+       assert( LDAP_VALID( ld ) );
 
        if( ctrls == NULL ) {
                /* use default server controls */
index 533ef352963855594e91085cbd39a14268eec37a..d65dd23c62bf413ae3ece6a085bf8a0a640f59bd 100644 (file)
@@ -151,6 +151,7 @@ struct ldapoptions {
 #define LDAP_UNINITIALIZED     0x0
 #define LDAP_INITIALIZED       0x1
 #define LDAP_VALID_SESSION     0x2
+#define LDAP_TRASHED_SESSION   0xFF
        int   ldo_debug;
 #ifdef LDAP_CONNECTIONLESS
 #define        LDAP_IS_UDP(ld)         ((ld)->ld_options.ldo_is_udp)
@@ -347,7 +348,9 @@ struct ldap {
        LDAPConn        *ld_conns;      /* list of server connections */
        void            *ld_selectinfo; /* platform specifics for select */
 };
-#define LDAP_VALID(ld) ( (ld)->ld_valid == LDAP_VALID_SESSION )
+#define LDAP_VALID(ld)         ( (ld)->ld_valid == LDAP_VALID_SESSION )
+#define LDAP_TRASHED(ld)       ( (ld)->ld_valid == LDAP_TRASHED_SESSION )
+#define LDAP_TRASH(ld)         ( (ld)->ld_valid = LDAP_TRASHED_SESSION )
 
 #ifdef LDAP_R_COMPILE
 LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_resolv_mutex;
index 0b9aa27da6f577dd8d7c01ed9cec2b61c068c6dd..97f6ccc5a7c0302433c4cd5ecb6e115e964875d4 100644 (file)
@@ -661,8 +661,9 @@ ldap_dump_requests_and_responses( LDAP *ld )
                ( lr->lr_status == LDAP_REQST_INPROGRESS ) ? "InProgress" :
                ( lr->lr_status == LDAP_REQST_CHASINGREFS ) ? "ChasingRefs" :
                ( lr->lr_status == LDAP_REQST_NOTCONNECTED ) ? "NotConnected" :
-               ( lr->lr_status == LDAP_REQST_WRITING) ? "Writing" :
-               ( lr->lr_status == LDAP_REQST_COMPLETED ? "Request Completed" : "Invalid Status"));
+               ( lr->lr_status == LDAP_REQST_WRITING ) ? "Writing" :
+               ( lr->lr_status == LDAP_REQST_COMPLETED ) ? "RequestCompleted"
+                       : "InvalidStatus");
            fprintf( stderr, "   outstanding referrals %d, parent count %d\n",
                    lr->lr_outrefcnt, lr->lr_parentcnt );
        }
index e17210f93d4bb0be6da020a5442a66016b9320fa..91b118fc8c8df8e84a31a36cbe96708527ccb4b6 100644 (file)
@@ -78,6 +78,8 @@ static ber_tag_t build_result_ber LDAP_P(( LDAP *ld, BerElement **bp, LDAPReques
 static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
 static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all));
 
+#define LDAP_MSG_X_KEEP_LOOKING                (-2)
+
 
 /*
  * ldap_result - wait for an ldap result response to a message from the
@@ -255,8 +257,8 @@ wait4msg(
                start_time = time( NULL );
        }
                    
-       rc = -2;
-       while ( rc == -2 ) {
+       rc = LDAP_MSG_X_KEEP_LOOKING;
+       while ( rc == LDAP_MSG_X_KEEP_LOOKING ) {
 #ifdef LDAP_DEBUG
                if ( ldap_debug & LDAP_DEBUG_TRACE ) {
                        Debug( LDAP_DEBUG_TRACE, "wait4msg continue ld %p msgid %d all %d\n",
@@ -315,9 +317,9 @@ wait4msg(
                                }
 
                                if ( rc == -1 ) {
-                                       rc = -2;        /* select interrupted: loop */
+                                       rc = LDAP_MSG_X_KEEP_LOOKING;   /* select interrupted: loop */
                                } else {
-                                       rc = -2;
+                                       rc = LDAP_MSG_X_KEEP_LOOKING;
 #ifdef LDAP_R_COMPILE
                                        ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
 #endif
@@ -332,7 +334,7 @@ wait4msg(
                                        ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
                                        ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
 #endif
-                                       for ( lc = ld->ld_conns; rc == -2 && lc != NULL;
+                                       for ( lc = ld->ld_conns; rc == LDAP_MSG_X_KEEP_LOOKING && lc != NULL;
                                                lc = nextlc )
                                        {
                                                nextlc = lc->lconn_next;
@@ -357,7 +359,7 @@ wait4msg(
                        }
                }
 
-               if ( rc == -2 && tvp != NULL ) {
+               if ( rc == LDAP_MSG_X_KEEP_LOOKING && tvp != NULL ) {
                        tmp_time = time( NULL );
                        tv0.tv_sec -= ( tmp_time - start_time );
                        if ( tv0.tv_sec <= 0 ) {
@@ -459,10 +461,10 @@ nextresp3:
                                "ber_get_next failed.\n", 0, 0, 0 );
 #endif            
 #ifdef EWOULDBLOCK                     
-                       if (errno==EWOULDBLOCK) return -2;
+                       if (errno==EWOULDBLOCK) return LDAP_MSG_X_KEEP_LOOKING;
 #endif
 #ifdef EAGAIN
-                       if (errno == EAGAIN) return -2;
+                       if (errno == EAGAIN) return LDAP_MSG_X_KEEP_LOOKING;
 #endif
                        ld->ld_errno = LDAP_SERVER_DOWN;
                        return -1;
@@ -487,7 +489,7 @@ retry_ber:
                if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
                        goto retry;
                }
-               return( -2 );   /* continue looking */
+               return( LDAP_MSG_X_KEEP_LOOKING );      /* continue looking */
        }
 
        lr = ldap_find_request_by_msgid( ld, id );
@@ -517,7 +519,7 @@ nextresp2:
        id = lr->lr_origid;
        refer_cnt = 0;
        hadref = simple_request = 0;
-       rc = -2;        /* default is to keep looking (no response found) */
+       rc = LDAP_MSG_X_KEEP_LOOKING;   /* default is to keep looking (no response found) */
        lr->lr_res_msgtype = tag;
 
        /*
@@ -989,7 +991,7 @@ exit:
        if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
                goto retry;
        }
-       return( -2 );   /* continue looking */
+       return( LDAP_MSG_X_KEEP_LOOKING );      /* continue looking */
 }
 
 
index 86b9ab2baa13fd17ca855ca50fee525778d1ad21..fba3a5ffb35936c501c5c1dfc03a73b2caadaedf 100644 (file)
@@ -194,6 +194,9 @@ ldap_ld_free(
 #ifdef LDAP_R_COMPILE
        ldap_pvt_thread_mutex_destroy( &ld->ld_req_mutex );
        ldap_pvt_thread_mutex_destroy( &ld->ld_res_mutex );
+#endif
+#ifndef NDEBUG
+       LDAP_TRASH(ld);
 #endif
        LDAP_FREE( (char *) ld );
    
index d14ca8d12e5a97730a2d6ee7d156ffeaf6737ef5..67bd76bd8ec31325a19046c78e7ef1715cdaf103 100644 (file)
@@ -27,7 +27,7 @@ argsfile      @TESTDIR@/slapd.1.args
 # normal installations should protect root dse, cn=monitor, cn=subschema
 #
 
-access         to dn.exact="" attr=objectClass
+access         to dn.exact="" attrs=objectClass
                by users read
 access         to *
                by * read
@@ -54,12 +54,12 @@ rootpw              secret
 #ldbm#index            objectClass     eq
 #ldbm#index            cn,sn,uid       pres,eq,sub
 
-#access                to attr=objectclass dn.subtree="dc=example,dc=com"
-access         to attr=objectclass
+#access                to attrs=objectclass dn.subtree="dc=example,dc=com"
+access         to attrs=objectclass
                by * =rsc stop
 
-#access                to filter="(objectclass=person)" attr=userpassword dn.subtree="dc=example,dc=com"
-access         to filter="(objectclass=person)" attr=userpassword
+#access                to filter="(objectclass=person)" attrs=userpassword dn.subtree="dc=example,dc=com"
+access         to filter="(objectclass=person)" attrs=userpassword
                by anonymous auth
                by self =wx
 
@@ -108,14 +108,14 @@ access            to dn.children="ou=Alumni Association,ou=People,dc=example,dc=com"
                by dn.children="dc=example,dc=com" +d continue
                by * stop
 
-#access                to attr=member,uniquemember dn.subtree="dc=example,dc=com"
-access         to attr=member,uniquemember
+#access                to attrs=member,uniquemember dn.subtree="dc=example,dc=com"
+access         to attrs=member,uniquemember
                by dnattr=member selfwrite
                by dnattr=uniquemember selfwrite
                by * read
 
-#access                to attr=member,uniquemember filter="(mail=*com)" dn.subtree="dc=example,dc=com"
-access         to attr=member,uniquemember filter="(mail=*com)"
+#access                to attrs=member,uniquemember filter="(mail=*com)" dn.subtree="dc=example,dc=com"
+access         to attrs=member,uniquemember filter="(mail=*com)"
                by * read
 
 #access                to filter="(|(objectclass=groupofnames)(objectClass=groupofuniquenames))" dn.subtree="dc=example,dc=com"