From fc55ee9edca2d904d31f716d66227f3802326986 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Fri, 24 Jan 2003 09:23:06 +0000 Subject: [PATCH] Support slapi_entry_first_attr()/slapi_entry_next_attr() API --- servers/slapd/slapi/slapi_utils.c | 36 +++++++++++++++++++++++++++++++ servers/slapd/slapi/slapi_utils.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 0922ae0138..73e34e29be 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -462,6 +462,42 @@ slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals #endif } +int +slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ) +{ +#ifdef LDAP_SLAPI + if ( e == NULL ) { + return -1; + } + + *attr = e->e_attrs; + + return ( *attr != NULL ) ? 0 : -1; +#else + return -1; +#endif +} + +int +slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ) +{ +#ifdef LDAP_SLAPI + if ( e == NULL ) { + return -1; + } + + if ( prevattr == NULL ) { + return -1; + } + + *attr = prevattr->a_next; + + return ( *attr != NULL ) ? 0 : -1; +#else + return -1; +#endif +} + int slapi_entry_attr_replace_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ) { diff --git a/servers/slapd/slapi/slapi_utils.h b/servers/slapd/slapi/slapi_utils.h index 2e31d54253..c8d4de45f1 100644 --- a/servers/slapd/slapi/slapi_utils.h +++ b/servers/slapd/slapi/slapi_utils.h @@ -55,6 +55,8 @@ int slapi_entry_attr_get_uint( const Slapi_Entry *e, const char *type ); int slapi_entry_attr_get_ulong( const Slapi_Entry *e, const char *type ); int slapi_entry_attr_hasvalue( Slapi_Entry *e, const char *type, const char *value ); int slapi_entry_attr_merge_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals ); +int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr ); +int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr ); char *slapi_entry_get_dn( Slapi_Entry *e ); int slapi_x_entry_get_id( Slapi_Entry *e ); void slapi_entry_set_dn( Slapi_Entry *e, char *dn ); -- 2.39.5