Preparing to reduce use of lp_posix_pathnames().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
return -1;
}
-static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int skel_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
errno = ENOSYS;
return -1;
return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
}
-static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int skel_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
- return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp,
/* Version 35 - Change opendir from const char *, to
const struct smb_filename * */
/* Version 35 - Wrap aio async funtions args in a struct vfs_aio_state */
+/* Version 35 - Change chmod from const char *, to
+ const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 35
uint64_t (*get_alloc_size_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
int (*unlink_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
- int (*chmod_fn)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
+ int (*chmod_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode);
int (*fchmod_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
int (*chown_fn)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
int (*fchown_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
const SMB_STRUCT_STAT *sbuf);
int smb_vfs_call_unlink(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
-int smb_vfs_call_chmod(struct vfs_handle_struct *handle, const char *path,
- mode_t mode);
+int smb_vfs_call_chmod(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode);
int smb_vfs_call_fchmod(struct vfs_handle_struct *handle,
struct files_struct *fsp, mode_t mode);
int smb_vfs_call_chown(struct vfs_handle_struct *handle, const char *path,
#define SMB_VFS_NEXT_UNLINK(handle, path) \
smb_vfs_call_unlink((handle)->next, (path))
-#define SMB_VFS_CHMOD(conn, path, mode) \
- smb_vfs_call_chmod((conn)->vfs_handles, (path), (mode))
-#define SMB_VFS_NEXT_CHMOD(handle, path, mode) \
- smb_vfs_call_chmod((handle)->next, (path), (mode))
+#define SMB_VFS_CHMOD(conn, smb_fname, mode) \
+ smb_vfs_call_chmod((conn)->vfs_handles, (smb_fname), (mode))
+#define SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode) \
+ smb_vfs_call_chmod((handle)->next, (smb_fname), (mode))
#define SMB_VFS_FCHMOD(fsp, mode) \
smb_vfs_call_fchmod((fsp)->conn->vfs_handles, (fsp), (mode))
}
static int chmod_acl_module_common(struct vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
if (lp_posix_pathnames()) {
/* Only allow this on POSIX pathnames. */
- return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
return 0;
}
return result;
}
-static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int audit_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n",
- path, mode,
+ smb_fname->base_name, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
return ret;
}
-static int cap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int cap_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
- char *cappath = capencode(talloc_tos(), path);
+ struct smb_filename *cap_smb_fname = NULL;
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+ int ret;
+ int saved_errno;
if (!cappath) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_CHMOD(handle, cappath, mode);
+
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ cappath,
+ NULL,
+ NULL);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(cappath);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_CHMOD(handle, cap_smb_fname, mode);
+ saved_errno = errno;
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(cap_smb_fname);
+ errno = saved_errno;
+ return ret;
}
static int cap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
return ret;
}
-static int catia_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int catia_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
char *name = NULL;
NTSTATUS status;
int ret;
+ int saved_errno;
+ struct smb_filename *catia_smb_fname = NULL;
- status = catia_string_replace_allocate(handle->conn, path,
- &name, vfs_translate_to_unix);
+ status = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
}
+ catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+ name,
+ NULL,
+ NULL);
+ if (catia_smb_fname == NULL) {
+ TALLOC_FREE(name);
+ errno = ENOMEM;
+ return -1;
+ }
- ret = SMB_VFS_NEXT_CHMOD(handle, name, mode);
+ ret = SMB_VFS_NEXT_CHMOD(handle, catia_smb_fname, mode);
+ saved_errno = errno;
TALLOC_FREE(name);
-
+ TALLOC_FREE(catia_smb_fname);
+ errno = saved_errno;
return ret;
}
WRAP_RETURN(result);
}
-static int cephwrap_chmod(struct vfs_handle_struct *handle, const char *path, mode_t mode)
+static int cephwrap_chmod(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- DEBUG(10, ("[CEPH] chmod(%p, %s, %d)\n", handle, path, mode));
+ DEBUG(10, ("[CEPH] chmod(%p, %s, %d)\n",
+ handle,
+ smb_fname->base_name,
+ mode));
/*
* We need to do this due to the fact that the default POSIX ACL
{
int saved_errno = errno; /* We might get ENOSYS */
- if ((result = SMB_VFS_CHMOD_ACL(handle->conn, path, mode)) == 0) {
+ result = SMB_VFS_CHMOD_ACL(handle->conn,
+ smb_fname->base_name,
+ mode);
+ if (result == 0) {
return result;
}
/* Error - return the old errno. */
errno = saved_errno;
}
- result = ceph_chmod(handle->data, path, mode);
+ result = ceph_chmod(handle->data, smb_fname->base_name, mode);
DEBUG(10, ("[CEPH] chmod(...) = %d\n", result));
WRAP_RETURN(result);
}
return result;
}
-static int vfswrap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int vfswrap_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
{
int saved_errno = errno; /* We might get ENOSYS */
- if ((result = SMB_VFS_CHMOD_ACL(handle->conn, path, mode)) == 0) {
+ result = SMB_VFS_CHMOD_ACL(handle->conn,
+ smb_fname->base_name,
+ mode);
+ if (result == 0) {
END_PROFILE(syscall_chmod);
return result;
}
errno = saved_errno;
}
- result = chmod(path, mode);
+ result = chmod(smb_fname->base_name, mode);
END_PROFILE(syscall_chmod);
return result;
}
return result;
}
-static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int audit_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n",
- path, mode,
+ smb_fname->base_name, mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : "");
}
DEBUG(1, ("vfs_extd_audit: chmod %s mode 0x%x %s %s\n",
- path, (unsigned int)mode,
+ smb_fname->base_name, (unsigned int)mode,
(result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""));
}
static int fruit_chmod(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
mode_t mode)
{
int rc = -1;
char *adp = NULL;
struct fruit_config_data *config = NULL;
SMB_STRUCT_STAT sb;
+ const char *path = smb_fname->base_name;
+ struct smb_filename *smb_fname_adp = NULL;
- rc = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ rc = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
if (rc != 0) {
return rc;
}
DEBUG(10, ("fruit_chmod: %s\n", adp));
- rc = SMB_VFS_NEXT_CHMOD(handle, adp, mode);
+ smb_fname_adp = synthetic_smb_fname(talloc_tos(),
+ adp,
+ NULL,
+ NULL);
+ if (smb_fname_adp == NULL) {
+ TALLOC_FREE(adp);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ rc = SMB_VFS_NEXT_CHMOD(handle, smb_fname_adp, mode);
if (errno == ENOENT) {
rc = 0;
}
+ TALLOC_FREE(smb_fname_adp);
TALLOC_FREE(adp);
return rc;
}
result = SMB_VFS_FCHMOD(fsp, ms_nfs_mode);
} else {
result = SMB_VFS_CHMOD(fsp->conn,
- fsp->fsp_name->base_name,
+ fsp->fsp_name,
ms_nfs_mode);
}
}
static int smb_full_audit_chmod(vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
- do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o", path, mode);
+ do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o",
+ smb_fname->base_name,
+ mode);
return result;
}
}
static int vfs_gluster_chmod(struct vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
- return glfs_chmod(handle->data, path, mode);
+ return glfs_chmod(handle->data, smb_fname->base_name, mode);
}
static int vfs_gluster_fchmod(struct vfs_handle_struct *handle,
return 0; /* ok for [f]chmod */
}
-static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int vfs_gpfs_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
struct smb_filename *smb_fname_cpath;
int rc;
- smb_fname_cpath = synthetic_smb_fname(talloc_tos(), path, NULL, NULL);
+ smb_fname_cpath = cp_smb_fname(talloc_tos(), smb_fname);
if (smb_fname_cpath == NULL) {
errno = ENOMEM;
return -1;
}
if (SMB_VFS_NEXT_STAT(handle, smb_fname_cpath) != 0) {
+ TALLOC_FREE(smb_fname_cpath);
return -1;
}
/* avoid chmod() if possible, to preserve acls */
if ((smb_fname_cpath->st.st_ex_mode & ~S_IFMT) == mode) {
+ TALLOC_FREE(smb_fname_cpath);
return 0;
}
- rc = gpfsacl_emu_chmod(handle, path, mode);
+ rc = gpfsacl_emu_chmod(handle, smb_fname->base_name, mode);
if (rc == 1)
- return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
+
+ TALLOC_FREE(smb_fname_cpath);
return rc;
}
*/
become_root();
res = SMB_VFS_NEXT_CHMOD(handle,
- smb_fname->base_name,
+ smb_fname,
fname.st.st_ex_mode);
unbecome_root();
* Failure: set errno, return -1
*/
static int mh_chmod(vfs_handle_struct *handle,
- const char *path,
+ const struct smb_filename *smb_fname,
mode_t mode)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_chmod\n"));
- if (!is_in_media_files(path))
+ if (!is_in_media_files(smb_fname->base_name))
{
- status = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ status = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
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_CHMOD(handle, clientPath, mode);
+ status = SMB_VFS_NEXT_CHMOD(handle, clientFname, mode);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
return ret;
}
-static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_t mode)
+static int atalk_chmod(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int ret = 0;
+ int ret1 = 0;
char *adbl_path = 0;
char *orig_path = 0;
SMB_STRUCT_STAT adbl_info;
SMB_STRUCT_STAT orig_info;
TALLOC_CTX *ctx;
- ret = SMB_VFS_NEXT_CHMOD(handle, path, mode);
-
- if (!path) return ret;
+ ret = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
if (!(ctx = talloc_init("chmod_file")))
return ret;
- if (atalk_build_paths(ctx, handle->conn->cwd, path, &adbl_path,
- &orig_path, &adbl_info, &orig_info) != 0)
+ ret1 = atalk_build_paths(ctx,
+ handle->conn->cwd,
+ smb_fname->base_name,
+ &adbl_path,
+ &orig_path,
+ &adbl_info,
+ &orig_info);
+ if (ret1 != 0) {
goto exit_chmod;
+ }
if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {
DEBUG(3, ("ATALK: %s has passed..\n", orig_path));
return ret;
}
-static int shadow_copy2_chmod(vfs_handle_struct *handle, const char *fname,
- mode_t mode)
+static int shadow_copy2_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
time_t timestamp;
- char *stripped;
+ char *stripped = NULL;
int ret, saved_errno;
- char *conv;
+ char *conv = NULL;
+ struct smb_filename *conv_smb_fname;
- 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_CHMOD(handle, fname, mode);
+ TALLOC_FREE(stripped);
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_CHMOD(handle, conv, mode);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_CHMOD(handle, conv_smb_fname, mode);
saved_errno = errno;
TALLOC_FREE(conv);
+ TALLOC_FREE(conv_smb_fname);
errno = saved_errno;
return ret;
}
return ret;
}
-static int snapper_gmt_chmod(vfs_handle_struct *handle, const char *fname,
- mode_t mode)
+static int snapper_gmt_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
time_t timestamp;
- char *stripped;
+ char *stripped = NULL;
int ret, saved_errno;
- char *conv;
+ 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_CHMOD(handle, fname, mode);
+ TALLOC_FREE(stripped);
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
TALLOC_FREE(stripped);
if (conv == NULL) {
return -1;
}
- ret = SMB_VFS_NEXT_CHMOD(handle, conv, mode);
+ conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+ conv,
+ NULL,
+ NULL);
+ if (conv_smb_fname == NULL) {
+ TALLOC_FREE(conv);
+ errno = ENOMEM;
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_CHMOD(handle, conv_smb_fname, mode);
saved_errno = errno;
TALLOC_FREE(conv);
+ TALLOC_FREE(conv_smb_fname);
errno = saved_errno;
return ret;
}
}
static int smb_time_audit_chmod(vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("chmod", timediff, path);
+ smb_time_audit_log_fname("chmod",
+ timediff,
+ smb_fname->base_name);
}
return result;
}
static int um_chmod(vfs_handle_struct *handle,
- const char *path,
- mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int status;
- char *client_path = NULL;
+ struct smb_filename *client_fname = NULL;
DEBUG(10, ("Entering um_chmod\n"));
- if (!is_in_media_files(path)) {
- return SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ if (!is_in_media_files(smb_fname->base_name)) {
+ return SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
}
- 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_CHMOD(handle, client_path, mode);
+ status = SMB_VFS_NEXT_CHMOD(handle, client_fname, mode);
err:
- TALLOC_FREE(client_path);
+ TALLOC_FREE(client_fname);
return status;
}
return -1;
}
- ret = SMB_VFS_CHMOD(conn, smb_fname->base_name, unixmode);
+ ret = SMB_VFS_CHMOD(conn, smb_fname, unixmode);
if (ret == 0) {
if(!newfile || (lret != -1)) {
notify_fname(conn, NOTIFY_ACTION_MODIFIED,
*/
if ((mode & ~(S_IRWXU|S_IRWXG|S_IRWXO)) &&
(mode & ~smb_dname->st.st_ex_mode)) {
- SMB_VFS_CHMOD(conn, smb_dname->base_name,
+ SMB_VFS_CHMOD(conn, smb_dname,
(smb_dname->st.st_ex_mode |
(mode & ~smb_dname->st.st_ex_mode)));
need_re_stat = true;
if (set_acl_as_root) {
become_root();
}
- sret = SMB_VFS_CHMOD(conn, fsp->fsp_name->base_name,
+ sret = SMB_VFS_CHMOD(conn, fsp->fsp_name,
posix_perms);
if (set_acl_as_root) {
unbecome_root();
become_root();
sret = SMB_VFS_CHMOD(conn,
- fsp->fsp_name->base_name,
+ fsp->fsp_name,
posix_perms);
unbecome_root();
}
if (fsp && fsp->fh->fd != -1) {
ret = SMB_VFS_FCHMOD(fsp, unixmode);
} else {
- ret = SMB_VFS_CHMOD(conn, smb_fname->base_name, unixmode);
+ ret = SMB_VFS_CHMOD(conn, smb_fname, unixmode);
}
if (ret != 0) {
return map_nt_error_from_unix(errno);
return handle->fns->unlink_fn(handle, smb_fname);
}
-int smb_vfs_call_chmod(struct vfs_handle_struct *handle, const char *path,
- mode_t mode)
+int smb_vfs_call_chmod(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
VFS_FIND(chmod);
- return handle->fns->chmod_fn(handle, path, mode);
+ return handle->fns->chmod_fn(handle, smb_fname, mode);
}
int smb_vfs_call_fchmod(struct vfs_handle_struct *handle,
static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
+ struct smb_filename *smb_fname = NULL;
mode_t mode;
if (argc != 3) {
printf("Usage: chmod <path> <mode>\n");
}
mode = atoi(argv[2]);
- if (SMB_VFS_CHMOD(vfs->conn, argv[1], mode) == -1) {
+
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ argv[1],
+ NULL,
+ NULL);
+ if (smb_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (SMB_VFS_CHMOD(vfs->conn, smb_fname, mode) == -1) {
printf("chmod: error=%d (%s)\n", errno, strerror(errno));
return NT_STATUS_UNSUCCESSFUL;
}