mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the modules.
This commit is contained in:
parent
5a8d70d465
commit
c9b8a01714
@ -183,7 +183,8 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
|
||||
memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
|
||||
|
||||
if (fsp->is_directory || fsp->fh->fd == -1) {
|
||||
return smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, psbuf);
|
||||
return smbacl4_GetFileOwner(fsp->conn,
|
||||
fsp->fsp_name->base_name, psbuf);
|
||||
}
|
||||
if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
|
||||
{
|
||||
@ -327,7 +328,7 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
|
||||
{
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
|
||||
DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
|
||||
DEBUG(10, ("smb_fget_nt_acl_nfs4 invoked for %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
if (smbacl4_fGetFileOwner(fsp, &sbuf)) {
|
||||
return map_nt_error_from_unix(errno);
|
||||
@ -717,7 +718,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
|
||||
gid_t newGID = (gid_t)-1;
|
||||
int saved_errno;
|
||||
|
||||
DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp->fsp_name));
|
||||
DEBUG(10, ("smb_set_nt_acl_nfs4 invoked for %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
if ((security_info_sent & (DACL_SECURITY_INFORMATION |
|
||||
GROUP_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION)) == 0)
|
||||
@ -743,26 +744,23 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
|
||||
}
|
||||
if (((newUID != (uid_t)-1) && (sbuf.st_ex_uid != newUID)) ||
|
||||
((newGID != (gid_t)-1) && (sbuf.st_ex_gid != newGID))) {
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
status = create_synthetic_smb_fname_split(talloc_tos(),
|
||||
fsp->fsp_name, NULL, &smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
if(try_chown(fsp->conn, smb_fname, newUID, newGID)) {
|
||||
DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n",
|
||||
fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID,
|
||||
if(try_chown(fsp->conn, fsp->fsp_name, newUID,
|
||||
newGID)) {
|
||||
DEBUG(3,("chown %s, %u, %u failed. Error = "
|
||||
"%s.\n", fsp_str_dbg(fsp),
|
||||
(unsigned int)newUID,
|
||||
(unsigned int)newGID,
|
||||
strerror(errno)));
|
||||
TALLOC_FREE(smb_fname);
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
TALLOC_FREE(smb_fname);
|
||||
|
||||
DEBUG(10,("chown %s, %u, %u succeeded.\n",
|
||||
fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID));
|
||||
if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf))
|
||||
fsp_str_dbg(fsp), (unsigned int)newUID,
|
||||
(unsigned int)newGID));
|
||||
if (smbacl4_GetFileOwner(fsp->conn,
|
||||
fsp->fsp_name->base_name,
|
||||
&sbuf))
|
||||
return map_nt_error_from_unix(errno);
|
||||
|
||||
/* If we successfully chowned, we know we must
|
||||
@ -777,7 +775,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
theacl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms,
|
||||
theacl = smbacl4_win2nfs4(fsp->fsp_name->base_name, psd->dacl, ¶ms,
|
||||
sbuf.st_ex_uid, sbuf.st_ex_gid);
|
||||
if (!theacl)
|
||||
return map_nt_error_from_unix(errno);
|
||||
|
@ -395,8 +395,8 @@ onefs_canon_acl(files_struct *fsp, struct ifs_security_descriptor *sd)
|
||||
|
||||
if ((sbuf.st_ex_flags & SF_HASNTFSACL) != 0) {
|
||||
DEBUG(10, ("Did not canonicalize ACLs because a "
|
||||
"Windows ACL set was found for file %s\n",
|
||||
fsp->fsp_name));
|
||||
"Windows ACL set was found for file %s\n",
|
||||
fsp_str_dbg(fsp)));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -436,7 +436,7 @@ onefs_canon_acl(files_struct *fsp, struct ifs_security_descriptor *sd)
|
||||
|
||||
SMB_ASSERT(new_aces_count == sd->dacl->num_aces);
|
||||
DEBUG(10, ("Performed canonicalization of ACLs for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
|
||||
/*
|
||||
* At this point you would think we could just do this:
|
||||
@ -535,32 +535,21 @@ static bool add_sfs_aces(files_struct *fsp, struct ifs_security_descriptor *sd)
|
||||
if (error) {
|
||||
DEBUG(0, ("Failed to stat %s in simple files sharing "
|
||||
"compatibility mode. errno=%d\n",
|
||||
fsp->fsp_name, errno));
|
||||
fsp_str_dbg(fsp), errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Only continue if this is a synthetic ACL and a directory. */
|
||||
if (S_ISDIR(sbuf.st_ex_mode) &&
|
||||
(sbuf.st_ex_flags & SF_HASNTFSACL) == 0) {
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
struct ifs_ace new_aces[6];
|
||||
struct ifs_ace *old_aces;
|
||||
int i, num_aces_to_add = 0;
|
||||
mode_t file_mode = 0, dir_mode = 0;
|
||||
NTSTATUS status;
|
||||
|
||||
status = create_synthetic_smb_fname_split(talloc_tos(),
|
||||
fsp->fsp_name, NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Use existing samba logic to derive the mode bits. */
|
||||
file_mode = unix_mode(fsp->conn, 0, smb_fname, NULL);
|
||||
dir_mode = unix_mode(fsp->conn, aDIR, smb_fname, NULL);
|
||||
|
||||
TALLOC_FREE(smb_fname);
|
||||
file_mode = unix_mode(fsp->conn, 0, fsp->fsp_name, NULL);
|
||||
dir_mode = unix_mode(fsp->conn, aDIR, fsp->fsp_name, NULL);
|
||||
|
||||
/* Initialize ACEs. */
|
||||
new_aces[0] = onefs_init_ace(fsp->conn, file_mode, false, USR);
|
||||
@ -631,18 +620,18 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
*ppdesc = NULL;
|
||||
|
||||
DEBUG(5, ("Getting sd for file %s. security_info=%u\n",
|
||||
fsp->fsp_name, security_info));
|
||||
fsp_str_dbg(fsp), security_info));
|
||||
|
||||
if (lp_parm_bool(SNUM(fsp->conn), PARM_ONEFS_TYPE,
|
||||
PARM_IGNORE_SACLS, PARM_IGNORE_SACLS_DEFAULT)) {
|
||||
DEBUG(5, ("Ignoring SACL on %s.\n", fsp->fsp_name));
|
||||
DEBUG(5, ("Ignoring SACL on %s.\n", fsp_str_dbg(fsp)));
|
||||
security_info &= ~SACL_SECURITY_INFORMATION;
|
||||
}
|
||||
|
||||
if (fsp->fh->fd == -1) {
|
||||
if ((fsp->fh->fd = onefs_sys_create_file(handle->conn,
|
||||
-1,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@ -655,7 +644,7 @@ onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
0,
|
||||
NULL)) == -1) {
|
||||
DEBUG(0, ("Error opening file %s. errno=%d (%s)\n",
|
||||
fsp->fsp_name, errno, strerror(errno)));
|
||||
fsp_str_dbg(fsp), errno, strerror(errno)));
|
||||
status = map_nt_error_from_unix(errno);
|
||||
goto out;
|
||||
}
|
||||
@ -801,6 +790,7 @@ onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
|
||||
{
|
||||
files_struct finfo;
|
||||
struct fd_handle fh;
|
||||
NTSTATUS status;
|
||||
|
||||
ZERO_STRUCT(finfo);
|
||||
ZERO_STRUCT(fh);
|
||||
@ -809,9 +799,16 @@ onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
|
||||
finfo.conn = handle->conn;
|
||||
finfo.fh = &fh;
|
||||
finfo.fh->fd = -1;
|
||||
finfo.fsp_name = CONST_DISCARD(char *, name);
|
||||
status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
|
||||
&finfo.fsp_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return onefs_fget_nt_acl(handle, &finfo, security_info, ppdesc);
|
||||
status = onefs_fget_nt_acl(handle, &finfo, security_info, ppdesc);
|
||||
|
||||
TALLOC_FREE(finfo.fsp_name);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -918,7 +915,7 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
START_PROFILE(syscall_set_sd);
|
||||
|
||||
DEBUG(5,("Setting SD on file %s.\n", fsp->fsp_name ));
|
||||
DEBUG(5,("Setting SD on file %s.\n", fsp_str_dbg(fsp)));
|
||||
|
||||
status = onefs_samba_sd_to_sd(sec_info_sent, psd, &sd,
|
||||
SNUM(handle->conn), &sec_info_effective);
|
||||
@ -930,10 +927,10 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
fd = fsp->fh->fd;
|
||||
if (fd == -1) {
|
||||
DEBUG(10,("Reopening file %s.\n", fsp->fsp_name));
|
||||
DEBUG(10,("Reopening file %s.\n", fsp_str_dbg(fsp)));
|
||||
if ((fd = onefs_sys_create_file(handle->conn,
|
||||
-1,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@ -946,7 +943,7 @@ onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
0,
|
||||
NULL)) == -1) {
|
||||
DEBUG(0, ("Error opening file %s. errno=%d (%s)\n",
|
||||
fsp->fsp_name, errno, strerror(errno)));
|
||||
fsp_str_dbg(fsp), errno, strerror(errno)));
|
||||
status = map_nt_error_from_unix(errno);
|
||||
goto out;
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ static NTSTATUS onefs_open_file(files_struct *fsp,
|
||||
struct security_descriptor *sd,
|
||||
int *granted_oplock)
|
||||
{
|
||||
char *path = NULL;
|
||||
struct smb_filename *smb_fname_onefs = NULL;
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
int accmode = (flags & O_ACCMODE);
|
||||
@ -157,7 +156,7 @@ static NTSTATUS onefs_open_file(files_struct *fsp,
|
||||
* wildcard characters are allowed in stream names
|
||||
* only test the basefilename
|
||||
*/
|
||||
wild = fsp->base_fsp->fsp_name;
|
||||
wild = fsp->base_fsp->fsp_name->base_name;
|
||||
} else {
|
||||
wild = smb_fname->base_name;
|
||||
}
|
||||
@ -323,15 +322,13 @@ static NTSTATUS onefs_open_file(files_struct *fsp,
|
||||
fsp->aio_write_behind = True;
|
||||
}
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), smb_fname,
|
||||
&path);
|
||||
status = fsp_set_smb_fname(fsp, smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
fd_close(fsp);
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return status;
|
||||
}
|
||||
|
||||
string_set(&fsp->fsp_name, path);
|
||||
TALLOC_FREE(path);
|
||||
|
||||
fsp->wcp = NULL; /* Write cache pointer. */
|
||||
|
||||
DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",
|
||||
@ -1592,7 +1589,12 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
|
||||
fsp->is_directory = True;
|
||||
fsp->posix_open = posix_open;
|
||||
|
||||
string_set(&fsp->fsp_name, smb_dname->base_name);
|
||||
status = fsp_set_smb_fname(fsp, smb_dname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
fd_close(fsp);
|
||||
file_free(req, fsp);
|
||||
return status;
|
||||
}
|
||||
|
||||
mtimespec = smb_dname->st.st_ex_mtime;
|
||||
|
||||
|
@ -376,7 +376,7 @@ int onefs_fstat(vfs_handle_struct *handle, struct files_struct *fsp,
|
||||
}
|
||||
}
|
||||
|
||||
onefs_adjust_stat_time(handle->conn, fsp->fsp_name, sbuf);
|
||||
onefs_adjust_stat_time(handle->conn, fsp->fsp_name->base_name, sbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -600,7 +600,11 @@ static NTSTATUS walk_onefs_streams(connection_struct *conn, files_struct *fsp,
|
||||
|
||||
fake_fs.conn = conn;
|
||||
fake_fs.fh = &fake_fh;
|
||||
fake_fs.fsp_name = SMB_STRDUP(fname);
|
||||
status = create_synthetic_smb_fname(talloc_tos(), fname, NULL, NULL,
|
||||
&fake_fs.fsp_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Iterate over the streams in the ADS directory. */
|
||||
while ((dp = SMB_VFS_READDIR(conn, dirp, NULL)) != NULL) {
|
||||
@ -667,7 +671,7 @@ out:
|
||||
close(base_fd);
|
||||
}
|
||||
|
||||
SAFE_FREE(fake_fs.fsp_name);
|
||||
TALLOC_FREE(fake_fs.fsp_name);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -272,27 +272,24 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
{
|
||||
uint8 id_buf[16];
|
||||
struct file_id id;
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
TDB_DATA data;
|
||||
struct db_context *db;
|
||||
struct db_record *rec;
|
||||
int ret = -1;
|
||||
|
||||
DEBUG(10,("store_acl_blob_fsp: storing blob length %u on file %s\n",
|
||||
(unsigned int)pblob->length, fsp->fsp_name));
|
||||
(unsigned int)pblob->length, fsp_str_dbg(fsp)));
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context,
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION);
|
||||
|
||||
if (fsp->fh->fd != -1) {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
|
||||
} else {
|
||||
if (fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(handle->conn, fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_LSTAT(handle->conn, fsp->fsp_name);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(handle->conn, fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_STAT(handle->conn, fsp->fsp_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,7 +297,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
|
||||
id = vfs_file_id_from_sbuf(handle->conn, &sbuf);
|
||||
id = vfs_file_id_from_sbuf(handle->conn, &fsp->fsp_name->st);
|
||||
|
||||
/* For backwards compatibility only store the dev/inode. */
|
||||
push_file_id_16((char *)id_buf, &id);
|
||||
@ -381,7 +378,7 @@ static NTSTATUS get_nt_acl_tdb_internal(vfs_handle_struct *handle,
|
||||
NTSTATUS status;
|
||||
|
||||
if (fsp && name == NULL) {
|
||||
name = fsp->fsp_name;
|
||||
name = fsp->fsp_name->base_name;
|
||||
}
|
||||
|
||||
DEBUG(10, ("get_nt_acl_tdb_internal: name=%s\n", name));
|
||||
@ -450,7 +447,7 @@ static struct security_descriptor *default_file_sd(TALLOC_CTX *mem_ctx,
|
||||
*********************************************************************/
|
||||
|
||||
static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
const char *fname,
|
||||
struct smb_filename *smb_fname,
|
||||
files_struct *fsp,
|
||||
bool container)
|
||||
{
|
||||
@ -462,7 +459,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
size_t size;
|
||||
char *parent_name;
|
||||
|
||||
if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
|
||||
if (!parent_dirname(ctx, smb_fname->base_name, &parent_name, NULL)) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
@ -508,25 +505,22 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
if (!psd || psd->dacl == NULL) {
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
int ret;
|
||||
|
||||
TALLOC_FREE(psd);
|
||||
if (fsp && !fsp->is_directory && fsp->fh->fd != -1) {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
|
||||
} else {
|
||||
if (fsp && fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(handle->conn,fname,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_LSTAT(handle->conn, smb_fname);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(handle->conn,fname,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname);
|
||||
}
|
||||
}
|
||||
if (ret == -1) {
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
psd = default_file_sd(ctx, &sbuf);
|
||||
psd = default_file_sd(ctx, &smb_fname->st);
|
||||
if (!psd) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
@ -544,7 +538,8 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
if (fsp) {
|
||||
return store_acl_blob_fsp(handle, fsp, &blob);
|
||||
} else {
|
||||
return store_acl_blob_pathname(handle, fname, &blob);
|
||||
return store_acl_blob_pathname(handle, smb_fname->base_name,
|
||||
&blob);
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,19 +556,11 @@ static int open_acl_tdb(vfs_handle_struct *handle,
|
||||
uint32_t access_granted = 0;
|
||||
struct security_descriptor *pdesc = NULL;
|
||||
bool file_existed = true;
|
||||
char *fname = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), smb_fname,
|
||||
&fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
status = get_nt_acl_tdb_internal(handle,
|
||||
NULL,
|
||||
fname,
|
||||
smb_fname->base_name,
|
||||
(OWNER_SECURITY_INFORMATION |
|
||||
GROUP_SECURITY_INFORMATION |
|
||||
DACL_SECURITY_INFORMATION),
|
||||
@ -605,10 +592,13 @@ static int open_acl_tdb(vfs_handle_struct *handle,
|
||||
|
||||
if (!file_existed && fsp->fh->fd != -1) {
|
||||
/* File was created. Inherit from parent directory. */
|
||||
string_set(&fsp->fsp_name, fname);
|
||||
inherit_new_acl(handle, fname, fsp, false);
|
||||
status = fsp_set_smb_fname(fsp, smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
inherit_new_acl(handle, smb_fname, fsp, false);
|
||||
}
|
||||
|
||||
return fsp->fh->fd;
|
||||
}
|
||||
|
||||
@ -659,13 +649,24 @@ static int unlink_acl_tdb(vfs_handle_struct *handle,
|
||||
|
||||
static int mkdir_acl_tdb(vfs_handle_struct *handle, const char *path, mode_t mode)
|
||||
{
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
int ret = SMB_VFS_NEXT_MKDIR(handle, path, mode);
|
||||
NTSTATUS status;
|
||||
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
status = create_synthetic_smb_fname(talloc_tos(), path, NULL, NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* New directory - inherit from parent. */
|
||||
inherit_new_acl(handle, path, NULL, true);
|
||||
inherit_new_acl(handle, smb_fname, NULL, true);
|
||||
TALLOC_FREE(smb_fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -713,15 +714,14 @@ static NTSTATUS fget_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("fget_nt_acl_tdb: returning tdb sd for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
NDR_PRINT_DEBUG(security_descriptor, *ppdesc);
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
DEBUG(10,("fget_nt_acl_tdb: failed to get tdb sd for file %s, Error %s\n",
|
||||
fsp->fsp_name,
|
||||
nt_errstr(status) ));
|
||||
fsp_str_dbg(fsp), nt_errstr(status)));
|
||||
|
||||
return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp,
|
||||
security_info, ppdesc);
|
||||
@ -765,7 +765,7 @@ static NTSTATUS fset_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("fset_nt_acl_tdb: incoming sd for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
NDR_PRINT_DEBUG(security_descriptor,
|
||||
CONST_DISCARD(struct security_descriptor *,psd));
|
||||
}
|
||||
@ -778,7 +778,6 @@ static NTSTATUS fset_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
|
||||
/* Ensure owner and group are set. */
|
||||
if (!psd->owner_sid || !psd->group_sid) {
|
||||
int ret;
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
DOM_SID owner_sid, group_sid;
|
||||
struct security_descriptor *nc_psd = dup_sec_desc(talloc_tos(), psd);
|
||||
|
||||
@ -787,23 +786,19 @@ static NTSTATUS fset_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
if (fsp->is_directory || fsp->fh->fd == -1) {
|
||||
if (fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(fsp->conn,
|
||||
fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(fsp->conn,
|
||||
fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
|
||||
}
|
||||
} else {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
|
||||
}
|
||||
if (ret == -1) {
|
||||
/* Lower level acl set succeeded,
|
||||
* so still return OK. */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
create_file_sids(&sbuf, &owner_sid, &group_sid);
|
||||
create_file_sids(&fsp->fsp_name->st, &owner_sid, &group_sid);
|
||||
/* This is safe as nc_psd is discarded at fn exit. */
|
||||
nc_psd->owner_sid = &owner_sid;
|
||||
nc_psd->group_sid = &group_sid;
|
||||
@ -831,7 +826,7 @@ static NTSTATUS fset_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("fset_nt_acl_tdb: storing tdb sd for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
NDR_PRINT_DEBUG(security_descriptor,
|
||||
CONST_DISCARD(struct security_descriptor *,psd));
|
||||
}
|
||||
@ -913,7 +908,6 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
SMB_ACL_T theacl)
|
||||
{
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
struct db_context *db;
|
||||
int ret;
|
||||
|
||||
@ -921,14 +915,12 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
|
||||
|
||||
if (fsp->is_directory || fsp->fh->fd == -1) {
|
||||
if (fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(fsp->conn,fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(fsp->conn,fsp->fsp_name,
|
||||
&sbuf);
|
||||
ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
|
||||
}
|
||||
} else {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
|
||||
}
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
@ -941,7 +933,7 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
|
||||
return -1;
|
||||
}
|
||||
|
||||
acl_tdb_delete(handle, db, &sbuf);
|
||||
acl_tdb_delete(handle, db, &fsp->fsp_name->st);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -206,14 +206,14 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
int saved_errno = 0;
|
||||
|
||||
DEBUG(10,("store_acl_blob_fsp: storing blob length %u on file %s\n",
|
||||
(unsigned int)pblob->length, fsp->fsp_name));
|
||||
(unsigned int)pblob->length, fsp_str_dbg(fsp)));
|
||||
|
||||
become_root();
|
||||
if (fsp->fh->fd != -1) {
|
||||
ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
|
||||
pblob->data, pblob->length, 0);
|
||||
} else {
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name,
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name->base_name,
|
||||
XATTR_NTACL_NAME,
|
||||
pblob->data, pblob->length, 0);
|
||||
}
|
||||
@ -225,7 +225,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
errno = saved_errno;
|
||||
DEBUG(5, ("store_acl_blob_fsp: setting attr failed for file %s"
|
||||
"with error %s\n",
|
||||
fsp->fsp_name,
|
||||
fsp_str_dbg(fsp),
|
||||
strerror(errno) ));
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
@ -284,7 +284,7 @@ static NTSTATUS get_nt_acl_xattr_internal(vfs_handle_struct *handle,
|
||||
struct security_descriptor *pdesc_next = NULL;
|
||||
|
||||
if (fsp && name == NULL) {
|
||||
name = fsp->fsp_name;
|
||||
name = fsp->fsp_name->base_name;
|
||||
}
|
||||
|
||||
DEBUG(10, ("get_nt_acl_xattr_internal: name=%s\n", name));
|
||||
@ -408,7 +408,7 @@ static struct security_descriptor *default_file_sd(TALLOC_CTX *mem_ctx,
|
||||
*********************************************************************/
|
||||
|
||||
static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
const char *fname,
|
||||
struct smb_filename *smb_fname,
|
||||
files_struct *fsp,
|
||||
bool container)
|
||||
{
|
||||
@ -422,7 +422,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
char *parent_name;
|
||||
uint8_t hash[16];
|
||||
|
||||
if (!parent_dirname(ctx, fname, &parent_name, NULL)) {
|
||||
if (!parent_dirname(ctx, smb_fname->base_name, &parent_name, NULL)) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
@ -468,23 +468,22 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
}
|
||||
|
||||
if (!psd || psd->dacl == NULL) {
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
int ret;
|
||||
|
||||
TALLOC_FREE(psd);
|
||||
if (fsp && !fsp->is_directory && fsp->fh->fd != -1) {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
|
||||
} else {
|
||||
if (fsp && fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(handle->conn,fname, &sbuf);
|
||||
ret = SMB_VFS_LSTAT(handle->conn, smb_fname);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(handle->conn,fname, &sbuf);
|
||||
ret = SMB_VFS_STAT(handle->conn, smb_fname);
|
||||
}
|
||||
}
|
||||
if (ret == -1) {
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
psd = default_file_sd(ctx, &sbuf);
|
||||
psd = default_file_sd(ctx, &smb_fname->st);
|
||||
if (!psd) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
@ -503,7 +502,7 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
&pdesc_next);
|
||||
} else {
|
||||
status = SMB_VFS_NEXT_GET_NT_ACL(handle,
|
||||
fname,
|
||||
smb_fname->base_name,
|
||||
HASH_SECURITY_INFO,
|
||||
&pdesc_next);
|
||||
}
|
||||
@ -523,7 +522,8 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
|
||||
if (fsp) {
|
||||
return store_acl_blob_fsp(handle, fsp, &blob);
|
||||
} else {
|
||||
return store_acl_blob_pathname(handle, fname, &blob);
|
||||
return store_acl_blob_pathname(handle, smb_fname->base_name,
|
||||
&blob);
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,8 +591,12 @@ static int open_acl_xattr(vfs_handle_struct *handle,
|
||||
|
||||
if (!file_existed && fsp->fh->fd != -1) {
|
||||
/* File was created. Inherit from parent directory. */
|
||||
string_set(&fsp->fsp_name, fname);
|
||||
inherit_new_acl(handle, fname, fsp, false);
|
||||
status = fsp_set_smb_fname(fsp, smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
inherit_new_acl(handle, smb_fname, fsp, false);
|
||||
}
|
||||
|
||||
return fsp->fh->fd;
|
||||
@ -600,13 +604,24 @@ static int open_acl_xattr(vfs_handle_struct *handle,
|
||||
|
||||
static int mkdir_acl_xattr(vfs_handle_struct *handle, const char *path, mode_t mode)
|
||||
{
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
int ret = SMB_VFS_NEXT_MKDIR(handle, path, mode);
|
||||
NTSTATUS status;
|
||||
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
status = create_synthetic_smb_fname(talloc_tos(), path, NULL, NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* New directory - inherit from parent. */
|
||||
inherit_new_acl(handle, path, NULL, true);
|
||||
inherit_new_acl(handle, smb_fname, NULL, true);
|
||||
TALLOC_FREE(smb_fname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -646,7 +661,7 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("fset_nt_acl_xattr: incoming sd for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
NDR_PRINT_DEBUG(security_descriptor,
|
||||
CONST_DISCARD(struct security_descriptor *,psd));
|
||||
}
|
||||
@ -654,7 +669,6 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
|
||||
/* Ensure owner and group are set. */
|
||||
if (!psd->owner_sid || !psd->group_sid) {
|
||||
int ret;
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
DOM_SID owner_sid, group_sid;
|
||||
struct security_descriptor *nc_psd = dup_sec_desc(talloc_tos(), psd);
|
||||
|
||||
@ -663,19 +677,19 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
if (fsp->is_directory || fsp->fh->fd == -1) {
|
||||
if (fsp->posix_open) {
|
||||
ret = vfs_lstat_smb_fname(fsp->conn,fsp->fsp_name, &sbuf);
|
||||
ret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
|
||||
} else {
|
||||
ret = vfs_stat_smb_fname(fsp->conn,fsp->fsp_name, &sbuf);
|
||||
ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
|
||||
}
|
||||
} else {
|
||||
ret = SMB_VFS_FSTAT(fsp, &sbuf);
|
||||
ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
|
||||
}
|
||||
if (ret == -1) {
|
||||
/* Lower level acl set succeeded,
|
||||
* so still return OK. */
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
create_file_sids(&sbuf, &owner_sid, &group_sid);
|
||||
create_file_sids(&fsp->fsp_name->st, &owner_sid, &group_sid);
|
||||
/* This is safe as nc_psd is discarded at fn exit. */
|
||||
nc_psd->owner_sid = &owner_sid;
|
||||
nc_psd->group_sid = &group_sid;
|
||||
@ -723,7 +737,7 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
if (DEBUGLEVEL >= 10) {
|
||||
DEBUG(10,("fset_nt_acl_xattr: storing xattr sd for file %s\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
NDR_PRINT_DEBUG(security_descriptor,
|
||||
CONST_DISCARD(struct security_descriptor *,psd));
|
||||
}
|
||||
|
@ -655,18 +655,17 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
|
||||
|
||||
static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
|
||||
struct connection_struct *conn,
|
||||
const char *name,
|
||||
struct smb_filename *smb_fname,
|
||||
uint32 security_info,
|
||||
struct security_descriptor **ppdesc)
|
||||
{
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
|
||||
/* Get the stat struct for the owner info. */
|
||||
if(vfs_stat_smb_fname(conn, name, &sbuf) != 0) {
|
||||
if(SMB_VFS_STAT(conn, smb_fname) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return afs_to_nt_acl_common(afs_acl, &sbuf, security_info, ppdesc);
|
||||
return afs_to_nt_acl_common(afs_acl, &smb_fname->st, security_info,
|
||||
ppdesc);
|
||||
}
|
||||
|
||||
static size_t afs_fto_nt_acl(struct afs_acl *afs_acl,
|
||||
@ -905,7 +904,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
ZERO_STRUCT(dir_acl);
|
||||
ZERO_STRUCT(file_acl);
|
||||
|
||||
name = talloc_strdup(talloc_tos(), fsp->fsp_name);
|
||||
name = talloc_strdup(talloc_tos(), fsp->fsp_name->base_name);
|
||||
if (!name) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
@ -925,7 +924,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
|
||||
if (!afs_get_afs_acl(name, &old_afs_acl)) {
|
||||
DEBUG(3, ("Could not get old ACL of %s\n", fsp->fsp_name));
|
||||
DEBUG(3, ("Could not get old ACL of %s\n", fsp_str_dbg(fsp)));
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -941,7 +940,8 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
|
||||
free_afs_acl(&dir_acl);
|
||||
if (!nt_to_afs_acl(fsp->fsp_name, security_info_sent, psd,
|
||||
if (!nt_to_afs_acl(fsp->fsp_name->base_name,
|
||||
security_info_sent, psd,
|
||||
nt_to_afs_dir_rights, &dir_acl))
|
||||
goto done;
|
||||
} else {
|
||||
@ -956,7 +956,8 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
||||
}
|
||||
|
||||
free_afs_acl(&file_acl);
|
||||
if (!nt_to_afs_acl(fsp->fsp_name, security_info_sent, psd,
|
||||
if (!nt_to_afs_acl(fsp->fsp_name->base_name,
|
||||
security_info_sent, psd,
|
||||
nt_to_afs_file_rights, &file_acl))
|
||||
goto done;
|
||||
}
|
||||
@ -997,11 +998,11 @@ static NTSTATUS afsacl_fget_nt_acl(struct vfs_handle_struct *handle,
|
||||
struct afs_acl acl;
|
||||
size_t sd_size;
|
||||
|
||||
DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp->fsp_name));
|
||||
DEBUG(5, ("afsacl_fget_nt_acl: %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
sidpts = lp_parm_bool(SNUM(fsp->conn), "afsacl", "sidpts", False);
|
||||
|
||||
if (!afs_get_afs_acl(fsp->fsp_name, &acl)) {
|
||||
if (!afs_get_afs_acl(fsp->fsp_name->base_name, &acl)) {
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
@ -1018,6 +1019,8 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
|
||||
{
|
||||
struct afs_acl acl;
|
||||
size_t sd_size;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
DEBUG(5, ("afsacl_get_nt_acl: %s\n", name));
|
||||
|
||||
@ -1027,8 +1030,16 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
sd_size = afs_to_nt_acl(&acl, handle->conn, name, security_info,
|
||||
status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
free_afs_acl(&acl);
|
||||
return status;
|
||||
}
|
||||
|
||||
sd_size = afs_to_nt_acl(&acl, handle->conn, smb_fname, security_info,
|
||||
ppdesc);
|
||||
TALLOC_FREE(smb_fname);
|
||||
|
||||
free_afs_acl(&acl);
|
||||
|
||||
|
@ -162,7 +162,8 @@ static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
|
||||
bool retryPosix = False;
|
||||
|
||||
*ppdesc = NULL;
|
||||
result = aixjfs2_get_nfs4_acl(fsp->fsp_name, &pacl, &retryPosix);
|
||||
result = aixjfs2_get_nfs4_acl(fsp->fsp_name->base_name, &pacl,
|
||||
&retryPosix);
|
||||
if (retryPosix)
|
||||
{
|
||||
DEBUG(10, ("retrying with posix acl...\n"));
|
||||
@ -258,7 +259,7 @@ SMB_ACL_T aixjfs2_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
acl_type_t aixjfs2_type;
|
||||
aixjfs2_type.u64 = ACL_AIXC;
|
||||
|
||||
return aixjfs2_get_posix_acl(fsp->fsp_name, aixjfs2_type);
|
||||
return aixjfs2_get_posix_acl(fsp->fsp_name->base_name, aixjfs2_type);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -304,7 +305,7 @@ static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
|
||||
int rc;
|
||||
acl_type_t acltype;
|
||||
|
||||
DEBUG(10, ("jfs2_process_smbacl invoked on %s\n", fsp->fsp_name));
|
||||
DEBUG(10, ("jfs2_process_smbacl invoked on %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
/* no need to be freed which is alloced with mem_ctx */
|
||||
mem_ctx = talloc_tos();
|
||||
@ -353,7 +354,7 @@ static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
|
||||
|
||||
/* won't set S_ISUID - the only one JFS2/NFS4 accepts */
|
||||
rc = aclx_put(
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
SET_ACL, /* set only the ACL, not mode bits */
|
||||
acltype, /* not a pointer !!! */
|
||||
jfs2acl,
|
||||
@ -444,9 +445,10 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
|
||||
acl_type_t acl_type_info;
|
||||
int rc;
|
||||
|
||||
DEBUG(10, ("aixjfs2_sys_acl_set_fd invoked for %s", fsp->fsp_name));
|
||||
DEBUG(10, ("aixjfs2_sys_acl_set_fd invoked for %s", fsp_str_dbg(fsp)));
|
||||
|
||||
rc = aixjfs2_query_acl_support(fsp->fsp_name, ACL_AIXC, &acl_type_info);
|
||||
rc = aixjfs2_query_acl_support(fsp->fsp_name->base_name, ACL_AIXC,
|
||||
&acl_type_info);
|
||||
if (rc) {
|
||||
DEBUG(8, ("jfs2_set_nt_acl: AIXC support not found\n"));
|
||||
return -1;
|
||||
@ -466,7 +468,7 @@ int aixjfs2_sys_acl_set_fd(vfs_handle_struct *handle,
|
||||
);
|
||||
if (rc) {
|
||||
DEBUG(2, ("aclx_fput failed with %s for %s\n",
|
||||
strerror(errno), fsp->fsp_name));
|
||||
strerror(errno), fsp_str_dbg(fsp)));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
|
||||
result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
|
||||
|
||||
syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
|
||||
fsp->fsp_name, mode,
|
||||
fsp->fsp_name->base_name, mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : "");
|
||||
|
||||
@ -251,7 +251,7 @@ static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t
|
||||
result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
|
||||
|
||||
syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
|
||||
fsp->fsp_name, mode,
|
||||
fsp->fsp_name->base_name, mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : "");
|
||||
|
||||
|
@ -72,7 +72,7 @@ static bool prime_cache(
|
||||
DEBUG(module_debug,
|
||||
("%s: doing readahead of %lld bytes at %lld for %s\n",
|
||||
MODULE, (long long)g_readsz, (long long)*last,
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
|
||||
nread = sys_pread(fsp->fh->fd, g_readbuf, g_readsz, *last);
|
||||
if (nread < 0) {
|
||||
|
@ -866,7 +866,9 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
|
||||
uint64_t space_avail;
|
||||
uint64_t bsize,dfree,dsize;
|
||||
|
||||
space_avail = get_dfree_info(fsp->conn,fsp->fsp_name,false,&bsize,&dfree,&dsize);
|
||||
space_avail = get_dfree_info(fsp->conn,
|
||||
fsp->fsp_name->base_name, false,
|
||||
&bsize, &dfree, &dsize);
|
||||
/* space_avail is 1k blocks */
|
||||
if (space_avail == (uint64_t)-1 ||
|
||||
((uint64_t)space_to_write/1024 > space_avail) ) {
|
||||
|
@ -304,12 +304,12 @@ static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mod
|
||||
|
||||
if (lp_syslog() > 0) {
|
||||
syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
|
||||
fsp->fsp_name, mode,
|
||||
fsp->fsp_name->base_name, mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : "");
|
||||
}
|
||||
DEBUG(1, ("vfs_extd_audit: fchmod %s mode 0x%x %s %s",
|
||||
fsp->fsp_name, (unsigned int)mode,
|
||||
fsp_str_dbg(fsp), (unsigned int)mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : ""));
|
||||
|
||||
@ -324,12 +324,12 @@ static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t
|
||||
|
||||
if (lp_syslog() > 0) {
|
||||
syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n",
|
||||
fsp->fsp_name, mode,
|
||||
fsp->fsp_name->base_name, mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : "");
|
||||
}
|
||||
DEBUG(1, ("vfs_extd_audit: fchmod_acl %s mode 0x%x %s %s",
|
||||
fsp->fsp_name, (unsigned int)mode,
|
||||
fsp_str_dbg(fsp), (unsigned int)mode,
|
||||
(result < 0) ? "failed: " : "",
|
||||
(result < 0) ? strerror(errno) : ""));
|
||||
|
||||
|
@ -419,6 +419,13 @@ static const char *smb_fname_str_do_log(const struct smb_filename *smb_fname)
|
||||
return fname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an fsp debug string using the do_log_ctx()
|
||||
*/
|
||||
static const char *fsp_str_do_log(const struct files_struct *fsp)
|
||||
{
|
||||
return smb_fname_str_do_log(fsp->fsp_name);
|
||||
}
|
||||
|
||||
/* Free function for the private data. */
|
||||
|
||||
@ -736,7 +743,8 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
|
||||
|
||||
result = SMB_VFS_NEXT_CLOSE(handle, fsp);
|
||||
|
||||
do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -748,7 +756,8 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
|
||||
|
||||
do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -760,7 +769,8 @@ static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp
|
||||
|
||||
result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
|
||||
|
||||
do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -772,7 +782,8 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp
|
||||
|
||||
result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
|
||||
|
||||
do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -785,7 +796,8 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs
|
||||
|
||||
result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
|
||||
|
||||
do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -798,7 +810,7 @@ static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *f
|
||||
result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
|
||||
|
||||
do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -813,7 +825,7 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
|
||||
result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
|
||||
|
||||
do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
|
||||
"%s", fromfsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fromfsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -828,7 +840,7 @@ static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
|
||||
result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
|
||||
|
||||
do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
|
||||
"%s", tofsp->fsp_name);
|
||||
"%s", fsp_str_do_log(tofsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -854,7 +866,8 @@ static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
|
||||
|
||||
result = SMB_VFS_NEXT_FSYNC(handle, fsp);
|
||||
|
||||
do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -879,7 +892,8 @@ static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
|
||||
|
||||
do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -942,7 +956,7 @@ static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
|
||||
result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
|
||||
|
||||
do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
|
||||
"%s|%o", fsp->fsp_name, mode);
|
||||
"%s|%o", fsp_str_do_log(fsp), mode);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -968,7 +982,7 @@ static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
|
||||
result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
|
||||
|
||||
do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
|
||||
fsp->fsp_name, (long int)uid, (long int)gid);
|
||||
fsp_str_do_log(fsp), (long int)uid, (long int)gid);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1032,7 +1046,7 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp
|
||||
result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
|
||||
|
||||
do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1044,7 +1058,7 @@ static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
|
||||
|
||||
do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1058,7 +1072,7 @@ static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode);
|
||||
|
||||
do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
|
||||
fsp->fsp_name);
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1071,7 +1085,7 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct
|
||||
result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
|
||||
|
||||
do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
|
||||
fsp->fsp_name);
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1083,7 +1097,7 @@ static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
|
||||
|
||||
result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
|
||||
|
||||
do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1256,7 +1270,7 @@ static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle
|
||||
blocking_lock, blr);
|
||||
|
||||
do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
|
||||
"%s:%llu-%llu. type=%d. blocking=%d", br_lck->fsp->fsp_name,
|
||||
"%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck->fsp),
|
||||
plock->start, plock->size, plock->lock_type, blocking_lock );
|
||||
|
||||
return result;
|
||||
@ -1273,7 +1287,7 @@ static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
|
||||
plock);
|
||||
|
||||
do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
|
||||
"%s:%llu-%llu:%d", br_lck->fsp->fsp_name, plock->start,
|
||||
"%s:%llu-%llu:%d", fsp_str_do_log(br_lck->fsp), plock->start,
|
||||
plock->size, plock->lock_type);
|
||||
|
||||
return result;
|
||||
@ -1289,7 +1303,7 @@ static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
|
||||
|
||||
do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle,
|
||||
"%s:%llu-%llu:%d", br_lck->fsp->fsp_name, plock->start,
|
||||
"%s:%llu-%llu:%d", fsp_str_do_log(br_lck->fsp), plock->start,
|
||||
plock->size);
|
||||
|
||||
return result;
|
||||
@ -1304,7 +1318,7 @@ static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
|
||||
|
||||
do_log(SMB_VFS_OP_STRICT_LOCK, result, handle,
|
||||
"%s:%llu-%llu:%d", fsp->fsp_name, plock->start,
|
||||
"%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
|
||||
plock->size);
|
||||
|
||||
return result;
|
||||
@ -1317,7 +1331,7 @@ static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle,
|
||||
SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
|
||||
|
||||
do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle,
|
||||
"%s:%llu-%llu:%d", fsp->fsp_name, plock->start,
|
||||
"%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
|
||||
plock->size);
|
||||
|
||||
return;
|
||||
@ -1332,7 +1346,7 @@ static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_stru
|
||||
result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
|
||||
|
||||
do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1360,7 +1374,8 @@ static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_stru
|
||||
|
||||
result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
|
||||
|
||||
do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
|
||||
do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s",
|
||||
fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1386,7 +1401,7 @@ static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fs
|
||||
result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
|
||||
|
||||
do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
|
||||
"%s|%o", fsp->fsp_name, mode);
|
||||
"%s|%o", fsp_str_do_log(fsp), mode);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1475,7 +1490,7 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
|
||||
|
||||
do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1635,7 +1650,7 @@ static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct
|
||||
result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
|
||||
|
||||
do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1749,7 +1764,7 @@ static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
|
||||
|
||||
do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
|
||||
"%s|%s", fsp->fsp_name, name);
|
||||
"%s|%s", fsp_str_do_log(fsp), name);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1787,7 +1802,7 @@ static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
|
||||
|
||||
do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1829,7 +1844,7 @@ static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
|
||||
|
||||
do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
|
||||
"%s|%s", fsp->fsp_name, name);
|
||||
"%s|%s", fsp_str_do_log(fsp), name);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1875,7 +1890,7 @@ static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
|
||||
|
||||
do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
|
||||
"%s|%s", fsp->fsp_name, name);
|
||||
"%s|%s", fsp_str_do_log(fsp), name);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1886,7 +1901,7 @@ static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct file
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_READ, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1897,7 +1912,7 @@ static int smb_full_audit_aio_write(struct vfs_handle_struct *handle, struct fil
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_WRITE, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1908,7 +1923,7 @@ static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struc
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_RETURN, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1919,7 +1934,7 @@ static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct fi
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_CANCEL, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1930,7 +1945,7 @@ static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct fil
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_ERROR, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1941,7 +1956,7 @@ static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct fil
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
|
||||
do_log(SMB_VFS_OP_AIO_FSYNC, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1952,7 +1967,7 @@ static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct f
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
|
||||
do_log(SMB_VFS_OP_AIO_SUSPEND, (result >= 0), handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1964,7 +1979,7 @@ static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
|
||||
|
||||
result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
|
||||
do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
|
||||
"%s", fsp->fsp_name);
|
||||
"%s", fsp_str_do_log(fsp));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ static NTSTATUS gpfsacl_fget_nt_acl(vfs_handle_struct *handle,
|
||||
int result;
|
||||
|
||||
*ppdesc = NULL;
|
||||
result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl);
|
||||
result = gpfs_get_nfs4_acl(fsp->fsp_name->base_name, &pacl);
|
||||
|
||||
if (result == 0)
|
||||
return smb_fget_nt_acl_nfs4(fsp, security_info, ppdesc, pacl);
|
||||
@ -389,7 +389,7 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
|
||||
"merge_writeappend", True)) {
|
||||
DEBUG(2, ("vfs_gpfs.c: file [%s]: ACE contains "
|
||||
"WRITE^APPEND, setting WRITE|APPEND\n",
|
||||
fsp->fsp_name));
|
||||
fsp_str_dbg(fsp)));
|
||||
gace->aceMask |= ACE4_MASK_WRITE|ACE4_MASK_APPEND;
|
||||
}
|
||||
|
||||
@ -423,7 +423,8 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
|
||||
gacl->acl_nace++;
|
||||
}
|
||||
|
||||
ret = smbd_gpfs_putacl(fsp->fsp_name, GPFS_PUTACL_STRUCT | GPFS_ACL_SAMBA, gacl);
|
||||
ret = smbd_gpfs_putacl(fsp->fsp_name->base_name,
|
||||
GPFS_PUTACL_STRUCT | GPFS_ACL_SAMBA, gacl);
|
||||
if (ret != 0) {
|
||||
DEBUG(8, ("gpfs_putacl failed with %s\n", strerror(errno)));
|
||||
gpfs_dumpacl(8, gacl);
|
||||
@ -439,7 +440,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i
|
||||
struct gpfs_acl *acl;
|
||||
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
|
||||
|
||||
acl = gpfs_getacl_alloc(fsp->fsp_name, 0);
|
||||
acl = gpfs_getacl_alloc(fsp->fsp_name->base_name, 0);
|
||||
if (acl == NULL)
|
||||
return result;
|
||||
|
||||
@ -594,7 +595,8 @@ static SMB_ACL_T gpfsacl_sys_acl_get_file(vfs_handle_struct *handle,
|
||||
static SMB_ACL_T gpfsacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
files_struct *fsp)
|
||||
{
|
||||
return gpfsacl_get_posix_acl(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS);
|
||||
return gpfsacl_get_posix_acl(fsp->fsp_name->base_name,
|
||||
GPFS_ACL_TYPE_ACCESS);
|
||||
}
|
||||
|
||||
static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl,
|
||||
@ -707,7 +709,8 @@ static int gpfsacl_sys_acl_set_fd(vfs_handle_struct *handle,
|
||||
files_struct *fsp,
|
||||
SMB_ACL_T theacl)
|
||||
{
|
||||
return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name, SMB_ACL_TYPE_ACCESS, theacl);
|
||||
return gpfsacl_sys_acl_set_file(handle, fsp->fsp_name->base_name,
|
||||
SMB_ACL_TYPE_ACCESS, theacl);
|
||||
}
|
||||
|
||||
static int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
||||
@ -764,6 +767,8 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
|
||||
int i;
|
||||
files_struct fake_fsp; /* TODO: rationalize parametrization */
|
||||
SMB4ACE_T *smbace;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
DEBUG(10, ("gpfsacl_emu_chmod invoked for %s mode %o\n", path, mode));
|
||||
|
||||
@ -833,11 +838,19 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
|
||||
|
||||
/* don't add complementary DENY ACEs here */
|
||||
ZERO_STRUCT(fake_fsp);
|
||||
fake_fsp.fsp_name = (char *)path; /* no file_new is needed here */
|
||||
|
||||
/* put the acl */
|
||||
if (gpfsacl_process_smbacl(&fake_fsp, pacl) == False)
|
||||
status = create_synthetic_smb_fname(talloc_tos(), path, NULL, NULL,
|
||||
&fake_fsp.fsp_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
return -1;
|
||||
}
|
||||
/* put the acl */
|
||||
if (gpfsacl_process_smbacl(&fake_fsp, pacl) == False) {
|
||||
TALLOC_FREE(fake_fsp.fsp_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
TALLOC_FREE(fake_fsp.fsp_name);
|
||||
return 0; /* ok for [f]chmod */
|
||||
}
|
||||
|
||||
@ -875,7 +888,7 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = gpfsacl_emu_chmod(fsp->fsp_name, mode);
|
||||
rc = gpfsacl_emu_chmod(fsp->fsp_name->base_name, mode);
|
||||
if (rc == 1)
|
||||
return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
|
||||
return rc;
|
||||
|
@ -201,23 +201,23 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
DEBUG(10, ("redirecting call of hpuxacl_sys_acl_get_fd to "
|
||||
"hpuxacl_sys_acl_get_file (no facl syscall on HPUX).\n"));
|
||||
|
||||
return hpuxacl_sys_acl_get_file(handle, file_struct_p->fsp_name,
|
||||
SMB_ACL_TYPE_ACCESS);
|
||||
return hpuxacl_sys_acl_get_file(handle,
|
||||
file_struct_p->fsp_name->base_name,
|
||||
SMB_ACL_TYPE_ACCESS);
|
||||
}
|
||||
|
||||
|
||||
int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
|
||||
const char *name,
|
||||
struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
SMB_ACL_T theacl)
|
||||
{
|
||||
int ret = -1;
|
||||
SMB_STRUCT_STAT s;
|
||||
HPUX_ACL_T hpux_acl = NULL;
|
||||
int count;
|
||||
|
||||
DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n",
|
||||
name));
|
||||
smb_fname_str_dbg(smb_fname)));
|
||||
|
||||
|
||||
if(hpux_acl_call_present() == False) {
|
||||
@ -248,11 +248,11 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
|
||||
* that has _not_ been specified in "type" from the file first
|
||||
* and concatenate it with the acl provided.
|
||||
*/
|
||||
if (vfs_stat_smb_fname(handle->conn, name, &s) != 0) {
|
||||
if (SMB_VFS_STAT(handle->conn, smb_fname) != 0) {
|
||||
DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
|
||||
goto done;
|
||||
}
|
||||
if (S_ISDIR(s.st_ex_mode)) {
|
||||
if (S_ISDIR(smb_fname->st.st_ex_mode)) {
|
||||
HPUX_ACL_T other_acl;
|
||||
int other_count;
|
||||
SMB_ACL_TYPE_T other_type;
|
||||
@ -261,7 +261,8 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
|
||||
? SMB_ACL_TYPE_DEFAULT
|
||||
: SMB_ACL_TYPE_ACCESS;
|
||||
DEBUGADD(10, ("getting acl from filesystem\n"));
|
||||
if (!hpux_acl_get_file(name, &other_acl, &other_count)) {
|
||||
if (!hpux_acl_get_file(smb_fname->base_name, &other_acl,
|
||||
&other_count)) {
|
||||
DEBUG(10, ("error getting acl from directory\n"));
|
||||
goto done;
|
||||
}
|
||||
@ -289,7 +290,8 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
|
||||
}
|
||||
DEBUG(10, ("resulting acl is valid.\n"));
|
||||
|
||||
ret = acl(CONST_DISCARD(char *, name), ACL_SET, count, hpux_acl);
|
||||
ret = acl(CONST_DISCARD(char *, smb_fname->base_name), ACL_SET, count,
|
||||
hpux_acl);
|
||||
if (ret != 0) {
|
||||
DEBUG(0, ("ERROR calling acl: %s\n", strerror(errno)));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
|
||||
files_struct *fsp);
|
||||
|
||||
int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
|
||||
const char *name,
|
||||
struct smb_filename *smb_fname,
|
||||
SMB_ACL_TYPE_T type,
|
||||
SMB_ACL_T theacl);
|
||||
|
||||
|
@ -406,8 +406,8 @@ static int shadow_copy2_lstat(vfs_handle_struct *handle,
|
||||
static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
|
||||
{
|
||||
int ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
|
||||
if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name)) {
|
||||
convert_sbuf(handle, fsp->fsp_name, sbuf);
|
||||
if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name->base_name)) {
|
||||
convert_sbuf(handle, fsp->fsp_name->base_name, sbuf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -336,11 +336,11 @@ static ssize_t smb_traffic_analyzer_read(vfs_handle_struct *handle, \
|
||||
ssize_t result;
|
||||
|
||||
result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
|
||||
DEBUG(10, ("smb_traffic_analyzer_read: READ: %s\n", fsp->fsp_name ));
|
||||
DEBUG(10, ("smb_traffic_analyzer_read: READ: %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
smb_traffic_analyzer_send_data(handle,
|
||||
result,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
false);
|
||||
return result;
|
||||
}
|
||||
@ -353,11 +353,12 @@ static ssize_t smb_traffic_analyzer_pread(vfs_handle_struct *handle, \
|
||||
|
||||
result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
|
||||
|
||||
DEBUG(10, ("smb_traffic_analyzer_pread: PREAD: %s\n", fsp->fsp_name ));
|
||||
DEBUG(10, ("smb_traffic_analyzer_pread: PREAD: %s\n",
|
||||
fsp_str_dbg(fsp)));
|
||||
|
||||
smb_traffic_analyzer_send_data(handle,
|
||||
result,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
false);
|
||||
|
||||
return result;
|
||||
@ -370,11 +371,12 @@ static ssize_t smb_traffic_analyzer_write(vfs_handle_struct *handle, \
|
||||
|
||||
result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
|
||||
|
||||
DEBUG(10, ("smb_traffic_analyzer_write: WRITE: %s\n", fsp->fsp_name ));
|
||||
DEBUG(10, ("smb_traffic_analyzer_write: WRITE: %s\n",
|
||||
fsp_str_dbg(fsp)));
|
||||
|
||||
smb_traffic_analyzer_send_data(handle,
|
||||
result,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
true);
|
||||
return result;
|
||||
}
|
||||
@ -386,11 +388,11 @@ static ssize_t smb_traffic_analyzer_pwrite(vfs_handle_struct *handle, \
|
||||
|
||||
result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
|
||||
|
||||
DEBUG(10, ("smb_traffic_analyzer_pwrite: PWRITE: %s\n", fsp->fsp_name ));
|
||||
DEBUG(10, ("smb_traffic_analyzer_pwrite: PWRITE: %s\n", fsp_str_dbg(fsp)));
|
||||
|
||||
smb_traffic_analyzer_send_data(handle,
|
||||
result,
|
||||
fsp->fsp_name,
|
||||
fsp->fsp_name->base_name,
|
||||
true);
|
||||
return result;
|
||||
}
|
||||
|
@ -128,27 +128,20 @@ static NTSTATUS streams_xattr_get_name(TALLOC_CTX *ctx,
|
||||
static bool streams_xattr_recheck(struct stream_io *sio)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct smb_filename *smb_fname = NULL;
|
||||
char *xattr_name = NULL;
|
||||
|
||||
if (sio->fsp->fsp_name == sio->fsp_name_ptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
status = create_synthetic_smb_fname_split(talloc_tos(),
|
||||
sio->fsp->fsp_name, NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (smb_fname->stream_name == NULL) {
|
||||
if (sio->fsp->fsp_name->stream_name == NULL) {
|
||||
/* how can this happen */
|
||||
errno = EINVAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
status = streams_xattr_get_name(talloc_tos(), smb_fname->stream_name,
|
||||
status = streams_xattr_get_name(talloc_tos(),
|
||||
sio->fsp->fsp_name->stream_name,
|
||||
&xattr_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return false;
|
||||
@ -159,10 +152,9 @@ static bool streams_xattr_recheck(struct stream_io *sio)
|
||||
sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
|
||||
xattr_name);
|
||||
sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
|
||||
smb_fname->base_name);
|
||||
sio->fsp->fsp_name->base_name);
|
||||
sio->fsp_name_ptr = sio->fsp->fsp_name;
|
||||
|
||||
TALLOC_FREE(smb_fname);
|
||||
TALLOC_FREE(xattr_name);
|
||||
|
||||
if ((sio->xattr_name == NULL) || (sio->base == NULL)) {
|
||||
@ -899,7 +891,8 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
|
||||
sio->xattr_name,
|
||||
ea.value.data, ea.value.length, 0);
|
||||
} else {
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn,
|
||||
fsp->base_fsp->fsp_name->base_name,
|
||||
sio->xattr_name,
|
||||
ea.value.data, ea.value.length, 0);
|
||||
}
|
||||
@ -963,8 +956,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
|
||||
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
|
||||
|
||||
DEBUG(10, ("streams_xattr_ftruncate called for file %s offset %.0f\n",
|
||||
fsp->fsp_name,
|
||||
(double)offset ));
|
||||
fsp_str_dbg(fsp), (double)offset));
|
||||
|
||||
if (sio == NULL) {
|
||||
return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
|
||||
@ -1004,7 +996,8 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
|
||||
sio->xattr_name,
|
||||
ea.value.data, ea.value.length, 0);
|
||||
} else {
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
|
||||
ret = SMB_VFS_SETXATTR(fsp->conn,
|
||||
fsp->base_fsp->fsp_name->base_name,
|
||||
sio->xattr_name,
|
||||
ea.value.data, ea.value.length, 0);
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_s
|
||||
if(result >= 0) {
|
||||
notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name);
|
||||
fsp->fsp_name->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -307,7 +307,7 @@ static ssize_t tsmsm_pread(struct vfs_handle_struct *handle, struct files_struct
|
||||
*/
|
||||
notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name);
|
||||
fsp->fsp_name->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -325,7 +325,7 @@ static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struc
|
||||
*/
|
||||
notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name);
|
||||
fsp->fsp_name->base_name);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -145,14 +145,14 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
|
||||
SMB_ASSERT(i == naces);
|
||||
|
||||
/* store acl */
|
||||
if(acl(fsp->fsp_name, ACE_SETACL, naces, acebuf)) {
|
||||
if(acl(fsp->fsp_name->base_name, ACE_SETACL, naces, acebuf)) {
|
||||
if(errno == ENOSYS) {
|
||||
DEBUG(9, ("acl(ACE_SETACL, %s): Operation is not "
|
||||
"supported on the filesystem where the file "
|
||||
"reside", fsp->fsp_name));
|
||||
"reside", fsp_str_dbg(fsp)));
|
||||
} else {
|
||||
DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp->fsp_name,
|
||||
strerror(errno)));
|
||||
DEBUG(9, ("acl(ACE_SETACL, %s): %s ", fsp_str_dbg(fsp),
|
||||
strerror(errno)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -180,7 +180,8 @@ static NTSTATUS zfsacl_fget_nt_acl(struct vfs_handle_struct *handle,
|
||||
SMB4ACL_T *pacl;
|
||||
NTSTATUS status;
|
||||
|
||||
status = zfs_get_nt_acl_common(fsp->fsp_name, security_info, &pacl);
|
||||
status = zfs_get_nt_acl_common(fsp->fsp_name->base_name, security_info,
|
||||
&pacl);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -58,6 +58,13 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
|
||||
return NT_STATUS_ACCESS_DENIED; /* No errno around here */
|
||||
}
|
||||
|
||||
status = create_synthetic_smb_fname(fsp,
|
||||
print_job_fname(lp_const_servicename(SNUM(conn)), jobid), NULL,
|
||||
NULL, &fsp->fsp_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
pjob_delete(lp_const_servicename(SNUM(conn)), jobid);
|
||||
return status;
|
||||
}
|
||||
/* setup a full fsp */
|
||||
fsp->fh->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid);
|
||||
GetTimeOfDay(&fsp->open_time);
|
||||
@ -72,7 +79,6 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
|
||||
fsp->oplock_type = NO_OPLOCK;
|
||||
fsp->sent_oplock_break = NO_BREAK_SENT;
|
||||
fsp->is_directory = False;
|
||||
string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid));
|
||||
fsp->wcp = NULL;
|
||||
SMB_VFS_FSTAT(fsp, psbuf);
|
||||
fsp->mode = psbuf->st_ex_mode;
|
||||
@ -98,7 +104,7 @@ void print_fsp_end(files_struct *fsp, enum file_close_type close_type)
|
||||
}
|
||||
|
||||
if (fsp->fsp_name) {
|
||||
string_free(&fsp->fsp_name);
|
||||
TALLOC_FREE(fsp->fsp_name);
|
||||
}
|
||||
|
||||
if (!rap_to_pjobid(fsp->rap_print_jobid, NULL, &jobid)) {
|
||||
|
@ -317,11 +317,6 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
|
||||
if (fsp == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
fsp->fsp_name = SMB_STRDUP(argv[1]);
|
||||
if (fsp->fsp_name == NULL) {
|
||||
SAFE_FREE(fsp);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
fsp->fh = SMB_MALLOC_P(struct fd_handle);
|
||||
if (fsp->fh == NULL) {
|
||||
SAFE_FREE(fsp->fsp_name);
|
||||
@ -333,18 +328,18 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
|
||||
status = create_synthetic_smb_fname_split(mem_ctx, argv[1], NULL,
|
||||
&smb_fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
SAFE_FREE(fsp->fsp_name);
|
||||
SAFE_FREE(fsp);
|
||||
return status;
|
||||
}
|
||||
|
||||
fsp->fsp_name = smb_fname;
|
||||
|
||||
fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, smb_fname, fsp, flags, mode);
|
||||
TALLOC_FREE(smb_fname);
|
||||
if (fsp->fh->fd == -1) {
|
||||
printf("open: error=%d (%s)\n", errno, strerror(errno));
|
||||
SAFE_FREE(fsp->fh);
|
||||
SAFE_FREE(fsp->fsp_name);
|
||||
SAFE_FREE(fsp);
|
||||
TALLOC_FREE(smb_fname);
|
||||
return NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
@ -415,7 +410,7 @@ static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
|
||||
else
|
||||
printf("close: ok\n");
|
||||
|
||||
SAFE_FREE(vfs->files[fd]->fsp_name);
|
||||
TALLOC_FREE(vfs->files[fd]->fsp_name);
|
||||
SAFE_FREE(vfs->files[fd]->fh);
|
||||
SAFE_FREE(vfs->files[fd]);
|
||||
vfs->files[fd] = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user