mirror of
https://github.com/samba-team/samba.git
synced 2025-01-18 06:04:06 +03:00
py3: Remove PyStr_FromString() compatability macro
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
This commit is contained in:
parent
f498c81966
commit
34f9a089d8
@ -41,7 +41,7 @@ static PyObject *PyString_FromStringOrNULL(const char *str)
|
||||
{
|
||||
if (str == NULL)
|
||||
Py_RETURN_NONE;
|
||||
return PyStr_FromString(str);
|
||||
return PyUnicode_FromString(str);
|
||||
}
|
||||
|
||||
static PyObject *py_creds_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||
|
@ -85,7 +85,6 @@ static struct ldb_message_element *PyObject_AsMessageElement(
|
||||
static PyTypeObject PyLdbBytesType;
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PyStr_FromString PyUnicode_FromString
|
||||
#define PyStr_FromStringAndSize PyUnicode_FromStringAndSize
|
||||
#define PyStr_FromFormat PyUnicode_FromFormat
|
||||
#define PyStr_FromFormatV PyUnicode_FromFormatV
|
||||
@ -105,7 +104,6 @@ static PyObject *PyLdbBytes_FromStringAndSize(const char *msg, int size)
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
#define PyStr_FromString PyString_FromString
|
||||
#define PyStr_FromStringAndSize PyString_FromStringAndSize
|
||||
#define PyStr_FromFormat PyString_FromFormat
|
||||
#define PyStr_FromFormatV PyString_FromFormatV
|
||||
@ -152,9 +150,9 @@ static PyObject *py_ldb_control_str(PyLdbControlObject *self)
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
return PyStr_FromString(control);
|
||||
return PyUnicode_FromString(control);
|
||||
} else {
|
||||
return PyStr_FromString("ldb control");
|
||||
return PyUnicode_FromString("ldb control");
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +191,7 @@ static PyObject *wrap_text(const char *type, PyObject *wrapped)
|
||||
static PyObject *py_ldb_control_get_oid(PyLdbControlObject *self,
|
||||
PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(self->data->oid);
|
||||
return PyUnicode_FromString(self->data->oid);
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_control_get_critical(PyLdbControlObject *self,
|
||||
@ -454,7 +452,7 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result)
|
||||
}
|
||||
|
||||
for (i = 0;result->refs && result->refs[i]; i++) {
|
||||
PyList_SetItem(referals, i, PyStr_FromString(result->refs[i]));
|
||||
PyList_SetItem(referals, i, PyUnicode_FromString(result->refs[i]));
|
||||
}
|
||||
ret->referals = referals;
|
||||
return (PyObject *)ret;
|
||||
@ -517,24 +515,24 @@ static PyObject *py_ldb_dn_is_null(PyLdbDnObject *self,
|
||||
static PyObject *py_ldb_dn_get_casefold(PyLdbDnObject *self,
|
||||
PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(ldb_dn_get_casefold(self->dn));
|
||||
return PyUnicode_FromString(ldb_dn_get_casefold(self->dn));
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_get_linearized(PyLdbDnObject *self)
|
||||
{
|
||||
return PyStr_FromString(ldb_dn_get_linearized(self->dn));
|
||||
return PyUnicode_FromString(ldb_dn_get_linearized(self->dn));
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_canonical_str(PyLdbDnObject *self,
|
||||
PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(ldb_dn_canonical_string(self->dn, self->dn));
|
||||
return PyUnicode_FromString(ldb_dn_canonical_string(self->dn, self->dn));
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_canonical_ex_str(PyLdbDnObject *self,
|
||||
PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(ldb_dn_canonical_ex_string(self->dn, self->dn));
|
||||
return PyUnicode_FromString(ldb_dn_canonical_ex_string(self->dn, self->dn));
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_extended_str(PyLdbDnObject *self, PyObject *args, PyObject *kwargs)
|
||||
@ -545,7 +543,7 @@ static PyObject *py_ldb_dn_extended_str(PyLdbDnObject *self, PyObject *args, PyO
|
||||
discard_const_p(char *, kwnames),
|
||||
&mode))
|
||||
return NULL;
|
||||
return PyStr_FromString(ldb_dn_get_extended_linearized(self->dn, self->dn, mode));
|
||||
return PyUnicode_FromString(ldb_dn_get_extended_linearized(self->dn, self->dn, mode));
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_get_extended_component(PyLdbDnObject *self, PyObject *args)
|
||||
@ -592,7 +590,7 @@ static PyObject *py_ldb_dn_set_extended_component(PyLdbDnObject *self, PyObject
|
||||
|
||||
static PyObject *py_ldb_dn_repr(PyLdbDnObject *self)
|
||||
{
|
||||
PyObject *str = PyStr_FromString(ldb_dn_get_linearized(self->dn));
|
||||
PyObject *str = PyUnicode_FromString(ldb_dn_get_linearized(self->dn));
|
||||
PyObject *repr, *result;
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
@ -726,7 +724,7 @@ static PyObject *py_ldb_dn_get_component_name(PyLdbDnObject *self, PyObject *arg
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
return PyStr_FromString(name);
|
||||
return PyUnicode_FromString(name);
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_get_component_value(PyLdbDnObject *self, PyObject *args)
|
||||
@ -784,7 +782,7 @@ static PyObject *py_ldb_dn_get_rdn_name(PyLdbDnObject *self,
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
return PyStr_FromString(name);
|
||||
return PyUnicode_FromString(name);
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_get_rdn_value(PyLdbDnObject *self,
|
||||
@ -1096,7 +1094,7 @@ static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self,
|
||||
|
||||
static PyObject *py_ldb_repr(PyLdbObject *self)
|
||||
{
|
||||
return PyStr_FromString("<ldb connection>");
|
||||
return PyUnicode_FromString("<ldb connection>");
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_get_root_basedn(PyLdbObject *self,
|
||||
@ -1738,7 +1736,7 @@ static PyObject *py_ldb_write_ldif(PyLdbObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = PyStr_FromString(string);
|
||||
ret = PyUnicode_FromString(string);
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
@ -2066,7 +2064,7 @@ static int py_ldb_search_iterator_callback(struct ldb_request *req,
|
||||
return LDB_SUCCESS;
|
||||
|
||||
case LDB_REPLY_REFERRAL:
|
||||
reply->obj = PyStr_FromString(ares->referral);
|
||||
reply->obj = PyUnicode_FromString(ares->referral);
|
||||
if (reply->obj == NULL) {
|
||||
TALLOC_FREE(ares);
|
||||
return ldb_request_done(req, LDB_ERR_OPERATIONS_ERROR);
|
||||
@ -2606,7 +2604,7 @@ static PySequenceMethods py_ldb_result_seq = {
|
||||
|
||||
static PyObject *py_ldb_result_repr(PyLdbObject *self)
|
||||
{
|
||||
return PyStr_FromString("<ldb result>");
|
||||
return PyUnicode_FromString("<ldb result>");
|
||||
}
|
||||
|
||||
|
||||
@ -2751,7 +2749,7 @@ static PyMethodDef py_ldb_search_iterator_methods[] = {
|
||||
|
||||
static PyObject *py_ldb_search_iterator_repr(PyLdbSearchIteratorObject *self)
|
||||
{
|
||||
return PyStr_FromString("<ldb search iterator>");
|
||||
return PyUnicode_FromString("<ldb search iterator>");
|
||||
}
|
||||
|
||||
static PyTypeObject PyLdbSearchIterator = {
|
||||
@ -2774,7 +2772,7 @@ static PyObject *py_ldb_module_repr(PyLdbModuleObject *self)
|
||||
|
||||
static PyObject *py_ldb_module_str(PyLdbModuleObject *self)
|
||||
{
|
||||
return PyStr_FromString(pyldb_Module_AsModule(self)->ops->name);
|
||||
return PyUnicode_FromString(pyldb_Module_AsModule(self)->ops->name);
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_module_start_transaction(PyLdbModuleObject *self,
|
||||
@ -3313,7 +3311,7 @@ static PyObject *py_ldb_msg_element_repr(PyLdbMessageElementObject *self)
|
||||
ret = PyStr_FromFormat("MessageElement([%s])", element_str);
|
||||
talloc_free(element_str);
|
||||
} else {
|
||||
ret = PyStr_FromString("MessageElement([])");
|
||||
ret = PyUnicode_FromString("MessageElement([])");
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3426,11 +3424,11 @@ static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self,
|
||||
Py_ssize_t i, j = 0;
|
||||
PyObject *obj = PyList_New(msg->num_elements+(msg->dn != NULL?1:0));
|
||||
if (msg->dn != NULL) {
|
||||
PyList_SetItem(obj, j, PyStr_FromString("dn"));
|
||||
PyList_SetItem(obj, j, PyUnicode_FromString("dn"));
|
||||
j++;
|
||||
}
|
||||
for (i = 0; i < msg->num_elements; i++) {
|
||||
PyList_SetItem(obj, j, PyStr_FromString(msg->elements[i].name));
|
||||
PyList_SetItem(obj, j, PyUnicode_FromString(msg->elements[i].name));
|
||||
j++;
|
||||
}
|
||||
return obj;
|
||||
@ -3908,7 +3906,7 @@ static int py_module_search(struct ldb_module *mod, struct ldb_request *req)
|
||||
for (len = 0; req->op.search.attrs[len]; len++);
|
||||
py_attrs = PyList_New(len);
|
||||
for (i = 0; i < len; i++)
|
||||
PyList_SetItem(py_attrs, i, PyStr_FromString(req->op.search.attrs[i]));
|
||||
PyList_SetItem(py_attrs, i, PyUnicode_FromString(req->op.search.attrs[i]));
|
||||
}
|
||||
|
||||
py_result = PyObject_CallMethod(py_ldb, discard_const_p(char, "search"),
|
||||
@ -4205,7 +4203,7 @@ static PyObject *py_timestring(PyObject *module, PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "l", &t_val))
|
||||
return NULL;
|
||||
tresult = ldb_timestring(NULL, (time_t) t_val);
|
||||
ret = PyStr_FromString(tresult);
|
||||
ret = PyUnicode_FromString(tresult);
|
||||
talloc_free(tresult);
|
||||
return ret;
|
||||
}
|
||||
@ -4247,7 +4245,7 @@ static PyObject *py_binary_encode(PyObject *self, PyObject *args)
|
||||
PyErr_SetString(PyExc_TypeError, "unable to encode binary string");
|
||||
return NULL;
|
||||
}
|
||||
ret = PyStr_FromString(encoded);
|
||||
ret = PyUnicode_FromString(encoded);
|
||||
talloc_free(encoded);
|
||||
return ret;
|
||||
}
|
||||
|
@ -32,14 +32,12 @@
|
||||
#include <tdb.h>
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PyStr_FromString PyUnicode_FromString
|
||||
#define PyStr_FromFormat PyUnicode_FromFormat
|
||||
#define PyInt_FromLong PyLong_FromLong
|
||||
#define PyInt_Check PyLong_Check
|
||||
#define PyInt_AsLong PyLong_AsLong
|
||||
#define Py_TPFLAGS_HAVE_ITER 0
|
||||
#else
|
||||
#define PyStr_FromString PyString_FromString
|
||||
#define PyStr_FromFormat PyString_FromFormat
|
||||
#endif
|
||||
|
||||
@ -654,7 +652,7 @@ static PyObject *tdb_object_repr(PyTdbObject *self)
|
||||
{
|
||||
PyErr_TDB_RAISE_IF_CLOSED(self);
|
||||
if (tdb_get_flags(self->ctx) & TDB_INTERNAL) {
|
||||
return PyStr_FromString("Tdb(<internal>)");
|
||||
return PyUnicode_FromString("Tdb(<internal>)");
|
||||
} else {
|
||||
return PyStr_FromFormat("Tdb('%s')", tdb_name(self->ctx));
|
||||
}
|
||||
|
@ -27,11 +27,9 @@
|
||||
#include <tevent.h>
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define PyStr_FromString PyUnicode_FromString
|
||||
#define PyStr_AsUTF8 PyUnicode_AsUTF8
|
||||
#define PyInt_FromLong PyLong_FromLong
|
||||
#else
|
||||
#define PyStr_FromString PyString_FromString
|
||||
#define PyStr_AsUTF8 PyString_AsString
|
||||
#endif
|
||||
|
||||
@ -836,7 +834,7 @@ static PyObject *py_backend_list(PyObject *self,
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; backends[i]; i++) {
|
||||
string = PyStr_FromString(backends[i]);
|
||||
string = PyUnicode_FromString(backends[i]);
|
||||
if (!string) {
|
||||
goto err;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ static PyObject *py_nbt_name_query(PyObject *self, PyObject *args, PyObject *kwa
|
||||
ret = PyTuple_New(3);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
PyTuple_SetItem(ret, 0, PyStr_FromString(io.out.reply_from));
|
||||
PyTuple_SetItem(ret, 0, PyUnicode_FromString(io.out.reply_from));
|
||||
|
||||
py_name = PyObject_FromNBTName(node->socket, &io.out.name);
|
||||
if (py_name == NULL)
|
||||
@ -205,7 +205,7 @@ static PyObject *py_nbt_name_query(PyObject *self, PyObject *args, PyObject *kwa
|
||||
}
|
||||
|
||||
for (i = 0; i < io.out.num_addrs; i++) {
|
||||
PyList_SetItem(reply_addrs, i, PyStr_FromString(io.out.reply_addrs[i]));
|
||||
PyList_SetItem(reply_addrs, i, PyUnicode_FromString(io.out.reply_addrs[i]));
|
||||
}
|
||||
|
||||
PyTuple_SetItem(ret, 2, reply_addrs);
|
||||
@ -248,7 +248,7 @@ static PyObject *py_nbt_name_status(PyObject *self, PyObject *args, PyObject *kw
|
||||
ret = PyTuple_New(3);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
PyTuple_SetItem(ret, 0, PyStr_FromString(io.out.reply_from));
|
||||
PyTuple_SetItem(ret, 0, PyUnicode_FromString(io.out.reply_from));
|
||||
|
||||
py_name = PyObject_FromNBTName(node->socket, &io.out.name);
|
||||
if (py_name == NULL)
|
||||
@ -312,7 +312,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
|
||||
ret = PyTuple_New(4);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
PyTuple_SetItem(ret, 0, PyStr_FromString(io.out.reply_from));
|
||||
PyTuple_SetItem(ret, 0, PyUnicode_FromString(io.out.reply_from));
|
||||
|
||||
py_name = PyObject_FromNBTName(node->socket, &io.out.name);
|
||||
if (py_name == NULL)
|
||||
@ -320,7 +320,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
|
||||
|
||||
PyTuple_SetItem(ret, 1, py_name);
|
||||
|
||||
PyTuple_SetItem(ret, 2, PyStr_FromString(io.out.reply_addr));
|
||||
PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
|
||||
|
||||
PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
|
||||
|
||||
@ -368,7 +368,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
|
||||
ret = PyTuple_New(3);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
PyTuple_SetItem(ret, 0, PyStr_FromString(io.out.reply_from));
|
||||
PyTuple_SetItem(ret, 0, PyUnicode_FromString(io.out.reply_from));
|
||||
|
||||
py_name = PyObject_FromNBTName(node->socket, &io.out.name);
|
||||
if (py_name == NULL)
|
||||
@ -376,7 +376,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
|
||||
|
||||
PyTuple_SetItem(ret, 1, py_name);
|
||||
|
||||
PyTuple_SetItem(ret, 2, PyStr_FromString(io.out.reply_addr));
|
||||
PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
|
||||
|
||||
PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
|
||||
|
||||
|
@ -39,7 +39,7 @@ static PyObject* GPO_get_##ATTR(PyObject *self, void *closure) \
|
||||
= pytalloc_get_ptr(self); \
|
||||
\
|
||||
if (gpo_ptr->ATTR) \
|
||||
return PyStr_FromString(gpo_ptr->ATTR); \
|
||||
return PyUnicode_FromString(gpo_ptr->ATTR); \
|
||||
else \
|
||||
return Py_None; \
|
||||
}
|
||||
@ -108,7 +108,7 @@ static PyObject *py_gpo_get_unix_path(PyObject *self, PyObject *args,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = PyStr_FromString(unix_path);
|
||||
ret = PyUnicode_FromString(unix_path);
|
||||
|
||||
out:
|
||||
TALLOC_FREE(frame);
|
||||
@ -537,7 +537,7 @@ MODULE_INIT_FUNC(gpo)
|
||||
}
|
||||
|
||||
if (PyModule_AddObject(m, "version",
|
||||
PyStr_FromString(SAMBA_VERSION_STRING)) ) {
|
||||
PyUnicode_FromString(SAMBA_VERSION_STRING)) ) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ sub PythonStruct($$$$$$)
|
||||
$self->pidl("char *retstr;");
|
||||
$self->pidl("");
|
||||
$self->pidl("retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);");
|
||||
$self->pidl("ret = PyStr_FromString(retstr);");
|
||||
$self->pidl("ret = PyUnicode_FromString(retstr);");
|
||||
$self->pidl("talloc_free(retstr);");
|
||||
$self->pidl("");
|
||||
$self->pidl("return ret;");
|
||||
@ -809,7 +809,7 @@ sub PythonFunctionStruct($$$$)
|
||||
$self->pidl("call = &ndr_table_$iface\.calls[$fn->{OPNUM}];");
|
||||
$self->pidl("");
|
||||
$self->pidl("retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);");
|
||||
$self->pidl("ret = PyStr_FromString(retstr);");
|
||||
$self->pidl("ret = PyUnicode_FromString(retstr);");
|
||||
$self->pidl("TALLOC_FREE(retstr);");
|
||||
$self->pidl("");
|
||||
$self->pidl("return ret;");
|
||||
@ -2407,7 +2407,7 @@ static inline long long ndr_sizeof2intmax(size_t var_size)
|
||||
if ($cvar =~ /^[0-9]+$/ or $cvar =~ /^0x[0-9a-fA-F]+$/) {
|
||||
$py_obj = "PyLong_FromUnsignedLongLong($cvar)";
|
||||
} elsif ($cvar =~ /^".*"$/) {
|
||||
$py_obj = "PyStr_FromString($cvar)";
|
||||
$py_obj = "PyUnicode_FromString($cvar)";
|
||||
} else {
|
||||
$py_obj = $self->ConvertObjectToPythonData("NULL", expandAlias($ctype), $cvar, undef);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
static bool PySys_PathPrepend(PyObject *list, const char *path)
|
||||
{
|
||||
bool ok;
|
||||
PyObject *py_path = PyStr_FromString(path);
|
||||
PyObject *py_path = PyUnicode_FromString(path);
|
||||
if (py_path == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -54,7 +54,6 @@
|
||||
|
||||
/* Strings */
|
||||
|
||||
#define PyStr_FromString PyUnicode_FromString
|
||||
#define PyStr_FromStringAndSize PyUnicode_FromStringAndSize
|
||||
#define PyStr_FromFormat PyUnicode_FromFormat
|
||||
#define PyStr_FromFormatV PyUnicode_FromFormatV
|
||||
|
@ -40,7 +40,7 @@ static PyObject *py_generate_random_str(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
retstr = generate_random_str(NULL, len);
|
||||
ret = PyStr_FromString(retstr);
|
||||
ret = PyUnicode_FromString(retstr);
|
||||
talloc_free(retstr);
|
||||
return ret;
|
||||
}
|
||||
@ -57,7 +57,7 @@ static PyObject *py_generate_random_password(PyObject *self, PyObject *args)
|
||||
if (retstr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ret = PyStr_FromString(retstr);
|
||||
ret = PyUnicode_FromString(retstr);
|
||||
talloc_free(retstr);
|
||||
return ret;
|
||||
}
|
||||
@ -150,7 +150,7 @@ static PyObject *py_nttime2string(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
string = nt_time_string(tmp_ctx, nt);
|
||||
ret = PyStr_FromString(string);
|
||||
ret = PyUnicode_FromString(string);
|
||||
|
||||
talloc_free(tmp_ctx);
|
||||
|
||||
@ -272,7 +272,7 @@ static PyObject *py_interface_ips(PyObject *self, PyObject *args)
|
||||
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;
|
||||
}
|
||||
@ -293,7 +293,7 @@ static PyObject *py_interface_ips(PyObject *self, PyObject *args)
|
||||
continue;
|
||||
}
|
||||
|
||||
PyList_SetItem(pylist, ifcount, PyStr_FromString(ip));
|
||||
PyList_SetItem(pylist, ifcount, PyUnicode_FromString(ip));
|
||||
ifcount++;
|
||||
}
|
||||
talloc_free(tmp_ctx);
|
||||
@ -411,7 +411,7 @@ MODULE_INIT_FUNC(_glue)
|
||||
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);
|
||||
|
@ -239,7 +239,7 @@ static PyObject *py_samu_get_username(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_username = PyStr_FromString(username);
|
||||
py_username = PyUnicode_FromString(username);
|
||||
talloc_free(frame);
|
||||
return py_username;
|
||||
}
|
||||
@ -270,7 +270,7 @@ static PyObject *py_samu_get_domain(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_domain = PyStr_FromString(domain);
|
||||
py_domain = PyUnicode_FromString(domain);
|
||||
talloc_free(frame);
|
||||
return py_domain;
|
||||
}
|
||||
@ -301,7 +301,7 @@ static PyObject *py_samu_get_nt_username(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_nt_username = PyStr_FromString(nt_username);
|
||||
py_nt_username = PyUnicode_FromString(nt_username);
|
||||
talloc_free(frame);
|
||||
return py_nt_username;
|
||||
}
|
||||
@ -332,7 +332,7 @@ static PyObject *py_samu_get_full_name(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_full_name = PyStr_FromString(full_name);
|
||||
py_full_name = PyUnicode_FromString(full_name);
|
||||
talloc_free(frame);
|
||||
return py_full_name;
|
||||
}
|
||||
@ -363,7 +363,7 @@ static PyObject *py_samu_get_home_dir(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_home_dir = PyStr_FromString(home_dir);
|
||||
py_home_dir = PyUnicode_FromString(home_dir);
|
||||
talloc_free(frame);
|
||||
return py_home_dir;
|
||||
}
|
||||
@ -394,7 +394,7 @@ static PyObject *py_samu_get_dir_drive(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_dir_drive = PyStr_FromString(dir_drive);
|
||||
py_dir_drive = PyUnicode_FromString(dir_drive);
|
||||
talloc_free(frame);
|
||||
return py_dir_drive;
|
||||
}
|
||||
@ -425,7 +425,7 @@ static PyObject *py_samu_get_logon_script(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_logon_script = PyStr_FromString(logon_script);
|
||||
py_logon_script = PyUnicode_FromString(logon_script);
|
||||
talloc_free(frame);
|
||||
return py_logon_script;
|
||||
}
|
||||
@ -456,7 +456,7 @@ static PyObject *py_samu_get_profile_path(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_profile_path = PyStr_FromString(profile_path);
|
||||
py_profile_path = PyUnicode_FromString(profile_path);
|
||||
talloc_free(frame);
|
||||
return py_profile_path;
|
||||
}
|
||||
@ -487,7 +487,7 @@ static PyObject *py_samu_get_acct_desc(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_acct_desc = PyStr_FromString(acct_desc);
|
||||
py_acct_desc = PyUnicode_FromString(acct_desc);
|
||||
talloc_free(frame);
|
||||
return py_acct_desc;
|
||||
}
|
||||
@ -518,7 +518,7 @@ static PyObject *py_samu_get_workstations(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_workstations = PyStr_FromString(workstations);
|
||||
py_workstations = PyUnicode_FromString(workstations);
|
||||
talloc_free(frame);
|
||||
return py_workstations;
|
||||
}
|
||||
@ -549,7 +549,7 @@ static PyObject *py_samu_get_comment(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_comment = PyStr_FromString(comment);
|
||||
py_comment = PyUnicode_FromString(comment);
|
||||
talloc_free(frame);
|
||||
return py_comment;
|
||||
}
|
||||
@ -580,7 +580,7 @@ static PyObject *py_samu_get_munged_dial(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_munged_dial = PyStr_FromString(munged_dial);
|
||||
py_munged_dial = PyUnicode_FromString(munged_dial);
|
||||
talloc_free(frame);
|
||||
return py_munged_dial;
|
||||
}
|
||||
@ -795,7 +795,7 @@ static PyObject *py_samu_get_plaintext_passwd(PyObject *obj, void *closure)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
py_plaintext_pw = PyStr_FromString(plaintext_pw);
|
||||
py_plaintext_pw = PyUnicode_FromString(plaintext_pw);
|
||||
talloc_free(frame);
|
||||
return py_plaintext_pw;
|
||||
}
|
||||
@ -1346,7 +1346,7 @@ static PyObject *py_groupmap_get_nt_name(PyObject *obj, void *closure)
|
||||
py_nt_name = Py_None;
|
||||
Py_INCREF(py_nt_name);
|
||||
} else {
|
||||
py_nt_name = PyStr_FromString(group_map->nt_name);
|
||||
py_nt_name = PyUnicode_FromString(group_map->nt_name);
|
||||
}
|
||||
talloc_free(frame);
|
||||
return py_nt_name;
|
||||
@ -1376,7 +1376,7 @@ static PyObject *py_groupmap_get_comment(PyObject *obj, void *closure)
|
||||
py_comment = Py_None;
|
||||
Py_INCREF(py_comment);
|
||||
} else {
|
||||
py_comment = PyStr_FromString(group_map->comment);
|
||||
py_comment = PyUnicode_FromString(group_map->comment);
|
||||
}
|
||||
talloc_free(frame);
|
||||
return py_comment;
|
||||
@ -3823,7 +3823,7 @@ static PyObject *py_passdb_backends(PyObject *self, PyObject *unused)
|
||||
|
||||
while(entry) {
|
||||
int res = 0;
|
||||
PyObject *entry_name = PyStr_FromString(entry->name);
|
||||
PyObject *entry_name = PyUnicode_FromString(entry->name);
|
||||
if (entry_name) {
|
||||
res = PyList_Append(py_blist, entry_name);
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ static PyObject *py_get_name_by_authtype(PyObject *self, PyObject *args)
|
||||
if (name == NULL)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
return PyStr_FromString(name);
|
||||
return PyUnicode_FromString(name);
|
||||
}
|
||||
|
||||
static struct gensec_settings *settings_from_object(TALLOC_CTX *mem_ctx, PyObject *object)
|
||||
|
@ -97,7 +97,7 @@ static PyObject *py_samdb_server_site_name(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = PyStr_FromString(site);
|
||||
result = PyUnicode_FromString(site);
|
||||
talloc_free(mem_ctx);
|
||||
return result;
|
||||
}
|
||||
@ -123,7 +123,7 @@ static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = PyStr_FromString(retstr);
|
||||
ret = PyUnicode_FromString(retstr);
|
||||
talloc_free(retstr);
|
||||
return ret;
|
||||
}
|
||||
@ -208,7 +208,7 @@ static PyObject *py_samdb_get_domain_sid(PyLdbObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = PyStr_FromString(dom_sid_str_buf(sid, &buf));
|
||||
ret = PyUnicode_FromString(dom_sid_str_buf(sid, &buf));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ static PyObject *py_samdb_ntds_invocation_id(PyObject *self, PyObject *args)
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
result = PyStr_FromString(retstr);
|
||||
result = PyUnicode_FromString(retstr);
|
||||
talloc_free(retstr);
|
||||
return result;
|
||||
}
|
||||
@ -279,7 +279,7 @@ static PyObject *py_dsdb_get_oid_from_attid(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = PyStr_FromString(oid);
|
||||
ret = PyUnicode_FromString(oid);
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
@ -434,7 +434,7 @@ static PyObject *py_dsdb_get_backlink_from_lDAPDisplayName(PyObject *self, PyObj
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
return PyStr_FromString(target_attr->lDAPDisplayName);
|
||||
return PyUnicode_FromString(target_attr->lDAPDisplayName);
|
||||
}
|
||||
|
||||
|
||||
@ -464,7 +464,7 @@ static PyObject *py_dsdb_get_lDAPDisplayName_by_attid(PyObject *self, PyObject *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyStr_FromString(a->lDAPDisplayName);
|
||||
return PyUnicode_FromString(a->lDAPDisplayName);
|
||||
}
|
||||
|
||||
|
||||
@ -497,7 +497,7 @@ static PyObject *py_dsdb_get_syntax_oid_from_lDAPDisplayName(PyObject *self, PyO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyStr_FromString(attribute->syntax->ldap_oid);
|
||||
return PyUnicode_FromString(attribute->syntax->ldap_oid);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -821,7 +821,7 @@ static PyObject *py_samdb_ntds_objectGUID(PyObject *self, PyObject *args)
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
result = PyStr_FromString(retstr);
|
||||
result = PyUnicode_FromString(retstr);
|
||||
talloc_free(retstr);
|
||||
return result;
|
||||
}
|
||||
@ -1656,7 +1656,7 @@ MODULE_INIT_FUNC(dsdb)
|
||||
ADD_DSDB_FLAG(GPO_INHERIT);
|
||||
ADD_DSDB_FLAG(GPO_BLOCK_INHERITANCE);
|
||||
|
||||
#define ADD_DSDB_STRING(val) PyModule_AddObject(m, #val, PyStr_FromString(val))
|
||||
#define ADD_DSDB_STRING(val) PyModule_AddObject(m, #val, PyUnicode_FromString(val))
|
||||
|
||||
ADD_DSDB_STRING(DSDB_SYNTAX_BINARY_DN);
|
||||
ADD_DSDB_STRING(DSDB_SYNTAX_STRING_DN);
|
||||
|
@ -53,7 +53,7 @@ static PyObject *py_get_gpo_flags(PyObject *self, PyObject *args)
|
||||
py_ret = PyList_New(0);
|
||||
for (i = 0; ret[i]; i++) {
|
||||
int res = 0;
|
||||
PyObject *item = PyStr_FromString(ret[i]);
|
||||
PyObject *item = PyUnicode_FromString(ret[i]);
|
||||
if (item == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
Py_DECREF(py_ret);
|
||||
@ -102,7 +102,7 @@ static PyObject *py_get_gplink_options(PyObject *self, PyObject *args)
|
||||
py_ret = PyList_New(0);
|
||||
for (i = 0; ret[i]; i++) {
|
||||
int res = 0;
|
||||
PyObject *item = PyStr_FromString(ret[i]);
|
||||
PyObject *item = PyUnicode_FromString(ret[i]);
|
||||
if (item == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
Py_DECREF(py_ret);
|
||||
|
@ -417,7 +417,7 @@ static PyObject *py_str_regtype(PyObject *self, PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "i", ®type))
|
||||
return NULL;
|
||||
|
||||
return PyStr_FromString(str_regtype(regtype));
|
||||
return PyUnicode_FromString(str_regtype(regtype));
|
||||
}
|
||||
|
||||
static PyObject *py_get_predef_name(PyObject *self, PyObject *args)
|
||||
@ -431,7 +431,7 @@ static PyObject *py_get_predef_name(PyObject *self, PyObject *args)
|
||||
str = reg_get_predef_name(hkey);
|
||||
if (str == NULL)
|
||||
Py_RETURN_NONE;
|
||||
return PyStr_FromString(str);
|
||||
return PyUnicode_FromString(str);
|
||||
}
|
||||
|
||||
static PyMethodDef py_registry_methods[] = {
|
||||
|
@ -325,7 +325,7 @@ static PyObject *py_net_time(py_net_Object *self, PyObject *args, PyObject *kwar
|
||||
tm = localtime(&r.generic.out.time);
|
||||
strftime(timestr, sizeof(timestr)-1, "%c %Z",tm);
|
||||
|
||||
ret = PyStr_FromString(timestr);
|
||||
ret = PyUnicode_FromString(timestr);
|
||||
|
||||
talloc_free(mem_ctx);
|
||||
|
||||
|
@ -26,9 +26,9 @@ static PyObject *py_lsa_String_str(PyObject *py_self)
|
||||
PyObject *ret = NULL;
|
||||
if (self->string == NULL) {
|
||||
const char *empty = "";
|
||||
ret = PyStr_FromString(empty);
|
||||
ret = PyUnicode_FromString(empty);
|
||||
} else {
|
||||
ret = PyStr_FromString(self->string);
|
||||
ret = PyUnicode_FromString(self->string);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -39,7 +39,7 @@ static PyObject *py_lsa_String_repr(PyObject *py_self)
|
||||
PyObject *ret = NULL;
|
||||
if (self->string == NULL) {
|
||||
const char *empty = "lsaString(None)";
|
||||
ret = PyStr_FromString(empty);
|
||||
ret = PyUnicode_FromString(empty);
|
||||
} else {
|
||||
ret = PyStr_FromFormat("lsaString('%s')", self->string);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static PyObject *py_GUID_str(PyObject *py_self)
|
||||
{
|
||||
struct GUID *self = pytalloc_get_ptr(py_self);
|
||||
char *str = GUID_string(NULL, self);
|
||||
PyObject *ret = PyStr_FromString(str);
|
||||
PyObject *ret = PyUnicode_FromString(str);
|
||||
talloc_free(str);
|
||||
return ret;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ static PyObject *py_dom_sid_str(PyObject *py_self)
|
||||
{
|
||||
struct dom_sid *self = pytalloc_get_ptr(py_self);
|
||||
struct dom_sid_buf buf;
|
||||
PyObject *ret = PyStr_FromString(dom_sid_str_buf(self, &buf));
|
||||
PyObject *ret = PyUnicode_FromString(dom_sid_str_buf(self, &buf));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ static PyObject *py_descriptor_as_sddl(PyObject *self, PyObject *args)
|
||||
|
||||
text = sddl_encode(NULL, desc, sid);
|
||||
|
||||
ret = PyStr_FromString(text);
|
||||
ret = PyUnicode_FromString(text);
|
||||
|
||||
talloc_free(text);
|
||||
|
||||
@ -438,7 +438,7 @@ static PyObject *py_privilege_name(PyObject *self, PyObject *args)
|
||||
if (!PyArg_ParseTuple(args, "i", &priv))
|
||||
return NULL;
|
||||
|
||||
return PyStr_FromString(sec_privilege_name(priv));
|
||||
return PyUnicode_FromString(sec_privilege_name(priv));
|
||||
}
|
||||
|
||||
static PyObject *py_privilege_id(PyObject *self, PyObject *args)
|
||||
|
@ -95,7 +95,7 @@ static PyObject *py_iface_server_name(PyObject *obj, void *closure)
|
||||
if (server_name == NULL)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
return PyStr_FromString(server_name);
|
||||
return PyUnicode_FromString(server_name);
|
||||
}
|
||||
|
||||
static PyObject *py_ndr_syntax_id(struct ndr_syntax_id *syntax_id)
|
||||
|
@ -416,7 +416,7 @@ PyObject *PyString_FromStringOrNULL(const char *str)
|
||||
if (str == NULL) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return PyStr_FromString(str);
|
||||
return PyUnicode_FromString(str);
|
||||
}
|
||||
|
||||
PyObject *pyrpc_import_union(PyTypeObject *type, TALLOC_CTX *mem_ctx, int level,
|
||||
|
@ -45,7 +45,7 @@ static bool dict_insert(PyObject* dict,
|
||||
|
||||
static PyObject *provision_module(void)
|
||||
{
|
||||
PyObject *name = PyStr_FromString("samba.provision");
|
||||
PyObject *name = PyUnicode_FromString("samba.provision");
|
||||
PyObject *mod = NULL;
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
@ -56,7 +56,7 @@ static PyObject *provision_module(void)
|
||||
|
||||
static PyObject *schema_module(void)
|
||||
{
|
||||
PyObject *name = PyStr_FromString("samba.schema");
|
||||
PyObject *name = PyUnicode_FromString("samba.schema");
|
||||
PyObject *mod = NULL;
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
@ -67,7 +67,7 @@ static PyObject *schema_module(void)
|
||||
|
||||
static PyObject *ldb_module(void)
|
||||
{
|
||||
PyObject *name = PyStr_FromString("ldb");
|
||||
PyObject *name = PyUnicode_FromString("ldb");
|
||||
PyObject *mod = NULL;
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
@ -152,7 +152,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
configfile = lpcfg_configfile(lp_ctx);
|
||||
if (configfile != NULL) {
|
||||
if (!dict_insert(parameters, "smbconf",
|
||||
PyStr_FromString(configfile))) {
|
||||
PyUnicode_FromString(configfile))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -160,40 +160,40 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
|
||||
if (!dict_insert(parameters,
|
||||
"rootdn",
|
||||
PyStr_FromString(settings->root_dn_str))) {
|
||||
PyUnicode_FromString(settings->root_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (settings->targetdir != NULL) {
|
||||
if (!dict_insert(parameters,
|
||||
"targetdir",
|
||||
PyStr_FromString(settings->targetdir))) {
|
||||
PyUnicode_FromString(settings->targetdir))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"hostname",
|
||||
PyStr_FromString(settings->netbios_name))) {
|
||||
PyUnicode_FromString(settings->netbios_name))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"domain",
|
||||
PyStr_FromString(settings->domain))) {
|
||||
PyUnicode_FromString(settings->domain))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"realm",
|
||||
PyStr_FromString(settings->realm))) {
|
||||
PyUnicode_FromString(settings->realm))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (settings->root_dn_str) {
|
||||
if (!dict_insert(parameters,
|
||||
"rootdn",
|
||||
PyStr_FromString(settings->root_dn_str))) {
|
||||
PyUnicode_FromString(settings->root_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -202,7 +202,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
if (settings->domain_dn_str) {
|
||||
if (!dict_insert(parameters,
|
||||
"domaindn",
|
||||
PyStr_FromString(settings->domain_dn_str))) {
|
||||
PyUnicode_FromString(settings->domain_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -211,7 +211,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
if (settings->schema_dn_str) {
|
||||
if (!dict_insert(parameters,
|
||||
"schemadn",
|
||||
PyStr_FromString(settings->schema_dn_str))) {
|
||||
PyUnicode_FromString(settings->schema_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -219,7 +219,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
if (settings->config_dn_str) {
|
||||
if (!dict_insert(parameters,
|
||||
"configdn",
|
||||
PyStr_FromString(settings->config_dn_str))) {
|
||||
PyUnicode_FromString(settings->config_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -227,7 +227,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
if (settings->server_dn_str) {
|
||||
if (!dict_insert(parameters,
|
||||
"serverdn",
|
||||
PyStr_FromString(settings->server_dn_str))) {
|
||||
PyUnicode_FromString(settings->server_dn_str))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -235,7 +235,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
if (settings->site_name) {
|
||||
if (!dict_insert(parameters,
|
||||
"sitename",
|
||||
PyStr_FromString(settings->site_name))) {
|
||||
PyUnicode_FromString(settings->site_name))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -243,7 +243,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
|
||||
|
||||
if (!dict_insert(parameters,
|
||||
"machinepass",
|
||||
PyStr_FromString(settings->machine_password))){
|
||||
PyUnicode_FromString(settings->machine_password))){
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -403,27 +403,27 @@ NTSTATUS provision_store_self_join(TALLOC_CTX *mem_ctx, struct loadparm_context
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"domain",
|
||||
PyStr_FromString(settings->domain_name))) {
|
||||
PyUnicode_FromString(settings->domain_name))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (settings->realm != NULL) {
|
||||
if (!dict_insert(parameters,
|
||||
"realm",
|
||||
PyStr_FromString(settings->realm))) {
|
||||
PyUnicode_FromString(settings->realm))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"machinepass",
|
||||
PyStr_FromString(settings->machine_password))) {
|
||||
PyUnicode_FromString(settings->machine_password))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
if (!dict_insert(parameters,
|
||||
"netbiosname",
|
||||
PyStr_FromString(settings->netbios_name))) {
|
||||
PyUnicode_FromString(settings->netbios_name))) {
|
||||
status = NT_STATUS_UNSUCCESSFUL;
|
||||
goto out;
|
||||
}
|
||||
@ -527,7 +527,7 @@ struct ldb_context *provision_get_schema(TALLOC_CTX *mem_ctx,
|
||||
if (schema_dn) {
|
||||
if (!dict_insert(parameters,
|
||||
"schemadn",
|
||||
PyStr_FromString(schema_dn))) {
|
||||
PyUnicode_FromString(schema_dn))) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
|
||||
if (value == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return PyStr_FromString(value);
|
||||
return PyUnicode_FromString(value);
|
||||
}
|
||||
|
||||
parm = lpcfg_parm_struct(lp_ctx, param_name);
|
||||
@ -83,7 +83,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
|
||||
value = lpcfg_get_parametric(lp_ctx, NULL, type, option);
|
||||
if (value == NULL)
|
||||
return NULL;
|
||||
return PyStr_FromString(value);
|
||||
return PyUnicode_FromString(value);
|
||||
} else {
|
||||
/* its a global parameter */
|
||||
parm = lpcfg_parm_struct(lp_ctx, param_name);
|
||||
@ -103,7 +103,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
|
||||
return PyStr_FromFormat("%c", *(char *)parm_ptr);
|
||||
case P_STRING:
|
||||
case P_USTRING:
|
||||
return PyStr_FromString(*(char **)parm_ptr);
|
||||
return PyUnicode_FromString(*(char **)parm_ptr);
|
||||
case P_BOOL:
|
||||
return PyBool_FromLong(*(bool *)parm_ptr);
|
||||
case P_BOOLREV:
|
||||
@ -115,7 +115,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
|
||||
case P_ENUM:
|
||||
for (i=0; parm->enum_list[i].name; i++) {
|
||||
if (*(int *)parm_ptr == parm->enum_list[i].value) {
|
||||
return PyStr_FromString(parm->enum_list[i].name);
|
||||
return PyUnicode_FromString(parm->enum_list[i].name);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -133,7 +133,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha
|
||||
pylist = PyList_New(str_list_length(strlist));
|
||||
for (j = 0; strlist[j]; j++)
|
||||
PyList_SetItem(pylist, j,
|
||||
PyStr_FromString(strlist[j]));
|
||||
PyUnicode_FromString(strlist[j]));
|
||||
return pylist;
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ static PyObject *py_lp_ctx_private_path(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
path = lpcfg_private_path(NULL, PyLoadparmContext_AsLoadparmContext(self), name);
|
||||
ret = PyStr_FromString(path);
|
||||
ret = PyUnicode_FromString(path);
|
||||
talloc_free(path);
|
||||
|
||||
return ret;
|
||||
@ -240,7 +240,7 @@ static PyObject *py_lp_ctx_services(PyObject *self, PyObject *unused)
|
||||
for (i = 0; i < lpcfg_numservices(lp_ctx); i++) {
|
||||
struct loadparm_service *service = lpcfg_servicebynum(lp_ctx, i);
|
||||
if (service != NULL) {
|
||||
PyList_SetItem(ret, i, PyStr_FromString(lpcfg_servicename(service)));
|
||||
PyList_SetItem(ret, i, PyUnicode_FromString(lpcfg_servicename(service)));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -255,7 +255,7 @@ static PyObject *py_lp_ctx_server_role(PyObject *self, PyObject *unused)
|
||||
role = lpcfg_server_role(lp_ctx);
|
||||
role_str = server_role_str(role);
|
||||
|
||||
return PyStr_FromString(role_str);
|
||||
return PyUnicode_FromString(role_str);
|
||||
}
|
||||
|
||||
static PyObject *py_lp_dump(PyObject *self, PyObject *args)
|
||||
@ -375,7 +375,7 @@ static PyObject *py_cache_path(PyObject *self, PyObject *args)
|
||||
"Unable to access cache %s", name);
|
||||
return NULL;
|
||||
}
|
||||
ret = PyStr_FromString(path);
|
||||
ret = PyUnicode_FromString(path);
|
||||
talloc_free(path);
|
||||
|
||||
return ret;
|
||||
@ -399,7 +399,7 @@ static PyObject *py_state_path(PyObject *self, PyObject *args)
|
||||
"Unable to access cache %s", name);
|
||||
return NULL;
|
||||
}
|
||||
ret = PyStr_FromString(path);
|
||||
ret = PyUnicode_FromString(path);
|
||||
talloc_free(path);
|
||||
|
||||
return ret;
|
||||
@ -460,7 +460,7 @@ static PyObject *py_lp_ctx_config_file(PyObject *self, void *closure)
|
||||
if (configfile == NULL)
|
||||
Py_RETURN_NONE;
|
||||
else
|
||||
return PyStr_FromString(configfile);
|
||||
return PyUnicode_FromString(configfile);
|
||||
}
|
||||
|
||||
static PyGetSetDef py_lp_ctx_getset[] = {
|
||||
@ -616,27 +616,27 @@ PyTypeObject PyLoadparmService = {
|
||||
|
||||
static PyObject *py_default_path(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(lp_default_path());
|
||||
return PyUnicode_FromString(lp_default_path());
|
||||
}
|
||||
|
||||
static PyObject *py_setup_dir(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(dyn_SETUPDIR);
|
||||
return PyUnicode_FromString(dyn_SETUPDIR);
|
||||
}
|
||||
|
||||
static PyObject *py_modules_dir(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(dyn_MODULESDIR);
|
||||
return PyUnicode_FromString(dyn_MODULESDIR);
|
||||
}
|
||||
|
||||
static PyObject *py_bin_dir(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(dyn_BINDIR);
|
||||
return PyUnicode_FromString(dyn_BINDIR);
|
||||
}
|
||||
|
||||
static PyObject *py_sbin_dir(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyStr_FromString(dyn_SBINDIR);
|
||||
return PyUnicode_FromString(dyn_SBINDIR);
|
||||
}
|
||||
|
||||
static PyMethodDef pyparam_methods[] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user