summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/nfs4_acls.c14
-rw-r--r--source3/modules/vfs_acl_xattr.c361
-rw-r--r--source3/modules/vfs_afsacl.c16
-rw-r--r--source3/modules/vfs_aixacl2.c4
-rw-r--r--source3/modules/vfs_cap.c8
-rw-r--r--source3/modules/vfs_default.c8
-rw-r--r--source3/modules/vfs_full_audit.c18
-rw-r--r--source3/modules/vfs_gpfs.c10
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.c427
-rw-r--r--source3/modules/vfs_xattr_tdb.c68
-rw-r--r--source3/modules/vfs_zfsacl.c4
11 files changed, 860 insertions, 78 deletions
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 9e28db8b39..f411176590 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -44,10 +44,6 @@ typedef struct _SMB_ACL4_INT_T
SMB_ACE4_INT_T *last;
} SMB_ACL4_INT_T;
-extern int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
-extern NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp,
- uint32 security_info_sent, SEC_DESC *psd);
-
static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *acl)
{
SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl;
@@ -225,7 +221,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
}
for (aceint=aclint->first; aceint!=NULL; aceint=(SMB_ACE4_INT_T *)aceint->next) {
- SEC_ACCESS mask;
+ uint32_t mask;
DOM_SID sid;
SMB_ACE4PROP_T *ace = &aceint->prop;
@@ -260,7 +256,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
DEBUG(10, ("mapped %d to %s\n", ace->who.id,
sid_string_dbg(&sid)));
- init_sec_access(&mask, ace->aceMask);
+ mask = ace->aceMask;
init_sec_ace(&nt_ace_list[good_aces++], &sid,
ace->aceType, mask,
ace->aceFlags & 0xf);
@@ -518,7 +514,7 @@ static bool smbacl4_fill_ace4(
smbacl4_vfs_params *params,
uid_t ownerUID,
gid_t ownerGID,
- SEC_ACE *ace_nt, /* input */
+ const SEC_ACE *ace_nt, /* input */
SMB_ACE4PROP_T *ace_v4 /* output */
)
{
@@ -650,7 +646,7 @@ static int smbacl4_MergeIgnoreReject(
static SMB4ACL_T *smbacl4_win2nfs4(
const char *filename,
- SEC_ACL *dacl,
+ const SEC_ACL *dacl,
smbacl4_vfs_params *pparams,
uid_t ownerUID,
gid_t ownerGID
@@ -694,7 +690,7 @@ static SMB4ACL_T *smbacl4_win2nfs4(
NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd,
+ const SEC_DESC *psd,
set_nfs4acl_native_fn_t set_nfs4_native)
{
smbacl4_vfs_params params;
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
new file mode 100644
index 0000000000..241751c6a6
--- /dev/null
+++ b/source3/modules/vfs_acl_xattr.c
@@ -0,0 +1,361 @@
+/*
+ * Store Windows ACLs in xattrs.
+ *
+ * Copyright (C) Volker Lendecke, 2008
+ * Copyright (C) Jeremy Allison, 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This is an experimental module, not yet finished. JRA. */
+
+#include "includes.h"
+#include "librpc/gen_ndr/xattr.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+static NTSTATUS parse_acl_blob(const DATA_BLOB *pblob,
+ const struct timespec cts,
+ uint32 security_info,
+ struct security_descriptor **ppdesc)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ struct xattr_NTACL xacl;
+ enum ndr_err_code ndr_err;
+ size_t sd_size;
+ struct timespec ts;
+
+ ndr_err = ndr_pull_struct_blob(pblob, ctx, NULL, &xacl,
+ (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(5, ("parse_acl_blob: ndr_pull_xattr_NTACL failed: %s\n",
+ ndr_errstr(ndr_err)));
+ return ndr_map_error2ntstatus(ndr_err);;
+ }
+
+ if (xacl.version != 2) {
+ return NT_STATUS_REVISION_MISMATCH;
+ }
+
+ /*
+ * Check that the ctime timestamp is ealier
+ * than the stored timestamp.
+ */
+
+ ts = nt_time_to_unix_timespec(&xacl.info.sd_ts->last_changed);
+
+ if (timespec_compare(&cts, &ts) > 0) {
+ DEBUG(5, ("parse_acl_blob: stored ACL out of date.\n"));
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+
+ *ppdesc = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
+ (security_info & OWNER_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->owner_sid : NULL,
+ (security_info & GROUP_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->group_sid : NULL,
+ (security_info & SACL_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->sacl : NULL,
+ (security_info & DACL_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->dacl : NULL,
+ &sd_size);
+
+ TALLOC_FREE(xacl.info.sd);
+
+ return (*ppdesc != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
+}
+
+static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
+ vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *name,
+ DATA_BLOB *pblob)
+{
+ size_t size = 1024;
+ uint8_t *val = NULL;
+ uint8_t *tmp;
+ ssize_t sizeret;
+ int saved_errno = 0;
+
+ ZERO_STRUCTP(pblob);
+
+ again:
+
+ tmp = TALLOC_REALLOC_ARRAY(ctx, val, uint8_t, size);
+ if (tmp == NULL) {
+ TALLOC_FREE(val);
+ return NT_STATUS_NO_MEMORY;
+ }
+ val = tmp;
+
+ become_root();
+ if (fsp && fsp->fh->fd != -1) {
+ sizeret = SMB_VFS_FGETXATTR(fsp, XATTR_NTACL_NAME, val, size);
+ } else {
+ sizeret = SMB_VFS_GETXATTR(handle->conn, name,
+ XATTR_NTACL_NAME, val, size);
+ }
+ if (sizeret == -1) {
+ saved_errno = errno;
+ }
+ unbecome_root();
+
+ /* Max ACL size is 65536 bytes. */
+ if (sizeret == -1) {
+ errno = saved_errno;
+ if ((errno == ERANGE) && (size != 65536)) {
+ /* Too small, try again. */
+ size = 65536;
+ goto again;
+ }
+
+ /* Real error - exit here. */
+ TALLOC_FREE(val);
+ return map_nt_error_from_unix(errno);
+ }
+
+ pblob->data = val;
+ pblob->length = sizeret;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS get_nt_acl_xattr_internal(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *name,
+ uint32 security_info,
+ SEC_DESC **ppdesc)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ DATA_BLOB blob;
+ SMB_STRUCT_STAT sbuf;
+ NTSTATUS status;
+
+ if (fsp && name == NULL) {
+ name = fsp->fsp_name;
+ }
+
+ DEBUG(10, ("get_nt_acl_xattr_internal: name=%s\n", name));
+
+ status = get_acl_blob(ctx, handle, fsp, name, &blob);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("get_acl_blob returned %s\n", nt_errstr(status)));
+ return status;
+ }
+
+ if (fsp && fsp->fh->fd != -1) {
+ if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ } else {
+ if (SMB_VFS_STAT(handle->conn, name, &sbuf) == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ }
+
+ status = parse_acl_blob(&blob, get_ctimespec(&sbuf),
+ security_info, ppdesc);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("parse_acl_blob returned %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+
+ TALLOC_FREE(blob.data);
+ return status;
+}
+
+static int mkdir_acl_xattr(vfs_handle_struct *handle, const char *path, mode_t mode)
+{
+ return SMB_VFS_NEXT_MKDIR(handle, path, mode);
+}
+
+/*********************************************************************
+ * Currently this only works for existing files. Need to work on
+ * inheritance for new files.
+*********************************************************************/
+
+static int open_acl_xattr(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode)
+{
+ uint32_t access_granted = 0;
+ SEC_DESC *pdesc = NULL;
+ NTSTATUS status = get_nt_acl_xattr_internal(handle,
+ NULL,
+ fname,
+ (OWNER_SECURITY_INFORMATION |
+ GROUP_SECURITY_INFORMATION |
+ DACL_SECURITY_INFORMATION),
+ &pdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ /* See if we can access it. */
+ if (!se_access_check(pdesc,
+ handle->conn->server_info->ptok,
+ fsp->access_mask,
+ &access_granted,
+ &status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+ }
+
+ return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
+}
+
+static NTSTATUS fget_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
+ uint32 security_info, SEC_DESC **ppdesc)
+{
+ NTSTATUS status = get_nt_acl_xattr_internal(handle, fsp,
+ NULL, security_info, ppdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_OK;
+ }
+ return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp,
+ security_info, ppdesc);
+}
+
+static NTSTATUS get_nt_acl_xattr(vfs_handle_struct *handle,
+ const char *name, uint32 security_info, SEC_DESC **ppdesc)
+{
+ NTSTATUS status = get_nt_acl_xattr_internal(handle, NULL,
+ name, security_info, ppdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_OK;
+ }
+ return SMB_VFS_NEXT_GET_NT_ACL(handle, name,
+ security_info, ppdesc);
+}
+
+static NTSTATUS create_acl_blob(const SEC_DESC *psd, DATA_BLOB *pblob)
+{
+ struct xattr_NTACL xacl;
+ struct security_descriptor_timestamp sd_ts;
+ enum ndr_err_code ndr_err;
+ TALLOC_CTX *ctx = talloc_tos();
+ struct timespec curr = timespec_current();
+
+ ZERO_STRUCT(xacl);
+ ZERO_STRUCT(sd_ts);
+
+ /* Horrid hack as setting an xattr changes the ctime
+ * on Linux. This gives a race of 1 second during
+ * which we would not see a POSIX ACL set.
+ */
+ curr.tv_sec += 1;
+
+ xacl.version = 2;
+ xacl.info.sd_ts = &sd_ts;
+ xacl.info.sd_ts->sd = CONST_DISCARD(SEC_DESC *, psd);
+ unix_timespec_to_nt_time(&xacl.info.sd_ts->last_changed, curr);
+
+ ndr_err = ndr_push_struct_blob(
+ pblob, ctx, NULL, &xacl,
+ (ndr_push_flags_fn_t)ndr_push_xattr_NTACL);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(5, ("create_acl_blob: ndr_push_xattr_NTACL failed: %s\n",
+ ndr_errstr(ndr_err)));
+ return ndr_map_error2ntstatus(ndr_err);;
+ }
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS store_acl_blob(files_struct *fsp,
+ DATA_BLOB *pblob)
+{
+ int ret;
+ int saved_errno = 0;
+
+ DEBUG(10,("store_acl_blob: storing blob length %u on file %s\n",
+ (unsigned int)pblob->length, fsp->fsp_name));
+
+ 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,
+ XATTR_NTACL_NAME,
+ pblob->data, pblob->length, 0);
+ }
+ if (ret) {
+ saved_errno = errno;
+ }
+ unbecome_root();
+ if (ret) {
+ errno = saved_errno;
+ DEBUG(5, ("store_acl_blob: setting attr failed for file %s"
+ "with error %s\n",
+ fsp->fsp_name,
+ strerror(errno) ));
+ return map_nt_error_from_unix(errno);
+ }
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
+ uint32 security_info_sent, const SEC_DESC *psd)
+{
+ NTSTATUS status;
+ DATA_BLOB blob;
+
+ status = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if ((security_info_sent & DACL_SECURITY_INFORMATION) &&
+ psd->dacl != NULL &&
+ (psd->type & (SE_DESC_DACL_AUTO_INHERITED|
+ SE_DESC_DACL_AUTO_INHERIT_REQ))==
+ (SE_DESC_DACL_AUTO_INHERITED|
+ SE_DESC_DACL_AUTO_INHERIT_REQ) ) {
+ SEC_DESC *new_psd = NULL;
+ status = append_parent_acl(fsp, psd, &new_psd);
+ if (!NT_STATUS_IS_OK(status)) {
+ /* Lower level acl set succeeded,
+ * so still return OK. */
+ return NT_STATUS_OK;
+ }
+ psd = new_psd;
+ }
+
+ create_acl_blob(psd, &blob);
+ store_acl_blob(fsp, &blob);
+
+ return NT_STATUS_OK;
+}
+
+/* VFS operations structure */
+
+static vfs_op_tuple skel_op_tuples[] =
+{
+ {SMB_VFS_OP(mkdir_acl_xattr), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(open_acl_xattr), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT},
+
+ /* NT File ACL operations */
+
+ {SMB_VFS_OP(fget_nt_acl_xattr),SMB_VFS_OP_FGET_NT_ACL,SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(get_nt_acl_xattr), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(fset_nt_acl_xattr),SMB_VFS_OP_FSET_NT_ACL,SMB_VFS_LAYER_TRANSPARENT},
+
+ {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_acl_xattr_init(void)
+{
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "acl_xattr", skel_op_tuples);
+}
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 9409f3fa20..8c89d2fd9f 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -592,7 +592,6 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
{
SEC_ACE *nt_ace_list;
DOM_SID owner_sid, group_sid;
- SEC_ACCESS mask;
SEC_ACL *psa = NULL;
int good_aces;
size_t sd_size;
@@ -616,7 +615,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
good_aces = 0;
while (afs_ace != NULL) {
- uint32 nt_rights;
+ uint32_t nt_rights;
uint8 flag = SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT;
@@ -633,9 +632,8 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
else
nt_rights = afs_to_nt_file_rights(afs_ace->rights);
- init_sec_access(&mask, nt_rights);
init_sec_ace(&nt_ace_list[good_aces++], &(afs_ace->sid),
- SEC_ACE_TYPE_ACCESS_ALLOWED, mask, flag);
+ SEC_ACE_TYPE_ACCESS_ALLOWED, nt_rights, flag);
afs_ace = afs_ace->next;
}
@@ -717,12 +715,12 @@ static bool mappable_sid(const DOM_SID *sid)
static bool nt_to_afs_acl(const char *filename,
uint32 security_info_sent,
- struct security_descriptor *psd,
+ const struct security_descriptor *psd,
uint32 (*nt_to_afs_rights)(const char *filename,
const SEC_ACE *ace),
struct afs_acl *afs_acl)
{
- SEC_ACL *dacl;
+ const SEC_ACL *dacl;
int i;
/* Currently we *only* look at the dacl */
@@ -737,7 +735,7 @@ static bool nt_to_afs_acl(const char *filename,
dacl = psd->dacl;
for (i = 0; i < dacl->num_aces; i++) {
- SEC_ACE *ace = &(dacl->aces[i]);
+ const SEC_ACE *ace = &(dacl->aces[i]);
const char *dom_name, *name;
enum lsa_SidType name_type;
char *p;
@@ -887,7 +885,7 @@ static void merge_unknown_aces(struct afs_acl *src, struct afs_acl *dst)
static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- struct security_descriptor *psd)
+ const struct security_descriptor *psd)
{
struct afs_acl old_afs_acl, new_afs_acl;
struct afs_acl dir_acl, file_acl;
@@ -1040,7 +1038,7 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
}
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index 23c4d88134..a078b9f9f6 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -371,7 +371,7 @@ static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
return True;
}
-static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
acl_type_t acl_type_info;
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
@@ -395,7 +395,7 @@ static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_inf
return result;
}
-NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
}
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 79537367d6..6950ab2168 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -28,15 +28,15 @@
static char *capencode(TALLOC_CTX *ctx, const char *from);
static char *capdecode(TALLOC_CTX *ctx, const char *from);
-static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static uint64_t cap_disk_free(vfs_handle_struct *handle, const char *path,
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
char *cappath = capencode(talloc_tos(), path);
if (!cappath) {
errno = ENOMEM;
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
return SMB_VFS_NEXT_DISK_FREE(handle, cappath, small_query, bsize,
dfree, dsize);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 381aa18561..275c2f53c4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -40,10 +40,10 @@ static void vfswrap_disconnect(vfs_handle_struct *handle)
/* Disk operations */
-static SMB_BIG_UINT vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static uint64_t vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
- SMB_BIG_UINT result;
+ uint64_t result;
result = sys_disk_free(handle->conn, path, small_query, bsize, dfree, dsize);
return result;
@@ -1036,7 +1036,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
return result;
}
-static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
NTSTATUS result;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 1224ec3edb..6342c4a14e 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -74,10 +74,10 @@ struct vfs_full_audit_private_data {
static int smb_full_audit_connect(vfs_handle_struct *handle,
const char *svc, const char *user);
static void smb_full_audit_disconnect(vfs_handle_struct *handle);
-static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
+static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize);
static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
enum SMB_QUOTA_TYPE qtype, unid_t id,
SMB_DISK_QUOTA *qt);
@@ -202,7 +202,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
SEC_DESC **ppdesc);
static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd);
+ const SEC_DESC *psd);
static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
const char *path, mode_t mode);
static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
@@ -910,12 +910,12 @@ static void smb_full_audit_disconnect(vfs_handle_struct *handle)
return;
}
-static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
+static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
- SMB_BIG_UINT result;
+ uint64_t result;
result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
dfree, dsize);
@@ -1582,7 +1582,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
NTSTATUS result;
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 39d2bb6c38..fa0b4e97a5 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -179,7 +179,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
"who: %d\n", gace->aceType, gace->aceIFlags,
gace->aceFlags, gace->aceMask, gace->aceWho));
- memset(&smbace, 0, sizeof(SMB4ACE_T));
+ ZERO_STRUCT(smbace);
if (gace->aceIFlags & ACE4_IFLAG_SPECIAL_ID) {
smbace.flags |= SMB_ACE4_ID_SPECIAL;
switch (gace->aceWho) {
@@ -365,7 +365,7 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
return True;
}
-static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
struct gpfs_acl *acl;
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
@@ -386,7 +386,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i
return result;
}
-static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
}
@@ -739,7 +739,7 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
if (haveAllowEntry[i]==True)
continue;
- memset(&ace, 0, sizeof(SMB_ACE4PROP_T));
+ ZERO_STRUCT(ace);
ace.aceType = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE;
ace.flags |= SMB_ACE4_ID_SPECIAL;
ace.who.special_id = i;
@@ -761,7 +761,7 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
}
/* don't add complementary DENY ACEs here */
- memset(&fake_fsp, 0, sizeof(struct files_struct));
+ ZERO_STRUCT(fake_fsp);
fake_fsp.fsp_name = (char *)path; /* no file_new is needed here */
/* put the acl */
diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
new file mode 100644
index 0000000000..9456afb811
--- /dev/null
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -0,0 +1,427 @@
+/*
+ * traffic-analyzer VFS module. Measure the smb traffic users create
+ * on the net.
+ *
+ * Copyright (C) Holger Hetterich, 2008
+ * Copyright (C) Jeremy Allison, 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+
+/* abstraction for the send_over_network function */
+
+enum sock_type {INTERNET_SOCKET = 0, UNIX_DOMAIN_SOCKET};
+
+#define LOCAL_PATHNAME "/var/tmp/stadsocket"
+
+static int vfs_smb_traffic_analyzer_debug_level = DBGC_VFS;
+
+static enum sock_type smb_traffic_analyzer_connMode(vfs_handle_struct *handle)
+{
+ connection_struct *conn = handle->conn;
+ const char *Mode;
+ Mode=lp_parm_const_string(SNUM(conn), "smb_traffic_analyzer","mode", \
+ "internet_socket");
+ if (strstr(Mode,"unix_domain_socket")) {
+ return UNIX_DOMAIN_SOCKET;
+ } else {
+ return INTERNET_SOCKET;
+ }
+}
+
+
+/* Connect to an internet socket */
+
+static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle,
+ const char *name, uint16_t port)
+{
+ /* Create a streaming Socket */
+ int sockfd = -1;
+ struct addrinfo hints;
+ struct addrinfo *ailist = NULL;
+ struct addrinfo *res = NULL;
+ int ret;
+
+ ZERO_STRUCT(hints);
+ /* By default make sure it supports TCP. */
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+
+ ret = getaddrinfo(name,
+ NULL,
+ &hints,
+ &ailist);
+
+ if (ret) {
+ DEBUG(3,("smb_traffic_analyzer_connect_inet_socket: "
+ "getaddrinfo failed for name %s [%s]\n",
+ name,
+ gai_strerror(ret) ));
+ return -1;
+ }
+
+ DEBUG(3,("smb_traffic_analyzer: Internet socket mode. Hostname: %s,"
+ "Port: %i\n", name, port));
+
+ for (res = ailist; res; res = res->ai_next) {
+ struct sockaddr_storage ss;
+
+ if (!res->ai_addr || res->ai_addrlen == 0) {
+ continue;
+ }
+
+ ZERO_STRUCT(ss);
+ memcpy(&ss, res->ai_addr, res->ai_addrlen);
+
+ sockfd = open_socket_out(SOCK_STREAM, &ss, port, 10000);
+ if (sockfd != -1) {
+ break;
+ }
+ }
+
+ if (ailist) {
+ freeaddrinfo(ailist);
+ }
+
+ if (sockfd == -1) {
+ DEBUG(1, ("smb_traffic_analyzer: unable to create "
+ "socket, error is %s",
+ strerror(errno)));
+ return -1;
+ }
+
+ return sockfd;
+}
+
+/* Connect to a unix domain socket */
+
+static int smb_traffic_analyzer_connect_unix_socket(vfs_handle_struct *handle,
+ const char *name)
+{
+ /* Create the socket to stad */
+ int len, sock;
+ struct sockaddr_un remote;
+
+ DEBUG(7, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Unix domain socket mode. Using %s\n",
+ name ));
+
+ if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+ DEBUG(1, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Couldn't create socket, "
+ "make sure stad is running!\n"));
+ }
+ remote.sun_family = AF_UNIX;
+ strlcpy(remote.sun_path, name,
+ sizeof(remote.sun_path));
+ len=strlen(remote.sun_path) + sizeof(remote.sun_family);
+ if (connect(sock, (struct sockaddr *)&remote, len) == -1 ) {
+ DEBUG(1, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Could not connect to "
+ "socket, make sure\nstad is running!\n"));
+ close(sock);
+ return -1;
+ }
+ return sock;
+}
+
+/* Private data allowing shared connection sockets. */
+
+struct refcounted_sock {
+ struct refcounted_sock *next, *prev;
+ char *name;
+ uint16_t port;
+ int sock;
+ unsigned int ref_count;
+};
+
+/* Send data over a socket */
+
+static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
+ ssize_t result,
+ const char *file_name,
+ bool Write)
+{
+ struct refcounted_sock *rf_sock = NULL;
+ struct timeval tv;
+ time_t tv_sec;
+ struct tm *tm = NULL;
+ int seconds;
+ char *str = NULL;
+ char *username = NULL;
+ const char *anon_prefix = NULL;
+ size_t len;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, rf_sock, struct refcounted_sock, return);
+
+ if (rf_sock == NULL || rf_sock->sock == -1) {
+ DEBUG(1, ("smb_traffic_analyzer_send_data: socket is "
+ "closed\n"));
+ return;
+ }
+
+ GetTimeOfDay(&tv);
+ tv_sec = convert_timespec_to_time_t(convert_timeval_to_timespec(tv));
+ tm = localtime(&tv_sec);
+ if (!tm) {
+ return;
+ }
+ seconds=(float) (tv.tv_usec / 1000);
+
+ /* check if anonymization is required */
+
+ anon_prefix=lp_parm_const_string(SNUM(handle->conn),"smb_traffic_analyzer",\
+ "anonymize_prefix", NULL );
+ if (anon_prefix!=NULL) {
+ username = talloc_asprintf(talloc_tos(),
+ "%s%i",
+ anon_prefix,
+ str_checksum(
+ handle->conn->server_info->sanitized_username ) );
+ } else {
+ username = handle->conn->server_info->sanitized_username;
+ }
+
+ if (!username) {
+ return;
+ }
+
+ str = talloc_asprintf(talloc_tos(),
+ "V1,%u,\"%s\",\"%s\",\"%c\",\"%s\",\"%s\","
+ "\"%04d-%02d-%02d %02d:%02d:%02d.%03d\"\n",
+ (unsigned int)result,
+ username,
+ pdb_get_domain(handle->conn->server_info->sam_account),
+ Write ? 'W' : 'R',
+ handle->conn->connectpath,
+ file_name,
+ tm->tm_year+1900,
+ tm->tm_mon+1,
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec,
+ (int)seconds);
+
+ if (!str) {
+ return;
+ }
+
+ len = strlen(str);
+
+ DEBUG(10, ("smb_traffic_analyzer_send_data_socket: sending %s\n",
+ str));
+ if (write_data(rf_sock->sock, str, len) != len) {
+ DEBUG(1, ("smb_traffic_analyzer_send_data_socket: "
+ "error sending data to socket!\n"));
+ return ;
+ }
+}
+
+static struct refcounted_sock *sock_list;
+
+static void smb_traffic_analyzer_free_data(void **pptr)
+{
+ struct refcounted_sock *rf_sock = *(struct refcounted_sock **)pptr;
+ if (rf_sock == NULL) {
+ return;
+ }
+ rf_sock->ref_count--;
+ if (rf_sock->ref_count != 0) {
+ return;
+ }
+ if (rf_sock->sock != -1) {
+ close(rf_sock->sock);
+ }
+ DLIST_REMOVE(sock_list, rf_sock);
+ TALLOC_FREE(rf_sock);
+}
+
+static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
+ const char *service,
+ const char *user)
+{
+ connection_struct *conn = handle->conn;
+ enum sock_type st = smb_traffic_analyzer_connMode(handle);
+ struct refcounted_sock *rf_sock = NULL;
+ const char *name = (st == UNIX_DOMAIN_SOCKET) ? LOCAL_PATHNAME :
+ lp_parm_const_string(SNUM(conn),
+ "smb_traffic_analyzer",
+ "host", "localhost");
+ uint16_t port = (st == UNIX_DOMAIN_SOCKET) ? 0 :
+ atoi( lp_parm_const_string(SNUM(conn),
+ "smb_traffic_analyzer", "port", "9430"));
+
+ /* Are we already connected ? */
+ for (rf_sock = sock_list; rf_sock; rf_sock = rf_sock->next) {
+ if (port == rf_sock->port &&
+ (strcmp(name, rf_sock->name) == 0)) {
+ break;
+ }
+ }
+
+ /* If we're connected already, just increase the
+ * reference count. */
+ if (rf_sock) {
+ rf_sock->ref_count++;
+ } else {
+ /* New connection. */
+ rf_sock = TALLOC_ZERO_P(NULL, struct refcounted_sock);
+ if (rf_sock == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ rf_sock->name = talloc_strdup(rf_sock, name);
+ if (rf_sock->name == NULL) {
+ TALLOC_FREE(rf_sock);
+ errno = ENOMEM;
+ return -1;
+ }
+ rf_sock->port = port;
+ rf_sock->ref_count = 1;
+
+ if (st == UNIX_DOMAIN_SOCKET) {
+ rf_sock->sock = smb_traffic_analyzer_connect_unix_socket(handle,
+ name);
+ } else {
+
+ rf_sock->sock = smb_traffic_analyzer_connect_inet_socket(handle,
+ name,
+ port);
+ }
+ if (rf_sock->sock == -1) {
+ TALLOC_FREE(rf_sock);
+ return -1;
+ }
+ DLIST_ADD(sock_list, rf_sock);
+ }
+
+ /* Store the private data. */
+ SMB_VFS_HANDLE_SET_DATA(handle, rf_sock, smb_traffic_analyzer_free_data,
+ struct refcounted_sock, return -1);
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
+}
+
+/* VFS Functions: write, read, pread, pwrite for now */
+
+static ssize_t smb_traffic_analyzer_read(vfs_handle_struct *handle, \
+ files_struct *fsp, void *data, size_t n)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
+ DEBUG(10, ("smb_traffic_analyzer_read: READ: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ false);
+ return result;
+}
+
+
+static ssize_t smb_traffic_analyzer_pread(vfs_handle_struct *handle, \
+ files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+
+ DEBUG(10, ("smb_traffic_analyzer_pread: PREAD: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ false);
+
+ return result;
+}
+
+static ssize_t smb_traffic_analyzer_write(vfs_handle_struct *handle, \
+ files_struct *fsp, const void *data, size_t n)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
+
+ DEBUG(10, ("smb_traffic_analyzer_write: WRITE: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ true);
+ return result;
+}
+
+static ssize_t smb_traffic_analyzer_pwrite(vfs_handle_struct *handle, \
+ files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+
+ DEBUG(10, ("smb_traffic_analyzer_pwrite: PWRITE: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ true);
+ return result;
+}
+
+/* VFS operations we use */
+
+static vfs_op_tuple smb_traffic_analyzer_tuples[] = {
+
+ {SMB_VFS_OP(smb_traffic_analyzer_connect), SMB_VFS_OP_CONNECT,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_read), SMB_VFS_OP_READ,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_pread), SMB_VFS_OP_PREAD,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_write), SMB_VFS_OP_WRITE,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_pwrite), SMB_VFS_OP_PWRITE,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(NULL),SMB_VFS_OP_NOOP,SMB_VFS_LAYER_NOOP}
+};
+
+/* Module initialization */
+
+NTSTATUS vfs_smb_traffic_analyzer_init(void)
+{
+ NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, \
+ "smb_traffic_analyzer", smb_traffic_analyzer_tuples);
+
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
+ }
+
+ vfs_smb_traffic_analyzer_debug_level =
+ debug_add_class("smb_traffic_analyzer");
+
+ if (vfs_smb_traffic_analyzer_debug_level == -1) {
+ vfs_smb_traffic_analyzer_debug_level = DBGC_VFS;
+ DEBUG(1, ("smb_traffic_analyzer_init: Couldn't register custom"
+ "debugging class!\n"));
+ } else {
+ DEBUG(3, ("smb_traffic_analyzer_init: Debug class number of"
+ "'smb_traffic_analyzer': %d\n", \
+ vfs_smb_traffic_analyzer_debug_level));
+ }
+
+ return ret;
+}
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 7b5e510747..8320a5820a 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -48,7 +48,7 @@ static NTSTATUS xattr_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
blob = data_blob_const(data->dptr, data->dsize);
ndr_err = ndr_pull_struct_blob(
- &blob, result, result,
+ &blob, result, NULL, result,
(ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -74,7 +74,7 @@ static NTSTATUS xattr_tdb_push_attrs(TALLOC_CTX *mem_ctx,
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_blob(
- &blob, mem_ctx, attribs,
+ &blob, mem_ctx, NULL, attribs,
(ndr_push_flags_fn_t)ndr_push_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -177,25 +177,25 @@ static ssize_t xattr_tdb_getattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
break;
}
}
- if (i == attribs->num_xattrs) {
+ if (i == attribs->num_eas) {
errno = ENOATTR;
goto fail;
}
- if (attribs->xattrs[i].value.length > size) {
+ if (attribs->eas[i].value.length > size) {
errno = ERANGE;
goto fail;
}
- memcpy(value, attribs->xattrs[i].value.data,
- attribs->xattrs[i].value.length);
- result = attribs->xattrs[i].value.length;
+ memcpy(value, attribs->eas[i].value.data,
+ attribs->eas[i].value.length);
+ result = attribs->eas[i].value.length;
fail:
TALLOC_FREE(attribs);
@@ -273,8 +273,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
if (flags & XATTR_CREATE) {
TALLOC_FREE(rec);
errno = EEXIST;
@@ -284,8 +284,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
}
}
- if (i == attribs->num_xattrs) {
- struct tdb_xattr *tmp;
+ if (i == attribs->num_eas) {
+ struct xattr_EA *tmp;
if (flags & XATTR_REPLACE) {
TALLOC_FREE(rec);
@@ -294,8 +294,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
}
tmp = TALLOC_REALLOC_ARRAY(
- attribs, attribs->xattrs, struct tdb_xattr,
- attribs->num_xattrs + 1);
+ attribs, attribs->eas, struct xattr_EA,
+ attribs->num_eas+ 1);
if (tmp == NULL) {
DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n"));
@@ -304,13 +304,13 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1;
}
- attribs->xattrs = tmp;
- attribs->num_xattrs += 1;
+ attribs->eas = tmp;
+ attribs->num_eas += 1;
}
- attribs->xattrs[i].name = name;
- attribs->xattrs[i].value.data = CONST_DISCARD(uint8 *, value);
- attribs->xattrs[i].value.length = size;
+ attribs->eas[i].name = name;
+ attribs->eas[i].value.data = CONST_DISCARD(uint8 *, value);
+ attribs->eas[i].value.length = size;
status = xattr_tdb_save_attrs(rec, attribs);
@@ -386,15 +386,15 @@ static ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
}
DEBUG(10, ("xattr_tdb_listattr: Found %d xattrs\n",
- attribs->num_xattrs));
+ attribs->num_eas));
- for (i=0; i<attribs->num_xattrs; i++) {
+ for (i=0; i<attribs->num_eas; i++) {
size_t tmp;
DEBUG(10, ("xattr_tdb_listattr: xattrs[i].name: %s\n",
- attribs->xattrs[i].name));
+ attribs->eas[i].name));
- tmp = strlen(attribs->xattrs[i].name);
+ tmp = strlen(attribs->eas[i].name);
/*
* Try to protect against overflow
@@ -420,10 +420,10 @@ static ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
len = 0;
- for (i=0; i<attribs->num_xattrs; i++) {
- strlcpy(list+len, attribs->xattrs[i].name,
+ for (i=0; i<attribs->num_eas; i++) {
+ strlcpy(list+len, attribs->eas[i].name,
size-len);
- len += (strlen(attribs->xattrs[i].name) + 1);
+ len += (strlen(attribs->eas[i].name) + 1);
}
TALLOC_FREE(attribs);
@@ -496,23 +496,23 @@ static int xattr_tdb_removeattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
break;
}
}
- if (i == attribs->num_xattrs) {
+ if (i == attribs->num_eas) {
TALLOC_FREE(rec);
errno = ENOATTR;
return -1;
}
- attribs->xattrs[i] =
- attribs->xattrs[attribs->num_xattrs-1];
- attribs->num_xattrs -= 1;
+ attribs->eas[i] =
+ attribs->eas[attribs->num_eas-1];
+ attribs->num_eas -= 1;
- if (attribs->num_xattrs == 0) {
+ if (attribs->num_eas == 0) {
rec->delete_rec(rec);
TALLOC_FREE(rec);
return 0;
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index e933e47317..3688b2386e 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -166,7 +166,7 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
*/
static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- struct security_descriptor *psd)
+ const struct security_descriptor *psd)
{
return smb_set_nt_acl_nfs4(fsp, security_info_sent, psd,
zfs_process_smbacl);
@@ -207,7 +207,7 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
return zfs_set_nt_acl(handle, fsp, security_info_sent, psd);
}