This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "py_winbind.h"
/* Prototypes from common.h */
-NSS_STATUS winbindd_request(int req_type,
+NSS_STATUS winbindd_request_response(int req_type,
struct winbindd_request *request,
struct winbindd_response *response);
fstrcpy(request.data.name.name, name);
}
- if (winbindd_request(WINBINDD_LOOKUPNAME, &request, &response)
+ if (winbindd_request_response(WINBINDD_LOOKUPNAME, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
fstrcpy(request.data.sid, sid);
- if (winbindd_request(WINBINDD_LOOKUPSID, &request, &response)
+ if (winbindd_request_response(WINBINDD_LOOKUPSID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
ZERO_STRUCT(response);
- if (winbindd_request(WINBINDD_LIST_USERS, NULL, &response)
+ if (winbindd_request_response(WINBINDD_LIST_USERS, NULL, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
result = PyList_New(0);
- if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ if (response.extra_data.data) {
+ const char *extra_data = response.extra_data.data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
ZERO_STRUCT(response);
- if (winbindd_request(WINBINDD_LIST_GROUPS, NULL, &response)
+ if (winbindd_request_response(WINBINDD_LIST_GROUPS, NULL, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
result = PyList_New(0);
- if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ if (response.extra_data.data) {
+ const char *extra_data = response.extra_data.data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
ZERO_STRUCT(response);
- if (winbindd_request(WINBINDD_LIST_TRUSTDOM, NULL, &response)
+ if (winbindd_request_response(WINBINDD_LIST_TRUSTDOM, NULL, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
result = PyList_New(0);
- if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ if (response.extra_data.data) {
+ const char *extra_data = response.extra_data.data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
ZERO_STRUCT(response);
- if (winbindd_request(WINBINDD_CHECK_MACHACC, NULL, &response)
+ if (winbindd_request_response(WINBINDD_CHECK_MACHACC, NULL, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
PyDict_SetItemString(result, "template_shell",
PyString_FromString(lp_template_shell()));
- /* Winbind uid/gid range */
+ /* idmap uid/gid range */
- if (lp_winbind_uid(&ulow, &uhi)) {
+ if (lp_idmap_uid(&ulow, &uhi)) {
PyDict_SetItemString(result, "uid_low", PyInt_FromLong(ulow));
PyDict_SetItemString(result, "uid_high", PyInt_FromLong(uhi));
}
- if (lp_winbind_gid(&glow, &ghi)) {
+ if (lp_idmap_gid(&glow, &ghi)) {
PyDict_SetItemString(result, "gid_low", PyInt_FromLong(glow));
PyDict_SetItemString(result, "gid_high", PyInt_FromLong(ghi));
}
request.data.uid = id;
- if (winbindd_request(WINBINDD_UID_TO_SID, &request, &response)
+ if (winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
request.data.gid = id;
- if (winbindd_request(WINBINDD_GID_TO_SID, &request, &response)
+ if (winbindd_request_response(WINBINDD_GID_TO_SID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
fstrcpy(request.data.sid, sid);
- if (winbindd_request(WINBINDD_SID_TO_UID, &request, &response)
+ if (winbindd_request_response(WINBINDD_SID_TO_UID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
fstrcpy(request.data.sid, sid);
- if (winbindd_request(WINBINDD_SID_TO_GID, &request, &response)
+ if (winbindd_request_response(WINBINDD_SID_TO_GID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
fstrcpy(request.data.auth.user, username);
fstrcpy(request.data.auth.pass, password);
- if (winbindd_request(WINBINDD_PAM_AUTH, &request, &response)
+ if (winbindd_request_response(WINBINDD_PAM_AUTH, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
ZERO_STRUCT(request);
ZERO_STRUCT(response);
- fstrcpy(request.data.auth_crap.user, username);
+ if (push_utf8_fstring(request.data.auth_crap.user, username) == -1) {
+ PyErr_SetString(winbind_error, "unable to create utf8 string");
+ return NULL;
+ }
- generate_random_buffer(request.data.auth_crap.chal, 8, False);
+ generate_random_buffer(request.data.auth_crap.chal, 8);
if (use_lm_hash) {
SMBencrypt((uchar *)password, request.data.auth_crap.chal,
request.data.auth_crap.nt_resp_len = 24;
}
- if (winbindd_request(WINBINDD_PAM_AUTH_CRAP, &request, &response)
+ if (winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
ZERO_STRUCT(request);
ZERO_STRUCT(response);
- fstrcpy(request.data.smbd_auth_crap.user, username);
+ if (push_utf8_fstring(request.data.auth_crap.user, username) == -1) {
+ PyErr_SetString("unable to create utf8 string");
+ return NULL;
+ }
- generate_random_buffer(request.data.smbd_auth_crap.chal, 8, False);
+ generate_random_buffer(request.data.smbd_auth_crap.chal, 8);
if (use_lm_hash) {
SMBencrypt((uchar *)password,
- if (winbindd_request(WINBINDD_SMBD_AUTH_CRAP, &request, &response)
+ if (winbindd_request_response(WINBINDD_SMBD_AUTH_CRAP, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
fstrcpy(request.data.username, username);
- if (winbindd_request(WINBINDD_GETPWNAM, &request, &response)
+ if (winbindd_request_response(WINBINDD_GETPWNAM, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
request.data.uid = uid;
- if (winbindd_request(WINBINDD_GETPWUID, &request, &response)
+ if (winbindd_request_response(WINBINDD_GETPWUID, &request, &response)
!= NSS_STATUS_SUCCESS) {
PyErr_SetString(winbind_error, "lookup failed");
return NULL;
"Authenticate a username and password using plaintext authentication.\n"
"The NT status code is returned with zero indicating success." },
- { "auth_crap", (PyCFunction)py_auth_crap, METH_VARARGS,
+ { "auth_crap", (PyCFunction)py_auth_crap, METH_VARARGS | METH_KEYWORDS,
"auth_crap(s, s) -> int\n"
"\n"
"Authenticate a username and password using the challenge/response\n"