]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
Don't require slapi to be in the path - always include slapi/slapi.h
[openldap] / servers / slapd / bind.c
index 4e56336924163b53acae9b774f205cdbc0ddf1f0..0c13bad30bc6f2c22fc4457cf0aeebd7a69542b1 100644 (file)
@@ -34,7 +34,7 @@
 #include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
-#include "slapi.h"
+#include "slapi/slapi.h"
 #endif
 
 
@@ -368,12 +368,12 @@ do_bind(
                 * SASL bind.
                 */
                if ( pb ) {
-                       slapi_x_pblock_set_operation( pb, op );
+                       slapi_int_pblock_set_operation( pb, op );
                        slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
                        slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
                        slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
                        slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
-                       (void) doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb );
+                       (void) slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb );
                }
 #endif /* LDAP_SLAPI */
 
@@ -397,6 +397,7 @@ do_bind(
        }
 
        if ( method == LDAP_AUTH_SIMPLE ) {
+               ber_str2bv( "SIMPLE", sizeof("SIMPLE")-1, 0, &mech );
                /* accept "anonymous" binds */
                if ( op->orb_cred.bv_len == 0 || op->o_req_ndn.bv_len == 0 ) {
                        rs->sr_err = LDAP_SUCCESS;
@@ -475,6 +476,7 @@ do_bind(
 #endif
                        goto cleanup;
                }
+               ber_str2bv( "KRBV4", sizeof("KRBV4")-1, 0, &mech );
 #endif
 
        } else {
@@ -529,14 +531,14 @@ do_bind(
 #if defined( LDAP_SLAPI )
        if ( pb ) {
                int rc;
-               slapi_x_pblock_set_operation( pb, op );
+               slapi_int_pblock_set_operation( pb, op );
                slapi_pblock_set( pb, SLAPI_BIND_TARGET, (void *)dn.bv_val );
                slapi_pblock_set( pb, SLAPI_BIND_METHOD, (void *)method );
                slapi_pblock_set( pb, SLAPI_BIND_CREDENTIALS, (void *)&op->orb_cred );
                slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(0) );
                slapi_pblock_set( pb, SLAPI_CONN_DN, (void *)(0) );
 
-               rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb );
+               rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_BIND_FN, pb );
 
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO,
@@ -599,10 +601,10 @@ do_bind(
                                }
                                /* log authorization identity */
                                Statslog( LDAP_DEBUG_STATS,
-                                       "conn=%lu op=%lu BIND dn=\"%s\" mech=simple (SLAPI) ssf=0\n",
+                                       "conn=%lu op=%lu BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
                                        op->o_connid, op->o_opid,
                                        op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
-                                       0, 0 );
+                                       mech.bv_val, 0 );
                                ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
                        }
                        goto cleanup;
@@ -639,9 +641,9 @@ do_bind(
 
                        /* log authorization identity */
                        Statslog( LDAP_DEBUG_STATS,
-                               "conn=%lu op=%lu BIND dn=\"%s\" mech=simple ssf=0\n",
+                               "conn=%lu op=%lu BIND dn=\"%s\" mech=%s ssf=0\n",
                                op->o_connid, op->o_opid,
-                               op->o_conn->c_dn.bv_val, 0, 0 );
+                               op->o_conn->c_dn.bv_val, mech.bv_val, 0 );
 
 #ifdef NEW_LOGGING
                        LDAP_LOG( OPERATION, DETAIL1, 
@@ -668,7 +670,7 @@ do_bind(
        }
 
 #if defined( LDAP_SLAPI )
-       if ( pb && doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) < 0 ) {
+       if ( pb != NULL && slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_BIND_FN, pb ) < 0 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO,
                        "do_bind: Bind postoperation plugins failed\n",
@@ -682,6 +684,12 @@ do_bind(
 #endif /* defined( LDAP_SLAPI ) */
 
 cleanup:
+       if ( rs->sr_err == LDAP_SUCCESS ) {
+               if ( method != LDAP_AUTH_SASL ) {
+                       ber_dupbv( &op->o_conn->c_authmech, &mech );
+               }
+               op->o_conn->c_authtype = method;
+       }
 
        op->o_conn->c_sasl_bindop = NULL;