diff options
author | Tim Potter <tpot@samba.org> | 2005-04-05 09:38:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:26 -0500 |
commit | 2543885bf3a012aa8004ff81670fde26033ff1ff (patch) | |
tree | 8bc56bcae1f99d99f4d72392e57b58973de570a6 | |
parent | d77e7cd774983e651ac6a2e679bdd6e6c73642d8 (diff) | |
download | samba-2543885bf3a012aa8004ff81670fde26033ff1ff.tar.gz samba-2543885bf3a012aa8004ff81670fde26033ff1ff.tar.bz2 samba-2543885bf3a012aa8004ff81670fde26033ff1ff.zip |
r6211: Use cli_credentials_set_{domain,username,password}() to fill in
command line arguments for credentials typemap. Neat!
(This used to be commit a3e7d71463053101e743a930f2648269d63ecaca)
-rw-r--r-- | source4/scripting/swig/samba.i | 19 |
1 files changed, 18 insertions, 1 deletions
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); + } } |