Back to index

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

Go to the source code of this file.

Functions

int LDAP_CALL ldap_create_proxyauth_control (LDAP *ld, const char *dn, const char ctl_iscritical, LDAPControl **ctrlp)
int LDAP_CALL ldap_create_proxiedauth_control (LDAP *ld, const char *authzid, LDAPControl **ctrlp)

Function Documentation

int LDAP_CALL ldap_create_proxiedauth_control ( LDAP *  ld,
const char *  authzid,
LDAPControl **  ctrlp 
)

Definition at line 124 of file proxyauthctrl.c.

{
       BerElement           *ber;
       int                         rc;

       if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
              return( LDAP_PARAM_ERROR );
       }

       if (  ctrlp == NULL || authzid == NULL ) {
              LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL );
              return ( LDAP_PARAM_ERROR );
       }

       /* create a ber package to hold the controlValue */
       if ( ( nsldapi_alloc_ber_with_options( ld, &ber ) ) != LDAP_SUCCESS ) {
              LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL );
              return( LDAP_NO_MEMORY );
       }



        if ( LBER_ERROR == ber_printf( ber, 
                                       "s", 
                                       authzid ) ) 
        {
            LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL );
            ber_free( ber, 1 );
            return( LDAP_ENCODING_ERROR );
        }

       rc = nsldapi_build_control( LDAP_CONTROL_PROXIEDAUTH, ber, 1, 1, ctrlp );

       LDAP_SET_LDERRNO( ld, rc, NULL, NULL );
       return( rc );

}

Here is the call graph for this function:

Here is the caller graph for this function:

int LDAP_CALL ldap_create_proxyauth_control ( LDAP *  ld,
const char *  dn,
const char  ctl_iscritical,
LDAPControl **  ctrlp 
)

Definition at line 59 of file proxyauthctrl.c.

{
       BerElement           *ber;
       int                         rc;

       if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
              return( LDAP_PARAM_ERROR );
       }

       if (  ctrlp == NULL ) {
              LDAP_SET_LDERRNO( ld, LDAP_PARAM_ERROR, NULL, NULL );
              return ( LDAP_PARAM_ERROR );
       }
       if (NULL == dn)
       {
           dn = "";
       }

       /* create a ber package to hold the controlValue */
       if ( ( nsldapi_alloc_ber_with_options( ld, &ber ) ) != LDAP_SUCCESS ) {
              LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL );
              return( LDAP_NO_MEMORY );
       }



        if ( LBER_ERROR == ber_printf( ber, 
                                       "{s}", 
                                       dn ) ) 
        {
            LDAP_SET_LDERRNO( ld, LDAP_ENCODING_ERROR, NULL, NULL );
            ber_free( ber, 1 );
            return( LDAP_ENCODING_ERROR );
        }

       rc = nsldapi_build_control( LDAP_CONTROL_PROXYAUTH, ber, 1,
           ctl_iscritical, ctrlp );

       LDAP_SET_LDERRNO( ld, rc, NULL, NULL );
       return( rc );

}

Here is the call graph for this function:

Here is the caller graph for this function: