summaryrefslogtreecommitdiffstats
path: root/source3/smbd/srvstr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-03-31 13:48:24 +0000
committerAndrew Tridgell <tridge@samba.org>2001-03-31 13:48:24 +0000
commit578a9fabfb08740bd13af7418ceda41d1341cc5d (patch)
tree0d1a2f97697ddc2066508e16c28349fe90a0e1fd /source3/smbd/srvstr.c
parentfd6e9d6db98086e47650e5679064172fd5454f40 (diff)
downloadsamba-578a9fabfb08740bd13af7418ceda41d1341cc5d.tar.gz
samba-578a9fabfb08740bd13af7418ceda41d1341cc5d.tar.xz
samba-578a9fabfb08740bd13af7418ceda41d1341cc5d.zip
started converting some of the only-ascii code to use srvstr_*
added srvstr_push_ascii() and srvstr_pull_ascii() as convenience routines to replace the current usage of strncpy() like fns for packet pull/push. We need to do this in *lots* of places in Samba in order to get our codepage handling right (This used to be commit 8b0e3679a6dc479c0e3177707dff386559779b69)
Diffstat (limited to 'source3/smbd/srvstr.c')
-rw-r--r--source3/smbd/srvstr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c
index 55cbada10c..6ca34a2428 100644
--- a/source3/smbd/srvstr.c
+++ b/source3/smbd/srvstr.c
@@ -144,3 +144,21 @@ int srvstr_align(void *inbuf, int offset)
if (!UNICODE_FLAG(inbuf)) return 0;
return offset & 1;
}
+
+
+/****************************************************************************
+these are useful for replacing all those StrnCpy() ops for copying data
+to/from the wire
+****************************************************************************/
+
+int srvstr_push_ascii(void *dest, const char *src, int dest_len)
+{
+ return srvstr_push(NULL, dest, src, dest_len,
+ STR_ASCII|STR_CONVERT|STR_TERMINATE);
+}
+
+int srvstr_pull_ascii(char *dest, const void *src, int dest_len)
+{
+ return srvstr_pull(NULL, dest, src, dest_len, -1,
+ STR_ASCII|STR_CONVERT|STR_TERMINATE);
+}