static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, uint16_t *dest_port)
{
if (PyUnicode_Check(obj) || PyUnicode_Check(obj)) {
- *dest_addr = PyStr_AsString(obj);
+ *dest_addr = PyUnicode_AsUTF8(obj);
*dest_port = NBT_NAME_SERVICE_PORT;
return true;
}
return false;
}
- *dest_addr = PyStr_AsString(obj);
+ *dest_addr = PyUnicode_AsUTF8(obj);
if (PyTuple_Size(obj) == 1) {
*dest_port = NBT_NAME_SERVICE_PORT;
{
if (PyTuple_Check(obj)) {
if (PyTuple_Size(obj) == 2) {
- name->name = PyStr_AsString(PyTuple_GetItem(obj, 0));
+ name->name = PyUnicode_AsUTF8(PyTuple_GetItem(obj, 0));
if (name->name == NULL) {
goto err;
}
name->scope = NULL;
return true;
} else if (PyTuple_Size(obj) == 3) {
- name->name = PyStr_AsString(PyTuple_GetItem(obj, 0));
+ name->name = PyUnicode_AsUTF8(PyTuple_GetItem(obj, 0));
if (name->name == NULL) {
goto err;
}
- name->scope = PyStr_AsString(PyTuple_GetItem(obj, 1));
+ name->scope = PyUnicode_AsUTF8(PyTuple_GetItem(obj, 1));
if (name->scope == NULL) {
goto err;
}
if (PyUnicode_Check(obj) || PyUnicode_Check(obj)) {
/* FIXME: Parse string to be able to interpret things like RHONWYN<02> ? */
- name->name = PyStr_AsString(obj);
+ name->name = PyUnicode_AsUTF8(obj);
if (name->name == NULL) {
goto err;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_username(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_username(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_domain(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_domain(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_nt_username(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_nt_username(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_fullname(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_fullname(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_homedir(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_homedir(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_dir_drive(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_dir_drive(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_logon_script(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_logon_script(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_profile_path(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_profile_path(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_acct_desc(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_acct_desc(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_workstations(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_workstations(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_comment(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_comment(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
- if (!pdb_set_munged_dial(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
+ if (!pdb_set_munged_dial(sam_acct, PyUnicode_AsUTF8(value), PDB_CHANGED)) {
talloc_free(frame);
return -1;
}
TALLOC_CTX *frame = talloc_stackframe();
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
- if (!pdb_set_plaintext_passwd(sam_acct, PyStr_AsString(value))) {
+ if (!pdb_set_plaintext_passwd(sam_acct, PyUnicode_AsUTF8(value))) {
talloc_free(frame);
return -1;
}
if (value == Py_None) {
fstrcpy(group_map->nt_name, NULL);
} else {
- fstrcpy(group_map->nt_name, PyStr_AsString(value));
+ fstrcpy(group_map->nt_name, PyUnicode_AsUTF8(value));
}
talloc_free(frame);
return 0;
if (value == Py_None) {
fstrcpy(group_map->comment, NULL);
} else {
- fstrcpy(group_map->comment, PyStr_AsString(value));
+ fstrcpy(group_map->comment, PyUnicode_AsUTF8(value));
}
talloc_free(frame);
return 0;
alias_sid = pytalloc_get_ptr(py_alias_sid);
- alias_info.acct_name = talloc_strdup(frame, PyStr_AsString(PyDict_GetItemString(py_alias_info, "acct_name")));
+ alias_info.acct_name = talloc_strdup(frame, PyUnicode_AsUTF8(PyDict_GetItemString(py_alias_info, "acct_name")));
if (alias_info.acct_name == NULL) {
PyErr_Format(py_pdb_error, "Unable to allocate memory");
talloc_free(frame);
return NULL;
}
- alias_info.acct_desc = talloc_strdup(frame, PyStr_AsString(PyDict_GetItemString(py_alias_info, "acct_desc")));
+ alias_info.acct_desc = talloc_strdup(frame, PyUnicode_AsUTF8(PyDict_GetItemString(py_alias_info, "acct_desc")));
if (alias_info.acct_desc == NULL) {
PyErr_Format(py_pdb_error, "Unable to allocate memory");
talloc_free(frame);
}
py_tmp = PyDict_GetItemString(py_td_info, "domain_name");
- td_info.domain_name = discard_const_p(char, PyStr_AsString(py_tmp));
+ td_info.domain_name = discard_const_p(char, PyUnicode_AsUTF8(py_tmp));
py_tmp = PyDict_GetItemString(py_td_info, "netbios_name");
- td_info.netbios_name = discard_const_p(char, PyStr_AsString(py_tmp));
+ td_info.netbios_name = discard_const_p(char, PyUnicode_AsUTF8(py_tmp));
py_tmp = PyDict_GetItemString(py_td_info, "security_identifier");
td_info.security_identifier = *pytalloc_get_type(py_tmp, struct dom_sid);