summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-21 04:14:28 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-21 04:14:28 +0000
commitd689f00026541dd2cb87c6949fdc2f8eb3ad919f (patch)
tree864274dbd6a3e30fb029ea2dee72c9803b0a5e13
parent7fb8d5a00bf0e13f5198c3f1cdae1343d636bdd0 (diff)
downloadsamba-d689f00026541dd2cb87c6949fdc2f8eb3ad919f.tar.gz
samba-d689f00026541dd2cb87c6949fdc2f8eb3ad919f.tar.bz2
samba-d689f00026541dd2cb87c6949fdc2f8eb3ad919f.zip
converted the last couple of functions in libsmb to be unicode
the whole of libsmb should now do unicode where appropriate (This used to be commit ac7529d2b69826f8214d5632c31778cc87216653)
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/libsmb/clirap.c24
-rw-r--r--source3/libsmb/clistr.c8
3 files changed, 22 insertions, 18 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ab1f235aa7..4f703dedb1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -906,10 +906,10 @@ BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd);
/*The following definitions come from libsmb/clistr.c */
-int clistr_push(struct cli_state *cli, void *dest, 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 clistr_pull(struct cli_state *cli, char *dest, void *src, int dest_len, int src_len, int flags);
-int clistr_pull_size(struct cli_state *cli, void *src, int src_len);
+int clistr_push(struct cli_state *cli, void *dest, const char *src, int dest_len, int flags);
+int clistr_push_size(struct cli_state *cli, const void *dest, const char *src, int dest_len, int flags);
+int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len, int src_len, int flags);
+int clistr_pull_size(struct cli_state *cli, const void *src, int src_len);
int clistr_align(struct cli_state *cli, int offset);
/*The following definitions come from libsmb/clitrans.c */
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index bf0940d1d6..3c87464495 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -388,13 +388,15 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
int count=8;
BOOL ret;
time_t (*date_fn)(void *);
+ char *p;
- param_len = strlen(fname) + 7;
+ p = param;
+ memset(p, 0, 6);
+ SSVAL(p, 0, SMB_INFO_STANDARD);
+ p += 6;
+ p += clistr_push(cli, p, fname, sizeof(pstring)-6, CLISTR_TERMINATE | CLISTR_CONVERT);
- memset(param, 0, param_len);
- SSVAL(param, 0, SMB_INFO_STANDARD);
- pstrcpy(&param[6], fname);
- unix_to_dos(&param[6],True);
+ param_len = PTR_DIFF(p, param);
do {
ret = (cli_send_trans(cli, SMBtrans2,
@@ -462,13 +464,15 @@ BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
uint16 setup = TRANSACT2_QPATHINFO;
pstring param;
char *rparam=NULL, *rdata=NULL;
+ char *p;
- param_len = strlen(fname) + 7;
+ p = param;
+ memset(p, 0, 6);
+ SSVAL(p, 0, SMB_QUERY_FILE_ALL_INFO);
+ p += 6;
+ p += clistr_push(cli, p, fname, sizeof(pstring)-6, CLISTR_TERMINATE | CLISTR_CONVERT);
- memset(param, 0, param_len);
- SSVAL(param, 0, SMB_QUERY_FILE_ALL_INFO);
- pstrcpy(&param[6], fname);
- unix_to_dos(&param[6],True);
+ param_len = PTR_DIFF(p, param);
if (!cli_send_trans(cli, SMBtrans2,
NULL, /* name */
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index 9f46099ba9..e07b4d5a63 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -36,7 +36,7 @@ flags can have:
dest_len is the maximum length allowed in the destination. If dest_len
is -1 then no maxiumum is used
****************************************************************************/
-int clistr_push(struct cli_state *cli, void *dest, char *src, int dest_len, int flags)
+int clistr_push(struct cli_state *cli, void *dest, const char *src, int dest_len, int flags)
{
int len=0;
@@ -84,7 +84,7 @@ return the length that a string would occupy when copied with clistr_push()
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, void *dest, char *src, int dest_len, int flags)
+int clistr_push_size(struct cli_state *cli, const void *dest, const char *src, int dest_len, int flags)
{
int len = strlen(src);
if (flags & CLISTR_TERMINATE) len++;
@@ -107,7 +107,7 @@ if CLISTR_TERMINATE is set then src_len is ignored
src_len is the length of the source area in bytes
return the number of bytes occupied by the string in src
****************************************************************************/
-int clistr_pull(struct cli_state *cli, char *dest, void *src, int dest_len, int src_len, int flags)
+int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len, int src_len, int flags)
{
int len;
@@ -157,7 +157,7 @@ return the length that a string would occupy (not including the null)
when copied with clistr_pull()
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)
+int clistr_pull_size(struct cli_state *cli, const void *src, int src_len)
{
if (clistr_align(cli, PTR_DIFF(cli->inbuf, src))) {
src++;