]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/shell-backends/passwd-shell.c
silence warnings
[openldap] / servers / slapd / shell-backends / passwd-shell.c
index fd354e0fe4b6530df645ffc1c98ba6a1422c91a7..ef3ab616dff185ae406f08ce12709991db70fcb5 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  passwd-shell.c - /etc/passwd shell-based backend for standalone ldap server
 
 
 #include "portable.h"
 
-#include <sys/types.h>
 #include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/string.h>
+#include <ac/unistd.h>
+
 #include <pwd.h>
-#include <varargs.h>
+
 #include <lber.h>
 #include <ldap.h>
+
 #include "shellutil.h"
 #include "passwd-shell.h"
 
 
-#ifdef LDAP_DEBUG
-void debug_printf();
-#else /* LDAP_DEBUG */
-#define debug_printf()
-#endif /* LDAP_DEBUG */
-
-
-static void pwdfile_search( struct ldop *op, FILE *ofp );
-static struct ldentry *pw2entry( struct ldop *op, struct passwd *pw );
+static void pwdfile_search LDAP_P(( struct ldop *op, FILE *ofp ));
+static struct ldentry *pw2entry LDAP_P(( struct ldop *op, struct passwd *pw ));
 
 static char    tmpbuf[ MAXLINELEN * 2 ];
 
 
+int
 main( int argc, char **argv )
 {
     int                        c, errflg;
     struct ldop                op;
-    extern int         optind;
-    extern char                *optarg;
 
     if (( progname = strrchr( argv[ 0 ], '/' )) == NULL ) {
        progname = estrdup( argv[ 0 ] );
@@ -72,7 +69,7 @@ main( int argc, char **argv )
 
     if ( errflg || optind < argc ) {
        fprintf( stderr, "usage: %s [-d]\n", progname );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     debug_printf( "started\n" );
@@ -80,13 +77,13 @@ main( int argc, char **argv )
     (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
@@ -95,7 +92,7 @@ main( int argc, char **argv )
 
     pwdfile_search( &op, stdout );
 
-    exit( 0 );
+    exit( EXIT_SUCCESS );
 }
 
 
@@ -115,8 +112,8 @@ pwdfile_search( struct ldop *op, FILE *ofp )
                    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 );
        }