From: Noel Power Date: Mon, 17 Oct 2022 13:20:49 +0000 (+0100) Subject: librpc/wsp: add some helper functions needed to support AQS X-Git-Tag: talloc-2.4.2~1036 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46b4a99bfe195122bd8684f9211cb3fb4f536baf;p=thirdparty%2Fsamba.git librpc/wsp: add some helper functions needed to support AQS Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/librpc/wsp/wsp_util.c b/librpc/wsp/wsp_util.c index d2bebc3b92d..6b6f358a6f4 100644 --- a/librpc/wsp/wsp_util.c +++ b/librpc/wsp/wsp_util.c @@ -489,3 +489,34 @@ struct wsp_cfullpropspec *get_full_prop(struct wsp_crestriction *restriction) } return result; } + +void set_variant_lpwstr(TALLOC_CTX *ctx, + struct wsp_cbasestoragevariant *vvalue, + const char *string_val) +{ + vvalue->vtype = VT_LPWSTR; + vvalue->vvalue.vt_lpwstr.value = talloc_strdup(ctx, string_val); +} + +static void fill_string_vec(TALLOC_CTX* ctx, + struct wsp_cbasestoragevariant *variant, + const char **strings, uint16_t elems) +{ + int i; + variant->vvalue.vt_lpwstr_v.vvector_elements = elems; + variant->vvalue.vt_lpwstr_v.vvector_data = talloc_zero_array(ctx, + struct vt_lpwstr, + elems); + + for( i = 0; i < elems; i++ ) { + variant->vvalue.vt_lpwstr_v.vvector_data[ i ].value = talloc_strdup(ctx, strings[ i ]); + } +} + +void set_variant_lpwstr_vector(TALLOC_CTX *ctx, + struct wsp_cbasestoragevariant *variant, + const char **string_vals, uint32_t elems) +{ + variant->vtype = VT_LPWSTR | VT_VECTOR; + fill_string_vec(ctx, variant, string_vals, elems); +} diff --git a/librpc/wsp/wsp_util.h b/librpc/wsp/wsp_util.h index 7b208f96425..167a6dae51a 100644 --- a/librpc/wsp/wsp_util.h +++ b/librpc/wsp/wsp_util.h @@ -25,6 +25,7 @@ struct safearraybound; struct wsp_cfullpropspec; +struct wsp_cbasestoragevariant; struct wsp_crestriction; struct full_propset_info { @@ -51,5 +52,11 @@ const struct full_propset_info *get_propset_info_with_guid( const char *prop_name, struct GUID *guid); +void set_variant_lpwstr(TALLOC_CTX *ctx, + struct wsp_cbasestoragevariant *vvalue, + const char *string_val); +void set_variant_lpwstr_vector(TALLOC_CTX *ctx, + struct wsp_cbasestoragevariant *variant, + const char **string_vals, uint32_t elems); struct wsp_cfullpropspec *get_full_prop(struct wsp_crestriction *restriction); #endif /* __LIBRPC_WSP_UTIL_H__ */