summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-06-07 10:00:39 +0200
committerAndreas Schneider <asn@samba.org>2010-06-28 10:18:12 +0200
commitdc2e41a16ab5c203d73bfc6e9f368820221ee3ea (patch)
tree839e9fe139881af938ac2d2c340e60a7dff7a2e5 /librpc/ndr
parentb46eccfb1983c3107bcce2b8b5689e37cf3ec55f (diff)
downloadsamba-dc2e41a16ab5c203d73bfc6e9f368820221ee3ea.tar.gz
samba-dc2e41a16ab5c203d73bfc6e9f368820221ee3ea.tar.bz2
samba-dc2e41a16ab5c203d73bfc6e9f368820221ee3ea.zip
librpc: Use switch in GUID_from_data_blob().
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/uuid.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/librpc/ndr/uuid.c b/librpc/ndr/uuid.c
index 5b6053167a..d46da0993d 100644
--- a/librpc/ndr/uuid.c
+++ b/librpc/ndr/uuid.c
@@ -74,7 +74,9 @@ _PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
return NT_STATUS_INVALID_PARAMETER;
}
- if (s->length == 36) {
+ switch(s->length) {
+ case 36:
+ {
TALLOC_CTX *mem_ctx;
const char *string;
@@ -90,8 +92,10 @@ _PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
status = NT_STATUS_OK;
}
talloc_free(mem_ctx);
-
- } else if (s->length == 38) {
+ break;
+ }
+ case 38:
+ {
TALLOC_CTX *mem_ctx;
const char *string;
@@ -107,8 +111,10 @@ _PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
status = NT_STATUS_OK;
}
talloc_free(mem_ctx);
-
- } else if (s->length == 32) {
+ break;
+ }
+ case 32:
+ {
size_t rlen = strhex_to_str((char *)blob16.data, blob16.length,
(const char *)s->data, s->length);
if (rlen == blob16.length) {
@@ -116,10 +122,13 @@ _PUBLIC_ NTSTATUS GUID_from_data_blob(const DATA_BLOB *s, struct GUID *guid)
status = NT_STATUS_OK;
s = &blob16;
}
+ break;
}
-
- if (s->length == 16) {
+ case 16:
return GUID_from_ndr_blob(s, guid);
+ default:
+ status = NT_STATUS_INVALID_PARAMETER;
+ break;
}
if (!NT_STATUS_IS_OK(status)) {