[PATCH 2/7] ndr: Add ndr_ntprinting_string_flags() function.

Andreas Schneider asn at samba.org
Wed Mar 13 04:48:15 MDT 2013


It defaults to utf8string.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 librpc/ndr/ndr_ntprinting.c | 15 +++++++++++++++
 librpc/ndr/ndr_ntprinting.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/librpc/ndr/ndr_ntprinting.c b/librpc/ndr/ndr_ntprinting.c
index 76b296d..b22830f 100644
--- a/librpc/ndr/ndr_ntprinting.c
+++ b/librpc/ndr/ndr_ntprinting.c
@@ -22,6 +22,21 @@
 #include "includes.h"
 #include "../librpc/gen_ndr/ndr_ntprinting.h"
 
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t string_flags)
+{
+	uint32_t flags = LIBNDR_FLAG_STR_NULLTERM;
+
+	if (string_flags & LIBNDR_FLAG_STR_ASCII) {
+		flags |= LIBNDR_FLAG_STR_ASCII;
+	} else if (string_flags & LIBNDR_FLAG_STR_RAW8) {
+		flags |= LIBNDR_FLAG_STR_RAW8;
+	} else {
+		flags |= LIBNDR_FLAG_STR_UTF8;
+	}
+
+	return flags;
+}
+
 _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r)
 {
 	uint32_t _ptr_devmode;
diff --git a/librpc/ndr/ndr_ntprinting.h b/librpc/ndr/ndr_ntprinting.h
index 8bda430..16cea0f 100644
--- a/librpc/ndr/ndr_ntprinting.h
+++ b/librpc/ndr/ndr_ntprinting.h
@@ -22,4 +22,6 @@
 #include "includes.h"
 #include "../librpc/gen_ndr/ndr_ntprinting.h"
 
+_PUBLIC_ uint32_t ndr_ntprinting_string_flags(uint32_t negotiate_flags);
+
 _PUBLIC_ enum ndr_err_code ndr_pull_ntprinting_printer(struct ndr_pull *ndr, int ndr_flags, struct ntprinting_printer *r);
-- 
1.8.1.5




More information about the samba-technical mailing list