#include "version.h"
#include "param/pyparam.h"
#include "lib/socket/netif.h"
+#include "lib/util/debug.h"
void init_glue(void);
static PyObject *PyExc_NTSTATUSError;
return NULL;
retstr = generate_random_str(NULL, len);
- ret = PyStr_FromString(retstr);
+ ret = PyUnicode_FromString(retstr);
talloc_free(retstr);
return ret;
}
if (retstr == NULL) {
return NULL;
}
- ret = PyStr_FromString(retstr);
+ ret = PyUnicode_FromString(retstr);
talloc_free(retstr);
return ret;
}
}
string = nt_time_string(tmp_ctx, nt);
- ret = PyStr_FromString(string);
+ ret = PyUnicode_FromString(string);
talloc_free(tmp_ctx);
unsigned level;
if (!PyArg_ParseTuple(args, "I", &level))
return NULL;
- (DEBUGLEVEL) = level;
+ debuglevel_set(level);
Py_RETURN_NONE;
}
-static PyObject *py_get_debug_level(PyObject *self)
+static PyObject *py_get_debug_level(PyObject *self,
+ PyObject *Py_UNUSED(ignored))
{
- return PyInt_FromLong(DEBUGLEVEL);
+ return PyInt_FromLong(debuglevel_get());
}
-static PyObject *py_fault_setup(PyObject *self)
+static PyObject *py_fault_setup(PyObject *self,
+ PyObject *Py_UNUSED(ignored))
{
static bool done;
if (!done) {
Py_RETURN_NONE;
}
-static PyObject *py_is_ntvfs_fileserver_built(PyObject *self)
+static PyObject *py_is_ntvfs_fileserver_built(PyObject *self,
+ PyObject *Py_UNUSED(ignored))
{
#ifdef WITH_NTVFS_FILESERVER
Py_RETURN_TRUE;
#endif
}
-static PyObject *py_is_heimdal_built(PyObject *self)
+static PyObject *py_is_heimdal_built(PyObject *self,
+ PyObject *Py_UNUSED(ignored))
{
#ifdef SAMBA4_USES_HEIMDAL
Py_RETURN_TRUE;
const char *ip = iface_list_n_ip(ifaces, i);
if (all_interfaces) {
- PyList_SetItem(pylist, ifcount, PyStr_FromString(ip));
+ PyList_SetItem(pylist, ifcount, PyUnicode_FromString(ip));
ifcount++;
continue;
}
continue;
}
- PyList_SetItem(pylist, ifcount, PyStr_FromString(ip));
+ PyList_SetItem(pylist, ifcount, PyUnicode_FromString(ip));
ifcount++;
}
talloc_free(tmp_ctx);
{
const char *s1 = NULL;
const char *s2 = NULL;
-
- if (!PyArg_ParseTuple(args, "eses", "utf8", &s1, "utf8", &s2)) {
+ long cmp_result = 0;
+ if (!PyArg_ParseTuple(args, PYARG_STR_UNI
+ PYARG_STR_UNI,
+ "utf8", &s1, "utf8", &s2)) {
return NULL;
}
- return PyInt_FromLong(strcasecmp_m(s1, s2));
+ cmp_result = strcasecmp_m(s1, s2);
+ PyMem_Free(discard_const_p(char, s1));
+ PyMem_Free(discard_const_p(char, s2));
+ return PyInt_FromLong(cmp_result);
}
static PyObject *py_strstr_m(PyObject *self, PyObject *args)
{
const char *s1 = NULL;
const char *s2 = NULL;
- char *ret = NULL;
-
- if (!PyArg_ParseTuple(args, "eses", "utf8", &s1, "utf8", &s2))
+ char *strstr_ret = NULL;
+ PyObject *result = NULL;
+ if (!PyArg_ParseTuple(args, PYARG_STR_UNI
+ PYARG_STR_UNI,
+ "utf8", &s1, "utf8", &s2))
return NULL;
- ret = strstr_m(s1, s2);
- if (!ret) {
+ strstr_ret = strstr_m(s1, s2);
+ if (!strstr_ret) {
+ PyMem_Free(discard_const_p(char, s1));
+ PyMem_Free(discard_const_p(char, s2));
Py_RETURN_NONE;
}
- return PyUnicode_FromString(ret);
+ result = PyUnicode_FromString(strstr_ret);
+ PyMem_Free(discard_const_p(char, s1));
+ PyMem_Free(discard_const_p(char, s2));
+ return result;
}
static PyMethodDef py_misc_methods[] = {
return NULL;
PyModule_AddObject(m, "version",
- PyStr_FromString(SAMBA_VERSION_STRING));
+ PyUnicode_FromString(SAMBA_VERSION_STRING));
PyExc_NTSTATUSError = PyErr_NewException(discard_const_p(char, "samba.NTSTATUSError"), PyExc_RuntimeError, NULL);
if (PyExc_NTSTATUSError != NULL) {
Py_INCREF(PyExc_NTSTATUSError);