From af3866903e009271533f91470fe7d8819516b09e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Oct 2004 03:27:16 +0000 Subject: r2904: - fixed the old style SMBsearch to return the pvfs shortname, not a truncated long name. - short name can be up to 12 bytes, not 11 (This used to be commit 657103ec6264bf4c2986fedd3fc6577746395d49) --- source4/ntvfs/posix/pvfs_search.c | 7 +++++-- source4/ntvfs/posix/pvfs_shortname.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index 211cb68b86..07f2a0f127 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -36,6 +36,7 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, { struct pvfs_filename *name; NTSTATUS status; + const char *shortname; status = pvfs_resolve_partial(pvfs, file, unix_path, fname, &name); if (!NT_STATUS_IS_OK(status)) { @@ -50,13 +51,15 @@ static NTSTATUS fill_search_info(struct pvfs_state *pvfs, case RAW_SEARCH_SEARCH: case RAW_SEARCH_FFIRST: case RAW_SEARCH_FUNIQUE: + shortname = pvfs_short_name(pvfs, name, name); file->search.attrib = name->dos.attrib; file->search.write_time = nt_time_to_unix(name->dos.write_time); file->search.size = name->st.st_size; - file->search.name = fname; + file->search.name = shortname; file->search.id.reserved = 8; memset(file->search.id.name, ' ', sizeof(file->search.id.name)); - memcpy(file->search.id.name, fname, MIN(strlen(fname)+1, sizeof(file->search.id.name))); + memcpy(file->search.id.name, shortname, + MIN(strlen(shortname)+1, sizeof(file->search.id.name))); file->search.id.handle = search->handle; file->search.id.server_cookie = dir_index+1; file->search.id.client_cookie = 0; diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c index ae911ad885..81cf42e71f 100644 --- a/source4/ntvfs/posix/pvfs_shortname.c +++ b/source4/ntvfs/posix/pvfs_shortname.c @@ -63,7 +63,7 @@ char *pvfs_short_name_component(struct pvfs_state *pvfs, const char *name) char c1, c2; const char *ext; - if (strlen(name) < 12) { + if (strlen(name) <= 12) { return talloc_strdup(pvfs, name); } -- cgit