From 9eb008ab16212b94a7c859028d82759302ed384b Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 27 Feb 2003 13:00:25 +0000 Subject: [PATCH] Implemented slapi_dup_control(). --- servers/slapd/slapi/proto-slapi.h | 1 + servers/slapd/slapi/slapi_utils.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h index 78a167b304..11494570b4 100644 --- a/servers/slapd/slapi/proto-slapi.h +++ b/servers/slapd/slapi/proto-slapi.h @@ -169,6 +169,7 @@ extern void slapi_register_supported_control(char *controloid, extern int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp); extern int slapi_control_present( LDAPControl **controls, char *oid, struct berval **val, int *iscritical); +extern LDAPControl *slapi_dup_control(LDAPControl *control); extern void slapi_register_supported_saslmechanism(char *mechanism); extern char **slapi_get_supported_saslmechanisms(); extern char **slapi_get_supported_extended_ops(void); diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 001ee20693..3f8956aa6d 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -1210,6 +1210,23 @@ error_return: #endif /* LDAP_SLAPI */ } +LDAPControl * +slapi_dup_control( LDAPControl *ctrl ) +{ +#ifdef LDAP_SLAPI + LDAPControl *ret; + + ret = (LDAPControl *)slapi_ch_malloc( sizeof(*ret) ); + ret->ldctl_oid = slapi_ch_strdup( ctrl->ldctl_oid ); + ber_dupbv( &ret->ldctl_value, &ctrl->ldctl_value ); + ret->ldctl_iscritical = ctrl->ldctl_iscritical; + + return ret; +#else + return NULL; +#endif /* LDAP_SLAPI */ +} + void slapi_register_supported_saslmechanism( char *mechanism ) { -- 2.39.5