summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-21 22:35:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:41 -0500
commit698877885047db370429ac7311e118512145334b (patch)
treef6992f835c770f2aaf6493df7874c26eb977992f /source3
parentf023f8670969090f55adc96a6009d202ff672590 (diff)
downloadsamba-698877885047db370429ac7311e118512145334b.tar.gz
samba-698877885047db370429ac7311e118512145334b.tar.bz2
samba-698877885047db370429ac7311e118512145334b.zip
r20313: Make trans2_mkdir also go through open_directory for all the fancy inherit_acl
stuff & friends. Survives raw-mkdir. I'll activate that tomorrow when all build farm machines have picked up the changed samba4 torture test. Volker (This used to be commit 37e7a3f35f48f5689591c75d41d32c43d3b9b853)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index c1f7f1b5ba..2571104fc2 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -4773,12 +4773,12 @@ static int call_trans2mkdir(connection_struct *conn, char *inbuf, char *outbuf,
char *params = *pparams;
char *pdata = *ppdata;
pstring directory;
- int ret = -1;
SMB_STRUCT_STAT sbuf;
BOOL bad_path = False;
NTSTATUS status = NT_STATUS_OK;
TALLOC_CTX *ctx = NULL;
struct ea_list *ea_list = NULL;
+ files_struct *fsp;
if (!CAN_WRITE(conn))
return ERROR_DOS(ERRSRV,ERRaccess);
@@ -4827,27 +4827,35 @@ static int call_trans2mkdir(connection_struct *conn, char *inbuf, char *outbuf,
}
ea_list = read_ea_list(ctx, pdata + 4, total_data - 4);
if (!ea_list) {
- talloc_destroy(ctx);
+ TALLOC_FREE(ctx);
return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
}
} else if (IVAL(pdata,0) != 4) {
return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
}
- if (check_name(directory,conn)) {
- ret = vfs_MkDir(conn,directory,unix_mode(conn,aDIR,directory,True));
- }
-
- if(ret < 0) {
- talloc_destroy(ctx);
+ if (!check_name(directory,conn)) {
+ TALLOC_FREE(ctx);
DEBUG(5,("call_trans2mkdir error (%s)\n", strerror(errno)));
- return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
+ return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,
+ ERRnoaccess);
}
+ status = open_directory(conn, directory, &sbuf,
+ FILE_READ_ATTRIBUTES, /* A stat open */
+ FILE_SHARE_NONE, /* Ignored */
+ FILE_CREATE, 0, NULL, &fsp);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(ctx);
+ return ERROR_NT(status);
+ }
+ close_file(fsp, NORMAL_CLOSE);
+
/* Try and set any given EA. */
if (ea_list) {
status = set_ea(conn, NULL, directory, ea_list);
- talloc_destroy(ctx);
+ TALLOC_FREE(ctx);
if (!NT_STATUS_IS_OK(status)) {
return ERROR_NT(status);
}