diff options
author | xuhy <huayong.xu@samsung.com> | 2023-11-16 17:39:20 +0800 |
---|---|---|
committer | xuhy <huayong.xu@samsung.com> | 2023-11-16 17:39:20 +0800 |
commit | 76ea0b5d4a1b8180f2552c2729d84388a77beecb (patch) | |
tree | 9a2b028c24c205b075d9386acd7a62a2eb2271a7 /python/rpmbmodule.c | |
parent | c30d127e8780dc678168ee121b9f2eeb1a8aaafa (diff) | |
download | librpm-tizen-master.tar.gz librpm-tizen-master.tar.bz2 librpm-tizen-master.zip |
The following issues are fixed:
1. Prevent execution of arbitrary scripts
2. Enable dash(-) in spec file.
3. Ignore bad expressions in %if conditionals.
4. Ignore unknown tags.
5. Ignore error macro.
Change-Id: Id5b7b47c1a78de364ef0d513023fbe9ccc773a87
Signed-off-by: xuhy <huayong.xu@samsung.com>
Diffstat (limited to 'python/rpmbmodule.c')
-rw-r--r-- | python/rpmbmodule.c | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/python/rpmbmodule.c b/python/rpmbmodule.c deleted file mode 100644 index ad30570e4..000000000 --- a/python/rpmbmodule.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "rpmsystem-py.h" - -#include "spec-py.h" - -static char rpmb__doc__[] = -""; - -/* - Do any common preliminary work before python 2 vs python 3 module creation: -*/ -static int prepareInitModule(void) -{ - if (PyType_Ready(&spec_Type) < 0) return 0; - if (PyType_Ready(&specPkg_Type) < 0) return 0; - - return 1; -} - -static int initModule(PyObject *m) -{ - Py_INCREF(&spec_Type); - PyModule_AddObject(m, "spec", (PyObject *) &spec_Type); - Py_INCREF(&specPkg_Type); - PyModule_AddObject(m, "specPkg", (PyObject *) &specPkg_Type); - -#define REGISTER_ENUM(val) PyModule_AddIntConstant(m, #val, val) - REGISTER_ENUM(RPMBUILD_ISSOURCE); - REGISTER_ENUM(RPMBUILD_ISPATCH); - REGISTER_ENUM(RPMBUILD_ISICON); - REGISTER_ENUM(RPMBUILD_ISNO); - - REGISTER_ENUM(RPMBUILD_NONE); - REGISTER_ENUM(RPMBUILD_PREP); - REGISTER_ENUM(RPMBUILD_BUILD); - REGISTER_ENUM(RPMBUILD_INSTALL); - REGISTER_ENUM(RPMBUILD_CHECK); - REGISTER_ENUM(RPMBUILD_CLEAN); - REGISTER_ENUM(RPMBUILD_FILECHECK); - REGISTER_ENUM(RPMBUILD_PACKAGESOURCE); - REGISTER_ENUM(RPMBUILD_PACKAGEBINARY); - REGISTER_ENUM(RPMBUILD_RMSOURCE); - REGISTER_ENUM(RPMBUILD_RMBUILD); - REGISTER_ENUM(RPMBUILD_RMSPEC); - - REGISTER_ENUM(RPMBUILD_PKG_NONE); - REGISTER_ENUM(RPMBUILD_PKG_NODIRTOKENS); - - REGISTER_ENUM(RPMSPEC_NONE); - REGISTER_ENUM(RPMSPEC_ANYARCH); - REGISTER_ENUM(RPMSPEC_FORCE); - REGISTER_ENUM(RPMSPEC_NOLANG); - - return 1; -} - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef moduledef = { - PyModuleDef_HEAD_INIT, - "_rpmb", /* m_name */ - rpmb__doc__, /* m_doc */ - 0, /* m_size */ - NULL, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; - -PyObject * PyInit__rpmb(void); /* XXX eliminate gcc warning */ -PyObject * PyInit__rpmb(void) -{ - PyObject *m; - - if (!prepareInitModule()) - return NULL; - m = PyModule_Create(&moduledef); - if (m == NULL || !initModule(m)) { - Py_XDECREF(m); - m = NULL; - } - return m; -} -#else -void init_rpmb(void); /* XXX eliminate gcc warning */ -void init_rpmb(void) -{ - PyObject *m; - - if (!prepareInitModule()) - return; - - m = Py_InitModule3("_rpmb", NULL, rpmb__doc__); - if (m) initModule(m); -} -#endif |