From 2543885bf3a012aa8004ff81670fde26033ff1ff Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 5 Apr 2005 09:38:51 +0000 Subject: r6211: Use cli_credentials_set_{domain,username,password}() to fill in command line arguments for credentials typemap. Neat! (This used to be commit a3e7d71463053101e743a930f2648269d63ecaca) --- source4/scripting/swig/samba.i | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source4/scripting/swig/samba.i') diff --git a/source4/scripting/swig/samba.i b/source4/scripting/swig/samba.i index 4e0e0b7659..25aef154cf 100644 --- a/source4/scripting/swig/samba.i +++ b/source4/scripting/swig/samba.i @@ -63,6 +63,23 @@ %typemap(in) struct cli_credentials * { $1 = cli_credentials_init(arg1); - cli_credentials_set_anonymous($1); cli_credentials_set_conf($1); + if ($input == Py_None) { + cli_credentials_set_anonymous($1); + } else { + if (!PyTuple_Check($input) || + PyTuple_Size($input) != 3) { + PyErr_SetString(PyExc_TypeError, "Expecting three element tuple"); + return NULL; + } + if (!PyString_Check(PyTuple_GetItem($input, 0)) || + !PyString_Check(PyTuple_GetItem($input, 1)) || + !PyString_Check(PyTuple_GetItem($input, 2))) { + PyErr_SetString(PyExc_TypeError, "Expecting string elements"); + return NULL; + } + cli_credentials_set_domain($1, PyString_AsString(PyTuple_GetItem($input, 0)), CRED_SPECIFIED); + cli_credentials_set_username($1, PyString_AsString(PyTuple_GetItem($input, 1)), CRED_SPECIFIED); + cli_credentials_set_password($1, PyString_AsString(PyTuple_GetItem($input, 2)), CRED_SPECIFIED); + } } -- cgit