summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-06-17 16:29:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:23 -0500
commitcd39847e815bea73b6bcae63541dd36b1715aa6c (patch)
tree8d32a9a57ec3b27282f5042a9b570c9d7348d805 /source4/librpc
parent5b19286df08d6cf10654d6e20c323ba44f7d2054 (diff)
downloadsamba-cd39847e815bea73b6bcae63541dd36b1715aa6c.tar.gz
samba-cd39847e815bea73b6bcae63541dd36b1715aa6c.tar.bz2
samba-cd39847e815bea73b6bcae63541dd36b1715aa6c.zip
r7695: Add support for the [string] attribute that works in the traditional sense. Not
used anywhere yet. (This used to be commit a73a35cfc7b5b92cd95bd0d0fbd64d04acecccf3)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/ndr_string.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index aa612eca38..af9783ed95 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -569,3 +569,30 @@ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char
}
ndr->depth--;
}
+
+/* Return number of elements in a string including the last (zeroed) element */
+uint32_t ndr_string_length(void *_var, uint32_t element_size)
+{
+ uint32_t i;
+ uint8_t zero[4] = {0,0,0,0};
+ char *var = _var;
+
+ for (i = 0; memcmp(var+i*element_size,zero,element_size) != 0; i++);
+
+ return i+1;
+}
+
+NTSTATUS ndr_check_string_terminator(struct ndr_pull *ndr, const void *_var, uint32_t count, uint32_t element_size)
+{
+ const char *var = _var;
+ uint32_t i;
+
+ for (i = 0; i < element_size; i++) {
+ if (var+element_size*(count-1)+i != 0) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
+ return NT_STATUS_OK;
+
+}