Back to index

openldap  2.4.31
Enumerations | Functions | Variables
slapd-common.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  tester_t {
  TESTER_TESTER, TESTER_ADDEL, TESTER_BIND, TESTER_MODIFY,
  TESTER_MODRDN, TESTER_READ, TESTER_SEARCH, TESTER_LAST
}

Functions

void tester_init (const char *pname, tester_t ptype)
char * tester_uri (char *uri, char *host, int port)
void tester_error (const char *msg)
void tester_perror (const char *fname, const char *msg)
void tester_ldap_error (LDAP *ld, const char *fname, const char *msg)
int tester_ignore_str2errlist (const char *err)
int tester_ignore_err (int err)

Variables

pid_t pid

Enumeration Type Documentation

enum tester_t
Enumerator:
TESTER_TESTER 
TESTER_ADDEL 
TESTER_BIND 
TESTER_MODIFY 
TESTER_MODRDN 
TESTER_READ 
TESTER_SEARCH 
TESTER_LAST 

Definition at line 23 of file slapd-common.h.


Function Documentation

void tester_error ( const char *  msg)

Definition at line 297 of file slapd-common.c.

{
       fprintf( stderr, "%s: %s\n", progname, msg );
}

Here is the caller graph for this function:

Definition at line 185 of file slapd-common.c.

{
       int rc = 1;

       if ( err && TESTER_CLIENT_FIRST <= err && err <= TESTER_SERVER_LAST ) {
              rc = ignore_count[ err ];
              if ( rc != 0 ) {
                     ignore_count[ err ] = rc + (rc > 0 ? 1 : -1);
              }
       }

       /* SUCCESS is always "ignored" */
       return rc;
}

Here is the caller graph for this function:

Definition at line 169 of file slapd-common.c.

{
       int    i;
       char   **errs = ldap_str2charray( err, "," );

       for ( i = 0; errs[ i ] != NULL; i++ ) {
              /* TODO: allow <err>:<prog> to ignore <err> only when <prog> */
              (void)tester_ignore_str2err( errs[ i ] );
       }

       ldap_charray_free( errs );

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tester_init ( const char *  pname,
tester_t  ptype 
)

Definition at line 201 of file slapd-common.c.

{
       pid = getpid();
       srand( pid );
       snprintf( progname, sizeof( progname ), "%s PID=%d", pname, pid );
       progtype = ptype;
}

Here is the caller graph for this function:

void tester_ldap_error ( LDAP *  ld,
const char *  fname,
const char *  msg 
)

Definition at line 224 of file slapd-common.c.

{
       int           err;
       char          *text = NULL;
       LDAPControl   **ctrls = NULL;

       ldap_get_option( ld, LDAP_OPT_RESULT_CODE, (void *)&err );
       if ( err != LDAP_SUCCESS ) {
              ldap_get_option( ld, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void *)&text );
       }

       fprintf( stderr, "%s: %s: %s (%d) %s %s\n",
              progname, fname, ldap_err2string( err ), err,
              text == NULL ? "" : text,
              msg ? msg : "" );

       if ( text ) {
              ldap_memfree( text );
              text = NULL;
       }

       ldap_get_option( ld, LDAP_OPT_MATCHED_DN, (void *)&text );
       if ( text != NULL ) {
              if ( text[ 0 ] != '\0' ) {
                     fprintf( stderr, "\tmatched: %s\n", text );
              }
              ldap_memfree( text );
              text = NULL;
       }

       ldap_get_option( ld, LDAP_OPT_SERVER_CONTROLS, (void *)&ctrls );
       if ( ctrls != NULL ) {
              int    i;

              fprintf( stderr, "\tcontrols:\n" );
              for ( i = 0; ctrls[ i ] != NULL; i++ ) {
                     fprintf( stderr, "\t\t%s\n", ctrls[ i ]->ldctl_oid );
              }
              ldap_controls_free( ctrls );
              ctrls = NULL;
       }

       if ( err == LDAP_REFERRAL ) {
              char **refs = NULL;

              ldap_get_option( ld, LDAP_OPT_REFERRAL_URLS, (void *)&refs );

              if ( refs ) {
                     int    i;

                     fprintf( stderr, "\treferral:\n" );
                     for ( i = 0; refs[ i ] != NULL; i++ ) {
                            fprintf( stderr, "\t\t%s\n", refs[ i ] );
                     }

                     ber_memvfree( (void **)refs );
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tester_perror ( const char *  fname,
const char *  msg 
)

Definition at line 285 of file slapd-common.c.

{
       int    save_errno = errno;
       char   buf[ BUFSIZ ];

       fprintf( stderr, "%s: %s: (%d) %s %s\n",
                     progname, fname, save_errno,
                     AC_STRERROR_R( save_errno, buf, sizeof( buf ) ),
                     msg ? msg : "" );
}

Here is the caller graph for this function:

char* tester_uri ( char *  uri,
char *  host,
int  port 
)

Definition at line 210 of file slapd-common.c.

{
       static char   uribuf[ BUFSIZ ];

       if ( uri != NULL ) {
              return uri;
       }

       snprintf( uribuf, sizeof( uribuf ), "ldap://%s:%d", host, port );

       return uribuf;
}

Here is the caller graph for this function:


Variable Documentation

pid_t pid

Definition at line 35 of file slapd-common.c.