X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fback-passwd%2Fsearch.c;h=3e02efd51064930bbeb1e7a99aa700ca50f6fa0b;hb=1a9bc6655ddf9a1d08ee4f5e6e4ef6a7707ca5f7;hp=2f3266378ed7b57e676e390d5d21c98092872054;hpb=e8c58b4e7f21caa6c0b6006e3528cbad9b8aed45;p=openldap
diff --git a/servers/slapd/back-passwd/search.c b/servers/slapd/back-passwd/search.c
index 2f3266378e..3e02efd510 100644
--- a/servers/slapd/back-passwd/search.c
+++ b/servers/slapd/back-passwd/search.c
@@ -1,5 +1,36 @@
/* search.c - /etc/passwd backend search function */
/* $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). Additional significant contributors
+ * include:
+ * Hallvard B. Furuseth
+ * Howard Chu
+ * Kurt D. Zeilenga
+ */
#include "portable.h"
@@ -33,9 +64,7 @@ passwd_back_search(
char *s;
time_t stoptime;
- int sent = 0;
-
- LDAPRDN *rdn = NULL;
+ LDAPRDN rdn = NULL;
struct berval parent = { 0, NULL };
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
@@ -76,13 +105,13 @@ passwd_back_search(
goto done;
}
- if( slap_bv2ad( &rdn[0][0]->la_attr, &desc, &rs->sr_text )) {
+ if( slap_bv2ad( &rdn[0]->la_attr, &desc, &rs->sr_text )) {
rs->sr_err = LDAP_NO_SUCH_OBJECT;
ldap_rdnfree(rdn);
goto done;
}
- vals[0] = rdn[0][0]->la_value;
+ vals[0] = rdn[0]->la_value;
attr_mergeit( e, desc, vals );
ldap_rdnfree(rdn);
@@ -103,7 +132,6 @@ passwd_back_search(
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
}
@@ -147,7 +175,6 @@ passwd_back_search(
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
entry_free( e );
@@ -189,7 +216,7 @@ passwd_back_search(
ldap_pvt_thread_mutex_lock( &passwd_mutex );
pw_start( op->o_bd );
- if ( (pw = getpwnam( rdn[0][0]->la_value.bv_val )) == NULL ) {
+ if ( (pw = getpwnam( rdn[0]->la_value.bv_val )) == NULL ) {
rs->sr_matched = parent.bv_val;
rs->sr_err = LDAP_NO_SUCH_OBJECT;
ldap_pvt_thread_mutex_unlock( &passwd_mutex );
@@ -207,7 +234,6 @@ passwd_back_search(
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
entry_free( e );
@@ -215,8 +241,7 @@ passwd_back_search(
done:
if( rs->sr_err != LDAP_NO_SUCH_OBJECT ) rs->sr_matched = NULL;
- rs->sr_nentries = sent;
- send_search_result( op, rs );
+ send_ldap_result( op, rs );
if( rdn != NULL ) ldap_rdnfree( rdn );
@@ -275,7 +300,7 @@ pw2entry( Backend *be, struct passwd *pw, const char **text )
sprintf( vals[0].bv_val, "uid=%s,%s",
pw->pw_name, be->be_suffix[0].bv_val );
- rc = dnNormalize2( NULL, vals, &bv );
+ rc = dnNormalize( 0, NULL, NULL, vals, &bv, NULL );
if( rc != LDAP_SUCCESS ) {
free( vals[0].bv_val );
return NULL;