Lines 4255-4260
static NTSTATUS mkdir_internal(connection_struct *conn,
|
Link Here
|
---|
|
4255 |
uint32_t access_mask = SEC_DIR_ADD_SUBDIR; |
4255 |
uint32_t access_mask = SEC_DIR_ADD_SUBDIR; |
4256 |
int ret; |
4256 |
int ret; |
4257 |
bool ok; |
4257 |
bool ok; |
|
|
4258 |
struct smb_filename *oldwd_fname = NULL; |
4259 |
struct smb_filename *smb_fname_rel = NULL; |
4258 |
|
4260 |
|
4259 |
SMB_ASSERT(*dirfsp == conn->cwd_fsp); |
4261 |
SMB_ASSERT(*dirfsp == conn->cwd_fsp); |
4260 |
|
4262 |
|
Lines 4267-4273
static NTSTATUS mkdir_internal(connection_struct *conn,
|
Link Here
|
---|
|
4267 |
ok = parent_smb_fname(talloc_tos(), |
4269 |
ok = parent_smb_fname(talloc_tos(), |
4268 |
smb_dname, |
4270 |
smb_dname, |
4269 |
&parent_dir_fname, |
4271 |
&parent_dir_fname, |
4270 |
NULL); |
4272 |
&smb_fname_rel); |
4271 |
if (!ok) { |
4273 |
if (!ok) { |
4272 |
return NT_STATUS_NO_MEMORY; |
4274 |
return NT_STATUS_NO_MEMORY; |
4273 |
} |
4275 |
} |
Lines 4295-4308
static NTSTATUS mkdir_internal(connection_struct *conn,
|
Link Here
|
---|
|
4295 |
return status; |
4297 |
return status; |
4296 |
} |
4298 |
} |
4297 |
|
4299 |
|
|
|
4300 |
oldwd_fname = vfs_GetWd(talloc_tos(), conn); |
4301 |
if (oldwd_fname == NULL) { |
4302 |
return NT_STATUS_NO_MEMORY; |
4303 |
} |
4304 |
|
4305 |
/* Pin parent directory in place. */ |
4306 |
if (vfs_ChDir(conn, parent_dir_fname) == -1) { |
4307 |
status = map_nt_error_from_unix(errno); |
4308 |
TALLOC_FREE(oldwd_fname); |
4309 |
return status; |
4310 |
} |
4311 |
|
4312 |
/* Ensure the relative path is below the share. */ |
4313 |
status = check_reduced_name(conn, parent_dir_fname, smb_fname_rel); |
4314 |
if (!NT_STATUS_IS_OK(status)) { |
4315 |
goto need_chdir_err; |
4316 |
} |
4317 |
|
4298 |
ret = SMB_VFS_MKDIRAT(conn, |
4318 |
ret = SMB_VFS_MKDIRAT(conn, |
4299 |
*dirfsp, |
4319 |
*dirfsp, |
4300 |
smb_dname, |
4320 |
smb_fname_rel, |
4301 |
mode); |
4321 |
mode); |
4302 |
if (ret != 0) { |
4322 |
if (ret != 0) { |
4303 |
return map_nt_error_from_unix(errno); |
4323 |
status = map_nt_error_from_unix(errno); |
|
|
4324 |
goto need_chdir_err; |
4304 |
} |
4325 |
} |
4305 |
|
4326 |
|
|
|
4327 |
/* Return to share $cwd. */ |
4328 |
ret = vfs_ChDir(conn, oldwd_fname); |
4329 |
if (ret == -1) { |
4330 |
smb_panic("unable to get back to old directory\n"); |
4331 |
} |
4332 |
TALLOC_FREE(oldwd_fname); |
4333 |
|
4306 |
/* Ensure we're checking for a symlink here.... */ |
4334 |
/* Ensure we're checking for a symlink here.... */ |
4307 |
/* We don't want to get caught by a symlink racer. */ |
4335 |
/* We don't want to get caught by a symlink racer. */ |
4308 |
|
4336 |
|
Lines 4378-4383
static NTSTATUS mkdir_internal(connection_struct *conn,
|
Link Here
|
---|
|
4378 |
smb_dname->base_name); |
4406 |
smb_dname->base_name); |
4379 |
|
4407 |
|
4380 |
return NT_STATUS_OK; |
4408 |
return NT_STATUS_OK; |
|
|
4409 |
|
4410 |
need_chdir_err: |
4411 |
|
4412 |
ret = vfs_ChDir(conn, oldwd_fname); |
4413 |
if (ret == -1) { |
4414 |
smb_panic("unable to get back to old directory\n"); |
4415 |
} |
4416 |
TALLOC_FREE(oldwd_fname); |
4417 |
return status; |
4381 |
} |
4418 |
} |
4382 |
|
4419 |
|
4383 |
/**************************************************************************** |
4420 |
/**************************************************************************** |
4384 |
- |
|
|