diff options
author | Jeremy Allison <jra@samba.org> | 2008-09-23 15:04:18 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-10-06 12:58:33 +0200 |
commit | fc9247572e0ace4956845e279c63c9d00fa667bd (patch) | |
tree | 37c9a76415192bf197280e0b1206f4c62b642e9a /source/smbd/trans2.c | |
parent | cfc8dc236dda869dbe4141bef80f6965ce76188d (diff) | |
download | samba-fc9247572e0ace4956845e279c63c9d00fa667bd.tar.gz samba-fc9247572e0ace4956845e279c63c9d00fa667bd.tar.xz samba-fc9247572e0ace4956845e279c63c9d00fa667bd.zip |
Fix bug #5783 FindFirst fails where search pattern == mangled filename.
That was an old and subtle bug.
Jeremy.
(cherry picked from commit c412888f916563c44c4c753884df23c1951f6e27)
Diffstat (limited to 'source/smbd/trans2.c')
-rw-r--r-- | source/smbd/trans2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c index 13105dce0fc..f3b45ad1fd0 100644 --- a/source/smbd/trans2.c +++ b/source/smbd/trans2.c @@ -1885,7 +1885,7 @@ static void call_trans2findfirst(connection_struct *conn, bool requires_resume_key; int info_level; char *directory = NULL; - const char *mask = NULL; + char *mask = NULL; char *p; int last_entry_off=0; int dptr_num = -1; @@ -1973,7 +1973,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", return; } - ntstatus = unix_convert(ctx, conn, directory, True, &directory, NULL, &sbuf); + ntstatus = unix_convert(ctx, conn, directory, True, &directory, &mask, &sbuf); if (!NT_STATUS_IS_OK(ntstatus)) { reply_nterror(req, ntstatus); return; @@ -1989,10 +1989,12 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", if(p == NULL) { /* Windows and OS/2 systems treat search on the root '\' as if it were '\*' */ if((directory[0] == '.') && (directory[1] == '\0')) { - mask = "*"; + mask = talloc_strdup(ctx,"*"); + if (!mask) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + return; + } mask_contains_wcard = True; - } else { - mask = directory; } directory = talloc_strdup(talloc_tos(), "./"); if (!directory) { @@ -2000,7 +2002,6 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", return; } } else { - mask = p+1; *p = 0; } |