summaryrefslogtreecommitdiff
path: root/source3/libsmb/clistr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-20 10:11:40 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-20 10:11:40 +0000
commitc565c98723f1fab04d47ae6076d742c8ee2dcb49 (patch)
tree6666eba5ae7ab3feb4d18133df65d4cac4675908 /source3/libsmb/clistr.c
parent6492d6b2f6a2743f5e794447911cbbba7e031d5d (diff)
downloadsamba-c565c98723f1fab04d47ae6076d742c8ee2dcb49.tar.gz
samba-c565c98723f1fab04d47ae6076d742c8ee2dcb49.tar.bz2
samba-c565c98723f1fab04d47ae6076d742c8ee2dcb49.zip
pipe opening now works with unicode
(This used to be commit ba3ce3404e1cd2e9da3ba1708f6fc8a12c085ef2)
Diffstat (limited to 'source3/libsmb/clistr.c')
-rw-r--r--source3/libsmb/clistr.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index 839dec7592..eb66d08c30 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -47,6 +47,11 @@ int clistr_push(struct cli_state *cli, void *dest, char *src, int dest_len, int
dest_len = sizeof(pstring);
}
+ if (clistr_align(cli, PTR_DIFF(cli->outbuf, dest))) {
+ dest++;
+ dest_len--;
+ }
+
if (!cli_use_unicode || !(cli->capabilities & CAP_UNICODE)) {
/* the server doesn't want unicode */
safe_strcpy(dest, src, dest_len);
@@ -77,12 +82,18 @@ return the length that a string would occupy when copied with clistr_push()
CLISTR_TERMINATE means include the null termination
CLISTR_CONVERT means convert from unix to dos codepage
CLISTR_UPPER means uppercase in the destination
+note that dest is only used for alignment purposes. No data is written.
****************************************************************************/
-int clistr_push_size(struct cli_state *cli, char *src, int dest_len, int flags)
+int clistr_push_size(struct cli_state *cli, void *dest, char *src, int dest_len, int flags)
{
int len = strlen(src);
if (flags & CLISTR_TERMINATE) len++;
if (cli_use_unicode && (cli->capabilities & CAP_UNICODE)) len *= 2;
+
+ if (clistr_align(cli, PTR_DIFF(cli->outbuf, dest))) {
+ len++;
+ }
+
return len;
}
@@ -104,6 +115,11 @@ int clistr_pull(struct cli_state *cli, char *dest, void *src, int dest_len, int
dest_len = sizeof(pstring);
}
+ if (clistr_align(cli, PTR_DIFF(cli->inbuf, src))) {
+ src++;
+ if (src_len > 0) src_len--;
+ }
+
if (!cli_use_unicode || !(cli->capabilities & CAP_UNICODE)) {
/* the server doesn't want unicode */
if (flags & CLISTR_TERMINATE) {
@@ -143,6 +159,11 @@ if src_len is -1 then assume the source is null terminated
****************************************************************************/
int clistr_pull_size(struct cli_state *cli, void *src, int src_len)
{
+ if (clistr_align(cli, PTR_DIFF(cli->inbuf, src))) {
+ src++;
+ if (src_len > 0) src_len--;
+ }
+
if (!cli_use_unicode || !(cli->capabilities & CAP_UNICODE)) {
return strlen(src);
}