Author: jelmer Date: 2007-11-20 12:53:02 +0000 (Tue, 20 Nov 2007) New Revision: 26064
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26064 Log: Re-enable SWIG bindings for SMB and NBT. Modified: branches/4.0-python/ branches/4.0-python/.bzrignore branches/4.0-python/source/BRANCH.TODO branches/4.0-python/source/auth/auth.i branches/4.0-python/source/auth/credentials/credentials.i branches/4.0-python/source/auth/credentials/tests/bindings.py branches/4.0-python/source/libcli/config.mk branches/4.0-python/source/libcli/swig/libcli_nbt.i branches/4.0-python/source/libcli/swig/libcli_smb.i Changeset: Property changes on: branches/4.0-python ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:file-ids ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/4.0-python/.bzrignore =================================================================== --- branches/4.0-python/.bzrignore 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/.bzrignore 2007-11-20 12:53:02 UTC (rev 26064) @@ -235,3 +235,5 @@ source/lib/ldb/build source/auth/auth_wrap.c source/auth/auth_util.h +source/librpc/rpc/dcerpc_wrap.c +source/librpc/rpc/dcerpc.py Modified: branches/4.0-python/source/BRANCH.TODO =================================================================== --- branches/4.0-python/source/BRANCH.TODO 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/BRANCH.TODO 2007-11-20 12:53:02 UTC (rev 26064) @@ -4,3 +4,4 @@ - fix web server - allow non-top-level modules in build system - ldb: don't crash when trying to commit a transaction when there is no transaction open +- fix dependency problem for auth.py Modified: branches/4.0-python/source/auth/auth.i =================================================================== --- branches/4.0-python/source/auth/auth.i 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/auth/auth.i 2007-11-20 12:53:02 UTC (rev 26064) @@ -30,8 +30,9 @@ %} %include "carrays.i" +%include "stdint.i" %include "typemaps.i" -%import "../scripting/swig/talloc.i" +%import "../lib/talloc/talloc.i" %typemap(default) struct auth_session_info * { $1 = system_session_anon(NULL); Modified: branches/4.0-python/source/auth/credentials/credentials.i =================================================================== --- branches/4.0-python/source/auth/credentials/credentials.i 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/auth/credentials/credentials.i 2007-11-20 12:53:02 UTC (rev 26064) @@ -36,6 +36,14 @@ $1 = NULL; } +%{ +#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */ +%} + +%typemap(out) struct samr_Password * { + $result = PyString_FromStringAndSize($1->hash, 16); +} + %rename(Credentials) cli_credentials; typedef struct cli_credentials { %extend { @@ -79,5 +87,7 @@ void guess(void); bool is_anonymous(void); + + const struct samr_Password *get_nt_hash(TALLOC_CTX *mem_ctx); } } cli_credentials; Modified: branches/4.0-python/source/auth/credentials/tests/bindings.py =================================================================== --- branches/4.0-python/source/auth/credentials/tests/bindings.py 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/auth/credentials/tests/bindings.py 2007-11-20 12:53:02 UTC (rev 26064) @@ -67,3 +67,8 @@ #self.assertEquals(None, self.creds.get_workstation()) self.creds.set_workstation("myworksta") self.assertEquals("myworksta", self.creds.get_workstation()) + + def test_get_nt_hash(self): + self.creds.set_password("geheim") + self.assertEquals('\xc2\xae\x1f\xe6\xe6H\x84cRE>\x81o*\xeb\x93', + self.creds.get_nt_hash()) Modified: branches/4.0-python/source/libcli/config.mk =================================================================== --- branches/4.0-python/source/libcli/config.mk 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/libcli/config.mk 2007-11-20 12:53:02 UTC (rev 26064) @@ -50,14 +50,7 @@ [PYTHON::swig_libcli_nbt] SWIG_FILE = swig/libcli_nbt.i PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO -[LIBRARY::swig_libcli_smb] -LIBRARY_REALNAME = swig/_libcli_smb.$(SHLIBEXT) -OBJ_FILES = swig/libcli_smb_wrap.o -PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO - [SUBSYSTEM::LIBCLI_DGRAM] OBJ_FILES = \ dgram/dgramsocket.o \ Modified: branches/4.0-python/source/libcli/swig/libcli_nbt.i =================================================================== --- branches/4.0-python/source/libcli/swig/libcli_nbt.i 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/libcli/swig/libcli_nbt.i 2007-11-20 12:53:02 UTC (rev 26064) @@ -39,30 +39,9 @@ %} -%apply bool { bool }; -%apply int { uint8_t }; -%apply int { int8_t }; -%apply unsigned int { uint16_t }; -%apply int { int16_t }; +%import "stdint.i" +%import "../../lib/talloc/talloc.i" -%typemap(in) uint32_t { - if (PyLong_Check($input)) - $1 = PyLong_AsUnsignedLong($input); - else if (PyInt_Check($input)) - $1 = PyInt_AsLong($input); - else { - PyErr_SetString(PyExc_TypeError,"Expected a long or an int"); - return NULL; - } -} - -%typemap(out) uint32_t { - $result = PyLong_FromUnsignedLong($1); -} - -%apply unsigned long long { uint64_t }; -%apply long long { int64_t }; - %typemap(in) NTSTATUS { if (PyLong_Check($input)) $1 = NT_STATUS(PyLong_AsUnsignedLong($input)); @@ -78,9 +57,6 @@ $result = PyLong_FromUnsignedLong(NT_STATUS_V($1)); } -TALLOC_CTX *talloc_init(char *name); -int talloc_free(TALLOC_CTX *ptr); - /* Function prototypes */ struct event_context *event_context_init(TALLOC_CTX *mem_ctx); @@ -138,7 +114,3 @@ return nbt_name_query(nbtsock, mem_ctx, io); } %} - -%init %{ - lp_load(); -%} Modified: branches/4.0-python/source/libcli/swig/libcli_smb.i =================================================================== --- branches/4.0-python/source/libcli/swig/libcli_smb.i 2007-11-20 12:52:58 UTC (rev 26063) +++ branches/4.0-python/source/libcli/swig/libcli_smb.i 2007-11-20 12:53:02 UTC (rev 26064) @@ -1,14 +1,13 @@ %module libcli_smb +%import "../../lib/talloc/talloc.i" + %{ #include "includes.h" -#include "lib/talloc/talloc.h" #include "lib/events/events.h" #include "libcli/raw/libcliraw.h" %} -TALLOC_CTX *talloc_init(char *name); -int talloc_free(TALLOC_CTX *ptr); struct event_context *event_context_init(TALLOC_CTX *mem_ctx); struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port,
