]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/request.c
Remove lint
[openldap] / libraries / libldap / request.c
index 55f1945b5f5ba70f65b5fe12c1881f00951625d1..b4336b24eb877b2d7d4e9a961404cb0f2307cee8 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
@@ -95,8 +95,8 @@ ldap_send_initial_request(
                }
 
                Debug( LDAP_DEBUG_TRACE,
-                       "ldap_delayed_open successful, ld_host is %s\n",
-                       ( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 );
+                       "ldap_open_defconn: successful\n",
+                       0, 0, 0 );
        }
 
        {
@@ -107,6 +107,18 @@ ldap_send_initial_request(
                servers = NULL;
        }       
 
+#ifdef LDAP_CONNECTIONLESS
+       if (LDAP_IS_UDP(ld)) {
+               if (msgtype == LDAP_REQ_BIND) {
+                       if (ld->ld_options.ldo_cldapdn)
+                               ldap_memfree(ld->ld_options.ldo_cldapdn);
+                       ld->ld_options.ldo_cldapdn = ldap_strdup(dn);
+                       return 0;
+               }
+               if (msgtype != LDAP_REQ_ABANDON && msgtype != LDAP_REQ_SEARCH)
+                       return LDAP_PARAM_ERROR;
+       }
+#endif
        rc = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL,
                                                                        servers, NULL, NULL );
        if (servers)
@@ -187,8 +199,8 @@ ldap_send_server_request(
                lr->lr_origid = parentreq->lr_origid;
                lr->lr_parentcnt = parentreq->lr_parentcnt + 1;
                lr->lr_parent = parentreq;
-               lr->lr_refnext = parentreq->lr_refnext;
-               parentreq->lr_refnext = lr;
+               lr->lr_refnext = parentreq->lr_child;
+               parentreq->lr_child = lr;
        } else {                        /* original request */
                lr->lr_origid = lr->lr_msgid;
        }
@@ -289,7 +301,7 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
                 */
                lc->lconn_rebind_inprogress = 1;
                /* V3 rebind function */
-               if ( ld->ld_rebindproc != NULL) {
+               if ( ld->ld_rebind_proc != NULL) {
                        LDAPURLDesc     *srvfunc;
                        if( ( srvfunc = ldap_url_dup( srvlist)) == NULL) {
                                ld->ld_errno = LDAP_NO_MEMORY;
@@ -299,8 +311,10 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
                                ++lc->lconn_refcnt;     /* avoid premature free */
                                ld->ld_defconn = lc;
 
-                               Debug( LDAP_DEBUG_TRACE, "Call application rebindproc\n", 0, 0, 0);
-                               err = (*ld->ld_rebindproc)( ld, bind->ri_url, bind->ri_request, bind->ri_msgid);
+                               Debug( LDAP_DEBUG_TRACE, "Call application rebind_proc\n", 0, 0, 0);
+                               err = (*ld->ld_rebind_proc)( ld,
+                                       bind->ri_url, bind->ri_request, bind->ri_msgid,
+                                       ld->ld_rebind_params );
 
                                ld->ld_defconn = savedefconn;
                                --lc->lconn_refcnt;
@@ -523,25 +537,9 @@ ldap_dump_requests_and_responses( LDAP *ld )
 }
 #endif /* LDAP_DEBUG */
 
-
 void
-ldap_free_request( LDAP *ld, LDAPRequest *lr )
+ldap_free_request_int( LDAP *ld, LDAPRequest *lr )
 {
-       LDAPRequest     *tmplr, *nextlr;
-
-       Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
-               lr->lr_origid, lr->lr_msgid, 0 );
-
-       if ( lr->lr_parent != NULL ) {
-               --lr->lr_parent->lr_outrefcnt;
-       } else {
-               /* free all referrals (child requests) */
-               for ( tmplr = lr->lr_refnext; tmplr != NULL; tmplr = nextlr ) {
-                       nextlr = tmplr->lr_refnext;
-                       ldap_free_request( ld, tmplr );
-               }
-       }
-
        if ( lr->lr_prev == NULL ) {
                ld->ld_requests = lr->lr_next;
        } else {
@@ -567,6 +565,28 @@ ldap_free_request( LDAP *ld, LDAPRequest *lr )
        LDAP_FREE( lr );
 }
 
+void
+ldap_free_request( LDAP *ld, LDAPRequest *lr )
+{
+       LDAPRequest     **ttmplr;
+
+       Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
+               lr->lr_origid, lr->lr_msgid, 0 );
+
+       if ( lr->lr_parent != NULL ) {
+               --lr->lr_parent->lr_outrefcnt;
+               for ( ttmplr = &lr->lr_parent->lr_child; *ttmplr && *ttmplr != lr; ttmplr = &(*ttmplr)->lr_refnext ); 
+               if ( *ttmplr == lr )  
+                       *ttmplr = lr->lr_refnext;
+       } else {
+               /* free all referrals (child requests) */
+               while ( lr->lr_child )
+                       ldap_free_request( ld, lr->lr_child );
+       }
+       ldap_free_request_int( ld, lr );
+}
+
+
 /*
  * Chase v3 referrals
  *
@@ -665,7 +685,7 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
                                if( lc->lconn_rebind_queue == NULL ) {
                                        /* Create a referral list */
                                        lc->lconn_rebind_queue =
-                                               (char ***) LDAP_MALLOC( sizeof(void *) * 2));
+                                               (char ***) LDAP_MALLOC( sizeof(void *) * 2);
 
                                        if( lc->lconn_rebind_queue == NULL) {
                                                ld->ld_errno = LDAP_NO_MEMORY;