Red Hat DIRECTORY SERVER 7.1 - PLUG-IN PROGRAMMERS Manual page 113

Table of Contents

Advertisement

Code Example 8-1
break;
}
slapi_attr_get_values( attr, &pwvals );
if ( slapi_pw_find( pwvals, credentials ) != 0 ) {
slapi_log_error( SLAPI_LOG_PLUGIN, "test_bind",
"Credentials are not correct for the entry\n" );
rc = LDAP_INVALID_CREDENTIALS;
break;
}
} else {
/* This should not happen. The previous section of code
already checks for this case. */
slapi_log_error( SLAPI_LOG_PLUGIN, "test_bind",
"Could find entry for %s\n", dn );
rc = LDAP_NO_SUCH_OBJECT;
break;
}
/* Set the DN and the authentication method for the
connection. */
if ( slapi_pblock_set( pb, SLAPI_CONN_DN, slapi_ch_strdup( dn
) ) != 0 ||
slapi_pblock_set( pb, SLAPI_CONN_AUTHTYPE,
SLAPD_AUTH_SIMPLE ) != 0 ) {
slapi_log_error( SLAPI_LOG_PLUGIN, "testbind_init",
"Failed to set DN and auth method for connection\n" );
rc = LDAP_OPERATIONS_ERROR;
break;
}
/* Send a "success" result code back to the client. */
slapi_log_error( SLAPI_LOG_PLUGIN, "test_bind",
"Authenticated: %s\n", dn );
rc = LDAP_SUCCESS;
break;
/* If NONE is specified, the client is requesting to bind
anonymously.
Normally, this case should be handled by the server's
front-end
before it calls this plug-in function.
does
get through to the plug-in function, you can handle this by
sending a successful result code back to the client and
returning
1.
*/
case LDAP_AUTH_NONE:
slapi_log_error( SLAPI_LOG_PLUGIN, "test_bind",
"Authenticating anonymously\n" );
rc = LDAP_SUCCESS;
break;
/* This plug-in does not support any other method of
authentication */
case LDAP_AUTH_SASL:
default:
Sample Pre-Operation Bind Function (Continued)
Writing a Pre-Operation Bind Plug-in
Just in case this
Chapter 8
Defining Functions for Authentication
111

Advertisement

Table of Contents
loading

This manual is also suitable for:

Directory server 7.1

Table of Contents