diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-08-25 10:05:15 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-08-30 08:44:38 +0200 |
commit | 11a3d78951c897c46264203daaad12a3ead5cf8c (patch) | |
tree | 182b0fa7569239e7bf667e3a12598eb6a88a5164 /librpc | |
parent | fbf3d03550495df58adeb291a44776270d6cf01d (diff) | |
download | samba-11a3d78951c897c46264203daaad12a3ead5cf8c.tar.gz samba-11a3d78951c897c46264203daaad12a3ead5cf8c.tar.bz2 samba-11a3d78951c897c46264203daaad12a3ead5cf8c.zip |
librpc/ndr: correctly implement ndr_charset_length()
Before we ignored the charset type.
metze
Diffstat (limited to 'librpc')
-rw-r--r-- | librpc/ndr/ndr_string.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 568c36845e..2e04633963 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -714,7 +714,19 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, /* Return number of elements in a string in the specified charset */ _PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset) { - /* FIXME: Treat special chars special here, taking chset into account */ - /* Also include 0 byte */ + switch (chset) { + /* case CH_UTF16: this has the same value as CH_UTF16LE */ + case CH_UTF16LE: + case CH_UTF16BE: + case CH_UTF16MUNGED: + return strlen_m_term((const char *)var); + case CH_DISPLAY: + case CH_DOS: + case CH_UNIX: + case CH_UTF8: + return strlen((const char *)var)+1; + } + + /* Fallback, this should never happen */ return strlen((const char *)var)+1; } |