Back to index

lightning-sunbird  0.9+nobinonly
Functions
bind.c File Reference
#include "ldap-int.h"

Go to the source code of this file.

Functions

int LDAP_CALL ldap_bind (LDAP *ld, const char *dn, const char *passwd, int authmethod)
int LDAP_CALL ldap_bind_s (LDAP *ld, const char *dn, const char *passwd, int authmethod)
void LDAP_CALL ldap_set_rebind_proc (LDAP *ld, LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg)
char * nsldapi_get_binddn (LDAP *ld)

Function Documentation

int LDAP_CALL ldap_bind ( LDAP *  ld,
const char *  dn,
const char *  passwd,
int  authmethod 
)

Definition at line 64 of file bind.c.

{
       /*
        * The bind request looks like this:
        *     BindRequest ::= SEQUENCE {
        *            version              INTEGER,
        *            name          DistinguishedName,    -- who
        *            authentication       CHOICE {
        *                   simple        [0] OCTET STRING -- passwd
        *            }
        *     }
        * all wrapped up in an LDAPMessage sequence.
        */

       LDAPDebug( LDAP_DEBUG_TRACE, "ldap_bind\n", 0, 0, 0 );

       if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
              return( -1 );
       }

       switch ( authmethod ) {
       case LDAP_AUTH_SIMPLE:
              return( ldap_simple_bind( ld, dn, passwd ) );

       default:
              LDAP_SET_LDERRNO( ld, LDAP_AUTH_UNKNOWN, NULL, NULL );
              return( -1 );
       }
}

Here is the call graph for this function:

int LDAP_CALL ldap_bind_s ( LDAP *  ld,
const char *  dn,
const char *  passwd,
int  authmethod 
)

Definition at line 110 of file bind.c.

{
       int    err;

       LDAPDebug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 );

       switch ( authmethod ) {
       case LDAP_AUTH_SIMPLE:
              return( ldap_simple_bind_s( ld, dn, passwd ) );

       default:
              err = LDAP_AUTH_UNKNOWN;
              LDAP_SET_LDERRNO( ld, err, NULL, NULL );
              return( err );
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LDAP_CALL ldap_set_rebind_proc ( LDAP *  ld,
LDAP_REBINDPROC_CALLBACK *  rebindproc,
void arg 
)

Definition at line 130 of file bind.c.

{
       if ( ld == NULL ) {
              if ( !nsldapi_initialized ) {
                     nsldapi_initialize_defaults();
              }
              ld = &nsldapi_ld_defaults;
       }

       if ( NSLDAPI_VALID_LDAP_POINTER( ld )) {
              LDAP_MUTEX_LOCK( ld, LDAP_OPTION_LOCK );
              ld->ld_rebind_fn = rebindproc;
              ld->ld_rebind_arg = arg;
              LDAP_MUTEX_UNLOCK( ld, LDAP_OPTION_LOCK );
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* nsldapi_get_binddn ( LDAP *  ld)

Definition at line 154 of file bind.c.

{
       char   *binddn;

       binddn = NULL;       /* default -- assume they are not bound */

       LDAP_MUTEX_LOCK( ld, LDAP_CONN_LOCK );
       if ( NULL != ld->ld_defconn && LDAP_CONNST_CONNECTED ==
           ld->ld_defconn->lconn_status && ld->ld_defconn->lconn_bound ) {
              if (( binddn = ld->ld_defconn->lconn_binddn ) == NULL ) {
                     binddn = "";
              }
       }
       LDAP_MUTEX_UNLOCK( ld, LDAP_CONN_LOCK );

       return( binddn );
}

Here is the caller graph for this function: