/* $OpenLDAP$ */
/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
}
if( sasl_host == NULL ) {
- char hostname[MAXHOSTNAMELEN+1];
+ static char hostname[MAXHOSTNAMELEN+1];
if( gethostname( hostname, MAXHOSTNAMELEN ) == 0 ) {
hostname[MAXHOSTNAMELEN] = '\0';
int sasl_bind(
Connection *conn,
Operation *op,
- char *dn,
- char *ndn,
- char *mech,
+ const char *dn,
+ const char *ndn,
+ const char *mech,
struct berval *cred,
char **edn )
{
int sc;
int rc = 1;
- Debug(LDAP_DEBUG_ARGS, "==> sasl_bind: dn=%s, mech=%s, cred->bv_len=%d\n",
+ Debug(LDAP_DEBUG_ARGS,
+ "==> sasl_bind: dn=\"%s\" mech=%s cred->bv_len=%d\n",
dn, mech, cred ? cred->bv_len : 0 );
if ( conn->c_sasl_bind_context == NULL ) {
send_ldap_result( conn, op, rc = LDAP_AUTH_METHOD_NOT_SUPPORTED,
NULL, NULL, NULL, NULL );
} else {
+ unsigned reslen;
conn->c_authmech = ch_strdup( mech );
+
sc = sasl_server_start( conn->c_sasl_bind_context, conn->c_authmech,
- cred->bv_val, cred->bv_len, (char **)&response.bv_val,
- (unsigned *)&response.bv_len, &errstr );
+ cred->bv_val, cred->bv_len,
+ (char **)&response.bv_val, &reslen, &errstr );
+
+ response.bv_len = reslen;
+
if ( (sc != SASL_OK) && (sc != SASL_CONTINUE) ) {
send_ldap_result( conn, op, rc = slap_sasl_err2ldap( sc ),
NULL, errstr, NULL, NULL );
}
}
} else {
+ unsigned reslen;
sc = sasl_server_step( conn->c_sasl_bind_context, cred->bv_val, cred->bv_len,
- (char **)&response.bv_val, (unsigned *)&response.bv_len, &errstr );
+ (char **)&response.bv_val, &reslen, &errstr );
+
+ response.bv_len = reslen;
+
if ( (sc != SASL_OK) && (sc != SASL_CONTINUE) ) {
send_ldap_result( conn, op, rc = slap_sasl_err2ldap( sc ),
NULL, errstr, NULL, NULL );
int sasl_bind(
Connection *conn,
Operation *op,
- char *dn,
- char *ndn,
- char *mech,
+ const char *dn,
+ const char *ndn,
+ const char *mech,
struct berval *cred,
char **edn )
{