/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2003 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* 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
* }
* }
int rc;
ber_int_t id;
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, ENTRY, "ldap_sasl_bind\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind\n", 0, 0, 0 );
-#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
cred );
} else if ( cred == NULL || cred->bv_val == NULL ) {
- /* SASL bind w/o creditials */
+ /* SASL bind w/o credentials */
rc = ber_printf( ber, "{it{ist{sN}N}" /*}*/,
id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_SASL,
mechanism );
} else {
- /* SASL bind w/ creditials */
+ /* SASL bind w/ credentials */
rc = ber_printf( ber, "{it{ist{sON}N}" /*}*/,
id, LDAP_REQ_BIND,
ld->ld_version, dn, LDAP_AUTH_SASL,
LDAPMessage *result;
struct berval *scredp = NULL;
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, ENTRY, "ldap_sasl_bind_s\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind_s\n", 0, 0, 0 );
-#endif
/* do a quick !LDAPv3 check... ldap_sasl_bind will do the rest. */
if( servercredp != NULL ) {
}
#endif
- if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) {
+ if ( ldap_result( ld, msgid, LDAP_MSG_ALL, NULL, &result ) == -1 || !result ) {
return( ld->ld_errno ); /* ldap_result sets ld_errno */
}
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 );
}
ber_tag_t tag;
BerElement *ber;
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, ENTRY, "ldap_parse_sasl_bind_result\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_parse_sasl_bind_result\n", 0, 0, 0 );
-#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
}
if ( ld->ld_version < LDAP_VERSION2 ) {
- tag = ber_scanf( ber, "{ia}",
+ tag = ber_scanf( ber, "{iA}",
&errcode, &ld->ld_error );
if( tag == LBER_ERROR ) {
} else {
ber_len_t len;
- tag = ber_scanf( ber, "{iaa" /*}*/,
+ tag = ber_scanf( ber, "{eAA" /*}*/,
&errcode, &ld->ld_matched, &ld->ld_error );
if( tag == LBER_ERROR ) {
ldap_msgfree( res );
}
- return( ld->ld_errno );
+ return( LDAP_SUCCESS );
}
int
char **values, *mechlist;
int rc;
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, ENTRY, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
-#endif
rc = ldap_search_s( ld, "", LDAP_SCOPE_BASE,
NULL, attrs, 0, &res );
goto done;
}
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, DETAIL1,
- "ldap_sasl_interactive_bind_s: server supports: %s\n",
- smechs, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE,
"ldap_sasl_interactive_bind_s: server supports: %s\n",
smechs, 0, 0 );
-#endif
mechs = smechs;
} else {
-#ifdef NEW_LOGGING
- LDAP_LOG ( TRANSPORT, DETAIL1,
- "ldap_sasl_interactive_bind_s: user selected: %s\n",
- mechs, 0, 0 );
-#else
Debug( LDAP_DEBUG_TRACE,
"ldap_sasl_interactive_bind_s: user selected: %s\n",
mechs, 0, 0 );
-#endif
}
rc = ldap_int_sasl_bind( ld, dn, mechs,