static Entry *pw2entry(
Backend *be,
- struct passwd *pw);
+ struct passwd *pw,
+ const char **text);
int
passwd_back_search(
LDAPRDN *rdn = NULL;
char *parent = NULL;
char *matched = NULL;
- char *user = NULL;
+ const char *text = NULL;
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
matched = (char *) base;
if( scope != LDAP_SCOPE_ONELEVEL ) {
- const char *text;
AttributeDescription *desc = NULL;
/* Create an entry corresponding to the base DN */
return( 0 );
}
- e = pw2entry( be, pw );
+ if ( !(e = pw2entry( be, pw, &text )) ) {
+ err = LDAP_OPERATIONS_ERROR;
+ endpwent();
+ goto done;
+ }
if ( test_filter( be, conn, op, e, filter ) == LDAP_COMPARE_TRUE ) {
/* check size limit */
}
} else {
- const char *text = NULL;
-
parent = dn_parent( be, nbase->bv_val );
/* This backend is only one layer deep. Don't answer requests for
goto done;
}
- e = pw2entry( be, pw );
+ if ( !(e = pw2entry( be, pw, &text )) ) {
+ err = LDAP_OPERATIONS_ERROR;
+ goto done;
+ }
if ( test_filter( be, conn, op, e, filter ) == LDAP_COMPARE_TRUE ) {
send_search_entry( be, conn, op,
done:
send_ldap_result( conn, op,
- err, err == LDAP_NO_SUCH_OBJECT ? matched : NULL, NULL,
+ err, err == LDAP_NO_SUCH_OBJECT ? matched : NULL, text,
NULL, NULL );
if( rdn != NULL ) ldap_rdnfree( rdn );
}
static Entry *
-pw2entry( Backend *be, struct passwd *pw )
+pw2entry( Backend *be, struct passwd *pw, const char **text )
{
size_t pwlen;
Entry *e;
struct berval bv;
int rc;
- const char *text;
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
AttributeDescription *ad_cn = NULL;
AttributeDescription *ad_uid = NULL;
AttributeDescription *ad_description = NULL;
- rc = slap_str2ad( "cn", &ad_cn, &text );
+ rc = slap_str2ad( "cn", &ad_cn, text );
if(rc != LDAP_SUCCESS) return NULL;
- rc = slap_str2ad( "sn", &ad_sn, &text );
+ rc = slap_str2ad( "sn", &ad_sn, text );
if(rc != LDAP_SUCCESS) return NULL;
- rc = slap_str2ad( "uid", &ad_uid, &text );
+ rc = slap_str2ad( "uid", &ad_uid, text );
if(rc != LDAP_SUCCESS) return NULL;
- rc = slap_str2ad( "description", &ad_description, &text );
+ rc = slap_str2ad( "description", &ad_description, text );
if(rc != LDAP_SUCCESS) return NULL;
/*