summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/dir.c13
-rw-r--r--source3/smbd/reply.c15
2 files changed, 16 insertions, 12 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 58b0061e19..55d5bf132c 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -685,13 +685,14 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
while ((n = vfs_readdirname(conn, p)))
{
int l;
- pstring zn;
-
- pstrcpy(zn, unix_to_dos(n,True));
- l = strlen(zn)+1;
+
+ l = strlen(n)+1;
+
+ /* Return value of vfs_readdirname has already gone through
+ unix_to_dos() */
/* If it's a vetoed file, pretend it doesn't even exist */
- if (use_veto && conn && IS_VETO_PATH(conn, zn)) continue;
+ if (use_veto && conn && IS_VETO_PATH(conn, n)) continue;
if (used + l > dirp->mallocsize) {
int s = MAX(used+l,used+2000);
@@ -705,7 +706,7 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
dirp->mallocsize = s;
dirp->current = dirp->data;
}
- pstrcpy(dirp->data+used,zn);
+ pstrcpy(dirp->data+used,n);
used += l;
dirp->numentries++;
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 4b0400fe6c..0092d6b397 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3570,6 +3570,7 @@ int rename_internals(connection_struct *conn,
int error = ERRnoaccess;
BOOL exists=False;
BOOL rc = True;
+ pstring zdirectory;
*directory = *mask = 0;
@@ -3667,23 +3668,24 @@ int rename_internals(connection_struct *conn,
}
}
+ pstrcpy(zdirectory, dos_to_unix(directory, False));
if(replace_if_exists) {
/*
* NT SMB specific flag - rename can overwrite
* file with the same name so don't check for
- * dos_file_exist().
+ * vfs_file_exist().
*/
if(resolve_wildcards(directory,newname) &&
can_rename(directory,conn) &&
- !conn->vfs_ops.rename(dos_to_unix(directory,False),
- newname))
+ !conn->vfs_ops.rename(zdirectory,
+ dos_to_unix(newname,False)))
count++;
} else {
if (resolve_wildcards(directory,newname) &&
can_rename(directory,conn) &&
!vfs_file_exist(conn,newname,NULL) &&
- !conn->vfs_ops.rename(dos_to_unix(directory,False),
- newname))
+ !conn->vfs_ops.rename(zdirectory,
+ dos_to_unix(newname,False)))
count++;
}
@@ -3714,6 +3716,7 @@ int rename_internals(connection_struct *conn,
while ((dname = ReadDirName(dirptr))) {
pstring fname;
+
pstrcpy(fname,dname);
if(!mask_match(fname, mask, case_sensitive, False))
@@ -3741,7 +3744,7 @@ int rename_internals(connection_struct *conn,
}
if (!conn->vfs_ops.rename(dos_to_unix(fname,False),
- destname))
+ dos_to_unix(destname,False)))
count++;
DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname));
}