2 Unix SMB/CIFS implementation.
5 Copyright (C) Simo Sorce 2002
6 Copyright (C) Eric Lorimer 2002
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "smbd/smbd.h"
24 #include "system/passwd.h"
25 #include "system/filesys.h"
27 #include "../lib/util/util_pw.h"
28 #include "libcli/security/security.h"
29 #include "passdb/machine_sid.h"
31 static const char *null_string
= "";
33 static uint32_t ssf_flags(void)
35 return lp_posix_pathnames() ? SMB_FILENAME_POSIX_PATH
: 0;
38 static NTSTATUS
cmd_load_module(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
43 printf("Usage: load <modules>\n");
47 for (i
=argc
-1;i
>0;i
--) {
48 if (!vfs_init_custom(vfs
->conn
, argv
[i
])) {
49 DEBUG(0, ("load: (vfs_init_custom failed for %s)\n", argv
[i
]));
50 return NT_STATUS_UNSUCCESSFUL
;
57 static NTSTATUS
cmd_populate(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
62 printf("Usage: populate <char> <size>\n");
67 vfs
->data
= talloc_array(mem_ctx
, char, size
);
68 if (vfs
->data
== NULL
) {
69 printf("populate: error=-1 (not enough memory)");
70 return NT_STATUS_UNSUCCESSFUL
;
72 memset(vfs
->data
, c
, size
);
73 vfs
->data_size
= size
;
77 static NTSTATUS
cmd_show_data(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
81 if (argc
!= 1 && argc
!= 3) {
82 printf("Usage: showdata [<offset> <len>]\n");
85 if (vfs
->data
== NULL
|| vfs
->data_size
== 0) {
86 printf("show_data: error=-1 (buffer empty)\n");
87 return NT_STATUS_UNSUCCESSFUL
;
91 offset
= atoi(argv
[1]);
97 if ((offset
+ len
) > vfs
->data_size
) {
98 printf("show_data: error=-1 (not enough data in buffer)\n");
99 return NT_STATUS_UNSUCCESSFUL
;
101 dump_data(0, (uint8_t *)(vfs
->data
) + offset
, len
);
105 static NTSTATUS
cmd_connect(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
107 const struct loadparm_substitution
*lp_sub
=
108 loadparm_s3_global_substitution();
110 SMB_VFS_CONNECT(vfs
->conn
, lp_servicename(talloc_tos(), lp_sub
, SNUM(vfs
->conn
)), "vfstest");
114 static NTSTATUS
cmd_disconnect(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
116 SMB_VFS_DISCONNECT(vfs
->conn
);
120 static NTSTATUS
cmd_disk_free(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
122 struct smb_filename
*smb_fname
= NULL
;
123 uint64_t diskfree
, bsize
, dfree
, dsize
;
125 printf("Usage: disk_free <path>\n");
129 smb_fname
= synthetic_smb_fname(talloc_tos(),
135 if (smb_fname
== NULL
) {
136 return NT_STATUS_NO_MEMORY
;
138 diskfree
= SMB_VFS_DISK_FREE(vfs
->conn
, smb_fname
,
139 &bsize
, &dfree
, &dsize
);
140 printf("disk_free: %lu, bsize = %lu, dfree = %lu, dsize = %lu\n",
141 (unsigned long)diskfree
,
142 (unsigned long)bsize
,
143 (unsigned long)dfree
,
144 (unsigned long)dsize
);
149 static NTSTATUS
cmd_opendir(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
151 struct smb_filename
*smb_fname
= NULL
;
155 printf("Usage: opendir <fname>\n");
159 smb_fname
= synthetic_smb_fname(talloc_tos(),
165 if (smb_fname
== NULL
) {
166 return NT_STATUS_NO_MEMORY
;
169 status
= OpenDir(vfs
->conn
,
175 if (!NT_STATUS_IS_OK(status
)) {
176 int err
= map_errno_from_nt_status(status
);
177 printf("opendir error=%d (%s)\n", err
, strerror(err
));
178 TALLOC_FREE(smb_fname
);
180 return NT_STATUS_UNSUCCESSFUL
;
183 TALLOC_FREE(smb_fname
);
184 printf("opendir: ok\n");
189 static NTSTATUS
cmd_readdir(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
191 struct smb_Dir
*currentdir
= vfs
->currentdir
;
192 files_struct
*dirfsp
= dir_hnd_fetch_fsp(currentdir
);
193 connection_struct
*conn
= dirfsp
->conn
;
195 const char *dname
= NULL
;
196 struct smb_filename
*fname
= NULL
;
197 char *talloced
= NULL
;
200 if (vfs
->currentdir
== NULL
) {
201 printf("readdir: error=-1 (no open directory)\n");
202 return NT_STATUS_UNSUCCESSFUL
;
205 dname
= ReadDirName(vfs
->currentdir
, &talloced
);
207 printf("readdir: NULL\n");
211 fname
= synthetic_smb_fname(
212 talloc_tos(), dname
, NULL
, 0, 0, ssf_flags());
214 printf("readdir: no memory\n");
218 printf("readdir: %s\n", dname
);
220 ret
= SMB_VFS_FSTATAT(conn
, dirfsp
, fname
, &st
, AT_SYMLINK_NOFOLLOW
);
222 if ((ret
== 0) && VALID_STAT(st
)) {
224 printf(" stat available");
225 if (S_ISREG(st
.st_ex_mode
)) printf(" Regular File\n");
226 else if (S_ISDIR(st
.st_ex_mode
)) printf(" Directory\n");
227 else if (S_ISCHR(st
.st_ex_mode
)) printf(" Character Device\n");
228 else if (S_ISBLK(st
.st_ex_mode
)) printf(" Block Device\n");
229 else if (S_ISFIFO(st
.st_ex_mode
)) printf(" Fifo\n");
230 else if (S_ISLNK(st
.st_ex_mode
)) printf(" Symbolic Link\n");
231 else if (S_ISSOCK(st
.st_ex_mode
)) printf(" Socket\n");
232 printf(" Size: %10u", (unsigned int)st
.st_ex_size
);
233 #ifdef HAVE_STAT_ST_BLOCKS
234 printf(" Blocks: %9u", (unsigned int)st
.st_ex_blocks
);
236 #ifdef HAVE_STAT_ST_BLKSIZE
237 printf(" IO Block: %u\n", (unsigned int)st
.st_ex_blksize
);
239 printf(" Device: 0x%10x", (unsigned int)st
.st_ex_dev
);
240 printf(" Inode: %10u", (unsigned int)st
.st_ex_ino
);
241 printf(" Links: %10u\n", (unsigned int)st
.st_ex_nlink
);
242 printf(" Access: %05o", (int)((st
.st_ex_mode
) & 007777));
243 printf(" Uid: %5lu Gid: %5lu\n",
244 (unsigned long)st
.st_ex_uid
,
245 (unsigned long)st
.st_ex_gid
);
246 tmp_time
= convert_timespec_to_time_t(st
.st_ex_atime
);
247 printf(" Access: %s", ctime(&tmp_time
));
248 tmp_time
= convert_timespec_to_time_t(st
.st_ex_mtime
);
249 printf(" Modify: %s", ctime(&tmp_time
));
250 tmp_time
= convert_timespec_to_time_t(st
.st_ex_ctime
);
251 printf(" Change: %s", ctime(&tmp_time
));
254 TALLOC_FREE(talloced
);
259 static NTSTATUS
cmd_mkdir(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
261 struct smb_filename
*smb_fname
= NULL
;
265 printf("Usage: mkdir <path>\n");
269 smb_fname
= synthetic_smb_fname(talloc_tos(),
276 if (smb_fname
== NULL
) {
277 return NT_STATUS_NO_MEMORY
;
280 ret
= SMB_VFS_MKDIRAT(vfs
->conn
,
285 printf("mkdir error=%d (%s)\n", errno
, strerror(errno
));
286 return NT_STATUS_UNSUCCESSFUL
;
289 printf("mkdir: ok\n");
294 static NTSTATUS
cmd_closedir(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
296 if (vfs
->currentdir
== NULL
) {
297 printf("closedir: failure (no directory open)\n");
298 return NT_STATUS_UNSUCCESSFUL
;
301 TALLOC_FREE(vfs
->currentdir
);
303 printf("closedir: ok\n");
308 static NTSTATUS
cmd_open(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
310 struct vfs_open_how how
= { .mode
= 0400, };
313 struct files_struct
*fspcwd
= NULL
;
314 struct smb_filename
*smb_fname
= NULL
;
318 if (argc
< 3 || argc
> 5) {
319 printf("Usage: open <filename> <flags> <mode>\n");
320 printf(" flags: O = O_RDONLY\n");
321 printf(" R = O_RDWR\n");
322 printf(" W = O_WRONLY\n");
323 printf(" C = O_CREAT\n");
324 printf(" E = O_EXCL\n");
325 printf(" T = O_TRUNC\n");
326 printf(" A = O_APPEND\n");
327 printf(" N = O_NONBLOCK/O_NDELAY\n");
329 printf(" S = O_SYNC\n");
332 printf(" F = O_NOFOLLOW\n");
334 printf(" mode: see open.2\n");
335 printf(" mode is ignored if C flag not present\n");
336 printf(" mode defaults to 00400\n");
343 how
.flags
|= O_RDONLY
;
349 how
.flags
|= O_WRONLY
;
352 how
.flags
|= O_CREAT
;
358 how
.flags
|= O_TRUNC
;
361 how
.flags
|= O_APPEND
;
364 how
.flags
|= O_NONBLOCK
;
373 how
.flags
|= O_NOFOLLOW
;
377 printf("open: error=-1 (invalid flag!)\n");
378 return NT_STATUS_UNSUCCESSFUL
;
382 if ((how
.flags
& O_CREAT
) && argc
== 4) {
385 if (sscanf(argv
[3], "%ho", &_mode
) == 0) {
386 printf("open: error=-1 (invalid mode!)\n");
387 return NT_STATUS_UNSUCCESSFUL
;
393 fsp
= talloc_zero(vfs
, struct files_struct
);
397 fsp
->fh
= fd_handle_create(fsp
);
398 if (fsp
->fh
== NULL
) {
401 fsp
->conn
= vfs
->conn
;
403 smb_fname
= synthetic_smb_fname_split(NULL
,
405 lp_posix_pathnames());
406 if (smb_fname
== NULL
) {
410 fsp
->fsp_name
= smb_fname
;
412 status
= vfs_at_fspcwd(fsp
, vfs
->conn
, &fspcwd
);
413 if (!NT_STATUS_IS_OK(status
)) {
417 if (is_named_stream(smb_fname
)) {
418 struct smb_filename
*base_name
= NULL
;
420 base_name
= cp_smb_filename_nostream(NULL
, smb_fname
);
421 if (base_name
== NULL
) {
425 status
= openat_pathref_fsp(fspcwd
, base_name
);
426 if (!NT_STATUS_IS_OK(status
)) {
432 fsp
->base_fsp
= base_name
->fsp
;
435 fd
= SMB_VFS_OPENAT(vfs
->conn
,
441 printf("open: error=%d (%s)\n", errno
, strerror(errno
));
442 status
= map_nt_error_from_unix(errno
);
447 status
= vfs_stat_fsp(fsp
);
448 if (!NT_STATUS_IS_OK(status
)) {
449 /* If we have an fd, this stat should succeed. */
450 DEBUG(0,("Error doing fstat on open file %s "
452 smb_fname_str_dbg(smb_fname
),
453 nt_errstr(status
) ));
454 } else if (S_ISDIR(smb_fname
->st
.st_ex_mode
)) {
456 status
= NT_STATUS_FILE_IS_A_DIRECTORY
;
459 if (!NT_STATUS_IS_OK(status
)) {
464 fsp
->file_id
= vfs_file_id_from_sbuf(vfs
->conn
, &smb_fname
->st
);
465 fsp
->vuid
= UID_FIELD_INVALID
;
467 fsp
->fsp_flags
.can_lock
= true;
468 fsp
->fsp_flags
.can_read
= true;
469 fsp
->fsp_flags
.can_write
= CAN_WRITE(vfs
->conn
);
470 fsp
->print_file
= NULL
;
471 fsp
->fsp_flags
.modified
= false;
472 fsp
->sent_oplock_break
= NO_BREAK_SENT
;
473 fsp
->fsp_flags
.is_directory
= false;
475 vfs
->files
[fsp_get_pathref_fd(fsp
)] = fsp
;
476 printf("open: fd=%d\n", fsp_get_pathref_fd(fsp
));
480 status
= NT_STATUS_NO_MEMORY
;
482 TALLOC_FREE(smb_fname
);
488 static NTSTATUS
cmd_pathfunc(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
490 struct smb_filename
*smb_fname
= NULL
;
494 printf("Usage: %s <path>\n", argv
[0]);
498 smb_fname
= synthetic_smb_fname(talloc_tos(),
505 if (smb_fname
== NULL
) {
506 return NT_STATUS_NO_MEMORY
;
509 if (strcmp("rmdir", argv
[0]) == 0 ) {
510 ret
= SMB_VFS_UNLINKAT(vfs
->conn
,
514 TALLOC_FREE(smb_fname
);
515 } else if (strcmp("unlink", argv
[0]) == 0 ) {
516 TALLOC_FREE(smb_fname
);
517 /* unlink can be a stream:name */
518 smb_fname
= synthetic_smb_fname_split(talloc_tos(),
520 lp_posix_pathnames());
521 if (smb_fname
== NULL
) {
522 return NT_STATUS_NO_MEMORY
;
524 ret
= SMB_VFS_UNLINKAT(vfs
->conn
,
528 TALLOC_FREE(smb_fname
);
529 } else if (strcmp("chdir", argv
[0]) == 0 ) {
530 ret
= SMB_VFS_CHDIR(vfs
->conn
, smb_fname
);
531 TALLOC_FREE(smb_fname
);
533 printf("%s: error=%d (invalid function name!)\n", argv
[0], errno
);
534 return NT_STATUS_UNSUCCESSFUL
;
538 printf("%s: error=%d (%s)\n", argv
[0], errno
, strerror(errno
));
539 return NT_STATUS_UNSUCCESSFUL
;
542 printf("%s: ok\n", argv
[0]);
547 static NTSTATUS
cmd_close(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
553 printf("Usage: close <fd>\n");
558 if (vfs
->files
[fd
] == NULL
) {
559 printf("close: error=-1 (invalid file descriptor)\n");
563 status
= fd_close(vfs
->files
[fd
]);
564 if (!NT_STATUS_IS_OK(status
))
565 printf("close: error=%s\n", nt_errstr(status
));
567 printf("close: ok\n");
569 TALLOC_FREE(vfs
->files
[fd
]);
570 vfs
->files
[fd
] = NULL
;
575 static NTSTATUS
cmd_read(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
582 printf("Usage: read <fd> <size>\n");
586 /* do some error checking on these */
588 size
= atoi(argv
[2]);
589 vfs
->data
= talloc_array(mem_ctx
, char, size
);
590 if (vfs
->data
== NULL
) {
591 printf("read: error=-1 (not enough memory)");
592 return NT_STATUS_UNSUCCESSFUL
;
594 vfs
->data_size
= size
;
596 rsize
= read_file(vfs
->files
[fd
], vfs
->data
, 0, size
);
598 printf("read: error=%d (%s)\n", errno
, strerror(errno
));
599 return NT_STATUS_UNSUCCESSFUL
;
602 printf("read: ok\n");
607 static NTSTATUS
cmd_write(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
613 printf("Usage: write <fd> <size>\n");
617 /* some error checking should go here */
619 size
= atoi(argv
[2]);
620 if (vfs
->data
== NULL
) {
621 printf("write: error=-1 (buffer empty, please populate it before writing)");
622 return NT_STATUS_UNSUCCESSFUL
;
625 if (vfs
->data_size
< size
) {
626 printf("write: error=-1 (buffer too small, please put some more data in)");
627 return NT_STATUS_UNSUCCESSFUL
;
630 wsize
= write_file(NULL
, vfs
->files
[fd
], vfs
->data
, 0, size
);
633 printf("write: error=%d (%s)\n", errno
, strerror(errno
));
634 return NT_STATUS_UNSUCCESSFUL
;
637 printf("write: ok\n");
642 static NTSTATUS
cmd_lseek(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
644 int fd
, offset
, whence
;
648 printf("Usage: lseek <fd> <offset> <whence>\n...where whence is 1 => SEEK_SET, 2 => SEEK_CUR, 3 => SEEK_END\n");
653 offset
= atoi(argv
[2]);
654 whence
= atoi(argv
[3]);
656 case 1: whence
= SEEK_SET
; break;
657 case 2: whence
= SEEK_CUR
; break;
658 default: whence
= SEEK_END
;
661 pos
= SMB_VFS_LSEEK(vfs
->files
[fd
], offset
, whence
);
662 if (pos
== (off_t
)-1) {
663 printf("lseek: error=%d (%s)\n", errno
, strerror(errno
));
664 return NT_STATUS_UNSUCCESSFUL
;
667 printf("lseek: ok\n");
672 static NTSTATUS
cmd_rename(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
675 struct smb_filename
*smb_fname_src
= NULL
;
676 struct smb_filename
*smb_fname_dst
= NULL
;
679 printf("Usage: rename <old> <new>\n");
683 smb_fname_src
= synthetic_smb_fname_split(mem_ctx
,
685 lp_posix_pathnames());
686 if (smb_fname_src
== NULL
) {
687 return NT_STATUS_NO_MEMORY
;
690 smb_fname_dst
= synthetic_smb_fname_split(mem_ctx
,
692 lp_posix_pathnames());
693 if (smb_fname_dst
== NULL
) {
694 TALLOC_FREE(smb_fname_src
);
695 return NT_STATUS_NO_MEMORY
;
698 ret
= SMB_VFS_RENAMEAT(vfs
->conn
,
704 TALLOC_FREE(smb_fname_src
);
705 TALLOC_FREE(smb_fname_dst
);
707 printf("rename: error=%d (%s)\n", errno
, strerror(errno
));
708 return NT_STATUS_UNSUCCESSFUL
;
711 printf("rename: ok\n");
715 static NTSTATUS
cmd_fsync(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
719 printf("Usage: fsync <fd>\n");
724 ret
= smb_vfs_fsync_sync(vfs
->files
[fd
]);
726 printf("fsync: error=%d (%s)\n", errno
, strerror(errno
));
727 return NT_STATUS_UNSUCCESSFUL
;
730 printf("fsync: ok\n");
735 static NTSTATUS
cmd_stat(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
740 struct passwd
*pwd
= NULL
;
741 struct group
*grp
= NULL
;
742 struct smb_filename
*smb_fname
= NULL
;
747 printf("Usage: stat <fname>\n");
751 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
753 lp_posix_pathnames());
754 if (smb_fname
== NULL
) {
755 return NT_STATUS_NO_MEMORY
;
758 ret
= SMB_VFS_STAT(vfs
->conn
, smb_fname
);
760 printf("stat: error=%d (%s)\n", errno
, strerror(errno
));
761 TALLOC_FREE(smb_fname
);
762 return NT_STATUS_UNSUCCESSFUL
;
765 TALLOC_FREE(smb_fname
);
767 pwd
= getpwuid(st
.st_ex_uid
);
768 if (pwd
!= NULL
) user
= pwd
->pw_name
;
769 else user
= null_string
;
770 grp
= getgrgid(st
.st_ex_gid
);
771 if (grp
!= NULL
) group
= grp
->gr_name
;
772 else group
= null_string
;
774 printf("stat: ok\n");
775 printf(" File: %s", argv
[1]);
776 if (S_ISREG(st
.st_ex_mode
)) printf(" Regular File\n");
777 else if (S_ISDIR(st
.st_ex_mode
)) printf(" Directory\n");
778 else if (S_ISCHR(st
.st_ex_mode
)) printf(" Character Device\n");
779 else if (S_ISBLK(st
.st_ex_mode
)) printf(" Block Device\n");
780 else if (S_ISFIFO(st
.st_ex_mode
)) printf(" Fifo\n");
781 else if (S_ISLNK(st
.st_ex_mode
)) printf(" Symbolic Link\n");
782 else if (S_ISSOCK(st
.st_ex_mode
)) printf(" Socket\n");
783 printf(" Size: %10u", (unsigned int)st
.st_ex_size
);
784 #ifdef HAVE_STAT_ST_BLOCKS
785 printf(" Blocks: %9u", (unsigned int)st
.st_ex_blocks
);
787 #ifdef HAVE_STAT_ST_BLKSIZE
788 printf(" IO Block: %u\n", (unsigned int)st
.st_ex_blksize
);
790 printf(" Device: 0x%10x", (unsigned int)st
.st_ex_dev
);
791 printf(" Inode: %10u", (unsigned int)st
.st_ex_ino
);
792 printf(" Links: %10u\n", (unsigned int)st
.st_ex_nlink
);
793 printf(" Access: %05o", (int)((st
.st_ex_mode
) & 007777));
794 printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st
.st_ex_uid
, user
,
795 (unsigned long)st
.st_ex_gid
, group
);
796 tmp_time
= convert_timespec_to_time_t(st
.st_ex_atime
);
797 printf(" Access: %s", ctime(&tmp_time
));
798 tmp_time
= convert_timespec_to_time_t(st
.st_ex_mtime
);
799 printf(" Modify: %s", ctime(&tmp_time
));
800 tmp_time
= convert_timespec_to_time_t(st
.st_ex_ctime
);
801 printf(" Change: %s", ctime(&tmp_time
));
807 static NTSTATUS
cmd_fstat(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
812 struct passwd
*pwd
= NULL
;
813 struct group
*grp
= NULL
;
818 printf("Usage: fstat <fd>\n");
823 if (fd
< 0 || fd
>= 1024) {
824 printf("fstat: error=%d (file descriptor out of range)\n", EBADF
);
828 if (vfs
->files
[fd
] == NULL
) {
829 printf("fstat: error=%d (invalid file descriptor)\n", EBADF
);
833 if (SMB_VFS_FSTAT(vfs
->files
[fd
], &st
) == -1) {
834 printf("fstat: error=%d (%s)\n", errno
, strerror(errno
));
835 return NT_STATUS_UNSUCCESSFUL
;
838 pwd
= getpwuid(st
.st_ex_uid
);
839 if (pwd
!= NULL
) user
= pwd
->pw_name
;
840 else user
= null_string
;
841 grp
= getgrgid(st
.st_ex_gid
);
842 if (grp
!= NULL
) group
= grp
->gr_name
;
843 else group
= null_string
;
845 printf("fstat: ok\n");
846 if (S_ISREG(st
.st_ex_mode
)) printf(" Regular File\n");
847 else if (S_ISDIR(st
.st_ex_mode
)) printf(" Directory\n");
848 else if (S_ISCHR(st
.st_ex_mode
)) printf(" Character Device\n");
849 else if (S_ISBLK(st
.st_ex_mode
)) printf(" Block Device\n");
850 else if (S_ISFIFO(st
.st_ex_mode
)) printf(" Fifo\n");
851 else if (S_ISLNK(st
.st_ex_mode
)) printf(" Symbolic Link\n");
852 else if (S_ISSOCK(st
.st_ex_mode
)) printf(" Socket\n");
853 printf(" Size: %10u", (unsigned int)st
.st_ex_size
);
854 #ifdef HAVE_STAT_ST_BLOCKS
855 printf(" Blocks: %9u", (unsigned int)st
.st_ex_blocks
);
857 #ifdef HAVE_STAT_ST_BLKSIZE
858 printf(" IO Block: %u\n", (unsigned int)st
.st_ex_blksize
);
860 printf(" Device: 0x%10x", (unsigned int)st
.st_ex_dev
);
861 printf(" Inode: %10u", (unsigned int)st
.st_ex_ino
);
862 printf(" Links: %10u\n", (unsigned int)st
.st_ex_nlink
);
863 printf(" Access: %05o", (int)((st
.st_ex_mode
) & 007777));
864 printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st
.st_ex_uid
, user
,
865 (unsigned long)st
.st_ex_gid
, group
);
866 tmp_time
= convert_timespec_to_time_t(st
.st_ex_atime
);
867 printf(" Access: %s", ctime(&tmp_time
));
868 tmp_time
= convert_timespec_to_time_t(st
.st_ex_mtime
);
869 printf(" Modify: %s", ctime(&tmp_time
));
870 tmp_time
= convert_timespec_to_time_t(st
.st_ex_ctime
);
871 printf(" Change: %s", ctime(&tmp_time
));
877 static NTSTATUS
cmd_lstat(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
881 struct passwd
*pwd
= NULL
;
882 struct group
*grp
= NULL
;
883 struct smb_filename
*smb_fname
= NULL
;
888 printf("Usage: lstat <path>\n");
892 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
894 lp_posix_pathnames());
895 if (smb_fname
== NULL
) {
896 return NT_STATUS_NO_MEMORY
;
899 if (SMB_VFS_LSTAT(vfs
->conn
, smb_fname
) == -1) {
900 printf("lstat: error=%d (%s)\n", errno
, strerror(errno
));
901 TALLOC_FREE(smb_fname
);
902 return NT_STATUS_UNSUCCESSFUL
;
905 TALLOC_FREE(smb_fname
);
907 pwd
= getpwuid(st
.st_ex_uid
);
908 if (pwd
!= NULL
) user
= pwd
->pw_name
;
909 else user
= null_string
;
910 grp
= getgrgid(st
.st_ex_gid
);
911 if (grp
!= NULL
) group
= grp
->gr_name
;
912 else group
= null_string
;
914 printf("lstat: ok\n");
915 if (S_ISREG(st
.st_ex_mode
)) printf(" Regular File\n");
916 else if (S_ISDIR(st
.st_ex_mode
)) printf(" Directory\n");
917 else if (S_ISCHR(st
.st_ex_mode
)) printf(" Character Device\n");
918 else if (S_ISBLK(st
.st_ex_mode
)) printf(" Block Device\n");
919 else if (S_ISFIFO(st
.st_ex_mode
)) printf(" Fifo\n");
920 else if (S_ISLNK(st
.st_ex_mode
)) printf(" Symbolic Link\n");
921 else if (S_ISSOCK(st
.st_ex_mode
)) printf(" Socket\n");
922 printf(" Size: %10u", (unsigned int)st
.st_ex_size
);
923 #ifdef HAVE_STAT_ST_BLOCKS
924 printf(" Blocks: %9u", (unsigned int)st
.st_ex_blocks
);
926 #ifdef HAVE_STAT_ST_BLKSIZE
927 printf(" IO Block: %u\n", (unsigned int)st
.st_ex_blksize
);
929 printf(" Device: 0x%10x", (unsigned int)st
.st_ex_dev
);
930 printf(" Inode: %10u", (unsigned int)st
.st_ex_ino
);
931 printf(" Links: %10u\n", (unsigned int)st
.st_ex_nlink
);
932 printf(" Access: %05o", (int)((st
.st_ex_mode
) & 007777));
933 printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n", (unsigned long)st
.st_ex_uid
, user
,
934 (unsigned long)st
.st_ex_gid
, group
);
935 tmp_time
= convert_timespec_to_time_t(st
.st_ex_atime
);
936 printf(" Access: %s", ctime(&tmp_time
));
937 tmp_time
= convert_timespec_to_time_t(st
.st_ex_mtime
);
938 printf(" Modify: %s", ctime(&tmp_time
));
939 tmp_time
= convert_timespec_to_time_t(st
.st_ex_ctime
);
940 printf(" Change: %s", ctime(&tmp_time
));
946 static NTSTATUS
cmd_chmod(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
948 struct smb_filename
*smb_fname
= NULL
;
950 struct smb_filename
*pathref_fname
= NULL
;
953 printf("Usage: chmod <path> <mode>\n");
957 mode
= atoi(argv
[2]);
959 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
961 lp_posix_pathnames());
962 if (smb_fname
== NULL
) {
963 return NT_STATUS_NO_MEMORY
;
966 status
= synthetic_pathref(mem_ctx
,
968 smb_fname
->base_name
,
974 if (!NT_STATUS_IS_OK(status
)) {
977 if (SMB_VFS_FCHMOD(pathref_fname
->fsp
, mode
) == -1) {
978 printf("chmod: error=%d (%s)\n", errno
, strerror(errno
));
979 return NT_STATUS_UNSUCCESSFUL
;
982 printf("chmod: ok\n");
987 static NTSTATUS
cmd_fchmod(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
992 printf("Usage: fchmod <fd> <mode>\n");
997 mode
= atoi(argv
[2]);
998 if (fd
< 0 || fd
>= 1024) {
999 printf("fchmod: error=%d (file descriptor out of range)\n", EBADF
);
1000 return NT_STATUS_OK
;
1002 if (vfs
->files
[fd
] == NULL
) {
1003 printf("fchmod: error=%d (invalid file descriptor)\n", EBADF
);
1004 return NT_STATUS_OK
;
1007 if (SMB_VFS_FCHMOD(vfs
->files
[fd
], mode
) == -1) {
1008 printf("fchmod: error=%d (%s)\n", errno
, strerror(errno
));
1009 return NT_STATUS_UNSUCCESSFUL
;
1012 printf("fchmod: ok\n");
1013 return NT_STATUS_OK
;
1016 static NTSTATUS
cmd_fchown(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1022 printf("Usage: fchown <fd> <uid> <gid>\n");
1023 return NT_STATUS_OK
;
1026 uid
= atoi(argv
[2]);
1027 gid
= atoi(argv
[3]);
1029 if (fd
< 0 || fd
>= 1024) {
1030 printf("fchown: failure=%d (file descriptor out of range)\n", EBADF
);
1031 return NT_STATUS_OK
;
1033 if (vfs
->files
[fd
] == NULL
) {
1034 printf("fchown: error=%d (invalid file descriptor)\n", EBADF
);
1035 return NT_STATUS_OK
;
1037 if (SMB_VFS_FCHOWN(vfs
->files
[fd
], uid
, gid
) == -1) {
1038 printf("fchown error=%d (%s)\n", errno
, strerror(errno
));
1039 return NT_STATUS_UNSUCCESSFUL
;
1042 printf("fchown: ok\n");
1043 return NT_STATUS_OK
;
1047 static NTSTATUS
cmd_getwd(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1049 struct smb_filename
*smb_fname
= SMB_VFS_GETWD(vfs
->conn
, talloc_tos());
1050 if (smb_fname
== NULL
) {
1051 printf("getwd: error=%d (%s)\n", errno
, strerror(errno
));
1052 return NT_STATUS_UNSUCCESSFUL
;
1055 printf("getwd: %s\n", smb_fname
->base_name
);
1056 TALLOC_FREE(smb_fname
);
1057 return NT_STATUS_OK
;
1060 static NTSTATUS
cmd_utime(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1062 struct smb_file_time ft
;
1063 struct files_struct
*dirfsp
= NULL
;
1064 struct smb_filename
*smb_fname
= NULL
;
1068 printf("Usage: utime <path> <access> <modify>\n");
1069 return NT_STATUS_OK
;
1072 init_smb_file_time(&ft
);
1074 ft
.atime
= time_t_to_full_timespec(atoi(argv
[2]));
1075 ft
.mtime
= time_t_to_full_timespec(atoi(argv
[3]));
1077 status
= filename_convert_dirfsp(mem_ctx
,
1084 if (!NT_STATUS_IS_OK(status
)) {
1085 printf("utime: %s\n", nt_errstr(status
));
1089 if (SMB_VFS_FNTIMES(smb_fname
->fsp
, &ft
) != 0) {
1090 printf("utime: error=%d (%s)\n", errno
, strerror(errno
));
1091 TALLOC_FREE(smb_fname
);
1092 return NT_STATUS_UNSUCCESSFUL
;
1095 TALLOC_FREE(smb_fname
);
1096 printf("utime: ok\n");
1097 return NT_STATUS_OK
;
1100 static NTSTATUS
cmd_ftruncate(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1105 printf("Usage: ftruncate <fd> <length>\n");
1106 return NT_STATUS_OK
;
1110 off
= atoi(argv
[2]);
1111 if (fd
< 0 || fd
>= 1024) {
1112 printf("ftruncate: error=%d (file descriptor out of range)\n", EBADF
);
1113 return NT_STATUS_OK
;
1115 if (vfs
->files
[fd
] == NULL
) {
1116 printf("ftruncate: error=%d (invalid file descriptor)\n", EBADF
);
1117 return NT_STATUS_OK
;
1120 if (SMB_VFS_FTRUNCATE(vfs
->files
[fd
], off
) == -1) {
1121 printf("ftruncate: error=%d (%s)\n", errno
, strerror(errno
));
1122 return NT_STATUS_UNSUCCESSFUL
;
1125 printf("ftruncate: ok\n");
1126 return NT_STATUS_OK
;
1129 static NTSTATUS
cmd_lock(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1136 const char *typestr
;
1139 printf("Usage: lock <fd> <op> <offset> <count> <type>\n");
1140 printf(" ops: G = F_GETLK\n");
1141 printf(" S = F_SETLK\n");
1142 printf(" W = F_SETLKW\n");
1143 printf(" type: R = F_RDLCK\n");
1144 printf(" W = F_WRLCK\n");
1145 printf(" U = F_UNLCK\n");
1146 return NT_STATUS_OK
;
1149 if (sscanf(argv
[1], "%d", &fd
) == 0) {
1150 printf("lock: error=-1 (error parsing fd)\n");
1151 return NT_STATUS_UNSUCCESSFUL
;
1166 printf("lock: error=-1 (invalid op flag!)\n");
1167 return NT_STATUS_UNSUCCESSFUL
;
1170 if (sscanf(argv
[3], "%ld", &offset
) == 0) {
1171 printf("lock: error=-1 (error parsing fd)\n");
1172 return NT_STATUS_UNSUCCESSFUL
;
1175 if (sscanf(argv
[4], "%ld", &count
) == 0) {
1176 printf("lock: error=-1 (error parsing fd)\n");
1177 return NT_STATUS_UNSUCCESSFUL
;
1194 printf("lock: error=-1 (invalid type flag!)\n");
1195 return NT_STATUS_UNSUCCESSFUL
;
1200 printf("lock: debug lock(fd=%d, op=%d, offset=%ld, count=%ld, type=%d))\n", fd
, op
, offset
, count
, type
);
1202 if (SMB_VFS_LOCK(vfs
->files
[fd
], op
, offset
, count
, type
) == False
) {
1203 printf("lock: error=%d (%s)\n", errno
, strerror(errno
));
1204 return NT_STATUS_UNSUCCESSFUL
;
1207 printf("lock: ok\n");
1208 return NT_STATUS_OK
;
1211 static NTSTATUS
cmd_symlink(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1214 char *target
= NULL
;
1215 struct smb_filename target_fname
;
1216 struct smb_filename
*new_smb_fname
= NULL
;
1220 printf("Usage: symlink <path> <link>\n");
1221 return NT_STATUS_OK
;
1224 new_smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1226 lp_posix_pathnames());
1227 if (new_smb_fname
== NULL
) {
1228 return NT_STATUS_NO_MEMORY
;
1231 target
= talloc_strdup(mem_ctx
, argv
[1]);
1232 if (target
== NULL
) {
1233 return NT_STATUS_NO_MEMORY
;
1236 target_fname
= (struct smb_filename
) {
1237 .base_name
= target
,
1240 /* Removes @GMT tokens if any */
1241 status
= canonicalize_snapshot_path(&target_fname
, UCF_GMT_PATHNAME
, 0);
1242 if (!NT_STATUS_IS_OK(status
)) {
1246 ret
= SMB_VFS_SYMLINKAT(vfs
->conn
,
1251 printf("symlink: error=%d (%s)\n", errno
, strerror(errno
));
1252 return NT_STATUS_UNSUCCESSFUL
;
1255 printf("symlink: ok\n");
1256 return NT_STATUS_OK
;
1260 static NTSTATUS
cmd_readlink(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1262 char buffer
[PATH_MAX
];
1263 struct smb_filename
*smb_fname
= NULL
;
1267 printf("Usage: readlink <path>\n");
1268 return NT_STATUS_OK
;
1271 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1273 lp_posix_pathnames());
1274 if (smb_fname
== NULL
) {
1275 return NT_STATUS_NO_MEMORY
;
1277 size
= SMB_VFS_READLINKAT(vfs
->conn
,
1284 printf("readlink: error=%d (%s)\n", errno
, strerror(errno
));
1285 return NT_STATUS_UNSUCCESSFUL
;
1288 buffer
[size
] = '\0';
1289 printf("readlink: %s\n", buffer
);
1290 return NT_STATUS_OK
;
1294 static NTSTATUS
cmd_link(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1296 struct smb_filename
*old_smb_fname
= NULL
;
1297 struct smb_filename
*new_smb_fname
= NULL
;
1301 printf("Usage: link <path> <link>\n");
1302 return NT_STATUS_OK
;
1305 old_smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1307 lp_posix_pathnames());
1308 if (old_smb_fname
== NULL
) {
1309 return NT_STATUS_NO_MEMORY
;
1311 new_smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1313 lp_posix_pathnames());
1314 if (new_smb_fname
== NULL
) {
1315 return NT_STATUS_NO_MEMORY
;
1318 ret
= SMB_VFS_LINKAT(vfs
->conn
,
1325 printf("link: error=%d (%s)\n", errno
, strerror(errno
));
1326 return NT_STATUS_UNSUCCESSFUL
;
1329 printf("link: ok\n");
1330 return NT_STATUS_OK
;
1333 static NTSTATUS
cmd_mknod(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1337 unsigned int dev_val
;
1339 struct smb_filename
*smb_fname
= NULL
;
1343 printf("Usage: mknod <path> <mode> <dev>\n");
1344 printf(" mode is octal\n");
1345 printf(" dev is hex\n");
1346 return NT_STATUS_OK
;
1349 if (sscanf(argv
[2], "%ho", &_mode
) == 0) {
1350 printf("open: error=-1 (invalid mode!)\n");
1351 return NT_STATUS_UNSUCCESSFUL
;
1355 if (sscanf(argv
[3], "%x", &dev_val
) == 0) {
1356 printf("open: error=-1 (invalid dev!)\n");
1357 return NT_STATUS_UNSUCCESSFUL
;
1359 dev
= (SMB_DEV_T
)dev_val
;
1361 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1363 lp_posix_pathnames());
1364 if (smb_fname
== NULL
) {
1365 return NT_STATUS_NO_MEMORY
;
1368 ret
= SMB_VFS_MKNODAT(vfs
->conn
,
1375 printf("mknod: error=%d (%s)\n", errno
, strerror(errno
));
1376 return NT_STATUS_UNSUCCESSFUL
;
1379 printf("mknod: ok\n");
1380 return NT_STATUS_OK
;
1383 static NTSTATUS
cmd_realpath(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1385 struct smb_filename
*smb_fname
= NULL
;
1388 printf("Usage: realpath <path>\n");
1389 return NT_STATUS_OK
;
1392 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1394 lp_posix_pathnames());
1395 if (smb_fname
== NULL
) {
1396 return NT_STATUS_NO_MEMORY
;
1398 if (SMB_VFS_REALPATH(vfs
->conn
, mem_ctx
, smb_fname
) == NULL
) {
1399 printf("realpath: error=%d (%s)\n", errno
, strerror(errno
));
1400 return NT_STATUS_UNSUCCESSFUL
;
1403 printf("realpath: ok\n");
1404 return NT_STATUS_OK
;
1407 static NTSTATUS
cmd_getxattr(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1408 int argc
, const char **argv
)
1412 struct smb_filename
*smb_fname
= NULL
;
1413 struct smb_filename
*pathref_fname
= NULL
;
1417 printf("Usage: getxattr <path> <xattr>\n");
1418 return NT_STATUS_OK
;
1423 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1425 lp_posix_pathnames());
1426 if (smb_fname
== NULL
) {
1427 return NT_STATUS_NO_MEMORY
;
1429 status
= synthetic_pathref(mem_ctx
,
1431 smb_fname
->base_name
,
1437 if (!NT_STATUS_IS_OK(status
)) {
1440 ret
= SMB_VFS_FGETXATTR(pathref_fname
->fsp
,
1443 talloc_get_size(buf
));
1446 printf("getxattr returned (%s)\n", strerror(err
));
1447 return map_nt_error_from_unix(err
);
1449 buf
= talloc_array(mem_ctx
, uint8_t, ret
);
1451 return NT_STATUS_NO_MEMORY
;
1453 ret
= SMB_VFS_FGETXATTR(pathref_fname
->fsp
,
1456 talloc_get_size(buf
));
1459 printf("getxattr returned (%s)\n", strerror(err
));
1460 return map_nt_error_from_unix(err
);
1462 dump_data_file(buf
, talloc_get_size(buf
), false, stdout
);
1463 return NT_STATUS_OK
;
1466 static NTSTATUS
cmd_listxattr(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1467 int argc
, const char **argv
)
1471 struct smb_filename
*smb_fname
= NULL
;
1472 struct smb_filename
*pathref_fname
= NULL
;
1475 printf("Usage: listxattr <path>\n");
1476 return NT_STATUS_OK
;
1481 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1483 lp_posix_pathnames());
1484 if (smb_fname
== NULL
) {
1485 return NT_STATUS_NO_MEMORY
;
1487 status
= synthetic_pathref(mem_ctx
,
1489 smb_fname
->base_name
,
1495 if (!NT_STATUS_IS_OK(status
)) {
1499 ret
= SMB_VFS_FLISTXATTR(pathref_fname
->fsp
,
1500 buf
, talloc_get_size(buf
));
1503 printf("listxattr returned (%s)\n", strerror(err
));
1504 return map_nt_error_from_unix(err
);
1506 buf
= talloc_array(mem_ctx
, char, ret
);
1508 return NT_STATUS_NO_MEMORY
;
1510 ret
= SMB_VFS_FLISTXATTR(pathref_fname
->fsp
,
1511 buf
, talloc_get_size(buf
));
1514 printf("listxattr returned (%s)\n", strerror(err
));
1515 return map_nt_error_from_unix(err
);
1518 return NT_STATUS_OK
;
1520 if (buf
[ret
-1] != '\0') {
1521 printf("listxattr returned non 0-terminated strings\n");
1522 return NT_STATUS_INTERNAL_ERROR
;
1526 while (p
< buf
+ret
) {
1531 return NT_STATUS_OK
;
1534 static NTSTATUS
cmd_fsetxattr(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1535 int argc
, const char **argv
)
1539 struct smb_filename
*smb_fname
= NULL
;
1540 struct smb_filename
*pathref_fname
= NULL
;
1543 if ((argc
< 4) || (argc
> 5)) {
1544 printf("Usage: setxattr <path> <xattr> <value> [flags]\n");
1545 return NT_STATUS_OK
;
1549 flags
= atoi(argv
[4]);
1552 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1554 lp_posix_pathnames());
1555 if (smb_fname
== NULL
) {
1556 return NT_STATUS_NO_MEMORY
;
1559 status
= synthetic_pathref(mem_ctx
,
1561 smb_fname
->base_name
,
1567 if (!NT_STATUS_IS_OK(status
)) {
1571 ret
= SMB_VFS_FSETXATTR(pathref_fname
->fsp
, argv
[2],
1572 argv
[3], strlen(argv
[3]), flags
);
1575 printf("fsetxattr returned (%s)\n", strerror(err
));
1576 return map_nt_error_from_unix(err
);
1578 return NT_STATUS_OK
;
1581 static NTSTATUS
cmd_removexattr(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1582 int argc
, const char **argv
)
1585 struct smb_filename
*smb_fname
= NULL
;
1586 struct smb_filename
*pathref_fname
= NULL
;
1590 printf("Usage: removexattr <path> <xattr>\n");
1591 return NT_STATUS_OK
;
1594 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1596 lp_posix_pathnames());
1597 if (smb_fname
== NULL
) {
1598 return NT_STATUS_NO_MEMORY
;
1600 status
= synthetic_pathref(mem_ctx
,
1602 smb_fname
->base_name
,
1608 if (!NT_STATUS_IS_OK(status
)) {
1611 ret
= SMB_VFS_FREMOVEXATTR(pathref_fname
->fsp
, argv
[2]);
1614 printf("removexattr returned (%s)\n", strerror(err
));
1615 return map_nt_error_from_unix(err
);
1617 return NT_STATUS_OK
;
1620 static NTSTATUS
cmd_fget_nt_acl(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1621 int argc
, const char **argv
)
1625 struct security_descriptor
*sd
;
1628 printf("Usage: fget_nt_acl <fd>\n");
1629 return NT_STATUS_OK
;
1633 if (fd
< 0 || fd
>= 1024) {
1634 printf("fget_nt_acl: error=%d (file descriptor out of range)\n", EBADF
);
1635 return NT_STATUS_OK
;
1637 if (vfs
->files
[fd
] == NULL
) {
1638 printf("fget_nt_acl: error=%d (invalid file descriptor)\n", EBADF
);
1639 return NT_STATUS_OK
;
1642 status
= SMB_VFS_FGET_NT_ACL(metadata_fsp(vfs
->files
[fd
]),
1643 SECINFO_OWNER
| SECINFO_GROUP
| SECINFO_DACL
,
1645 if (!NT_STATUS_IS_OK(status
)) {
1646 printf("fget_nt_acl returned (%s)\n", nt_errstr(status
));
1649 printf("%s\n", sddl_encode(talloc_tos(), sd
, get_global_sam_sid()));
1651 return NT_STATUS_OK
;
1654 static NTSTATUS
cmd_get_nt_acl(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1655 int argc
, const char **argv
)
1658 struct security_descriptor
*sd
;
1659 struct smb_filename
*smb_fname
= NULL
;
1660 struct smb_filename
*pathref_fname
= NULL
;
1663 printf("Usage: get_nt_acl <path>\n");
1664 return NT_STATUS_OK
;
1667 smb_fname
= synthetic_smb_fname(talloc_tos(),
1674 if (smb_fname
== NULL
) {
1675 return NT_STATUS_NO_MEMORY
;
1678 status
= synthetic_pathref(mem_ctx
,
1680 smb_fname
->base_name
,
1686 if (!NT_STATUS_IS_OK(status
)) {
1687 TALLOC_FREE(smb_fname
);
1690 status
= SMB_VFS_FGET_NT_ACL(pathref_fname
->fsp
,
1691 SECINFO_OWNER
| SECINFO_GROUP
| SECINFO_DACL
,
1694 if (!NT_STATUS_IS_OK(status
)) {
1695 printf("get_nt_acl returned (%s)\n", nt_errstr(status
));
1696 TALLOC_FREE(smb_fname
);
1697 TALLOC_FREE(pathref_fname
);
1700 printf("%s\n", sddl_encode(talloc_tos(), sd
, get_global_sam_sid()));
1702 TALLOC_FREE(smb_fname
);
1703 TALLOC_FREE(pathref_fname
);
1704 return NT_STATUS_OK
;
1707 static NTSTATUS
cmd_fset_nt_acl(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1708 int argc
, const char **argv
)
1712 struct security_descriptor
*sd
;
1715 printf("Usage: fset_nt_acl <fd> <sddl>\n");
1716 return NT_STATUS_OK
;
1720 if (fd
< 0 || fd
>= 1024) {
1721 printf("fset_nt_acl: error=%d (file descriptor out of range)\n", EBADF
);
1722 return NT_STATUS_OK
;
1724 if (vfs
->files
[fd
] == NULL
) {
1725 printf("fset_nt_acl: error=%d (invalid file descriptor)\n", EBADF
);
1726 return NT_STATUS_OK
;
1729 sd
= sddl_decode(talloc_tos(), argv
[2], get_global_sam_sid());
1731 printf("sddl_decode failed to parse %s as SDDL\n", argv
[2]);
1732 return NT_STATUS_INVALID_PARAMETER
;
1735 status
= SMB_VFS_FSET_NT_ACL(
1736 metadata_fsp(vfs
->files
[fd
]),
1737 SECINFO_OWNER
| SECINFO_GROUP
| SECINFO_DACL
,
1739 if (!NT_STATUS_IS_OK(status
)) {
1740 printf("fset_nt_acl returned (%s)\n", nt_errstr(status
));
1744 return NT_STATUS_OK
;
1747 static NTSTATUS
cmd_set_nt_acl(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
, int argc
, const char **argv
)
1749 struct vfs_open_how how
= { .mode
= 0400, };
1751 struct files_struct
*fspcwd
= NULL
;
1752 struct smb_filename
*smb_fname
= NULL
;
1754 struct security_descriptor
*sd
= NULL
;
1758 printf("Usage: set_nt_acl <file> <sddl>\n");
1759 return NT_STATUS_OK
;
1763 fsp
= talloc_zero(vfs
, struct files_struct
);
1765 return NT_STATUS_NO_MEMORY
;
1767 fsp
->fh
= fd_handle_create(fsp
);
1768 if (fsp
->fh
== NULL
) {
1770 return NT_STATUS_NO_MEMORY
;
1772 fsp
->conn
= vfs
->conn
;
1774 smb_fname
= synthetic_smb_fname_split(NULL
,
1776 lp_posix_pathnames());
1777 if (smb_fname
== NULL
) {
1779 return NT_STATUS_NO_MEMORY
;
1782 fsp
->fsp_name
= smb_fname
;
1784 status
= vfs_at_fspcwd(fsp
, vfs
->conn
, &fspcwd
);
1785 if (!NT_STATUS_IS_OK(status
)) {
1790 fd
= SMB_VFS_OPENAT(vfs
->conn
,
1795 if (fd
== -1 && errno
== EISDIR
) {
1797 how
.flags
= O_RDONLY
|O_DIRECTORY
;
1799 /* POSIX allows us to open a directory with O_RDONLY. */
1800 how
.flags
= O_RDONLY
;
1802 fd
= SMB_VFS_OPENAT(vfs
->conn
,
1809 printf("open: error=%d (%s)\n", errno
, strerror(errno
));
1811 TALLOC_FREE(smb_fname
);
1812 return NT_STATUS_UNSUCCESSFUL
;
1814 fsp_set_fd(fsp
, fd
);
1816 status
= vfs_stat_fsp(fsp
);
1817 if (!NT_STATUS_IS_OK(status
)) {
1818 /* If we have an fd, this stat should succeed. */
1819 DEBUG(0,("Error doing fstat on open file %s "
1821 smb_fname_str_dbg(smb_fname
),
1822 nt_errstr(status
) ));
1826 fsp
->file_id
= vfs_file_id_from_sbuf(vfs
->conn
, &smb_fname
->st
);
1827 fsp
->vuid
= UID_FIELD_INVALID
;
1829 fsp
->fsp_flags
.can_lock
= true;
1830 fsp
->fsp_flags
.can_read
= true;
1831 fsp
->fsp_flags
.can_write
= true;
1832 fsp
->print_file
= NULL
;
1833 fsp
->fsp_flags
.modified
= false;
1834 fsp
->sent_oplock_break
= NO_BREAK_SENT
;
1835 fsp
->fsp_flags
.is_directory
= S_ISDIR(smb_fname
->st
.st_ex_mode
);
1837 sd
= sddl_decode(talloc_tos(), argv
[2], get_global_sam_sid());
1839 printf("sddl_decode failed to parse %s as SDDL\n", argv
[2]);
1840 status
= NT_STATUS_INVALID_PARAMETER
;
1844 status
= SMB_VFS_FSET_NT_ACL(
1846 SECINFO_OWNER
| SECINFO_GROUP
| SECINFO_DACL
,
1848 if (!NT_STATUS_IS_OK(status
)) {
1849 printf("fset_nt_acl returned (%s)\n", nt_errstr(status
));
1855 status
= fd_close(fsp
);
1856 if (!NT_STATUS_IS_OK(status
))
1857 printf("close: error= (%s)\n", nt_errstr(status
));
1866 static NTSTATUS
cmd_sys_acl_get_fd(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1867 int argc
, const char **argv
)
1874 printf("Usage: sys_acl_get_fd <fd>\n");
1875 return NT_STATUS_OK
;
1879 if (fd
< 0 || fd
>= 1024) {
1880 printf("sys_acl_get_fd: error=%d (file descriptor out of range)\n", EBADF
);
1881 return NT_STATUS_OK
;
1883 if (vfs
->files
[fd
] == NULL
) {
1884 printf("sys_acl_get_fd: error=%d (invalid file descriptor)\n", EBADF
);
1885 return NT_STATUS_OK
;
1888 acl
= SMB_VFS_SYS_ACL_GET_FD(vfs
->files
[fd
],
1889 SMB_ACL_TYPE_ACCESS
,
1892 printf("sys_acl_get_fd failed (%s)\n", strerror(errno
));
1893 return NT_STATUS_UNSUCCESSFUL
;
1895 acl_text
= sys_acl_to_text(acl
, NULL
);
1896 printf("%s", acl_text
);
1898 SAFE_FREE(acl_text
);
1899 return NT_STATUS_OK
;
1902 static NTSTATUS
cmd_sys_acl_get_file(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
1903 int argc
, const char **argv
)
1908 struct smb_filename
*smb_fname
= NULL
;
1909 struct smb_filename
*pathref_fname
= NULL
;
1913 printf("Usage: sys_acl_get_file <path> <type>\n");
1914 return NT_STATUS_OK
;
1917 smb_fname
= synthetic_smb_fname_split(talloc_tos(),
1919 lp_posix_pathnames());
1920 if (smb_fname
== NULL
) {
1921 return NT_STATUS_NO_MEMORY
;
1923 type
= atoi(argv
[2]);
1925 status
= synthetic_pathref(mem_ctx
,
1927 smb_fname
->base_name
,
1933 if (!NT_STATUS_IS_OK(status
)) {
1934 TALLOC_FREE(smb_fname
);
1938 acl
= SMB_VFS_SYS_ACL_GET_FD(pathref_fname
->fsp
,
1939 type
, talloc_tos());
1941 printf("sys_acl_get_fd failed (%s)\n", strerror(errno
));
1942 TALLOC_FREE(smb_fname
);
1943 TALLOC_FREE(pathref_fname
);
1944 return NT_STATUS_UNSUCCESSFUL
;
1946 acl_text
= sys_acl_to_text(acl
, NULL
);
1947 printf("%s", acl_text
);
1949 TALLOC_FREE(smb_fname
);
1950 TALLOC_FREE(pathref_fname
);
1951 SAFE_FREE(acl_text
);
1952 return NT_STATUS_OK
;
1955 static NTSTATUS
cmd_sys_acl_blob_get_file(struct vfs_state
*vfs
,
1956 TALLOC_CTX
*mem_ctx
,
1957 int argc
, const char **argv
)
1963 struct smb_filename
*smb_fname
= NULL
;
1964 struct smb_filename
*pathref_fname
= NULL
;
1968 printf("Usage: sys_acl_blob_get_file <path>\n");
1969 return NT_STATUS_OK
;
1972 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
1974 lp_posix_pathnames());
1975 if (smb_fname
== NULL
) {
1976 return NT_STATUS_NO_MEMORY
;
1978 status
= synthetic_pathref(mem_ctx
,
1980 smb_fname
->base_name
,
1986 if (!NT_STATUS_IS_OK(status
)) {
1987 TALLOC_FREE(smb_fname
);
1991 ret
= SMB_VFS_SYS_ACL_BLOB_GET_FD(pathref_fname
->fsp
,
1996 status
= map_nt_error_from_unix(errno
);
1997 printf("sys_acl_blob_get_file failed (%s)\n", strerror(errno
));
1998 TALLOC_FREE(smb_fname
);
1999 TALLOC_FREE(pathref_fname
);
2002 printf("Description: %s\n", description
);
2003 for (i
= 0; i
< blob
.length
; i
++) {
2004 printf("%.2x ", blob
.data
[i
]);
2008 TALLOC_FREE(smb_fname
);
2009 TALLOC_FREE(pathref_fname
);
2010 return NT_STATUS_OK
;
2013 static NTSTATUS
cmd_sys_acl_blob_get_fd(struct vfs_state
*vfs
,
2014 TALLOC_CTX
*mem_ctx
,
2015 int argc
, const char **argv
)
2024 printf("Usage: sys_acl_blob_get_fd <fd>\n");
2025 return NT_STATUS_OK
;
2029 if (fd
< 0 || fd
>= 1024) {
2030 printf("sys_acl_blob_get_fd: error=%d "
2031 "(file descriptor out of range)\n", EBADF
);
2032 return NT_STATUS_OK
;
2034 if (vfs
->files
[fd
] == NULL
) {
2035 printf("sys_acl_blob_get_fd: error=%d "
2036 "(invalid file descriptor)\n", EBADF
);
2037 return NT_STATUS_OK
;
2040 ret
= SMB_VFS_SYS_ACL_BLOB_GET_FD(vfs
->files
[fd
], talloc_tos(),
2041 &description
, &blob
);
2043 printf("sys_acl_blob_get_fd failed (%s)\n", strerror(errno
));
2044 return map_nt_error_from_unix(errno
);
2046 printf("Description: %s\n", description
);
2047 for (i
= 0; i
< blob
.length
; i
++) {
2048 printf("%.2x ", blob
.data
[i
]);
2052 return NT_STATUS_OK
;
2057 static NTSTATUS
cmd_sys_acl_delete_def_file(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
2058 int argc
, const char **argv
)
2061 struct smb_filename
*smb_fname
= NULL
;
2062 struct smb_filename
*pathref_fname
= NULL
;
2066 printf("Usage: sys_acl_delete_def_file <path>\n");
2067 return NT_STATUS_OK
;
2070 smb_fname
= synthetic_smb_fname_split(mem_ctx
,
2072 lp_posix_pathnames());
2073 if (smb_fname
== NULL
) {
2074 return NT_STATUS_NO_MEMORY
;
2076 status
= synthetic_pathref(mem_ctx
,
2078 smb_fname
->base_name
,
2084 if (!NT_STATUS_IS_OK(status
)) {
2085 TALLOC_FREE(smb_fname
);
2088 if (!pathref_fname
->fsp
->fsp_flags
.is_directory
) {
2089 printf("sys_acl_delete_def_file - %s is not a directory\n",
2090 smb_fname
->base_name
);
2091 TALLOC_FREE(smb_fname
);
2092 TALLOC_FREE(pathref_fname
);
2093 return NT_STATUS_INVALID_PARAMETER
;
2095 ret
= SMB_VFS_SYS_ACL_DELETE_DEF_FD(pathref_fname
->fsp
);
2098 printf("sys_acl_delete_def_file failed (%s)\n", strerror(err
));
2099 TALLOC_FREE(smb_fname
);
2100 TALLOC_FREE(pathref_fname
);
2101 return map_nt_error_from_unix(err
);
2103 TALLOC_FREE(smb_fname
);
2104 TALLOC_FREE(pathref_fname
);
2105 return NT_STATUS_OK
;
2108 /* Afaik translate name was first introduced with vfs_catia, to be able
2109 to translate unix file/dir-names, containing invalid windows characters,
2110 to valid windows names.
2111 The used translation direction is always unix --> windows
2113 static NTSTATUS
cmd_translate_name(struct vfs_state
*vfs
, TALLOC_CTX
*mem_ctx
,
2114 int argc
, const char **argv
)
2116 const char *dname
= NULL
;
2117 char *dname_talloced
= NULL
;
2119 char *translated
= NULL
;
2120 struct smb_filename
*smb_fname
= NULL
;
2124 DEBUG(0, ("Usage: translate_name unix_filename\n"));
2125 return NT_STATUS_UNSUCCESSFUL
;
2128 smb_fname
= synthetic_smb_fname(talloc_tos(),
2134 if (smb_fname
== NULL
) {
2135 return NT_STATUS_NO_MEMORY
;
2138 status
= OpenDir(vfs
->conn
,
2144 if (!NT_STATUS_IS_OK(status
)) {
2145 int err
= map_errno_from_nt_status(status
);
2146 DEBUG(0, ("cmd_translate_name: opendir error=%d (%s)\n",
2147 err
, strerror(err
)));
2148 TALLOC_FREE(smb_fname
);
2150 return NT_STATUS_UNSUCCESSFUL
;
2154 /* ReadDirName() returns Windows "encoding" */
2155 dname
= ReadDirName(vfs
->currentdir
, &dname_talloced
);
2156 if (dname
== NULL
) {
2160 /* Convert Windows "encoding" from ReadDirName() to UNIX */
2161 status
= SMB_VFS_TRANSLATE_NAME(vfs
->conn
,
2163 vfs_translate_to_unix
,
2166 if (!NT_STATUS_IS_OK(status
)) {
2167 DBG_ERR("file '%s' cannot be translated\n", argv
[1]);
2172 * argv[1] uses UNIX "encoding", so compare with translation
2175 if (strcmp(translated
, argv
[1]) == 0) {
2179 TALLOC_FREE(dname_talloced
);
2180 TALLOC_FREE(translated
);
2184 DEBUG(0, ("cmd_translate_name: file '%s' not found.\n",
2186 status
= NT_STATUS_UNSUCCESSFUL
;
2190 /* translation success. But that could also mean
2191 that translating "aaa" to "aaa" was successful :-(
2193 DBG_ERR("file '%s' --> '%s'\n", argv
[1], dname
);
2194 status
= NT_STATUS_OK
;
2197 TALLOC_FREE(dname_talloced
);
2198 TALLOC_FREE(translated
);
2199 TALLOC_FREE(smb_fname
);
2200 TALLOC_FREE(vfs
->currentdir
);
2205 * This is a quick hack to demonstrate a crash in the full_audit
2206 * module when passing fsp->smb_fname into SMB_VFS_CREATE_FILE leading
2209 * Feel free to expand with more options as needed
2211 static NTSTATUS
cmd_create_file(
2212 struct vfs_state
*vfs
,
2213 TALLOC_CTX
*mem_ctx
,
2217 struct smb_filename
*fname
= NULL
;
2218 struct files_struct
*fsp
= NULL
;
2223 DBG_ERR("Usage: create_file filename\n");
2224 return NT_STATUS_UNSUCCESSFUL
;
2227 fname
= synthetic_smb_fname(
2228 talloc_tos(), argv
[1], NULL
, NULL
, 0, 0);
2229 if (fname
== NULL
) {
2230 return NT_STATUS_NO_MEMORY
;
2233 ret
= vfs_stat(vfs
->conn
, fname
);
2235 status
= map_nt_error_from_unix(errno
);
2236 DBG_DEBUG("vfs_stat() failed: %s\n", strerror(errno
));
2241 status
= openat_pathref_fsp(vfs
->conn
->cwd_fsp
, fname
);
2242 if (!NT_STATUS_IS_OK(status
)) {
2243 DBG_DEBUG("Could not open %s: %s\n",
2250 status
= SMB_VFS_CREATE_FILE(
2256 * Using fname->fsp->fsp_name seems to be legal,
2257 * there's code to handle this in
2258 * create_file_unixpath(). And it is actually very
2259 * worthwhile re-using the fsp_name, we can save quite
2260 * a few copies of smb_filename with that.
2262 fname
->fsp
->fsp_name
,
2266 FILE_NON_DIRECTORY_FILE
,
2279 DBG_DEBUG("create_file returned %s\n", nt_errstr(status
));
2283 return NT_STATUS_OK
;
2286 struct cmd_set vfs_commands
[] = {
2288 { .name
= "VFS Commands" },
2290 { "load", cmd_load_module
, "Load a module", "load <module.so>" },
2291 { "populate", cmd_populate
, "Populate a data buffer", "populate <char> <size>" },
2292 { "showdata", cmd_show_data
, "Show data currently in data buffer", "show_data [<offset> <len>]"},
2293 { "connect", cmd_connect
, "VFS connect()", "connect" },
2294 { "disconnect", cmd_disconnect
, "VFS disconnect()", "disconnect" },
2295 { "disk_free", cmd_disk_free
, "VFS disk_free()", "disk_free <path>" },
2296 { "opendir", cmd_opendir
, "VFS opendir()", "opendir <fname>" },
2297 { "readdir", cmd_readdir
, "VFS readdir()", "readdir" },
2298 { "mkdir", cmd_mkdir
, "VFS mkdir()", "mkdir <path>" },
2299 { "rmdir", cmd_pathfunc
, "VFS rmdir()", "rmdir <path>" },
2300 { "closedir", cmd_closedir
, "VFS closedir()", "closedir" },
2301 { "open", cmd_open
, "VFS open()", "open <fname> <flags> <mode>" },
2302 { "close", cmd_close
, "VFS close()", "close <fd>" },
2303 { "read", cmd_read
, "VFS read()", "read <fd> <size>" },
2304 { "write", cmd_write
, "VFS write()", "write <fd> <size>" },
2305 { "lseek", cmd_lseek
, "VFS lseek()", "lseek <fd> <offset> <whence>" },
2306 { "rename", cmd_rename
, "VFS rename()", "rename <old> <new>" },
2307 { "fsync", cmd_fsync
, "VFS fsync()", "fsync <fd>" },
2308 { "stat", cmd_stat
, "VFS stat()", "stat <fname>" },
2309 { "fstat", cmd_fstat
, "VFS fstat()", "fstat <fd>" },
2310 { "lstat", cmd_lstat
, "VFS lstat()", "lstat <fname>" },
2311 { "unlink", cmd_pathfunc
, "VFS unlink()", "unlink <fname>" },
2312 { "chmod", cmd_chmod
, "VFS chmod()", "chmod <path> <mode>" },
2313 { "fchmod", cmd_fchmod
, "VFS fchmod()", "fchmod <fd> <mode>" },
2314 { "fchown", cmd_fchown
, "VFS fchown()", "fchown <fd> <uid> <gid>" },
2315 { "chdir", cmd_pathfunc
, "VFS chdir()", "chdir <path>" },
2316 { "getwd", cmd_getwd
, "VFS getwd()", "getwd" },
2317 { "utime", cmd_utime
, "VFS utime()", "utime <path> <access> <modify>" },
2318 { "ftruncate", cmd_ftruncate
, "VFS ftruncate()", "ftruncate <fd> <length>" },
2319 { "lock", cmd_lock
, "VFS lock()", "lock <f> <op> <offset> <count> <type>" },
2320 { "symlink", cmd_symlink
, "VFS symlink()", "symlink <old> <new>" },
2321 { "readlink", cmd_readlink
, "VFS readlink()", "readlink <path>" },
2322 { "link", cmd_link
, "VFS link()", "link <oldpath> <newpath>" },
2323 { "mknod", cmd_mknod
, "VFS mknod()", "mknod <path> <mode> <dev>" },
2324 { "realpath", cmd_realpath
, "VFS realpath()", "realpath <path>" },
2325 { "getxattr", cmd_getxattr
, "VFS getxattr()",
2326 "getxattr <path> <name>" },
2327 { "listxattr", cmd_listxattr
, "VFS listxattr()",
2328 "listxattr <path>" },
2329 { "fsetxattr", cmd_fsetxattr
, "VFS fsetxattr()",
2330 "fsetxattr <path> <name> <value> [<flags>]" },
2331 { "removexattr", cmd_removexattr
, "VFS removexattr()",
2332 "removexattr <path> <name>\n" },
2333 { "fget_nt_acl", cmd_fget_nt_acl
, "VFS fget_nt_acl()",
2334 "fget_nt_acl <fd>\n" },
2335 { "get_nt_acl", cmd_get_nt_acl
, "VFS get_nt_acl()",
2336 "get_nt_acl <path>\n" },
2337 { "fset_nt_acl", cmd_fset_nt_acl
, "VFS fset_nt_acl()",
2338 "fset_nt_acl <fd>\n" },
2339 { "set_nt_acl", cmd_set_nt_acl
, "VFS open() and fset_nt_acl()",
2340 "set_nt_acl <file>\n" },
2341 { "sys_acl_get_file", cmd_sys_acl_get_file
, "VFS sys_acl_get_file()", "sys_acl_get_file <path>" },
2342 { "sys_acl_get_fd", cmd_sys_acl_get_fd
, "VFS sys_acl_get_fd()", "sys_acl_get_fd <fd>" },
2343 { "sys_acl_blob_get_file", cmd_sys_acl_blob_get_file
,
2344 "VFS sys_acl_blob_get_file()", "sys_acl_blob_get_file <path>" },
2345 { "sys_acl_blob_get_fd", cmd_sys_acl_blob_get_fd
,
2346 "VFS sys_acl_blob_get_fd()", "sys_acl_blob_get_fd <path>" },
2347 { "sys_acl_delete_def_file", cmd_sys_acl_delete_def_file
, "VFS sys_acl_delete_def_file()", "sys_acl_delete_def_file <path>" },
2350 #if defined(WITH_SMB1SERVER)
2351 { "test_chain", cmd_test_chain
, "test chain code",
2354 { "translate_name", cmd_translate_name
, "VFS translate_name()", "translate_name unix_filename" },
2357 "VFS create_file()",
2358 "create_file <filename>"