/* $OpenLDAP$ */
/*
- * Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include <ac/string.h>
#include <ac/unistd.h>
+#ifdef HAVE_SASL_SASL_H
+#include <sasl/sasl.h>
+#else
#include <sasl.h>
+#endif
#include <ldap.h>
#include "lutil_ldap.h"
if( dflt && !*dflt ) dflt = NULL;
- if( flags != LDAP_SASL_INTERACTIVE && dflt ) {
+ if( flags != LDAP_SASL_INTERACTIVE &&
+ ( dflt || interact->id == SASL_CB_USER ) )
+ {
goto use_default;
}
fprintf( stderr, "Default: %s\n", dflt );
}
- sprintf( input, "%s: ",
+ snprintf( input, sizeof input, "%s: ",
interact->prompt ? interact->prompt : "Interact" );
if( noecho ) {
if( interact->len > 0 ) {
/* duplicate */
- char *p = interact->result;
+ char *p = (char *)interact->result;
interact->result = strdup( p );
/* zap */
} else {
use_default:
- /* must be empty */
+ /* input must be empty */
interact->result = strdup( (dflt && *dflt) ? dflt : "" );
interact->len = interact->result
? strlen( interact->result ) : 0;
{
sasl_interact_t *interact = in;
- if( flags != LDAP_SASL_QUIET ) {
+ if( flags == LDAP_SASL_INTERACTIVE ) {
fputs( "SASL Interaction\n", stderr );
}