1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

librpc/wsp: add some helper functions needed to support AQS

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Noel Power 2022-10-17 14:20:49 +01:00 committed by Andrew Bartlett
parent ae9d9434de
commit 46b4a99bfe
2 changed files with 38 additions and 0 deletions

View File

@ -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);
}

View File

@ -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__ */