summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-26 06:53:42 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-26 06:53:42 +0000
commit0d54de536c03f941739359a121a337aa33a2dc84 (patch)
tree6ad3a1f33ef0226e84c9e73298dda4d889c529b2 /source3/libsmb
parent8cfc7453394224d04077e7e875fca89c47826410 (diff)
downloadsamba-0d54de536c03f941739359a121a337aa33a2dc84.tar.gz
samba-0d54de536c03f941739359a121a337aa33a2dc84.tar.bz2
samba-0d54de536c03f941739359a121a337aa33a2dc84.zip
made some LANMAN1 wildcard progress
it now handles -M LANMAN1 -f '.x' -m '?x' nicely (This used to be commit e7ccb9be6da9b1426eb136b4a0a1171232471768)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clilist.c18
-rw-r--r--source3/libsmb/clistr.c7
2 files changed, 16 insertions, 9 deletions
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index eccf3c553a..175673d4fe 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -133,10 +133,14 @@ static int interpret_long_filename(struct cli_state *cli,
p += 4; /* EA size */
slen = SVAL(p, 0);
p += 2;
- clistr_pull(cli, finfo->short_name, p,
- sizeof(finfo->short_name),
- 24,
- CLISTR_CONVERT);
+ {
+ /* stupid NT bugs. grr */
+ int flags = CLISTR_CONVERT;
+ if (p[1] == 0 && namelen > 1) flags |= CLISTR_UNICODE;
+ clistr_pull(cli, finfo->short_name, p,
+ sizeof(finfo->short_name),
+ 24, flags);
+ }
p += 24; /* short name? */
clistr_pull(cli, finfo->name, p,
sizeof(finfo->name),
@@ -159,8 +163,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
void (*fn)(file_info *, const char *, void *), void *state)
{
int max_matches = 512;
- /* NT uses 260, OS/2 uses 2. Both accept 1. */
- int info_level = cli->protocol<PROTOCOL_NT1?1:260;
+ int info_level;
char *p, *p2;
pstring mask;
file_info finfo;
@@ -179,6 +182,9 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
uint16 setup;
pstring param;
+ /* NT uses 260, OS/2 uses 2. Both accept 1. */
+ info_level = (cli->capabilities&CAP_NT_SMBS)?260:1;
+
pstrcpy(mask,Mask);
while (ff_eos == 0) {
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index 52137d9f78..1835e15971 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -103,6 +103,7 @@ cli->capabilities) to a char* destination
flags can have:
CLISTR_CONVERT means convert from dos to unix codepage
CLISTR_TERMINATE means the string in src is null terminated
+ CLISTR_UNICODE means to force as unicode
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
@@ -115,12 +116,12 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len
dest_len = sizeof(pstring);
}
- if (clistr_align(cli, PTR_DIFF(cli->inbuf, src))) {
+ if (clistr_align(cli, PTR_DIFF(src, cli->inbuf))) {
src++;
if (src_len > 0) src_len--;
}
- if (!(cli->capabilities & CAP_UNICODE)) {
+ if (!(flags & CLISTR_UNICODE) && !(cli->capabilities & CAP_UNICODE)) {
/* the server doesn't want unicode */
if (flags & CLISTR_TERMINATE) {
safe_strcpy(dest, src, dest_len);
@@ -159,7 +160,7 @@ if src_len is -1 then assume the source is null terminated
****************************************************************************/
int clistr_pull_size(struct cli_state *cli, const void *src, int src_len)
{
- if (clistr_align(cli, PTR_DIFF(cli->inbuf, src))) {
+ if (clistr_align(cli, PTR_DIFF(src, cli->inbuf))) {
src++;
if (src_len > 0) src_len--;
}