mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 02:29:34 -05:00
cleanup
This commit is contained in:
parent
b7ed9571db
commit
62497187c7
2 changed files with 19 additions and 11 deletions
|
|
@ -713,12 +713,14 @@ ldap_back_entry_get(
|
|||
struct berval bdn;
|
||||
LDAPMessage *result = NULL,
|
||||
*e = NULL;
|
||||
char *gattr[3];
|
||||
char *attr[3], **attrp = NULL;
|
||||
char *filter = NULL;
|
||||
SlapReply rs;
|
||||
int do_retry = 1;
|
||||
LDAPControl **ctrls = NULL;
|
||||
|
||||
*ent = NULL;
|
||||
|
||||
/* Tell getconn this is a privileged op */
|
||||
do_not_cache = op->o_do_not_cache;
|
||||
op->o_do_not_cache = 1;
|
||||
|
|
@ -730,14 +732,15 @@ ldap_back_entry_get(
|
|||
op->o_do_not_cache = do_not_cache;
|
||||
|
||||
if ( at ) {
|
||||
attrp = attr;
|
||||
if ( oc && at != slap_schema.si_ad_objectClass ) {
|
||||
gattr[0] = slap_schema.si_ad_objectClass->ad_cname.bv_val;
|
||||
gattr[1] = at->ad_cname.bv_val;
|
||||
gattr[2] = NULL;
|
||||
attr[0] = slap_schema.si_ad_objectClass->ad_cname.bv_val;
|
||||
attr[1] = at->ad_cname.bv_val;
|
||||
attr[2] = NULL;
|
||||
|
||||
} else {
|
||||
gattr[0] = at->ad_cname.bv_val;
|
||||
gattr[1] = NULL;
|
||||
attr[0] = at->ad_cname.bv_val;
|
||||
attr[1] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -760,8 +763,8 @@ ldap_back_entry_get(
|
|||
|
||||
retry:
|
||||
rc = ldap_search_ext_s( lc->lc_ld, ndn->bv_val, LDAP_SCOPE_BASE, filter,
|
||||
at ? gattr : NULL, 0, ctrls, NULL,
|
||||
LDAP_NO_LIMIT, LDAP_NO_LIMIT, &result );
|
||||
attrp, 0, ctrls, NULL,
|
||||
NULL, LDAP_NO_LIMIT, &result );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
if ( rc == LDAP_SERVER_DOWN && do_retry ) {
|
||||
do_retry = 0;
|
||||
|
|
@ -774,10 +777,15 @@ retry:
|
|||
|
||||
e = ldap_first_entry( lc->lc_ld, result );
|
||||
if ( e == NULL ) {
|
||||
/* the entry exists, but it doesn't match the filter? */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
*ent = ch_calloc( 1, sizeof( Entry ) );
|
||||
if ( *ent == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rc = ldap_build_entry( op, e, *ent, &bdn );
|
||||
|
||||
|
|
|
|||
|
|
@ -835,11 +835,11 @@ void slap_mods_opattrs(
|
|||
csn = op->o_csn;
|
||||
}
|
||||
ptr = ber_bvchr( &csn, '#' );
|
||||
if ( ptr && ptr < &csn.bv_val[csn.bv_len] ) {
|
||||
if ( ptr ) {
|
||||
timestamp.bv_len = ptr - csn.bv_val;
|
||||
if ( timestamp.bv_len >= sizeof( timebuf ))
|
||||
if ( timestamp.bv_len >= sizeof( timebuf )) /* ?!? */
|
||||
timestamp.bv_len = sizeof( timebuf ) - 1;
|
||||
strncpy( timebuf, csn.bv_val, timestamp.bv_len );
|
||||
AC_MEMCPY( timebuf, csn.bv_val, timestamp.bv_len );
|
||||
timebuf[timestamp.bv_len] = '\0';
|
||||
} else {
|
||||
time_t now = slap_get_time();
|
||||
|
|
|
|||
Loading…
Reference in a new issue