X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fshell-backends%2Fpasswd-shell.c;h=f3d68a7770fc53ed34d0d7f935db52da9915d057;hb=3917d2b15dad2220e1263af60c742bf93884c986;hp=f546d2de5b8fc41b1d2330af298a7fdd04afa013;hpb=45118be88ed82e2bb660d5d4343fbafe3e9fad67;p=openldap diff --git a/servers/slapd/shell-backends/passwd-shell.c b/servers/slapd/shell-backends/passwd-shell.c index f546d2de5b..f3d68a7770 100644 --- a/servers/slapd/shell-backends/passwd-shell.c +++ b/servers/slapd/shell-backends/passwd-shell.c @@ -1,22 +1,39 @@ -/* - passwd-shell.c - /etc/passwd shell-based backend for standalone ldap server - - Copyright (c) 1995 Regents of the University of Michigan. - All rights reserved. - - Redistribution and use in source and binary forms are permitted - provided that this notice is preserved and that due credit is given - to the University of Michigan at Ann Arbor. The name of the University - may not be used to endorse or promote products derived from this - software without specific prior written permission. This software - is provided ``as is'' without express or implied warranty. -*/ +/* passwd-shell.c - passwd(5) shell-based backend for slapd(8) */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 1998-2004 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* Portions Copyright (c) 1995 Regents of the University of Michigan. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of Michigan at Ann Arbor. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ +/* ACKNOWLEDGEMENTS: + * This work was originally developed by the University of Michigan + * (as part of U-MICH LDAP). + */ #include "portable.h" #include -#include + +#include #include #include @@ -27,8 +44,6 @@ #include #include "shellutil.h" -#include "passwd-shell.h" - static void pwdfile_search LDAP_P(( struct ldop *op, FILE *ofp )); static struct ldentry *pw2entry LDAP_P(( struct ldop *op, struct passwd *pw )); @@ -67,7 +82,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" ); @@ -75,13 +90,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 @@ -90,7 +105,7 @@ main( int argc, char **argv ) pwdfile_search( &op, stdout ); - exit( 0 ); + exit( EXIT_SUCCESS ); } @@ -106,12 +121,12 @@ pwdfile_search( struct ldop *op, FILE *ofp ) 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 ); }