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
;
134 TALLOC_CTX
*frame
= talloc_stackframe();
136 smb_fname
= synthetic_smb_fname_split(frame
,
138 lp_posix_pathnames());
139 if (smb_fname
== NULL
) {
144 ret
= SMB_VFS_SYS_ACL_SET_FILE( conn
, smb_fname
, acltype
, theacl
);
151 static NTSTATUS
init_files_struct(TALLOC_CTX
*mem_ctx
,
153 struct connection_struct
*conn
,
155 struct files_struct
**_fsp
)
157 struct smb_filename
*smb_fname
= NULL
;
160 struct files_struct
*fsp
;
161 struct files_struct
*fspcwd
= NULL
;
164 fsp
= talloc_zero(mem_ctx
, struct files_struct
);
166 return NT_STATUS_NO_MEMORY
;
168 fsp
->fh
= talloc(fsp
, struct fd_handle
);
169 if (fsp
->fh
== NULL
) {
170 return NT_STATUS_NO_MEMORY
;
174 smb_fname
= synthetic_smb_fname_split(fsp
,
176 lp_posix_pathnames());
177 if (smb_fname
== NULL
) {
178 return NT_STATUS_NO_MEMORY
;
181 fsp
->fsp_name
= smb_fname
;
183 status
= vfs_at_fspcwd(fsp
, conn
, &fspcwd
);
184 if (!NT_STATUS_IS_OK(status
)) {
189 * we want total control over the permissions on created files,
190 * so set our umask to 0 (this matters if flags contains O_CREAT)
192 saved_umask
= umask(0);
194 fsp
->fh
->fd
= SMB_VFS_OPENAT(conn
,
203 if (fsp
->fh
->fd
== -1) {
206 return NT_STATUS_OBJECT_NAME_NOT_FOUND
;
208 return NT_STATUS_INVALID_PARAMETER
;
211 ret
= SMB_VFS_FSTAT(fsp
, &smb_fname
->st
);
213 /* If we have an fd, this stat should succeed. */
214 DEBUG(0,("Error doing fstat on open file %s (%s)\n",
215 smb_fname_str_dbg(smb_fname
),
217 return map_nt_error_from_unix(errno
);
220 fsp
->file_id
= vfs_file_id_from_sbuf(conn
, &smb_fname
->st
);
221 fsp
->vuid
= UID_FIELD_INVALID
;
223 fsp
->fsp_flags
.can_lock
= true;
224 fsp
->fsp_flags
.can_read
= true;
225 fsp
->fsp_flags
.can_write
= true;
226 fsp
->print_file
= NULL
;
227 fsp
->fsp_flags
.modified
= false;
228 fsp
->sent_oplock_break
= NO_BREAK_SENT
;
229 fsp
->fsp_flags
.is_directory
= S_ISDIR(smb_fname
->st
.st_ex_mode
);
236 static NTSTATUS
set_nt_acl_conn(const char *fname
,
237 uint32_t security_info_sent
, const struct security_descriptor
*sd
,
238 connection_struct
*conn
)
240 TALLOC_CTX
*frame
= talloc_stackframe();
241 struct files_struct
*fsp
= NULL
;
242 NTSTATUS status
= NT_STATUS_OK
;
244 /* first, try to open it as a file with flag O_RDWR */
245 status
= init_files_struct(frame
,
250 if (!NT_STATUS_IS_OK(status
) && errno
== EISDIR
) {
251 /* if fail, try to open as dir */
252 status
= init_files_struct(frame
,
259 if (!NT_STATUS_IS_OK(status
)) {
260 DBG_ERR("init_files_struct failed: %s\n",
269 status
= SMB_VFS_FSET_NT_ACL(fsp
, security_info_sent
, sd
);
270 if (!NT_STATUS_IS_OK(status
)) {
271 DEBUG(0,("set_nt_acl_no_snum: fset_nt_acl returned %s.\n", nt_errstr(status
)));
280 static NTSTATUS
get_nt_acl_conn(TALLOC_CTX
*mem_ctx
,
282 connection_struct
*conn
,
283 uint32_t security_info_wanted
,
284 struct security_descriptor
**sd
)
286 TALLOC_CTX
*frame
= talloc_stackframe();
288 struct smb_filename
*smb_fname
= synthetic_smb_fname(talloc_tos(),
293 lp_posix_pathnames() ?
294 SMB_FILENAME_POSIX_PATH
: 0);
296 if (smb_fname
== NULL
) {
298 return NT_STATUS_NO_MEMORY
;
301 status
= SMB_VFS_GET_NT_ACL_AT(conn
,
304 security_info_wanted
,
307 if (!NT_STATUS_IS_OK(status
)) {
308 DBG_ERR("get_nt_acl_at returned %s.\n",
317 static int set_acl_entry_perms(SMB_ACL_ENTRY_T entry
, mode_t perm_mask
)
319 SMB_ACL_PERMSET_T perms
= NULL
;
321 if (sys_acl_get_permset(entry
, &perms
) != 0) {
325 if (sys_acl_clear_perms(perms
) != 0) {
329 if ((perm_mask
& SMB_ACL_READ
) != 0 &&
330 sys_acl_add_perm(perms
, SMB_ACL_READ
) != 0) {
334 if ((perm_mask
& SMB_ACL_WRITE
) != 0 &&
335 sys_acl_add_perm(perms
, SMB_ACL_WRITE
) != 0) {
339 if ((perm_mask
& SMB_ACL_EXECUTE
) != 0 &&
340 sys_acl_add_perm(perms
, SMB_ACL_EXECUTE
) != 0) {
344 if (sys_acl_set_permset(entry
, perms
) != 0) {
351 static SMB_ACL_T
make_simple_acl(TALLOC_CTX
*mem_ctx
,
355 mode_t mode
= SMB_ACL_READ
|SMB_ACL_WRITE
|SMB_ACL_EXECUTE
;
357 mode_t mode_user
= (chmod_mode
& 0700) >> 6;
358 mode_t mode_group
= (chmod_mode
& 070) >> 3;
359 mode_t mode_other
= chmod_mode
& 07;
360 SMB_ACL_ENTRY_T entry
;
361 SMB_ACL_T acl
= sys_acl_init(mem_ctx
);
367 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
372 if (sys_acl_set_tag_type(entry
, SMB_ACL_USER_OBJ
) != 0) {
377 if (set_acl_entry_perms(entry
, mode_user
) != 0) {
382 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
387 if (sys_acl_set_tag_type(entry
, SMB_ACL_GROUP_OBJ
) != 0) {
392 if (set_acl_entry_perms(entry
, mode_group
) != 0) {
397 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
402 if (sys_acl_set_tag_type(entry
, SMB_ACL_OTHER
) != 0) {
407 if (set_acl_entry_perms(entry
, mode_other
) != 0) {
413 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
418 if (sys_acl_set_tag_type(entry
, SMB_ACL_GROUP
) != 0) {
423 if (sys_acl_set_qualifier(entry
, &gid
) != 0) {
428 if (set_acl_entry_perms(entry
, mode_group
) != 0) {
434 if (sys_acl_create_entry(&acl
, &entry
) != 0) {
439 if (sys_acl_set_tag_type(entry
, SMB_ACL_MASK
) != 0) {
444 if (set_acl_entry_perms(entry
, mode
) != 0) {
453 set a simple ACL on a file, as a test
455 static PyObject
*py_smbd_set_simple_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
457 const char * const kwnames
[] = {
465 char *fname
, *service
= NULL
;
466 PyObject
*py_session
= Py_None
;
467 struct auth_session_info
*session_info
= NULL
;
472 connection_struct
*conn
;
474 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siO|iz",
475 discard_const_p(char *, kwnames
),
483 if (!py_check_dcerpc_type(py_session
,
488 session_info
= pytalloc_get_type(py_session
,
489 struct auth_session_info
);
490 if (session_info
== NULL
) {
491 PyErr_Format(PyExc_TypeError
,
492 "Expected auth_session_info for session_info argument got %s",
493 pytalloc_get_name(py_session
));
497 frame
= talloc_stackframe();
499 acl
= make_simple_acl(frame
, gid
, mode
);
505 conn
= get_conn_tos(service
, session_info
);
511 ret
= set_sys_acl_conn(fname
, SMB_ACL_TYPE_ACCESS
, acl
, conn
);
516 return PyErr_SetFromErrno(PyExc_OSError
);
527 static PyObject
*py_smbd_chown(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
529 const char * const kwnames
[] = {
537 connection_struct
*conn
;
540 char *fname
, *service
= NULL
;
541 PyObject
*py_session
= Py_None
;
542 struct auth_session_info
*session_info
= NULL
;
545 struct files_struct
*fsp
= NULL
;
547 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siiO|z",
548 discard_const_p(char *, kwnames
),
556 if (!py_check_dcerpc_type(py_session
,
561 session_info
= pytalloc_get_type(py_session
,
562 struct auth_session_info
);
563 if (session_info
== NULL
) {
564 PyErr_Format(PyExc_TypeError
,
565 "Expected auth_session_info for session_info argument got %s",
566 pytalloc_get_name(py_session
));
570 frame
= talloc_stackframe();
572 conn
= get_conn_tos(service
, session_info
);
578 /* first, try to open it as a file with flag O_RDWR */
579 status
= init_files_struct(frame
,
584 if (!NT_STATUS_IS_OK(status
) && errno
== EISDIR
) {
585 /* if fail, try to open as dir */
586 status
= init_files_struct(frame
,
593 if (!NT_STATUS_IS_OK(status
)) {
594 DBG_ERR("init_files_struct failed: %s\n",
601 * The following macro raises a python
602 * error then returns NULL.
604 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
607 ret
= SMB_VFS_FCHOWN(fsp
, uid
, gid
);
609 int saved_errno
= errno
;
613 return PyErr_SetFromErrno(PyExc_OSError
);
625 static PyObject
*py_smbd_unlink(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
627 const char * const kwnames
[] = {
633 connection_struct
*conn
;
635 struct smb_filename
*smb_fname
= NULL
;
636 PyObject
*py_session
= Py_None
;
637 struct auth_session_info
*session_info
= NULL
;
638 char *fname
, *service
= NULL
;
641 frame
= talloc_stackframe();
643 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "sO|z",
644 discard_const_p(char *, kwnames
),
652 if (!py_check_dcerpc_type(py_session
,
658 session_info
= pytalloc_get_type(py_session
,
659 struct auth_session_info
);
660 if (session_info
== NULL
) {
661 PyErr_Format(PyExc_TypeError
,
662 "Expected auth_session_info for session_info argument got %s",
663 pytalloc_get_name(py_session
));
668 conn
= get_conn_tos(service
, session_info
);
674 smb_fname
= synthetic_smb_fname_split(frame
,
676 lp_posix_pathnames());
677 if (smb_fname
== NULL
) {
679 return PyErr_NoMemory();
682 ret
= SMB_VFS_UNLINKAT(conn
,
689 return PyErr_SetFromErrno(PyExc_OSError
);
698 check if we have ACL support
700 static PyObject
*py_smbd_have_posix_acls(PyObject
*self
,
701 PyObject
*Py_UNUSED(ignored
))
703 #ifdef HAVE_POSIX_ACLS
704 return PyBool_FromLong(true);
706 return PyBool_FromLong(false);
711 set the NT ACL on a file
713 static PyObject
*py_smbd_set_nt_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
715 const char * const kwnames
[] = {
717 "security_info_sent",
725 char *fname
, *service
= NULL
;
726 int security_info_sent
;
728 struct security_descriptor
*sd
;
729 PyObject
*py_session
= Py_None
;
730 struct auth_session_info
*session_info
= NULL
;
731 connection_struct
*conn
;
734 frame
= talloc_stackframe();
736 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siOO|z",
737 discard_const_p(char *, kwnames
),
747 if (!py_check_dcerpc_type(py_sd
, "samba.dcerpc.security", "descriptor")) {
752 if (!py_check_dcerpc_type(py_session
,
758 session_info
= pytalloc_get_type(py_session
,
759 struct auth_session_info
);
760 if (session_info
== NULL
) {
761 PyErr_Format(PyExc_TypeError
,
762 "Expected auth_session_info for session_info argument got %s",
763 pytalloc_get_name(py_session
));
767 conn
= get_conn_tos(service
, session_info
);
773 sd
= pytalloc_get_type(py_sd
, struct security_descriptor
);
775 status
= set_nt_acl_conn(fname
, security_info_sent
, sd
, conn
);
777 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
783 Return the NT ACL on a file
785 static PyObject
*py_smbd_get_nt_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
787 const char * const kwnames
[] = {
789 "security_info_wanted",
794 char *fname
, *service
= NULL
;
795 int security_info_wanted
;
797 struct security_descriptor
*sd
;
798 TALLOC_CTX
*frame
= talloc_stackframe();
799 PyObject
*py_session
= Py_None
;
800 struct auth_session_info
*session_info
= NULL
;
801 connection_struct
*conn
;
805 ret
= PyArg_ParseTupleAndKeywords(args
,
808 discard_const_p(char *, kwnames
),
810 &security_info_wanted
,
818 if (!py_check_dcerpc_type(py_session
,
824 session_info
= pytalloc_get_type(py_session
,
825 struct auth_session_info
);
826 if (session_info
== NULL
) {
829 "Expected auth_session_info for "
830 "session_info argument got %s",
831 pytalloc_get_name(py_session
));
835 conn
= get_conn_tos(service
, session_info
);
841 status
= get_nt_acl_conn(frame
, fname
, conn
, security_info_wanted
, &sd
);
842 PyErr_NTSTATUS_IS_ERR_RAISE(status
);
844 py_sd
= py_return_ndr_struct("samba.dcerpc.security", "descriptor", sd
, sd
);
852 set the posix (or similar) ACL on a file
854 static PyObject
*py_smbd_set_sys_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
856 const char * const kwnames
[] = {
864 TALLOC_CTX
*frame
= talloc_stackframe();
866 char *fname
, *service
= NULL
;
868 PyObject
*py_session
= Py_None
;
869 struct auth_session_info
*session_info
= NULL
;
870 struct smb_acl_t
*acl
;
872 connection_struct
*conn
;
874 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siOO|z",
875 discard_const_p(char *, kwnames
),
885 if (!py_check_dcerpc_type(py_acl
, "samba.dcerpc.smb_acl", "t")) {
890 if (!py_check_dcerpc_type(py_session
,
896 session_info
= pytalloc_get_type(py_session
,
897 struct auth_session_info
);
898 if (session_info
== NULL
) {
899 PyErr_Format(PyExc_TypeError
,
900 "Expected auth_session_info for session_info argument got %s",
901 pytalloc_get_name(py_session
));
906 conn
= get_conn_tos(service
, session_info
);
912 acl
= pytalloc_get_type(py_acl
, struct smb_acl_t
);
914 ret
= set_sys_acl_conn(fname
, acl_type
, acl
, conn
);
918 return PyErr_SetFromErrno(PyExc_OSError
);
926 Return the posix (or similar) ACL on a file
928 static PyObject
*py_smbd_get_sys_acl(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
930 const char * const kwnames
[] = {
939 PyObject
*py_session
= Py_None
;
940 struct auth_session_info
*session_info
= NULL
;
941 struct smb_acl_t
*acl
;
943 TALLOC_CTX
*frame
= talloc_stackframe();
944 connection_struct
*conn
;
945 char *service
= NULL
;
946 struct smb_filename
*smb_fname
= NULL
;
948 if (!PyArg_ParseTupleAndKeywords(args
, kwargs
, "siO|z",
949 discard_const_p(char *, kwnames
),
958 if (!py_check_dcerpc_type(py_session
,
964 session_info
= pytalloc_get_type(py_session
,
965 struct auth_session_info
);
966 if (session_info
== NULL
) {
967 PyErr_Format(PyExc_TypeError
,
968 "Expected auth_session_info for session_info argument got %s",
969 pytalloc_get_name(py_session
));
974 conn
= get_conn_tos(service
, session_info
);
980 smb_fname
= synthetic_smb_fname_split(frame
,
982 lp_posix_pathnames());
983 if (smb_fname
== NULL
) {
987 acl
= SMB_VFS_SYS_ACL_GET_FILE( conn
, smb_fname
, acl_type
, frame
);
990 return PyErr_SetFromErrno(PyExc_OSError
);
993 py_acl
= py_return_ndr_struct("samba.dcerpc.smb_acl", "t", acl
, acl
);
1000 static PyObject
*py_smbd_mkdir(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
1002 const char * const kwnames
[] = {
1008 char *fname
, *service
= NULL
;
1009 PyObject
*py_session
= Py_None
;
1010 struct auth_session_info
*session_info
= NULL
;
1011 TALLOC_CTX
*frame
= talloc_stackframe();
1012 struct connection_struct
*conn
= NULL
;
1013 struct smb_filename
*smb_fname
= NULL
;
1017 if (!PyArg_ParseTupleAndKeywords(args
,
1020 discard_const_p(char *,
1029 if (!py_check_dcerpc_type(py_session
,
1030 "samba.dcerpc.auth",
1035 session_info
= pytalloc_get_type(py_session
,
1036 struct auth_session_info
);
1037 if (session_info
== NULL
) {
1038 PyErr_Format(PyExc_TypeError
,
1039 "Expected auth_session_info for session_info argument got %s",
1040 pytalloc_get_name(py_session
));
1045 conn
= get_conn_tos(service
, session_info
);
1051 smb_fname
= synthetic_smb_fname(talloc_tos(),
1056 lp_posix_pathnames() ?
1057 SMB_FILENAME_POSIX_PATH
: 0);
1059 if (smb_fname
== NULL
) {
1064 /* we want total control over the permissions on created files,
1065 so set our umask to 0 */
1066 saved_umask
= umask(0);
1068 ret
= SMB_VFS_MKDIRAT(conn
,
1076 DBG_ERR("mkdirat error=%d (%s)\n", errno
, strerror(errno
));
1087 Create an empty file
1089 static PyObject
*py_smbd_create_file(PyObject
*self
, PyObject
*args
, PyObject
*kwargs
)
1091 const char * const kwnames
[] = {
1097 char *fname
, *service
= NULL
;
1098 PyObject
*py_session
= Py_None
;
1099 struct auth_session_info
*session_info
= NULL
;
1100 TALLOC_CTX
*frame
= talloc_stackframe();
1101 struct connection_struct
*conn
= NULL
;
1102 struct files_struct
*fsp
= NULL
;
1105 if (!PyArg_ParseTupleAndKeywords(args
,
1108 discard_const_p(char *,
1117 if (!py_check_dcerpc_type(py_session
,
1118 "samba.dcerpc.auth",
1123 session_info
= pytalloc_get_type(py_session
,
1124 struct auth_session_info
);
1125 if (session_info
== NULL
) {
1126 PyErr_Format(PyExc_TypeError
,
1127 "Expected auth_session_info for session_info argument got %s",
1128 pytalloc_get_name(py_session
));
1133 conn
= get_conn_tos(service
, session_info
);
1139 status
= init_files_struct(frame
,
1142 O_CREAT
|O_EXCL
|O_RDWR
,
1144 if (!NT_STATUS_IS_OK(status
)) {
1145 DBG_ERR("init_files_struct failed: %s\n",
1154 static PyMethodDef py_smbd_methods
[] = {
1155 { "have_posix_acls",
1156 (PyCFunction
)py_smbd_have_posix_acls
, METH_NOARGS
,
1159 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_simple_acl
),
1160 METH_VARARGS
|METH_KEYWORDS
,
1163 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_nt_acl
),
1164 METH_VARARGS
|METH_KEYWORDS
,
1167 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_get_nt_acl
),
1168 METH_VARARGS
|METH_KEYWORDS
,
1171 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_get_sys_acl
),
1172 METH_VARARGS
|METH_KEYWORDS
,
1175 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_set_sys_acl
),
1176 METH_VARARGS
|METH_KEYWORDS
,
1179 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_chown
),
1180 METH_VARARGS
|METH_KEYWORDS
,
1183 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_unlink
),
1184 METH_VARARGS
|METH_KEYWORDS
,
1187 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_mkdir
),
1188 METH_VARARGS
|METH_KEYWORDS
,
1191 PY_DISCARD_FUNC_SIG(PyCFunction
, py_smbd_create_file
),
1192 METH_VARARGS
|METH_KEYWORDS
,
1197 void initsmbd(void);
1199 static struct PyModuleDef moduledef
= {
1200 PyModuleDef_HEAD_INIT
,
1202 .m_doc
= "Python bindings for the smbd file server.",
1204 .m_methods
= py_smbd_methods
,
1207 MODULE_INIT_FUNC(smbd
)
1211 m
= PyModule_Create(&moduledef
);