summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-07-20 01:32:56 +0000
committerTim Potter <tpot@samba.org>2001-07-20 01:32:56 +0000
commit8678c6d6f67f9f1f4f68eba4a3dc1bf87f4abc3a (patch)
treeb06171bbd91c81dd9afa949181eaf35c8eb5204f /source3
parentd3f1d7f7b670ce59c2349f2687ae3f6708be3254 (diff)
downloadsamba-8678c6d6f67f9f1f4f68eba4a3dc1bf87f4abc3a.tar.gz
samba-8678c6d6f67f9f1f4f68eba4a3dc1bf87f4abc3a.tar.bz2
samba-8678c6d6f67f9f1f4f68eba4a3dc1bf87f4abc3a.zip
It looks like the rpc client code in libsmb hasn't been converted to the
new internal string stuff. The main problem is that some unicode strings are null terminated and some aren't. There's no rhyme or reason to it - some pipes have 99% of the strings terminated and some have 99% unterminated. To avoid having to actually know the termination policy, I propose a set of functions that take a UNISTR2* and use the length contained there. Added rpcstr_pull_unistr2_string() function to convert a unicode string of dubious termination to a fstring. (This used to be commit e5b62b4961769e45bc377be6180ca61ef5f6c22e)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_unistr.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 4a1117d8d0..48bff4c41c 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -72,6 +72,16 @@ int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags)
return pull_ucs2(NULL, dest, src, dest_len, src_len, flags|STR_UNICODE|STR_NOALIGN);
}
+/* Copy a string from a unistr2 source to internal samba format
+ destination. Use this instead of direct calls to rpcstr_pull() to avoid
+ having to determine whether the source string is null terminated. */
+
+int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src)
+{
+ return pull_ucs2(NULL, dest, src->buffer, sizeof(fstring),
+ src->uni_str_len * 2, 0);
+}
+
/* Converts a string from internal samba format to unicode
*/
int rpcstr_push(void* dest, const char *src, int dest_len, int flags)