svn commit: samba r2786 - in branches/SAMBA_4_0/source/ntvfs/posix:
.
tridge at samba.org
tridge at samba.org
Sat Oct 2 12:25:02 GMT 2004
Author: tridge
Date: 2004-10-02 12:25:02 +0000 (Sat, 02 Oct 2004)
New Revision: 2786
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/ntvfs/posix&rev=2786&nolog=1
Log:
- match on both long and short name for search posix backend
- a final name component of . is illegal
Modified:
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_dirlist.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c
Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_dirlist.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_dirlist.c 2004-10-02 12:18:59 UTC (rev 2785)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_dirlist.c 2004-10-02 12:25:02 UTC (rev 2786)
@@ -98,11 +98,20 @@
while ((dent = readdir(odir))) {
uint_t i = dir->count;
const char *dname = dent->d_name;
+ char *short_name;
+ short_name = pvfs_short_name_component(pvfs, dname);
+
/* check it matches the wildcard pattern */
- if (ms_fnmatch(pattern, dname, PROTOCOL_NT1) != 0) {
+ if (ms_fnmatch(pattern, dname,
+ pvfs->tcon->smb_conn->negotiate.protocol) != 0 &&
+ ms_fnmatch(pattern, short_name,
+ pvfs->tcon->smb_conn->negotiate.protocol) != 0) {
+ talloc_free(short_name);
continue;
}
+
+ talloc_free(short_name);
if (dir->count >= allocated) {
allocated = (allocated + 100) * 1.2;
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c 2004-10-02 12:18:59 UTC (rev 2785)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c 2004-10-02 12:25:02 UTC (rev 2786)
@@ -159,6 +159,7 @@
uint_t flags, struct pvfs_filename *name)
{
char *ret, *p;
+ size_t len;
name->original_name = talloc_strdup(name, cifs_name);
name->stream_name = NULL;
@@ -183,9 +184,14 @@
p = ret + strlen(pvfs->base_directory) + 1;
- if (p[strlen(cifs_name)-1] == '\\') {
- p[strlen(cifs_name)-1] = 0;
+ len = strlen(cifs_name);
+ if (len>0 && p[len-1] == '\\') {
+ p[len-1] = 0;
+ len--;
}
+ if (len>1 && p[len-1] == '.' && p[len-2] == '\\') {
+ return NT_STATUS_OBJECT_NAME_INVALID;
+ }
/* now do an in-place conversion of '\' to '/', checking
for legal characters */
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c 2004-10-02 12:18:59 UTC (rev 2785)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c 2004-10-02 12:25:02 UTC (rev 2786)
@@ -25,11 +25,21 @@
/*
+ return the short name for a component of a full name
+ TODO: this is obviously not very useful in its current form !
+*/
+char *pvfs_short_name_component(struct pvfs_state *pvfs, const char *name)
+{
+ return talloc_strndup(pvfs, name, 12);
+}
+
+
+/*
return the short name for a given entry in a directory
TODO: this is obviously not very useful in its current form !
*/
char *pvfs_short_name(struct pvfs_state *pvfs, struct pvfs_filename *name)
{
char *p = strrchr(name->full_name, '/');
- return talloc_strndup(name, p+1, 12);
+ return pvfs_short_name_component(pvfs, p+1);
}
More information about the samba-cvs
mailing list