summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-07-29 17:34:20 +0000
committerJeremy Allison <jra@samba.org>2003-07-29 17:34:20 +0000
commit79a5d2e31bd1d5711d4fe7f9161abfc4ff81e7af (patch)
tree64e276e560005ea87f42c90cd55547d1a7c456fc /source3
parentb40d1a2a765ea919b117476c787716f12fc4c6d6 (diff)
downloadsamba-79a5d2e31bd1d5711d4fe7f9161abfc4ff81e7af.tar.gz
samba-79a5d2e31bd1d5711d4fe7f9161abfc4ff81e7af.tar.bz2
samba-79a5d2e31bd1d5711d4fe7f9161abfc4ff81e7af.zip
Finish tridge's patch as referenced here :
make sure we don't allow the creation of directories containing wildcard characters. I've only put this in mkdir at the moment, but I suspect this will apply to all places that can create new filenames. We need to allow the opening of existing filenames that contain wildcards, but not allow the creation of new ones. Jeremy. (This used to be commit 7f111e545d198faa5fa89f6d360db0d5c32a8bd7)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8f83983023..5f49640aa4 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -167,6 +167,14 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
local_flags |= O_NONBLOCK;
#endif
+ /* Don't create files with Microsoft wildcard characters. */
+ if ((local_flags & O_CREAT) && !VALID_STAT(*psbuf) && ms_has_wild(fname)) {
+ unix_ERR_class = ERRDOS;
+ unix_ERR_code = ERRinvalidname;
+ unix_ERR_ntstatus = NT_STATUS_OBJECT_NAME_INVALID;
+ return False;
+ }
+
/* Actually do the open */
fsp->fd = fd_open(conn, fname, local_flags, mode);
if (fsp->fd == -1) {
@@ -1291,6 +1299,15 @@ files_struct *open_directory(connection_struct *conn, char *fname, SMB_STRUCT_ST
return NULL;
}
+ if (ms_has_wild(fname)) {
+ file_free(fsp);
+ DEBUG(5,("open_directory: failing create on filename %s with wildcards\n", fname));
+ unix_ERR_class = ERRDOS;
+ unix_ERR_code = ERRinvalidname;
+ unix_ERR_ntstatus = NT_STATUS_OBJECT_NAME_INVALID;
+ return NULL;
+ }
+
if(vfs_MkDir(conn,fname, unix_mode(conn,aDIR, fname)) < 0) {
DEBUG(2,("open_directory: unable to create %s. Error was %s\n",
fname, strerror(errno) ));