From e4773b184cd6ccf1e46ec151afbfd9fb9ad3ede8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Nov 2003 03:21:49 +0000 Subject: added tests for the remaining calls on the rpc management interface (This used to be commit 00f9b0e12061c175334f96805ca8333f28f74d91) --- source4/librpc/ndr/ndr_basic.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source4/librpc/ndr') diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 5f59899133..a45771ef28 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -730,6 +730,38 @@ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, ndr->depth--; } +/* + build a GUID from a string +*/ +NTSTATUS GUID_from_string(const char *s, struct GUID *guid) +{ + uint32 time_low; + uint32 time_mid, time_hi_and_version; + uint32 clock_seq_hi_and_reserved; + uint32 clock_seq_low; + uint32 node[6]; + int i; + + if (11 != sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + &time_low, &time_mid, &time_hi_and_version, + &clock_seq_hi_and_reserved, &clock_seq_low, + &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { + return NT_STATUS_INVALID_PARAMETER; + } + + SIVAL(guid->info, 0, time_low); + SSVAL(guid->info, 4, time_mid); + SSVAL(guid->info, 6, time_hi_and_version); + SCVAL(guid->info, 8, clock_seq_hi_and_reserved); + SCVAL(guid->info, 9, clock_seq_low); + for (i=0;i<6;i++) { + SCVAL(guid->info, 10 + i, node[i]); + } + + return NT_STATUS_OK; +} + + const char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) { return talloc_asprintf(mem_ctx, -- cgit