]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-passwd/search.c
Merge remote branch 'origin/mdb.master'
[openldap] / servers / slapd / back-passwd / search.c
index e32e8b9b6dbb65f7f6d4dfeb80085a0f6e5d1892..6a4258ab2c1e8eaabd4d50a110e53e06393e5a02 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,7 +59,7 @@ passwd_back_search(
     SlapReply  *rs )
 {
        struct passwd   *pw;
-       time_t          stoptime;
+       time_t          stoptime = (time_t)-1;
 
        LDAPRDN rdn = NULL;
        struct berval parent = BER_BVNULL;
@@ -123,6 +123,8 @@ passwd_back_search(
                                rs->sr_attrs = op->ors_attrs;
                                rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
+                               rs->sr_flags = 0;
+                               rs->sr_attrs = NULL;
                        }
 
                        entry_clean( &e );
@@ -173,6 +175,8 @@ passwd_back_search(
                                        rs->sr_attrs = op->ors_attrs;
                                        rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                        send_search_entry( op, rs );
+                                       rs->sr_flags = 0;
+                                       rs->sr_entry = NULL;
                                }
 
                                entry_clean( &e );
@@ -238,6 +242,9 @@ passwd_back_search(
                        rs->sr_attrs = op->ors_attrs;
                        rs->sr_flags = REP_ENTRY_MODIFIABLE;
                        send_search_entry( op, rs );
+                       rs->sr_flags = 0;
+                       rs->sr_entry = NULL;
+                       rs->sr_attrs = NULL;
                }
 
                entry_clean( &e );
@@ -312,7 +319,7 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e )
        attr_merge_normalize_one( e, slap_schema.si_ad_cn, &val, NULL );        /* required by person */
        attr_merge_normalize_one( e, ad_sn, &val, NULL );       /* required by person */
 
-#ifdef HAVE_PW_GECOS
+#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
        /*
         * if gecos is present, add it as a cn. first process it
         * according to standard BSD usage. If the processed cn has
@@ -324,10 +331,10 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e )
                ber_str2bv( pw->pw_gecos, 0, 0, &val );
                attr_merge_normalize_one( e, ad_desc, &val, NULL );
 
-               s = strchr( val.bv_val, ',' );
+               s = ber_bvchr( &val, ',' );
                if ( s ) *s = '\0';
 
-               s = strchr( val.bv_val, '&' );
+               s = ber_bvchr( &val, '&' );
                if ( s ) {
                        char buf[1024];
 
@@ -352,7 +359,7 @@ pw2entry( Backend *be, struct passwd *pw, Entry *e )
                        attr_merge_normalize_one( e, ad_sn, &val, NULL );
                }
        }
-#endif /* HAVE_PW_GECOS */
+#endif /* HAVE_STRUCT_PASSWD_PW_GECOS */
 
        return( 0 );
 }