+/* $OpenLDAP$ */
/*
passwd-shell.c - /etc/passwd shell-based backend for standalone ldap server
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#include <ac/string.h>
#include <ac/unistd.h>
if ( errflg || optind < argc ) {
fprintf( stderr, "usage: %s [-d]\n", progname );
- exit( 1 );
+ exit( EXIT_FAILURE );
}
debug_printf( "started\n" );
(void) memset( (char *)&op, '\0', sizeof( op ));
if ( parse_input( stdin, stdout, &op ) < 0 ) {
- exit( 0 );
+ exit( EXIT_SUCCESS );
}
if ( op.ldop_op != LDOP_SEARCH ) {
write_result( stdout, LDAP_UNWILLING_TO_PERFORM, NULL,
"Command Not Implemented" );
- exit( 0 );
+ exit( EXIT_SUCCESS );
}
#ifdef LDAP_DEBUG
pwdfile_search( &op, stdout );
- exit( 0 );
+ exit( EXIT_SUCCESS );
}
for ( pw = getpwent(); pw != NULL; pw = getpwent()) {
if (( entry = pw2entry( op, pw )) != NULL ) {
if ( oneentry ) {
- if ( dn_casecmp( op->ldop_dn, entry->lde_dn ) == 0 ) {
+ if ( strcasecmp( op->ldop_dn, entry->lde_dn ) == 0 ) {
write_entry( op, entry, ofp );
break;
}
- } else if ( test_filter( op, entry )) {
- write_entry( op, entry, ofp );
+ } else if ( test_filter( op, entry ) == LDAP_COMPARE_TRUE ) {
+ write_entry( op, entry, ofp );
}
free_entry( entry );
}