mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
Implement slapi_entry_has_children()
This commit is contained in:
parent
a18e199e0d
commit
13e657ffa8
@ -48,6 +48,8 @@ extern void slapi_entry_attr_set_uint( Slapi_Entry* e, const char *type, unsigne
|
||||
extern void slapi_entry_attr_set_long(Slapi_Entry* e, const char *type, long l);
|
||||
extern void slapi_entry_attr_set_ulong(Slapi_Entry* e, const char *type, unsigned long l);
|
||||
extern int slapi_is_rootdse( const char *dn );
|
||||
extern int slapi_entry_has_children(const Slapi_Entry *e);
|
||||
|
||||
extern int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
|
||||
extern int slapi_entry_add_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
|
||||
extern int slapi_entry_add_valueset(Slapi_Entry *e, const char *type, Slapi_ValueSet *vs);
|
||||
@ -297,6 +299,7 @@ extern Slapi_PBlock *slapi_modrdn_internal( char * olddn, char * newrdn,
|
||||
int deloldrdn, LDAPControl **controls, int log_change);
|
||||
extern char **slapi_get_supported_extended_ops(void);
|
||||
extern struct berval *slapi_int_get_supported_extop( int );
|
||||
Connection *slapi_int_init_connection(char *DN, int OpType);
|
||||
|
||||
/*
|
||||
* Was: slapi_cl.h
|
||||
|
@ -119,7 +119,7 @@ internal_search_reference(
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
static Connection *
|
||||
Connection *
|
||||
slapi_int_init_connection(
|
||||
char *DN,
|
||||
int OpType )
|
||||
|
@ -109,7 +109,7 @@ bvptr2obj(
|
||||
Slapi_Entry *
|
||||
slapi_str2entry(
|
||||
char *s,
|
||||
int check_dup )
|
||||
int flags )
|
||||
{
|
||||
#ifdef LDAP_SLAPI
|
||||
Slapi_Entry *e = NULL;
|
||||
@ -529,6 +529,35 @@ slapi_is_rootdse( const char *dn )
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
slapi_entry_has_children(const Slapi_Entry *e)
|
||||
{
|
||||
#ifdef LDAP_SLAPI
|
||||
Connection *pConn;
|
||||
Operation *op;
|
||||
int hasSubordinates = 0;
|
||||
|
||||
pConn = slapi_int_init_connection( NULL, LDAP_REQ_SEARCH );
|
||||
if ( pConn == NULL ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
op = (Operation *)pConn->c_pending_ops.stqh_first;
|
||||
op->o_bd = select_backend( (struct berval *)&e->e_nname, 0, 0 );
|
||||
if ( op->o_bd == NULL ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
op->o_bd->be_has_subordinates( op, (Entry *)e, &hasSubordinates );
|
||||
|
||||
slapi_int_connection_destroy( &pConn );
|
||||
|
||||
return ( hasSubordinates == LDAP_COMPARE_TRUE );
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Add values to entry.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user