Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sudo-project
GitHub Repository: sudo-project/sudo
Path: blob/main/plugins/python/sudo_python_module.h
1532 views
1
/*
2
* SPDX-License-Identifier: ISC
3
*
4
* Copyright (c) 2019-2020 Robert Manner <[email protected]>
5
*
6
* Permission to use, copy, modify, and distribute this software for any
7
* purpose with or without fee is hereby granted, provided that the above
8
* copyright notice and this permission notice appear in all copies.
9
*
10
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
19
#ifndef SUDO_PYTHON_MODULE_H
20
#define SUDO_PYTHON_MODULE_H
21
22
#include "pyhelpers.h"
23
24
extern PyObject *sudo_exc_SudoException; // Base exception for the sudo module problems
25
26
// This is for the python plugins to report error messages for us
27
extern PyObject *sudo_exc_PluginException; // base exception of the following:
28
extern PyObject *sudo_exc_PluginReject; // a reject with message
29
extern PyObject *sudo_exc_PluginError; // an error with message
30
31
extern PyTypeObject *sudo_type_Plugin;
32
extern PyTypeObject *sudo_type_ConvMessage;
33
34
PyObject *sudo_module_create_class(const char *class_name, PyMethodDef *class_methods,
35
PyObject *base_class);
36
37
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
38
int sudo_module_register_conv_message(PyObject *py_module);
39
40
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
41
int sudo_module_ConvMessage_to_c(PyObject *py_conv_message, struct sudo_conv_message *conv_message);
42
43
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
44
int sudo_module_ConvMessages_to_c(PyObject *py_tuple, Py_ssize_t *num_msgs, struct sudo_conv_message **msgs);
45
46
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
47
int sudo_module_register_baseplugin(PyObject *py_module);
48
49
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
50
int sudo_module_set_default_loghandler(void);
51
52
PyObject *python_sudo_debug(PyObject *py_self, PyObject *py_args);
53
54
PyMODINIT_FUNC sudo_module_init(void);
55
56
#endif // SUDO_PYTHON_MODULE_H
57
58