X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fshell-backends%2Fshellutil.c;h=246e93bc3e2ce6d9aadf567b0b81b39632d3cfb2;hb=9fc4a749dcecda7176cea4859fa8f51bbc91feff;hp=4ba1213fa2fa11e833df5abb1671ce401de9b4d4;hpb=df8f7cbb9b79be3be9205d116d1dd0b263d6861a;p=openldap diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index 4ba1213fa2..246e93bc3e 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -1,3 +1,4 @@ +/* $OpenLDAP$ */ /* shellutil.c - common routines useful when building shell-based backends for the standalone ldap server @@ -88,7 +89,8 @@ write_entry( struct ldop *op, struct ldentry *entry, FILE *ofp ) int test_filter( struct ldop *op, struct ldentry *entry ) { - return (( random() & 0x07 ) == 0x07 ); /* XXX random for now */ + return ((random() & 0x07 ) == 0x07) /* XXX random for now */ + ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE; } @@ -139,7 +141,7 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) struct inputparams *ip; if ( fgets( line, MAXLINELEN, ifp ) == NULL ) { - write_result( ofp, LDAP_OPERATIONS_ERROR, NULL, "Empty Input" ); + write_result( ofp, LDAP_OTHER, NULL, "Empty Input" ); } line[ strlen( line ) - 1 ] = '\0'; if ( strncasecmp( line, STR_OP_SEARCH, sizeof( STR_OP_SEARCH ) - 1 ) @@ -172,7 +174,7 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) if (( op->ldop_srch.ldsp_scope = atoi( args )) != LDAP_SCOPE_BASE && op->ldop_srch.ldsp_scope != LDAP_SCOPE_ONELEVEL && op->ldop_srch.ldsp_scope != LDAP_SCOPE_SUBTREE ) { - write_result( ofp, LDAP_OPERATIONS_ERROR, NULL, "Bad scope" ); + write_result( ofp, LDAP_OTHER, NULL, "Bad scope" ); return( -1 ); } break; @@ -212,7 +214,7 @@ parse_input( FILE *ifp, FILE *ofp, struct ldop *op ) if ( op->ldop_suffixes == NULL || op->ldop_dn == NULL || op->ldop_srch.ldsp_filter == NULL ) { - write_result( ofp, LDAP_OPERATIONS_ERROR, NULL, + write_result( ofp, LDAP_OTHER, NULL, "Required suffix:, base:, or filter: missing" ); return( -1 ); } @@ -320,26 +322,12 @@ ecalloc( unsigned nelem, unsigned elsize ) /* VARARGS */ void -debug_printf -#if HAVE_STDARG - ( char *fmt, ... ) -#else - ( va_alist ) - va_dcl -#endif +debug_printf( const char *fmt, ... ) { va_list ap; -#if !HAVE_STDARG - char *fmt; -#endif if ( debugflg ) { -#if HAVE_STDARG va_start( ap, fmt ); -#else - va_start( ap ); - fmt = va_arg( ap, char * ); -#endif fprintf( stderr, "%s: ", progname ); vfprintf( stderr, fmt, ap ); va_end( ap );