From 578a9fabfb08740bd13af7418ceda41d1341cc5d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 31 Mar 2001 13:48:24 +0000 Subject: 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) --- source3/smbd/srvstr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source3/smbd/srvstr.c') 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); +} -- cgit