summaryrefslogtreecommitdiffstats
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-03-18 06:07:16 +0000
committerTim Potter <tpot@samba.org>2003-03-18 06:07:16 +0000
commit870a397bd5bcbf1f4135bb80beb012b6c3997dce (patch)
tree49d5b399bf68a69c9845af09c2cf8c4fea84bea9 /source3/python
parentd332200c254b4bbf27461a37f9655bf42faa2b3a (diff)
downloadsamba-870a397bd5bcbf1f4135bb80beb012b6c3997dce.tar.gz
samba-870a397bd5bcbf1f4135bb80beb012b6c3997dce.tar.xz
samba-870a397bd5bcbf1f4135bb80beb012b6c3997dce.zip
Merge of #ifdef'ed out auth_smbd wrapper.
(This used to be commit fc0b2fcf977b9014d2478296168b22e9faa22108)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_winbind.c72
1 files changed, 71 insertions, 1 deletions
diff --git a/source3/python/py_winbind.c b/source3/python/py_winbind.c
index e9fc4b7dd86..20bbe9dba4b 100644
--- a/source3/python/py_winbind.c
+++ b/source3/python/py_winbind.c
@@ -3,7 +3,7 @@
Python wrapper for winbind client functions.
- Copyright (C) Tim Potter 2002
+ Copyright (C) Tim Potter 2002-2003
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
@@ -452,6 +452,65 @@ static PyObject *py_auth_crap(PyObject *self, PyObject *args, PyObject *kw)
return PyInt_FromLong(response.data.auth.nt_status);
}
+#if 0 /* Include when auth_smbd merged to HEAD */
+
+/* Challenge/response authentication, with secret */
+
+static PyObject *py_auth_smbd(PyObject *self, PyObject *args, PyObject *kw)
+{
+ static char *kwlist[] =
+ {"username", "password", "use_lm_hash", "use_nt_hash", NULL };
+ struct winbindd_request request;
+ struct winbindd_response response;
+ char *username, *password;
+ int use_lm_hash = 1, use_nt_hash = 1;
+
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kw, "ss|ii", kwlist, &username, &password,
+ &use_lm_hash, &use_nt_hash))
+ return NULL;
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ fstrcpy(request.data.smbd_auth_crap.user, username);
+
+ generate_random_buffer(request.data.smbd_auth_crap.chal, 8, False);
+
+ if (use_lm_hash) {
+ SMBencrypt((uchar *)password,
+ request.data.smbd_auth_crap.chal,
+ (uchar *)request.data.smbd_auth_crap.lm_resp);
+ request.data.smbd_auth_crap.lm_resp_len = 24;
+ }
+
+ if (use_nt_hash) {
+ SMBNTencrypt((uchar *)password,
+ request.data.smbd_auth_crap.chal,
+ (uchar *)request.data.smbd_auth_crap.nt_resp);
+ request.data.smbd_auth_crap.nt_resp_len = 24;
+ }
+
+ if (!secrets_fetch_trust_account_password(
+ lp_workgroup(), request.data.smbd_auth_crap.proof, NULL)) {
+ PyErr_SetString(
+ winbind_error, "unable to fetch domain secret");
+ return NULL;
+ }
+
+
+
+ if (winbindd_request(WINBINDD_SMBD_AUTH_CRAP, &request, &response)
+ != NSS_STATUS_SUCCESS) {
+ PyErr_SetString(winbind_error, "lookup failed");
+ return NULL;
+ }
+
+ return PyInt_FromLong(response.data.auth.nt_status);
+}
+
+#endif /* 0 */
+
/* Get user info from name */
static PyObject *py_getpwnam(PyObject *self, PyObject *args)
@@ -648,6 +707,17 @@ Authenticate a username and password using the challenge/response
protocol. The NT status code is returned with zero indicating
success." },
+#if 0 /* Include when smbd_auth merged to HEAD */
+
+ { "auth_smbd", (PyCFunction)py_auth_crap, METH_VARARGS,
+ "auth_smbd(s, s) -> int
+
+Authenticate a username and password using the challenge/response
+protocol but using the domain secret to prove we are root. The NT
+status code is returned with zero indicating success." },
+
+#endif
+
{ NULL }
};