return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
}
-static int skel_setxattr(vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags)
+static int skel_setxattr(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
errno = ENOSYS;
return -1;
return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
}
-static int skel_setxattr(vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags)
+static int skel_setxattr(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
- return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
+ return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+ name, value, size, flags);
}
static int skel_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp,
to const struct smb_filename * */
/* Version 37 - Change removexattr from const char *
to const struct smb_filename * */
+/* Version 37 - Change setxattr from const char *
+ to const struct smb_filename * */
+
#define SMB_VFS_INTERFACE_VERSION 37
const struct smb_filename *smb_fname,
const char *name);
int (*fremovexattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
- int (*setxattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
+ int (*setxattr_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags);
int (*fsetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
/* aio operations */
const char *name);
int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
struct files_struct *fsp, const char *name);
-int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags);
+int smb_vfs_call_setxattr(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags);
int smb_vfs_call_lsetxattr(struct vfs_handle_struct *handle, const char *path,
const char *name, const void *value, size_t size,
int flags);
#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) \
smb_vfs_call_fremovexattr((handle)->next,(fsp),(name))
-#define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) \
- smb_vfs_call_setxattr((conn)->vfs_handles,(path),(name),(value),(size),(flags))
-#define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) \
- smb_vfs_call_setxattr((handle)->next,(path),(name),(value),(size),(flags))
+#define SMB_VFS_SETXATTR(conn,smb_fname,name,value,size,flags) \
+ smb_vfs_call_setxattr((conn)->vfs_handles,(smb_fname),(name),(value),(size),(flags))
+#define SMB_VFS_NEXT_SETXATTR(handle,smb_fname,name,value,size,flags) \
+ smb_vfs_call_setxattr((handle)->next,(smb_fname),(name),(value),(size),(flags))
#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) \
smb_vfs_call_fsetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size),(flags))
return -1;
}
- return SMB_VFS_SETXATTR(handle->conn, smb_fname->base_name,
+ return SMB_VFS_SETXATTR(handle->conn, smb_fname,
name, buf, size, 0);
}
ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
pblob->data, pblob->length, 0);
} else {
- ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name->base_name,
+ ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name,
XATTR_NTACL_NAME,
pblob->data, pblob->length, 0);
}
return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath);
}
-static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
+static int cap_setxattr(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
- char *cappath = capencode(talloc_tos(), path);
+ struct smb_filename *cap_smb_fname = NULL;
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
char *capname = capencode(talloc_tos(), name);
+ int ret;
+ int saved_errno = 0;
if (!cappath || !capname) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_SETXATTR(handle, cappath, capname, value, size, flags);
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ cappath,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(capname);
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SETXATTR(handle, cap_smb_fname,
+ capname, value, size, flags);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(capname);
+ TALLOC_FREE(cap_smb_fname);
+ if (saved_errno) {
+ errno = saved_errno;
+ }
+ return ret;
}
static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags)
}
static int
-catia_setxattr(vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags)
+catia_setxattr(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
+ struct smb_filename *mapped_smb_fname = NULL;
char *mapped_name = NULL;
char *mapped_ea_name = NULL;
NTSTATUS status;
ssize_t ret;
+ int saved_errno = 0;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, vfs_translate_to_unix);
+ smb_fname->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
return -1;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, mapped_name, mapped_ea_name,
+ mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+ mapped_name,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (mapped_smb_fname == NULL) {
+ TALLOC_FREE(mapped_name);
+ TALLOC_FREE(mapped_ea_name);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_SETXATTR(handle, mapped_smb_fname, mapped_ea_name,
value, size, flags);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
TALLOC_FREE(mapped_name);
TALLOC_FREE(mapped_ea_name);
+ TALLOC_FREE(mapped_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return ret;
}
WRAP_RETURN(ret);
}
-static int cephwrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
+static int cephwrap_setxattr(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
int ret;
- DBG_DEBUG("[CEPH] setxattr(%p, %s, %s, %p, %llu, %d)\n", handle, path, name, value, llu(size), flags);
- ret = ceph_setxattr(handle->data, path, name, value, size, flags);
+ DBG_DEBUG("[CEPH] setxattr(%p, %s, %s, %p, %llu, %d)\n", handle,
+ smb_fname->base_name, name, value, llu(size), flags);
+ ret = ceph_setxattr(handle->data, smb_fname->base_name,
+ name, value, size, flags);
DBG_DEBUG("[CEPH] setxattr(...) = %d\n", ret);
WRAP_RETURN(ret);
}
return fremovexattr(fsp->fh->fd, name);
}
-static int vfswrap_setxattr(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
+static int vfswrap_setxattr(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
- return setxattr(path, name, value, size, flags);
+ return setxattr(smb_fname->base_name, name, value, size, flags);
}
static int vfswrap_fsetxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags)
name = FAKE_ACL_DEFAULT_XATTR;
break;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname->base_name,
+ ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
name, blob.data, blob.length, 0);
TALLOC_FREE(frame);
return ret;
if (uid != -1) {
SIVAL(id_buf, 0, uid);
ret = SMB_VFS_NEXT_SETXATTR(handle,
- smb_fname->base_name,
+ smb_fname,
FAKE_UID,
id_buf,
sizeof(id_buf),
if (gid != -1) {
SIVAL(id_buf, 0, gid);
ret = SMB_VFS_NEXT_SETXATTR(handle,
- smb_fname->base_name,
+ smb_fname,
FAKE_GID,
id_buf,
sizeof(id_buf),
*/
SIVAL(id_buf, 0, uid);
ret = SMB_VFS_NEXT_SETXATTR(handle,
- smb_fname->base_name,
+ smb_fname,
FAKE_UID,
id_buf,
sizeof(id_buf),
if (gid != -1) {
SIVAL(id_buf, 0, gid);
ret = SMB_VFS_NEXT_SETXATTR(handle,
- smb_fname->base_name,
+ smb_fname,
FAKE_GID,
id_buf,
sizeof(id_buf),
}
ret = SMB_VFS_SETXATTR(ad->ad_handle->conn,
- smb_fname->base_name,
+ smb_fname,
AFPINFO_EA_NETATALK,
ad->ad_data,
AD_DATASZ_XATTR, 0);
}
static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name, const void *value, size_t size,
int flags)
{
int result;
- result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
+ result = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value, size,
flags);
do_log(SMB_VFS_OP_SETXATTR, (result >= 0), handle,
- "%s|%s", path, name);
+ "%s|%s", smb_fname->base_name, name);
return result;
}
}
static int vfs_gluster_setxattr(struct vfs_handle_struct *handle,
- const char *path, const char *name,
+ const struct smb_filename *smb_fname,
+ const char *name,
const void *value, size_t size, int flags)
{
- return glfs_setxattr(handle->data, path, name, value, size, flags);
+ return glfs_setxattr(handle->data, smb_fname->base_name, name, value, size, flags);
}
static int vfs_gluster_fsetxattr(struct vfs_handle_struct *handle,
* In this case, "name" is an attr name.
*/
static int mh_setxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name,
const void *value,
size_t size,
int flags)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_setxattr\n"));
- if (!is_in_media_files(path))
- {
- status = SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value,
size, flags);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- path,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
-
- status = SMB_VFS_NEXT_SETXATTR(handle, clientPath, name, value,
+ status = SMB_VFS_NEXT_SETXATTR(handle, clientFname, name, value,
size, flags);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
}
static bool nfs4acl_xattr_set_smb4acl(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
struct SMB4ACL_T *smbacl)
{
TALLOC_CTX *frame = talloc_stackframe();
errno = EINVAL;
return false;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, path, NFS4ACL_XATTR_NAME,
+ ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, NFS4ACL_XATTR_NAME,
blob.data, blob.length, 0);
if (ret != 0) {
DEBUG(0, ("can't store acl in xattr: %s\n", strerror(errno)));
/* store the returned ACL to get it directly in the
future and avoid dynamic inheritance behavior. */
- nfs4acl_xattr_set_smb4acl(handle, path, pchildacl);
+ nfs4acl_xattr_set_smb4acl(handle, smb_fname, pchildacl);
TALLOC_FREE(frame);
return pchildacl;
}
static int posix_eadb_setxattr(struct vfs_handle_struct *handle,
- const char *path, const char *name,
- const void *value, size_t size, int flags)
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
struct tdb_wrap *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
- return posix_eadb_setattr(db, path, -1, name, value, size, flags);
+ return posix_eadb_setattr(db, smb_fname->base_name,
+ -1, name, value, size, flags);
}
static int posix_eadb_fsetxattr(struct vfs_handle_struct *handle,
}
static int shadow_copy2_setxattr(struct vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *aname, const void *value,
size_t size, int flags)
{
ssize_t ret;
int saved_errno = 0;
char *conv;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
- ×tamp, &stripped)) {
+ if (!shadow_copy2_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ ×tamp,
+ &stripped)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_SETXATTR(handle, fname, aname, value, size,
- flags);
+ return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+ aname, value, size, flags);
}
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, conv, aname, value, size, flags);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SETXATTR(handle, conv_smb_fname,
+ aname, value, size, flags);
if (ret == -1) {
saved_errno = errno;
}
+ TALLOC_FREE(conv_smb_fname);
TALLOC_FREE(conv);
if (saved_errno != 0) {
errno = saved_errno;
}
static int snapper_gmt_setxattr(struct vfs_handle_struct *handle,
- const char *fname,
+ const struct smb_filename *smb_fname,
const char *aname, const void *value,
size_t size, int flags)
{
- time_t timestamp;
- char *stripped;
+ time_t timestamp = 0;
+ char *stripped = NULL;
ssize_t ret;
- int saved_errno;
- char *conv;
+ int saved_errno = 0;
+ char *conv = NULL;
+ struct smb_filename *conv_smb_fname = NULL;
- if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
- ×tamp, &stripped)) {
+ if (!snapper_gmt_strip_snapshot(talloc_tos(),
+ handle,
+ smb_fname->base_name,
+ ×tamp,
+ &stripped)) {
return -1;
}
if (timestamp == 0) {
- return SMB_VFS_NEXT_SETXATTR(handle, fname, aname, value, size,
- flags);
+ return SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+ aname, value, size, flags);
}
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, conv, aname, value, size, flags);
- saved_errno = errno;
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL,
+ smb_fname->flags);
TALLOC_FREE(conv);
- errno = saved_errno;
+ if (conv_smb_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SETXATTR(handle, conv_smb_fname,
+ aname, value, size, flags);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(conv_smb_fname);
+ TALLOC_FREE(conv);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return ret;
}
return true;
}
-static bool mark_file_valid(vfs_handle_struct *handle, const char *path)
+static bool mark_file_valid(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
char buf = '1';
int ret;
- DEBUG(10, ("marking file %s as valid\n", path));
+ DEBUG(10, ("marking file %s as valid\n", smb_fname->base_name));
- ret = SMB_VFS_SETXATTR(handle->conn, path, SAMBA_XATTR_MARKER,
+ ret = SMB_VFS_SETXATTR(handle->conn, smb_fname, SAMBA_XATTR_MARKER,
&buf, sizeof(buf), 0);
if (ret == -1) {
goto fail;
}
- if (check_valid && !mark_file_valid(handle, smb_fname->base_name)) {
+ if (check_valid && !mark_file_valid(handle, smb_fname)) {
goto fail;
}
}
/* (over)write the new stream */
- nret = SMB_VFS_SETXATTR(handle->conn, smb_fname_src->base_name,
+ nret = SMB_VFS_SETXATTR(handle->conn, smb_fname_src,
dst_xattr_name, ea.value.data, ea.value.length,
0);
if (nret < 0) {
ea.value.data, ea.value.length, 0);
} else {
ret = SMB_VFS_SETXATTR(fsp->conn,
- fsp->fsp_name->base_name,
+ fsp->fsp_name,
sio->xattr_name,
ea.value.data, ea.value.length, 0);
}
ea.value.data, ea.value.length, 0);
} else {
ret = SMB_VFS_SETXATTR(fsp->conn,
- fsp->fsp_name->base_name,
+ fsp->fsp_name,
sio->xattr_name,
ea.value.data, ea.value.length, 0);
}
}
static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
- const char *path, const char *name,
- const void *value, size_t size,
- int flags)
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
+ result = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value, size,
flags);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("setxattr", timediff, path);
+ smb_time_audit_log_fname("setxattr", timediff,
+ smb_fname->base_name);
}
return result;
}
static int um_setxattr(struct vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
const char *name,
const void *value,
size_t size,
int flags)
{
int status;
- char *client_path = NULL;
+ struct smb_filename *client_fname = NULL;
DEBUG(10, ("Entering um_setxattr\n"));
- if (!is_in_media_files(path)) {
- return SMB_VFS_NEXT_SETXATTR(handle, path, name, value,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ return SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value,
size, flags);
}
- status = alloc_get_client_path(handle, talloc_tos(),
- path, &client_path);
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &client_fname);
if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_SETXATTR(handle, client_path, name, value,
+ status = SMB_VFS_NEXT_SETXATTR(handle, client_fname, name, value,
size, flags);
err:
- TALLOC_FREE(client_path);
+ TALLOC_FREE(client_fname);
return status;
}
acltype, theacl);
}
-static int vxfs_set_xattr(struct vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags){
- struct smb_filename *smb_fname;
+static int vxfs_set_xattr(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname_in,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
+{
+ struct smb_filename *smb_fname = NULL;
bool is_dir = false;
int ret = 0;
+ int saved_errno = 0;
DEBUG(10, ("In vxfs_set_xattr\n"));
- smb_fname = synthetic_smb_fname(talloc_tos(), path, NULL, NULL, 0);
+ smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in);
if (smb_fname == NULL) {
errno = ENOMEM;
return -1;
is_dir = S_ISDIR(smb_fname->st.st_ex_mode);
- ret = vxfs_setxattr_path(path, name, value, size, flags,
- is_dir);
+ ret = vxfs_setxattr_path(smb_fname_in->base_name, name, value, size,
+ flags, is_dir);
if ((ret == 0) ||
((ret == -1) && (errno != ENOTSUP) && (errno != ENOSYS))) {
/*
* Now remve old style xattr if it exists
*/
SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
- TALLOC_FREE(smb_fname);
/*
* Do not bother about return value
*/
-
- return ret;
+ if (ret != 0) {
+ saved_errno = errno;
+ }
+ goto fail;
}
- TALLOC_FREE(smb_fname);
-
DEBUG(10, ("Fallback to xattr\n"));
if (strcmp(name, XATTR_NTACL_NAME) == 0) {
- return SMB_VFS_NEXT_SETXATTR(handle, path, XATTR_USER_NTACL,
- value, size, flags);
+ ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+ XATTR_USER_NTACL,
+ value, size, flags);
+ if (ret != 0) {
+ saved_errno = errno;
+ goto fail;
+ }
+ return 0;
}
/* Clients can't set XATTR_USER_NTACL directly. */
if (strcasecmp(name, XATTR_USER_NTACL) == 0) {
- errno = EACCES;
- return -1;
+ saved_errno = EACCES;
+ ret = -1;
+ goto fail;
}
- return SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size, flags);
+ ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname,
+ name, value, size, flags);
+ if (ret != 0) {
+ saved_errno = errno;
+ goto fail;
+ }
+
+fail:
+ TALLOC_FREE(smb_fname);
+ if (saved_errno != 0) {
+ saved_errno = errno;
+ }
+ return ret;
}
static int vxfs_fset_xattr(struct vfs_handle_struct *handle,
}
static int xattr_tdb_setxattr(struct vfs_handle_struct *handle,
- const char *path, const char *name,
- const void *value, size_t size, int flags)
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
struct file_id id;
struct db_context *db;
TALLOC_FREE(frame); return -1;
});
- ret = xattr_tdb_get_file_id(handle, path, &id);
+ ret = xattr_tdb_get_file_id(handle, smb_fname->base_name, &id);
if (ret == -1) {
TALLOC_FREE(frame);
return -1;
return NT_STATUS_INVALID_PARAMETER;
}
- if (SMB_VFS_SETXATTR(conn, smb_fname->base_name,
+ if (SMB_VFS_SETXATTR(conn, smb_fname,
SAMBA_XATTR_DOS_ATTRIB, blob.data, blob.length,
0) == -1) {
NTSTATUS status = NT_STATUS_OK;
ret = SMB_VFS_FSETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
pai_buf, store_size, 0);
} else {
- ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name->base_name,
+ ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name,
SAMBA_POSIX_INHERITANCE_EA_NAME,
pai_buf, store_size, 0);
}
DEBUG(10,("set_ea: setting ea name %s on file %s.\n",
unix_ea_name, smb_fname->base_name));
ret = SMB_VFS_SETXATTR(conn,
- smb_fname->base_name,
+ smb_fname,
unix_ea_name,
ea_list->ea.value.data,
ea_list->ea.value.length,
return handle->fns->fremovexattr_fn(handle, fsp, name);
}
-int smb_vfs_call_setxattr(struct vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags)
+int smb_vfs_call_setxattr(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
VFS_FIND(setxattr);
- return handle->fns->setxattr_fn(handle, path, name, value, size, flags);
+ return handle->fns->setxattr_fn(handle, smb_fname,
+ name, value, size, flags);
}
int smb_vfs_call_fsetxattr(struct vfs_handle_struct *handle,
{
ssize_t ret;
int flags = 0;
+ struct smb_filename *smb_fname = NULL;
if ((argc < 4) || (argc > 5)) {
printf("Usage: setxattr <path> <xattr> <value> [flags]\n");
flags = atoi(argv[4]);
}
- ret = SMB_VFS_SETXATTR(vfs->conn, argv[1], argv[2],
+ smb_fname = synthetic_smb_fname_split(mem_ctx,
+ argv[1],
+ lp_posix_pathnames());
+ if (smb_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ ret = SMB_VFS_SETXATTR(vfs->conn, smb_fname, argv[2],
argv[3], strlen(argv[3]), flags);
if (ret == -1) {
int err = errno;