]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/sasl.c
ITS#5300
[openldap] / libraries / libldap / sasl.c
index 20840958822fbda334f52b336dc502cf47bdc3a5..c7b18ac91dd5a7f633a4e1924e40426ce3c1be2c 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -12,9 +12,6 @@
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
-/* Portions Copyright (C) The Internet Society (1997)
- * ASN.1 fragments are from RFC 2251; see RFC for full legal notices.
- */
 
 /*
  *     BindRequest ::= SEQUENCE {
  *             name            DistinguishedName,       -- who
  *             authentication  CHOICE {
  *                     simple          [0] OCTET STRING -- passwd
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
- *                     krbv42ldap      [1] OCTET STRING
- *                     krbv42dsa       [2] OCTET STRING
-#endif
+ *                     krbv42ldap      [1] OCTET STRING -- OBSOLETE
+ *                     krbv42dsa       [2] OCTET STRING -- OBSOLETE
  *                     sasl            [3] SaslCredentials     -- LDAPv3
  *             }
  *     }
@@ -196,7 +191,7 @@ ldap_sasl_bind_s(
        }
 #endif
 
-       if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 ) {
+       if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 || !result ) {
                return( ld->ld_errno ); /* ldap_result sets ld_errno */
        }
 
@@ -206,7 +201,7 @@ ldap_sasl_bind_s(
                rc = ldap_parse_sasl_bind_result( ld, result, &scredp, 0 );
        }
 
-       if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) {
+       if ( rc != LDAP_SUCCESS ) {
                ldap_msgfree( result );
                return( rc );
        }
@@ -294,13 +289,8 @@ ldap_parse_sasl_bind_result(
        }
 
        if ( ld->ld_version < LDAP_VERSION2 ) {
-#ifdef LDAP_NULL_IS_NULL
                tag = ber_scanf( ber, "{iA}",
                        &errcode, &ld->ld_error );
-#else /* ! LDAP_NULL_IS_NULL */
-               tag = ber_scanf( ber, "{ia}",
-                       &errcode, &ld->ld_error );
-#endif /* ! LDAP_NULL_IS_NULL */
 
                if( tag == LBER_ERROR ) {
                        ber_free( ber, 0 );
@@ -311,13 +301,8 @@ ldap_parse_sasl_bind_result(
        } else {
                ber_len_t len;
 
-#ifdef LDAP_NULL_IS_NULL
                tag = ber_scanf( ber, "{eAA" /*}*/,
                        &errcode, &ld->ld_matched, &ld->ld_error );
-#else /* ! LDAP_NULL_IS_NULL */
-               tag = ber_scanf( ber, "{eaa" /*}*/,
-                       &errcode, &ld->ld_matched, &ld->ld_error );
-#endif /* ! LDAP_NULL_IS_NULL */
 
                if( tag == LBER_ERROR ) {
                        ber_free( ber, 0 );
@@ -362,7 +347,7 @@ ldap_parse_sasl_bind_result(
                ldap_msgfree( res );
        }
 
-       return( ld->ld_errno );
+       return( LDAP_SUCCESS );
 }
 
 int