mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Added slapi_attr_get_flags() and slapi_attr_flag_is_set() API for
Sun ONE harmonisation.
This commit is contained in:
parent
6f26183f20
commit
f1fdb34fbe
@ -36,6 +36,17 @@ LDAP_END_DECL
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* Attribute flags returned by slapi_attr_get_flags()
|
||||
*/
|
||||
#define SLAPI_ATTR_FLAG_SINGLE 0x0001
|
||||
#define SLAPI_ATTR_FLAG_OPATTR 0x0002
|
||||
#define SLAPI_ATTR_FLAG_READONLY 0x0004
|
||||
#define SLAPI_ATTR_FLAG_STD_ATTR SLAPI_ATTR_FLAG_READONLY
|
||||
#define SLAPI_ATTR_FLAG_OBSOLETE 0x0040
|
||||
#define SLAPI_ATTR_FLAG_COLLECTIVE 0x0080
|
||||
#define SLAPI_ATTR_FLAG_NOUSERMOD 0x0100
|
||||
|
||||
/*
|
||||
* Plugin types universally supported by SLAPI
|
||||
* implementations
|
||||
|
@ -1329,3 +1329,45 @@ int slapi_is_connection_ssl( Slapi_PBlock *pb, int *isSSL )
|
||||
return -1;
|
||||
#endif /* defined(LDAP_SLAPI) */
|
||||
}
|
||||
|
||||
int slapi_attr_get_flags( Slapi_Attr *attr, unsigned long *flags )
|
||||
{
|
||||
#if defined( LDAP_SLAPI )
|
||||
AttributeType *at;
|
||||
|
||||
if ( attr == NULL )
|
||||
return LDAP_PARAM_ERROR;
|
||||
|
||||
at = attr->a_desc->ad_type;
|
||||
|
||||
*flags = SLAPI_ATTR_FLAG_STD_ATTR;
|
||||
|
||||
if ( is_at_single_value( at ) )
|
||||
*flags |= SLAPI_ATTR_FLAG_SINGLE;
|
||||
if ( is_at_operational( at ) )
|
||||
*flags |= SLAPI_ATTR_FLAG_OPATTR;
|
||||
if ( is_at_obsolete( at ) )
|
||||
*flags |= SLAPI_ATTR_FLAG_OBSOLETE;
|
||||
if ( is_at_collective( at ) )
|
||||
*flags |= SLAPI_ATTR_FLAG_COLLECTIVE;
|
||||
if ( is_at_no_user_mod( at ) )
|
||||
*flags |= SLAPI_ATTR_FLAG_NOUSERMOD;
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
#else
|
||||
return -1;
|
||||
#endif /* defined(LDAP_SLAPI) */
|
||||
}
|
||||
|
||||
int slapi_attr_flag_is_set( Slapi_Attr *attr, unsigned long flag )
|
||||
{
|
||||
#if defined( LDAP_SLAPI )
|
||||
unsigned long flags;
|
||||
|
||||
if ( slapi_attr_get_flags( attr, &flags ) != 0 )
|
||||
return 0;
|
||||
return (flags & flag) ? 1 : 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif /* defined(LDAP_SLAPI) */
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ Slapi_Entry *slapi_entry_dup( Slapi_Entry *e );
|
||||
Slapi_Entry *slapi_entry_alloc();
|
||||
void slapi_entry_free( Slapi_Entry *e );
|
||||
int slapi_attr_get_values( Slapi_Attr *attr, struct berval ***vals );
|
||||
int slapi_attr_get_flags( Slapi_Attr *attr, unsigned long *flags );
|
||||
int slapi_attr_flag_is_set( Slapi_Attr *attr, unsigned long flag );
|
||||
char *slapi_ch_malloc( unsigned long size );
|
||||
void slapi_ch_free( void **ptr );
|
||||
char *slapi_ch_calloc( unsigned long nelem, unsigned long size );
|
||||
|
Loading…
Reference in New Issue
Block a user