2 Unix SMB/CIFS implementation.
3 Set NT and POSIX ACLs and other VFS operations from Python
5 Copyrigyt (C) Andrew Bartlett 2012
6 Copyright (C) Jeremy Allison 1994-2009.
7 Copyright (C) Andreas Gruenbacher 2002.
8 Copyright (C) Simo Sorce <idra@samba.org> 2009.
9 Copyright (C) Simo Sorce 2002
10 Copyright (C) Eric Lorimer 2002
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #include "python/py3compat.h"
29 #include "python/modules.h"
30 #include "smbd/smbd.h"
31 #include "libcli/util/pyerrors.h"
32 #include "librpc/rpc/pyrpc_util.h"
34 #include "system/filesys.h"
39 extern const struct generic_mapping file_generic_mapping
;
42 #define DBGC_CLASS DBGC_ACLS
45 #define DIRECTORY_FLAGS O_RDONLY|O_DIRECTORY
47 /* POSIX allows us to open a directory with O_RDONLY. */
48 #define DIRECTORY_FLAGS O_RDONLY
52 static connection_struct
*get_conn_tos(
54 const struct auth_session_info
*session_info
)
56 struct conn_struct_tos
*c
= NULL
;
60 struct smb_filename cwd_fname
= {0};
63 if (!posix_locking_init(false)) {
69 snum
= lp_servicenumber(service
);
71 PyErr_SetString(PyExc_RuntimeError
, "unknown service");
77 * Make sure that session unix info is filled,
78 * which is required by vfs operations.
80 if (session_info
->unix_info
== NULL
) {
81 PyErr_SetString(PyExc_RuntimeError
,
82 "Session unix info not initialized");
85 if (session_info
->unix_info
->unix_name
== NULL
) {
86 PyErr_SetString(PyExc_RuntimeError
,
87 "Session unix info not available");
91 status
= create_conn_struct_tos(NULL
,
96 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
98 /* Ignore read-only and share restrictions */
99 c
->conn
->read_only
= false;
100 c
->conn
->share_access
= SEC_RIGHTS_FILE_ALL
;
102 /* Provided by libreplace if not present. Always mallocs. */
103 cwd
= get_current_dir_name();
109 cwd_fname
.base_name
= cwd
;
111 * We need to call vfs_ChDir() to initialize
112 * conn->cwd_fsp correctly. Change directory
113 * to current directory (so no change for process).
115 ret
= vfs_ChDir(c
->conn
, &cwd_fname
);
117 status
= map_nt_error_from_unix(errno
);
119 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
127 static int set_sys_acl_conn(const char *fname
,
128 SMB_ACL_TYPE_T acltype
,
129 SMB_ACL_T theacl
, connection_struct
*conn
)
132 struct smb_filename
*smb_fname
= NULL
;
133 TALLOC_CTX
*frame
= talloc_stackframe();
136 smb_fname
= synthetic_smb_fname_split(frame
,
138 lp_posix_pathnames());
139 if (smb_fname
== NULL
) {
144 ret
= vfs_stat(conn
, smb_fname
);
150 status
= openat_pathref_fsp(conn
->cwd_fsp
, smb_fname
);
151 if (!NT_STATUS_IS_OK(status
)) {
153 errno
= map_errno_from_nt_status(status
);
157 ret
= SMB_VFS_SYS_ACL_SET_FD(smb_fname
->fsp
, acltype
, theacl
);
164 static NTSTATUS
init_files_struct(TALLOC_CTX
*mem_ctx
,
166 struct connection_struct
*conn
,
168 struct files_struct
**_fsp
)
170 struct smb_filename
*smb_fname
= NULL
;
174 struct files_struct
*fsp
;
175 struct files_struct
*fspcwd
= NULL
;
178 fsp
= talloc_zero(mem_ctx
, struct files_struct
);
180 return NT_STATUS_NO_MEMORY
;
182 fsp
->fh
= fd_handle_create(fsp
);
183 if (fsp
->fh
== NULL
) {
184 return NT_STATUS_NO_MEMORY
;
188 smb_fname
= synthetic_smb_fname_split(fsp
,
190 lp_posix_pathnames());
191 if (smb_fname
== NULL
) {
192 return NT_STATUS_NO_MEMORY
;
195 fsp
->fsp_name
= smb_fname
;
197 status
= vfs_at_fspcwd(fsp
, conn
, &fspcwd
);
198 if (!NT_STATUS_IS_OK(status
)) {
203 * we want total control over the permissions on created files,
204 * so set our umask to 0 (this matters if flags contains O_CREAT)
206 saved_umask
= umask(0);
208 fd
= SMB_VFS_OPENAT(conn
,
220 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
222 return NT_STATUS_INVALID_PARAMETER
;
226 ret
= SMB_VFS_FSTAT(fsp
, &smb_fname
->st
);
228 /* If we have an fd, this stat should succeed. */
229 DEBUG(0,("Error doing fstat on open file %s (%s)\n",
230 smb_fname_str_dbg(smb_fname
),
232 return map_nt_error_from_unix(errno
);
235 fsp
->file_id
= vfs_file_id_from_sbuf(conn
, &smb_fname
->st
);
236 fsp
->vuid
= UID_FIELD_INVALID
;
238 fsp
->fsp_flags
.can_lock
= true;
239 fsp
->fsp_flags
.can_read
= true;
240 fsp
->fsp_flags
.can_write
= true;
241 fsp
->print_file
= NULL
;
242 fsp
->fsp_flags
.modified
= false;
243 fsp
->sent_oplock_break
= NO_BREAK_SENT
;
244 fsp
->fsp_flags
.is_directory
= S_ISDIR(smb_fname
->st
.st_ex_mode
);
251 static NTSTATUS
set_nt_acl_conn(const char *fname
,
252 uint32_t security_info_sent
, const struct security_descriptor
*sd
,
253 connection_struct
*conn
)
255 TALLOC_CTX
*frame
= talloc_stackframe();
256 struct files_struct
*fsp
= NULL
;
257 NTSTATUS status
= NT_STATUS_OK
;
259 /* first, try to open it as a file with flag O_RDWR */
260 status
= init_files_struct(frame
,
265 if (!NT_STATUS_IS_OK(status
) && errno
== EISDIR
) {
266 /* if fail, try to open as dir */
267 status
= init_files_struct(frame
,
274 if (!NT_STATUS_IS_OK(status
)) {
275 DBG_ERR("init_files_struct failed: %s\n",
284 status
= SMB_VFS_FSET_NT_ACL(fsp
, security_info_sent
, sd
);
285 if (!NT_STATUS_IS_OK(status
)) {
286 DEBUG(0,("set_nt_acl_no_snum: fset_nt_acl returned %s.\n", nt_errstr(status
)));
295 static NTSTATUS
get_nt_acl_conn(TALLOC_CTX
*mem_ctx
,
297 connection_struct
*conn
,
298 uint32_t security_info_wanted
,
299 struct security_descriptor
**sd
)
301 TALLOC_CTX
*frame
= talloc_stackframe();
303 struct smb_filename
*smb_fname
= synthetic_smb_fname(talloc_tos(),
308 lp_posix_pathnames() ?
309 SMB_FILENAME_POSIX_PATH
: 0);
311 if (smb_fname
== NULL
) {
313 return NT_STATUS_NO_MEMORY
;
316 status
= SMB_VFS_GET_NT_ACL_AT(conn
,
319 security_info_wanted
,
322 if (!NT_STATUS_IS_OK(status
)) {
323 DBG_ERR("get_nt_acl_at returned %s.\n",
332 static int set_acl_entry_perms(SMB_ACL_ENTRY_T entry
, mode_t perm_mask
)
334 SMB_ACL_PERMSET_T perms
= NULL
;
336 if (sys_acl_get_permset(entry
, &perms
) != 0) {
340 if (sys_acl_clear_perms(perms
) != 0) {
344 if ((perm_mask
& SMB_ACL_READ
) != 0 &&
345 sys_acl_add_perm(perms
, SMB_ACL_READ
) != 0) {
349 if ((perm_mask
& SMB_ACL_WRITE
) != 0 &&
350 sys_acl_add_perm(perms
, SMB_ACL_WRITE
) != 0) {
354 if ((perm_mask
& SMB_ACL_EXECUTE
) != 0 &&
355 sys_acl_add_perm(perms
, SMB_ACL_EXECUTE
) != 0) {
359 if (sys_acl_set_permset(entry
, perms
) != 0) {
366 static SMB_ACL_T
make_simple_acl(TALLOC_CTX
*mem_ctx
,
370 mode_t mode
= SMB_ACL_READ
|SMB_ACL_WRITE
|SMB_ACL_EXECUTE
;
372 mode_t mode_user
= (chmod_mode
& 0700) >> 6;
373 mode_t mode_group
= (chmod_mode
& 070) >> 3;
374 mode_t mode_other
= chmod_mode
& 07;
375 SMB_ACL_ENTRY_T entry
;
376 SMB_ACL_T acl
= sys_acl_init(mem_ctx
);
382 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
387 if (sys_acl_set_tag_type(entry
, SMB_ACL_USER_OBJ
) != 0) {
392 if (set_acl_entry_perms(entry
, mode_user
) != 0) {
397 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
402 if (sys_acl_set_tag_type(entry
, SMB_ACL_GROUP_OBJ
) != 0) {
407 if (set_acl_entry_perms(entry
, mode_group
) != 0) {
412 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
417 if (sys_acl_set_tag_type(entry
, SMB_ACL_OTHER
) != 0) {
422 if (set_acl_entry_perms(entry
, mode_other
) != 0) {
428 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
433 if (sys_acl_set_tag_type(entry
, SMB_ACL_GROUP
) != 0) {
438 if (sys_acl_set_qualifier(entry
, &gid
) != 0) {
443 if (set_acl_entry_perms(entry
, mode_group
) != 0) {
449 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
454 if (sys_acl_set_tag_type(entry
, SMB_ACL_MASK
) != 0) {
459 if (set_acl_entry_perms(entry
, mode
) != 0) {
468 set a simple ACL on a file, as a test
470 static PyObject
*py_smbd_set_simple_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
472 const char * const kwnames
[] = {
480 char *fname
, *service
= NULL
;
481 PyObject
*py_session
= Py_None
;
482 struct auth_session_info
*session_info
= NULL
;
487 connection_struct
*conn
;
489 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siO|iz",
490 discard_const_p(char *, kwnames
),
498 if (!py_check_dcerpc_type(py_session
,
503 session_info
= pytalloc_get_type(py_session
,
504 struct auth_session_info
);
505 if (session_info
== NULL
) {
506 PyErr_Format(PyExc_TypeError
,
507 "Expected auth_session_info for session_info argument got %s",
508 pytalloc_get_name(py_session
));
512 frame
= talloc_stackframe();
514 acl
= make_simple_acl(frame
, gid
, mode
);
520 conn
= get_conn_tos(service
, session_info
);
526 ret
= set_sys_acl_conn(fname
, SMB_ACL_TYPE_ACCESS
, acl
, conn
);
531 return PyErr_SetFromErrno(PyExc_OSError
);
542 static PyObject
*py_smbd_chown(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
544 const char * const kwnames
[] = {
552 connection_struct
*conn
;
555 char *fname
, *service
= NULL
;
556 PyObject
*py_session
= Py_None
;
557 struct auth_session_info
*session_info
= NULL
;
560 struct files_struct
*fsp
= NULL
;
562 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siiO|z",
563 discard_const_p(char *, kwnames
),
571 if (!py_check_dcerpc_type(py_session
,
576 session_info
= pytalloc_get_type(py_session
,
577 struct auth_session_info
);
578 if (session_info
== NULL
) {
579 PyErr_Format(PyExc_TypeError
,
580 "Expected auth_session_info for session_info argument got %s",
581 pytalloc_get_name(py_session
));
585 frame
= talloc_stackframe();
587 conn
= get_conn_tos(service
, session_info
);
593 /* first, try to open it as a file with flag O_RDWR */
594 status
= init_files_struct(frame
,
599 if (!NT_STATUS_IS_OK(status
) && errno
== EISDIR
) {
600 /* if fail, try to open as dir */
601 status
= init_files_struct(frame
,
608 if (!NT_STATUS_IS_OK(status
)) {
609 DBG_ERR("init_files_struct failed: %s\n",
616 * The following macro raises a python
617 * error then returns NULL.
619 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
622 ret
= SMB_VFS_FCHOWN(fsp
, uid
, gid
);
624 int saved_errno
= errno
;
628 return PyErr_SetFromErrno(PyExc_OSError
);
640 static PyObject
*py_smbd_unlink(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
642 const char * const kwnames
[] = {
648 connection_struct
*conn
;
650 struct smb_filename
*smb_fname
= NULL
;
651 PyObject
*py_session
= Py_None
;
652 struct auth_session_info
*session_info
= NULL
;
653 char *fname
, *service
= NULL
;
656 frame
= talloc_stackframe();
658 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "sO|z",
659 discard_const_p(char *, kwnames
),
667 if (!py_check_dcerpc_type(py_session
,
673 session_info
= pytalloc_get_type(py_session
,
674 struct auth_session_info
);
675 if (session_info
== NULL
) {
676 PyErr_Format(PyExc_TypeError
,
677 "Expected auth_session_info for session_info argument got %s",
678 pytalloc_get_name(py_session
));
683 conn
= get_conn_tos(service
, session_info
);
689 smb_fname
= synthetic_smb_fname_split(frame
,
691 lp_posix_pathnames());
692 if (smb_fname
== NULL
) {
694 return PyErr_NoMemory();
697 ret
= SMB_VFS_UNLINKAT(conn
,
704 return PyErr_SetFromErrno(PyExc_OSError
);
713 check if we have ACL support
715 static PyObject
*py_smbd_have_posix_acls(PyObject
*self
,
716 PyObject
*Py_UNUSED(ignored
))
718 #ifdef HAVE_POSIX_ACLS
719 return PyBool_FromLong(true);
721 return PyBool_FromLong(false);
726 set the NT ACL on a file
728 static PyObject
*py_smbd_set_nt_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
730 const char * const kwnames
[] = {
732 "security_info_sent",
740 char *fname
, *service
= NULL
;
741 int security_info_sent
;
743 struct security_descriptor
*sd
;
744 PyObject
*py_session
= Py_None
;
745 struct auth_session_info
*session_info
= NULL
;
746 connection_struct
*conn
;
749 frame
= talloc_stackframe();
751 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siOO|z",
752 discard_const_p(char *, kwnames
),
762 if (!py_check_dcerpc_type(py_sd
, "samba.dcerpc.security", "descriptor")) {
767 if (!py_check_dcerpc_type(py_session
,
773 session_info
= pytalloc_get_type(py_session
,
774 struct auth_session_info
);
775 if (session_info
== NULL
) {
776 PyErr_Format(PyExc_TypeError
,
777 "Expected auth_session_info for session_info argument got %s",
778 pytalloc_get_name(py_session
));
782 conn
= get_conn_tos(service
, session_info
);
788 sd
= pytalloc_get_type(py_sd
, struct security_descriptor
);
790 status
= set_nt_acl_conn(fname
, security_info_sent
, sd
, conn
);
792 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
798 Return the NT ACL on a file
800 static PyObject
*py_smbd_get_nt_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
802 const char * const kwnames
[] = {
804 "security_info_wanted",
809 char *fname
, *service
= NULL
;
810 int security_info_wanted
;
812 struct security_descriptor
*sd
;
813 TALLOC_CTX
*frame
= talloc_stackframe();
814 PyObject
*py_session
= Py_None
;
815 struct auth_session_info
*session_info
= NULL
;
816 connection_struct
*conn
;
820 ret
= PyArg_ParseTupleAndKeywords(args
,
823 discard_const_p(char *, kwnames
),
825 &security_info_wanted
,
833 if (!py_check_dcerpc_type(py_session
,
839 session_info
= pytalloc_get_type(py_session
,
840 struct auth_session_info
);
841 if (session_info
== NULL
) {
844 "Expected auth_session_info for "
845 "session_info argument got %s",
846 pytalloc_get_name(py_session
));
850 conn
= get_conn_tos(service
, session_info
);
856 status
= get_nt_acl_conn(frame
, fname
, conn
, security_info_wanted
, &sd
);
857 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
859 py_sd
= py_return_ndr_struct("samba.dcerpc.security", "descriptor", sd
, sd
);
867 set the posix (or similar) ACL on a file
869 static PyObject
*py_smbd_set_sys_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
871 const char * const kwnames
[] = {
879 TALLOC_CTX
*frame
= talloc_stackframe();
881 char *fname
, *service
= NULL
;
883 PyObject
*py_session
= Py_None
;
884 struct auth_session_info
*session_info
= NULL
;
885 struct smb_acl_t
*acl
;
887 connection_struct
*conn
;
889 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siOO|z",
890 discard_const_p(char *, kwnames
),
900 if (!py_check_dcerpc_type(py_acl
, "samba.dcerpc.smb_acl", "t")) {
905 if (!py_check_dcerpc_type(py_session
,
911 session_info
= pytalloc_get_type(py_session
,
912 struct auth_session_info
);
913 if (session_info
== NULL
) {
914 PyErr_Format(PyExc_TypeError
,
915 "Expected auth_session_info for session_info argument got %s",
916 pytalloc_get_name(py_session
));
921 conn
= get_conn_tos(service
, session_info
);
927 acl
= pytalloc_get_type(py_acl
, struct smb_acl_t
);
929 ret
= set_sys_acl_conn(fname
, acl_type
, acl
, conn
);
933 return PyErr_SetFromErrno(PyExc_OSError
);
941 Return the posix (or similar) ACL on a file
943 static PyObject
*py_smbd_get_sys_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
945 const char * const kwnames
[] = {
954 PyObject
*py_session
= Py_None
;
955 struct auth_session_info
*session_info
= NULL
;
956 struct smb_acl_t
*acl
;
958 TALLOC_CTX
*frame
= talloc_stackframe();
959 connection_struct
*conn
;
960 char *service
= NULL
;
961 struct smb_filename
*smb_fname
= NULL
;
963 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siO|z",
964 discard_const_p(char *, kwnames
),
973 if (!py_check_dcerpc_type(py_session
,
979 session_info
= pytalloc_get_type(py_session
,
980 struct auth_session_info
);
981 if (session_info
== NULL
) {
982 PyErr_Format(PyExc_TypeError
,
983 "Expected auth_session_info for session_info argument got %s",
984 pytalloc_get_name(py_session
));
989 conn
= get_conn_tos(service
, session_info
);
995 smb_fname
= synthetic_smb_fname_split(frame
,
997 lp_posix_pathnames());
998 if (smb_fname
== NULL
) {
1002 acl
= SMB_VFS_SYS_ACL_GET_FILE( conn
, smb_fname
, acl_type
, frame
);
1005 return PyErr_SetFromErrno(PyExc_OSError
);
1008 py_acl
= py_return_ndr_struct("samba.dcerpc.smb_acl", "t", acl
, acl
);
1015 static PyObject
*py_smbd_mkdir(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
1017 const char * const kwnames
[] = {
1023 char *fname
, *service
= NULL
;
1024 PyObject
*py_session
= Py_None
;
1025 struct auth_session_info
*session_info
= NULL
;
1026 TALLOC_CTX
*frame
= talloc_stackframe();
1027 struct connection_struct
*conn
= NULL
;
1028 struct smb_filename
*smb_fname
= NULL
;
1029 struct smb_filename
*parent_fname
= NULL
;
1030 struct smb_filename
*base_name
= NULL
;
1036 if (!PyArg_ParseTupleAndKeywords(args
,
1039 discard_const_p(char *,
1048 if (!py_check_dcerpc_type(py_session
,
1049 "samba.dcerpc.auth",
1054 session_info
= pytalloc_get_type(py_session
,
1055 struct auth_session_info
);
1056 if (session_info
== NULL
) {
1057 PyErr_Format(PyExc_TypeError
,
1058 "Expected auth_session_info for session_info argument got %s",
1059 pytalloc_get_name(py_session
));
1064 conn
= get_conn_tos(service
, session_info
);
1070 smb_fname
= synthetic_smb_fname(talloc_tos(),
1075 lp_posix_pathnames() ?
1076 SMB_FILENAME_POSIX_PATH
: 0);
1078 if (smb_fname
== NULL
) {
1083 ok
= parent_smb_fname(frame
,
1092 ret
= vfs_stat(conn
, parent_fname
);
1097 status
= openat_pathref_fsp(conn
->cwd_fsp
, parent_fname
);
1098 if (!NT_STATUS_IS_OK(status
)) {
1103 /* we want total control over the permissions on created files,
1104 so set our umask to 0 */
1105 saved_umask
= umask(0);
1107 ret
= SMB_VFS_MKDIRAT(conn
,
1115 DBG_ERR("mkdirat error=%d (%s)\n", errno
, strerror(errno
));
1126 Create an empty file
1128 static PyObject
*py_smbd_create_file(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
1130 const char * const kwnames
[] = {
1136 char *fname
, *service
= NULL
;
1137 PyObject
*py_session
= Py_None
;
1138 struct auth_session_info
*session_info
= NULL
;
1139 TALLOC_CTX
*frame
= talloc_stackframe();
1140 struct connection_struct
*conn
= NULL
;
1141 struct files_struct
*fsp
= NULL
;
1144 if (!PyArg_ParseTupleAndKeywords(args
,
1147 discard_const_p(char *,
1156 if (!py_check_dcerpc_type(py_session
,
1157 "samba.dcerpc.auth",
1162 session_info
= pytalloc_get_type(py_session
,
1163 struct auth_session_info
);
1164 if (session_info
== NULL
) {
1165 PyErr_Format(PyExc_TypeError
,
1166 "Expected auth_session_info for session_info argument got %s",
1167 pytalloc_get_name(py_session
));
1172 conn
= get_conn_tos(service
, session_info
);
1178 status
= init_files_struct(frame
,
1181 O_CREAT
|O_EXCL
|O_RDWR
,
1183 if (!NT_STATUS_IS_OK(status
)) {
1184 DBG_ERR("init_files_struct failed: %s\n",
1186 } else if (fsp
!= NULL
) {
1191 PyErr_NTSTATUS_NOT_OK_RAISE(status
);
1196 static PyMethodDef py_smbd_methods
[] = {
1197 { "have_posix_acls",
1198 (PyCFunction
)py_smbd_have_posix_acls
, METH_NOARGS
,
1201 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_simple_acl
),
1202 METH_VARARGS
|METH_KEYWORDS
,
1205 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_nt_acl
),
1206 METH_VARARGS
|METH_KEYWORDS
,
1209 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_get_nt_acl
),
1210 METH_VARARGS
|METH_KEYWORDS
,
1213 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_get_sys_acl
),
1214 METH_VARARGS
|METH_KEYWORDS
,
1217 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_sys_acl
),
1218 METH_VARARGS
|METH_KEYWORDS
,
1221 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_chown
),
1222 METH_VARARGS
|METH_KEYWORDS
,
1225 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_unlink
),
1226 METH_VARARGS
|METH_KEYWORDS
,
1229 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_mkdir
),
1230 METH_VARARGS
|METH_KEYWORDS
,
1233 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_create_file
),
1234 METH_VARARGS
|METH_KEYWORDS
,
1239 void initsmbd(void);
1241 static struct PyModuleDef moduledef
= {
1242 PyModuleDef_HEAD_INIT
,
1244 .m_doc
= "Python bindings for the smbd file server.",
1246 .m_methods
= py_smbd_methods
,
1249 MODULE_INIT_FUNC(smbd
)
1253 m
= PyModule_Create(&moduledef
);