/* search.c - /etc/passwd backend search function */
/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * 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
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* 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"
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;
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);
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
}
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
entry_free( e );
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 );
rs->sr_entry = e;
rs->sr_attrs = op->oq_search.rs_attrs;
send_search_entry( op, rs );
- sent++;
}
entry_free( e );
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 );
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;