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;
}