Implement slapi_entry_{get,set}_uniqueid

This commit is contained in:
Luke Howard 2004-05-23 16:04:27 +00:00
parent 767f588520
commit f9b719f56e
2 changed files with 34 additions and 0 deletions

View File

@ -61,6 +61,8 @@ extern int slapi_entry_add_string(Slapi_Entry *e, const char *type, const char *
extern int slapi_entry_delete_string(Slapi_Entry *e, const char *type, const char *value);
extern int slapi_entry_first_attr( const Slapi_Entry *e, Slapi_Attr **attr );
extern int slapi_entry_next_attr( const Slapi_Entry *e, Slapi_Attr *prevattr, Slapi_Attr **attr );
extern const char *slapi_entry_get_uniqueid( const Slapi_Entry *e );
extern void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid );
extern int slapi_entry_schema_check( Slapi_PBlock *pb, Slapi_Entry *e );
extern int slapi_entry_rdn_values_present( const Slapi_Entry *e );
extern int slapi_entry_add_rdn_values( Slapi_Entry *e );

View File

@ -4166,3 +4166,35 @@ int slapi_entry_add_rdn_values( Slapi_Entry *e )
#endif /* LDAP_SLAPI */
}
const char *slapi_entry_get_uniqueid( const Slapi_Entry *e )
{
#ifdef LDAP_SLAPI
Attribute *attr;
const char *uniqueid;
attr = attr_find( e->e_attrs, slap_schema.si_ad_entryUUID );
if ( attr == NULL ) {
return NULL;
}
if ( attr->a_vals != NULL && attr->a_vals[0].bv_len != 0 ) {
return slapi_value_get_string( &attr->a_vals[0] );
}
#endif /* LDAP_SLAPI */
return NULL;
}
void slapi_entry_set_uniqueid( Slapi_Entry *e, char *uniqueid )
{
#ifdef LDAP_SLAPI
struct berval bv;
attr_delete ( &e->e_attrs, slap_schema.si_ad_entryUUID );
bv.bv_val = uniqueid;
bv.bv_len = strlen( uniqueid );
attr_merge_normalize_one( e, slap_schema.si_ad_entryUUID, &bv, NULL );
#endif /* LDAP_SLAPI */
}