Back to index

openldap  2.4.31
Functions
assertion.c File Reference
#include "portable.h"
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/time.h>
#include "ldap-int.h"

Go to the source code of this file.

Functions

int ldap_create_assertion_control_value (LDAP *ld, char *assertion, struct berval *value)
int ldap_create_assertion_control (LDAP *ld, char *assertion, int iscritical, LDAPControl **ctrlp)

Function Documentation

int ldap_create_assertion_control ( LDAP *  ld,
char *  assertion,
int  iscritical,
LDAPControl **  ctrlp 
)

Definition at line 73 of file assertion.c.

{
       struct berval value;

       if ( ctrlp == NULL ) {
              ld->ld_errno = LDAP_PARAM_ERROR;
              return ld->ld_errno;
       }

       ld->ld_errno = ldap_create_assertion_control_value( ld,
              assertion, &value );
       if ( ld->ld_errno == LDAP_SUCCESS ) {
              ld->ld_errno = ldap_control_create( LDAP_CONTROL_ASSERT,
                     iscritical, &value, 0, ctrlp );
              if ( ld->ld_errno != LDAP_SUCCESS ) {
                     LDAP_FREE( value.bv_val );
              }
       }

       return ld->ld_errno;
}

Here is the call graph for this function:

int ldap_create_assertion_control_value ( LDAP *  ld,
char *  assertion,
struct berval value 
)

Definition at line 26 of file assertion.c.

{
       BerElement           *ber = NULL;
       int                  err;

       if ( assertion == NULL || assertion[ 0 ] == '\0' ) {
              ld->ld_errno = LDAP_PARAM_ERROR;
              return ld->ld_errno;
       }

       if ( value == NULL ) {
              ld->ld_errno = LDAP_PARAM_ERROR;
              return ld->ld_errno;
       }

       BER_BVZERO( value );

       ber = ldap_alloc_ber_with_options( ld );
       if ( ber == NULL ) {
              ld->ld_errno = LDAP_NO_MEMORY;
              return ld->ld_errno;
       }

       err = ldap_pvt_put_filter( ber, assertion );
       if ( err < 0 ) {
              ld->ld_errno = LDAP_ENCODING_ERROR;
              goto done;
       }

       err = ber_flatten2( ber, value, 1 );
       if ( err < 0 ) {
              ld->ld_errno = LDAP_NO_MEMORY;
              goto done;
       }

done:;
       if ( ber != NULL ) {
              ber_free( ber, 1 );
       }

       return ld->ld_errno;
}

Here is the call graph for this function:

Here is the caller graph for this function: