Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-abartlet
authorAndrew Bartlett <abartlet@samba.org>
Tue, 27 May 2008 22:11:05 +0000 (08:11 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 27 May 2008 22:11:05 +0000 (08:11 +1000)
It seems the format of main.mk changed in my sleep...

Conflicts:

source/main.mk

194 files changed:
BUGS.txt
source/Makefile
source/auth/auth.i
source/auth/auth.py
source/auth/auth_wrap.c
source/auth/credentials/credentials.i
source/auth/credentials/credentials.py
source/auth/credentials/credentials_wrap.c
source/build/make/rules.mk
source/build/make/templates.mk
source/build/smb_build/config_mk.pm
source/build/smb_build/makefile.pm
source/dynconfig/config.mk [moved from source/dynconfig.mk with 78% similarity]
source/dynconfig/dynconfig.c [moved from source/dynconfig.c with 100% similarity]
source/dynconfig/dynconfig.h [moved from source/dynconfig.h with 100% similarity]
source/dynconfig/version.c [moved from source/lib/version.c with 100% similarity]
source/heimdal_build/asn1_compile_wrapper.sh
source/heimdal_build/asn1_deps.pl
source/heimdal_build/config.mk
source/heimdal_build/et_compile_wrapper.sh
source/heimdal_build/et_deps.pl
source/lib/charset/util_unistr.c
source/lib/cmdline/popt_common.c
source/lib/events/events.i
source/lib/events/events.py
source/lib/events/events_wrap.c
source/lib/ldb/config.mk
source/lib/ldb/ldb.i
source/lib/ldb/ldb.py
source/lib/ldb/ldb_ildap/config.mk
source/lib/ldb/ldb_wrap.c
source/lib/ldb/python.mk
source/lib/ldb/tools/config.mk
source/lib/messaging/config.mk
source/lib/messaging/irpc.h
source/lib/messaging/messaging.c
source/lib/messaging/pymessaging.c [new file with mode: 0644]
source/lib/messaging/tests/bindings.py [new file with mode: 0644]
source/lib/registry/config.mk
source/lib/registry/hive.c
source/lib/registry/interface.c
source/lib/registry/local.c
source/lib/registry/patchfile.c
source/lib/registry/patchfile_dotreg.c
source/lib/registry/patchfile_preg.c
source/lib/registry/regf.c
source/lib/registry/registry.h
source/lib/registry/registry.i
source/lib/registry/registry.py
source/lib/registry/registry_wrap.c
source/lib/registry/tests/diff.c
source/lib/registry/tests/hive.c
source/lib/registry/tests/registry.c
source/lib/replace/libreplace_network.m4
source/lib/smbreadline/readline.m4
source/lib/tdb/tdb.i
source/lib/tdb/tdb.py
source/lib/tdb/tdb_wrap.c
source/lib/util/debug.c
source/libcli/config.mk
source/libcli/nbt/nbtname.c
source/libcli/raw/interfaces.h
source/libcli/raw/raweas.c
source/libcli/raw/rawfile.c
source/libcli/raw/rawfileinfo.c
source/libcli/raw/smb.h
source/libcli/security/security.i
source/libcli/security/security.py
source/libcli/security/security_wrap.c
source/libcli/smb2/create.c
source/libcli/smb2/util.c
source/libcli/swig/libcli_smb.py
source/libcli/swig/libcli_smb_wrap.c
source/libcli/util/errors.i
source/libcli/util/pyerrors.h [moved from source/scripting/python/pyrpc.h with 60% similarity]
source/libnet/py_net.c
source/librpc/config.mk
source/librpc/idl-deps.pl
source/librpc/idl/echo.idl
source/librpc/idl/nbt.idl
source/librpc/idl/security.idl
source/librpc/idl/xattr.idl
source/librpc/rpc/dcerpc.h
source/librpc/rpc/dcerpc.i [deleted file]
source/librpc/rpc/dcerpc.py
source/librpc/rpc/dcerpc_wrap.c [deleted file]
source/librpc/rpc/pyrpc.c [new file with mode: 0644]
source/librpc/rpc/pyrpc.h [new file with mode: 0644]
source/librpc/scripts/build_idl.sh
source/main.mk
source/nsswitch/wbinfo.c
source/ntvfs/cifs/vfs_cifs.c
source/ntvfs/ntvfs_generic.c
source/ntvfs/posix/pvfs_acl.c
source/ntvfs/posix/pvfs_fileinfo.c
source/ntvfs/posix/pvfs_flush.c
source/ntvfs/posix/pvfs_open.c
source/ntvfs/posix/pvfs_qfileinfo.c
source/ntvfs/posix/pvfs_read.c
source/ntvfs/posix/pvfs_resolve.c
source/ntvfs/posix/pvfs_streams.c
source/param/config.mk
source/param/loadparm.c
source/param/param.i
source/param/param.py
source/param/param_wrap.c
source/param/util.c
source/pidl/TODO
source/pidl/lib/Parse/Pidl/Samba4/Python.pm
source/samba4-knownfail
source/scripting/bin/autoidl.py [new file with mode: 0755]
source/scripting/bin/minschema.py
source/scripting/bin/samba3dump
source/scripting/bin/smbstatus
source/scripting/bin/winreg [deleted file]
source/scripting/ejs/config.mk
source/scripting/ejs/ejsnet/config.mk [deleted file]
source/scripting/ejs/ejsnet/mpr_host.c [deleted file]
source/scripting/ejs/ejsnet/mpr_user.c [deleted file]
source/scripting/ejs/ejsnet/net_ctx.c [deleted file]
source/scripting/ejs/ejsnet/net_host.c [deleted file]
source/scripting/ejs/ejsnet/net_user.c [deleted file]
source/scripting/ejs/ejsrpc.c [deleted file]
source/scripting/ejs/ejsrpc.h [deleted file]
source/scripting/ejs/literal.c [deleted file]
source/scripting/ejs/smbcalls.c
source/scripting/ejs/smbcalls_cli.c [deleted file]
source/scripting/ejs/smbcalls_data.c [deleted file]
source/scripting/ejs/smbcalls_nbt.c [deleted file]
source/scripting/ejs/smbcalls_nss.c [deleted file]
source/scripting/ejs/smbcalls_param.c [deleted file]
source/scripting/ejs/smbcalls_rand.c [deleted file]
source/scripting/ejs/smbcalls_reg.c [deleted file]
source/scripting/ejs/smbcalls_rpc.c [deleted file]
source/scripting/ejs/smbscript.c
source/scripting/libjs/auth.js [deleted file]
source/scripting/libjs/base.js
source/scripting/libjs/encoder.js [deleted file]
source/scripting/libjs/management.js [deleted file]
source/scripting/libjs/samr.js [deleted file]
source/scripting/libjs/server_call.js [deleted file]
source/scripting/libjs/winreg.js [deleted file]
source/scripting/python/config.m4
source/scripting/python/config.mk
source/scripting/python/examples/samr.py [new file with mode: 0755]
source/scripting/python/examples/winreg.py [moved from source/scripting/bin/winreg.py with 98% similarity]
source/scripting/python/misc.i
source/scripting/python/misc.py
source/scripting/python/misc_wrap.c
source/scripting/python/pytalloc.c
source/scripting/python/samba/__init__.py
source/scripting/python/samba/getopt.py
source/scripting/python/samba/idmap.py
source/scripting/python/samba/ndr.py [new file with mode: 0644]
source/scripting/python/samba/provision.py
source/scripting/python/samba/samba3.py
source/scripting/python/samba/samdb.py
source/scripting/python/samba/tests/dcerpc/bare.py [new file with mode: 0644]
source/scripting/python/samba/tests/dcerpc/rpcecho.py
source/scripting/python/samba/tests/dcerpc/sam.py
source/scripting/python/samba/upgrade.py
source/selftest/output/plain.pm
source/selftest/samba4_tests.sh
source/selftest/selftest.pl
source/setup/provision-backend
source/smb_server/blob.c
source/smb_server/smb/reply.c
source/smb_server/smb2/smb2_server.h
source/smb_server/smb_server.c
source/static_deps.mk
source/torture/gentest.c
source/torture/gentest_smb2.c
source/torture/locktest.c
source/torture/masktest.c
source/torture/raw/read.c
source/torture/raw/streams.c
source/torture/smb2/config.mk
source/torture/smb2/connect.c
source/torture/smb2/create.c [new file with mode: 0644]
source/torture/smb2/getinfo.c
source/torture/smb2/lock.c
source/torture/smb2/read.c [new file with mode: 0644]
source/torture/smb2/smb2.c
source/torture/smbtorture.c
source/web_server/swat/__init__.py [new file with mode: 0644]
testprogs/ejs/argv.js [deleted file]
testprogs/ejs/echo.js [deleted file]
testprogs/ejs/ejsnet.js [deleted file]
testprogs/ejs/ejsnet/nethost.js [deleted file]
testprogs/ejs/ejsnet/netusr.js [deleted file]
testprogs/ejs/loadparm.js [deleted file]
testprogs/ejs/nbtstats [deleted file]
testprogs/ejs/resolveName.js [deleted file]
testprogs/ejs/samr.js [deleted file]

index 3ee3d63c56d8ff5833a1072a0f5ec739b50ce8f3..52e1791928116317d646987cc0bd1359d6fff31f 100644 (file)
--- a/BUGS.txt
+++ b/BUGS.txt
@@ -3,4 +3,4 @@ than education you are insane, or perhaps just very interested.
 
 We welcome your testing, please file bug reports at
 https://bugzilla.samba.org/, product: Samba4.  Please include as much
-information as possible, such as SVN revision number and backtraces.
+information as possible, such as GIT revision number and backtraces.
index 0ee36ec830d62d7f2f54ca2cc371bf08f90bb6aa..20a0876962bca36c545fbbd8ff676ee357f169a1 100644 (file)
@@ -6,7 +6,7 @@ include mkconfig.mk
 
 pidldir := $(srcdir)/pidl
 
-VPATH = $(builddir):$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
+VPATH = $(builddir):$(srcdir):$(srcdir)/heimdal_build:$(heimdalsrcdir)/lib/asn1:$(heimdalsrcdir)/lib/krb5:$(heimdalsrcdir)/lib/gssapi:$(heimdalsrcdir)/lib/hdb:$(heimdalsrcdir)/lib/roken:$(heimdalsrcdir)/lib/des
 
 BASEDIR = $(prefix)
 TORTUREDIR = $(libdir)/torture
@@ -47,8 +47,57 @@ ALL_PREDEP = basics
 .NOTPARALLEL:
 endif
 
-include build/make/rules.mk
-include build/make/python.mk
+include $(srcdir)/build/make/rules.mk
+include $(srcdir)/build/make/python.mk
+dynconfigsrcdir := dynconfig
+heimdalsrcdir := heimdal
+dsdbsrcdir := dsdb
+smbdsrcdir := smbd
+clustersrcdir := cluster
+libnetsrcdir := libnet
+authsrcdir := auth
+nsswitchsrcdir := nsswitch
+libsrcdir := lib
+libsocketsrcdir := lib/socket
+libcharsetsrcdir := lib/charset
+ldb_sambasrcdir := lib/ldb-samba
+libtlssrcdir := lib/tls
+libregistrysrcdir := lib/registry
+smbreadlinesrcdir := lib/smbreadline
+libmessagingsrcdir := lib/messaging
+libeventssrcdir := lib/events
+libcmdlinesrcdir := lib/cmdline
+socketwrappersrcdir := lib/socket_wrapper
+nsswrappersrcdir := lib/nss_wrapper
+appwebsrcdir := lib/appweb
+libstreamsrcdir := lib/stream
+libutilsrcdir := lib/util
+libtdrsrcdir := lib/tdr
+libdbwrapsrcdir := lib/dbwrap
+libcryptosrcdir := lib/crypto
+libtorturesrcdir := lib/torture
+smb_serversrcdir := smb_server
+libcompressionsrcdir := lib/compression
+libgencachesrcdir := lib
+paramsrcdir := param
+rpc_serversrcdir := rpc_server
+ldap_serversrcdir := ldap_server
+web_serversrcdir := web_server
+winbindsrcdir := winbind
+nbt_serversrcdir := nbt_server
+wrepl_serversrcdir := wrepl_server
+cldap_serversrcdir := cldap_server
+utilssrcdir := utils
+clientsrcdir := client
+torturesrcdir := torture
+ntvfssrcdir := ntvfs
+ntptrsrcdir := ntptr
+librpcsrcdir := librpc
+libclisrcdir := libcli
+ejsscriptsrcdir := scripting/ejs
+pyscriptsrcdir := $(srcdir)/scripting/python
+kdcsrcdir := kdc
+
 include data.mk
 
 BINARIES += $(BIN_PROGS) $(SBIN_PROGS)
@@ -233,8 +282,8 @@ data.mk: config.status $(MK_FILES)
 
 testcov-html:: 
 
-include pidl/config.mk
-include selftest/config.mk
+include $(pidldir)/config.mk
+include $(srcdir)/selftest/config.mk
 
 showflags::
        @echo '  pwd        = '`/bin/pwd`
index b1743ef7652427f62b4e9739c6b55ea57713253f..67c8137f67841b924cdc21a8580ebd2d14f51f0e 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-%module(package="samba.auth") auth
+%define DOCSTRING
+"Authentication and authorization support."
+%enddef
+
+%module(docstring=DOCSTRING,package="samba.auth") auth
 
 %{
 
index 88675f36266252d4687fcfe3c5f1d11d519d5e89..226175a75b4f4d9c4c24847cf69e486d5ac4ecf3 100644 (file)
@@ -1,8 +1,12 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+Authentication and authorization support.
+"""
+
 import _auth
 import new
 new_instancemethod = new.instancemethod
index af1827adc94e4161af21d8c511ca30c2a02983be..dea76ef87d26e93af15b3ddbc26e62e9cad253c2 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
-    PyErr_Format(PyExc_RuntimeError, mesg);
+    PyErr_SetString(PyExc_RuntimeError, mesg);
   }
 }
 
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
 {
   PySwigObject *sobj = (PySwigObject *) v;
   PyObject *next = sobj->next;
-  if (sobj->own) {
+  if (sobj->own == SWIG_POINTER_OWN) {
     swig_type_info *ty = sobj->ty;
     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
     PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
        res = ((*meth)(mself, v));
       }
       Py_XDECREF(res);
-    } else {
-      const char *name = SWIG_TypePrettyName(ty);
+    } 
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
     }
+#endif
   } 
   Py_XDECREF(next);
   PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
 
 SWIGRUNTIME int
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own) {
+  if (own == SWIG_POINTER_OWN) {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
     if (sobj) {
       int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
     return SWIG_OK;
   } else {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
     while (sobj) {
       void *vptr = sobj->ptr;
       if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
          if (!tc) {
            sobj = (PySwigObject *)sobj->next;
          } else {
-           if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+           if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
            break;
          }
        }
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
       }
     }
     if (sobj) {
-      if (own) *own = sobj->own;
+      if (own)
+        *own = *own | sobj->own;
       if (flags & SWIG_POINTER_DISOWN) {
        sobj->own = 0;
       }
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
     }
     if (ty) {
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (!tc) return SWIG_ERROR;
-      *ptr = SWIG_TypeCast(tc,vptr);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
     } else {
       *ptr = vptr;
     }
@@ -2505,7 +2523,7 @@ static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
 
 #define SWIG_name    "_auth"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2733,7 +2751,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -2743,6 +2761,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -2771,6 +2792,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
index 152d2e673ccd84c1b5ab2fabea7ed7b2c1690b6b..bb31d6d4c0540edf9e59ffe4ca30dd3f0d8cccec 100644 (file)
@@ -16,7 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-%module(package="samba.credentials") credentials
+%module(docstring="Credentials management.",package="samba.credentials") credentials
 
 %{
 
@@ -59,36 +59,53 @@ typedef struct cli_credentials {
             return cli_credentials_init(NULL);
         }
         /* username */
+        %feature("docstring") get_username "S.get_username() -> username\nObtain username.";
         const char *get_username(void);
+        %feature("docstring") set_username "S.set_username(name, obtained=CRED_SPECIFIED) -> None\nChange username.";
         bool set_username(const char *value, 
-                          enum credentials_obtained=CRED_SPECIFIED);
+                          enum credentials_obtained obtained=CRED_SPECIFIED);
 
         /* password */
+        %feature("docstring") get_password "S.get_password() -> password\n" \
+                                           "Obtain password.";
         const char *get_password(void);
+        %feature("docstring") set_password "S.set_password(password, obtained=CRED_SPECIFIED) -> None\n" \
+                                           "Change password.";
         bool set_password(const char *val, 
-                          enum credentials_obtained=CRED_SPECIFIED);
+                          enum credentials_obtained obtained=CRED_SPECIFIED);
 
         /* domain */
+        %feature("docstring") get_password "S.get_domain() -> domain\nObtain domain name.";
         const char *get_domain(void);
+        %feature("docstring") set_domain "S.set_domain(domain, obtained=CRED_SPECIFIED) -> None\n" \
+                                         "Change domain name.";
         bool set_domain(const char *val, 
-                        enum credentials_obtained=CRED_SPECIFIED);
+                        enum credentials_obtained obtained=CRED_SPECIFIED);
 
         /* realm */
+        %feature("docstring") get_realm "S.get_realm() -> realm\nObtain realm name.";
         const char *get_realm(void);
+        %feature("docstring") set_realm "S.set_realm(realm, obtained=CRED_SPECIFIED) -> None\n" \
+                                        "Change realm name.";
         bool set_realm(const char *val, 
-                       enum credentials_obtained=CRED_SPECIFIED);
+                       enum credentials_obtained obtained=CRED_SPECIFIED);
 
-       /* Kerberos */
+        /* Kerberos */
         void set_kerberos_state(enum credentials_use_kerberos use_kerberos);
 
+        %feature("docstring") parse_string "S.parse_string(text, obtained=CRED_SPECIFIED) -> None\n" \
+                                           "Parse credentials string.";
         void parse_string(const char *text,
-                         enum credentials_obtained=CRED_SPECIFIED);
+                          enum credentials_obtained obtained=CRED_SPECIFIED);
 
         /* bind dn */
+        %feature("docstring") get_bind_dn "S.get_bind_dn() -> bind dn\nObtain bind DN.";
         const char *get_bind_dn(void);
+        %feature("docstring") set_bind_dn "S.set_bind_dn(bind_dn) -> None\nChange bind DN.";
         bool set_bind_dn(const char *bind_dn);
 
-       void set_anonymous();
+        %feature("docstring") set_anonymous "S.set_anonymous() -> None\nUse anonymous credentials.";
+        void set_anonymous();
 
         /* workstation name */
         const char *get_workstation(void);
@@ -104,8 +121,10 @@ typedef struct cli_credentials {
 
         bool authentication_requested(void);
 
+        %feature("docstring") wrong_password "S.wrong_password() -> bool\nIndicate the returned password was incorrect.";
         bool wrong_password(void);
 
+        %feature("docstring") set_cmdline_callbacks "S.set_cmdline_callbacks() -> bool\nUse command-line to obtain credentials not explicitly set.";
         bool set_cmdline_callbacks();
     }
 } cli_credentials;
index b2f2c4ecddbb36552c64466354c2d356ee0137f4..2cd56c35990505a02f35d5063c41cd531fab2f95 100644 (file)
@@ -3,6 +3,10 @@
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+Credentials management.
+"""
+
 import _credentials
 import new
 new_instancemethod = new.instancemethod
@@ -66,6 +70,97 @@ class Credentials(object):
     __repr__ = _swig_repr
     def __init__(self, *args, **kwargs): 
         _credentials.Credentials_swiginit(self,_credentials.new_Credentials(*args, **kwargs))
+    def get_username(*args, **kwargs):
+        """
+        S.get_username() -> username
+        Obtain username.
+        """
+        return _credentials.Credentials_get_username(*args, **kwargs)
+
+    def set_username(*args, **kwargs):
+        """
+        S.set_username(name, obtained=CRED_SPECIFIED) -> None
+        Change username.
+        """
+        return _credentials.Credentials_set_username(*args, **kwargs)
+
+    def get_password(*args, **kwargs):
+        """
+        S.get_password() -> password
+        Obtain password.
+        """
+        return _credentials.Credentials_get_password(*args, **kwargs)
+
+    def set_password(*args, **kwargs):
+        """
+        S.set_password(password, obtained=CRED_SPECIFIED) -> None
+        Change password.
+        """
+        return _credentials.Credentials_set_password(*args, **kwargs)
+
+    def set_domain(*args, **kwargs):
+        """
+        S.set_domain(domain, obtained=CRED_SPECIFIED) -> None
+        Change domain name.
+        """
+        return _credentials.Credentials_set_domain(*args, **kwargs)
+
+    def get_realm(*args, **kwargs):
+        """
+        S.get_realm() -> realm
+        Obtain realm name.
+        """
+        return _credentials.Credentials_get_realm(*args, **kwargs)
+
+    def set_realm(*args, **kwargs):
+        """
+        S.set_realm(realm, obtained=CRED_SPECIFIED) -> None
+        Change realm name.
+        """
+        return _credentials.Credentials_set_realm(*args, **kwargs)
+
+    def parse_string(*args, **kwargs):
+        """
+        S.parse_string(text, obtained=CRED_SPECIFIED) -> None
+        Parse credentials string.
+        """
+        return _credentials.Credentials_parse_string(*args, **kwargs)
+
+    def get_bind_dn(*args, **kwargs):
+        """
+        S.get_bind_dn() -> bind dn
+        Obtain bind DN.
+        """
+        return _credentials.Credentials_get_bind_dn(*args, **kwargs)
+
+    def set_bind_dn(*args, **kwargs):
+        """
+        S.set_bind_dn(bind_dn) -> None
+        Change bind DN.
+        """
+        return _credentials.Credentials_set_bind_dn(*args, **kwargs)
+
+    def set_anonymous(*args, **kwargs):
+        """
+        S.set_anonymous() -> None
+        Use anonymous credentials.
+        """
+        return _credentials.Credentials_set_anonymous(*args, **kwargs)
+
+    def wrong_password(*args, **kwargs):
+        """
+        S.wrong_password() -> bool
+        Indicate the returned password was incorrect.
+        """
+        return _credentials.Credentials_wrong_password(*args, **kwargs)
+
+    def set_cmdline_callbacks(*args, **kwargs):
+        """
+        S.set_cmdline_callbacks() -> bool
+        Use command-line to obtain credentials not explicitly set.
+        """
+        return _credentials.Credentials_set_cmdline_callbacks(*args, **kwargs)
+
     __swig_destroy__ = _credentials.delete_Credentials
 Credentials.get_username = new_instancemethod(_credentials.Credentials_get_username,None,Credentials)
 Credentials.set_username = new_instancemethod(_credentials.Credentials_set_username,None,Credentials)
index d460f31927890874c870336ce3d9b23693b5aac7..81ba426e456baec106a12ab7b7d6f9389727dd8c 100644 (file)
@@ -2881,7 +2881,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_username(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   char *  kwnames[] = {
-    (char *) "self",(char *) "value",(char *)"arg3", NULL 
+    (char *) "self",(char *) "value",(char *) "obtained", NULL 
   };
   
   arg1 = NULL;
@@ -2962,7 +2962,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_password(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   char *  kwnames[] = {
-    (char *) "self",(char *) "val",(char *)"arg3", NULL 
+    (char *) "self",(char *) "val",(char *) "obtained", NULL 
   };
   
   arg1 = NULL;
@@ -3043,7 +3043,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_domain(PyObject *SWIGUNUSEDPARM(self)
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   char *  kwnames[] = {
-    (char *) "self",(char *) "val",(char *)"arg3", NULL 
+    (char *) "self",(char *) "val",(char *) "obtained", NULL 
   };
   
   arg1 = NULL;
@@ -3124,7 +3124,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_realm(PyObject *SWIGUNUSEDPARM(self),
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   char *  kwnames[] = {
-    (char *) "self",(char *) "val",(char *)"arg3", NULL 
+    (char *) "self",(char *) "val",(char *) "obtained", NULL 
   };
   
   arg1 = NULL;
@@ -3214,7 +3214,7 @@ SWIGINTERN PyObject *_wrap_Credentials_parse_string(PyObject *SWIGUNUSEDPARM(sel
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   char *  kwnames[] = {
-    (char *) "self",(char *) "text",(char *)"arg3", NULL 
+    (char *) "self",(char *) "text",(char *) "obtained", NULL 
   };
   
   arg1 = NULL;
@@ -3690,19 +3690,52 @@ SWIGINTERN PyObject *Credentials_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObje
 
 static PyMethodDef SwigMethods[] = {
         { (char *)"new_Credentials", (PyCFunction)_wrap_new_Credentials, METH_NOARGS, NULL},
-        { (char *)"Credentials_get_username", (PyCFunction) _wrap_Credentials_get_username, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_username", (PyCFunction) _wrap_Credentials_set_username, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_get_password", (PyCFunction) _wrap_Credentials_get_password, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_password", (PyCFunction) _wrap_Credentials_set_password, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_get_username", (PyCFunction) _wrap_Credentials_get_username, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_username() -> username\n"
+               "Obtain username.\n"
+               ""},
+        { (char *)"Credentials_set_username", (PyCFunction) _wrap_Credentials_set_username, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_username(name, obtained=CRED_SPECIFIED) -> None\n"
+               "Change username.\n"
+               ""},
+        { (char *)"Credentials_get_password", (PyCFunction) _wrap_Credentials_get_password, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_password() -> password\n"
+               "Obtain password.\n"
+               ""},
+        { (char *)"Credentials_set_password", (PyCFunction) _wrap_Credentials_set_password, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_password(password, obtained=CRED_SPECIFIED) -> None\n"
+               "Change password.\n"
+               ""},
         { (char *)"Credentials_get_domain", (PyCFunction) _wrap_Credentials_get_domain, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_domain", (PyCFunction) _wrap_Credentials_set_domain, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_get_realm", (PyCFunction) _wrap_Credentials_get_realm, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_realm", (PyCFunction) _wrap_Credentials_set_realm, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_set_domain", (PyCFunction) _wrap_Credentials_set_domain, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_domain(domain, obtained=CRED_SPECIFIED) -> None\n"
+               "Change domain name.\n"
+               ""},
+        { (char *)"Credentials_get_realm", (PyCFunction) _wrap_Credentials_get_realm, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_realm() -> realm\n"
+               "Obtain realm name.\n"
+               ""},
+        { (char *)"Credentials_set_realm", (PyCFunction) _wrap_Credentials_set_realm, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_realm(realm, obtained=CRED_SPECIFIED) -> None\n"
+               "Change realm name.\n"
+               ""},
         { (char *)"Credentials_set_kerberos_state", (PyCFunction) _wrap_Credentials_set_kerberos_state, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_parse_string", (PyCFunction) _wrap_Credentials_parse_string, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_get_bind_dn", (PyCFunction) _wrap_Credentials_get_bind_dn, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_bind_dn", (PyCFunction) _wrap_Credentials_set_bind_dn, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_anonymous", (PyCFunction) _wrap_Credentials_set_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_parse_string", (PyCFunction) _wrap_Credentials_parse_string, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.parse_string(text, obtained=CRED_SPECIFIED) -> None\n"
+               "Parse credentials string.\n"
+               ""},
+        { (char *)"Credentials_get_bind_dn", (PyCFunction) _wrap_Credentials_get_bind_dn, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_bind_dn() -> bind dn\n"
+               "Obtain bind DN.\n"
+               ""},
+        { (char *)"Credentials_set_bind_dn", (PyCFunction) _wrap_Credentials_set_bind_dn, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_bind_dn(bind_dn) -> None\n"
+               "Change bind DN.\n"
+               ""},
+        { (char *)"Credentials_set_anonymous", (PyCFunction) _wrap_Credentials_set_anonymous, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_anonymous() -> None\n"
+               "Use anonymous credentials.\n"
+               ""},
         { (char *)"Credentials_get_workstation", (PyCFunction) _wrap_Credentials_get_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_set_workstation", (PyCFunction) _wrap_Credentials_set_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_set_machine_account", (PyCFunction) _wrap_Credentials_set_machine_account, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -3710,8 +3743,14 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Credentials_is_anonymous", (PyCFunction) _wrap_Credentials_is_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_authentication_requested", (PyCFunction) _wrap_Credentials_authentication_requested, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Credentials_set_cmdline_callbacks", (PyCFunction) _wrap_Credentials_set_cmdline_callbacks, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.wrong_password() -> bool\n"
+               "Indicate the returned password was incorrect.\n"
+               ""},
+        { (char *)"Credentials_set_cmdline_callbacks", (PyCFunction) _wrap_Credentials_set_cmdline_callbacks, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_cmdline_callbacks() -> bool\n"
+               "Use command-line to obtain credentials not explicitly set.\n"
+               ""},
         { (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_swigregister", Credentials_swigregister, METH_VARARGS, NULL},
         { (char *)"Credentials_swiginit", Credentials_swiginit, METH_VARARGS, NULL},
index 176e67a691b77f40e85568b6bab9f9fbef9eb86c..27a214459a37f4f1884b6578327a1fbbf40ab9f1 100644 (file)
@@ -86,7 +86,7 @@ unused_macros:
        @mkdir -p $(@D)
        @$(STLD) $(STLD_FLAGS) $@ $^
 
-include build/make/templates.mk
+include $(make_utility_dir)/templates.mk
 
 ###############################################################################
 # File types
index 1c0af4dee66609341d157ff5b8782b2dc75f54d3..41a7ccd0a57735de95dcbe36ffa2fa51381f95df 100644 (file)
@@ -92,7 +92,7 @@ PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
 uninstallplugins::
        @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
 installplugins::
-       @ln -fs $(basename $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
+       @ln -fs $(notdir $(1)) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
 
 endef
 
index 652a52fa60520f61b48769d6d5329fb46da99409..8c7d75221c7162b8ecba3106bde8dd40b39f3f85 100644 (file)
@@ -25,7 +25,6 @@ my $section_types = {
                "PUBLIC_DEPENDENCIES"   => "list",
                "ENABLE"                => "bool",
                "LDFLAGS"               => "list",
-               "CFLAGS"                => "list",
        },
        "SUBSYSTEM" => {
                "PRIVATE_DEPENDENCIES"  => "list",
@@ -60,7 +59,6 @@ my $section_types = {
                "ENABLE"                => "bool",
 
                "INSTALLDIR"            => "string",
-               "CFLAGS"                => "list",
                "LDFLAGS"               => "list",
                "STANDARD_VISIBILITY"   => "string",
 
index 0269cfe8a346712698c34f32cf29bbb501b153bf..73801c25fd3afdd1e294cfe3c52895cd71e1f0cf 100644 (file)
@@ -262,6 +262,10 @@ sub CFlags($$)
                if($src_ne_build) {
                        if($flag =~ m#^-I([^/].*$)#) {
                                my $dir = $1;
+                               if ($dir =~ /^\$\(/) {
+                                       push (@cflags, $flag);
+                                       next;
+                               }
                                $dir =~ s#^\$\((?:src|build)dir\)/?##;
                                push(@cflags, "-I$builddir/$dir", "-I$srcdir/$dir");
                                next;
similarity index 78%
rename from source/dynconfig.mk
rename to source/dynconfig/config.mk
index f365911c6a0ffc630546f43d2d372952cec82e1b..5f2887f8b64973b82ff7652d1c7a397a2e9d31c3 100644 (file)
@@ -1,6 +1,7 @@
 [SUBSYSTEM::DYNCONFIG]
 
-DYNCONFIG_OBJ_FILES = dynconfig.o
+DYNCONFIG_OBJ_FILES = $(dynconfigsrcdir)/dynconfig.o \
+                                         $(dynconfigsrcdir)/version.o
 
 # set these to where to find various files
 # These can be overridden by command line switches (see smbd(8))
@@ -9,10 +10,7 @@ CONFIGFILE = $(sysconfdir)/smb.conf
 PKGCONFIGDIR = $(libdir)/pkgconfig
 LMHOSTSFILE = $(sysconfdir)/lmhosts
 
-dynconfig.o: dynconfig.c Makefile
-       @echo Compiling $<
-       @$(CC) $(CFLAGS) $(CPPFLAGS) $(PICFLAG) -c $< -o $@ \
-        -DCONFIGFILE=\"$(CONFIGFILE)\" -DBINDIR=\"$(bindir)\" \
+$(dynconfigsrcdir)/dynconfig.o: CFLAGS+=-DCONFIGFILE=\"$(CONFIGFILE)\" -DBINDIR=\"$(bindir)\" \
         -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
         -DLOCKDIR=\"$(lockdir)\" -DPIDDIR=\"$(piddir)\" -DDATADIR=\"$(datadir)\" \
         -DLOGFILEBASE=\"$(logfilebase)\" \
@@ -23,4 +21,3 @@ dynconfig.o: dynconfig.c Makefile
         -DTORTUREDIR=\"$(TORTUREDIR)\" \
         -DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(winbindd_socket_dir)\"
 
-
index 96677c7e8e659dbc233c73ad3a61b75c830c6276..c449bf80657642adccaedfbc36c62d760b6efbd6 100755 (executable)
@@ -4,21 +4,15 @@
 SELF=$0
 SELFDIR=`dirname ${SELF}`
 
-SRCDIR=$1
-BUILDDIR=$2
-DESTDIR=$3
+BUILDDIR=$1
+DESTDIR=$2
 
-CMD=$4
-FILE=$5
-NAME=$6
-shift 6
+CMD=$3
+FILE=$4
+NAME=$5
+shift 5
 OPTIONS="$@"
 
-test -z "${SRCDIR}" && {
-       echo "${SELF}:SRCDIR: '${SRCDIR}'" >&2;
-       exit 1;
-}
-
 test -z "${BUILDDIR}" && {
        echo "${SELF}:BUILDDIR: '${BUILDDIR}'" >&2;
        exit 1;
@@ -46,14 +40,6 @@ test -z "${NAME}" && {
 
 CURDIR=`pwd`
 
-cd ${SRCDIR} && {
-       ABS_SRCDIR=`pwd`
-       cd ${CURDIR}
-} || {
-       echo "${SELF}:cannot cd into '${SRCDIR}'" >&2;
-       exit 1;
-}
-
 cd ${BUILDDIR} && {
        ABS_BUILDDIR=`pwd`
        cd ${CURDIR}
@@ -63,7 +49,7 @@ cd ${BUILDDIR} && {
 }
 
 cd ${DESTDIR} && {
-       ${ABS_BUILDDIR}/${CMD} ${OPTIONS} ${ABS_SRCDIR}/${FILE} ${NAME} >&2 || exit 1;
+       ${ABS_BUILDDIR}/${CMD} ${OPTIONS} ${FILE} ${NAME} >&2 || exit 1;
        cd ${CURDIR}
 } || {
        echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2;
index a2fbb5e3d0f3d62b5dbf6a7e3000c722ef6a54f6..612178176074143767e732f9c76082b87a7a14a9 100755 (executable)
@@ -29,11 +29,11 @@ if (not defined $options) {
 
 my $header = "$dirname/$prefix.h";
 
-print "$header: $file bin/asn1_compile\n";
-print "\t\@echo \"Compiling ASN1 file $file\"\n";
-print "\t\@\$(builddir)/heimdal_build/asn1_compile_wrapper.sh \$(srcdir) \$(builddir) $dirname bin/asn1_compile $file $prefix $options\n\n";
+print "$header: \$(heimdalsrcdir)/$file \$(ASN1C)\n";
+print "\t\@echo \"Compiling ASN1 file \$(heimdalsrcdir)/$file\"\n";
+print "\t\@\$(heimdalbuildsrcdir)/asn1_compile_wrapper.sh \$(builddir) $dirname \$(ASN1C) \$(abspath \$(heimdalsrcdir)/$file) $prefix $options\n\n";
 
-open(IN,$file) or die("Can't open $file: $!");
+open(IN,"heimdal/$file") or die("Can't open heimdal/$file: $!");
 my @lines = <IN>;
 close(IN);
 foreach my $line (@lines) {
index a4f24c90266ec13e22217f67566ca9329dbeb276..17fc8c93ecc923c4d94a7bf18e6d1df06d2e90ba 100644 (file)
@@ -1,7 +1,9 @@
+heimdalbuildsrcdir = $(heimdalsrcdir)/../heimdal_build
+
 #######################
 # Start SUBSYSTEM HEIMDAL_KDC
 [SUBSYSTEM::HEIMDAL_KDC]
-CFLAGS = -Iheimdal_build -Iheimdal/kdc
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/kdc
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5 HEIMDAL_HDB HEIMDAL_HEIM_ASN1 HEIMDAL_DIGEST_ASN1 HEIMDAL_KX509_ASN1
 PUBLIC_DEPENDENCIES = HEIMDAL_NTLM HEIMDAL_HCRYPTO
 # End SUBSYSTEM HEIMDAL_KDC
@@ -24,14 +26,14 @@ HEIMDAL_KDC_OBJ_FILES = \
        $(heimdalsrcdir)/kdc/kx509.o
 
 [SUBSYSTEM::HEIMDAL_NTLM]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/ntlm
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/ntlm
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5
 
 HEIMDAL_NTLM_OBJ_FILES = \
        $(heimdalsrcdir)/lib/ntlm/ntlm.o
 
 [SUBSYSTEM::HEIMDAL_HDB_KEYS]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/hdb
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/hdb
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5 \
                                           HEIMDAL_HDB_ASN1
 
@@ -40,7 +42,7 @@ HEIMDAL_HDB_KEYS_OBJ_FILES = $(heimdalsrcdir)/lib/hdb/keys.o
 #######################
 # Start SUBSYSTEM HEIMDAL_HDB
 [SUBSYSTEM::HEIMDAL_HDB]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/hdb
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/hdb
 PRIVATE_DEPENDENCIES = HDB_LDB HEIMDAL_KRB5 HEIMDAL_HDB_KEYS HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_COM_ERR HEIMDAL_HDB_ASN1
 # End SUBSYSTEM HEIMDAL_HDB
 #######################
@@ -58,7 +60,7 @@ HEIMDAL_HDB_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_GSSAPI
 [SUBSYSTEM::HEIMDAL_GSSAPI]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/gssapi -Iheimdal/lib/gssapi/gssapi -Iheimdal/lib/gssapi/spnego -Iheimdal/lib/gssapi/krb5 -Iheimdal/lib/gssapi/mech
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/gssapi -I$(heimdalsrcdir)/lib/gssapi/gssapi -I$(heimdalsrcdir)/lib/gssapi/spnego -I$(heimdalsrcdir)/lib/gssapi/krb5 -I$(heimdalsrcdir)/lib/gssapi/mech
 PRIVATE_DEPENDENCIES = HEIMDAL_HCRYPTO HEIMDAL_HEIM_ASN1 HEIMDAL_SPNEGO_ASN1
 PUBLIC_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_KRB5
 # End SUBSYSTEM HEIMDAL_GSSAPI
@@ -176,7 +178,7 @@ HEIMDAL_GSSAPI_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_KRB5
 [SUBSYSTEM::HEIMDAL_KRB5]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/asn1 -Iheimdal/lib/com_err 
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/krb5 -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/com_err 
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_PKINIT_ASN1 HEIMDAL_WIND
 PUBLIC_DEPENDENCIES = HEIMDAL_KRB5_ASN1 HEIMDAL_GLUE HEIMDAL_HX509 HEIMDAL_HCRYPTO
 # End SUBSYSTEM HEIMDAL_KRB5
@@ -273,7 +275,7 @@ HEIMDAL_KRB5_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_HEIM_ASN1
 [SUBSYSTEM::HEIMDAL_HEIM_ASN1]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/asn1
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_COM_ERR
 # End SUBSYSTEM HEIMDAL_KRB5
 #######################
@@ -293,7 +295,7 @@ HEIMDAL_HEIM_ASN1_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_HCRYPTO_IMATH
 [SUBSYSTEM::HEIMDAL_HCRYPTO_IMATH]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/hcrypto/imath 
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/hcrypto/imath 
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN 
 # End SUBSYSTEM HEIMDAL_HCRYPTO_IMATH
 #######################
@@ -303,7 +305,7 @@ HEIMDAL_HCRYPTO_IMATH_OBJ_FILES = \
        $(heimdalsrcdir)/lib/hcrypto/imath/iprime.o
 
 [SUBSYSTEM::HEIMDAL_HCRYPTO]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/hcrypto -Iheimdal/lib
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/hcrypto -I$(heimdalsrcdir)/lib
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HEIM_ASN1 HEIMDAL_HCRYPTO_IMATH HEIMDAL_RFC2459_ASN1
 # End SUBSYSTEM HEIMDAL_HCRYPTO
 #######################
@@ -343,7 +345,7 @@ HEIMDAL_HCRYPTO_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_HX509
 [SUBSYSTEM::HEIMDAL_HX509]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/hx509 
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/hx509 
 PRIVATE_DEPENDENCIES = \
        HEIMDAL_ROKEN HEIMDAL_COM_ERR \
        HEIMDAL_HEIM_ASN1 HEIMDAL_HCRYPTO \
@@ -383,7 +385,7 @@ HEIMDAL_HX509_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_WIND
 [SUBSYSTEM::HEIMDAL_WIND]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/wind 
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/wind 
 PRIVATE_DEPENDENCIES = \
        HEIMDAL_ROKEN HEIMDAL_COM_ERR
 
@@ -406,24 +408,24 @@ HEIMDAL_WIND_OBJ_FILES = \
 #######################
 
 [SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken  -Ilib/socket_wrapper
 
 HEIMDAL_ROKEN_GETPROGNAME_OBJ_FILES = $(heimdalsrcdir)/lib/roken/getprogname.o
+$(HEIMDAL_ROKEN_GETPROGNAME_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken  -I$(socketwrappersrcdir)
 
 [SUBSYSTEM::HEIMDAL_ROKEN_CLOSEFROM] 
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken  -Ilib/socket_wrapper
 
 HEIMDAL_ROKEN_CLOSEFROM_OBJ_FILES = $(heimdalsrcdir)/lib/roken/closefrom.o
+$(HEIMDAL_ROKEN_CLOSEFROM_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken  -I$(socketwrappersrcdir)
 
 [SUBSYSTEM::HEIMDAL_ROKEN_GETPROGNAME_H] 
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken  -Ilib/socket_wrapper
 
 HEIMDAL_ROKEN_GETPROGNAME_H_OBJ_FILES = $(heimdalsrcdir)/lib/roken/getprogname.ho
+$(HEIMDAL_ROKEN_GETPROGNAME_H_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken  -I$(socketwrappersrcdir)
 
 #######################
 # Start SUBSYSTEM HEIMDAL_ROKEN
 [SUBSYSTEM::HEIMDAL_ROKEN]
-CFLAGS =  -Iheimdal_build -Iheimdal/lib/roken -Ilib/socket_wrapper
+CFLAGS =  -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir)
 PUBLIC_DEPENDENCIES = \
                        HEIMDAL_ROKEN_GETPROGNAME \
                        HEIMDAL_ROKEN_CLOSEFROM \
@@ -461,22 +463,22 @@ HEIMDAL_ROKEN_OBJ_FILES = \
        $(heimdalsrcdir)/lib/roken/simple_exec.o \
        $(heimdalsrcdir)/lib/roken/strcollect.o \
        $(heimdalsrcdir)/lib/roken/rtbl.o \
-       ./heimdal_build/replace.o
+       $(heimdalbuildsrcdir)/replace.o
 
 #######################
 # Start SUBSYSTEM HEIMDAL_GLUE
 [SUBSYSTEM::HEIMDAL_GLUE]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/asn1 -Iheimdal/lib/com_err 
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/krb5 -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/com_err 
 PUBLIC_DEPENDENCIES = LIBNETIF LIBSAMBA-HOSTCONFIG
 # End SUBSYSTEM HEIMDAL_GLUE
 #######################
 
-HEIMDAL_GLUE_OBJ_FILES = heimdal_build/glue.o
+HEIMDAL_GLUE_OBJ_FILES = $(heimdalbuildsrcdir)/glue.o
 
 #######################
 # Start SUBSYSTEM HEIMDAL_COM_ERR
 [SUBSYSTEM::HEIMDAL_COM_ERR]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/com_err
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/com_err
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN
 # End SUBSYSTEM HEIMDAL_COM_ERR
 #######################
@@ -488,19 +490,20 @@ HEIMDAL_COM_ERR_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_ASN1_COMPILE_LEX
 [SUBSYSTEM::HEIMDAL_ASN1_COMPILE_LEX]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1 -Iheimdal/lib/roken  -Ilib/socket_wrapper
 # End SUBSYSTEM HEIMDAL_ASN1_COMPILE_LEX
 #######################
 
 HEIMDAL_ASN1_COMPILE_LEX_OBJ_FILES = $(heimdalsrcdir)/lib/asn1/lex.ho 
+$(HEIMDAL_ASN1_COMPILE_LEX_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/asn1 -I$(heimdalsrcdir)/lib/roken -I$(socketwrappersrcdir)
 
 #######################
 # Start BINARY asn1_compile
 [BINARY::asn1_compile]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken
 USE_HOSTCC = YES
 PRIVATE_DEPENDENCIES = HEIMDAL_ASN1_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H LIBREPLACE_NETWORK
 
+ASN1C = $(builddir)/bin/asn1_compile
+
 asn1_compile_OBJ_FILES = \
        $(heimdalsrcdir)/lib/asn1/main.ho \
        $(heimdalsrcdir)/lib/asn1/gen.ho \
@@ -522,8 +525,10 @@ asn1_compile_OBJ_FILES = \
        $(heimdalsrcdir)/lib/roken/ecalloc.ho \
        $(heimdalsrcdir)/lib/asn1/symbol.ho \
        $(heimdalsrcdir)/lib/vers/print_version.ho \
-       ./lib/socket_wrapper/socket_wrapper.ho \
-       ./heimdal_build/replace.ho
+       $(socketwrappersrcdir)/socket_wrapper.ho \
+       $(heimdalbuildsrcdir)/replace.ho
+
+$(asn1_compile_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken -I$(heimdalsrcdir)/lib/asn1
 
 # End BINARY asn1_compile
 #######################
@@ -531,7 +536,7 @@ asn1_compile_OBJ_FILES = \
 #######################
 # Start SUBSYSTEM HEIMDAL_COM_ERR_COMPILE_LEX
 [SUBSYSTEM::HEIMDAL_COM_ERR_COMPILE_LEX]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/com_err -Iheimdal/lib/roken  -Ilib/socket_wrapper
+CFLAGS = -I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/com_err -I$(heimdalsrcdir)/lib/roken  -I$(socketwrappersrcdir)
 # End SUBSYSTEM HEIMDAL_COM_ERR_COMPILE_LEX
 #######################
 
@@ -540,12 +545,13 @@ HEIMDAL_COM_ERR_COMPILE_LEX_OBJ_FILES = $(heimdalsrcdir)/lib/com_err/lex.ho
 #######################
 # Start BINARY compile_et
 [BINARY::compile_et]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken
 USE_HOSTCC = YES
 PRIVATE_DEPENDENCIES = HEIMDAL_COM_ERR_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H LIBREPLACE_NETWORK
 # End BINARY compile_et
 #######################
 
+ET_COMPILER = $(builddir)/bin/compile_et
+
 compile_et_OBJ_FILES = $(heimdalsrcdir)/lib/vers/print_version.ho \
        $(heimdalsrcdir)/lib/com_err/parse.ho \
        $(heimdalsrcdir)/lib/com_err/compile_et.ho \
@@ -553,37 +559,38 @@ compile_et_OBJ_FILES = $(heimdalsrcdir)/lib/vers/print_version.ho \
        $(heimdalsrcdir)/lib/roken/get_window_size.ho \
        $(heimdalsrcdir)/lib/roken/strupr.ho \
        $(heimdalsrcdir)/lib/roken/setprogname.ho \
-       ./lib/socket_wrapper/socket_wrapper.ho \
-       ./heimdal_build/replace.ho
-
-
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hdb/hdb.asn1 hdb_asn1 heimdal/lib/hdb |
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/spnego/spnego.asn1 spnego_asn1 heimdal/lib/gssapi --sequence=MechTypeList |
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/mech/gssapi.asn1 gssapi_asn1 heimdal/lib/gssapi|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/k5.asn1 krb5_asn1 heimdal/lib/asn1 --encode-rfc1510-bit-string --sequence=KRB5SignedPathPrincipals --sequence=AuthorizationData --sequence=METHOD-DATA|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/digest.asn1 digest_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs8.asn1 pkcs8_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs9.asn1 pkcs9_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs12.asn1 pkcs12_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/rfc2459.asn1 rfc2459_asn1 heimdal/lib/asn1 --preserve-binary=TBSCertificate --preserve-binary=TBSCRLCertList --preserve-binary=Name --sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoints|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkinit.asn1 pkinit_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/CMS.asn1 cms_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hx509/ocsp.asn1 ocsp_asn1 heimdal/lib/hx509 --preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/kx509.asn1 kx509_asn1 heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hx509/pkcs10.asn1 pkcs10_asn1 heimdal/lib/hx509 --preserve-binary=CertificationRequestInfo|
+       $(socketwrappersrcdir)/socket_wrapper.ho \
+       $(heimdalbuildsrcdir)/replace.ho
+
+$(compile_et_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken
+
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/hdb/hdb.asn1 hdb_asn1 \$\(heimdalsrcdir\)/lib/hdb |
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/gssapi/spnego/spnego.asn1 spnego_asn1 \$\(heimdalsrcdir\)/lib/gssapi --sequence=MechTypeList |
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/gssapi/mech/gssapi.asn1 gssapi_asn1 \$\(heimdalsrcdir\)/lib/gssapi|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/k5.asn1 krb5_asn1 \$\(heimdalsrcdir\)/lib/asn1 --encode-rfc1510-bit-string --sequence=KRB5SignedPathPrincipals --sequence=AuthorizationData --sequence=METHOD-DATA|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/digest.asn1 digest_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/pkcs8.asn1 pkcs8_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/pkcs9.asn1 pkcs9_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/pkcs12.asn1 pkcs12_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/rfc2459.asn1 rfc2459_asn1 \$\(heimdalsrcdir\)/lib/asn1 --preserve-binary=TBSCertificate --preserve-binary=TBSCRLCertList --preserve-binary=Name --sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoints|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/pkinit.asn1 pkinit_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/CMS.asn1 cms_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/hx509/ocsp.asn1 ocsp_asn1 \$\(heimdalsrcdir\)/lib/hx509 --preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/asn1/kx509.asn1 kx509_asn1 \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh asn1_deps.pl lib/hx509/pkcs10.asn1 pkcs10_asn1 \$\(heimdalsrcdir\)/lib/hx509 --preserve-binary=CertificationRequestInfo|
 
 #
 # Ensure to update ./static_deps.mk when you add a new entry here!
 #
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/asn1/asn1_err.et heimdal/lib/asn1|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/hdb/hdb_err.et heimdal/lib/hdb|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/heim_err.et heimdal/lib/krb5|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/k524_err.et heimdal/lib/krb5|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/krb_err.et heimdal/lib/krb5|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/krb5_err.et heimdal/lib/krb5|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/gssapi/krb5/gkrb5_err.et heimdal/lib/gssapi|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/hx509/hx509_err.et heimdal/lib/hx509|
-mkinclude perl_path_wrapper.sh et_deps.pl heimdal/lib/wind/wind_err.et heimdal/lib/wind|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/asn1/asn1_err.et \$\(heimdalsrcdir\)/lib/asn1|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/hdb/hdb_err.et \$\(heimdalsrcdir\)/lib/hdb|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/krb5/heim_err.et \$\(heimdalsrcdir\)/lib/krb5|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/krb5/k524_err.et \$\(heimdalsrcdir\)/lib/krb5|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/krb5/krb_err.et \$\(heimdalsrcdir\)/lib/krb5|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/krb5/krb5_err.et \$\(heimdalsrcdir\)/lib/krb5|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/gssapi/krb5/gkrb5_err.et \$\(heimdalsrcdir\)/lib/gssapi|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/hx509/hx509_err.et \$\(heimdalsrcdir\)/lib/hx509|
+mkinclude perl_path_wrapper.sh et_deps.pl lib/wind/wind_err.et \$\(heimdalsrcdir\)/lib/wind|
 
 clean::        
        @-rm -f bin/compile_et bin/asn1_compile
@@ -591,7 +598,7 @@ clean::
 #######################
 # Start SUBSYSTEM HEIMDAL
 [SUBSYSTEM::HEIMDAL]
-CFLAGS = -Iheimdal_build
+CFLAGS = -I$(heimdalbuildsrcdir)
 PUBLIC_DEPENDENCIES = \
                HEIMDAL_GSSAPI HEIMDAL_KRB5
 # End SUBSYSTEM HEIMDAL
@@ -602,7 +609,6 @@ HEIMDAL_OBJ_FILES = $(heimdalsrcdir)/lib/vers/print_version.o
 #######################
 # Start BINARY compile_et
 [BINARY::samba4kinit]
-CFLAGS = -Iheimdal_build -Iheimdal/lib/roken
 PRIVATE_DEPENDENCIES = HEIMDAL_KRB5 HEIMDAL_NTLM
 # End BINARY compile_et
 #######################
@@ -612,5 +618,7 @@ samba4kinit_OBJ_FILES = $(heimdalsrcdir)/kuser/kinit.o \
        $(heimdalsrcdir)/lib/roken/setprogname.o \
        $(heimdalsrcdir)/lib/roken/getarg.o 
 
+$(samba4kinit_OBJ_FILES): CFLAGS+=-I$(heimdalbuildsrcdir) -I$(heimdalsrcdir)/lib/roken
+
 dist:: $(heimdalsrcdir)/lib/asn1/lex.c $(heimdalsrcdir)/lib/com_err/lex.c \
        $(heimdalsrcdir)/lib/asn1/parse.c $(heimdalsrcdir)/lib/com_err/parse.c
index d7d47ba363fee296beaf5adaed3040079b392824..ec3b39ff560c2fe530c31ca786b924221450b398 100755 (executable)
@@ -4,19 +4,13 @@
 SELF=$0
 SELFDIR=`dirname ${SELF}`
 
-SRCDIR=$1
-BUILDDIR=$2
-DESTDIR=$3
+BUILDDIR=$1
+DESTDIR=$2
 
-CMD=$4
-FILE=$5
-SOURCE=$6
-shift 6
-
-test -z "${SRCDIR}" && {
-       echo "${SELF}:SRCDIR: '${SRCDIR}'" >&2;
-       exit 1;
-}
+CMD=$3
+FILE=$4
+SOURCE=$5
+shift 5
 
 test -z "${BUILDDIR}" && {
        echo "${SELF}:BUILDDIR: '${BUILDDIR}'" >&2;
@@ -45,14 +39,6 @@ test -z "${SOURCE}" && {
 
 CURDIR=`pwd`
 
-cd ${SRCDIR} && {
-       ABS_SRCDIR=`pwd`
-       cd ${CURDIR}
-} || {
-       echo "${SELF}:cannot cd into '${SRCDIR}'" >&2;
-       exit 1;
-}
-
 cd ${BUILDDIR} && {
        ABS_BUILDDIR=`pwd`
        cd ${CURDIR}
@@ -62,7 +48,7 @@ cd ${BUILDDIR} && {
 }
 
 cd ${DESTDIR} && {
-       ${ABS_BUILDDIR}/${CMD} ${ABS_SRCDIR}/${FILE} >&2 || exit 1;
+       ${ABS_BUILDDIR}/${CMD} ${FILE} >&2 || exit 1;
        cd ${CURDIR}
        TMP="${SOURCE}.$$"
        mv ${SOURCE} ${TMP} && {
index 2385dbd085483218ba287b7b2be0273c2bece602..6a0485bb54a56a9a7ee5d26c18599cb75f8c03bf 100755 (executable)
@@ -8,9 +8,9 @@ my $basename = basename($file);
 
 my $header = "$dirname/$basename"; $header =~ s/\.et$/.h/;
 my $source = "$dirname/$basename"; $source =~ s/\.et$/.c/;
-print "$header $source: $file bin/compile_et\n";
+print "$header $source: \$(heimdalsrcdir)/$file \$(ET_COMPILER)\n";
 print "\t\@echo \"Compiling error table $file\"\n";
-print "\t\@\$(builddir)/heimdal_build/et_compile_wrapper.sh \$(srcdir) \$(builddir) $dirname bin/compile_et $file $source\n\n";
+print "\t\@\$(heimdalbuildsrcdir)/et_compile_wrapper.sh \$(builddir) $dirname \$(ET_COMPILER) \$(abspath \$(heimdalsrcdir)/$file) $source\n\n";
 
 print "clean:: \n";
 print "\t\@rm -f $header $source\n\n";
index c496c5d905085986c3b57dd3555f2a4b93aeb3a1..19a4f3236cfdedcdc5cffe9541d7b9cb427021c8 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "includes.h"
 #include "system/locale.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 #include "param/param.h"
 
 /**
index 73b3eecfbfee0aad97d3cbbd61441212d3d31441..96d8b8b40a1a7937490c0baa9fc8eaaad11e933c 100644 (file)
@@ -23,7 +23,7 @@
 #include "version.h"
 #include "lib/cmdline/popt_common.h"
 #include "param/param.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 
 /* Handle command line options:
  *             -d,--debuglevel 
index c16d482efc61d6caaab6f97bc88f0c6747b182d8..5f790aeac54d5d4d8efedfb121bc1712a7048ac2 100644 (file)
@@ -16,7 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-%module(package="samba.events") events;
+%module(docstring="Event management.",package="samba.events") events;
 
 %import "../talloc/talloc.i";
 
@@ -27,8 +27,11 @@ typedef struct event_context event;
 
 typedef struct event_context {
     %extend {
+        %feature("docstring") event "S.__init__()";
         event(TALLOC_CTX *mem_ctx) { return event_context_init(mem_ctx); }
+        %feature("docstring") loop_once "S.loop_once() -> int";
         int loop_once(void);
+        %feature("docstring") loop_wait "S.loop_wait() -> int";
         int loop_wait(void);
     }
 } event;
@@ -44,6 +47,8 @@ typedef struct event_context {
 
 struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name);
 
+%feature("docstring") event_backend_list "event_backend_list() -> list";
 const char **event_backend_list(TALLOC_CTX *mem_ctx);
+%feature("docstring") event_set_default_backend "event_set_default_backend(name) -> None";
 %rename(set_default_backend) event_set_default_backend;
 void event_set_default_backend(const char *backend);
index 237726897dd78ce01a9fcd54f081afc991b148c7..90695e3d92f587222883148a67117babd8bd877b 100644 (file)
@@ -3,6 +3,10 @@
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+Event management.
+"""
+
 import _events
 import new
 new_instancemethod = new.instancemethod
@@ -61,7 +65,16 @@ class event(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
     def __init__(self, *args, **kwargs): 
+        """S.__init__()"""
         _events.event_swiginit(self,_events.new_event(*args, **kwargs))
+    def loop_once(*args, **kwargs):
+        """S.loop_once() -> int"""
+        return _events.event_loop_once(*args, **kwargs)
+
+    def loop_wait(*args, **kwargs):
+        """S.loop_wait() -> int"""
+        return _events.event_loop_wait(*args, **kwargs)
+
     __swig_destroy__ = _events.delete_event
 event.loop_once = new_instancemethod(_events.event_loop_once,None,event)
 event.loop_wait = new_instancemethod(_events.event_loop_wait,None,event)
@@ -69,7 +82,13 @@ event_swigregister = _events.event_swigregister
 event_swigregister(event)
 
 event_context_init_byname = _events.event_context_init_byname
-event_backend_list = _events.event_backend_list
-set_default_backend = _events.set_default_backend
+
+def event_backend_list(*args):
+  """event_backend_list() -> list"""
+  return _events.event_backend_list(*args)
+
+def set_default_backend(*args, **kwargs):
+  """event_set_default_backend(name) -> None"""
+  return _events.set_default_backend(*args, **kwargs)
 
 
index 727485dfdb84dc8b1c19e172f30be804ab5e8abe..ccaeab7ad6a868913c69852b89cf82cefc7bd613 100644 (file)
@@ -2773,15 +2773,15 @@ fail:
 
 
 static PyMethodDef SwigMethods[] = {
-        { (char *)"new_event", (PyCFunction)_wrap_new_event, METH_NOARGS, NULL},
-        { (char *)"event_loop_once", (PyCFunction)_wrap_event_loop_once, METH_O, NULL},
-        { (char *)"event_loop_wait", (PyCFunction)_wrap_event_loop_wait, METH_O, NULL},
+        { (char *)"new_event", (PyCFunction)_wrap_new_event, METH_NOARGS, (char *)"S.__init__()"},
+        { (char *)"event_loop_once", (PyCFunction)_wrap_event_loop_once, METH_O, (char *)"S.loop_once() -> int"},
+        { (char *)"event_loop_wait", (PyCFunction)_wrap_event_loop_wait, METH_O, (char *)"S.loop_wait() -> int"},
         { (char *)"delete_event", (PyCFunction)_wrap_delete_event, METH_O, NULL},
         { (char *)"event_swigregister", event_swigregister, METH_VARARGS, NULL},
         { (char *)"event_swiginit", event_swiginit, METH_VARARGS, NULL},
         { (char *)"event_context_init_byname", (PyCFunction) _wrap_event_context_init_byname, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"event_backend_list", (PyCFunction)_wrap_event_backend_list, METH_NOARGS, NULL},
-        { (char *)"set_default_backend", (PyCFunction) _wrap_set_default_backend, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"event_backend_list", (PyCFunction)_wrap_event_backend_list, METH_NOARGS, (char *)"event_backend_list() -> list"},
+        { (char *)"set_default_backend", (PyCFunction) _wrap_set_default_backend, METH_VARARGS | METH_KEYWORDS, (char *)"event_set_default_backend(name) -> None"},
         { NULL, NULL, 0, NULL }
 };
 
index e8852980f634e989d5a681ab3eba5894a914c788..cc8f1e36ab84da20cccbdab4d98ba09ab7c492cf 100644 (file)
@@ -2,11 +2,11 @@
 # Start MODULE ldb_asq
 [MODULE::ldb_asq]
 PRIVATE_DEPENDENCIES = LIBTALLOC
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 INIT_FUNCTION = LDB_MODULE(asq)
 SUBSYSTEM = LIBLDB
 
-ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o
+ldb_asq_OBJ_FILES = $(ldbdir)/modules/asq.o
 # End MODULE ldb_asq
 ################################################
 
@@ -14,106 +14,106 @@ ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o
 # Start MODULE ldb_server_sort
 [MODULE::ldb_server_sort]
 PRIVATE_DEPENDENCIES = LIBTALLOC
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 INIT_FUNCTION = LDB_MODULE(server_sort)
 SUBSYSTEM = LIBLDB
 
 # End MODULE ldb_sort
 ################################################
-ldb_server_sort_OBJ_FILES = lib/ldb/modules/sort.o
+ldb_server_sort_OBJ_FILES = $(ldbdir)/modules/sort.o
 
 ################################################
 # Start MODULE ldb_paged_results
 [MODULE::ldb_paged_results]
 INIT_FUNCTION = LDB_MODULE(paged_results)
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_paged_results
 ################################################
 
-ldb_paged_results_OBJ_FILES = lib/ldb/modules/paged_results.o
+ldb_paged_results_OBJ_FILES = $(ldbdir)/modules/paged_results.o
 
 ################################################
 # Start MODULE ldb_paged_results
 [MODULE::ldb_paged_searches]
 INIT_FUNCTION = LDB_MODULE(paged_searches)
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
 # End MODULE ldb_paged_results
 ################################################
 
-ldb_paged_searches_OBJ_FILES = lib/ldb/modules/paged_searches.o
+ldb_paged_searches_OBJ_FILES = $(ldbdir)/modules/paged_searches.o
 
 ################################################
 # Start MODULE ldb_operational
 [MODULE::ldb_operational]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 INIT_FUNCTION = LDB_MODULE(operational)
 # End MODULE ldb_operational
 ################################################
 
-ldb_operational_OBJ_FILES = lib/ldb/modules/operational.o
+ldb_operational_OBJ_FILES = $(ldbdir)/modules/operational.o
 
 ################################################
 # Start MODULE ldb_rdn_name
 [MODULE::ldb_rdn_name]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 INIT_FUNCTION = LDB_MODULE(rdn_name)
 # End MODULE ldb_rdn_name
 ################################################
 
-ldb_rdn_name_OBJ_FILES = lib/ldb/modules/rdn_name.o
+ldb_rdn_name_OBJ_FILES = $(ldbdir)/modules/rdn_name.o
 
-ldb_map_OBJ_FILES = $(addprefix lib/ldb/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o)
+ldb_map_OBJ_FILES = $(addprefix $(ldbdir)/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o)
 
-$(ldb_map_OBJ_FILES): CFLAGS+=-Ilib/ldb/ldb_map
+$(ldb_map_OBJ_FILES): CFLAGS+=-I$(ldbdir)/ldb_map
 
 ################################################
 # Start MODULE ldb_skel
 [MODULE::ldb_skel]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 INIT_FUNCTION = LDB_MODULE(skel)
 # End MODULE ldb_skel
 ################################################
 
-ldb_skel_OBJ_FILES = lib/ldb/modules/skel.o
+ldb_skel_OBJ_FILES = $(ldbdir)/modules/skel.o
 
 ################################################
 # Start MODULE ldb_sqlite3
 [MODULE::ldb_sqlite3]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC
 # End MODULE ldb_sqlite3
 ################################################
 
-ldb_sqlite3_OBJ_FILES = lib/ldb/ldb_sqlite3/ldb_sqlite3.o
+ldb_sqlite3_OBJ_FILES = $(ldbdir)/ldb_sqlite3/ldb_sqlite3.o
 
 ################################################
 # Start MODULE ldb_tdb
 [MODULE::ldb_tdb]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_tdb
+CFLAGS = -I$(ldbdir)/include -I$(ldbdir)/ldb_tdb
 PRIVATE_DEPENDENCIES = \
                LIBTDB LIBTALLOC
 # End MODULE ldb_tdb
 ################################################
 
-ldb_tdb_OBJ_FILES = $(addprefix lib/ldb/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o)
+ldb_tdb_OBJ_FILES = $(addprefix $(ldbdir)/ldb_tdb/, ldb_tdb.o ldb_search.o ldb_pack.o ldb_index.o ldb_cache.o ldb_tdb_wrap.o)
 
 
 ################################################
 # Start SUBSYSTEM ldb
 [LIBRARY::LIBLDB]
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 INIT_FUNCTION_TYPE = extern const struct ldb_module_ops
 PUBLIC_DEPENDENCIES = \
                LIBTALLOC
@@ -128,7 +128,9 @@ PC_FILES += $(ldbdir)/ldb.pc
 LIBLDB_VERSION = 0.0.1
 LIBLDB_SOVERSION = 0
 
-LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES)
+LIBLDB_OBJ_FILES = $(addprefix $(ldbdir)/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES)
+
+$(LIBLDB_OBJ_FILES): CFLAGS+=-I$(ldbdir)/include
 
 PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h
 
@@ -142,7 +144,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbtest
 ################################################
 
-ldbtest_OBJ_FILES = lib/ldb/tools/ldbtest.o
+ldbtest_OBJ_FILES = $(ldbdir)/tools/ldbtest.o
 
 ################################################
 # Start BINARY oLschema2ldif
@@ -154,7 +156,7 @@ PRIVATE_DEPENDENCIES = \
 ################################################
 
 
-oLschema2ldif_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o oLschema2ldif.o)
+oLschema2ldif_OBJ_FILES = $(addprefix $(ldbdir)/tools/, convert.o oLschema2ldif.o)
 
 MANPAGES += $(ldbdir)/man/oLschema2ldif.1
 
@@ -167,7 +169,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ad2oLschema
 ################################################
 
-ad2oLschema_OBJ_FILES = $(addprefix lib/ldb/tools/, convert.o ad2oLschema.o)
+ad2oLschema_OBJ_FILES = $(addprefix $(ldbdir)/tools/, convert.o ad2oLschema.o)
 
 MANPAGES += $(ldbdir)/man/ad2oLschema.1
 
index 18e981f7bea008a2a10ff3b57c5121834960d63a..061d13a2ddc8de0281f42d577e3ae44d3e193053 100644 (file)
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-%module ldb
+%define DOCSTRING
+"An interface to LDB, a LDAP-like API that can either to talk an embedded database (TDB-based) or a standards-compliant LDAP server."
+%enddef
+
+%module(docstring=DOCSTRING) ldb
 
 %{
 
@@ -40,7 +44,7 @@ typedef struct ldb_message ldb_msg;
 typedef struct ldb_context ldb;
 typedef struct ldb_dn ldb_dn;
 typedef struct ldb_ldif ldb_ldif;
-typedef struct ldb_message_element ldb_msg_element;
+typedef struct ldb_message_element ldb_message_element;
 typedef int ldb_error;
 typedef int ldb_int_error;
 
@@ -194,8 +198,11 @@ PyObject *ldb_val_to_py_object(struct ldb_context *ldb_ctx,
 %rename(__cmp__) ldb_dn::compare;
 %rename(__len__) ldb_dn::get_comp_num;
 %rename(Dn) ldb_dn;
+%feature("docstring") ldb_dn "A LDB distinguished name.";
 typedef struct ldb_dn {
     %extend {
+        %feature("docstring") ldb_dn "S.__init__(ldb, string)\n" \
+                 "Create a new DN.";
         ldb_dn(ldb *ldb_ctx, const char *str)
         {
             ldb_dn *ret = ldb_dn_new(ldb_ctx, ldb_ctx, str);
@@ -210,21 +217,37 @@ fail:
             return ret;
         }
         ~ldb_dn() { talloc_free($self); }
+        %feature("docstring") validate "S.validate() -> bool\n" \
+                                       "Validate DN is correct.";
         bool validate();
         const char *get_casefold();
         const char *get_linearized();
+        %feature("docstring") parent "S.parent() -> dn\n" \
+                                     "Get the parent for this DN.";
         ldb_dn *parent() { return ldb_dn_get_parent(NULL, $self); }
         int compare(ldb_dn *other);
         bool is_valid();
+        %feature("docstring") is_special "S.is_special() -> bool\n" \
+                                         "Check whether this is a special LDB DN.";
         bool is_special();
+        %feature("docstring") is_null "S.is_null() -> bool\n" \
+                                         "Check whether this is a null DN.";
         bool is_null();
         bool check_special(const char *name);
         int get_comp_num();
+        %feature("docstring") add_child "S.add_child(dn) -> None\n" \
+                                         "Add a child DN to this DN.";
         bool add_child(ldb_dn *child);
+        %feature("docstring") add_base "S.add_base(dn) -> None\n" \
+                                         "Add a base DN to this DN.";
         bool add_base(ldb_dn *base);
+        %feature("docstring") canonical_str "S.canonical_str() -> string\n" \
+                                         "Canonical version of this DN (like a posix path).";
         const char *canonical_str() {
             return ldb_dn_canonical_string($self, $self);
         }
+        %feature("docstring") canonical_ex_str "S.canonical_ex_str() -> string\n" \
+                                               "Canonical version of this DN (like a posix path, with terminating newline).";
         const char *canonical_ex_str() {
             return ldb_dn_canonical_ex_string($self, $self);
         }
@@ -289,7 +312,7 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
     return ret;
 }
 
-ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
+ldb_message_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
                                                PyObject *set_obj, int flags,
                                                const char *attr_name)
 {
@@ -320,7 +343,7 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
 }
 
 PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, 
-                                 ldb_msg_element *me)
+                                 ldb_message_element *me)
 {
     int i;
     PyObject *result;
@@ -340,11 +363,16 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx,
 #endif
 
 /* ldb_message_element */
-%rename(__cmp__) ldb_message_element::compare;
-%rename(MessageElement) ldb_msg_element;
+%rename(MessageElement) ldb_message_element;
+%feature("docstring") ldb_message_element "Message element.";
 typedef struct ldb_message_element {
     %extend {
 #ifdef SWIGPYTHON
+        int __cmp__(ldb_message_element *other)
+        {
+            return ldb_msg_element_compare($self, other);
+        }
+
         PyObject *__iter__(void)
         {
             return PyObject_GetIter(ldb_msg_element_to_set(NULL, $self));
@@ -355,7 +383,7 @@ typedef struct ldb_message_element {
             return ldb_msg_element_to_set(NULL, $self);
         }
 
-        ldb_msg_element(PyObject *set_obj, int flags=0, const char *name = NULL)
+        ldb_message_element(PyObject *set_obj, int flags=0, const char *name = NULL)
         {
             return ldb_msg_element_from_pyobject(NULL, set_obj, flags, name);
         }
@@ -374,8 +402,7 @@ typedef struct ldb_message_element {
             return ldb_val_to_py_object(NULL, $self, &$self->values[i]);
         }
 
-        ~ldb_msg_element() { talloc_free($self); }
-        int compare(ldb_msg_element *);
+        ~ldb_message_element() { talloc_free($self); }
     }
     %pythoncode {
         def __getitem__(self, i):
@@ -398,21 +425,20 @@ typedef struct ldb_message_element {
                     return False
             return True
     }
-} ldb_msg_element;
+} ldb_message_element;
 
 /* ldb_message */
 
+%feature("docstring") ldb_message "Message.";
 %rename(Message) ldb_message;
 #ifdef SWIGPYTHON
 %rename(__delitem__) ldb_message::remove_attr;
-%typemap(out) ldb_msg_element * {
+%typemap(out) ldb_message_element * {
        if ($1 == NULL)
                PyErr_SetString(PyExc_KeyError, "no such element");
     else
         $result = SWIG_NewPointerObj($1, SWIGTYPE_p_ldb_message_element, 0);
 }
-//%typemap(out) ldb_msg_element *;
-
 
 %inline {
     PyObject *ldb_msg_list_elements(ldb_msg *msg)
@@ -443,10 +469,10 @@ typedef struct ldb_message {
             return ret;
         }
         ~ldb_msg() { talloc_free($self); }
-        ldb_msg_element *find_element(const char *name);
+        ldb_message_element *find_element(const char *name);
         
 #ifdef SWIGPYTHON
-        void __setitem__(const char *attr_name, ldb_msg_element *val)
+        void __setitem__(const char *attr_name, ldb_message_element *val)
         {
             struct ldb_message_element *el;
             
@@ -600,6 +626,7 @@ PyObject *PyExc_LdbError;
 }
 
 %rename(Ldb) ldb_context;
+%feature("docstring") ldb_context "Connection to a LDB database.";
 
 %typemap(in,noblock=1) struct ldb_dn * {
     if (ldb_dn_from_pyobject(NULL, $input, arg1, &$1) != 0) {
@@ -613,7 +640,7 @@ PyObject *PyExc_LdbError;
 
 %typemap(in,numinputs=1) ldb_msg *add_msg {
     Py_ssize_t dict_pos, msg_pos;
-    ldb_msg_element *msgel;
+    ldb_message_element *msgel;
     PyObject *key, *value;
 
     if (PyDict_Check($input)) {
@@ -660,6 +687,8 @@ typedef struct ldb_context {
     %extend {
         ldb(void) { return ldb_init(NULL); }
 
+        %feature("docstring") connect "S.connect(url,flags=0,options=None) -> None\n" \
+                                      "Connect to a LDB URL.";
         ldb_error connect(const char *url, unsigned int flags = 0, 
             const char *options[] = NULL);
 
@@ -707,11 +736,19 @@ typedef struct ldb_context {
             return ret;
         }
 
+        %feature("docstring") delete "S.delete(dn) -> None\n" \
+                                     "Remove an entry.";
         ldb_error delete(ldb_dn *dn);
+        %feature("docstring") rename "S.rename(old_dn, new_dn) -> None\n" \
+                                     "Rename an entry.";
         ldb_error rename(ldb_dn *olddn, ldb_dn *newdn);
         struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx, 
                                                    const char * const*control_strings);
+        %feature("docstring") add "S.add(message) -> None\n" \
+                                  "Add an entry.";
         ldb_error add(ldb_msg *add_msg);
+        %feature("docstring") modify "S.modify(message) -> None\n" \
+                                  "Modify an entry.";
         ldb_error modify(ldb_msg *message);
         ldb_dn *get_config_basedn();
         ldb_dn *get_root_basedn();
@@ -747,20 +784,39 @@ typedef struct ldb_context {
         }
 
         const char *errstring();
+        %feature("docstring") set_create_perms "S.set_create_perms(mode) -> None\n" \
+                                               "Set mode to use when creating new LDB files.";
         void set_create_perms(unsigned int perms);
+        %feature("docstring") set_modules_dir "S.set_modules_dir(path) -> None\n" \
+                                              "Set path LDB should search for modules";
         void set_modules_dir(const char *path);
+        %feature("docstring") set_debug "S.set_debug(callback) -> None\n" \
+                                        "Set callback for LDB debug messages.\n" \
+                                        "The callback should accept a debug level and debug text.";
         ldb_error set_debug(void (*debug)(void *context, enum ldb_debug_level level, 
                                           const char *fmt, va_list ap),
                             void *context);
+        %feature("docstring") set_opaque "S.set_opaque(name, value) -> None\n" \
+            "Set an opaque value on this LDB connection. \n"
+            ":note: Passing incorrect values may cause crashes.";
         ldb_error set_opaque(const char *name, void *value);
+        %feature("docstring") get_opaque "S.get_opaque(name) -> value\n" \
+            "Get an opaque value set on this LDB connection. \n"
+            ":note: The returned value may not be useful in Python.";
         void *get_opaque(const char *name);
+        %feature("docstring") transaction_start "S.transaction_start() -> None\n" \
+                                                "Start a new transaction.";
         ldb_error transaction_start();
+        %feature("docstring") transaction_commit "S.transaction_commit() -> None\n" \
+                                                 "Commit currently active transaction.";
         ldb_error transaction_commit();
+        %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n" \
+                                                 "Cancel currently active transaction.";
         ldb_error transaction_cancel();
         void schema_attribute_remove(const char *name);
         ldb_error schema_attribute_add(const char *attribute, unsigned flags, const char *syntax);
-       ldb_error setup_wellknown_attributes(void);
-       
+        ldb_error setup_wellknown_attributes(void);
 #ifdef SWIGPYTHON
         %typemap(in,numinputs=0,noblock=1) struct ldb_result **result_as_bool (struct ldb_result *tmp) { $1 = &tmp; }
         %typemap(argout,noblock=1) struct ldb_result **result_as_bool { $result = ((*$1)->count > 0)?Py_True:Py_False; }
@@ -771,6 +827,9 @@ typedef struct ldb_context {
                              result_as_bool);
         }
 
+        %feature("docstring") parse_ldif "S.parse_ldif(ldif) -> iter(messages)\n" \
+            "Parse a string formatted using LDIF.";
+
         PyObject *parse_ldif(const char *s)
         {
             PyObject *list = PyList_New(0);
@@ -791,12 +850,25 @@ typedef struct ldb_context {
     }
     %pythoncode {
         def __init__(self, url=None, flags=0, options=None):
+            """Create a new LDB object.
+
+            Will also connect to the specified URL if one was given.
+            """
             _ldb.Ldb_swiginit(self,_ldb.new_Ldb())
             if url is not None:
                 self.connect(url, flags, options)
 
         def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, 
                    attrs=None, controls=None):
+            """Search in a database.
+
+            :param base: Optional base DN to search
+            :param scope: Search scope (SCOPE_BASE, SCOPE_ONELEVEL or SCOPE_SUBTREE)
+            :param expression: Optional search expression
+            :param attrs: Attributes to return (defaults to all)
+            :param controls: Optional list of controls
+            :return: Iterator over Message objects
+            """
             if not (attrs is None or isinstance(attrs, list)):
                 raise TypeError("attributes not a list")
             parsed_controls = None
@@ -816,10 +888,15 @@ typedef struct ldb_context {
 %nodefault Dn;
 
 %rename(valid_attr_name) ldb_valid_attr_name;
+%feature("docstring") ldb_valid_attr_name "S.valid_attr_name(name) -> bool\n"
+                                          "Check whether the supplied name is a valid attribute name.";
 int ldb_valid_attr_name(const char *s);
 
 typedef unsigned long time_t;
 
+%feature("docstring") timestring "S.timestring(int) -> string\n"
+                                 "Generate a LDAP time string from a UNIX timestamp";
+
 %inline %{
 static char *timestring(time_t t)
 {
@@ -831,6 +908,8 @@ static char *timestring(time_t t)
 %}
 
 %rename(string_to_time) ldb_string_to_time;
+%feature("docstring") ldb_string_to_time "S.string_to_time(string) -> int\n"
+                                     "Parse a LDAP time string into a UNIX timestamp.";
 time_t ldb_string_to_time(const char *s);
 
 %typemap(in,noblock=1) const struct ldb_module_ops * {
@@ -839,5 +918,11 @@ time_t ldb_string_to_time(const char *s);
     $1->name = (char *)PyObject_GetAttrString($input, (char *)"name");
 }
 
+%feature("docstring") ldb_register_module "S.register_module(module) -> None\n"
+                                          "Register a LDB module.";
 %rename(register_module) ldb_register_module;
 ldb_int_error ldb_register_module(const struct ldb_module_ops *);
+
+%pythoncode {
+__docformat__ = "restructuredText"
+}
index e9f4055fbf7c8fdf221c093645f6c7f76ac789f9..ae2c187367fdd455f03cb308a6cc87e36428e14a 100644 (file)
@@ -3,6 +3,10 @@
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+An interface to LDB, a LDAP-like API that can either to talk an embedded database (TDB-based) or a standards-compliant LDAP server.
+"""
+
 import _ldb
 import new
 new_instancemethod = new.instancemethod
@@ -67,10 +71,71 @@ CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE
 CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY
 ldb_val_to_py_object = _ldb.ldb_val_to_py_object
 class Dn(object):
+    """A LDB distinguished name."""
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     def __init__(self, *args, **kwargs): 
+        """
+        S.__init__(ldb, string)
+        Create a new DN.
+        """
         _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs))
     __swig_destroy__ = _ldb.delete_Dn
+    def validate(*args, **kwargs):
+        """
+        S.validate() -> bool
+        Validate DN is correct.
+        """
+        return _ldb.Dn_validate(*args, **kwargs)
+
+    def parent(*args, **kwargs):
+        """
+        S.parent() -> dn
+        Get the parent for this DN.
+        """
+        return _ldb.Dn_parent(*args, **kwargs)
+
+    def is_special(*args, **kwargs):
+        """
+        S.is_special() -> bool
+        Check whether this is a special LDB DN.
+        """
+        return _ldb.Dn_is_special(*args, **kwargs)
+
+    def is_null(*args, **kwargs):
+        """
+        S.is_null() -> bool
+        Check whether this is a null DN.
+        """
+        return _ldb.Dn_is_null(*args, **kwargs)
+
+    def add_child(*args, **kwargs):
+        """
+        S.add_child(dn) -> None
+        Add a child DN to this DN.
+        """
+        return _ldb.Dn_add_child(*args, **kwargs)
+
+    def add_base(*args, **kwargs):
+        """
+        S.add_base(dn) -> None
+        Add a base DN to this DN.
+        """
+        return _ldb.Dn_add_base(*args, **kwargs)
+
+    def canonical_str(*args, **kwargs):
+        """
+        S.canonical_str() -> string
+        Canonical version of this DN (like a posix path).
+        """
+        return _ldb.Dn_canonical_str(*args, **kwargs)
+
+    def canonical_ex_str(*args, **kwargs):
+        """
+        S.canonical_ex_str() -> string
+        Canonical version of this DN (like a posix path, with terminating newline).
+        """
+        return _ldb.Dn_canonical_ex_str(*args, **kwargs)
+
     def __eq__(self, other):
         if isinstance(other, self.__class__):
             return self.__cmp__(other) == 0
@@ -97,11 +162,14 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn)
 Dn_swigregister = _ldb.Dn_swigregister
 Dn_swigregister(Dn)
 
-class ldb_msg_element(object):
+class MessageElement(object):
+    """Message element."""
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
-    __swig_destroy__ = _ldb.delete_ldb_msg_element
+    def __init__(self, *args, **kwargs): 
+        """Message element."""
+        _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs))
+    __swig_destroy__ = _ldb.delete_MessageElement
     def __getitem__(self, i):
         ret = self.get(i)
         if ret is None:
@@ -122,20 +190,17 @@ class ldb_msg_element(object):
                 return False
         return True
 
-ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element)
-ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element)
-ldb_msg_element.__len__ = new_instancemethod(_ldb.ldb_msg_element___len__,None,ldb_msg_element)
-ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element)
-ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element)
-ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister
-ldb_msg_element_swigregister(ldb_msg_element)
-
-def MessageElement(*args, **kwargs):
-    val = _ldb.new_MessageElement(*args, **kwargs)
-    return val
+MessageElement.__cmp__ = new_instancemethod(_ldb.MessageElement___cmp__,None,MessageElement)
+MessageElement.__iter__ = new_instancemethod(_ldb.MessageElement___iter__,None,MessageElement)
+MessageElement.__set__ = new_instancemethod(_ldb.MessageElement___set__,None,MessageElement)
+MessageElement.__len__ = new_instancemethod(_ldb.MessageElement___len__,None,MessageElement)
+MessageElement.get = new_instancemethod(_ldb.MessageElement_get,None,MessageElement)
+MessageElement_swigregister = _ldb.MessageElement_swigregister
+MessageElement_swigregister(MessageElement)
 
 ldb_msg_list_elements = _ldb.ldb_msg_list_elements
 class Message(object):
+    """Message."""
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
     dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set)
@@ -214,17 +279,132 @@ LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED
 LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS
 LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER
 class Ldb(object):
+    """Connection to a LDB database."""
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     def __init__(self, *args, **kwargs): 
         _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs))
+    def connect(*args, **kwargs):
+        """
+        S.connect(url,flags=0,options=None) -> None
+        Connect to a LDB URL.
+        """
+        return _ldb.Ldb_connect(*args, **kwargs)
+
     __swig_destroy__ = _ldb.delete_Ldb
+    def delete(*args, **kwargs):
+        """
+        S.delete(dn) -> None
+        Remove an entry.
+        """
+        return _ldb.Ldb_delete(*args, **kwargs)
+
+    def rename(*args, **kwargs):
+        """
+        S.rename(old_dn, new_dn) -> None
+        Rename an entry.
+        """
+        return _ldb.Ldb_rename(*args, **kwargs)
+
+    def add(*args, **kwargs):
+        """
+        S.add(message) -> None
+        Add an entry.
+        """
+        return _ldb.Ldb_add(*args, **kwargs)
+
+    def modify(*args, **kwargs):
+        """
+        S.modify(message) -> None
+        Modify an entry.
+        """
+        return _ldb.Ldb_modify(*args, **kwargs)
+
+    def set_create_perms(*args, **kwargs):
+        """
+        S.set_create_perms(mode) -> None
+        Set mode to use when creating new LDB files.
+        """
+        return _ldb.Ldb_set_create_perms(*args, **kwargs)
+
+    def set_modules_dir(*args, **kwargs):
+        """
+        S.set_modules_dir(path) -> None
+        Set path LDB should search for modules
+        """
+        return _ldb.Ldb_set_modules_dir(*args, **kwargs)
+
+    def set_debug(*args, **kwargs):
+        """
+        S.set_debug(callback) -> None
+        Set callback for LDB debug messages.
+        The callback should accept a debug level and debug text.
+        """
+        return _ldb.Ldb_set_debug(*args, **kwargs)
+
+    def set_opaque(*args, **kwargs):
+        """
+        S.set_opaque(name, value) -> None
+        Set an opaque value on this LDB connection. 
+        :note: Passing incorrect values may cause crashes.
+        """
+        return _ldb.Ldb_set_opaque(*args, **kwargs)
+
+    def get_opaque(*args, **kwargs):
+        """
+        S.get_opaque(name) -> value
+        Get an opaque value set on this LDB connection. 
+        :note: The returned value may not be useful in Python.
+        """
+        return _ldb.Ldb_get_opaque(*args, **kwargs)
+
+    def transaction_start(*args, **kwargs):
+        """
+        S.transaction_start() -> None
+        Start a new transaction.
+        """
+        return _ldb.Ldb_transaction_start(*args, **kwargs)
+
+    def transaction_commit(*args, **kwargs):
+        """
+        S.transaction_commit() -> None
+        Commit currently active transaction.
+        """
+        return _ldb.Ldb_transaction_commit(*args, **kwargs)
+
+    def transaction_cancel(*args, **kwargs):
+        """
+        S.transaction_cancel() -> None
+        Cancel currently active transaction.
+        """
+        return _ldb.Ldb_transaction_cancel(*args, **kwargs)
+
+    def parse_ldif(*args, **kwargs):
+        """
+        S.parse_ldif(ldif) -> iter(messages)
+        Parse a string formatted using LDIF.
+        """
+        return _ldb.Ldb_parse_ldif(*args, **kwargs)
+
     def __init__(self, url=None, flags=0, options=None):
+        """Create a new LDB object.
+
+        Will also connect to the specified URL if one was given.
+        """
         _ldb.Ldb_swiginit(self,_ldb.new_Ldb())
         if url is not None:
             self.connect(url, flags, options)
 
     def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, 
                attrs=None, controls=None):
+        """Search in a database.
+
+        :param base: Optional base DN to search
+        :param scope: Search scope (SCOPE_BASE, SCOPE_ONELEVEL or SCOPE_SUBTREE)
+        :param expression: Optional search expression
+        :param attrs: Attributes to return (defaults to all)
+        :param controls: Optional list of controls
+        :return: Iterator over Message objects
+        """
         if not (attrs is None or isinstance(attrs, list)):
             raise TypeError("attributes not a list")
         parsed_controls = None
@@ -263,9 +443,35 @@ Ldb.__repr__ = new_instancemethod(_ldb.Ldb___repr__,None,Ldb)
 Ldb_swigregister = _ldb.Ldb_swigregister
 Ldb_swigregister(Ldb)
 
-valid_attr_name = _ldb.valid_attr_name
-timestring = _ldb.timestring
-string_to_time = _ldb.string_to_time
-register_module = _ldb.register_module
+
+def valid_attr_name(*args, **kwargs):
+  """
+    S.valid_attr_name(name) -> bool
+    Check whether the supplied name is a valid attribute name.
+    """
+  return _ldb.valid_attr_name(*args, **kwargs)
+
+def timestring(*args, **kwargs):
+  """
+    S.timestring(int) -> string
+    Generate a LDAP time string from a UNIX timestamp
+    """
+  return _ldb.timestring(*args, **kwargs)
+
+def string_to_time(*args, **kwargs):
+  """
+    S.string_to_time(string) -> int
+    Parse a LDAP time string into a UNIX timestamp.
+    """
+  return _ldb.string_to_time(*args, **kwargs)
+
+def register_module(*args, **kwargs):
+  """
+    S.register_module(module) -> None
+    Register a LDB module.
+    """
+  return _ldb.register_module(*args, **kwargs)
+__docformat__ = "restructuredText"
+
 
 
index 1b534645b69a45aeb00210392781b7f124087480..94e3380038e0aa90af2e70e0cc604f3803a7b14e 100644 (file)
@@ -2,12 +2,12 @@
 # Start MODULE ldb_ildap
 [MODULE::ldb_ildap]
 SUBSYSTEM = LIBLDB
-CFLAGS = -Ilib/ldb/include
+CFLAGS = -I$(ldbdir)/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS
 ALIASES = ldapi ldaps ldap
 # End MODULE ldb_ildap
 ################################################
 
-ldb_ildap_OBJ_FILES = lib/ldb/ldb_ildap/ldb_ildap.o
+ldb_ildap_OBJ_FILES = $(ldbdir)/ldb_ildap/ldb_ildap.o
 
index d787266416a1dc496c254df82f427e701ebd8d3a..744033cbf6d4bb8ae0092e5f52ddfa715494e23a 100644 (file)
@@ -2554,7 +2554,7 @@ typedef struct ldb_message ldb_msg;
 typedef struct ldb_context ldb;
 typedef struct ldb_dn ldb_dn;
 typedef struct ldb_ldif ldb_ldif;
-typedef struct ldb_message_element ldb_msg_element;
+typedef struct ldb_message_element ldb_message_element;
 typedef int ldb_error;
 typedef int ldb_int_error;
 
@@ -2761,7 +2761,7 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
     return ret;
 }
 
-ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
+ldb_message_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
                                                PyObject *set_obj, int flags,
                                                const char *attr_name)
 {
@@ -2792,7 +2792,7 @@ ldb_msg_element *ldb_msg_element_from_pyobject(TALLOC_CTX *mem_ctx,
 }
 
 PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx, 
-                                 ldb_msg_element *me)
+                                 ldb_message_element *me)
 {
     int i;
     PyObject *result;
@@ -2809,10 +2809,13 @@ PyObject *ldb_msg_element_to_set(struct ldb_context *ldb_ctx,
 }
 
 
-SWIGINTERN PyObject *ldb_msg_element___iter__(ldb_msg_element *self){
+SWIGINTERN int ldb_message_element___cmp__(ldb_message_element *self,ldb_message_element *other){
+            return ldb_msg_element_compare(self, other);
+        }
+SWIGINTERN PyObject *ldb_message_element___iter__(ldb_message_element *self){
             return PyObject_GetIter(ldb_msg_element_to_set(NULL, self));
         }
-SWIGINTERN PyObject *ldb_msg_element___set__(ldb_msg_element *self){
+SWIGINTERN PyObject *ldb_message_element___set__(ldb_message_element *self){
             return ldb_msg_element_to_set(NULL, self);
         }
 
@@ -2960,19 +2963,19 @@ SWIG_AsVal_int (PyObject * obj, int *val)
   return res;
 }
 
-SWIGINTERN ldb_msg_element *new_ldb_msg_element(PyObject *set_obj,int flags,char const *name){
+SWIGINTERN ldb_message_element *new_ldb_message_element(PyObject *set_obj,int flags,char const *name){
             return ldb_msg_element_from_pyobject(NULL, set_obj, flags, name);
         }
-SWIGINTERN int ldb_msg_element___len__(ldb_msg_element *self){
+SWIGINTERN int ldb_message_element___len__(ldb_message_element *self){
             return self->num_values;
         }
-SWIGINTERN PyObject *ldb_msg_element_get(ldb_msg_element *self,int i){
+SWIGINTERN PyObject *ldb_message_element_get(ldb_message_element *self,int i){
             if (i < 0 || i >= self->num_values)
                 return Py_None;
 
             return ldb_val_to_py_object(NULL, self, &self->values[i]);
         }
-SWIGINTERN void delete_ldb_msg_element(ldb_msg_element *self){ talloc_free(self); }
+SWIGINTERN void delete_ldb_message_element(ldb_message_element *self){ talloc_free(self); }
 
     PyObject *ldb_msg_list_elements(ldb_msg *msg)
     {
@@ -2995,7 +2998,7 @@ SWIGINTERN ldb_msg *new_ldb_msg(ldb_dn *dn){
             return ret;
         }
 SWIGINTERN void delete_ldb_msg(ldb_msg *self){ talloc_free(self); }
-SWIGINTERN void ldb_msg___setitem____SWIG_0(ldb_msg *self,char const *attr_name,ldb_msg_element *val){
+SWIGINTERN void ldb_msg___setitem____SWIG_0(ldb_msg *self,char const *attr_name,ldb_message_element *val){
             struct ldb_message_element *el;
             
             ldb_msg_remove_attr(self, attr_name);
@@ -3763,9 +3766,43 @@ SWIGINTERN PyObject *Dn_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
   return SWIG_Python_InitShadowInstance(args);
 }
 
-SWIGINTERN PyObject *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_MessageElement___cmp__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
+  ldb_message_element *arg2 = (ldb_message_element *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "other", NULL 
+  };
+  
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:MessageElement___cmp__",kwnames,&obj0,&obj1)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___cmp__" "', argument " "1"" of type '" "ldb_message_element *""'"); 
+  }
+  arg1 = (ldb_message_element *)(argp1);
+  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MessageElement___cmp__" "', argument " "2"" of type '" "ldb_message_element *""'"); 
+  }
+  arg2 = (ldb_message_element *)(argp2);
+  result = (int)ldb_message_element___cmp__(arg1,arg2);
+  resultobj = SWIG_From_int((int)(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_MessageElement___iter__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
   PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
@@ -3775,10 +3812,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___iter__(PyObject *SWIGUNUSEDPARM(sel
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___iter__" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___iter__" "', argument " "1"" of type '" "ldb_message_element *""'"); 
   }
-  arg1 = (ldb_msg_element *)(argp1);
-  result = (PyObject *)ldb_msg_element___iter__(arg1);
+  arg1 = (ldb_message_element *)(argp1);
+  result = (PyObject *)ldb_message_element___iter__(arg1);
   resultobj = result;
   return resultobj;
 fail:
@@ -3786,9 +3823,9 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ldb_msg_element___set__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_MessageElement___set__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
   PyObject *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
@@ -3798,10 +3835,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___set__(PyObject *SWIGUNUSEDPARM(self
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___set__" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___set__" "', argument " "1"" of type '" "ldb_message_element *""'"); 
   }
-  arg1 = (ldb_msg_element *)(argp1);
-  result = (PyObject *)ldb_msg_element___set__(arg1);
+  arg1 = (ldb_message_element *)(argp1);
+  result = (PyObject *)ldb_message_element___set__(arg1);
   resultobj = result;
   return resultobj;
 fail:
@@ -3814,7 +3851,7 @@ SWIGINTERN PyObject *_wrap_new_MessageElement(PyObject *SWIGUNUSEDPARM(self), Py
   PyObject *arg1 = (PyObject *) 0 ;
   int arg2 = (int) 0 ;
   char *arg3 = (char *) NULL ;
-  ldb_msg_element *result = 0 ;
+  ldb_message_element *result = 0 ;
   int val2 ;
   int ecode2 = 0 ;
   int res3 ;
@@ -3843,8 +3880,8 @@ SWIGINTERN PyObject *_wrap_new_MessageElement(PyObject *SWIGUNUSEDPARM(self), Py
     }
     arg3 = (char *)(buf3);
   }
-  result = (ldb_msg_element *)new_ldb_msg_element(arg1,arg2,(char const *)arg3);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_message_element, SWIG_POINTER_OWN |  0 );
+  result = (ldb_message_element *)new_ldb_message_element(arg1,arg2,(char const *)arg3);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_message_element, SWIG_POINTER_NEW |  0 );
   if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
   return resultobj;
 fail:
@@ -3853,9 +3890,9 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ldb_msg_element___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_MessageElement___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
   int result;
   void *argp1 = 0 ;
   int res1 = 0 ;
@@ -3865,10 +3902,10 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element___len__(PyObject *SWIGUNUSEDPARM(self
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___len__" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement___len__" "', argument " "1"" of type '" "ldb_message_element *""'"); 
   }
-  arg1 = (ldb_msg_element *)(argp1);
-  result = (int)ldb_msg_element___len__(arg1);
+  arg1 = (ldb_message_element *)(argp1);
+  result = (int)ldb_message_element___len__(arg1);
   resultobj = SWIG_From_int((int)(result));
   return resultobj;
 fail:
@@ -3876,9 +3913,9 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ldb_msg_element_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_MessageElement_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
   int arg2 ;
   PyObject *result = 0 ;
   void *argp1 = 0 ;
@@ -3891,18 +3928,18 @@ SWIGINTERN PyObject *_wrap_ldb_msg_element_get(PyObject *SWIGUNUSEDPARM(self), P
     (char *) "self",(char *) "i", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element_get",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:MessageElement_get",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element_get" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MessageElement_get" "', argument " "1"" of type '" "ldb_message_element *""'"); 
   }
-  arg1 = (ldb_msg_element *)(argp1);
+  arg1 = (ldb_message_element *)(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ldb_msg_element_get" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "MessageElement_get" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = (int)(val2);
-  result = (PyObject *)ldb_msg_element_get(arg1,arg2);
+  result = (PyObject *)ldb_message_element_get(arg1,arg2);
   resultobj = result;
   return resultobj;
 fail:
@@ -3910,9 +3947,9 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_MessageElement(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg1 = (ldb_message_element *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   PyObject *swig_obj[1] ;
@@ -3921,10 +3958,10 @@ SWIGINTERN PyObject *_wrap_delete_ldb_msg_element(PyObject *SWIGUNUSEDPARM(self)
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_message_element, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ldb_msg_element" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_MessageElement" "', argument " "1"" of type '" "ldb_message_element *""'"); 
   }
-  arg1 = (ldb_msg_element *)(argp1);
-  delete_ldb_msg_element(arg1);
+  arg1 = (ldb_message_element *)(argp1);
+  delete_ldb_message_element(arg1);
   
   resultobj = SWIG_Py_Void();
   return resultobj;
@@ -3933,47 +3970,17 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ldb_msg_element___cmp__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  ldb_msg_element *arg1 = (ldb_msg_element *) 0 ;
-  ldb_msg_element *arg2 = (ldb_msg_element *) 0 ;
-  int result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *)"arg2", NULL 
-  };
-  
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:ldb_msg_element___cmp__",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_message_element, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_element___cmp__" "', argument " "1"" of type '" "ldb_msg_element *""'"); 
-  }
-  arg1 = (ldb_msg_element *)(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_message_element, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_msg_element___cmp__" "', argument " "2"" of type '" "ldb_msg_element *""'"); 
-  }
-  arg2 = (ldb_msg_element *)(argp2);
-  result = (int)ldb_msg_element_compare(arg1,arg2);
-  resultobj = SWIG_From_int((int)(result));
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *ldb_msg_element_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *MessageElement_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
   if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_ldb_message_element, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
+SWIGINTERN PyObject *MessageElement_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  return SWIG_Python_InitShadowInstance(args);
+}
+
 SWIGINTERN PyObject *_wrap_ldb_msg_list_elements(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   ldb_msg *arg1 = (ldb_msg *) 0 ;
@@ -4118,7 +4125,7 @@ SWIGINTERN PyObject *_wrap_Message_find_element(PyObject *SWIGUNUSEDPARM(self),
   PyObject *resultobj = 0;
   ldb_msg *arg1 = (ldb_msg *) 0 ;
   char *arg2 = (char *) 0 ;
-  ldb_msg_element *result = 0 ;
+  ldb_message_element *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -4144,7 +4151,7 @@ SWIGINTERN PyObject *_wrap_Message_find_element(PyObject *SWIGUNUSEDPARM(self),
   if (arg1 == NULL)
   SWIG_exception(SWIG_ValueError, 
     "Message can not be None");
-  result = (ldb_msg_element *)ldb_msg_find_element(arg1,(char const *)arg2);
+  result = (ldb_message_element *)ldb_msg_find_element(arg1,(char const *)arg2);
   {
     if (result == NULL)
     PyErr_SetString(PyExc_KeyError, "no such element");
@@ -4163,7 +4170,7 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(
   PyObject *resultobj = 0;
   ldb_msg *arg1 = (ldb_msg *) 0 ;
   char *arg2 = (char *) 0 ;
-  ldb_msg_element *arg3 = (ldb_msg_element *) 0 ;
+  ldb_message_element *arg3 = (ldb_message_element *) 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -4185,9 +4192,9 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(
   arg2 = (char *)(buf2);
   res3 = SWIG_ConvertPtr(swig_obj[2], &argp3,SWIGTYPE_p_ldb_message_element, 0 |  0 );
   if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_msg_element *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_message_element *""'"); 
   }
-  arg3 = (ldb_msg_element *)(argp3);
+  arg3 = (ldb_message_element *)(argp3);
   if (arg1 == NULL)
   SWIG_exception(SWIG_ValueError, 
     "Message can not be None");
@@ -4262,7 +4269,7 @@ check_1:
 fail:
   SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n"
     "  Possible C/C++ prototypes are:\n"
-    "    __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"
+    "    __setitem__(ldb_msg *,char const *,ldb_message_element *)\n"
     "    __setitem__(ldb_msg *,char const *,PyObject *)\n");
   return NULL;
 }
@@ -4787,7 +4794,7 @@ SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
   arg1 = (ldb *)(argp1);
   {
     Py_ssize_t dict_pos, msg_pos;
-    ldb_msg_element *msgel;
+    ldb_message_element *msgel;
     PyObject *key, *value;
     
     if (PyDict_Check(obj1)) {
@@ -5723,34 +5730,62 @@ fail:
 
 static PyMethodDef SwigMethods[] = {
         { (char *)"ldb_val_to_py_object", (PyCFunction) _wrap_ldb_val_to_py_object, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"new_Dn", (PyCFunction) _wrap_new_Dn, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.__init__(ldb, string)\n"
+               "Create a new DN.\n"
+               ""},
         { (char *)"delete_Dn", (PyCFunction)_wrap_delete_Dn, METH_O, NULL},
-        { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, NULL},
+        { (char *)"Dn_validate", (PyCFunction)_wrap_Dn_validate, METH_O, (char *)"\n"
+               "S.validate() -> bool\n"
+               "Validate DN is correct.\n"
+               ""},
         { (char *)"Dn_get_casefold", (PyCFunction)_wrap_Dn_get_casefold, METH_O, NULL},
         { (char *)"Dn___str__", (PyCFunction)_wrap_Dn___str__, METH_O, NULL},
-        { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, NULL},
+        { (char *)"Dn_parent", (PyCFunction)_wrap_Dn_parent, METH_O, (char *)"\n"
+               "S.parent() -> dn\n"
+               "Get the parent for this DN.\n"
+               ""},
         { (char *)"Dn___cmp__", (PyCFunction) _wrap_Dn___cmp__, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Dn_is_valid", (PyCFunction)_wrap_Dn_is_valid, METH_O, NULL},
-        { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, NULL},
-        { (char *)"Dn_is_null", (PyCFunction)_wrap_Dn_is_null, METH_O, NULL},
+        { (char *)"Dn_is_special", (PyCFunction)_wrap_Dn_is_special, METH_O, (char *)"\n"
+               "S.is_special() -> bool\n"
+               "Check whether this is a special LDB DN.\n"
+               ""},
+        { (char *)"Dn_is_null", (PyCFunction)_wrap_Dn_is_null, METH_O, (char *)"\n"
+               "S.is_null() -> bool\n"
+               "Check whether this is a null DN.\n"
+               ""},
         { (char *)"Dn_check_special", (PyCFunction) _wrap_Dn_check_special, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Dn___len__", (PyCFunction)_wrap_Dn___len__, METH_O, NULL},
-        { (char *)"Dn_add_child", (PyCFunction) _wrap_Dn_add_child, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, NULL},
-        { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, NULL},
+        { (char *)"Dn_add_child", (PyCFunction) _wrap_Dn_add_child, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.add_child(dn) -> None\n"
+               "Add a child DN to this DN.\n"
+               ""},
+        { (char *)"Dn_add_base", (PyCFunction) _wrap_Dn_add_base, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.add_base(dn) -> None\n"
+               "Add a base DN to this DN.\n"
+               ""},
+        { (char *)"Dn_canonical_str", (PyCFunction)_wrap_Dn_canonical_str, METH_O, (char *)"\n"
+               "S.canonical_str() -> string\n"
+               "Canonical version of this DN (like a posix path).\n"
+               ""},
+        { (char *)"Dn_canonical_ex_str", (PyCFunction)_wrap_Dn_canonical_ex_str, METH_O, (char *)"\n"
+               "S.canonical_ex_str() -> string\n"
+               "Canonical version of this DN (like a posix path, with terminating newline).\n"
+               ""},
         { (char *)"Dn___repr__", (PyCFunction)_wrap_Dn___repr__, METH_O, NULL},
         { (char *)"Dn___add__", (PyCFunction) _wrap_Dn___add__, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Dn_swigregister", Dn_swigregister, METH_VARARGS, NULL},
         { (char *)"Dn_swiginit", Dn_swiginit, METH_VARARGS, NULL},
-        { (char *)"ldb_msg_element___iter__", (PyCFunction)_wrap_ldb_msg_element___iter__, METH_O, NULL},
-        { (char *)"ldb_msg_element___set__", (PyCFunction)_wrap_ldb_msg_element___set__, METH_O, NULL},
-        { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"ldb_msg_element___len__", (PyCFunction)_wrap_ldb_msg_element___len__, METH_O, NULL},
-        { (char *)"ldb_msg_element_get", (PyCFunction) _wrap_ldb_msg_element_get, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"delete_ldb_msg_element", (PyCFunction)_wrap_delete_ldb_msg_element, METH_O, NULL},
-        { (char *)"ldb_msg_element___cmp__", (PyCFunction) _wrap_ldb_msg_element___cmp__, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"ldb_msg_element_swigregister", ldb_msg_element_swigregister, METH_VARARGS, NULL},
+        { (char *)"MessageElement___cmp__", (PyCFunction) _wrap_MessageElement___cmp__, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"MessageElement___iter__", (PyCFunction)_wrap_MessageElement___iter__, METH_O, NULL},
+        { (char *)"MessageElement___set__", (PyCFunction)_wrap_MessageElement___set__, METH_O, NULL},
+        { (char *)"new_MessageElement", (PyCFunction) _wrap_new_MessageElement, METH_VARARGS | METH_KEYWORDS, (char *)"Message element."},
+        { (char *)"MessageElement___len__", (PyCFunction)_wrap_MessageElement___len__, METH_O, NULL},
+        { (char *)"MessageElement_get", (PyCFunction) _wrap_MessageElement_get, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"delete_MessageElement", (PyCFunction)_wrap_delete_MessageElement, METH_O, NULL},
+        { (char *)"MessageElement_swigregister", MessageElement_swigregister, METH_VARARGS, NULL},
+        { (char *)"MessageElement_swiginit", MessageElement_swiginit, METH_VARARGS, NULL},
         { (char *)"ldb_msg_list_elements", (PyCFunction) _wrap_ldb_msg_list_elements, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Message_dn_set", _wrap_Message_dn_set, METH_VARARGS, NULL},
         { (char *)"Message_dn_get", (PyCFunction)_wrap_Message_dn_get, METH_O, NULL},
@@ -5766,40 +5801,97 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Message_swiginit", Message_swiginit, METH_VARARGS, NULL},
         { (char *)"ldb_ldif_to_pyobject", (PyCFunction) _wrap_ldb_ldif_to_pyobject, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"new_Ldb", (PyCFunction)_wrap_new_Ldb, METH_NOARGS, NULL},
-        { (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_connect", (PyCFunction) _wrap_Ldb_connect, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.connect(url,flags=0,options=None) -> None\n"
+               "Connect to a LDB URL.\n"
+               ""},
         { (char *)"delete_Ldb", (PyCFunction)_wrap_delete_Ldb, METH_O, NULL},
         { (char *)"Ldb_search_ex", (PyCFunction) _wrap_Ldb_search_ex, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.delete(dn) -> None\n"
+               "Remove an entry.\n"
+               ""},
+        { (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.rename(old_dn, new_dn) -> None\n"
+               "Rename an entry.\n"
+               ""},
         { (char *)"Ldb_parse_control_strings", (PyCFunction) _wrap_Ldb_parse_control_strings, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.add(message) -> None\n"
+               "Add an entry.\n"
+               ""},
+        { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.modify(message) -> None\n"
+               "Modify an entry.\n"
+               ""},
         { (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL},
         { (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL},
         { (char *)"Ldb_get_schema_basedn", (PyCFunction)_wrap_Ldb_get_schema_basedn, METH_O, NULL},
         { (char *)"Ldb_get_default_basedn", (PyCFunction)_wrap_Ldb_get_default_basedn, METH_O, NULL},
         { (char *)"Ldb_schema_format_value", (PyCFunction) _wrap_Ldb_schema_format_value, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_errstring", (PyCFunction)_wrap_Ldb_errstring, METH_O, NULL},
-        { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_get_opaque", (PyCFunction) _wrap_Ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, NULL},
-        { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, NULL},
-        { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, NULL},
+        { (char *)"Ldb_set_create_perms", (PyCFunction) _wrap_Ldb_set_create_perms, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_create_perms(mode) -> None\n"
+               "Set mode to use when creating new LDB files.\n"
+               ""},
+        { (char *)"Ldb_set_modules_dir", (PyCFunction) _wrap_Ldb_set_modules_dir, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_modules_dir(path) -> None\n"
+               "Set path LDB should search for modules\n"
+               ""},
+        { (char *)"Ldb_set_debug", (PyCFunction) _wrap_Ldb_set_debug, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_debug(callback) -> None\n"
+               "Set callback for LDB debug messages.\n"
+               "The callback should accept a debug level and debug text.\n"
+               ""},
+        { (char *)"Ldb_set_opaque", (PyCFunction) _wrap_Ldb_set_opaque, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.set_opaque(name, value) -> None\n"
+               "Set an opaque value on this LDB connection. \n"
+               ":note: Passing incorrect values may cause crashes.\n"
+               ""},
+        { (char *)"Ldb_get_opaque", (PyCFunction) _wrap_Ldb_get_opaque, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_opaque(name) -> value\n"
+               "Get an opaque value set on this LDB connection. \n"
+               ":note: The returned value may not be useful in Python.\n"
+               ""},
+        { (char *)"Ldb_transaction_start", (PyCFunction)_wrap_Ldb_transaction_start, METH_O, (char *)"\n"
+               "S.transaction_start() -> None\n"
+               "Start a new transaction.\n"
+               ""},
+        { (char *)"Ldb_transaction_commit", (PyCFunction)_wrap_Ldb_transaction_commit, METH_O, (char *)"\n"
+               "S.transaction_commit() -> None\n"
+               "Commit currently active transaction.\n"
+               ""},
+        { (char *)"Ldb_transaction_cancel", (PyCFunction)_wrap_Ldb_transaction_cancel, METH_O, (char *)"\n"
+               "S.transaction_cancel() -> None\n"
+               "Cancel currently active transaction.\n"
+               ""},
         { (char *)"Ldb_schema_attribute_remove", (PyCFunction) _wrap_Ldb_schema_attribute_remove, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_schema_attribute_add", (PyCFunction) _wrap_Ldb_schema_attribute_add, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Ldb_setup_wellknown_attributes", (PyCFunction)_wrap_Ldb_setup_wellknown_attributes, METH_O, NULL},
         { (char *)"Ldb___contains__", (PyCFunction) _wrap_Ldb___contains__, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Ldb_parse_ldif", (PyCFunction) _wrap_Ldb_parse_ldif, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.parse_ldif(ldif) -> iter(messages)\n"
+               "Parse a string formatted using LDIF.\n"
+               ""},
         { (char *)"Ldb___repr__", (PyCFunction)_wrap_Ldb___repr__, METH_O, NULL},
         { (char *)"Ldb_swigregister", Ldb_swigregister, METH_VARARGS, NULL},
         { (char *)"Ldb_swiginit", Ldb_swiginit, METH_VARARGS, NULL},
-        { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"valid_attr_name", (PyCFunction) _wrap_valid_attr_name, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.valid_attr_name(name) -> bool\n"
+               "Check whether the supplied name is a valid attribute name.\n"
+               ""},
+        { (char *)"timestring", (PyCFunction) _wrap_timestring, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.timestring(int) -> string\n"
+               "Generate a LDAP time string from a UNIX timestamp\n"
+               ""},
+        { (char *)"string_to_time", (PyCFunction) _wrap_string_to_time, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.string_to_time(string) -> int\n"
+               "Parse a LDAP time string into a UNIX timestamp.\n"
+               ""},
+        { (char *)"register_module", (PyCFunction) _wrap_register_module, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.register_module(module) -> None\n"
+               "Register a LDB module.\n"
+               ""},
         { NULL, NULL, 0, NULL }
 };
 
@@ -5814,7 +5906,7 @@ static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_con
 static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_message = {"_p_ldb_message", "ldb_msg *|struct ldb_message *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", "struct ldb_message_element *|ldb_msg_element *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", "struct ldb_message_element *|ldb_message_element *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0};
index 89aba8f2766195cd1f1f36380be26c1940e513d0..5325446e1ee19ab49cc44225f5ff3669a7c86c98 100644 (file)
@@ -1,10 +1,10 @@
 [PYTHON::swig_ldb]
 LIBRARY_REALNAME = _ldb.$(SHLIBEXT)
 PUBLIC_DEPENDENCIES = LIBLDB
-CFLAGS = -Ilib/ldb/include
 
-swig_ldb_OBJ_FILES = lib/ldb/ldb_wrap.o
+swig_ldb_OBJ_FILES = $(ldbdir)/ldb_wrap.o
+$(swig_ldb_OBJ_FILES): CFLAGS+=-I$(ldbdir)/include
 
-$(eval $(call python_py_module_template,ldb.py,lib/ldb/ldb.py))
+$(eval $(call python_py_module_template,ldb.py,$(ldbdir)/ldb.py))
 
 $(swig_ldb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
index 6729636434831bb1a52071a6a32853570e9d55e4..051fd0c57b8abcf62e84d6412952a915a883b3ca 100644 (file)
@@ -1,13 +1,13 @@
 ################################################
 # Start SUBSYSTEM LIBLDB_CMDLINE
 [SUBSYSTEM::LIBLDB_CMDLINE]
-CFLAGS = -Ilib/ldb -Ilib/ldb/include
+CFLAGS = -I$(ldbdir) -I$(ldbdir)/include
 PUBLIC_DEPENDENCIES = LIBLDB LIBPOPT
 PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL POPT_SAMBA POPT_CREDENTIALS gensec
 # End SUBSYSTEM LIBLDB_CMDLINE
 ################################################
 
-LIBLDB_CMDLINE_OBJ_FILES = lib/ldb/tools/cmdline.o
+LIBLDB_CMDLINE_OBJ_FILES = $(ldbdir)/tools/cmdline.o
 
 ################################################
 # Start BINARY ldbadd
@@ -19,7 +19,7 @@ PRIVATE_DEPENDENCIES = \
 ################################################
 
 
-ldbadd_OBJ_FILES = lib/ldb/tools/ldbadd.o
+ldbadd_OBJ_FILES = $(ldbdir)/tools/ldbadd.o
 
 MANPAGES += $(ldbdir)/man/ldbadd.1
 
@@ -32,7 +32,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbdel
 ################################################
 
-ldbdel_OBJ_FILES = lib/ldb/tools/ldbdel.o
+ldbdel_OBJ_FILES = $(ldbdir)/tools/ldbdel.o
 
 MANPAGES += $(ldbdir)/man/ldbdel.1
 
@@ -45,7 +45,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbmodify
 ################################################
 
-ldbmodify_OBJ_FILES = lib/ldb/tools/ldbmodify.o
+ldbmodify_OBJ_FILES = $(ldbdir)/tools/ldbmodify.o
 MANPAGES += $(ldbdir)/man/ldbmodify.1
 
 ################################################
@@ -57,7 +57,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbsearch
 ################################################
 
-ldbsearch_OBJ_FILES = lib/ldb/tools/ldbsearch.o
+ldbsearch_OBJ_FILES = $(ldbdir)/tools/ldbsearch.o
 
 MANPAGES += $(ldbdir)/man/ldbsearch.1
 
@@ -70,7 +70,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbedit
 ################################################
 
-ldbedit_OBJ_FILES = lib/ldb/tools/ldbedit.o
+ldbedit_OBJ_FILES = $(ldbdir)/tools/ldbedit.o
 
 MANPAGES += $(ldbdir)/man/ldbedit.1
 
@@ -83,7 +83,7 @@ PRIVATE_DEPENDENCIES = \
 # End BINARY ldbrename
 ################################################
 
-ldbrename_OBJ_FILES = lib/ldb/tools/ldbrename.o
+ldbrename_OBJ_FILES = $(ldbdir)/tools/ldbrename.o
 
 MANPAGES += $(ldbdir)/man/ldbrename.1
 
index eaf7e3581e1249cde11f1edd378f4e7e56ab1665..e92f78c8e368b99127d41aae26ebf556f3b93d49 100644 (file)
@@ -1,6 +1,3 @@
-
-################################################
-# Start SUBSYSTEM MESSAGING
 [SUBSYSTEM::MESSAGING]
 PUBLIC_DEPENDENCIES = \
                LIBSAMBA-UTIL \
@@ -9,8 +6,13 @@ PUBLIC_DEPENDENCIES = \
                UNIX_PRIVS \
                UTIL_TDB \
                CLUSTER \
-               LIBNDR
-# End SUBSYSTEM MESSAGING
-################################################
+               LIBNDR \
+               samba-socket
 
 MESSAGING_OBJ_FILES = $(libmessagingsrcdir)/messaging.o
+
+[PYTHON::python_messaging]
+LIBRARY_REALNAME = samba/messaging.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = MESSAGING LIBEVENTS python_irpc
+
+python_messaging_OBJ_FILES = $(libmessagingsrcdir)/pymessaging.o
index f44c0af3ec40f134d6980be0a97972304f3bc8e5..65e98dce2c29d8fb396e00589fa00b1eaf745f36 100644 (file)
@@ -125,6 +125,7 @@ NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
 struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name);
 void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
 NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);
+struct server_id messaging_get_server_id(struct messaging_context *msg_ctx);
 
 #endif
 
index e7b654894f0d0eebe055d1242d89571ddca71a5f..4b90e8c4fd5d0dcaf59f7978e59086c8b0ac5adc 100644 (file)
@@ -1113,3 +1113,8 @@ void irpc_remove_name(struct messaging_context *msg_ctx, const char *name)
        tdb_unlock_bystring(t->tdb, name);
        talloc_free(t);
 }
+
+struct server_id messaging_get_server_id(struct messaging_context *msg_ctx)
+{
+       return msg_ctx->server_id;
+}
diff --git a/source/lib/messaging/pymessaging.c b/source/lib/messaging/pymessaging.c
new file mode 100644 (file)
index 0000000..1c22fb4
--- /dev/null
@@ -0,0 +1,559 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
+
+   Based on the equivalent for EJS:
+   Copyright © Andrew Tridgell <tridge@samba.org> 2005
+   
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include <Python.h>
+#include "libcli/util/pyerrors.h"
+#include "librpc/rpc/pyrpc.h"
+#include "lib/messaging/irpc.h"
+#include "lib/messaging/messaging.h"
+#include "lib/events/events.h"
+#include "cluster/cluster.h"
+#include "param/param.h"
+#include "librpc/gen_ndr/py_irpc.h"
+
+PyAPI_DATA(PyTypeObject) messaging_Type;
+PyAPI_DATA(PyTypeObject) irpc_ClientConnectionType;
+
+static bool server_id_from_py(PyObject *object, struct server_id *server_id)
+{
+       if (!PyTuple_Check(object)) {
+               PyErr_SetString(PyExc_ValueError, "Expected tuple");
+               return false;
+       }
+
+       if (PyTuple_Size(object) == 3) {
+               return PyArg_ParseTuple(object, "iii", &server_id->id, &server_id->id2, &server_id->node);
+       } else {
+               int id, id2;
+               if (!PyArg_ParseTuple(object, "ii", &id, &id2))
+                       return false;
+               *server_id = cluster_id(id, id2);
+               return true;
+       }
+}
+
+typedef struct {
+       PyObject_HEAD
+       TALLOC_CTX *mem_ctx;
+       struct messaging_context *msg_ctx;
+} messaging_Object;
+
+PyObject *py_messaging_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
+{
+       struct event_context *ev;
+       const char *kwnames[] = { "own_id", "messaging_path", NULL };
+       PyObject *own_id = Py_None;
+       const char *messaging_path = NULL;
+       messaging_Object *ret;
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Oz:connect", 
+               discard_const_p(char *, kwnames), &own_id, &messaging_path)) {
+               return NULL;
+       }
+
+       ret = PyObject_New(messaging_Object, &messaging_Type);
+       if (ret == NULL)
+               return NULL;
+
+       ret->mem_ctx = talloc_new(NULL);
+
+       ev = event_context_init(ret->mem_ctx);
+
+       if (messaging_path == NULL) {
+               messaging_path = lp_messaging_path(ret, global_loadparm);
+       } else {
+               messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
+       }
+
+       if (own_id != Py_None) {
+               struct server_id server_id;
+
+               if (!server_id_from_py(own_id, &server_id)) 
+                       return NULL;
+
+               ret->msg_ctx = messaging_init(ret->mem_ctx, 
+                                           messaging_path,
+                                           server_id,
+                                           lp_iconv_convenience(global_loadparm),
+                                           ev);
+       } else {
+               ret->msg_ctx = messaging_client_init(ret->mem_ctx, 
+                                           messaging_path,
+                                           lp_iconv_convenience(global_loadparm),
+                                           ev);
+       }
+
+       if (ret->msg_ctx == NULL) {
+               PyErr_SetString(PyExc_RuntimeError, "messaging_connect unable to create a messaging context");
+               talloc_free(ret->mem_ctx);
+               return NULL;
+       }
+
+       return (PyObject *)ret;
+}
+
+static void py_messaging_dealloc(PyObject *self)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       talloc_free(iface->msg_ctx);
+       PyObject_Del(self);
+}
+
+static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       uint32_t msg_type;
+       DATA_BLOB data;
+       PyObject *target;
+       NTSTATUS status;
+       struct server_id server;
+       const char *kwnames[] = { "target", "msg_type", "data", NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#|:send", 
+               discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &data.length)) {
+               return NULL;
+       }
+
+       if (!server_id_from_py(target, &server)) 
+               return NULL;
+
+       status = messaging_send(iface->msg_ctx, server, msg_type, &data);
+       if (NT_STATUS_IS_ERR(status)) {
+               PyErr_SetNTSTATUS(status);
+               return NULL;
+       }
+
+       return Py_None;
+}
+
+static void py_msg_callback_wrapper(struct messaging_context *msg, void *private, 
+                              uint32_t msg_type, 
+                              struct server_id server_id, DATA_BLOB *data)
+{
+       PyObject *callback = (PyObject *)private;
+
+       PyObject_CallFunction(callback, discard_const_p(char, "i(iii)s#"), msg_type, 
+                             server_id.id, server_id.id2, server_id.node, 
+                             data->data, data->length);
+}
+
+static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       uint32_t msg_type = -1;
+       PyObject *callback;
+       NTSTATUS status;
+       const char *kwnames[] = { "callback", "msg_type", NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", 
+               discard_const_p(char *, kwnames), &callback, &msg_type)) {
+               return NULL;
+       }
+
+       Py_INCREF(callback);
+
+       if (msg_type == -1) {
+               status = messaging_register_tmp(iface->msg_ctx, callback,
+                                               py_msg_callback_wrapper, &msg_type);
+       } else {
+               status = messaging_register(iface->msg_ctx, callback,
+                                   msg_type, py_msg_callback_wrapper);
+       }
+       if (NT_STATUS_IS_ERR(status)) {
+               PyErr_SetNTSTATUS(status);
+               return NULL;
+       }
+
+       return PyLong_FromLong(msg_type);
+}
+
+static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       uint32_t msg_type = -1;
+       PyObject *callback;
+       const char *kwnames[] = { "callback", "msg_type", NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", 
+               discard_const_p(char *, kwnames), &callback, &msg_type)) {
+               return NULL;
+       }
+
+       messaging_deregister(iface->msg_ctx, msg_type, callback);
+
+       Py_DECREF(callback);
+
+       return Py_None;
+}
+
+static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       NTSTATUS status;
+       char *name;
+       const char *kwnames[] = { "name", NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", 
+               discard_const_p(char *, kwnames), &name)) {
+               return NULL;
+       }
+
+       status = irpc_add_name(iface->msg_ctx, name);
+       if (NT_STATUS_IS_ERR(status)) {
+               PyErr_SetNTSTATUS(status);
+               return NULL;
+       }
+
+       return Py_None;
+}
+
+
+static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+       messaging_Object *iface = (messaging_Object *)self;
+       char *name;
+       const char *kwnames[] = { "name", NULL };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:send", 
+               discard_const_p(char *, kwnames), &name)) {
+               return NULL;
+       }
+
+       irpc_remove_name(iface->msg_ctx, name);
+
+       return Py_None;
+}
+
+static PyMethodDef py_messaging_methods[] = {
+       { "send", (PyCFunction)py_messaging_send, METH_VARARGS|METH_KEYWORDS, 
+               "S.send(target, msg_type, data) -> None\nSend a message" },
+       { "register", (PyCFunction)py_messaging_register, METH_VARARGS|METH_KEYWORDS,
+               "S.register(callback, msg_type=None) -> msg_type\nRegister a message handler" },
+       { "deregister", (PyCFunction)py_messaging_deregister, METH_VARARGS|METH_KEYWORDS,
+               "S.deregister(callback, msg_type) -> None\nDeregister a message handler" },
+       { "add_name", (PyCFunction)py_messaging_add_name, METH_VARARGS|METH_KEYWORDS, "S.add_name(name) -> None\nListen on another name" },
+       { "remove_name", (PyCFunction)py_messaging_remove_name, METH_VARARGS|METH_KEYWORDS, "S.remove_name(name) -> None\nStop listening on a name" },
+       { NULL, NULL, 0, NULL }
+};
+
+static PyObject *py_messaging_server_id(PyObject *obj, void *closure)
+{
+       messaging_Object *iface = (messaging_Object *)obj;
+       struct server_id server_id = messaging_get_server_id(iface->msg_ctx);
+
+       return Py_BuildValue("(iii)", server_id.id, server_id.id2, 
+                            server_id.node);
+}
+
+static PyGetSetDef py_messaging_getset[] = {
+       { discard_const_p(char, "server_id"), py_messaging_server_id, NULL, 
+         discard_const_p(char, "local server id") },
+       { NULL },
+};
+
+
+PyTypeObject messaging_Type = {
+       PyObject_HEAD_INIT(NULL) 0,
+       .tp_name = "irpc.Messaging",
+       .tp_basicsize = sizeof(messaging_Object),
+       .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+       .tp_new = py_messaging_connect,
+       .tp_dealloc = py_messaging_dealloc,
+       .tp_methods = py_messaging_methods,
+       .tp_getset = py_messaging_getset,
+       .tp_doc = "Messaging(own_id=None, messaging_path=None)\n" \
+                 "Create a new object that can be used to communicate with the peers in the specified messaging path.\n" \
+                 "If no path is specified, the default path from smb.conf will be used."
+};
+
+
+/*
+  state of a irpc 'connection'
+*/
+typedef struct {
+       PyObject_HEAD
+       const char *server_name;
+       struct server_id *dest_ids;
+       struct messaging_context *msg_ctx;
+       TALLOC_CTX *mem_ctx;
+} irpc_ClientConnectionObject;
+
+/*
+  setup a context for talking to a irpc server
+     example: 
+        status = irpc.connect("smb_server");
+*/
+
+PyObject *py_irpc_connect(PyTypeObject *self, PyObject *args, PyObject *kwargs)
+{
+       struct event_context *ev;
+       const char *kwnames[] = { "server", "own_id", "messaging_path", NULL };
+       char *server;
+       const char *messaging_path = NULL;
+       PyObject *own_id = Py_None;
+       irpc_ClientConnectionObject *ret;
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Oz:connect", 
+               discard_const_p(char *, kwnames), &server, &own_id, &messaging_path)) {
+               return NULL;
+       }
+
+       ret = PyObject_New(irpc_ClientConnectionObject, &irpc_ClientConnectionType);
+       if (ret == NULL)
+               return NULL;
+
+       ret->mem_ctx = talloc_new(NULL);
+
+       ret->server_name = server;
+
+       ev = event_context_init(ret->mem_ctx);
+
+       if (messaging_path == NULL) {
+               messaging_path = lp_messaging_path(ret, global_loadparm);
+       } else {
+               messaging_path = talloc_strdup(ret->mem_ctx, messaging_path);
+       }
+
+       if (own_id != Py_None) {
+               struct server_id server_id;
+
+               if (!server_id_from_py(own_id, &server_id)) 
+                       return NULL;
+
+               ret->msg_ctx = messaging_init(ret->mem_ctx, 
+                                           messaging_path,
+                                           server_id,
+                                           lp_iconv_convenience(global_loadparm),
+                                           ev);
+       } else {
+               ret->msg_ctx = messaging_client_init(ret->mem_ctx, 
+                                           messaging_path,
+                                           lp_iconv_convenience(global_loadparm),
+                                           ev);
+       }
+
+       if (ret->msg_ctx == NULL) {
+               PyErr_SetString(PyExc_RuntimeError, "irpc_connect unable to create a messaging context");
+               talloc_free(ret->mem_ctx);
+               return NULL;
+       }
+
+       ret->dest_ids = irpc_servers_byname(ret->msg_ctx, ret->mem_ctx, ret->server_name);
+       if (ret->dest_ids == NULL || ret->dest_ids[0].id == 0) {
+               talloc_free(ret->mem_ctx);
+               PyErr_SetNTSTATUS(NT_STATUS_OBJECT_NAME_NOT_FOUND);
+               return NULL;
+       } else {
+               return (PyObject *)ret;
+       }
+}
+
+typedef struct {
+       PyObject_HEAD
+       struct irpc_request **reqs;
+       int count;
+       int current;
+       TALLOC_CTX *mem_ctx;
+       py_data_unpack_fn unpack_fn;
+} irpc_ResultObject;
+
+       
+static PyObject *irpc_result_next(irpc_ResultObject *iterator)
+{
+       NTSTATUS status;
+
+       if (iterator->current >= iterator->count) {
+               PyErr_SetString(PyExc_StopIteration, "No more results");
+               return NULL;
+       }
+
+       status = irpc_call_recv(iterator->reqs[iterator->current]);
+       iterator->current++;
+       if (!NT_STATUS_IS_OK(status)) {
+               PyErr_SetNTSTATUS(status);
+               return NULL;
+       }
+
+       return iterator->unpack_fn(iterator->reqs[iterator->current-1]->r);
+}
+
+static PyObject *irpc_result_len(irpc_ResultObject *self)
+{
+       return PyLong_FromLong(self->count);
+}
+
+static PyMethodDef irpc_result_methods[] = {
+       { "__len__", (PyCFunction)irpc_result_len, METH_NOARGS, 
+               "Number of elements returned"},
+       { NULL }
+};
+
+static void irpc_result_dealloc(PyObject *self)
+{
+       talloc_free(((irpc_ResultObject *)self)->mem_ctx);
+       PyObject_Del(self);
+}
+
+PyTypeObject irpc_ResultIteratorType = {
+       PyObject_HEAD_INIT(NULL) 0,
+       .tp_name = "irpc.ResultIterator",
+       .tp_basicsize = sizeof(irpc_ResultObject),
+       .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+       .tp_iternext = (iternextfunc)irpc_result_next,
+       .tp_iter = PyObject_SelfIter,
+       .tp_methods = irpc_result_methods,
+       .tp_dealloc = irpc_result_dealloc,
+};
+
+static PyObject *py_irpc_call(irpc_ClientConnectionObject *p, struct PyNdrRpcMethodDef *method_def, PyObject *args, PyObject *kwargs)
+{
+       void *ptr;
+       struct irpc_request **reqs;
+       int i, count;
+       NTSTATUS status;
+       TALLOC_CTX *mem_ctx = talloc_new(NULL);
+       irpc_ResultObject *ret;
+
+       /* allocate the C structure */
+       ptr = talloc_zero_size(mem_ctx, method_def->table->calls[method_def->opnum].struct_size);
+       if (ptr == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       /* convert the mpr object into a C structure */
+       if (!method_def->pack_in_data(args, kwargs, ptr)) {
+               talloc_free(mem_ctx);
+               return NULL;
+       }
+
+       for (count=0;p->dest_ids[count].id;count++) /* noop */ ;
+
+       /* we need to make a call per server */
+       reqs = talloc_array(mem_ctx, struct irpc_request *, count);
+       if (reqs == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       /* make the actual calls */
+       for (i=0;i<count;i++) {
+               reqs[i] = irpc_call_send(p->msg_ctx, p->dest_ids[i], 
+                                        method_def->table, method_def->opnum, ptr, ptr);
+               if (reqs[i] == NULL) {
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
+               }
+               talloc_steal(reqs, reqs[i]);
+       }
+
+       ret = PyObject_New(irpc_ResultObject, &irpc_ResultIteratorType);
+       ret->mem_ctx = mem_ctx;
+       ret->reqs = reqs;
+       ret->count = count;
+       ret->current = 0;
+       ret->unpack_fn = method_def->unpack_out_data;
+
+       return (PyObject *)ret;
+done:
+       talloc_free(mem_ctx);
+       PyErr_SetNTSTATUS(status);
+       return NULL;
+}
+
+static PyObject *py_irpc_call_wrapper(PyObject *self, PyObject *args, void *wrapped, PyObject *kwargs)
+{      
+       irpc_ClientConnectionObject *iface = (irpc_ClientConnectionObject *)self;
+       struct PyNdrRpcMethodDef *md = wrapped;
+
+       return py_irpc_call(iface, md, args, kwargs);
+}
+
+static void py_irpc_dealloc(PyObject *self)
+{
+       irpc_ClientConnectionObject *iface = (irpc_ClientConnectionObject *)self;
+       talloc_free(iface->mem_ctx);
+       PyObject_Del(self);
+}
+
+PyTypeObject irpc_ClientConnectionType = {
+       PyObject_HEAD_INIT(NULL) 0,
+       .tp_name = "irpc.ClientConnection",
+       .tp_basicsize = sizeof(irpc_ClientConnectionObject),
+       .tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
+       .tp_new = py_irpc_connect,
+       .tp_dealloc = py_irpc_dealloc,
+       .tp_doc = "ClientConnection(server, own_id=None, messaging_path=None)\n" \
+                 "Create a new IRPC client connection to communicate with the servers in the specified path.\n" \
+                 "If no path is specified, the default path from smb.conf will be used."
+};
+
+static bool irpc_AddNdrRpcMethods(PyTypeObject *ifacetype, const struct PyNdrRpcMethodDef *mds)
+{
+       int i;
+       for (i = 0; mds[i].name; i++) {
+               PyObject *ret;
+               struct wrapperbase *wb = calloc(sizeof(struct wrapperbase), 1);
+
+               wb->name = discard_const_p(char, mds[i].name);
+               wb->flags = PyWrapperFlag_KEYWORDS;
+               wb->wrapper = (wrapperfunc)py_irpc_call_wrapper;
+               wb->doc = discard_const_p(char, mds[i].doc);
+               
+               ret = PyDescr_NewWrapper(ifacetype, wb, discard_const_p(void, &mds[i]));
+
+               PyDict_SetItemString(ifacetype->tp_dict, mds[i].name, 
+                                    (PyObject *)ret);
+       }
+
+       return true;
+}
+
+void initmessaging(void)
+{
+       extern void initirpc(void);
+       PyObject *mod;
+
+       if (PyType_Ready(&irpc_ClientConnectionType) < 0)
+               return;
+
+       if (PyType_Ready(&messaging_Type) < 0)
+               return;
+
+       if (PyType_Ready(&irpc_ResultIteratorType) < 0) 
+               return;
+
+       if (!irpc_AddNdrRpcMethods(&irpc_ClientConnectionType, py_ndr_irpc_methods))
+               return;
+
+       mod = Py_InitModule3("messaging", NULL, "Internal RPC");
+       if (mod == NULL)
+               return;
+
+       initirpc();
+
+       Py_INCREF((PyObject *)&irpc_ClientConnectionType);
+       PyModule_AddObject(mod, "ClientConnection", (PyObject *)&irpc_ClientConnectionType);
+
+       Py_INCREF((PyObject *)&messaging_Type);
+       PyModule_AddObject(mod, "Messaging", (PyObject *)&messaging_Type);
+}
diff --git a/source/lib/messaging/tests/bindings.py b/source/lib/messaging/tests/bindings.py
new file mode 100644 (file)
index 0000000..c89538d
--- /dev/null
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Unix SMB/CIFS implementation.
+# Copyright © Jelmer Vernooij <jelmer@samba.org> 2008
+#   
+# 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#   
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#   
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+from samba.messaging import Messaging
+from unittest import TestCase
+
+class MessagingTests(TestCase):
+    def get_context(self, *args, **kwargs):
+        kwargs["messaging_path"] = "."
+        return Messaging(*args, **kwargs)
+    
+    def test_register(self):
+        x = self.get_context()
+        def callback():
+            pass
+        msg_type = x.register(callback)
+        x.deregister(callback, msg_type)
+
+    def test_assign_server_id(self):
+        x = self.get_context()
+        self.assertTrue(isinstance(x.server_id, tuple))
+        self.assertEquals(3, len(x.server_id))
+
+    def test_ping_speed(self):
+        server_ctx = self.get_context((0, 1))
+        def ping_callback(src, data):
+                server_ctx.send(src, data)
+        def exit_callback():
+                print "received exit"
+        msg_ping = server_ctx.register(ping_callback)
+        msg_exit = server_ctx.register(exit_callback)
+
+        def pong_callback():
+                print "received pong"
+        client_ctx = self.get_context((0, 2))
+        msg_pong = client_ctx.register(pong_callback)
+
+        client_ctx.send((0,1), msg_ping, "testing")
+        client_ctx.send((0,1), msg_ping, "")
+
index 44adc535245e85a1f5930d1dc35d7495e2acdc86..fd1fd01a09e8b47b574d29ed696b73da2d34cbb0 100644 (file)
@@ -5,12 +5,11 @@ TDR_REGF_OBJ_FILES = $(libregistrysrcdir)/tdr_regf.o
 
 # Special support for external builddirs
 $(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c
-$(srcdir)/$(libregistrysrcdir)/regf.c: $(libregistrysrcdir)/tdr_regf.c
 $(libregistrysrcdir)/tdr_regf.h: $(libregistrysrcdir)/tdr_regf.c
-$(libregistrysrcdir)/tdr_regf.c: $(srcdir)/$(libregistrysrcdir)/regf.idl
-       @CPP="$(CPP)" srcdir="$(srcdir)" $(PERL) $(srcdir)/pidl/pidl $(PIDL_ARGS) \
-               --header --outputdir=lib/registry \
-               --tdr-parser -- $(srcdir)/$(libregistrysrcdir)/regf.idl
+$(libregistrysrcdir)/tdr_regf.c: $(libregistrysrcdir)/regf.idl
+       @CPP="$(CPP)" $(PERL) $(pidldir)/pidl $(PIDL_ARGS) \
+               --header --outputdir=$(libregistrysrcdir) \
+               --tdr-parser -- $(libregistrysrcdir)/regf.idl
 
 clean::
        @-rm -f $(libregistrysrcdir)/regf.h $(libregistrysrcdir)/tdr_regf*
index 4a2309faeee00fb3fd67cde30d824c1b03220112..5105040f30618514e395cf4ad26e30d86b08486c 100644 (file)
@@ -144,6 +144,24 @@ WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx,
        return key->ops->enum_value(mem_ctx, key, idx, name, type, data);
 }
 
+WERROR hive_get_sec_desc(TALLOC_CTX *mem_ctx,
+                        struct hive_key *key, 
+                        struct security_descriptor **security)
+{
+       if (key->ops->get_sec_desc == NULL)
+               return WERR_NOT_SUPPORTED;
+
+       return key->ops->get_sec_desc(mem_ctx, key, security);
+}
+
+WERROR hive_set_sec_desc(struct hive_key *key, 
+                        const struct security_descriptor *security)
+{
+       if (key->ops->set_sec_desc == NULL)
+               return WERR_NOT_SUPPORTED;
+
+       return key->ops->set_sec_desc(key, security);
+}
 
 WERROR hive_key_del_value(struct hive_key *key, const char *name)
 {
index ff3ddf0a3599f08b8f04857e9a0e7c38b77f5de9..c9b3b064470f3d49002a2f99622c6c452d161d37 100644 (file)
@@ -248,10 +248,10 @@ _PUBLIC_ WERROR reg_get_sec_desc(TALLOC_CTX *ctx,
                return WERR_INVALID_PARAM;
 
        /* A 'real' set function has preference */
-       if (key->context->ops->get_security == NULL)
+       if (key->context->ops->get_sec_desc == NULL)
                return WERR_NOT_SUPPORTED;
 
-       return key->context->ops->get_security(ctx, key, secdesc);
+       return key->context->ops->get_sec_desc(ctx, key, secdesc);
 }
 
 /**
@@ -282,27 +282,14 @@ _PUBLIC_ WERROR reg_key_flush(struct registry_key *key)
        return key->context->ops->flush_key(key);
 }
 
-_PUBLIC_ WERROR reg_get_security(TALLOC_CTX *mem_ctx,
-                                const struct registry_key *key,
-                                struct security_descriptor **security)
-{
-       if (key == NULL)
-               return WERR_INVALID_PARAM;
-
-       if (key->context->ops->get_security == NULL)
-               return WERR_NOT_SUPPORTED;
-
-       return key->context->ops->get_security(mem_ctx, key, security);
-}
-
-_PUBLIC_ WERROR reg_set_security(struct registry_key *key,
-                                struct security_descriptor *security)
+_PUBLIC_ WERROR reg_set_sec_desc(struct registry_key *key,
+                                const struct security_descriptor *security)
 {
        if (key == NULL)
                return WERR_INVALID_PARAM;
 
-       if (key->context->ops->set_security == NULL)
+       if (key->context->ops->set_sec_desc == NULL)
                return WERR_NOT_SUPPORTED;
 
-       return key->context->ops->set_security(key, security);
+       return key->context->ops->set_sec_desc(key, security);
 }
index 47d6d4cd32692224316e7d6f7fd7b489878d9480..4af95e2dd62d46fc9754bae51011934d675e9c45 100644 (file)
@@ -274,7 +274,21 @@ static WERROR local_get_key_info(TALLOC_CTX *mem_ctx,
                                 last_change_time, max_subkeynamelen, 
                                 max_valnamelen, max_valbufsize);
 }
+static WERROR local_get_sec_desc(TALLOC_CTX *mem_ctx, 
+                                const struct registry_key *key, 
+                                struct security_descriptor **security)
+{
+       const struct local_key *local = (const struct local_key *)key;
 
+       return hive_get_sec_desc(mem_ctx, local->hive_key, security);
+}
+static WERROR local_set_sec_desc(struct registry_key *key, 
+                                const struct security_descriptor *security)
+{
+       const struct local_key *local = (const struct local_key *)key;
+
+       return hive_set_sec_desc(local->hive_key, security);
+}
 const static struct registry_operations local_ops = {
        .name = "local",
        .open_key = local_open_key,
@@ -288,6 +302,8 @@ const static struct registry_operations local_ops = {
        .delete_value = local_delete_value,
        .flush_key = local_flush_key,
        .get_key_info = local_get_key_info,
+       .get_sec_desc = local_get_sec_desc,
+       .set_sec_desc = local_set_sec_desc,
 };
 
 WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx)
index 15e3a158f2b8d9a0b8683316317de4779668fb04..0ede3106f00dceecb9e95deee19aa503e867c1a3 100644 (file)
@@ -45,7 +45,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
                             void *callback_data)
 {
        int i;
-       struct registry_key *t1, *t2;
+       struct registry_key *t1 = NULL, *t2 = NULL;
        char *tmppath;
        const char *keyname1;
        WERROR error, error1, error2;
@@ -295,7 +295,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
 
        /* Reset position in file */
        lseek(fd, 0, SEEK_SET);
-#if 0
+#if 0 /* These backends are not supported yet. */
        if (strncmp(hdr, "CREG", 4) == 0) {
                /* Must be a W9x CREG Config.pol file */
                return reg_creg_diff_load(diff, fd);
@@ -320,12 +320,33 @@ static WERROR reg_diff_apply_add_key(void *_ctx, const char *key_name)
 {
        struct registry_context *ctx = (struct registry_context *)_ctx;
        struct registry_key *tmp;
+       char *buf, *buf_ptr;
        WERROR error;
 
+       /* Recursively create the path */
+       buf = talloc_strdup(ctx, key_name);
+       buf_ptr = buf;
+
+       while (*buf_ptr++ != '\0' ) {
+               if (*buf_ptr == '\\') {
+                       *buf_ptr = '\0';
+                       error = reg_key_add_abs(ctx, ctx, buf, 0, NULL, &tmp);
+
+                       if (!W_ERROR_EQUAL(error, WERR_ALREADY_EXISTS) &&
+                                   !W_ERROR_IS_OK(error)) {
+                               DEBUG(0, ("Error adding new key '%s': %s\n",
+                                       key_name, win_errstr(error)));
+                               return error;
+                       }
+                       *buf_ptr++ = '\\';
+               }
+       }
+
+       /* Add the key */
        error = reg_key_add_abs(ctx, ctx, key_name, 0, NULL, &tmp);
 
        if (!W_ERROR_EQUAL(error, WERR_ALREADY_EXISTS) &&
-           !W_ERROR_IS_OK(error)) {
+                   !W_ERROR_IS_OK(error)) {
                DEBUG(0, ("Error adding new key '%s': %s\n",
                        key_name, win_errstr(error)));
                return error;
index 59f40447135a9b332e1fdc1cb12fac7767a30624..1bc9c607536a9d732b0f0758e4cf798b039742ba 100644 (file)
@@ -3,7 +3,7 @@
    Reading .REG files
 
    Copyright (C) Jelmer Vernooij 2004-2007
-   Copyright (C) Wilco Baan Hofman 2006
+   Copyright (C) Wilco Baan Hofman 2006-2008
 
    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
@@ -20,7 +20,7 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* FIXME Newer .REG files, created by Windows XP and above use unicode UTF-16 */
+/* FIXME Newer .REG files, created by Windows XP and above use unicode UCS-2 */
 
 #include "includes.h"
 #include "lib/registry/registry.h"
@@ -112,8 +112,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
        data->iconv_convenience = iconv_convenience;
 
        if (filename) {
-               data->fd = open(filename, O_CREAT, 0755);
-               if (data->fd == -1) {
+               data->fd = open(filename, O_CREAT|O_WRONLY, 0755);
+               if (data->fd < 0) {
                        DEBUG(0, ("Unable to open %s\n", filename));
                        return WERR_BADFILE;
                }
@@ -121,7 +121,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
                data->fd = STDOUT_FILENO;
        }
 
-       fdprintf(data->fd, "%s\n", HEADER_STRING);
+       fdprintf(data->fd, "%s\n\n", HEADER_STRING);
 
        *callbacks = talloc(ctx, struct reg_diff_callbacks);
 
index 0fa367bfcb7ee8a915b9316ff8877b351dac3e0c..bb46495c19c5a21e180cc4bd934c25d3b5e6d1e6 100644 (file)
@@ -2,7 +2,7 @@
    Unix SMB/CIFS implementation.
    Reading Registry.pol PReg registry files
 
-   Copyright (C) Wilco Baan Hofman 2006
+   Copyright (C) Wilco Baan Hofman 2006-2008
 
    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
 #include "lib/registry/registry.h"
 #include "system/filesys.h"
 #include "param/param.h"
+#include "librpc/gen_ndr/winreg.h"
 
 struct preg_data {
        int fd;
+       TALLOC_CTX *ctx;
+       struct smb_iconv_convenience *ic;
 };
 
 static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
@@ -38,14 +41,22 @@ static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
        push_codepoint(ic, c, v);
        return WERR_OK;
 }
-
-/* FIXME These functions need to be implemented */
-static WERROR reg_preg_diff_add_key(void *_data, const char *key_name)
+static WERROR preg_write_utf16(struct smb_iconv_convenience *ic, int fd, const char *string)
 {
+       codepoint_t v;
+       uint16_t i;
+       size_t size;
+
+       for (i = 0; i < strlen(string); i+=size) {
+               v = next_codepoint(ic, &string[i], &size);
+               if (write(fd, &v, 2) < 2) {
+                       return WERR_GENERAL_FAILURE;
+               }
+       }
        return WERR_OK;
 }
-
-static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
+/* PReg does not support adding keys. */
+static WERROR reg_preg_diff_add_key(void *_data, const char *key_name)
 {
        return WERR_OK;
 }
@@ -54,24 +65,73 @@ static WERROR reg_preg_diff_set_value(void *_data, const char *key_name,
                                      const char *value_name,
                                      uint32_t value_type, DATA_BLOB value_data)
 {
+       struct preg_data *data = _data;
+       uint32_t buf;
+       
+       preg_write_utf16(data->ic, data->fd, "[");
+       preg_write_utf16(data->ic, data->fd, key_name);
+       preg_write_utf16(data->ic, data->fd, ";");
+       preg_write_utf16(data->ic, data->fd, value_name);
+       preg_write_utf16(data->ic, data->fd, ";");
+       SIVAL(&buf, 0, value_type);
+       write(data->fd, &buf, sizeof(uint32_t));
+       preg_write_utf16(data->ic, data->fd, ";");
+       SIVAL(&buf, 0, value_data.length);
+       write(data->fd, &buf, sizeof(uint32_t));
+       preg_write_utf16(data->ic, data->fd, ";");
+       write(data->fd, value_data.data, value_data.length);
+       preg_write_utf16(data->ic, data->fd, "]");
+       
        return WERR_OK;
 }
 
+static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
+{
+       struct preg_data *data = _data;
+       char *parent_name;
+       DATA_BLOB blob;
+
+       parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name);
+       blob.data = (void *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1, 
+                       strlen(key_name)-(strrchr(key_name, '\\')-key_name));
+       blob.length = strlen((char *)blob.data)+1;
+       
+
+       /* FIXME: These values should be accumulated to be written at done(). */
+       return reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob);
+}
+
 static WERROR reg_preg_diff_del_value(void *_data, const char *key_name,
                                      const char *value_name)
 {
-       return WERR_OK;
+       struct preg_data *data = _data;
+       char *val;
+       DATA_BLOB blob;
+
+       val = talloc_asprintf(data->ctx, "**Del.%s", value_name);
+
+       blob.data = (void *)talloc(data->ctx, uint32_t);
+       *(uint32_t *)blob.data = 0;
+       blob.length = 4;
+       return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
 }
 
 static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
 {
-       return WERR_OK;
+       struct preg_data *data = _data;
+       DATA_BLOB blob;
+
+       blob.data = (void *)talloc(data->ctx, uint32_t);
+       *(uint32_t *)blob.data = 0;     
+       blob.length = 4;
+
+       return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob);
 }
 
 static WERROR reg_preg_diff_done(void *_data)
 {
        struct preg_data *data = (struct preg_data *)_data;
-
+       
        close(data->fd);
        talloc_free(data);
        return WERR_OK;
@@ -81,6 +141,7 @@ static WERROR reg_preg_diff_done(void *_data)
  * Save registry diff
  */
 _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
+                                  struct smb_iconv_convenience *ic,
                                   struct reg_diff_callbacks **callbacks,
                                   void **callback_data)
 {
@@ -95,18 +156,22 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
        *callback_data = data;
 
        if (filename) {
-               data->fd = open(filename, O_CREAT, 0755);
-               if (data->fd == -1) {
+               data->fd = open(filename, O_CREAT|O_WRONLY, 0755);
+               if (data->fd < 0) {
                        DEBUG(0, ("Unable to open %s\n", filename));
                        return WERR_BADFILE;
                }
        } else {
                data->fd = STDOUT_FILENO;
        }
-       snprintf(preg_header.hdr, 4, "PReg");
+
+       strncpy(preg_header.hdr, "PReg", 4);
        SIVAL(&preg_header, 4, 1);
        write(data->fd, (uint8_t *)&preg_header,8);
 
+       data->ctx = ctx;
+       data->ic = ic;
+
        *callbacks = talloc(ctx, struct reg_diff_callbacks);
 
        (*callbacks)->add_key = reg_preg_diff_add_key;
@@ -149,6 +214,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                ret = WERR_GENERAL_FAILURE;
                goto cleanup;
        }
+       preg_header.version = IVAL(&preg_header.version, 0);
+
        if (strncmp(preg_header.hdr, "PReg", 4) != 0) {
                DEBUG(0, ("This file is not a valid preg registry file\n"));
                ret = WERR_GENERAL_FAILURE;
@@ -177,7 +244,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
                        buf_ptr++;
                }
-               key = talloc_asprintf(mem_ctx, "\\%s", buf);
+               buf[buf_ptr-buf] = '\0';
+               key = talloc_strdup(mem_ctx, buf);
 
                /* Get the name */
                buf_ptr = buf;
@@ -185,6 +253,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
                        buf_ptr++;
                }
+               buf[buf_ptr-buf] = '\0';
                value_name = talloc_strdup(mem_ctx, buf);
 
                /* Get the type */
@@ -193,6 +262,8 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                        ret = WERR_GENERAL_FAILURE;
                        goto cleanup;
                }
+               value_type = IVAL(&value_type, 0);
+
                /* Read past delimiter */
                buf_ptr = buf;
                if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
index 46ccca922b8903d7892c908326ee4eff21a31319..57a895aa000b6cd17803093a2e58d12b1951bcf4 100644 (file)
@@ -25,6 +25,8 @@
 #include "librpc/gen_ndr/winreg.h"
 #include "param/param.h"
 #include "lib/registry/registry.h"
+#include "libcli/security/security.h"
+
 
 static struct hive_operations reg_backend_regf;
 
@@ -1915,9 +1917,12 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
 {
        struct regf_data *regf;
        struct regf_hdr *regf_hdr;
-       int i;
        struct nk_block nk;
+       struct sk_block sk;
        WERROR error;
+       DATA_BLOB data;
+       struct security_descriptor *sd;
+       uint32_t sk_offset;
 
        regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
 
@@ -1945,20 +1950,17 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
        regf_hdr->version.minor = minor_version;
        regf_hdr->last_block = 0x1000; /* Block size */
        regf_hdr->description = talloc_strdup(regf_hdr,
-                                             "registry created by Samba 4");
+                                             "Registry created by Samba 4");
        W_ERROR_HAVE_NO_MEMORY(regf_hdr->description);
        regf_hdr->chksum = 0;
 
        regf->header = regf_hdr;
 
-       i = 0;
        /* Create all hbin blocks */
        regf->hbins = talloc_array(regf, struct hbin_block *, 1);
        W_ERROR_HAVE_NO_MEMORY(regf->hbins);
        regf->hbins[0] = NULL;
 
-       regf_hdr->data_offset = -1; /* FIXME */
-
        nk.header = "nk";
        nk.type = REG_SUB_KEY;
        unix_to_nt_time(&nk.last_change, time(NULL));
@@ -1971,27 +1973,67 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
        nk.num_values = 0;
        nk.values_offset = -1;
        memset(nk.unk3, 0, 5);
-       nk.clsname_offset = -1; /* FIXME: fill in */
+       nk.clsname_offset = -1;
        nk.clsname_length = 0;
-       nk.key_name = "";
+       nk.sk_offset = 0x80;
+       nk.key_name = "SambaRootKey";
+
+       /*
+        * It should be noted that changing the key_name to something shorter
+        * creates a shorter nk block, which makes the position of the sk block
+        * change. All Windows registries I've seen have the sk at 0x80. 
+        * I therefore recommend that our regf files share that offset -- Wilco
+        */
+
+       /* Create a security descriptor. */
+       sd = security_descriptor_dacl_create(regf,
+                                        0,
+                                        NULL, NULL,
+                                        SID_NT_AUTHENTICATED_USERS,
+                                        SEC_ACE_TYPE_ACCESS_ALLOWED,
+                                        SEC_GENERIC_ALL,
+                                        SEC_ACE_FLAG_OBJECT_INHERIT,
+                                        NULL);
+       
+       /* Push the security descriptor to a blob */
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, NULL, 
+                                    sd, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) {
+               DEBUG(0, ("Unable to push security descriptor\n"));
+               return WERR_GENERAL_FAILURE;
+       }
 
-       nk.sk_offset = -1; /* FIXME: fill in */
+       ZERO_STRUCT(sk);
+       sk.header = "sk";
+       sk.prev_offset = 0x80;
+       sk.next_offset = 0x80;
+       sk.ref_cnt = 1;
+       sk.rec_size = data.length;
+       sk.sec_desc = data.data;
 
        /* Store the new nk key */
        regf->header->data_offset = hbin_store_tdr(regf,
                                                   (tdr_push_fn_t)tdr_push_nk_block,
                                                   &nk);
+       /* Store the sk block */
+       sk_offset = hbin_store_tdr(regf,
+                                  (tdr_push_fn_t) tdr_push_sk_block,
+                                  &sk);
+       if (sk_offset != 0x80) {
+               DEBUG(0, ("Error storing sk block, should be at 0x80, stored at 0x%x\n", nk.sk_offset));
+               return WERR_GENERAL_FAILURE;
+       }
+
 
        *key = (struct hive_key *)regf_get_key(parent_ctx, regf,
                                               regf->header->data_offset);
 
-       /* We can drop our own reference now that *key will have created one */
-       talloc_free(regf);
-
        error = regf_save_hbin(regf);
        if (!W_ERROR_IS_OK(error)) {
                return error;
        }
+       
+       /* We can drop our own reference now that *key will have created one */
+       talloc_free(regf);
 
        return WERR_OK;
 }
index 9c0f66b6d6ea9db922fa184b91e52aad2c9cb7b7..e134e3e5321147ba3e3fbf99b43def8eea0226b2 100644 (file)
@@ -186,6 +186,12 @@ WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx,
                               struct hive_key *key, uint32_t idx,
                               const char **name,
                               uint32_t *type, DATA_BLOB *data);
+WERROR hive_get_sec_desc(TALLOC_CTX *mem_ctx,
+                        struct hive_key *key,
+                        struct security_descriptor **security);
+
+WERROR hive_set_sec_desc(struct hive_key *key, 
+                        const struct security_descriptor *security);
 
 WERROR hive_key_del_value(struct hive_key *key, const char *name);
 
@@ -314,11 +320,11 @@ struct registry_operations {
                              uint32_t *type,
                              DATA_BLOB *data);
 
-       WERROR (*get_security) (TALLOC_CTX *mem_ctx,
+       WERROR (*get_sec_desc) (TALLOC_CTX *mem_ctx,
                                const struct registry_key *key,
                                struct security_descriptor **security);
 
-       WERROR (*set_security) (struct registry_key *key,
+       WERROR (*set_sec_desc) (struct registry_key *key,
                                const struct security_descriptor *security);
 
        WERROR (*load_key) (struct registry_key *key,
@@ -463,12 +469,8 @@ struct registry_key *reg_import_hive_key(struct registry_context *ctx,
                                         struct hive_key *hive,
                                         uint32_t predef_key,
                                         const char **elements);
-WERROR reg_get_security(TALLOC_CTX *mem_ctx,
-                       const struct registry_key *key,
-                       struct security_descriptor **security);
-
-WERROR reg_set_security(struct registry_key *key,
-                       struct security_descriptor *security);
+WERROR reg_set_sec_desc(struct registry_key *key,
+                       const struct security_descriptor *security);
 
 struct reg_diff_callbacks {
        WERROR (*add_key) (void *callback_data, const char *key_name);
@@ -492,11 +494,19 @@ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
                            struct smb_iconv_convenience *iconv_convenience,
                            struct reg_diff_callbacks **callbacks,
                            void **callback_data);
+WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
+                         struct smb_iconv_convenience *ic,
+                         struct reg_diff_callbacks **callbacks,
+                         void **callback_data);
 WERROR reg_generate_diff_key(struct registry_key *oldkey,
                             struct registry_key *newkey,
                             const char *path,
                             const struct reg_diff_callbacks *callbacks,
                             void *callback_data);
+WERROR reg_diff_load(const char *filename,
+                    struct smb_iconv_convenience *iconv_convenience,
+                    const struct reg_diff_callbacks *callbacks,
+                    void *callback_data);
 
 
 
index 5ffee4bb3dab341537d5bdf388eb6f1915ed3135..9420ba2014cd6e66c0ccbd92441fba164c7c26c7 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-%module registry
+%define DOCSTRING
+"Access to various registry formats and the Samba registry."
+%enddef
+
+%module(docstring=DOCSTRING) registry
 
 %{
 /* Include headers */
@@ -93,11 +97,20 @@ WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx);
 typedef struct registry_context {
     %extend {
 
+    %feature("docstring") get_predefined_key_by_name "S.get_predefined_key_by_name(name) -> key\n"
+                                                     "Find a predefined key by name";
     WERROR get_predefined_key_by_name(const char *name, 
                                       struct registry_key **key);
 
+    %feature("docstring") key_del_abs "S.key_del_abs(name) -> None\n"
+                                      "Delete a key by absolute path.";
     WERROR key_del_abs(const char *path);
+    %feature("docstring") get_predefined_key "S.get_predefined_key(hkey_id) -> key\n"
+                                      "Find a predefined key by id";
     WERROR get_predefined_key(uint32_t hkey_id, struct registry_key **key);
+    %feature("docstring") diff_apply "S.diff_apply(filename) -> None\n"
+                                      "Apply the diff from the specified file";
+
     WERROR diff_apply(const char *filename);
     WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks,
                          void *callback_data);
@@ -106,6 +119,8 @@ typedef struct registry_context {
                       const char **elements=NULL);
 
     struct registry_key *import_hive_key(struct hive_key *hive, uint32_t predef_key, const char **elements);
+    %feature("docstring") mount_hive "S.mount_hive(key, predef_name) -> None\n"
+                                      "Mount the specified key at the specified path.";
     WERROR mount_hive(struct hive_key *key, const char *predef_name)
     {
         int i;
@@ -130,6 +145,7 @@ typedef struct registry_context {
     $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0);
 }
 
+%feature("docstring") reg_open_hive "S.__init__(location, session_info=None, credentials=None, loadparm_context=None)";
 %rename(hive_key) reg_open_hive;
 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                      struct auth_session_info *session_info,
@@ -138,6 +154,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                      struct loadparm_context *lp_ctx,
                      struct hive_key **root);
 
+%feature("docstring") reg_open_ldb_file "open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key";
 %rename(open_ldb) reg_open_ldb_file;
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
              struct auth_session_info *session_info,
@@ -146,10 +163,12 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
              struct loadparm_context *lp_ctx,
              struct hive_key **k);
 
+%feature("docstring") reg_create_directory "create_dir(location) -> key";
 %rename(create_dir) reg_create_directory;
 WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
                 const char *location, struct hive_key **key);
 
+%feature("docstring") reg_open_directory "open_dir(location) -> key";
 %rename(open_dir) reg_open_directory;
 WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
              const char *location, struct hive_key **key);
@@ -158,15 +177,24 @@ WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
 
 typedef struct hive_key {
     %extend {
+        %feature("docstring") del "S.del(name) -> None\n"
+                                  "Delete a subkey";
         WERROR del(const char *name);
+        %feature("docstring") flush "S.flush() -> None\n"
+                                  "Flush this key to disk";
         WERROR flush(void);
+        %feature("docstring") del_value "S.del_value(name) -> None\n"
+                                  "Delete a value";
         WERROR del_value(const char *name);
+        %feature("docstring") set_value "S.set_value(name, type, data) -> None\n"
+                                  "Set a value";
         WERROR set_value(const char *name, uint32_t type, const DATA_BLOB data);
     }
 } hive_key;
 
 %rename(open_samba) reg_open_samba;
 
+%feature("docstring") reg_open_samba "open_samba() -> reg";
 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                       struct registry_context **ctx,
                       struct event_context *ev_ctx,
index cb20d6039ddded2a6069b8c29afa82d696c142d1..0aeefb86c1cb5f74838d4c660168dbb1bbe4137e 100644 (file)
@@ -3,6 +3,10 @@
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+Access to various registry formats and the Samba registry.
+"""
+
 import _registry
 import new
 new_instancemethod = new.instancemethod
@@ -66,6 +70,41 @@ Registry = _registry.Registry
 class reg(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
     __repr__ = _swig_repr
+    def get_predefined_key_by_name(*args, **kwargs):
+        """
+        S.get_predefined_key_by_name(name) -> key
+        Find a predefined key by name
+        """
+        return _registry.reg_get_predefined_key_by_name(*args, **kwargs)
+
+    def key_del_abs(*args, **kwargs):
+        """
+        S.key_del_abs(name) -> None
+        Delete a key by absolute path.
+        """
+        return _registry.reg_key_del_abs(*args, **kwargs)
+
+    def get_predefined_key(*args, **kwargs):
+        """
+        S.get_predefined_key(hkey_id) -> key
+        Find a predefined key by id
+        """
+        return _registry.reg_get_predefined_key(*args, **kwargs)
+
+    def diff_apply(*args, **kwargs):
+        """
+        S.diff_apply(filename) -> None
+        Apply the diff from the specified file
+        """
+        return _registry.reg_diff_apply(*args, **kwargs)
+
+    def mount_hive(*args):
+        """
+        S.mount_hive(key, predef_name) -> None
+        Mount the specified key at the specified path.
+        """
+        return _registry.reg_mount_hive(*args)
+
     def __init__(self, *args, **kwargs): 
         _registry.reg_swiginit(self,_registry.new_reg(*args, **kwargs))
     __swig_destroy__ = _registry.delete_reg
@@ -79,11 +118,26 @@ reg.mount_hive = new_instancemethod(_registry.reg_mount_hive,None,reg)
 reg_swigregister = _registry.reg_swigregister
 reg_swigregister(reg)
 
-hive_key = _registry.hive_key
-open_ldb = _registry.open_ldb
-create_dir = _registry.create_dir
-open_dir = _registry.open_dir
-open_samba = _registry.open_samba
+
+def hive_key(*args, **kwargs):
+  """S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"""
+  return _registry.hive_key(*args, **kwargs)
+
+def open_ldb(*args, **kwargs):
+  """open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"""
+  return _registry.open_ldb(*args, **kwargs)
+
+def create_dir(*args, **kwargs):
+  """create_dir(location) -> key"""
+  return _registry.create_dir(*args, **kwargs)
+
+def open_dir(*args, **kwargs):
+  """open_dir(location) -> key"""
+  return _registry.open_dir(*args, **kwargs)
+
+def open_samba(*args, **kwargs):
+  """open_samba() -> reg"""
+  return _registry.open_samba(*args, **kwargs)
 HKEY_CLASSES_ROOT = _registry.HKEY_CLASSES_ROOT
 HKEY_CURRENT_USER = _registry.HKEY_CURRENT_USER
 HKEY_LOCAL_MACHINE = _registry.HKEY_LOCAL_MACHINE
index d9b85ee9375ae89c3ca8a92d382c07636f05cef9..b066e42b41daacfe7e3cd7393222b8bac3a767a0 100644 (file)
@@ -3798,10 +3798,22 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL},
-        { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_predefined_key_by_name(name) -> key\n"
+               "Find a predefined key by name\n"
+               ""},
+        { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.key_del_abs(name) -> None\n"
+               "Delete a key by absolute path.\n"
+               ""},
+        { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.get_predefined_key(hkey_id) -> key\n"
+               "Find a predefined key by id\n"
+               ""},
+        { (char *)"reg_diff_apply", (PyCFunction) _wrap_reg_diff_apply, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.diff_apply(filename) -> None\n"
+               "Apply the diff from the specified file\n"
+               ""},
         { (char *)"reg_generate_diff", (PyCFunction) _wrap_reg_generate_diff, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"reg_import_hive_key", (PyCFunction) _wrap_reg_import_hive_key, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"reg_mount_hive", _wrap_reg_mount_hive, METH_VARARGS, NULL},
@@ -3809,11 +3821,11 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"delete_reg", (PyCFunction)_wrap_delete_reg, METH_O, NULL},
         { (char *)"reg_swigregister", reg_swigregister, METH_VARARGS, NULL},
         { (char *)"reg_swiginit", reg_swiginit, METH_VARARGS, NULL},
-        { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"hive_key", (PyCFunction) _wrap_hive_key, METH_VARARGS | METH_KEYWORDS, (char *)"S.__init__(location, session_info=None, credentials=None, loadparm_context=None)"},
+        { (char *)"open_ldb", (PyCFunction) _wrap_open_ldb, METH_VARARGS | METH_KEYWORDS, (char *)"open_ldb(location, session_info=None, credentials=None, loadparm_context=None) -> key"},
+        { (char *)"create_dir", (PyCFunction) _wrap_create_dir, METH_VARARGS | METH_KEYWORDS, (char *)"create_dir(location) -> key"},
+        { (char *)"open_dir", (PyCFunction) _wrap_open_dir, METH_VARARGS | METH_KEYWORDS, (char *)"open_dir(location) -> key"},
+        { (char *)"open_samba", (PyCFunction) _wrap_open_samba, METH_VARARGS | METH_KEYWORDS, (char *)"open_samba() -> reg"},
         { NULL, NULL, 0, NULL }
 };
 
index 690f71fcf7e9d865825478327b54c280ba8b86af..44ea090527a2630dc10bc72ca0fc6f30f99de888 100644 (file)
@@ -4,6 +4,7 @@
    local testing of registry diff functionality
 
    Copyright (C) Jelmer Vernooij 2007
+   Copyright (C) Wilco Baan Hofman 2008
 
    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
 #include "lib/registry/registry.h"
 #include "torture/torture.h"
 #include "librpc/gen_ndr/winreg.h"
+#include "param/param.h"
 
-static bool test_generate_diff(struct torture_context *test)
+struct diff_tcase_data {
+       struct registry_context *r1_ctx;
+       struct registry_context *r2_ctx;
+       struct reg_diff_callbacks *callbacks;
+       void *callback_data;
+       char *tempdir;
+       char *filename;
+};
+
+static bool test_generate_diff(struct torture_context *tctx, void *tcase_data)
 {
-       /* WERROR reg_generate_diff(struct registry_context *ctx1,
-                                 struct registry_context *ctx2,
-                                 const struct reg_diff_callbacks *callbacks,
-                                 void *callback_data)
-                                 */
+       WERROR error;
+       struct diff_tcase_data *td = tcase_data;
+
+       error = reg_generate_diff(td->r1_ctx, td->r2_ctx, 
+                       td->callbacks,
+                       td->callback_data);
+       torture_assert_werr_ok(tctx, error, "reg_generate_diff");
+
        return true;
 }
 
-
-static bool test_diff_load(struct torture_context *test)
+#if 0
+static bool test_diff_load(struct torture_context *tctx, void *tcase_data)
 {
-       /* WERROR reg_diff_load(const char *filename, const struct reg_diff_callbacks *callbacks, void *callback_data) */
+       struct diff_tcase_data *td = tcase_data;
+       struct smb_iconv_convenience *ic;
+       struct reg_diff_callbacks *callbacks;
+       void *data;
+       WERROR error;
+
+       ic = lp_iconv_convenience(tctx->lp_ctx);
+
+       error = reg_diff_load(td->filename, iconv_convenience, callbacks, data);
+       torture_assert_werr_ok(tctx, error, "reg_diff_load");
 
        return true;
 }
-
-static bool test_diff_apply(struct torture_context *test)
+#endif
+static bool test_diff_apply(struct torture_context *tctx, void *tcase_data)
 {
-       /* _PUBLIC_ WERROR reg_diff_apply (const char *filename, struct registry_context *ctx) */
+       struct diff_tcase_data *td = tcase_data;
+       struct registry_key *key;
+       WERROR error;
+
+       error = reg_diff_apply(td->r1_ctx, td->filename);
+       torture_assert_werr_ok(tctx, error, "reg_diff_apply");
+
+       error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed");
+
+       /* If this generates an error it could be that the apply doesn't work,
+        * but also that the reg_generate_diff didn't work. */
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Software", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\Software failed");
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Microsoft", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\Software\\Microsoft failed");
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Windows", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Microsoft\\Windows failed");
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "CurrentVersion", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Windows\\CurrentVersion failed");
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Policies", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\CurrentVersion\\Policies failed");
+       error = td->r1_ctx->ops->open_key(td->r1_ctx, key, "Explorer", &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKLM\\..\\Policies\\Explorer failed");
 
        return true;
 }
@@ -58,7 +104,7 @@ static WERROR test_add_key(void *callback_data, const char *key_name)
        return WERR_OK;
 }
 
-static bool test_generate_diff_key_add(struct torture_context *test)
+static bool test_generate_diff_key_add(struct torture_context *tctx, void *tcase_data)
 {
        struct reg_diff_callbacks cb;
        struct registry_key rk;
@@ -69,15 +115,15 @@ static bool test_generate_diff_key_add(struct torture_context *test)
 
        cb.add_key = test_add_key;
 
-       if (W_ERROR_IS_OK(reg_generate_diff_key(&rk, NULL, "bla", &cb, test)))
+       if (W_ERROR_IS_OK(reg_generate_diff_key(&rk, NULL, "bla", &cb, tctx)))
                return false;
 
-       torture_assert_str_equal(test, added_key, "bla", "key added");
+       torture_assert_str_equal(tctx, added_key, "bla", "key added");
 
        return true;
 }
 
-static bool test_generate_diff_key_null(struct torture_context *test)
+static bool test_generate_diff_key_null(struct torture_context *tctx, void *tcase_data)
 {
        struct reg_diff_callbacks cb;
 
@@ -89,18 +135,162 @@ static bool test_generate_diff_key_null(struct torture_context *test)
        return true;
 }
 
+static void tcase_add_tests (struct torture_tcase *tcase) 
+{
+       torture_tcase_add_simple_test(tcase, "test_generate_diff_key_add",
+                       test_generate_diff_key_add);
+       torture_tcase_add_simple_test(tcase, "test_generate_diff_key_null",
+                       test_generate_diff_key_null);
+       torture_tcase_add_simple_test(tcase, "test_generate_diff",
+                       test_generate_diff);
+       torture_tcase_add_simple_test(tcase, "test_diff_apply",
+                       test_diff_apply);
+/*     torture_tcase_add_simple_test(tcase, "test_diff_load",
+                       test_diff_load);
+*/
+}
+
+static bool diff_setup_tcase(struct torture_context *tctx, void **data)
+{
+       struct registry_context *r1_ctx, *r2_ctx;
+       WERROR error;
+       NTSTATUS status;
+       struct hive_key *r1_hklm, *r1_hkcu;
+       struct hive_key *r2_hklm, *r2_hkcu;
+       const char *filename;
+       struct diff_tcase_data *td;
+       struct registry_key *key, *newkey;
+       DATA_BLOB blob;
+
+       td = talloc(tctx, struct diff_tcase_data);
+
+       /* Create two registry contexts */
+       error = reg_open_local(tctx, &r1_ctx);
+       torture_assert_werr_ok(tctx, error, "Opening registry 1 for patch tests failed");
+       
+       error = reg_open_local(tctx, &r2_ctx);
+       torture_assert_werr_ok(tctx, error, "Opening registry 2 for patch tests failed");
+
+       /* Create temp directory */
+       status = torture_temp_dir(tctx, "patchfile", &td->tempdir);
+       torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed");
+
+       /* Create and mount HKLM and HKCU hives for registry 1 */
+       filename = talloc_asprintf(tctx, "%s/r1_local_machine.ldb", td->tempdir);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r1_hklm);
+       torture_assert_werr_ok(tctx, error, "Opening local machine file failed");
+
+       error = reg_mount_hive(r1_ctx, r1_hklm, HKEY_LOCAL_MACHINE, NULL);
+       torture_assert_werr_ok(tctx, error, "Mounting hive failed");
+       
+       filename = talloc_asprintf(tctx, "%s/r1_current_user.ldb", td->tempdir);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r1_hkcu);
+       torture_assert_werr_ok(tctx, error, "Opening current user file failed");
+
+       error = reg_mount_hive(r1_ctx, r1_hkcu, HKEY_CURRENT_USER, NULL);
+       torture_assert_werr_ok(tctx, error, "Mounting hive failed");
+       
+       /* Create and mount HKLM and HKCU hives for registry 2 */
+       filename = talloc_asprintf(tctx, "%s/r2_local_machine.ldb", td->tempdir);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r2_hklm);
+       torture_assert_werr_ok(tctx, error, "Opening local machine file failed");
+
+       error = reg_mount_hive(r2_ctx, r2_hklm, HKEY_LOCAL_MACHINE, NULL);
+       torture_assert_werr_ok(tctx, error, "Mounting hive failed");
+       
+       filename = talloc_asprintf(tctx, "%s/r2_current_user.ldb", td->tempdir);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &r2_hkcu);
+       torture_assert_werr_ok(tctx, error, "Opening current user file failed");
+       
+       error = reg_mount_hive(r2_ctx, r2_hkcu, HKEY_CURRENT_USER, NULL);
+       torture_assert_werr_ok(tctx, error, "Mounting hive failed");
+
+       error = r1_ctx->ops->get_predefined_key(r1_ctx, HKEY_CURRENT_USER, &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKEY_CURRENT_USER failed");
+       error = r1_ctx->ops->create_key(r1_ctx, key, "Network", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network failed");
+       error = r1_ctx->ops->create_key(r1_ctx, newkey, "L", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Opening HKCU\\Network\\L failed");
+
+       error = r2_ctx->ops->get_predefined_key(r2_ctx, HKEY_LOCAL_MACHINE, &key);
+       torture_assert_werr_ok(tctx, error, "Opening HKEY_LOCAL_MACHINE failed");
+       error = r2_ctx->ops->create_key(r2_ctx, key, "Software", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\Sofware failed");
+       error = r2_ctx->ops->create_key(r2_ctx, newkey, "Microsoft", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft failed");
+       error = r2_ctx->ops->create_key(r2_ctx, newkey, "Windows", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\Software\\Microsoft\\Windows failed");
+       error = r2_ctx->ops->create_key(r2_ctx, newkey, "CurrentVersion", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Windows\\CurrentVersion failed");
+       error = r2_ctx->ops->create_key(r2_ctx, newkey, "Policies", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\CurrentVersion\\Policies failed");
+       error = r2_ctx->ops->create_key(r2_ctx, newkey, "Explorer", NULL, NULL, &newkey);
+       torture_assert_werr_ok(tctx, error, "Creating HKLM\\..\\Policies\\Explorer failed");
+
+
+       blob.data = (void *)talloc(r2_ctx, uint32_t);
+       SIVAL(blob.data, 0, 0x03ffffff);
+       blob.length = sizeof(uint32_t);
+
+       r1_ctx->ops->set_value(newkey, "NoDrives", REG_DWORD, blob);
+
+       /* Set test case data */
+       td->r1_ctx = r1_ctx;
+       td->r2_ctx = r2_ctx;
+
+       *data = td;
+
+       return true;
+}
+
+static bool diff_setup_preg_tcase (struct torture_context *tctx, void **data)
+{
+       struct diff_tcase_data *td;
+       struct smb_iconv_convenience *ic;
+       WERROR error;
+
+       diff_setup_tcase(tctx, data);
+       td = *data;
+
+       ic = lp_iconv_convenience(tctx->lp_ctx);
+
+       td->filename = talloc_asprintf(tctx, "%s/test.pol", td->tempdir);
+       error = reg_preg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data);
+       torture_assert_werr_ok(tctx, error, "reg_preg_diff_save");
+
+       return true;
+}
+
+static bool diff_setup_dotreg_tcase (struct torture_context *tctx, void **data)
+{
+       struct diff_tcase_data *td;
+       struct smb_iconv_convenience *ic;
+       WERROR error;
+
+       diff_setup_tcase(tctx, data);
+       td = *data;
+
+       ic = lp_iconv_convenience(tctx->lp_ctx);
+       
+       td->filename = talloc_asprintf(tctx, "%s/test.reg", td->tempdir);
+       error = reg_dotreg_diff_save(tctx, td->filename, ic, &td->callbacks, &td->callback_data);
+       torture_assert_werr_ok(tctx, error, "reg_dotreg_diff_save");
+
+       return true;
+}
+
 struct torture_suite *torture_registry_diff(TALLOC_CTX *mem_ctx)
 {
+       struct torture_tcase *tcase;
        struct torture_suite *suite = torture_suite_create(mem_ctx, "DIFF");
-       torture_suite_add_simple_test(suite, "test_generate_diff_key_add",
-                                     test_generate_diff_key_add);
-       torture_suite_add_simple_test(suite, "test_generate_diff_key_null",
-                                     test_generate_diff_key_null);
-       torture_suite_add_simple_test(suite, "test_diff_apply",
-                                     test_diff_apply);
-       torture_suite_add_simple_test(suite, "test_generate_diff",
-                                     test_generate_diff);
-       torture_suite_add_simple_test(suite, "test_diff_load",
-                                     test_diff_load);
+
+       tcase = torture_suite_add_tcase(suite, "PReg");
+       torture_tcase_set_fixture(tcase, diff_setup_preg_tcase, NULL);
+       tcase_add_tests(tcase);
+
+       tcase = torture_suite_add_tcase(suite, "dotreg");
+       torture_tcase_set_fixture(tcase, diff_setup_dotreg_tcase, NULL);
+       tcase_add_tests(tcase);
+
        return suite;
 }
index 29f7e685c102faadf0e15cdedcfa5b8269d7d540..edc97c2468ebe8ca774b2f6cd7c336af4406a64a 100644 (file)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/winreg.h"
 #include "system/filesys.h"
 #include "param/param.h"
+#include "libcli/security/security.h"
 
 static bool test_del_nonexistant_key(struct torture_context *tctx,
                                     const void *test_data)
@@ -306,6 +307,56 @@ static bool test_list_values(struct torture_context *tctx,
        return true;
 }
 
+static bool test_hive_security(struct torture_context *tctx, const void *_data)
+{
+       struct hive_key *subkey = NULL;
+        const struct hive_key *root = _data;
+       WERROR error;
+       struct security_descriptor *osd, *nsd;
+       
+       osd = security_descriptor_dacl_create(tctx,
+                                        0,
+                                        NULL, NULL,
+                                        SID_NT_AUTHENTICATED_USERS,
+                                        SEC_ACE_TYPE_ACCESS_ALLOWED,
+                                        SEC_GENERIC_ALL,
+                                        SEC_ACE_FLAG_OBJECT_INHERIT,
+                                        NULL);
+
+
+       error = hive_key_add_name(tctx, root, "SecurityKey", NULL,
+                                 osd, &subkey);
+       torture_assert_werr_ok(tctx, error, "hive_key_add_name");
+
+       error = hive_get_sec_desc(tctx, subkey, &nsd);
+       torture_assert_werr_ok (tctx, error, "getting security descriptor");
+
+       torture_assert(tctx, security_descriptor_equal(osd, nsd),
+                      "security descriptor changed!");
+
+       /* Create a fresh security descriptor */        
+       talloc_free(osd);
+       osd = security_descriptor_dacl_create(tctx,
+                                        0,
+                                        NULL, NULL,
+                                        SID_NT_AUTHENTICATED_USERS,
+                                        SEC_ACE_TYPE_ACCESS_ALLOWED,
+                                        SEC_GENERIC_ALL,
+                                        SEC_ACE_FLAG_OBJECT_INHERIT,
+                                        NULL);
+
+       error = hive_set_sec_desc(subkey, osd);
+       torture_assert_werr_ok(tctx, error, "setting security descriptor");
+       
+       error = hive_get_sec_desc(tctx, subkey, &nsd);
+       torture_assert_werr_ok (tctx, error, "getting security descriptor");
+       
+       torture_assert(tctx, security_descriptor_equal(osd, nsd),
+                      "security descriptor changed!");
+
+       return true;
+}
+
 static void tcase_add_tests(struct torture_tcase *tcase)
 {
        torture_tcase_add_simple_test_const(tcase, "del_nonexistant_key",
@@ -333,6 +384,8 @@ static void tcase_add_tests(struct torture_tcase *tcase)
                                                test_del_key);
        torture_tcase_add_simple_test_const(tcase, "del_value",
                                                test_del_value);
+       torture_tcase_add_simple_test_const(tcase, "check hive security",
+                                               test_hive_security);
 }
 
 static bool hive_setup_dir(struct torture_context *tctx, void **data)
@@ -390,7 +443,7 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data)
        char *dirname;
        NTSTATUS status;
 
-       status = torture_temp_dir(tctx, "hive-dir", &dirname);
+       status = torture_temp_dir(tctx, "hive-regf", &dirname);
        if (!NT_STATUS_IS_OK(status))
                return false;
 
index 661d7c2c6985ba16d0a87f70911511750479be05..7274bf009d1e09f641f38e31051d57564bda0afd 100644 (file)
@@ -390,11 +390,11 @@ static bool test_security(struct torture_context *tctx, void *_data)
                                         SEC_ACE_FLAG_OBJECT_INHERIT,
                                         NULL);
 
-       error = reg_set_security(subkey, osd);
-       torture_assert_werr_ok(tctx, error, "setting security");
+       error = reg_set_sec_desc(subkey, osd);
+       torture_assert_werr_ok(tctx, error, "setting security descriptor");
 
-       error = reg_get_security(tctx, subkey, &nsd);
-       torture_assert_werr_ok (tctx, error, "setting security");
+       error = reg_get_sec_desc(tctx, subkey, &nsd);
+       torture_assert_werr_ok (tctx, error, "getting security descriptor");
 
        torture_assert(tctx, security_descriptor_equal(osd, nsd),
                       "security descriptor changed!");
index 6cde6b9e0caf3e0b41e4d13839fad2c18a055266..4edb55c03a29e057f38b4597a8d443c4d574ab89 100644 (file)
@@ -341,7 +341,7 @@ fi
 
 dnl test for ipv6
 AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
-       AC_TRY_COMPILE([
+       AC_TRY_LINK([
 #include <stdlib.h> /* for NULL */
 #include <sys/socket.h>
 #include <sys/types.h>
index ab85bba438ca7408632df2f441f9d5f759ec641a..ad6bc66690cb9eb5811408f7b7ff856daed4585e 100644 (file)
@@ -79,10 +79,10 @@ AC_MSG_CHECKING(whether to use extern readline)
 if test x"$EXTERNAL_READLINE" = x"yes"; then
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_LIBREADLINE,1,[Whether the system has readline])
-       SMB_SUBSYSTEM(SMBREADLINE, [lib/smbreadline/smbreadline.o], [READLINE])
+       SMB_SUBSYSTEM(SMBREADLINE, [\$(smbreadlinesrcdir)/smbreadline.o], [READLINE])
        SMB_EXT_LIB(READLINE, [${TERMLIBS}])
        SMB_ENABLE(READLINE,YES)
 else
-       SMB_SUBSYSTEM(SMBREADLINE, [lib/smbreadline/smbreadline.o], [])
+       SMB_SUBSYSTEM(SMBREADLINE, [\$(smbreadlinesrcdir)/smbreadline.o], [])
        AC_MSG_RESULT(no)
 fi
index 704f0facc635553c0de13170614c67364f504db4..5f23568170d8a2e2f196d76bc07e9afc901298eb 100644 (file)
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-%module tdb
+%define DOCSTRING
+"TDB is a simple key-value database similar to GDBM that supports multiple writers."
+%enddef
+
+%module(docstring=DOCSTRING) tdb
 
 %{
 
@@ -138,7 +142,8 @@ enum TDB_ERROR {
     $1 = TDB_REPLACE;
 }
 
-%rename(Tdb) tdb;
+%rename(Tdb) tdb_context;
+%feature("docstring") tdb_context "A TDB file.";
 %typemap(out,noblock=1) tdb * {
     /* Throw an IOError exception from errno if tdb_open() returns NULL */
     if ($1 == NULL) {
@@ -150,34 +155,68 @@ enum TDB_ERROR {
 
 typedef struct tdb_context {
     %extend {
+        %feature("docstring") tdb "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n"
+                                  "Open a TDB file.";
         tdb(const char *name, int hash_size, int tdb_flags, int flags, mode_t mode) {
             return tdb_open(name, hash_size, tdb_flags, flags, mode);
         }
         enum TDB_ERROR error();
         ~tdb() { tdb_close($self); }
+        %feature("docstring") close "S.close() -> None\n"
+                                    "Close the TDB file.";
         int close();
         int append(TDB_DATA key, TDB_DATA new_dbuf);
+        %feature("docstring") errorstr "S.errorstr() -> errorstring\n"
+                                        "Obtain last error message.";
         const char *errorstr();
         %rename(get) fetch;
+        %feature("docstring") fetch "S.fetch(key) -> value\n"
+                                        "Fetch a value.";
         TDB_DATA fetch(TDB_DATA key);
+        %feature("docstring") delete "S.delete(key) -> None\n"
+                                        "Delete an entry.";
         int delete(TDB_DATA key);
+        %feature("docstring") store "S.store(key, value, flag=TDB_REPLACE) -> None\n"
+                                        "Store an entry.";
         int store(TDB_DATA key, TDB_DATA dbuf, int flag);
         int exists(TDB_DATA key);
+        %feature("docstring") firstkey "S.firstkey() -> data\n"
+                                        "Return the first key in this database.";
         TDB_DATA firstkey();
+        %feature("docstring") nextkey "S.nextkey(prev) -> data\n"
+                                        "Return the next key in this database.";
         TDB_DATA nextkey(TDB_DATA key);
+        %feature("docstring") lockall "S.lockall() -> bool";
         int lockall();
+        %feature("docstring") unlockall "S.unlockall() -> bool";
         int unlockall();
+        %feature("docstring") unlockall "S.lockall_read() -> bool";
         int lockall_read();
+        %feature("docstring") unlockall "S.unlockall_read() -> bool";
         int unlockall_read();
+        %feature("docstring") reopen "S.reopen() -> bool\n"
+                                        "Reopen this file.";
         int reopen();
+        %feature("docstring") transaction_start "S.transaction_start() -> None\n"
+                                        "Start a new transaction.";
         int transaction_start();
+        %feature("docstring") transaction_commit "S.transaction_commit() -> None\n"
+                                        "Commit the currently active transaction.";
         int transaction_commit();
+        %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n"
+                                        "Cancel the currently active transaction.";
         int transaction_cancel();
         int transaction_recover();
+        %feature("docstring") hash_size "S.hash_size() -> int";
         int hash_size();
+        %feature("docstring") map_size "S.map_size() -> int";
         size_t map_size();
+        %feature("docstring") get_flags "S.get_flags() -> int";
         int get_flags();
+        %feature("docstring") set_max_dead "S.set_max_dead(int) -> None";
         void set_max_dead(int max_dead);
+        %feature("docstring") name "S.name() -> path\n" \
+                                   "Return filename of this TDB file.";
         const char *name();
     }
 
index eb76ca64593ed2bc1aaad5944ed2544e3d3f39dd..a8c1d06e0d9717d731ce4c348dc13173d0def648 100644 (file)
@@ -3,6 +3,10 @@
 #
 # Don't modify this file, modify the SWIG interface instead.
 
+"""
+TDB is a simple key-value database similar to GDBM that supports multiple writers.
+"""
+
 import _tdb
 import new
 new_instancemethod = new.instancemethod
@@ -78,11 +82,125 @@ TDB_ERR_LOCK_TIMEOUT = _tdb.TDB_ERR_LOCK_TIMEOUT
 TDB_ERR_NOEXIST = _tdb.TDB_ERR_NOEXIST
 TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL
 TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY
-class tdb(object):
+class Tdb(object):
+    """A TDB file."""
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
-    __swig_destroy__ = _tdb.delete_tdb
+    def __init__(self, *args, **kwargs): 
+        """
+        S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)
+        Open a TDB file.
+        """
+        _tdb.Tdb_swiginit(self,_tdb.new_Tdb(*args, **kwargs))
+    __swig_destroy__ = _tdb.delete_Tdb
+    def close(*args, **kwargs):
+        """
+        S.close() -> None
+        Close the TDB file.
+        """
+        return _tdb.Tdb_close(*args, **kwargs)
+
+    def errorstr(*args, **kwargs):
+        """
+        S.errorstr() -> errorstring
+        Obtain last error message.
+        """
+        return _tdb.Tdb_errorstr(*args, **kwargs)
+
+    def get(*args, **kwargs):
+        """
+        S.fetch(key) -> value
+        Fetch a value.
+        """
+        return _tdb.Tdb_get(*args, **kwargs)
+
+    def delete(*args, **kwargs):
+        """
+        S.delete(key) -> None
+        Delete an entry.
+        """
+        return _tdb.Tdb_delete(*args, **kwargs)
+
+    def store(*args, **kwargs):
+        """
+        S.store(key, value, flag=TDB_REPLACE) -> None
+        Store an entry.
+        """
+        return _tdb.Tdb_store(*args, **kwargs)
+
+    def firstkey(*args, **kwargs):
+        """
+        S.firstkey() -> data
+        Return the first key in this database.
+        """
+        return _tdb.Tdb_firstkey(*args, **kwargs)
+
+    def nextkey(*args, **kwargs):
+        """
+        S.nextkey(prev) -> data
+        Return the next key in this database.
+        """
+        return _tdb.Tdb_nextkey(*args, **kwargs)
+
+    def lock_all(*args, **kwargs):
+        """S.lockall() -> bool"""
+        return _tdb.Tdb_lock_all(*args, **kwargs)
+
+    def unlock_all(*args, **kwargs):
+        """S.unlockall() -> bool"""
+        return _tdb.Tdb_unlock_all(*args, **kwargs)
+
+    def reopen(*args, **kwargs):
+        """
+        S.reopen() -> bool
+        Reopen this file.
+        """
+        return _tdb.Tdb_reopen(*args, **kwargs)
+
+    def transaction_start(*args, **kwargs):
+        """
+        S.transaction_start() -> None
+        Start a new transaction.
+        """
+        return _tdb.Tdb_transaction_start(*args, **kwargs)
+
+    def transaction_commit(*args, **kwargs):
+        """
+        S.transaction_commit() -> None
+        Commit the currently active transaction.
+        """
+        return _tdb.Tdb_transaction_commit(*args, **kwargs)
+
+    def transaction_cancel(*args, **kwargs):
+        """
+        S.transaction_cancel() -> None
+        Cancel the currently active transaction.
+        """
+        return _tdb.Tdb_transaction_cancel(*args, **kwargs)
+
+    def hash_size(*args, **kwargs):
+        """S.hash_size() -> int"""
+        return _tdb.Tdb_hash_size(*args, **kwargs)
+
+    def map_size(*args, **kwargs):
+        """S.map_size() -> int"""
+        return _tdb.Tdb_map_size(*args, **kwargs)
+
+    def get_flags(*args, **kwargs):
+        """S.get_flags() -> int"""
+        return _tdb.Tdb_get_flags(*args, **kwargs)
+
+    def set_max_dead(*args, **kwargs):
+        """S.set_max_dead(int) -> None"""
+        return _tdb.Tdb_set_max_dead(*args, **kwargs)
+
+    def name(*args, **kwargs):
+        """
+        S.name() -> path
+        Return filename of this TDB file.
+        """
+        return _tdb.Tdb_name(*args, **kwargs)
+
     def __repr__(self):
         return "Tdb('%s')" % self.name()
 
@@ -178,36 +296,32 @@ class tdb(object):
 
 
 
-tdb.error = new_instancemethod(_tdb.tdb_error,None,tdb)
-tdb.close = new_instancemethod(_tdb.tdb_close,None,tdb)
-tdb.append = new_instancemethod(_tdb.tdb_append,None,tdb)
-tdb.errorstr = new_instancemethod(_tdb.tdb_errorstr,None,tdb)
-tdb.get = new_instancemethod(_tdb.tdb_get,None,tdb)
-tdb.delete = new_instancemethod(_tdb.tdb_delete,None,tdb)
-tdb.store = new_instancemethod(_tdb.tdb_store,None,tdb)
-tdb.exists = new_instancemethod(_tdb.tdb_exists,None,tdb)
-tdb.firstkey = new_instancemethod(_tdb.tdb_firstkey,None,tdb)
-tdb.nextkey = new_instancemethod(_tdb.tdb_nextkey,None,tdb)
-tdb.lock_all = new_instancemethod(_tdb.tdb_lock_all,None,tdb)
-tdb.unlock_all = new_instancemethod(_tdb.tdb_unlock_all,None,tdb)
-tdb.read_lock_all = new_instancemethod(_tdb.tdb_read_lock_all,None,tdb)
-tdb.read_unlock_all = new_instancemethod(_tdb.tdb_read_unlock_all,None,tdb)
-tdb.reopen = new_instancemethod(_tdb.tdb_reopen,None,tdb)
-tdb.transaction_start = new_instancemethod(_tdb.tdb_transaction_start,None,tdb)
-tdb.transaction_commit = new_instancemethod(_tdb.tdb_transaction_commit,None,tdb)
-tdb.transaction_cancel = new_instancemethod(_tdb.tdb_transaction_cancel,None,tdb)
-tdb.transaction_recover = new_instancemethod(_tdb.tdb_transaction_recover,None,tdb)
-tdb.hash_size = new_instancemethod(_tdb.tdb_hash_size,None,tdb)
-tdb.map_size = new_instancemethod(_tdb.tdb_map_size,None,tdb)
-tdb.get_flags = new_instancemethod(_tdb.tdb_get_flags,None,tdb)
-tdb.set_max_dead = new_instancemethod(_tdb.tdb_set_max_dead,None,tdb)
-tdb.name = new_instancemethod(_tdb.tdb_name,None,tdb)
-tdb_swigregister = _tdb.tdb_swigregister
-tdb_swigregister(tdb)
-
-def Tdb(*args, **kwargs):
-    val = _tdb.new_Tdb(*args, **kwargs)
-    return val
+Tdb.error = new_instancemethod(_tdb.Tdb_error,None,Tdb)
+Tdb.close = new_instancemethod(_tdb.Tdb_close,None,Tdb)
+Tdb.append = new_instancemethod(_tdb.Tdb_append,None,Tdb)
+Tdb.errorstr = new_instancemethod(_tdb.Tdb_errorstr,None,Tdb)
+Tdb.get = new_instancemethod(_tdb.Tdb_get,None,Tdb)
+Tdb.delete = new_instancemethod(_tdb.Tdb_delete,None,Tdb)
+Tdb.store = new_instancemethod(_tdb.Tdb_store,None,Tdb)
+Tdb.exists = new_instancemethod(_tdb.Tdb_exists,None,Tdb)
+Tdb.firstkey = new_instancemethod(_tdb.Tdb_firstkey,None,Tdb)
+Tdb.nextkey = new_instancemethod(_tdb.Tdb_nextkey,None,Tdb)
+Tdb.lock_all = new_instancemethod(_tdb.Tdb_lock_all,None,Tdb)
+Tdb.unlock_all = new_instancemethod(_tdb.Tdb_unlock_all,None,Tdb)
+Tdb.read_lock_all = new_instancemethod(_tdb.Tdb_read_lock_all,None,Tdb)
+Tdb.read_unlock_all = new_instancemethod(_tdb.Tdb_read_unlock_all,None,Tdb)
+Tdb.reopen = new_instancemethod(_tdb.Tdb_reopen,None,Tdb)
+Tdb.transaction_start = new_instancemethod(_tdb.Tdb_transaction_start,None,Tdb)
+Tdb.transaction_commit = new_instancemethod(_tdb.Tdb_transaction_commit,None,Tdb)
+Tdb.transaction_cancel = new_instancemethod(_tdb.Tdb_transaction_cancel,None,Tdb)
+Tdb.transaction_recover = new_instancemethod(_tdb.Tdb_transaction_recover,None,Tdb)
+Tdb.hash_size = new_instancemethod(_tdb.Tdb_hash_size,None,Tdb)
+Tdb.map_size = new_instancemethod(_tdb.Tdb_map_size,None,Tdb)
+Tdb.get_flags = new_instancemethod(_tdb.Tdb_get_flags,None,Tdb)
+Tdb.set_max_dead = new_instancemethod(_tdb.Tdb_set_max_dead,None,Tdb)
+Tdb.name = new_instancemethod(_tdb.Tdb_name,None,Tdb)
+Tdb_swigregister = _tdb.Tdb_swigregister
+Tdb_swigregister(Tdb)
 
 
 
index f36d5699376d5d8ae62ff7828e60bf8340eade7e..27da552d33a3569913b95ea1ca8dc55474657377 100644 (file)
@@ -2892,7 +2892,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   enum TDB_ERROR result;
@@ -2904,7 +2904,7 @@ SWIGINTERN PyObject *_wrap_tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *a
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_error" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_error" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (enum TDB_ERROR)tdb_error(arg1);
@@ -2915,7 +2915,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   void *argp1 = 0 ;
@@ -2926,7 +2926,7 @@ SWIGINTERN PyObject *_wrap_delete_tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, SWIG_POINTER_DISOWN |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_tdb" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Tdb" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   delete_tdb(arg1);
@@ -2938,7 +2938,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -2950,7 +2950,7 @@ SWIGINTERN PyObject *_wrap_tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *a
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_close" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_close" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_close(arg1);
@@ -2961,7 +2961,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -2976,10 +2976,10 @@ SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *
     (char *) "self",(char *) "key",(char *) "new_dbuf", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_append" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3010,7 +3010,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   char *result = 0 ;
@@ -3022,7 +3022,7 @@ SWIGINTERN PyObject *_wrap_tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_errorstr" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (char *)tdb_errorstr(arg1);
@@ -3033,7 +3033,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -3046,10 +3046,10 @@ SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
     (char *) "self",(char *) "key", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_get",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_get",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3075,7 +3075,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -3088,10 +3088,10 @@ SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
     (char *) "self",(char *) "key", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_delete" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3112,7 +3112,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -3132,10 +3132,10 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
   };
   
   arg4 = TDB_REPLACE;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_store" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_store" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3161,7 +3161,7 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
   if (obj3) {
     ecode4 = SWIG_AsVal_int(obj3, &val4);
     if (!SWIG_IsOK(ecode4)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "tdb_store" "', argument " "4"" of type '" "int""'");
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Tdb_store" "', argument " "4"" of type '" "int""'");
     } 
     arg4 = (int)(val4);
   }
@@ -3173,7 +3173,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -3186,10 +3186,10 @@ SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *
     (char *) "self",(char *) "key", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_exists" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3210,7 +3210,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA result;
@@ -3222,7 +3222,7 @@ SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_firstkey" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = tdb_firstkey(arg1);
@@ -3238,7 +3238,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   TDB_DATA arg2 ;
@@ -3251,10 +3251,10 @@ SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject
     (char *) "self",(char *) "key", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_nextkey" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   if (obj1 == Py_None) {
@@ -3280,7 +3280,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3292,7 +3292,7 @@ SWIGINTERN PyObject *_wrap_tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_lock_all" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_lockall(arg1);
@@ -3303,7 +3303,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3315,7 +3315,7 @@ SWIGINTERN PyObject *_wrap_tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObje
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_unlockall(arg1);
@@ -3326,7 +3326,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3338,7 +3338,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyO
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_lockall_read(arg1);
@@ -3349,7 +3349,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3361,7 +3361,7 @@ SWIGINTERN PyObject *_wrap_tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), P
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_unlockall_read(arg1);
@@ -3372,7 +3372,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3384,7 +3384,7 @@ SWIGINTERN PyObject *_wrap_tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_reopen" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_reopen(arg1);
@@ -3395,7 +3395,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3407,7 +3407,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self),
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_transaction_start(arg1);
@@ -3418,7 +3418,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3430,7 +3430,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self)
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_transaction_commit(arg1);
@@ -3441,7 +3441,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3453,7 +3453,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self)
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_transaction_cancel(arg1);
@@ -3464,7 +3464,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3476,7 +3476,7 @@ SWIGINTERN PyObject *_wrap_tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_transaction_recover(arg1);
@@ -3487,7 +3487,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3499,7 +3499,7 @@ SWIGINTERN PyObject *_wrap_tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObjec
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_hash_size" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_hash_size(arg1);
@@ -3510,7 +3510,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   size_t result;
@@ -3522,7 +3522,7 @@ SWIGINTERN PyObject *_wrap_tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_map_size" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = tdb_map_size(arg1);
@@ -3533,7 +3533,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int result;
@@ -3545,7 +3545,7 @@ SWIGINTERN PyObject *_wrap_tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObjec
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get_flags" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (int)tdb_get_flags(arg1);
@@ -3556,7 +3556,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   int arg2 ;
@@ -3570,15 +3570,15 @@ SWIGINTERN PyObject *_wrap_tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyOb
     (char *) "self",(char *) "max_dead", NULL 
   };
   
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail;
   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   ecode2 = SWIG_AsVal_int(obj1, &val2);
   if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "tdb_set_max_dead" "', argument " "2"" of type '" "int""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Tdb_set_max_dead" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = (int)(val2);
   tdb_set_max_dead(arg1,arg2);
@@ -3589,7 +3589,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_Tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   tdb *arg1 = (tdb *) 0 ;
   char *result = 0 ;
@@ -3601,7 +3601,7 @@ SWIGINTERN PyObject *_wrap_tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
   swig_obj[0] = args;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_name" "', argument " "1"" of type '" "tdb *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_name" "', argument " "1"" of type '" "tdb *""'"); 
   }
   arg1 = (tdb *)(argp1);
   result = (char *)tdb_name(arg1);
@@ -3612,41 +3612,85 @@ fail:
 }
 
 
-SWIGINTERN PyObject *tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *Tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *obj;
   if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
   SWIG_TypeNewClientData(SWIGTYPE_p_tdb_context, SWIG_NewClientData(obj));
   return SWIG_Py_Void();
 }
 
+SWIGINTERN PyObject *Tdb_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  return SWIG_Python_InitShadowInstance(args);
+}
+
 static PyMethodDef SwigMethods[] = {
-        { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_error", (PyCFunction)_wrap_tdb_error, METH_O, NULL},
-        { (char *)"delete_tdb", (PyCFunction)_wrap_delete_tdb, METH_O, NULL},
-        { (char *)"tdb_close", (PyCFunction)_wrap_tdb_close, METH_O, NULL},
-        { (char *)"tdb_append", (PyCFunction) _wrap_tdb_append, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_errorstr", (PyCFunction)_wrap_tdb_errorstr, METH_O, NULL},
-        { (char *)"tdb_get", (PyCFunction) _wrap_tdb_get, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_delete", (PyCFunction) _wrap_tdb_delete, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_store", (PyCFunction) _wrap_tdb_store, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_exists", (PyCFunction) _wrap_tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_firstkey", (PyCFunction)_wrap_tdb_firstkey, METH_O, NULL},
-        { (char *)"tdb_nextkey", (PyCFunction) _wrap_tdb_nextkey, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_lock_all", (PyCFunction)_wrap_tdb_lock_all, METH_O, NULL},
-        { (char *)"tdb_unlock_all", (PyCFunction)_wrap_tdb_unlock_all, METH_O, NULL},
-        { (char *)"tdb_read_lock_all", (PyCFunction)_wrap_tdb_read_lock_all, METH_O, NULL},
-        { (char *)"tdb_read_unlock_all", (PyCFunction)_wrap_tdb_read_unlock_all, METH_O, NULL},
-        { (char *)"tdb_reopen", (PyCFunction)_wrap_tdb_reopen, METH_O, NULL},
-        { (char *)"tdb_transaction_start", (PyCFunction)_wrap_tdb_transaction_start, METH_O, NULL},
-        { (char *)"tdb_transaction_commit", (PyCFunction)_wrap_tdb_transaction_commit, METH_O, NULL},
-        { (char *)"tdb_transaction_cancel", (PyCFunction)_wrap_tdb_transaction_cancel, METH_O, NULL},
-        { (char *)"tdb_transaction_recover", (PyCFunction)_wrap_tdb_transaction_recover, METH_O, NULL},
-        { (char *)"tdb_hash_size", (PyCFunction)_wrap_tdb_hash_size, METH_O, NULL},
-        { (char *)"tdb_map_size", (PyCFunction)_wrap_tdb_map_size, METH_O, NULL},
-        { (char *)"tdb_get_flags", (PyCFunction)_wrap_tdb_get_flags, METH_O, NULL},
-        { (char *)"tdb_set_max_dead", (PyCFunction) _wrap_tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"tdb_name", (PyCFunction)_wrap_tdb_name, METH_O, NULL},
-        { (char *)"tdb_swigregister", tdb_swigregister, METH_VARARGS, NULL},
+        { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n"
+               "Open a TDB file.\n"
+               ""},
+        { (char *)"Tdb_error", (PyCFunction)_wrap_Tdb_error, METH_O, NULL},
+        { (char *)"delete_Tdb", (PyCFunction)_wrap_delete_Tdb, METH_O, NULL},
+        { (char *)"Tdb_close", (PyCFunction)_wrap_Tdb_close, METH_O, (char *)"\n"
+               "S.close() -> None\n"
+               "Close the TDB file.\n"
+               ""},
+        { (char *)"Tdb_append", (PyCFunction) _wrap_Tdb_append, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Tdb_errorstr", (PyCFunction)_wrap_Tdb_errorstr, METH_O, (char *)"\n"
+               "S.errorstr() -> errorstring\n"
+               "Obtain last error message.\n"
+               ""},
+        { (char *)"Tdb_get", (PyCFunction) _wrap_Tdb_get, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.fetch(key) -> value\n"
+               "Fetch a value.\n"
+               ""},
+        { (char *)"Tdb_delete", (PyCFunction) _wrap_Tdb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.delete(key) -> None\n"
+               "Delete an entry.\n"
+               ""},
+        { (char *)"Tdb_store", (PyCFunction) _wrap_Tdb_store, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.store(key, value, flag=TDB_REPLACE) -> None\n"
+               "Store an entry.\n"
+               ""},
+        { (char *)"Tdb_exists", (PyCFunction) _wrap_Tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Tdb_firstkey", (PyCFunction)_wrap_Tdb_firstkey, METH_O, (char *)"\n"
+               "S.firstkey() -> data\n"
+               "Return the first key in this database.\n"
+               ""},
+        { (char *)"Tdb_nextkey", (PyCFunction) _wrap_Tdb_nextkey, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
+               "S.nextkey(prev) -> data\n"
+               "Return the next key in this database.\n"
+               ""},
+        { (char *)"Tdb_lock_all", (PyCFunction)_wrap_Tdb_lock_all, METH_O, (char *)"S.lockall() -> bool"},
+        { (char *)"Tdb_unlock_all", (PyCFunction)_wrap_Tdb_unlock_all, METH_O, (char *)"S.unlockall() -> bool"},
+        { (char *)"Tdb_read_lock_all", (PyCFunction)_wrap_Tdb_read_lock_all, METH_O, NULL},
+        { (char *)"Tdb_read_unlock_all", (PyCFunction)_wrap_Tdb_read_unlock_all, METH_O, NULL},
+        { (char *)"Tdb_reopen", (PyCFunction)_wrap_Tdb_reopen, METH_O, (char *)"\n"
+               "S.reopen() -> bool\n"
+               "Reopen this file.\n"
+               ""},
+        { (char *)"Tdb_transaction_start", (PyCFunction)_wrap_Tdb_transaction_start, METH_O, (char *)"\n"
+               "S.transaction_start() -> None\n"
+               "Start a new transaction.\n"
+               ""},
+        { (char *)"Tdb_transaction_commit", (PyCFunction)_wrap_Tdb_transaction_commit, METH_O, (char *)"\n"
+               "S.transaction_commit() -> None\n"
+               "Commit the currently active transaction.\n"
+               ""},
+        { (char *)"Tdb_transaction_cancel", (PyCFunction)_wrap_Tdb_transaction_cancel, METH_O, (char *)"\n"
+               "S.transaction_cancel() -> None\n"
+               "Cancel the currently active transaction.\n"
+               ""},
+        { (char *)"Tdb_transaction_recover", (PyCFunction)_wrap_Tdb_transaction_recover, METH_O, NULL},
+        { (char *)"Tdb_hash_size", (PyCFunction)_wrap_Tdb_hash_size, METH_O, (char *)"S.hash_size() -> int"},
+        { (char *)"Tdb_map_size", (PyCFunction)_wrap_Tdb_map_size, METH_O, (char *)"S.map_size() -> int"},
+        { (char *)"Tdb_get_flags", (PyCFunction)_wrap_Tdb_get_flags, METH_O, (char *)"S.get_flags() -> int"},
+        { (char *)"Tdb_set_max_dead", (PyCFunction) _wrap_Tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, (char *)"S.set_max_dead(int) -> None"},
+        { (char *)"Tdb_name", (PyCFunction)_wrap_Tdb_name, METH_O, (char *)"\n"
+               "S.name() -> path\n"
+               "Return filename of this TDB file.\n"
+               ""},
+        { (char *)"Tdb_swigregister", Tdb_swigregister, METH_VARARGS, NULL},
+        { (char *)"Tdb_swiginit", Tdb_swiginit, METH_VARARGS, NULL},
         { NULL, NULL, 0, NULL }
 };
 
index 5c1abf5039cdae741547abccf190558905f7f90a..00dcbfc8bdbeba71fa312245aa21f85e31e01a79 100644 (file)
@@ -21,7 +21,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "system/time.h"
-#include "dynconfig.h"
+#include "dynconfig/dynconfig.h"
 
 /**
  * @file
index b24f3eb4af9311f43fd5bce1605d336aa95c44c1..02711eedb32bfec62dd362d17bb7e096e6051491 100644 (file)
@@ -61,15 +61,14 @@ $(eval $(call proto_header_template,$(libclisrcdir)/nbt/nbt_proto.h,$(LIBCLI_NBT
 PUBLIC_DEPENDENCIES = LIBNDR  \
        NDR_SECURITY    
 
-LIBCLI_NDR_NETLOGON_OBJ_FILES = $(addprefix libcli/, \
-       ndr_netlogon.o)
+LIBCLI_NDR_NETLOGON_OBJ_FILES = $(addprefix $(libclisrcdir)/, ndr_netlogon.o)
 
 $(eval $(call proto_header_template,$(libclisrcdir)/ndr_netlogon_proto.h,$(LIBCLI_NDR_NETLOGON_OBJ_FILES:.o=.c)))
 
 [SUBSYSTEM::LIBCLI_NETLOGON]
 PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL LIBCLI_NDR_NETLOGON
 
-LIBCLI_NETLOGON_OBJ_FILES = $(addprefix libcli/, \
+LIBCLI_NETLOGON_OBJ_FILES = $(addprefix $(libclisrcdir)/, \
        netlogon.o)
 
 $(eval $(call proto_header_template,$(libclisrcdir)/netlogon_proto.h,$(LIBCLI_NETLOGON_OBJ_FILES:.o=.c)))
index 0d9073ccbb31adb72bf3690c356c515e81d1ecbb..97ae2e9d724974b8c9eee3050a9c64954adec135 100644 (file)
@@ -626,3 +626,24 @@ _PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name,
        ndr_print_string(ndr, name, s);
        talloc_free(s);
 }
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *r)
+{
+       {
+               uint32_t _flags_save_STRUCT = ndr->flags;
+               ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+               if (ndr_flags & NDR_SCALARS) {
+                       NDR_CHECK(ndr_push_align(ndr, 4));
+                       NDR_CHECK(ndr_push_nbt_name(ndr, NDR_SCALARS, &r->name));
+                       NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->rr_type));
+                       NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->rr_class));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl));
+                       NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && ((r->rdata).data.length == 2))?0:r->rr_type)));
+                       NDR_CHECK(ndr_push_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
+               }
+               if (ndr_flags & NDR_BUFFERS) {
+               }
+               ndr->flags = _flags_save_STRUCT;
+       }
+       return NDR_ERR_SUCCESS;
+}
index 3370021d48e4538f70d9462a2f162f3b5c6baac2..17c85138ac1377610936bedcce5ea7b6634d41d2 100644 (file)
@@ -684,7 +684,8 @@ union smb_fileinfo {
                        uint32_t ea_size;
                        uint32_t access_mask;
                        uint64_t position;
-                       uint64_t mode;
+                       uint32_t mode;
+                       uint32_t alignment_requirement;
                        struct smb_wire_string fname;
                } out;
        } all_info2;
@@ -1646,7 +1647,7 @@ union smb_read {
                struct {
                        union smb_handle file;
                        uint64_t offset;
-                       uint16_t mincnt;
+                       uint32_t mincnt; /* enforced on SMB2, 16 bit on SMB */
                        uint32_t maxcnt;
                        uint16_t remaining;
                        bool read_for_execute;
@@ -1918,6 +1919,7 @@ union smb_lock {
 #define SMB2_LOCK_FLAG_EXCLUSIVE       0x00000002
 #define SMB2_LOCK_FLAG_UNLOCK          0x00000004
 #define SMB2_LOCK_FLAG_FAIL_IMMEDIATELY        0x00000010
+#define SMB2_LOCK_FLAG_ALL_MASK                0x00000017
                                uint32_t flags;
                                uint32_t reserved;
                        } *locks;
@@ -1948,23 +1950,43 @@ union smb_lock {
 enum smb_close_level {
        RAW_CLOSE_CLOSE,
        RAW_CLOSE_SPLCLOSE,
-       RAW_CLOSE_SMB2
+       RAW_CLOSE_SMB2,
+       RAW_CLOSE_GENERIC,
 };
 
-#define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
-
 /*
   union for close() backend call
 */
 union smb_close {
-       /* SMBclose (and generic) interface */
+       /* generic interface */
+       struct {
+               enum smb_close_level level;
+               struct {
+                       union smb_handle file;
+                       time_t write_time;
+#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
+                       uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
+               } in;
+               struct {
+                       uint16_t flags;
+                       NTTIME   create_time;
+                       NTTIME   access_time;
+                       NTTIME   write_time;
+                       NTTIME   change_time;
+                       uint64_t alloc_size;
+                       uint64_t size;
+                       uint32_t file_attr;
+               } out;
+       } generic;
+
+       /* SMBclose interface */
        struct {
                enum smb_close_level level;
                struct {
                        union smb_handle file;
                        time_t write_time;
                } in;
-       } close, generic;
+       } close;
 
        /* SMBsplclose interface - empty! */
        struct {
@@ -1982,7 +2004,6 @@ union smb_close {
 
                        /* static body buffer 24 (0x18) bytes */
                        /* uint16_t buffer_code;  0x18 */
-#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
                        uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
                        uint32_t _pad;
                } in;
index 8ea8e621c9fedcab98f0d3e9f621987e6a15fbb1..07b517ade3f24bec4fdfc8622bc13a9b0e6dbac0 100644 (file)
@@ -54,13 +54,13 @@ static uint_t ea_name_list_size(uint_t num_names, struct ea_name *eas)
   This assumes the names are strict ascii, which should be a
   reasonable assumption
 */
-size_t ea_list_size_chained(uint_t num_eas, struct ea_struct *eas)
+size_t ea_list_size_chained(uint_t num_eas, struct ea_struct *eas, unsigned alignment)
 {
        uint_t total = 0;
        int i;
        for (i=0;i<num_eas;i++) {
                uint_t len = 8 + strlen(eas[i].name.s)+1 + eas[i].value.length;
-               len = (len + 3) & ~3;
+               len = (len + (alignment-1)) & ~(alignment-1);
                total += len;
        }
        return total;
@@ -96,14 +96,15 @@ void ea_put_list(uint8_t *data, uint_t num_eas, struct ea_struct *eas)
   put a chained ea_list into a pre-allocated buffer - buffer must be
   at least of size ea_list_size()
 */
-void ea_put_list_chained(uint8_t *data, uint_t num_eas, struct ea_struct *eas)
+void ea_put_list_chained(uint8_t *data, uint_t num_eas, struct ea_struct *eas,
+                        unsigned alignment)
 {
        int i;
 
        for (i=0;i<num_eas;i++) {
                uint_t nlen = strlen(eas[i].name.s);
                uint32_t len = 8+nlen+1+eas[i].value.length;
-               uint_t pad = ((len + 3) & ~3) - len;
+               uint_t pad = ((len + (alignment-1)) & ~(alignment-1)) - len;
                if (i == num_eas-1) {
                        SIVAL(data, 0, 0);
                } else {
index 3c5c1b742bd09dfe6f465e15017021d4d311e334..d39c61551be7b0b2f4158c04b01160dddb45c242 100644 (file)
@@ -314,14 +314,14 @@ static struct smbcli_request *smb_raw_nttrans_create_send(struct smbcli_tree *tr
 
        if (parms->ntcreatex.in.ea_list) {
                uint32_t ea_size = ea_list_size_chained(parms->ntcreatex.in.ea_list->num_eas,
-                                                       parms->ntcreatex.in.ea_list->eas);
+                                                       parms->ntcreatex.in.ea_list->eas, 4);
                ea_blob = data_blob_talloc(mem_ctx, NULL, ea_size);
                if (ea_blob.data == NULL) {
                        return NULL;
                }
                ea_put_list_chained(ea_blob.data, 
                                    parms->ntcreatex.in.ea_list->num_eas,
-                                   parms->ntcreatex.in.ea_list->eas);
+                                   parms->ntcreatex.in.ea_list->eas, 4);
        }
 
        nt.in.params = data_blob_talloc(mem_ctx, NULL, 53);
index 71900be49cde5ccb5a29f6695f876d68706260a0..0ea5a93606d23ed6408a0ae2209fbfe3a219e922 100644 (file)
@@ -243,7 +243,8 @@ NTSTATUS smb_raw_fileinfo_passthru_parse(const DATA_BLOB *blob, TALLOC_CTX *mem_
                parms->all_info2.out.ea_size        = IVAL(blob->data, 0x48);
                parms->all_info2.out.access_mask    = IVAL(blob->data, 0x4C);
                parms->all_info2.out.position       = BVAL(blob->data, 0x50);
-               parms->all_info2.out.mode           = BVAL(blob->data, 0x58);
+               parms->all_info2.out.mode           = IVAL(blob->data, 0x58);
+               parms->all_info2.out.alignment_requirement = IVAL(blob->data, 0x5C);
                smbcli_blob_pull_string(NULL, mem_ctx, blob,
                                        &parms->all_info2.out.fname, 0x60, 0x64, STR_UNICODE);
                return NT_STATUS_OK;
index e054ed6522406bdaed6a80ae346e314a98bfc048..5a92b99757043309112b976d0b730e42b53602cb 100644 (file)
 #define NTCREATEX_SHARE_ACCESS_READ   1
 #define NTCREATEX_SHARE_ACCESS_WRITE  2
 #define NTCREATEX_SHARE_ACCESS_DELETE 4
+#define NTCREATEX_SHARE_ACCESS_MASK   7
 
 /* ntcreatex open_disposition field */
 #define NTCREATEX_DISP_SUPERSEDE 0     /* supersede existing file (if it exists) */
 #define NTCREATEX_OPTIONS_RANDOM_ACCESS            0x0800
 #define NTCREATEX_OPTIONS_DELETE_ON_CLOSE          0x1000
 #define NTCREATEX_OPTIONS_OPEN_BY_FILE_ID          0x2000
-#define NTCREATEX_OPTIONS_UNKNOWN_400000           0x400000
-
+#define NTCREATEX_OPTIONS_BACKUP_INTENT            0x4000
+#define NTCREATEX_OPTIONS_REPARSE_POINT          0x200000
+#define NTCREATEX_OPTIONS_UNKNOWN_400000         0x400000
 /* create options these bits are for private use by backends, they are
    not valid on the wire */
 #define NTCREATEX_OPTIONS_PRIVATE_MASK         0xFF000000
 #define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x01000000
 #define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x02000000
 
+#define NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK   0x00DFA188 
+
+
 
 /* ntcreatex impersonation field */
 #define NTCREATEX_IMPERSONATION_ANONYMOUS      0
 #define FILE_ATTRIBUTE_OFFLINE         0x1000
 #define FILE_ATTRIBUTE_NONINDEXED      0x2000
 #define FILE_ATTRIBUTE_ENCRYPTED       0x4000
+#define FILE_ATTRIBUTE_ALL_MASK        0x7FFF
 
 /* Flags - combined with attributes. */
 #define FILE_FLAG_WRITE_THROUGH    0x80000000L
index 647c9aea0941e68226442ad29c6e97077b7537fb..1d964cc3d5aa0b044f37abc93707ef0a1c472753 100644 (file)
@@ -16,7 +16,7 @@
    along with this