]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/kbind.c
misc cleanup
[openldap] / libraries / libldap / kbind.c
index 84fa3dddf5333582174c203fdcf25bb08c076d03..1da20d716fe55209204b20a251188ba53d162f55 100644 (file)
@@ -66,6 +66,11 @@ ldap_kerberos_bind1( LDAP *ld, LDAP_CONST char *dn )
 
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind1\n", 0, 0, 0 );
 
+       if( ld->ld_version > LDAP_VERSION2 ) {
+               ld->ld_errno = LDAP_NOT_SUPPORTED;
+               return -1;
+       }
+
        if ( dn == NULL )
                dn = "";
 
@@ -144,6 +149,11 @@ ldap_kerberos_bind2( LDAP *ld, LDAP_CONST char *dn )
 
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind2\n", 0, 0, 0 );
 
+       if( ld->ld_version > LDAP_VERSION2 ) {
+               ld->ld_errno = LDAP_NOT_SUPPORTED;
+               return -1;
+       }
+
        if ( dn == NULL )
                dn = "";
 
@@ -233,10 +243,8 @@ ldap_get_kerberosv4_credentials(
        Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
 
        if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
-#ifdef LDAP_LIBUI
-               fprintf( stderr, "krb_get_tf_realm failed (%s)\n",
-                   krb_err_txt[err] );
-#endif /* LDAP_LIBUI */
+               Debug( LDAP_DEBUG_ANY, "ldap_get_kerberosv4_credentials: "
+                       "krb_get_tf_realm failed: %s\n", krb_err_txt[err], 0, 0 );
                ld->ld_errno = LDAP_AUTH_UNKNOWN;
                return( NULL );
        }
@@ -251,10 +259,10 @@ ldap_get_kerberosv4_credentials(
        krbinstance = ld->ld_defconn->lconn_krbinstance;
 
        if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
-           != KSUCCESS ) {
-#ifdef LDAP_LIBUI
-               fprintf( stderr, "krb_mk_req failed (%s)\n", krb_err_txt[err] );
-#endif /* LDAP_LIBUI */
+           != KSUCCESS )
+       {
+               Debug( LDAP_DEBUG_ANY, "ldap_get_kerberosv4_credentials: "
+                       "krb_mk_req failed (%s)\n", krb_err_txt[err], 0, 0 );
                ld->ld_errno = LDAP_AUTH_UNKNOWN;
                return( NULL );
        }
@@ -265,7 +273,7 @@ ldap_get_kerberosv4_credentials(
        }
 
        *len = ktxt.length;
-       memcpy( cred, ktxt.dat, ktxt.length );
+       AC_MEMCPY( cred, ktxt.dat, ktxt.length );
 
        return( cred );
 }