svn commit: samba r6211 - in branches/SAMBA_4_0/source/scripting/swig: .

tpot at samba.org tpot at samba.org
Tue Apr 5 09:38:51 GMT 2005


Author: tpot
Date: 2005-04-05 09:38:51 +0000 (Tue, 05 Apr 2005)
New Revision: 6211

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6211

Log:
Use cli_credentials_set_{domain,username,password}() to fill in
command line arguments for credentials typemap.  Neat!

Modified:
   branches/SAMBA_4_0/source/scripting/swig/samba.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/samba.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/samba.i	2005-04-05 09:18:36 UTC (rev 6210)
+++ branches/SAMBA_4_0/source/scripting/swig/samba.i	2005-04-05 09:38:51 UTC (rev 6211)
@@ -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);
+	}
 }



More information about the samba-cvs mailing list