Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
authorAndrew Bartlett <abartlet@samba.org>
Wed, 20 Feb 2008 22:55:13 +0000 (09:55 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Feb 2008 22:55:13 +0000 (09:55 +1100)
313 files changed:
.gitignore
README
TODO
prog_guide.txt
source/Makefile [new file with mode: 0644]
source/auth/auth_anonymous.c
source/auth/auth_developer.c
source/auth/auth_sam.c
source/auth/auth_unix.c
source/auth/auth_winbind.c
source/auth/config.mk
source/auth/gensec/config.mk
source/auth/gensec/cyrus_sasl.c
source/auth/gensec/gensec_gssapi.c
source/auth/gensec/gensec_krb5.c
source/auth/gensec/schannel.c
source/auth/gensec/spnego.c
source/auth/ntlmssp/config.mk
source/auth/ntlmssp/ntlmssp.c
source/autogen.sh
source/build/m4/check_ld.m4
source/build/m4/check_make.m4
source/build/m4/check_path.m4
source/build/m4/public.m4
source/build/smb_build/cflags.pm
source/build/smb_build/config_mk.pm
source/build/smb_build/dot.pl
source/build/smb_build/header.pm
source/build/smb_build/input.pm
source/build/smb_build/main.pl
source/build/smb_build/makefile.pm
source/build/smb_build/output.pm
source/build/smb_build/summary.pm
source/cluster/config.mk
source/configure.ac
source/dsdb/config.mk
source/dsdb/samdb/ldb_modules/anr.c
source/dsdb/samdb/ldb_modules/config.mk
source/dsdb/samdb/ldb_modules/dsdb_cache.c
source/dsdb/samdb/ldb_modules/extended_dn.c
source/dsdb/samdb/ldb_modules/instancetype.c
source/dsdb/samdb/ldb_modules/kludge_acl.c
source/dsdb/samdb/ldb_modules/linked_attributes.c
source/dsdb/samdb/ldb_modules/local_password.c
source/dsdb/samdb/ldb_modules/naming_fsmo.c
source/dsdb/samdb/ldb_modules/normalise.c
source/dsdb/samdb/ldb_modules/objectclass.c
source/dsdb/samdb/ldb_modules/objectguid.c
source/dsdb/samdb/ldb_modules/partition.c
source/dsdb/samdb/ldb_modules/password_hash.c
source/dsdb/samdb/ldb_modules/pdc_fsmo.c
source/dsdb/samdb/ldb_modules/proxy.c
source/dsdb/samdb/ldb_modules/ranged_results.c
source/dsdb/samdb/ldb_modules/repl_meta_data.c
source/dsdb/samdb/ldb_modules/rootdse.c
source/dsdb/samdb/ldb_modules/samba3sam.c
source/dsdb/samdb/ldb_modules/samldb.c
source/dsdb/samdb/ldb_modules/schema.c
source/dsdb/samdb/ldb_modules/schema_fsmo.c
source/dsdb/samdb/ldb_modules/show_deleted.c
source/dsdb/samdb/ldb_modules/simple_ldap_map.c
source/dsdb/samdb/ldb_modules/subtree_delete.c
source/dsdb/samdb/ldb_modules/subtree_rename.c
source/dsdb/samdb/ldb_modules/update_keytab.c
source/dsdb/schema/schema.h
source/dsdb/schema/schema_init.c
source/dsdb/schema/schema_syntax.c
source/dynconfig.mk
source/headermap.txt
source/heimdal_build/config.mk
source/kdc/config.mk
source/lib/basic.mk
source/lib/events/events_select.c
source/lib/events/events_standard.c
source/lib/gencache/gencache.h [new file with mode: 0644]
source/lib/ldb/Makefile.in
source/lib/ldb/common/ldb.c
source/lib/ldb/common/ldb_modules.c
source/lib/ldb/config.mk
source/lib/ldb/configure.ac
source/lib/ldb/include/ldb_private.h
source/lib/ldb/ldb.mk [new file with mode: 0644]
source/lib/ldb/ldb_ildap/config.mk
source/lib/ldb/ldb_ildap/ldb_ildap.c
source/lib/ldb/ldb_ldap/ldb_ldap.c
source/lib/ldb/ldb_map/ldb_map.c
source/lib/ldb/ldb_map/ldb_map.h
source/lib/ldb/ldb_map/ldb_map_private.h
source/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
source/lib/ldb/ldb_tdb/ldb_tdb.c
source/lib/ldb/modules/asq.c
source/lib/ldb/modules/operational.c
source/lib/ldb/modules/paged_results.c
source/lib/ldb/modules/paged_searches.c
source/lib/ldb/modules/rdn_name.c
source/lib/ldb/modules/skel.c
source/lib/ldb/modules/sort.c
source/lib/ldb/nssldb/ldb-nss.c
source/lib/ldb/rules.mk [new file with mode: 0644]
source/lib/ldb/setup.py [deleted file]
source/lib/ldb/tests/python/api.py
source/lib/ldb/tests/python/ldap.py
source/lib/ldb/tests/sample_module.c
source/lib/ldb/tools/ad2oLschema.c
source/lib/ldb/tools/cmdline.c
source/lib/ldb/tools/ldbadd.c
source/lib/ldb/tools/ldbdel.c
source/lib/ldb/tools/ldbedit.c
source/lib/ldb/tools/ldbmodify.c
source/lib/ldb/tools/ldbrename.c
source/lib/ldb/tools/ldbsearch.c
source/lib/ldb/tools/ldbtest.c
source/lib/ldb/tools/oLschema2ldif.c
source/lib/registry/ldb.c
source/lib/registry/tools/regshell.c
source/lib/replace/dlfcn.c
source/lib/replace/getifaddrs.m4
source/lib/replace/getpass.m4
source/lib/replace/libreplace.m4
source/lib/replace/libreplace_ld.m4
source/lib/replace/system/config.m4
source/lib/replace/system/network.h
source/lib/samba3/config.mk
source/lib/samba3/group.c [deleted file]
source/lib/samba3/idmap.c [deleted file]
source/lib/samba3/policy.c [deleted file]
source/lib/samba3/registry.c [deleted file]
source/lib/samba3/samba3.c [deleted file]
source/lib/samba3/samba3.h
source/lib/samba3/secrets.c [deleted file]
source/lib/samba3/share_info.c [deleted file]
source/lib/samba3/smbpasswd.c
source/lib/samba3/tdbsam.c [deleted file]
source/lib/samba3/winsdb.c [deleted file]
source/lib/socket/config.mk
source/lib/socket/socket_ip.c
source/lib/socket/socket_unix.c
source/lib/socket_wrapper/config.m4
source/lib/socket_wrapper/socket_wrapper.c
source/lib/talloc/Makefile.in
source/lib/talloc/config.mk
source/lib/talloc/configure.ac
source/lib/talloc/rules.mk [new file with mode: 0644]
source/lib/talloc/talloc.c
source/lib/talloc/talloc.h
source/lib/talloc/talloc.mk [new file with mode: 0644]
source/lib/talloc/testsuite.c
source/lib/talloc/web/index.html
source/lib/tdb/Makefile.in
source/lib/tdb/config.mk
source/lib/tdb/configure.ac
source/lib/tdb/python/tests/simple.py
source/lib/tdb/rules.mk [new file with mode: 0644]
source/lib/tdb/setup.py [deleted file]
source/lib/tdb/tdb.mk [new file with mode: 0644]
source/lib/tls/config.m4
source/lib/util/attr.h
source/lib/util/fault.c
source/lib/util/time.c
source/lib/util/time.h
source/lib/util/util.h
source/lib/util/util_ldb.c
source/libcli/composite/composite.c
source/libcli/config.mk
source/libcli/raw/clisession.c
source/libcli/raw/clitransport.c
source/libcli/raw/clitree.c
source/libcli/raw/interfaces.h
source/libcli/raw/libcliraw.h
source/libcli/raw/rawfile.c
source/libcli/raw/rawioctl.c
source/libcli/raw/rawnegotiate.c
source/libcli/raw/rawreadwrite.c
source/libcli/raw/rawrequest.c
source/libcli/raw/rawsearch.c
source/libcli/raw/rawsetfileinfo.c
source/libcli/raw/request.h
source/libcli/raw/smb_signing.c
source/libcli/smb2/cancel.c
source/libcli/smb2/connect.c
source/libcli/smb2/create.c
source/libcli/smb2/getinfo.c
source/libcli/smb2/logoff.c
source/libcli/smb2/negprot.c
source/libcli/smb2/notify.c
source/libcli/smb2/request.c
source/libcli/smb2/session.c
source/libcli/smb2/setinfo.c
source/libcli/smb2/smb2.h
source/libcli/smb2/smb2_calls.h
source/libcli/smb2/tcon.c
source/libcli/smb2/transport.c
source/libnet/config.mk
source/librpc/config.mk
source/librpc/idl/dcerpc.idl
source/librpc/idl/drsblobs.idl
source/librpc/idl/drsuapi.idl
source/librpc/idl/epmapper.idl
source/librpc/idl/idl_types.h
source/librpc/idl/initshutdown.idl
source/librpc/idl/krb5pac.idl
source/librpc/idl/lsa.idl
source/librpc/idl/nbt.idl
source/librpc/idl/spoolss.idl
source/librpc/idl/winreg.idl
source/librpc/ndr/libndr.h
source/librpc/ndr/ndr_sec_helper.c
source/librpc/ndr/ndr_string.c
source/librpc/rpc/dcerpc_smb2.c
source/main.mk
source/nbt_server/config.mk
source/nbt_server/wins/wins_ldb.c
source/nsswitch/config.mk
source/ntvfs/cifs/vfs_cifs.c
source/ntvfs/config.mk
source/ntvfs/ipc/vfs_ipc.c
source/ntvfs/ntvfs.h
source/ntvfs/ntvfs_generic.c
source/ntvfs/posix/config.mk
source/ntvfs/posix/pvfs_setfileinfo.c
source/param/config.mk
source/param/loadparm.c
source/pidl/config.mk [new file with mode: 0644]
source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
source/pidl/tests/ndr_compat.pl
source/pidl/tests/wireshark-conf.pl
source/rpc_server/config.mk
source/rules.mk [new file with mode: 0644]
source/samba4-knownfail
source/samba4-quick
source/samba4-skip
source/script/cflags.pl
source/scripting/bin/minschema.py [new file with mode: 0755]
source/scripting/bin/subunitrun
source/scripting/ejs/config.mk
source/scripting/ejs/smbcalls_samba3.c [deleted file]
source/scripting/ejs/smbscript.c
source/scripting/libjs/provision.js
source/scripting/python/config.m4
source/scripting/python/config.mk
source/scripting/python/samba/provision.py
source/scripting/python/samba/samdb.py
source/scripting/python/samba/tests/__init__.py
source/scripting/python/samba/tests/dcerpc/registry.py
source/scripting/python/samba/tests/dcerpc/rpcecho.py
source/scripting/python/samba/tests/dcerpc/sam.py
source/scripting/python/samba/tests/provision.py
source/scripting/python/samba/tests/samdb.py [new file with mode: 0644]
source/scripting/python/samba/tests/upgrade.py
source/scripting/python/samba/upgrade.py
source/scripting/python/subunit/__init__.py
source/selftest/README
source/selftest/config.mk
source/selftest/output/plain.pm
source/selftest/samba4_tests.sh
source/selftest/selftest.pl
source/selftest/target/Kvm.pm [new file with mode: 0644]
source/selftest/target/Samba4.pm
source/setup/newuser.py [new file with mode: 0755]
source/setup/tests/blackbox_provision.sh [new file with mode: 0755]
source/smb_server/blob.c
source/smb_server/config.mk
source/smb_server/smb/config.mk
source/smb_server/smb/negprot.c
source/smb_server/smb/nttrans.c
source/smb_server/smb/receive.c
source/smb_server/smb/reply.c
source/smb_server/smb/request.c
source/smb_server/smb/search.c
source/smb_server/smb/trans2.c
source/smb_server/smb2/config.mk
source/smb_server/smb2/fileinfo.c
source/smb_server/smb2/fileio.c
source/smb_server/smb2/find.c
source/smb_server/smb2/negprot.c
source/smb_server/smb2/receive.c
source/smb_server/smb2/sesssetup.c
source/smb_server/smb2/tcon.c
source/smb_server/smb_server.h
source/smbd/server.c
source/torture/config.mk
source/torture/gentest.c
source/torture/libnet/libnet_BecomeDC.c
source/torture/local/torture.c
source/torture/locktest.c
source/torture/masktest.c
source/torture/rpc/eventlog.c
source/torture/rpc/initshutdown.c
source/torture/rpc/samba3rpc.c
source/torture/rpc/samsync.c
source/torture/rpc/spoolss.c
source/torture/rpc/winreg.c
source/torture/smb2/connect.c
source/torture/smb2/getinfo.c
source/torture/smb2/lock.c
source/torture/smb2/scan.c
source/torture/smb2/util.c
source/torture/smbtorture.c
source/torture/util.c [deleted file]
source/torture/util.h [new file with mode: 0644]
source/torture/util_provision.c [new file with mode: 0644]
source/torture/util_smb.c
source/utils/net/net.c
source/utils/tests/test_nmblookup.sh [moved from testprogs/blackbox/test_nmblookup.sh with 100% similarity]
testdata/samba3/verify [deleted file]
testprogs/blackbox/test_gentest.sh [new file with mode: 0755]
testprogs/blackbox/test_locktest.sh [new file with mode: 0755]
testprogs/blackbox/test_masktest.sh [new file with mode: 0755]
testprogs/ejs/minschema_classes.txt
testprogs/ejs/samba3sam.js [changed mode: 0755->0644]

index 9ed0334ea13a80cb4219e91843b306887fb46ea6..6076ddc9cd3280d0b1c563007934135580e4eab0 100644 (file)
@@ -1,5 +1,6 @@
+source/pidl/Makefile
+source/mkconfig.mk
 source/test-results
-source/lib/gencache/gencache.h
 source/lib/ldb/bin
 *.pc
 autom4te.cache
@@ -9,7 +10,6 @@ autom4te.cache
 *.hd
 *.ho
 *.pyc
-Makefile
 configure
 source/bin/*
 config.log
@@ -115,7 +115,6 @@ source/smb_server/smb2/smb2_proto.h
 source/smbd/process_model_proto.h
 source/smbd/service_proto.h
 source/torture/proto.h
-source/torture/util.h
 source/torture/auth/proto.h
 source/torture/basic/proto.h
 source/torture/ldap/proto.h
@@ -193,3 +192,7 @@ source/lib/util/apidocs
 source/lib/util/util_ldb.h
 source/libcli/ldap/ldap_ndr.h
 source/libcli/resolve/lp_proto.h
+source/apidocs
+*.swp
+source/mkconfig.mk
+source/data.mk
diff --git a/README b/README
index c1034b3fe86a020dca49ac6d636de844613830d0..5501998ef1b8804828a48a3d7b7d1c6ab66dbb4b 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,6 @@
+Readme for Samba 4
+==================
+
 Samba 4 is the ambitious next version of the Samba suite that is being
 developed in parallel to the stable 3.0 series. The main emphasis in
 this branch is support for the Active Directory logon protocols used
@@ -15,8 +18,8 @@ Technology Preview (TP), aimed at allowing you, our users, managers and
 developers to see how we have progressed, and to invite your feedback and
 support.
 
-WARNINGS
-========
+Warnings
+--------
 
 Samba4 is currently at alpha stage.  That is more a reference to
 Samba4's lack of the features we expect you will need than a statement
@@ -58,8 +61,8 @@ logged in user, much as Samba3 does.
 As such, we must strongly recommend against using Samba4 in a
 production environment at this stage.
 
-NEW FEATURES
-============
+New Features
+------------
 
 Samba4 supports the server-side of the Active Directory logon environment
 used by Windows 2000 and later, so we can do full domain join
@@ -93,20 +96,20 @@ working on modules to map between AD-like behaviours and this back-end.
 We are aiming for Samba 4 to be powerful front-end to large
 directories.
 
-CHANGES
-=======
+Changes
+-------
 
 Those familiar with Samba 3 can find a list of user-visible changes
 since that release series in the NEWS file.
 
- - An optional password is no longer supported as the second argument to
-   smbclient.
+- An optional password is no longer supported as the second argument to
+  smbclient.
 
- - The default location of smb.conf in non-FHS builds has changed from the
-   PREFIX/lib directory to the PREFIX/etc directory.
+- The default location of smb.conf in non-FHS builds has changed from the
+  PREFIX/lib directory to the PREFIX/etc directory.
 
-KNOWN ISSUES
-============
+Known issues
+------------
 
 - Standalone server and domain member roles are not currently
   supported.  While we have much of the infrastructure required, we
@@ -117,14 +120,15 @@ KNOWN ISSUES
 - SWAT can be painful with <TAB> and forms.  Just use the mouse, as
   the JavaScript layer doing this will change.
 
-RUNNING Samba4
-==============
+Running Samba4
+--------------
 
 A short guide to setting up Samba 4 can be found in the howto.txt file
 in root of the tarball.
 
-DEVELOPMENT and FEEDBACK
-========================
+Development and feedback
+------------------------
+
 Bugs can be filed at https://bugzilla.samba.org/. Please
 look at the STATUS file before filing a bug to see if a particular
 is supposed to work yet.
@@ -134,4 +138,3 @@ the #samba-technical IRC channel (on irc.freenode.net) and
 the samba-technical mailing list (see http://lists.samba.org/ for
 details).
 
-
diff --git a/TODO b/TODO
index 65dca884f19cbc9ab58b5dc965c6ceae8c7dce98..14df8a507a09f0ec4924d2482978aa7c37e4d481 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,15 +3,9 @@ source/lib/registry/TODO
 source/lib/tdr/TODO
 source/pidl/TODO
 
-upgrade process (from Samba3):
- - Rename upgrade to upgrade3 (to avoid confusion with upgrades 
-   from earlier Samba4 releases in the future)
- - Add support for reading WINS TDB files as well as WINS dat files.
-
 - seperate adminlog mechanism (as opposed to the current DEBUG log,
   which is not really aimed at administrators but more at developers)
   Perhaps similar to eventlog so we can also use eventlog to retrieve the data?
-- improve handling of test results in testsuite
 
 - testsuite for the 'net' tool
 
index 3814a11a4ef531d58acd1bdf25b8399a5fca82b1..bba58b31b3b9350ba0e0d9e56b32d67e31710a87 100644 (file)
@@ -58,11 +58,11 @@ Static and Global Data
 
 The basic rule is "avoid static and global data like the plague". What
 do I mean by static data? The way to tell if you have static data in a
-file is to use the "size" utility in Linux. For example if we run:
+file is to use the "size" utility in Linux. For example if we run::
 
   size libcli/raw/*.o
 
-in Samba4 then you get the following:
+in Samba4 then you get the following::
 
    text    data     bss     dec     hex filename
    2015       0       0    2015     7df libcli/raw/clikrb5.o
@@ -91,7 +91,7 @@ notice that the "data" and "bss" columns are all zero? That is
 good. If there are any non-zero values in data or bss then that
 indicates static data and is bad (as a rule of thumb).
 
-Lets compare that result to the equivalent in Samba3:
+Lets compare that result to the equivalent in Samba3::
 
    text    data     bss     dec     hex filename
    3978       0       0    3978     f8a libsmb/asn1.o
@@ -142,11 +142,11 @@ notice all of the non-zero data and bss elements? Every bit of that
 data is a bug waiting to happen.
 
 Static data is evil as it has the following consequences:
- - it makes code much less likely to be thread-safe
- - it makes code much less likely to be recursion-safe
- - it leads to subtle side effects when the same code is called from
-   multiple places
- - doesn't play well with shared libraries or plugins
+- it makes code much less likely to be thread-safe
+- it makes code much less likely to be recursion-safe
+- it leads to subtle side effects when the same code is called from
+  multiple places
+- doesn't play well with shared libraries or plugins
 
 Static data is particularly evil in library code (such as our internal
 smb and rpc libraries). If you can get rid of all static data in
@@ -237,23 +237,23 @@ In the Samba3 msrpc code we used explicit parse structures for all
 msrpc functions. The problem is that we didn't just put all of the
 real variables in these structures, we also put in all the artifacts
 as well. A good example is the security descriptor strucrure that
-looks like this in Samba3:
+looks like this in Samba3::
 
-typedef struct security_descriptor_info
-{
-       uint16 revision; 
-       uint16 type;    
+       typedef struct security_descriptor_info
+       {
+               uint16 revision; 
+               uint16 type;    
 
-       uint32 off_owner_sid;
-       uint32 off_grp_sid;
-       uint32 off_sacl;
-       uint32 off_dacl;
+               uint32 off_owner_sid;
+               uint32 off_grp_sid;
+               uint32 off_sacl;
+               uint32 off_dacl;
 
-       SEC_ACL *dacl;
-       SEC_ACL *sacl;
-       DOM_SID *owner_sid; 
-       DOM_SID *grp_sid;
-} SEC_DESC;
+               SEC_ACL *dacl;
+               SEC_ACL *sacl;
+               DOM_SID *owner_sid; 
+               DOM_SID *grp_sid;
+       } SEC_DESC;
 
 The problem with this structure is all the off_* variables. Those are
 not part of the interface, and do not appear in any real descriptions
@@ -301,11 +301,11 @@ just about everywhere.
 
 The first aspect of the async design to look at is the SMB client
 library. Lets take a look at the following three functions in
-libcli/raw/rawfile.c:
+libcli/raw/rawfile.c::
 
-struct cli_request *smb_raw_seek_send(struct cli_tree *tree, struct smb_seek *parms);
-NTSTATUS smb_raw_seek_recv(struct cli_request *req, struct smb_seek *parms);
-NTSTATUS smb_raw_seek(struct cli_tree *tree, struct smb_seek *parms);
+       struct cli_request *smb_raw_seek_send(struct cli_tree *tree, struct smb_seek *parms);
+       NTSTATUS smb_raw_seek_recv(struct cli_request *req, struct smb_seek *parms);
+       NTSTATUS smb_raw_seek(struct cli_tree *tree, struct smb_seek *parms);
 
 Go and read them now then come back.
 
@@ -327,7 +327,7 @@ one called smb_raw_XXXX(). That just calls the first two in order, and
 blocks waiting for the reply. 
 
 But what if you want to be called when the reply comes in? Yes, thats
-possible. You can do things like this:
+possible. You can do things like this::
 
     struct cli_request *req;
 
@@ -374,7 +374,7 @@ to just like in Samba3, but it also has the option of answering the
 request asynchronously. The only backend that currently does this is
 the CIFS backend, but I hope the other backends will soon do this to.
 
-To make this work you need to do things like this in the backend:
+To make this work you need to do things like this in the backend::
 
   req->control_flags |= REQ_CONTROL_ASYNC;
 
@@ -450,7 +450,7 @@ and read it. Yes, that means you!).
 Notice the union? That's how Samba4 allows a single NTVFS backend
 interface to handle the several different ways of doing a write
 operation in the SMB protocol. Now lets look at one section of that
-union:
+union::
 
        /* SMBwriteX interface */
        struct {
@@ -473,7 +473,7 @@ union:
 see the "in" and "out" sections? The "in" section is for parameters
 that the SMB client sends on the wire as part of the request. The smbd
 front end parse code parses the wire request and fills in all those
-parameters. It then calls the NTVFS interface which looks like this:
+parameters. It then calls the NTVFS interface which looks like this::
 
   NTSTATUS (*write)(struct request_context *req, union smb_write *io);
 
diff --git a/source/Makefile b/source/Makefile
new file mode 100644 (file)
index 0000000..1fddfef
--- /dev/null
@@ -0,0 +1,185 @@
+#!gmake
+# The Samba 4 Makefile.
+# This file is *NOT* autogenerated.
+
+include mkconfig.mk
+
+VPATH = $(builddir):$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
+
+BASEDIR = $(prefix)
+TORTUREDIR = $(libdir)/torture
+SWATDIR = $(datadir)/swat
+JSDIR = $(datadir)/js
+SETUPDIR = $(datadir)/setup
+NCALRPCDIR = $(localstatedir)/ncalrpc
+
+BNLD = $(LD)
+BNLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
+
+HOSTCC_FLAGS = -D_SAMBA_HOSTCC_ $(CFLAGS)
+HOSTLD_FLAGS = $(LDFLAGS) $(SYS_LDFLAGS)
+
+default: all
+
+include rules.mk
+include data.mk
+
+DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
+                 $(srcdir)/version.h
+
+binaries::
+libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
+modules:: $(PLUGINS)
+headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
+manpages:: $(MANPAGES)
+all:: showflags $(ALL_PREDEP) bin/asn1_compile bin/compile_et binaries modules pythonmods
+everything:: all libraries headers
+
+LD_LIBPATH_OVERRIDE = $(LIB_PATH_VAR)=$(builddir)/bin/shared
+
+# 'make testsuite' creates all binaries which are
+# needed by samba3's 'make test' and the build-farm
+# scripts use that it as fallback in case
+# 'make everything' fails
+testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
+
+showlayout:: 
+       @echo 'Samba will be installed into:'
+       @echo '  basedir:     $(BASEDIR)'
+       @echo '  bindir:      $(bindir)'
+       @echo '  sbindir:     $(sbindir)'
+       @echo '  libdir:      $(libdir)'
+       @echo '  modulesdir:  $(modulesdir)'
+       @echo '  includedir:  $(includedir)'
+       @echo '  vardir:      $(localstatedir)'
+       @echo '  privatedir:  $(privatedir)'
+       @echo '  piddir:      $(piddir)'
+       @echo '  lockdir:     $(lockdir)'
+       @echo '  logfilebase: $(logfilebase)'
+       @echo '  setupdir:    $(SETUPDIR)'
+       @echo '  jsdir:       $(JSDIR)'
+       @echo '  swatdir:     $(SWATDIR)'
+       @echo '  mandir:      $(mandir)'
+       @echo '  torturedir:  $(TORTUREDIR)'
+       @echo '  datadir:     $(datadir)'
+       @echo '  winbindd_socket_dir:  $(winbindd_socket_dir)'
+
+showflags::
+       @echo '  srcdir     = $(srcdir)'
+       @echo '  builddir   = $(builddir)'
+
+# The permissions to give the executables
+INSTALLPERMS = 0755
+
+install:: showlayout everything installbin installdat installswat installmisc \
+             installlib installheader installpc installplugins
+
+# DESTDIR is used here to prevent packagers wasting their time
+# duplicating the Makefile. Remove it and you will have the privilege
+# of packaging each samba release for multiple versions of multiple
+# distributions and operating systems, or at least supplying patches
+# to all the packaging files required for this, prior to committing
+# the removal of DESTDIR. Do not remove it even though you think it
+# is not used.
+
+installdirs::
+       @$(SHELL) $(srcdir)/script/installdirs.sh \
+               $(DESTDIR)$(BASEDIR) \
+               $(DESTDIR)$(bindir) \
+               $(DESTDIR)$(sbindir) \
+               $(DESTDIR)$(TORTUREDIR) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(modulesdir) \
+               $(DESTDIR)$(mandir) \
+               $(DESTDIR)$(localstatedir) \
+               $(DESTDIR)$(privatedir) \
+               $(DESTDIR)$(datadir) \
+               $(DESTDIR)$(piddir) \
+               $(DESTDIR)$(lockdir) \
+               $(DESTDIR)$(logfilebase) \
+               $(DESTDIR)$(privatedir)/tls \
+               $(DESTDIR)$(includedir) \
+               $(DESTDIR)$(PKGCONFIGDIR) \
+               $(DESTDIR)$(sysconfdir) \
+
+installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
+       @$(SHELL) $(srcdir)/script/installbin.sh \
+               $(INSTALLPERMS) \
+               $(DESTDIR)$(BASEDIR) \
+               $(DESTDIR)$(sbindir) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(localstatedir) \
+               $(SBIN_PROGS)
+       @$(SHELL) $(srcdir)/script/installbin.sh \
+               $(INSTALLPERMS) \
+               $(DESTDIR)$(BASEDIR) \
+               $(DESTDIR)$(bindir) \
+               $(DESTDIR)$(libdir) \
+               $(DESTDIR)$(localstatedir) \
+               $(BIN_PROGS)
+       @$(SHELL) $(srcdir)/script/installtorture.sh \
+               $(INSTALLPERMS) \
+               $(DESTDIR)$(TORTUREDIR) \
+               $(TORTURE_PROGS)
+
+installplugins::
+
+installlib:: $(SHARED_LIBS) $(STATIC_LIBS) installdirs
+       @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(SHARED_LIBS) 
+       #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
+
+installheader:: headers installdirs
+       @srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
+
+installdat:: installdirs
+       @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
+
+installswat:: installdirs
+       @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
+
+installman:: manpages installdirs
+       @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
+
+installmisc:: installdirs
+       @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(bindir)
+
+installpc:: installdirs
+       @$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
+
+uninstall:: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader \
+       uninstallplugins
+
+uninstallmisc::
+       #FIXME
+
+uninstallbin::
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
+       @$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
+
+uninstalllib::
+       @$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
+       #@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(STATIC_LIBS) 
+
+uninstallheader::
+       @$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
+
+uninstallman::
+       @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
+
+uninstallplugins::
+
+config.status:
+       @echo "config.status does not exist. Please run ./configure."
+       @/bin/false
+
+data.mk: config.status $(MK_FILES)
+       ./config.status
+
+testcov-html:: 
+
+include pidl/config.mk
+include selftest/config.mk
+
+showflags::
+       @echo '  pwd        = '`/bin/pwd`
index bcab918347518956136e0caf60608f9b629f9c40..38c13d4b659a66c65b2b4b5d4ac5a1ecf71741c0 100644 (file)
@@ -63,7 +63,7 @@ static const struct auth_operations anonymous_auth_ops = {
        .check_password = anonymous_check_password
 };
 
-NTSTATUS auth_anonymous_init(void)
+_PUBLIC_ NTSTATUS auth_anonymous_init(void)
 {
        NTSTATUS ret;
 
index 57eb752ac8708d0cf11daf90f1dac253a169d5f9..0da947b68d9e8e23bd106aeed58aa099db650ce0 100644 (file)
@@ -186,7 +186,7 @@ static const struct auth_operations fixed_challenge_auth_ops = {
        .check_password = fixed_challenge_check_password
 };
 
-NTSTATUS auth_developer_init(void)
+_PUBLIC_ NTSTATUS auth_developer_init(void)
 {
        NTSTATUS ret;
 
index 0885d8265ad7a8f34d1832cf49eb0023ee54a46a..918964015039951f11f605e394f1bce25eec40d2 100644 (file)
@@ -425,7 +425,7 @@ static const struct auth_operations sam_ops = {
        .check_password = authsam_check_password
 };
 
-NTSTATUS auth_sam_init(void)
+_PUBLIC_ NTSTATUS auth_sam_init(void)
 {
        NTSTATUS ret;
 
index 62fb42935a415d3110fa6d00b03ccdf893d15d58..20e198701d67a4a549488b3d62090a8ea8c63dc0 100644 (file)
@@ -829,7 +829,7 @@ static const struct auth_operations unix_ops = {
        .check_password = authunix_check_password
 };
 
-NTSTATUS auth_unix_init(void)
+_PUBLIC_ NTSTATUS auth_unix_init(void)
 {
        NTSTATUS ret;
 
index 89ae3195dfd95b84d8630b3ae06f5b31a807f471..2f8074d3cbb22a560cd33a7b832f3c0142b67b84 100644 (file)
@@ -260,7 +260,7 @@ static const struct auth_operations winbind_ops = {
        .check_password = winbind_check_password
 };
 
-NTSTATUS auth_winbind_init(void)
+_PUBLIC_ NTSTATUS auth_winbind_init(void)
 {
        NTSTATUS ret;
 
index 37581b95f34a498bd17b9f1719df7c4efaf79514..5b320bcf363d4b28c935c36dc5a8280a497decef 100644 (file)
@@ -1,8 +1,8 @@
 # auth server subsystem
-include gensec/config.mk
-include kerberos/config.mk
-include ntlmssp/config.mk
-include credentials/config.mk
+mkinclude gensec/config.mk
+mkinclude kerberos/config.mk
+mkinclude ntlmssp/config.mk
+mkinclude credentials/config.mk
 
 [SUBSYSTEM::auth_session]
 OBJ_FILES = session.o
index a53dff8bfe7c56b3eef5773a6c29753ae848e9e1..9aab2c704ece2862670fe034756062f9924e3418 100644 (file)
@@ -62,7 +62,7 @@ INIT_FUNCTION = gensec_schannel_init
 OBJ_FILES = schannel.o \
                        schannel_sign.o
 PRIVATE_DEPENDENCIES = SCHANNELDB NDR_SCHANNEL CREDENTIALS LIBNDR
-OUTPUT_TYPE = INTEGRATED
+OUTPUT_TYPE = MERGED_OBJ
 # End MODULE gensec_schannel
 ################################################
 
index 64a0b2f0c777df84d0f791155faeff367f341f23..cb7bcb71d81e5fcec401b7c5e18373f841f302c1 100644 (file)
@@ -362,8 +362,11 @@ int gensec_sasl_log(void *context,
 NTSTATUS gensec_sasl_init(void)
 {
        NTSTATUS ret;
-       int sasl_ret, i;
+       int sasl_ret;
+#if 0
+       int i;
        const char **sasl_mechs;
+#endif
        
        static const sasl_callback_t callbacks[] = {
                { 
index 87fa47646bbfacf95f55d2b779cbd4ec597f451f..8361b115d7c9ae586d51324f545bc7a58af2f5c3 100644 (file)
@@ -1463,7 +1463,7 @@ static const struct gensec_security_ops gensec_gssapi_sasl_krb5_security_ops = {
        .priority         = GENSEC_GSSAPI
 };
 
-NTSTATUS gensec_gssapi_init(void)
+_PUBLIC_ NTSTATUS gensec_gssapi_init(void)
 {
        NTSTATUS ret;
 
index 5cd0de1ceb764f6b9cc54ecadd0a5369e382d864..d9addcaa3c290335ff105db93d7606ecb6225b32 100644 (file)
@@ -775,7 +775,7 @@ static const struct gensec_security_ops gensec_krb5_security_ops = {
        .priority       = GENSEC_KRB5
 };
 
-NTSTATUS gensec_krb5_init(void)
+_PUBLIC_ NTSTATUS gensec_krb5_init(void)
 {
        NTSTATUS ret;
 
index 42db959380e71ae87dfeed1e0df7c738cfb0a420..96e347898234e8cccc36fdfa6bf5de9953038f47 100644 (file)
@@ -274,7 +274,7 @@ static const struct gensec_security_ops gensec_schannel_security_ops = {
        .priority       = GENSEC_SCHANNEL
 };
 
-NTSTATUS gensec_schannel_init(void)
+_PUBLIC_ NTSTATUS gensec_schannel_init(void)
 {
        NTSTATUS ret;
        ret = gensec_register(&gensec_schannel_security_ops);
index 782aa44c758d4f3cd1d7f5ff0f86e5ce5d5102c6..f593d17d4bdf110cca608baf608554af3882199e 100644 (file)
@@ -1042,7 +1042,7 @@ static const struct gensec_security_ops gensec_spnego_security_ops = {
        .priority         = GENSEC_SPNEGO
 };
 
-NTSTATUS gensec_spnego_init(void)
+_PUBLIC_ NTSTATUS gensec_spnego_init(void)
 {
        NTSTATUS ret;
        ret = gensec_register(&gensec_spnego_security_ops);
index 544850264a8f12342d73b86ac2e1f76bb2a2d3c2..9033384b1f73e5d7e3ab121f463790e5d04c50ed 100644 (file)
@@ -13,6 +13,6 @@ OBJ_FILES = ntlmssp.o \
                ntlmssp_client.o \
                ntlmssp_server.o
 PRIVATE_DEPENDENCIES = MSRPC_PARSE CREDENTIALS
-OUTPUT_TYPE = INTEGRATED
+OUTPUT_TYPE = MERGED_OBJ
 # End MODULE gensec_ntlmssp
 ################################################
index 4f5822567ac3a3948170ffd4bb86378d07221b97..8901488004c5e46ff53515203cc61eb3697c0488 100644 (file)
@@ -425,7 +425,7 @@ static const struct gensec_security_ops gensec_ntlmssp_security_ops = {
 };
 
 
-NTSTATUS gensec_ntlmssp_init(void)
+_PUBLIC_ NTSTATUS gensec_ntlmssp_init(void)
 {
        NTSTATUS ret;
 
index 9c73c96572736b2815b1f91818fe34f8ef24b64d..b721a45a99c86d62ea7a91b4e7d52acbb31e2f03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-# Run this script to build samba from SVN.
+# Run this script to build samba from git.
 
-## insert all possible names (only works with 
-## autoconf 2.x
+## insert all possible names (only works with
+## autoconf 2.x)
 TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
 TESTAUTOCONF="autoconf autoconf-2.53 autoconf2.50 autoconf259 autoconf253"
 
@@ -12,7 +12,7 @@ AUTOCONFFOUND="0"
 
 
 ##
-## Look for autoheader 
+## Look for autoheader
 ##
 for i in $TESTAUTOHEADER; do
        if which $i > /dev/null 2>&1; then
@@ -24,7 +24,7 @@ for i in $TESTAUTOHEADER; do
        fi
 done
 
-## 
+##
 ## Look for autoconf
 ##
 
@@ -39,11 +39,11 @@ for i in $TESTAUTOCONF; do
 done
 
 
-## 
+##
 ## do we have it?
 ##
 if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
-       echo "$0: need autoconf 2.53 or later to build samba from SVN" >&2
+       echo "$0: need autoconf 2.53 or later to build samba from git" >&2
        exit 1
 fi
 
index 3b69057a69dd2d8d167afdd8a92bb830e0292095..0d0742e5d22a8bc99178c30b970e5905a5ea2b93 100644 (file)
@@ -13,6 +13,7 @@ LD=""
 
 AC_SUBST(BLDSHARED)
 AC_SUBST(LD)
+AC_SUBST(SYS_LDFLAGS)
 AC_SUBST(LDFLAGS)
 
 # Assume non-shared by default and override below
@@ -32,13 +33,13 @@ AC_MSG_CHECKING([whether to try to build shared libraries on $host_os])
 case "$host_os" in
        *linux*)
                BLDSHARED="true"
-               LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+               SYS_LDFLAGS="-Wl,--export-dynamic"
                ;;
        *solaris*)
                BLDSHARED="true"
                if test "${GCC}" = "yes"; then
                        if test "${ac_cv_prog_gnu_ld}" = "yes"; then
-                               LDFLAGS="$LDFLAGS -Wl,-E"
+                               SYS_LDFLAGS="-Wl,-E"
                        fi
                fi
                ;;
@@ -47,26 +48,26 @@ case "$host_os" in
                ;;
        *netbsd* | *freebsd* | *dragonfly* )  
                BLDSHARED="true"
-               LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+               SYS_LDFLAGS="-Wl,--export-dynamic"
                ;;
        *openbsd*)
                BLDSHARED="true"
-               LDFLAGS="$LDFLAGS -Wl,-Bdynamic"
+               SYS_LDFLAGS="-Wl,-Bdynamic"
                ;;
        *irix*)
                BLDSHARED="true"
                ;;
        *aix*)
                BLDSHARED="true"
-               LDFLAGS="$LDFLAGS -Wl,-brtl,-bexpall,-bbigtoc"
+               SYS_LDFLAGS="-Wl,-brtl,-bexpall,-bbigtoc"
                ;;
        *hpux*)
                # Use special PIC flags for the native HP-UX compiler.
                BLDSHARED="true" # I hope this is correct
                if test "$host_cpu" = "ia64"; then
-                       LDFLAGS="$LDFLAGS -Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
+                       SYS_LDFLAGS="-Wl,-E,+b/usr/local/lib/hpux32:/usr/lib/hpux32"
                else
-                       LDFLAGS="$LDFLAGS -Wl,-E,+b/usr/local/lib:/usr/lib"
+                       SYS_LDFLAGS="-Wl,-E,+b/usr/local/lib:/usr/lib"
                fi
                ;;
        *osf*)
@@ -86,6 +87,8 @@ AC_MSG_CHECKING([LD])
 AC_MSG_RESULT([$LD])
 AC_MSG_CHECKING([LDFLAGS])
 AC_MSG_RESULT([$LDFLAGS])
+AC_MSG_CHECKING([SYS_LDFLAGS])
+AC_MSG_RESULT([$SYS_LDFLAGS])
 
 AC_SUBST(HOSTLD)
 
index 4780f43e1cbe652a2368d6d4400197174276d1be..d7799649a7fd0c5e971e83e66831b97b59823ce7 100644 (file)
@@ -46,3 +46,11 @@ AC_ARG_ENABLE(automatic-dependencies,
 [ automatic_dependencies=no ])
 AC_MSG_RESULT($automatic_dependencies)
 AC_SUBST(automatic_dependencies)
+
+FIRST_PREREQ="\$*.c"
+AC_SUBST(FIRST_PREREQ)
+
+if test x$GNU_MAKE = xyes; then
+       FIRST_PREREQ="\$<"
+fi
+
index 1dacd956ea3630935c38f707d44f6634492a3a49..08a858ebb2c4edcfc54265bcaf834b24eee778e9 100644 (file)
@@ -132,7 +132,7 @@ AC_SUBST(modulesdir)
 selftest_prefix="./st"
 AC_SUBST(selftest_prefix)
 AC_ARG_WITH(selftest-prefix,
-[  --with-selftest-prefix=DIR    The prefix where make test will be runned ($selftest_prefix)],
+[  --with-selftest-prefix=DIR    The prefix where make test will be run ($selftest_prefix)],
 [ case "$withval" in
   yes|no)
     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
index 4192128bbdc16f5ca7d8f90a3ae5ee9c82fd81a5..eb673446c7af1e1d5024184b8718f3d8e5576f1a 100644 (file)
@@ -8,7 +8,7 @@ dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems)
 dnl
 dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
 dnl
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
 dnl
 dnl SMB_ENABLE(name,default_build)
 dnl
@@ -21,33 +21,45 @@ dnl #######################################################
 dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags)
 AC_DEFUN([SMB_SUBSYSTEM],
 [
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_OBJ_FILES = $2
+$1_CFLAGS = $4
+$1_ENABLE = YES
+"
+
 SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
 ###################################
 # Start Subsystem $1
 @<:@SUBSYSTEM::$1@:>@
-OBJ_FILES = $2
+OBJ_FILES = \$($1_OBJ_FILES)
 PRIVATE_DEPENDENCIES = $3
-CFLAGS = $4
+CFLAGS = \$($1_CFLAGS)
 ENABLE = YES
 # End Subsystem $1
 ###################################
 "
 ])
 
-dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname)
+dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags)
 AC_DEFUN([SMB_LIBRARY],
 [
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_OBJ_FILES = $2
+$1_CFLAGS = $6
+$1_LDFLAGS = $7
+$1_ENABLE = YES
+"
+
 SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
 ###################################
 # Start Library $1
 @<:@LIBRARY::$1@:>@
-OBJ_FILES = $2
+OBJ_FILES = \$($1_OBJ_FILES)
 PRIVATE_DEPENDENCIES = $3
 VERSION = $4
 SO_VERSION = $5 
-CFLAGS = $6
-LDFLAGS = $7
-PC_NAME = $8
+CFLAGS = \$($1_CFLAGS)
+LDFLAGS = \$($1_LDFLAGS)
 ENABLE = YES
 # End Library $1
 ###################################
@@ -91,8 +103,7 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG],
                                        [`$PKG_CONFIG --libs-only-l '$2'`], 
                                        [`$PKG_CONFIG --cflags-only-other '$2'`],
                                        [`$PKG_CONFIG --cflags-only-I '$2'`],
-                                       [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`],
-                                       [ $2 ])
+                                       [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`])
                                ac_cv_$1_found=yes
 
                        else
@@ -120,33 +131,28 @@ dnl SMB_INCLUDE_MK(file)
 AC_DEFUN([SMB_INCLUDE_MK],
 [
 SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
-include $1
+mkinclude $1
 "
 ])
 
-dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname)
+dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
 AC_DEFUN([SMB_EXT_LIB],
 [
-
-SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS
-###################################
-# Start Ext Lib $1
-@<:@EXT_LIB::$1@:>@
-LIBS = $2
-CFLAGS = $3
-CPPFLAGS = $4
-LDFLAGS = $5
-PC_NAME = $6
-# End Ext Lib $1
-###################################
+MAKE_SETTINGS="$MAKE_SETTINGS
+$1_LIBS = $2
+$1_CFLAGS = $3
+$1_CPPFLAGS = $4
+$1_LDFLAGS = $5
 "
+
 ])
 
 dnl SMB_ENABLE(name,default_build)
 AC_DEFUN([SMB_ENABLE],
 [
-       [SMB_ENABLE_][$1]="$2";
-
+       MAKE_SETTINGS="$MAKE_SETTINGS
+$1_ENABLE = $2
+"
 SMB_INFO_ENABLES="$SMB_INFO_ENABLES
 \$enabled{$1} = \"$2\";"
 ])
index ad6cd42c658307945fccd4aece8ba88ce7bb28d0..a4ab90a8cda0fe6d7de8e01774e0b2b5b80a8acf 100755 (executable)
@@ -23,6 +23,8 @@ sub create_cflags($$$$) {
 
        open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
 
+       print CFLAGS_TXT "include mkconfig.mk\n";
+
        my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0;
 
        foreach my $key (values %{$CTX}) {
index aa075490bce071bccec5935626372cbdd89b0c40..4d8db8a04ea54418a9ed74049d19ffc4174f1693 100644 (file)
@@ -18,7 +18,6 @@ my $section_types = {
                "CFLAGS"                => "list",
                "CPPFLAGS"              => "list",
                "LDFLAGS"               => "list",
-               "PC_NAME" => "string",
                },
        "PYTHON" => {
                SWIG_FILE => "string",
@@ -90,7 +89,6 @@ my $section_types = {
                "SO_VERSION"            => "string",
                "LIBRARY_REALNAME" => "string",
 
-               "PC_NAME" => "string",
                "PC_FILE" => "string",
                
                "INIT_FUNCTION_TYPE"    => "string",
@@ -241,7 +239,7 @@ sub run_config_mk($$$$)
                }
 
                # include
-               if ($line =~ /^include (.*)$/) {
+               if ($line =~ /^mkinclude (.*)$/) {
                        my $subfile= $1;
                        my $subdir = dirname($filename);
                        $subdir =~ s/^\.$//g;
index 82f89c081a8b527889279fda25e963a462f33bd3..e50ee50f95369214385fd2f4b9b94cb51271bd79 100755 (executable)
@@ -44,7 +44,7 @@ my $name = "samba4";
 my $only;
 if (defined($subsys)) {
        my $DEPEND = smb_build::input::check($INPUT, \%config::enabled, 
-               "STATIC_LIBRARY", "SHARED_LIBRARY", "SHARED_LIBRARY");
+               "MERGED_OBJ", "SHARED_LIBRARY", "SHARED_LIBRARY");
 
        die("No such subsystem $subsys") unless (defined($DEPEND->{$subsys}));
 
index b52464922b995ccc3a8ce37971a18464f979368d..c2bdbaf4c89f7761208eb84193dcb81cde08853b 100644 (file)
@@ -44,8 +44,14 @@ sub _prepare_build_h($)
                        $DEFINE->{VAL} .= "\t$_, \\\n";
                        unless (/{/) {
                                my $fn = $key->{INIT_FUNCTION_TYPE};
-                               $fn =~ s/\(\*\)/$_/;
-                               $output .= "$fn;\n";
+                               my $n = $_;
+                               if ($fn =~ /\(\*\)/) {
+                                       $fn =~ s/\(\*\)/$n/;
+                                       $output .= "$fn;\n";
+                               } else {
+                                       $n =~ s/\&//;
+                                       $output .= "$fn $n;\n";
+                               }
                        }
                }
 
@@ -82,4 +88,5 @@ sub create_smb_build_h($$)
 
        print __FILE__.": creating $file\n";
 }
+
 1;
index 6d5c4f4a1ed5fbdb610802467d19d112a75416f9..da90e9db48e95402f162c5278964f4221c86c79a 100644 (file)
@@ -5,13 +5,10 @@
 #  Copyright (C) Jelmer Vernooij 2004
 #  Released under the GNU GPL
 
-use smb_build::config;
 use strict;
 package smb_build::input;
 use File::Basename;
 
-my $srcdir = $config::config{srcdir};
-
 sub strtrim($)
 {
        $_ = shift;
@@ -60,14 +57,9 @@ sub check_subsystem($$$)
        my ($INPUT, $subsys, $default_ot) = @_;
        return if ($subsys->{ENABLE} ne "YES");
        
-       unless(defined($subsys->{OUTPUT_TYPE})) {
-               $subsys->{OUTPUT_TYPE} = $default_ot;
-       }
-
+       unless (defined($subsys->{OUTPUT_TYPE})) { $subsys->{OUTPUT_TYPE} = $default_ot; }
        unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
        unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
-       add_libreplace($subsys);
 }
 
 sub check_module($$$)
@@ -76,18 +68,16 @@ sub check_module($$$)
 
        die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
 
-       my $use_default = 0;
-       
        if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
                $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
        }
 
        if (!(defined($INPUT->{$mod->{SUBSYSTEM}}))) {
-               $mod->{ENABLE} = "NO";
-               return;
+               die("Unknown subsystem $mod->{SUBSYSTEM} for module $mod->{NAME}");
        }
 
        if ($INPUT->{$mod->{SUBSYSTEM}} eq "NO") {
+               warn("Disabling module $mod->{NAME} because subsystem $mod->{SUBSYSTEM} is disabled");
                $mod->{ENABLE} = "NO";
                return;
        }
@@ -102,7 +92,7 @@ sub check_module($$$)
 
        if (not defined($mod->{OUTPUT_TYPE})) {
                if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") {
-                       $mod->{OUTPUT_TYPE} = ["SHARED_LIBRARY"];
+                       $mod->{OUTPUT_TYPE} = undef;
                } else {
                        $mod->{OUTPUT_TYPE} = $default_ot;
                }
@@ -113,11 +103,12 @@ sub check_module($$$)
                $sane_subsystem =~ s/^lib//;
                $mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
                push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+               add_libreplace($mod);
        } 
-       if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
+       if (grep(/MERGED_OBJ/, @{$mod->{OUTPUT_TYPE}})) {
                push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
+               unshift (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME});
        }
-       add_libreplace($mod);
 }
 
 sub check_library($$$)
@@ -126,9 +117,7 @@ sub check_library($$$)
 
        return if ($lib->{ENABLE} ne "YES");
 
-       unless (defined($lib->{OUTPUT_TYPE})) {
-               $lib->{OUTPUT_TYPE} = $default_ot;
-       }
+       unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
 
        if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
                print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +130,8 @@ sub check_library($$$)
        }
 
        unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
        unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
-       unless(defined($lib->{INSTALLDIR})) {
-               $lib->{INSTALLDIR} = "LIBDIR";
-       }
+       unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
 
        add_libreplace($lib);
 }
@@ -169,8 +154,8 @@ sub check_python($$$)
                $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
                $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
                $python->{PYTHON_FILES} = ["$dirname$basename.py"];
-               push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS});
-               push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL});
+               push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)");
+               push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_CAST_QUAL)");
                $python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }";
        } else {
                my $basename = $python->{NAME};
@@ -178,7 +163,7 @@ sub check_python($$$)
                $python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
                $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
        }
-       push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}});
+       push (@{$python->{CFLAGS}}, "\$(EXT_LIB_PYTHON_CFLAGS)");
 
        $python->{SUBSYSTEM} = "LIBPYTHON";
 
@@ -197,25 +182,20 @@ sub check_binary($$)
        add_libreplace($bin);
 }
 
-sub import_integrated($$)
+sub add_implicit($$)
 {
-       my ($lib, $depend) = @_;
-
-       foreach my $mod (values %$depend) {
-               next if(not defined($mod->{OUTPUT_TYPE}));
-               next if(not grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}}));
-               next if(not defined($mod->{SUBSYSTEM}));
-               next if($mod->{SUBSYSTEM} ne $lib->{NAME});
-               next if($mod->{ENABLE} ne "YES");
-
-               push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)");
-               push (@{$lib->{LINK_FLAGS}}, "\$($mod->{TYPE}_$mod->{NAME}_LINK_FLAGS)");
-               push (@{$lib->{CFLAGS}}, @{$mod->{CFLAGS}}) if defined($mod->{CFLAGS});
-               push (@{$lib->{PUBLIC_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES});
-               push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PRIVATE_DEPENDENCIES}}) if defined($mod->{PRIVATE_DEPENDENCIES});
-
-               $mod->{ENABLE} = "NO";
-       }
+       my ($INPUT, $n) = @_;
+
+       $INPUT->{$n} = {
+               TYPE => "MAKE_RULE",
+               NAME => $n,
+               TARGET => "",
+               OUTPUT_TYPE => undef,
+               LIBS => ["\$(".uc($n)."_LIBS)"],
+               LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"],
+               CFLAGS => ["\$(".uc($n)."_CFLAGS)"],
+               CPPFLAGS => ["\$(".uc($n)."_CPPFLAGS)"]
+       };
 }
 
 sub calc_unique_deps($$$$$$$$)
@@ -224,16 +204,19 @@ sub calc_unique_deps($$$$$$$$)
        my ($name, $INPUT, $deps, $udeps, $withlibs, $forward, $pubonly, $busy) = @_;
 
        foreach my $n (@$deps) {
-               die("Dependency unknown: $n (for $name)") unless (defined($INPUT->{$n}));
-               die("Recursive dependency: $n, list: " . join(',', @$busy)) if (grep (/^$n$/, @$busy));
-               next if (grep /^$n$/, @$udeps);
+               add_implicit($INPUT, $n) unless (defined($INPUT->{$n}));
                my $dep = $INPUT->{$n};
+               if (grep (/^$n$/, @$busy)) {
+                       next if (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ");
+                       die("Recursive dependency: $n, list: " . join(',', @$busy));
+               }
+               next if (grep /^$n$/, @$udeps);
 
                push (@{$udeps}, $dep->{NAME}) if $forward;
 
                if (defined ($dep->{OUTPUT_TYPE}) && 
                        ($withlibs or 
-                       (@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or 
+                       (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or 
                        (@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
                                push (@$busy, $dep->{NAME});
                                calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -280,11 +263,9 @@ sub check($$$$$)
                }
        }
 
-       foreach my $k (keys %$INPUT) {
-               my $part = $INPUT->{$k};
-
+       foreach my $part (values %$INPUT) {
                $part->{LINK_FLAGS} = [];
-               $part->{FULL_OBJ_LIST} = ["\$($part->{TYPE}_$part->{NAME}_OBJ_LIST)"];
+               $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
 
                if ($part->{TYPE} eq "SUBSYSTEM") { 
                        check_subsystem($INPUT, $part, $subsys_ot);
@@ -306,7 +287,6 @@ sub check($$$$$)
                if (defined($part->{INIT_FUNCTIONS})) {
                        push (@{$part->{LINK_FLAGS}}, "\$(DYNEXP)");
                }
-               import_integrated($part, $INPUT);
        }
 
        foreach my $part (values %$INPUT) {
index fb769103d05ceeea3f7cf1270dcab000d826d0fd..3ed0327d6d7fef90c7adff22d1abe16dd359cef3 100644 (file)
@@ -19,8 +19,7 @@ use strict;
 my $INPUT = {};
 my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
 
-my $subsys_output_type;
-$subsys_output_type = ["STATIC_LIBRARY"];
+my $subsys_output_type = ["MERGED_OBJ"];
 
 my $library_output_type;
 if ($config::config{USESHARED} eq "true") {
@@ -35,7 +34,7 @@ my $module_output_type;
 if ($config::config{USESHARED} eq "true") {
        $module_output_type = ["SHARED_LIBRARY"];
 } else {
-       $module_output_type = ["INTEGRATED"];
+       $module_output_type = ["MERGED_OBJ"];
 }
 
 my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
@@ -43,36 +42,31 @@ my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
                                     $library_output_type,
                                     $module_output_type);
 my $OUTPUT = output::create_output($DEPEND, \%config::config);
-$config::config{SUBSYSTEM_OUTPUT_TYPE} = $subsys_output_type;
-$config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
-$config::config{MODULE_OUTPUT_TYPE} = $module_output_type;
 my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
 
+my $shared_libs_used = 0;
 foreach my $key (values %$OUTPUT) {
-       next unless defined $key->{OUTPUT_TYPE};
-
-       $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+       $mkenv->_prepare_list($key, "OBJ_LIST");
+       push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
 }
 
-my $shared_libs_used = 0;
-
 foreach my $key (values %$OUTPUT) {
        next unless defined $key->{OUTPUT_TYPE};
 
+       $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
        $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        if (defined($key->{PC_FILE})) {
                push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
        } 
-       $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
+       $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        if ($key->{TYPE} eq "LIBRARY" and 
            ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
                $shared_libs_used = 1;
        }
-       $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or 
+       $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or 
                                                                   $key->{TYPE} eq "PYTHON") and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
-       $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
        $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
        $mkenv->Manpage($key) if defined($key->{MANPAGE});
        $mkenv->Header($key) if defined($key->{PUBLIC_HEADERS});
@@ -80,7 +74,18 @@ foreach my $key (values %$OUTPUT) {
                                         defined($key->{PUBLIC_PROTO_HEADER});
 }
 
-$mkenv->write("Makefile");
+foreach my $key (values %$OUTPUT) {
+       next unless defined $key->{OUTPUT_TYPE};
+
+       $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
+                                       grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+       $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or 
+                                                                  $key->{TYPE} eq "PYTHON") and
+                                       grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+       $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
+}
+
+$mkenv->write("data.mk");
 header::create_smb_build_h($OUTPUT, "include/build.h");
 
 cflags::create_cflags($OUTPUT, $config::config{srcdir},
index 452e4254a346fe4783366de80b6812c4646ba54a..17474db00ecdabade885b1976e445f21e0548a35 100644 (file)
@@ -24,35 +24,23 @@ sub new($$$)
        $self->{manpages} = [];
        $self->{sbin_progs} = [];
        $self->{bin_progs} = [];
-       $self->{torture_progs} = [];
        $self->{static_libs} = [];
        $self->{python_dsos} = [];
        $self->{python_pys} = [];
        $self->{shared_libs} = [];
-       $self->{installable_shared_libs} = [];
        $self->{headers} = [];
-       $self->{shared_modules} = [];
        $self->{plugins} = [];
-       $self->{install_plugins} = "";
-       $self->{uninstall_plugins} = "";
        $self->{pc_files} = [];
        $self->{proto_headers} = [];
        $self->{output} = "";
 
        $self->{mkfile} = $mkfile;
 
-       $self->output("#!gmake\n");
        $self->output("################################################\n");
        $self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
        $self->output("################################################\n");
        $self->output("\n");
 
-       $self->output("default: all\n\n");
-
-       $self->_prepare_path_vars();
-       $self->_prepare_suffix_rules();
-       $self->_prepare_compiler_linker();
-
        if (!$self->{automatic_deps}) {
                $self->output("ALL_PREDEP = proto\n");
                $self->output(".NOTPARALLEL:\n");
@@ -68,173 +56,6 @@ sub output($$)
        $self->{output} .= $text;
 }
 
-sub _prepare_path_vars($)
-{
-       my ($self) = @_;
-
-       $self->output(<< "__EOD__"
-prefix = $self->{config}->{prefix}
-exec_prefix = $self->{config}->{exec_prefix}
-selftest_prefix = $self->{config}->{selftest_prefix}
-
-builddir = $self->{config}->{builddir}
-srcdir = $self->{config}->{srcdir}
-datarootdir = $self->{config}->{datarootdir}
-
-VPATH = \$(builddir):\$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
-
-BASEDIR = $self->{config}->{prefix}
-BINDIR = $self->{config}->{bindir}
-SBINDIR = $self->{config}->{sbindir}
-LIBDIR = $self->{config}->{libdir}
-TORTUREDIR = $self->{config}->{libdir}/torture
-MODULESDIR = $self->{config}->{modulesdir}
-INCLUDEDIR = $self->{config}->{includedir}
-CONFIGDIR = $self->{config}->{sysconfdir}
-DATADIR = $self->{config}->{datadir}
-SWATDIR = \$(DATADIR)/swat
-JSDIR = \$(DATADIR)/js
-SETUPDIR = \$(DATADIR)/setup
-VARDIR = $self->{config}->{localstatedir}
-LOGFILEBASE = $self->{config}->{logfilebase}
-NCALRPCDIR = $self->{config}->{localstatedir}/ncalrpc
-LOCKDIR = $self->{config}->{lockdir}
-PIDDIR = $self->{config}->{piddir}
-MANDIR = $self->{config}->{mandir}
-PRIVATEDIR = $self->{config}->{privatedir}
-WINBINDD_SOCKET_DIR = $self->{config}->{winbindd_socket_dir}
-
-__EOD__
-);
-}
-
-sub _prepare_suffix_rules($)
-{
-       my ($self) = @_;
-       my $first_prereq = '$*.c';
-
-       if ($self->{config}->{GNU_MAKE} eq 'yes') {
-               $first_prereq = '$<';
-       }
-
-       $self->output(<< "__EOD__"
-FIRST_PREREQ = $first_prereq
-
-# Dependencies command
-DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\
-    \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for host objects
-HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\
-    \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-# Dependencies for precompiled headers
-PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\
-    \$(CFLAGS) \$(CPPFLAGS) \$(FIRST_PREREQ) -o \$@
-
-# \$< is broken in older BSD versions:
-# when \$@ is foo/bar.o, \$< could be torture/foo/bar.c
-# if it also exists. So better use \$* which is foo/bar
-# and append .c manually to get foo/bar.c
-#
-# If we have GNU Make, it is safe to use \$<, which also lets
-# building with \$srcdir != \$builddir work.
-
-# Run a static analysis checker
-CHECK = \$(CC_CHECKER) \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(PICFLAG) \$(CPPLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Run the configured compiler
-COMPILE = \$(CC) \$(CFLAGS)  \$(PICFLAG) \\
-          `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-                 \$(CPPFLAGS) \\
-                 -c \$(FIRST_PREREQ) -o \$@
-
-# Run the compiler for the build host
-HCOMPILE = \$(HOSTCC) \$(HOSTCC_FLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-        \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-# Precompile headers
-PCHCOMPILE = @\$(CC) -Ilib/replace \\
-    \$(CFLAGS) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
-    \$(PICFLAG) \$(CPPFLAGS) -c \$(FIRST_PREREQ) -o \$@
-
-__EOD__
-);
-}
-
-sub _prepare_compiler_linker($)
-{
-       my ($self) = @_;
-
-       my $builddir_headers = "";
-       my $libdir;
-       my $extra_link_flags = "";
-
-       if ($self->{config}->{USESHARED} eq "true") {
-               $libdir = "\$(builddir)/bin/shared";
-               $extra_link_flags = "-Wl,-rpath-link,\$(builddir)/bin/shared";
-       } else {
-               $libdir = "\$(builddir)/bin/static";
-       }
-       
-       if (!(abs_path($self->{config}->{srcdir}) eq abs_path($self->{config}->{builddir}))) {
-           $builddir_headers= "-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
-       }
-
-       $self->output(<< "__EOD__"
-SHELL=$self->{config}->{SHELL}
-
-PERL=$self->{config}->{PERL}
-PYTHON=$self->{config}->{PYTHON}
-SWIG=$self->{config}->{SWIG}
-
-CPP=$self->{config}->{CPP}
-CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
-
-CC=$self->{config}->{CC}
-CFLAGS=$self->{config}->{CFLAGS}
-CFLAG_NO_UNUSED_MACROS=$self->{config}->{CFLAG_NO_UNUSED_MACROS}
-PICFLAG=$self->{config}->{PICFLAG}
-
-INSTALL_LINK_FLAGS=$extra_link_flags
-
-BNLD=$self->{config}->{LD} 
-BNLD_FLAGS=$self->{config}->{LDFLAGS} -L$libdir
-
-STLD=$self->{config}->{STLD}
-STLD_FLAGS=$self->{config}->{STLD_FLAGS}
-
-SHLD=$self->{config}->{SHLD}
-SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
-
-MDLD=$self->{config}->{MDLD}
-MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
-
-SHLIBEXT=$self->{config}->{SHLIBEXT}
-
-HOSTCC=$self->{config}->{HOSTCC}
-HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS)
-
-HOSTLD=$self->{config}->{HOSTLD}
-HOSTLD_FLAGS=$self->{config}->{LDFLAGS}
-
-XSLTPROC=$self->{config}->{XSLTPROC}
-
-LIB_PATH_VAR=$self->{config}->{LIB_PATH_VAR}
-
-LEX=$self->{config}->{LEX}
-YACC=$self->{config}->{YACC}
-YAPP=$self->{config}->{YAPP}
-
-GCOV=$self->{config}->{GCOV}
-
-DEFAULT_TEST_OPTIONS=$self->{config}->{DEFAULT_TEST_OPTIONS}
-
-__EOD__
-);
-}
-
 sub _prepare_mk_files($)
 {
        my $self = shift;
@@ -278,35 +99,24 @@ sub array2oneperline($)
        return $output;
 }
 
-sub _prepare_list_ex($$$$$)
+sub _prepare_list($$$)
 {
-       my ($self,$ctx,$var,$pre,$post) = @_;
+       my ($self,$ctx,$var) = @_;
        my @tmparr = ();
 
-       push(@tmparr, $pre) if defined($pre);
        push(@tmparr, @{$ctx->{$var}}) if defined($ctx->{$var});
-       push(@tmparr, $post) if defined($post);
 
        my $tmplist = array2oneperline(\@tmparr);
        return if ($tmplist eq "");
 
-       $self->output("$ctx->{TYPE}\_$ctx->{NAME}_$var =$tmplist\n");
+       $self->output("$ctx->{NAME}_$var =$tmplist\n");
 }
 
-sub _prepare_list($$$)
-{
-       my ($self,$ctx,$var) = @_;
-
-       $self->_prepare_list_ex($ctx, $var, undef, undef);
-}
-
-sub Integrated($$)
+sub SharedModulePrimitives($$)
 {
        my ($self,$ctx) = @_;
-
-       $self->_prepare_list($ctx, "OBJ_LIST");
-       $self->_prepare_list($ctx, "FULL_OBJ_LIST");
-       $self->_prepare_list($ctx, "LINK_FLAGS");
+       
+       #FIXME
 }
 
 sub SharedModule($$)
@@ -322,31 +132,36 @@ sub SharedModule($$)
                push (@{$self->{python_dsos}}, 
                        "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
        } else {
-               push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
                push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
-               $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/\n";
-               $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n");
+               $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
                if (defined($ctx->{ALIASES})) {
                        foreach (@{$ctx->{ALIASES}}) {
-                               $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+                               $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+                               $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+                       }
+               }
+
+               $self->output("uninstallplugins::\n");
+               $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+
+               if (defined($ctx->{ALIASES})) {
+                       foreach (@{$ctx->{ALIASES}}) {
+                               $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
                        }
                }
        }
 
-       $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
-       $self->_prepare_list($ctx, "OBJ_LIST");
+       $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
        $self->_prepare_list($ctx, "FULL_OBJ_LIST");
        $self->_prepare_list($ctx, "DEPEND_LIST");
        $self->_prepare_list($ctx, "LINK_FLAGS");
 
-       push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-
-       if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
+       if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON" and 
+               $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/) {
                my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
                $init_fn =~ s/\(\*\)/init_module/;
                my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
@@ -370,12 +185,12 @@ __EOD__
        $self->output(<< "__EOD__"
 #
 
-$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST) $init_obj
+$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) $init_obj
        \@echo Linking \$\@
        \@mkdir -p $ctx->{SHAREDDIR}
-       \@\$(MDLD) \$(MDLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
-               \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
-               \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+       \@\$(MDLD) \$(LDFLAGS) \$(MDLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+               \$($ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
+               \$($ctx->{NAME}_LINK_FLAGS)
 __EOD__
 );
 
@@ -388,79 +203,91 @@ __EOD__
        $self->output("\n");
 }
 
-sub SharedLibrary($$)
+sub SharedLibraryPrimitives($$)
 {
        my ($self,$ctx) = @_;
 
-       my $has_static_lib = 0;
-
-       push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
-       push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
-
-       $has_static_lib = 1 if grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}});
+       $self->output("$ctx->{NAME}_SOVERSION = $ctx->{SO_VERSION}\n") if (defined($ctx->{SO_VERSION}));
+       $self->output("$ctx->{NAME}_VERSION = $ctx->{VERSION}\n") if (defined($ctx->{VERSION}));
 
-       if (not $has_static_lib) {
-               $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
-               $self->_prepare_list($ctx, "OBJ_LIST");
+       if (not grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}})) {
+               $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
                $self->_prepare_list($ctx, "FULL_OBJ_LIST");
        }
+}
+
+sub SharedLibrary($$)
+{
+       my ($self,$ctx) = @_;
+
+       push (@{$self->{shared_libs}}, $ctx->{RESULT_SHARED_LIBRARY}) if (defined($ctx->{SO_VERSION}));
+
        $self->_prepare_list($ctx, "DEPEND_LIST");
        $self->_prepare_list($ctx, "LINK_FLAGS");
-#      $self->_prepare_list_ex($ctx, "LINK_FLAGS", "-Wl,--whole-archive", "-Wl,--no-whole-archive");
-
-       push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
 
        my $soarg = "";
        my $lns = "";
        if ($self->{config}->{SONAMEFLAG} ne "#" and defined($ctx->{LIBRARY_SONAME})) {
                $soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME}";
                if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
-                       $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
-                       $lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
+                       $lns .= "\n\t\@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
                }
        }
 
        if (defined($ctx->{LIBRARY_SONAME})) {
-               $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
                $lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
        }
 
        $self->output(<< "__EOD__"
 #
-
-$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
        \@echo Linking \$\@
        \@mkdir -p $ctx->{SHAREDDIR}
-       \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
-               \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) \\
-               \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
+       \@\$(SHLD) \$(LDFLAGS) \$(SHLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+               \$($ctx->{NAME}\_FULL_OBJ_LIST) \\
+               \$($ctx->{NAME}_LINK_FLAGS) \\
                $soarg$lns
 __EOD__
 );
        $self->output("\n");
 }
 
+sub MergedObj($$)
+{
+       my ($self, $ctx) = @_;
+
+       return unless defined($ctx->{OUTPUT});
+
+       $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+       $self->output(<< "__EOD__"
+#
+$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST)
+       \@echo Partially linking \$@
+       \@mkdir -p bin/mergedobj
+       \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_LIST)
+
+__EOD__
+);
+}
+
 sub StaticLibrary($$)
 {
        my ($self,$ctx) = @_;
 
        return unless (defined($ctx->{OBJ_FILES}));
 
-       push (@{$self->{static_libs}}, $ctx->{TARGET_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
+       push (@{$self->{static_libs}}, $ctx->{RESULT_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
 
-       $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
-       $self->_prepare_list($ctx, "OBJ_LIST");
+       $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
        $self->_prepare_list($ctx, "FULL_OBJ_LIST");
 
-       push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-
        $self->output(<< "__EOD__"
 #
-$ctx->{TARGET_STATIC_LIBRARY}: \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)
        \@echo Linking \$@
        \@rm -f \$@
        \@mkdir -p $ctx->{STATICDIR}
-       \@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+       \@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{NAME}_FULL_OBJ_LIST)
 
 __EOD__
 );
@@ -479,51 +306,37 @@ sub Binary($$)
 {
        my ($self,$ctx) = @_;
 
-       my $installdir;
        my $extradir = "";
 
-       if (defined($ctx->{INSTALLDIR}) && $ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
-               $extradir = "/torture" . substr($ctx->{INSTALLDIR}, length("TORTUREDIR"));
-       }
-       my $localdir = "bin$extradir";
-
-       $installdir = "bin$extradir";
-
-       push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
-               
        unless (defined($ctx->{INSTALLDIR})) {
        } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
-               push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
+               push (@{$self->{sbin_progs}}, $ctx->{RESULT_BINARY});
        } elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
-               push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
-       } elsif ($ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
-               push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}");
+               push (@{$self->{bin_progs}}, $ctx->{RESULT_BINARY});
        }
 
+       $self->output("binaries:: $ctx->{TARGET_BINARY}\n");
 
-       push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
-
-       $self->_prepare_list($ctx, "OBJ_LIST");
        $self->_prepare_list($ctx, "FULL_OBJ_LIST");
        $self->_prepare_list($ctx, "DEPEND_LIST");
        $self->_prepare_list($ctx, "LINK_FLAGS");
 
 $self->output(<< "__EOD__"
-$installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
        \@echo Linking \$\@
 __EOD__
        );
 
        if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") {
                $self->output(<< "__EOD__"
-       \@\$(HOSTLD) \$(HOSTLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
-               \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
+       \@\$(HOSTLD) \$(HOSTLD_FLAGS) -L\${builddir}/bin/static -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+               \$\($ctx->{NAME}_LINK_FLAGS)
 __EOD__
                );
        } else {
                $self->output(<< "__EOD__"
-       \@\$(BNLD) \$(BNLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
-               \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
+       \@\$(BNLD) \$(BNLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
+               \$\($ctx->{NAME}_LINK_FLAGS) 
 
 __EOD__
                );
@@ -586,35 +399,28 @@ sub ProtoHeader($$)
                $pub = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PUBLIC_PROTO_HEADER});
        }
 
-       $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
+       $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
        $self->output("\t\@echo \"$comment\"\n");
-       $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
+       $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{NAME}_OBJ_LIST)\n\n");
 }
 
 sub write($$)
 {
-       my ($self,$file) = @_;
+       my ($self, $file) = @_;
 
-       $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n");
+       $self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n");
        $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
        $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
-       $self->output("TORTURE_PROGS = " . array2oneperline($self->{torture_progs}) . "\n");
-       $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
        $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
        $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
        $self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
        $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
-       $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
        $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
        $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
        $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
        $self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) .  "\n");
-       $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
        $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
 
-       $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
-       $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
-
        $self->_prepare_mk_files();
 
        $self->output($self->{mkfile});
index fbf14f7e91803ef559df0401e168d7a2f7fae55c..ff9afe8e8c9f09d459bd0c7e86160070ab3a1f91 100644 (file)
@@ -81,12 +81,30 @@ sub generate_shared_library($)
        $lib->{LIBRARY_DEBUGNAME} = $lib->{LIBRARY_REALNAME};
 
        if (defined($lib->{VERSION}) and $config::config{SONAMEFLAG} ne "#") {
-               $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.$lib->{SO_VERSION}";
-               $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.$lib->{VERSION}";
+               $lib->{LIBRARY_SONAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_SOVERSION)";
+               $lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)";
        } 
        
-       $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
-       $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
+       $lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
+       $lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name";
+       $lib->{TARGET_SHARED_LIBRARY} = $lib->{RESULT_SHARED_LIBRARY};
+}
+
+sub generate_merged_obj($)
+{
+       my $lib = shift;
+
+       my $link_name = $lib->{NAME};
+       $link_name =~ s/^LIB//;
+
+       if (defined($lib->{OBJ_FILES})) {
+               $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+               $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+               $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ};
+       } else {
+               $lib->{TARGET_MERGED_OBJ} = "";
+               $lib->{RESULT_MERGED_OBJ} = "";
+       }
 }
 
 sub generate_static_library($)
@@ -102,12 +120,15 @@ sub generate_static_library($)
        $lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
 
        if (defined($lib->{OBJ_FILES})) {
-               $lib->{TARGET_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+               $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+               $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY};
                $lib->{STATICDIR} = 'bin/static';
+               $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name);
        } else {
+               $lib->{RESULT_STATIC_LIBRARY} = "";
                $lib->{TARGET_STATIC_LIBRARY} = "";
+               $lib->{OUTPUT_STATIC_LIBRARY} = "";
        }
-       $lib->{OUTPUT_STATIC_LIBRARY} = $lib->{TARGET_STATIC_LIBRARY};
 }
 
 sub generate_binary($)
@@ -115,10 +136,11 @@ sub generate_binary($)
        my $bin = shift;
 
        $bin->{DEPEND_LIST} = [];
-       push(@{$bin->{LINK_FLAGS}}, "\$($bin->{TYPE}_$bin->{NAME}\_OBJ_LIST)");
+       push(@{$bin->{LINK_FLAGS}}, "\$($bin->{NAME}\_FULL_OBJ_LIST)");
 
-       $bin->{DEBUGDIR} = "bin/";
-       $bin->{TARGET_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+       $bin->{DEBUGDIR} = "bin";
+       $bin->{RESULT_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+       $bin->{TARGET_BINARY} = $bin->{RESULT_BINARY};
        $bin->{BINARY} = $bin->{NAME};
 }
 
@@ -152,6 +174,7 @@ sub create_output($$)
                generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
                generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
                generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+               generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
                $part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
                $part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
        }
@@ -162,7 +185,7 @@ sub create_output($$)
                merge_array(\$part->{FINAL_CFLAGS}, $part->{CPPFLAGS});
                merge_array(\$part->{FINAL_CFLAGS}, $part->{CFLAGS});
 
-               foreach (@{$part->{UNIQUE_DEPENDENCIES_COMPILE}}) {
+               foreach (@{$part->{UNIQUE_DEPENDENCIES_ALL}}) {
                        my $elem = $depend->{$_};
                        next if $elem == $part;
 
@@ -175,15 +198,19 @@ sub create_output($$)
                        my $elem = $depend->{$_};
                        next if $elem == $part;
 
-                       push(@{$part->{LINK_FLAGS}}, $elem->{OUTPUT}) if defined($elem->{OUTPUT});
                        push(@{$part->{LINK_FLAGS}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
-                       push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
-                       push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+                       push(@{$part->{LINK_FLAGS}}, @{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
+                       if (defined($elem->{OUTPUT_TYPE}) and @{$elem->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") {
+                               push (@{$part->{FULL_OBJ_LIST}}, $elem->{TARGET});
+                       } else {
+                               push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT});
+                               push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+                       }
                }
        }
 
        foreach $part (values %{$depend}) {
-               if (($part->{STANDARD_VISIBILITY} ne "default") and 
+               if (defined($part->{STANDARD_VISIBILITY}) and ($part->{STANDARD_VISIBILITY} ne "default") and 
                        ($config->{visibility_attribute} eq "yes")) {
                        push(@{$part->{FINAL_CFLAGS}}, "-fvisibility=$part->{STANDARD_VISIBILITY}");
                }
index 52817f35976e18d7b1da520bf272f7863476d897..a6557fb1fed1e61d36c9f37a734bf08df924dbdc 100644 (file)
@@ -5,6 +5,7 @@
 #  Released under the GNU GPL
 
 package summary;
+use smb_build::config;
 use strict;
 
 sub enabled($)
@@ -21,9 +22,7 @@ sub showitem($$$)
        my @need = ();
 
        foreach (@$items) {
-               if (!enabled($output->{$_}->{ENABLE})) {
-                       push (@need, $_);
-               }
+               push (@need, $_) if (enabled($config::enable{$_}));
        }
 
        print "Support for $desc: ";
@@ -54,6 +53,9 @@ sub show($$)
        showitem($output, "using libblkid", ["BLKID"]);
        showitem($output, "using iconv", ["ICONV"]);
        showitem($output, "using pam", ["PAM"]);
+       if (enabled($config->{developer})) {
+               showitem($output, "using VDE", ["VDEPLUG"]);
+       }
        showitem($output, "python bindings", ["LIBPYTHON"]);
        showisexternal($output, "popt", "LIBPOPT");
        showisexternal($output, "talloc", "LIBTALLOC");
index c5c2ea970acdc5033ee8fc28e3f8c703c01c6207..8b225202fba5cdd4bfb3371d71edb6f7a4c8b6f8 100644 (file)
@@ -1,4 +1,4 @@
-include ctdb/config.mk
+mkinclude ctdb/config.mk
 
 ####################
 [SUBSYSTEM::CLUSTER]
index ed74bc1251ffa70d553c32593f1ef194c05470d7..b609b4f52c89b193ed400899ca27fc73cbc9b430 100644 (file)
@@ -35,12 +35,11 @@ AC_CONFIG_FILES(auth/gensec/gensec.pc)
 AC_CONFIG_FILES(param/samba-config.pc)
 AC_CONFIG_FILES(librpc/dcerpc_samr.pc)
 
-SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.1.0,
+SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.2.0,
        [],
        [
                m4_include(lib/talloc/libtalloc.m4)
                SMB_INCLUDE_MK(lib/talloc/config.mk)
-               AC_CONFIG_FILES(lib/talloc/talloc.pc)
        ]
 )
 
@@ -49,7 +48,6 @@ SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.0,
        [
                m4_include(lib/tdb/libtdb.m4)
                SMB_INCLUDE_MK(lib/tdb/config.mk)
-               AC_CONFIG_FILES(lib/tdb/tdb.pc)
        ]
 )
 
@@ -140,6 +138,25 @@ for d in build/smb_build bin include ; do
     test -d ${builddir}/$d || AS_MKDIR_P(${builddir}/$d)
 done
 
+AC_SUBST(INTERN_LDFLAGS)
+AC_SUBST(INSTALL_LINK_FLAGS)
+if test $USESHARED = "true";
+then
+       INTERN_LDFLAGS="-L\${builddir}/bin/shared -L\${builddir}/bin/static"
+       INSTALL_LINK_FLAGS="-Wl,-rpath-link,\${builddir}/bin/shared";
+else
+       INTERN_LDFLAGS="-L\${builddir}/bin/static -L\${builddir}/bin/shared"
+fi
+
+builddir_headers=""
+       
+if test "x$ac_abs_srcdir" != "x$ac_abs_builddir"
+then
+       builddir_headers="-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
+fi
+
+CPPFLAGS="$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $CPPFLAGS"
+
 echo "configure: creating build/smb_build/config.pm"
 cat >build/smb_build/config.pm<<CEOF
 # config.pm - Autogenerate by configure. DO NOT EDIT!
@@ -201,3 +218,11 @@ CMP_RET=$?
 if test $CMP_RET != 0; then
        cp include/config_tmp.h include/config.h
 fi
+
+echo "configure: creating mkconfig.mk"
+cat >mkconfig.mk<<CEOF
+# mkconfig.mk - Autogenerated by configure, DO NOT EDIT!
+AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
+AC_Var = $AC_Var])
+$MAKE_SETTINGS
+CEOF
index de00b401c825b97e14b7846577e918612e575b46..17752fbbbd30df295e952baa3b1ee02ff74c25a1 100644 (file)
@@ -1,6 +1,6 @@
 # Directory Service subsystem
 
-include samdb/ldb_modules/config.mk
+mkinclude samdb/ldb_modules/config.mk
 
 ################################################
 # Start SUBSYSTEM SAMDB
index 908d9b088c8b3540b321dce6792e5737ce16f9e9..1252c9ee42f1ae2c65fbb82dd875baae34101850 100644 (file)
@@ -295,13 +295,7 @@ static int anr_search(struct ldb_module *module, struct ldb_request *req)
        return ldb_next_request(module, req);
 }
 
-static const struct ldb_module_ops anr_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_anr_module_ops = {
        .name              = "anr",
        .search = anr_search
 };
-
-int ldb_anr_init(void)
-{
-       return ldb_register_module(&anr_ops);
-}
-
index dc407fbd8a9a049b0c8618dc86941d6ff7547852..de93b5638df22801b951edb15967c7510a6895b5 100644 (file)
@@ -4,7 +4,7 @@
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC
-INIT_FUNCTION = objectguid_module_init
+INIT_FUNCTION = objectguid_module_module_ops
 OBJ_FILES = \
                objectguid.o
 # End MODULE ldb_objectguid
@@ -17,7 +17,7 @@ SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBNDR NDR_MISC NDR_DRSUAPI \
                                           NDR_DRSBLOBS LIBNDR
-INIT_FUNCTION = repl_meta_data_module_init
+INIT_FUNCTION = repl_meta_data_module_module_ops
 OBJ_FILES = \
                repl_meta_data.o
 # End MODULE ldb_repl_meta_data
@@ -29,7 +29,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
-INIT_FUNCTION = dsdb_cache_module_init
+INIT_FUNCTION = dsdb_cache_module_module_ops
 OBJ_FILES = \
                dsdb_cache.o
 # End MODULE ldb_dsdb_cache
@@ -41,7 +41,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
-INIT_FUNCTION = schema_fsmo_module_init
+INIT_FUNCTION = schema_fsmo_module_module_ops
 OBJ_FILES = \
                schema_fsmo.o
 # End MODULE ldb_schema_fsmo
@@ -53,7 +53,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
-INIT_FUNCTION = naming_fsmo_module_init
+INIT_FUNCTION = naming_fsmo_module_module_ops
 OBJ_FILES = \
                naming_fsmo.o
 # End MODULE ldb_naming_fsmo
@@ -65,7 +65,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC
-INIT_FUNCTION = pdc_fsmo_module_init
+INIT_FUNCTION = pdc_fsmo_module_module_ops
 OBJ_FILES = \
                pdc_fsmo.o
 # End MODULE ldb_pdc_fsmo
@@ -77,7 +77,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB
-INIT_FUNCTION = samldb_module_init
+INIT_FUNCTION = samldb_module_module_ops
 OBJ_FILES = \
                samldb.o
 #
@@ -89,7 +89,7 @@ OBJ_FILES = \
 [MODULE::ldb_samba3sam]
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
-INIT_FUNCTION = ldb_samba3sam_module_init
+INIT_FUNCTION = &ldb_samba3sam_module_module_ops
 PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \
                                           NDR_SECURITY
 OBJ_FILES = \
@@ -103,7 +103,7 @@ OBJ_FILES = \
 [MODULE::ldb_simple_ldap_map]
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
-INIT_FUNCTION = ldb_simple_ldap_map_module_init
+INIT_FUNCTION = &ldb_simple_ldap_map_module_module_ops
 PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map LIBNDR NDR_MISC
 ENABLE = YES
 ALIASES = entryuuid nsuniqueid
@@ -117,7 +117,7 @@ OBJ_FILES = \
 # # Start MODULE ldb_proxy
 # [MODULE::ldb_proxy]
 # SUBSYSTEM = LIBLDB
-# INIT_FUNCTION = proxy_module_init
+# INIT_FUNCTION = proxy_module_module_ops
 # OBJ_FILES = \
 #              proxy.o
 # 
@@ -131,7 +131,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
 OUTPUT_TYPE = SHARED_LIBRARY
-INIT_FUNCTION = rootdse_module_init
+INIT_FUNCTION = rootdse_module_module_ops
 OBJ_FILES = \
                rootdse.o
 #
@@ -143,7 +143,7 @@ OBJ_FILES = \
 [MODULE::ldb_password_hash]
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
-INIT_FUNCTION = password_hash_module_init
+INIT_FUNCTION = password_hash_module_module_ops
 OBJ_FILES = password_hash.o
 PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \
                                           LIBCLI_AUTH NDR_DRSBLOBS KERBEROS SAMDB
@@ -157,7 +157,7 @@ PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR SAMDB
 OUTPUT_TYPE = SHARED_LIBRARY
 SUBSYSTEM = LIBLDB
-INIT_FUNCTION = local_password_module_init
+INIT_FUNCTION = local_password_module_module_ops
 OBJ_FILES = local_password.o
 #
 # End MODULE ldb_local_password
@@ -169,7 +169,7 @@ OBJ_FILES = local_password.o
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY SAMDB
 OUTPUT_TYPE = SHARED_LIBRARY
 SUBSYSTEM = LIBLDB
-INIT_FUNCTION = ldb_kludge_acl_init
+INIT_FUNCTION = &ldb_kludge_acl_module_ops
 OBJ_FILES = \
                kludge_acl.o
 #
@@ -182,7 +182,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR LIBSECURITY SAMDB
-INIT_FUNCTION = ldb_extended_dn_init
+INIT_FUNCTION = &ldb_extended_dn_module_ops
 OBJ_FILES = \
                extended_dn.o
 #
@@ -195,7 +195,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC
-INIT_FUNCTION = ldb_show_deleted_init
+INIT_FUNCTION = &ldb_show_deleted_module_ops
 OBJ_FILES = \
                show_deleted.o
 #
@@ -208,7 +208,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
-INIT_FUNCTION = ldb_partition_init
+INIT_FUNCTION = &ldb_partition_module_ops
 OBJ_FILES = \
                partition.o
 #
@@ -221,7 +221,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBLDB
-INIT_FUNCTION = ldb_schema_init
+INIT_FUNCTION = &ldb_schema_module_ops
 OBJ_FILES = \
                schema.o schema_syntax.o
 #
@@ -235,7 +235,7 @@ SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC CREDENTIALS
 #Also depends on credentials, but that would loop
-INIT_FUNCTION = ldb_update_kt_init
+INIT_FUNCTION = &ldb_update_kt_module_ops
 OBJ_FILES = \
                update_keytab.o 
 #
@@ -245,7 +245,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_objectclass
 [MODULE::ldb_objectclass]
-INIT_FUNCTION = ldb_objectclass_init
+INIT_FUNCTION = &ldb_objectclass_module_ops
 OUTPUT_TYPE = SHARED_LIBRARY
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY NDR_SECURITY SAMDB
@@ -258,8 +258,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_subtree_rename
 [MODULE::ldb_subtree_rename]
-INIT_FUNCTION = ldb_subtree_rename_init
-OUTPUT_TYPE = SHARED_LIBRARY
+INIT_FUNCTION = &ldb_subtree_rename_module_ops
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
@@ -271,8 +270,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_subtree_rename
 [MODULE::ldb_subtree_delete]
-INIT_FUNCTION = ldb_subtree_delete_init
-OUTPUT_TYPE = SHARED_LIBRARY
+INIT_FUNCTION = &ldb_subtree_delete_module_ops
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
@@ -284,7 +282,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_linked_attributes
 [MODULE::ldb_linked_attributes]
-INIT_FUNCTION = ldb_linked_attributes_init
+INIT_FUNCTION = &ldb_linked_attributes_module_ops
 CFLAGS = -Ilib/ldb/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB
@@ -297,9 +295,8 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_ranged_results
 [MODULE::ldb_ranged_results]
-INIT_FUNCTION = ldb_ranged_results_init
+INIT_FUNCTION = &ldb_ranged_results_module_ops
 CFLAGS = -Ilib/ldb/include
-OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
 OBJ_FILES = \
@@ -310,7 +307,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_anr
 [MODULE::ldb_anr]
-INIT_FUNCTION = ldb_anr_init
+INIT_FUNCTION = &ldb_anr_module_ops
 CFLAGS = -Ilib/ldb/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
@@ -323,7 +320,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_normalise
 [MODULE::ldb_normalise]
-INIT_FUNCTION = ldb_normalise_init
+INIT_FUNCTION = &ldb_normalise_module_ops
 CFLAGS = -Ilib/ldb/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB
@@ -336,7 +333,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_instancetype
 [MODULE::ldb_instancetype]
-INIT_FUNCTION = ldb_instancetype_init
+INIT_FUNCTION = &ldb_instancetype_module_ops
 CFLAGS = -Ilib/ldb/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC
index 4ca8bbf4637e22b4688aecf28b05e845eb5f6460..e60605dce1060bbad19ad41a6e0f5cbacb9aa976 100644 (file)
@@ -36,12 +36,7 @@ static int dsdb_cache_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops dsdb_cache_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_dsdb_cache_module_ops = {
        .name           = "dsdb_cache",
        .init_context   = dsdb_cache_init
 };
-
-int dsdb_cache_module_init(void)
-{
-       return ldb_register_module(&dsdb_cache_ops);
-}
index 802f86570bb34555e0ed7883852c056d851c2a93..84bf5e484352c635b9dd1791638e255128969eb6 100644 (file)
@@ -362,13 +362,8 @@ static int extended_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops extended_dn_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_extended_dn_module_ops = {
        .name              = "extended_dn",
        .search            = extended_search,
        .init_context      = extended_init
 };
-
-int ldb_extended_dn_init(void)
-{
-       return ldb_register_module(&extended_dn_ops);
-}
index 65df294e90e00f88f2b56a8b5c38b52ac79c19f7..fd5aa5e18aea56291ee9163c3b23de9fb9bb083d 100644 (file)
@@ -118,13 +118,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
        return ret;
 }
 
-static const struct ldb_module_ops instancetype_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_instancetype_module_ops = {
        .name          = "instancetype",
        .add           = instancetype_add,
 };
-
-
-int ldb_instancetype_init(void)
-{
-       return ldb_register_module(&instancetype_ops);
-}
index ea33548b919bcfad154c08296129531d004a8da3..e3e1f7ac88b6e49e102698646983826a5560fe90 100644 (file)
@@ -471,7 +471,7 @@ done:
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops kludge_acl_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_kludge_acl_module_ops = {
        .name              = "kludge_acl",
        .search            = kludge_acl_search,
        .add               = kludge_acl_change,
@@ -481,8 +481,3 @@ static const struct ldb_module_ops kludge_acl_ops = {
        .extended          = kludge_acl_change,
        .init_context      = kludge_acl_init
 };
-
-int ldb_kludge_acl_init(void)
-{
-       return ldb_register_module(&kludge_acl_ops);
-}
index b3fdffe5669f6c88cb02eb8f408bba2958ed947d..8685c722aad2b8b7b23b6d6e64d0a74c4325d5ef 100644 (file)
@@ -915,7 +915,7 @@ static int linked_attributes_wait(struct ldb_handle *handle, enum ldb_wait_type
        }
 }
 
-static const struct ldb_module_ops linked_attributes_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_linked_attributes_module_ops = {
        .name              = "linked_attributes",
        .add               = linked_attributes_add,
        .modify            = linked_attributes_modify,
@@ -923,8 +923,3 @@ static const struct ldb_module_ops linked_attributes_ops = {
        .rename            = linked_attributes_rename,
        .wait              = linked_attributes_wait,
 };
-
-int ldb_linked_attributes_init(void)
-{
-       return ldb_register_module(&linked_attributes_ops);
-}
index 350434df51733a768e8eebaec41a3eb95f18baa1..dfa98ef0af957bdb5ced6404ce6688d857846120 100644 (file)
@@ -843,16 +843,10 @@ static int local_password_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops local_password_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_local_password_module_ops = {
        .name          = "local_password",
        .add           = local_password_add,
        .modify        = local_password_modify,
        .search        = local_password_search,
        .wait          = local_password_wait
 };
-
-
-int local_password_module_init(void)
-{
-       return ldb_register_module(&local_password_ops);
-}
index d6b6a242875681cf54f0fe26045c9c7352daf625..084540f68d0af060a0a0885a187de2ea4b7f6dd2 100644 (file)
@@ -117,12 +117,7 @@ static int naming_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops naming_fsmo_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_naming_fsmo_module_ops = {
        .name           = "naming_fsmo",
        .init_context   = naming_fsmo_init
 };
-
-int naming_fsmo_module_init(void)
-{
-       return ldb_register_module(&naming_fsmo_ops);
-}
index efc9bb29e8b707c3b95cfc957510187e6d783615..695393d4e8a7f18f5f1f076203b38aa9dd9b5355 100644 (file)
@@ -105,6 +105,7 @@ static int normalise_search_callback(struct ldb_context *ldb, void *context, str
                if (!attribute) {
                        continue;
                }
+               /* Look to see if this attributeSyntax is a DN */
                if ((strcmp(attribute->attributeSyntax_oid, "2.5.5.1") != 0) &&
                    (strcmp(attribute->attributeSyntax_oid, "2.5.5.7") != 0)) {
                        continue;
@@ -155,12 +156,7 @@ static int normalise_search(struct ldb_module *module, struct ldb_request *req)
 }
 
 
-static const struct ldb_module_ops normalise_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_normalise_module_ops = {
        .name              = "normalise",
        .search            = normalise_search,
 };
-
-int ldb_normalise_init(void)
-{
-       return ldb_register_module(&normalise_ops);
-}
index 737475ca78b24693bcfb7fd82e6a01b5a7fd9e40..e63ad4de56b8e392a1bd9e5f1f88fc2d20f7d40a 100644 (file)
@@ -1153,16 +1153,10 @@ static int objectclass_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops objectclass_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_objectclass_module_ops = {
        .name              = "objectclass",
        .add           = objectclass_add,
        .modify        = objectclass_modify,
        .rename        = objectclass_rename,
        .wait          = objectclass_wait
 };
-
-int ldb_objectclass_init(void)
-{
-       return ldb_register_module(&objectclass_ops);
-}
-
index bf57f5c21ba6194ba685244f06b0e1bc6c9c2f08..f62839389d2c6b70274da08e281dfb3af9ada880 100644 (file)
@@ -247,14 +247,8 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
        return ret;
 }
 
-static const struct ldb_module_ops objectguid_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_objectguid_module_ops = {
        .name          = "objectguid",
        .add           = objectguid_add,
        .modify        = objectguid_modify,
 };
-
-
-int objectguid_module_init(void)
-{
-       return ldb_register_module(&objectguid_ops);
-}
index 61b64441a749ac817d3e593719d9099b52341a94..78b5a09f78bc245c964bdeab44ab54e65e05e69a 100644 (file)
@@ -87,7 +87,7 @@ static struct ldb_module *make_module_for_next_request(TALLOC_CTX *mem_ctx,
                                                       struct ldb_module *module)
 {
        struct ldb_module *current;
-       static const struct ldb_module_ops ops; /* zero */
+_PUBLIC_       static const struct ldb_module_ops ops; /* zero */
        current = talloc_zero(mem_ctx, struct ldb_module);
        if (current == NULL) {
                return module;
@@ -1030,7 +1030,7 @@ static int partition_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops partition_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_partition_module_ops = {
        .name              = "partition",
        .init_context      = partition_init,
        .search            = partition_search,
@@ -1045,8 +1045,3 @@ static const struct ldb_module_ops partition_ops = {
        .del_transaction   = partition_del_trans,
        .wait              = partition_wait
 };
-
-int ldb_partition_init(void)
-{
-       return ldb_register_module(&partition_ops);
-}
index 57c053d961829ce678d41a99e394f44e21e36211..aa64700f2f8d297be2f1f9280ec9f6ba76854573 100644 (file)
@@ -2044,15 +2044,9 @@ static int password_hash_wait(struct ldb_handle *handle, enum ldb_wait_type type
        }
 }
 
-static const struct ldb_module_ops password_hash_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_password_hash_module_ops = {
        .name          = "password_hash",
        .add           = password_hash_add,
        .modify        = password_hash_modify,
        .wait          = password_hash_wait
 };
-
-
-int password_hash_module_init(void)
-{
-       return ldb_register_module(&password_hash_ops);
-}
index 0f3293ed1db7a58309e2a436d27466e9b00562a4..09d56d77c93890f5bca149d6c2e0ad0ad9676390 100644 (file)
@@ -115,12 +115,7 @@ static int pdc_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops pdc_fsmo_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_pdc_fsmo_module_ops = {
        .name           = "pdc_fsmo",
        .init_context   = pdc_fsmo_init
 };
-
-int pdc_fsmo_module_init(void)
-{
-       return ldb_register_module(&pdc_fsmo_ops);
-}
index 37ee7f9fce82cdb4b3ff21138c614f065e6dee22..0d065425ca7efdb4610d8e0e448b477fae44067c 100644 (file)
@@ -331,12 +331,7 @@ static int proxy_request(struct ldb_module *module, struct ldb_request *req)
        }
 }
 
-static const struct ldb_module_ops proxy_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_proxy_module_ops = {
        .name           = "proxy",
        .request        = proxy_request
 };
-
-int proxy_module_init(void)
-{
-       return ldb_register_module(&proxy_ops);
-}
index c527afc6db30a9e8094825ed19964d19d056d92d..c6ebea1044e8ecd5597837e38a85ecdafd5cd012 100644 (file)
@@ -201,12 +201,7 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
        return ldb_next_request(module, req);
 }
 
-static const struct ldb_module_ops rr_ops = {
+const struct ldb_module_ops ldb_ranged_results_module_ops = {
        .name              = "ranged_results",
        .search            = rr_search,
 };
-
-int ldb_ranged_results_init(void)
-{
-       return ldb_register_module(&rr_ops);
-}
index 441dbc95983a9167079140c2949352ecc552a3ba..dd5faf837aba3b01db50879c9b7636d5b5aad177 100644 (file)
@@ -1579,15 +1579,10 @@ static int replmd_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        }
 }
 
-static const struct ldb_module_ops replmd_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_repl_meta_data_module_ops = {
        .name          = "repl_meta_data",
        .add           = replmd_add,
        .modify        = replmd_modify,
        .extended      = replmd_extended,
        .wait          = replmd_wait
 };
-
-int repl_meta_data_module_init(void)
-{
-       return ldb_register_module(&replmd_ops);
-}
index 02f43d7076ac15e7c3806583d2d31dfd73a4f71c..3235b24ef90a4ce71dc4f0de67b1f1c0f2dc14c5 100644 (file)
@@ -386,15 +386,9 @@ static int rootdse_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops rootdse_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_rootdse_module_ops = {
        .name                   = "rootdse",
        .init_context           = rootdse_init,
        .search                 = rootdse_search,
        .request                = rootdse_request
 };
-
-int rootdse_module_init(void)
-{
-       return ldb_register_module(&rootdse_ops);
-}
-
index 3a666b5380fd1be42f35043a6fecc65a3cdc8035..88b04b1bb6e63de6eefc1df604cb8e844e4b4694 100644 (file)
@@ -925,21 +925,8 @@ static int samba3sam_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static struct ldb_module_ops samba3sam_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_samba3sam_module_ops = {
+       LDB_MAP_OPS
        .name              = "samba3sam",
        .init_context      = samba3sam_init,
 };
-
-/* the init function */
-int ldb_samba3sam_module_init(void)
-{
-       struct ldb_module_ops ops = ldb_map_get_ops();
-       samba3sam_ops.add       = ops.add;
-       samba3sam_ops.modify    = ops.modify;
-       samba3sam_ops.del       = ops.del;
-       samba3sam_ops.rename    = ops.rename;
-       samba3sam_ops.search    = ops.search;
-       samba3sam_ops.wait      = ops.wait;
-
-       return ldb_register_module(&samba3sam_ops);
-}
index baf419c750def7db6486ab1c11c45a2ad819a7cc..178149a8865d335db6252c9f2344519e73590ca8 100644 (file)
@@ -750,14 +750,8 @@ static int samldb_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops samldb_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_samldb_module_ops = {
        .name          = "samldb",
        .init_context  = samldb_init,
        .add           = samldb_add,
 };
-
-
-int samldb_module_init(void)
-{
-       return ldb_register_module(&samldb_ops);
-}
index 525193ac8c05e45d9ccd50efdc7903b7d296112d..ff9530ca92b0bfd69390f32c2b1919f937c3a7c8 100644 (file)
@@ -1221,7 +1221,7 @@ static int schema_init(struct ldb_module *module)
        return LDB_SUCCESS;
 }
 
-static const struct ldb_module_ops schema_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_schema_module_ops = {
        .name          = "schema",
        .init_context  = schema_init,
        .add           = schema_add,
@@ -1230,8 +1230,3 @@ static const struct ldb_module_ops schema_ops = {
        .rename        = schema_rename,
        .wait          = schema_wait
 };
-
-int ldb_schema_init(void)
-{
-       return ldb_register_module(&schema_ops);
-}
index f9dd131fd4f8327ab323aa0f2c57fb22913a0c12..729fd15202ccea5ef9c9d306f68b77d302730c0a 100644 (file)
@@ -255,12 +255,7 @@ static int schema_fsmo_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops schema_fsmo_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_schema_fsmo_module_ops = {
        .name           = "schema_fsmo",
        .init_context   = schema_fsmo_init
 };
-
-int schema_fsmo_module_init(void)
-{
-       return ldb_register_module(&schema_fsmo_ops);
-}
index 19fa63fb6e92bbfc100fb7e460deab8eba7efd79..361cf226dc331b1a8a46059213c512552983fb81 100644 (file)
@@ -194,13 +194,8 @@ static int show_deleted_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops show_deleted_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_show_deleted_module_ops = {
        .name              = "show_deleted",
        .search            = show_deleted_search,
        .init_context      = show_deleted_init
 };
-
-int ldb_show_deleted_init(void)
-{
-       return ldb_register_module(&show_deleted_ops);
-}
index acf2fd622cc29ddb04134ec055d5dba6e5d53b99..3f4c19d28521f6bf2c462842ab524afdbd0c84ee 100644 (file)
@@ -793,42 +793,16 @@ static int entryuuid_sequence_number(struct ldb_module *module, struct ldb_reque
        return LDB_SUCCESS;
 }
 
-static struct ldb_module_ops entryuuid_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_entryuuid_module_ops = {
        .name              = "entryuuid",
        .init_context      = entryuuid_init,
-       .sequence_number   = entryuuid_sequence_number
+       .sequence_number   = entryuuid_sequence_number,
+       LDB_MAP_OPS
 };
 
-static struct ldb_module_ops nsuniqueid_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_nsuniqueid_module_ops = {
        .name              = "nsuniqueid",
        .init_context      = nsuniqueid_init,
-       .sequence_number   = entryuuid_sequence_number
+       .sequence_number   = entryuuid_sequence_number,
+       LDB_MAP_OPS
 };
-
-/* the init function */
-int ldb_simple_ldap_map_module_init(void)
-{
-       int ret;
-       struct ldb_module_ops ops = ldb_map_get_ops();
-       entryuuid_ops.add       = ops.add;
-       entryuuid_ops.modify    = ops.modify;
-       entryuuid_ops.del       = ops.del;
-       entryuuid_ops.rename    = ops.rename;
-       entryuuid_ops.search    = ops.search;
-       entryuuid_ops.wait      = ops.wait;
-       ret = ldb_register_module(&entryuuid_ops);
-
-       if (ret) {
-               return ret;
-       }
-
-       nsuniqueid_ops.add      = ops.add;
-       nsuniqueid_ops.modify   = ops.modify;
-       nsuniqueid_ops.del      = ops.del;
-       nsuniqueid_ops.rename   = ops.rename;
-       nsuniqueid_ops.search   = ops.search;
-       nsuniqueid_ops.wait     = ops.wait;
-       ret = ldb_register_module(&nsuniqueid_ops);
-
-       return ret;
-}
index e84bf60b328074e9c27327e48849d842eb2caa58..56ae7b239a2feef296815df152f03b5da6940a56 100644 (file)
@@ -247,13 +247,8 @@ static int subtree_delete_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops subtree_delete_ops = {
+const struct ldb_module_ops ldb_subtree_delete_module_ops = {
        .name              = "subtree_delete",
        .del               = subtree_delete,
        .wait              = subtree_delete_wait,
 };
-
-int ldb_subtree_delete_init(void)
-{
-       return ldb_register_module(&subtree_delete_ops);
-}
index 0964c3fdcd6567bb3ff2112367488c2bdb338944..bf8124e253acf51f5eda11e22566fbbc5dc2d8b8 100644 (file)
@@ -264,13 +264,8 @@ static int subtree_rename_wait(struct ldb_handle *handle, enum ldb_wait_type typ
        }
 }
 
-static const struct ldb_module_ops subtree_rename_ops = {
+const struct ldb_module_ops ldb_subtree_rename_module_ops = {
        .name              = "subtree_rename",
        .rename            = subtree_rename,
        .wait              = subtree_rename_wait,
 };
-
-int ldb_subtree_rename_init(void)
-{
-       return ldb_register_module(&subtree_rename_ops);
-}
index a18efd757aa6803a657e5e1176aa26a1c722f368..54362dcfd47157b4fac33f57cddd4de6969e5cf1 100644 (file)
@@ -199,7 +199,7 @@ static int update_kt_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops update_kt_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_update_keytab_module_ops = {
        .name              = "update_keytab",
        .init_context      = update_kt_init,
        .add               = update_kt_add,
@@ -209,8 +209,3 @@ static const struct ldb_module_ops update_kt_ops = {
        .end_transaction   = update_kt_end_trans,
        .del_transaction   = update_kt_del_trans,
 };
-
-int ldb_update_kt_init(void)
-{
-       return ldb_register_module(&update_kt_ops);
-}
index 1379ddee9fbb6331692b011d5cb640609c5eb8fb..bb3423546508ba686eda88b4d3af99693650fb2a 100644 (file)
@@ -149,6 +149,8 @@ struct dsdb_schema {
 
        struct dsdb_attribute *attributes;
        struct dsdb_class *classes;
+
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 #include "dsdb/schema/proto.h"
index 6a7463951e57a03ff658e73f0950693d14bfbca1..30d0adeda73b6319f7b40d7daf68b59d829c9689 100644 (file)
@@ -88,8 +88,7 @@ WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema,
        TALLOC_CTX *mem_ctx = talloc_new(schema);
        W_ERROR_HAVE_NO_MEMORY(mem_ctx);
        
-       ndr_err = ndr_pull_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm,
-                                      (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
+       ndr_err = ndr_pull_struct_blob(prefixMap, mem_ctx, schema->iconv_convenience, &pfm, (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
                talloc_free(mem_ctx);
@@ -181,8 +180,7 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema,
        pfm.reserved    = 0;
        pfm.ctr.dsdb    = *ctr;
 
-       ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, lp_iconv_convenience(global_loadparm), &pfm,
-                                      (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
+       ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, schema->iconv_convenience, &pfm, (ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
        talloc_free(ctr);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err);
@@ -628,7 +626,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
        } \
        if (_a && _a->value_ctr.num_values >= 1) { \
                ssize_t _ret; \
-               _ret = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, \
+               _ret = convert_string_talloc(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \
                                             _a->value_ctr.values[0].blob->data, \
                                             _a->value_ctr.values[0].blob->length, \
                                             (void **)discard_const(&(p)->elem)); \
@@ -665,7 +663,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
                struct drsuapi_DsReplicaObjectIdentifier3 _id3; \
                enum ndr_err_code _ndr_err; \
                _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
-                                                     mem_ctx, lp_iconv_convenience(global_loadparm), &_id3,\
+                                                     mem_ctx, s->iconv_convenience, &_id3,\
                                                      (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);\
                if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
                        NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
@@ -727,7 +725,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
            && _a->value_ctr.values[0].blob->length == 16) { \
                enum ndr_err_code _ndr_err; \
                _ndr_err = ndr_pull_struct_blob_all(_a->value_ctr.values[0].blob, \
-                                                     mem_ctx, lp_iconv_convenience(global_loadparm), &(p)->elem, \
+                                                     mem_ctx, s->iconv_convenience, &(p)->elem, \
                                                      (ndr_pull_flags_fn_t)ndr_pull_GUID); \
                if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
                        NTSTATUS _nt_status = ndr_map_error2ntstatus(_ndr_err); \
@@ -1157,6 +1155,8 @@ WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf
                goto nomem;
        }
 
+       schema->iconv_convenience = lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm"));
+
        /*
         * load the prefixMap attribute from pf
         */
index 2c133b64242185ddd9fe125e816d304b7115ba6f..beacfc49c2621694a8c7a073da8c8a52d3848665 100644 (file)
@@ -767,7 +767,8 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(const struct dsdb_schema *schem
                        return WERR_FOOBAR;
                }
 
-               ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
+               ret = convert_string_talloc(out->values, schema->iconv_convenience, 
+                                                                       CH_UTF16, CH_UNIX,
                                            in->value_ctr.values[i].blob->data,
                                            in->value_ctr.values[i].blob->length,
                                            (void **)&str);
@@ -809,7 +810,7 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(const struct dsdb_schema *schem
 
                out->value_ctr.values[i].blob   = &blobs[i];
 
-               ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
+               ret = convert_string_talloc(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
                                            in->values[i].data,
                                            in->values[i].length,
                                            (void **)&blobs[i].data);
@@ -851,7 +852,7 @@ static WERROR dsdb_syntax_DN_drsuapi_to_ldb(const struct dsdb_schema *schema,
                }
 
                ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
-                                                  out->values, lp_iconv_convenience(global_loadparm), &id3,
+                                                  out->values, schema->iconv_convenience, &id3,
                                                   (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -898,7 +899,7 @@ static WERROR dsdb_syntax_DN_ldb_to_drsuapi(const struct dsdb_schema *schema,
                ZERO_STRUCT(id3);
                id3.dn = (const char *)in->values[i].data;
 
-               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
+               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, schema->iconv_convenience, &id3, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
                        return ntstatus_to_werror(status);
@@ -939,7 +940,7 @@ static WERROR dsdb_syntax_DN_BINARY_drsuapi_to_ldb(const struct dsdb_schema *sch
                }
 
                ndr_err = ndr_pull_struct_blob_all(in->value_ctr.values[i].blob,
-                                                  out->values, lp_iconv_convenience(global_loadparm), &id3b,
+                                                  out->values, schema->iconv_convenience, &id3b,
                                                   (ndr_pull_flags_fn_t)ndr_pull_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -997,7 +998,7 @@ static WERROR dsdb_syntax_DN_BINARY_ldb_to_drsuapi(const struct dsdb_schema *sch
                id3b.dn         = (const char *)in->values[i].data;
                id3b.binary     = data_blob(NULL, 0);
 
-               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, lp_iconv_convenience(global_loadparm), &id3b,
+               ndr_err = ndr_push_struct_blob(&blobs[i], blobs, schema->iconv_convenience, &id3b,
                                               (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3Binary);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                        NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -1043,7 +1044,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(const struct dsdb_
                        return WERR_FOOBAR;
                }
 
-               ret = convert_string_talloc(out->values, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
+               ret = convert_string_talloc(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX,
                                            in->value_ctr.values[i].blob->data+4,
                                            in->value_ctr.values[i].blob->length-4,
                                            (void **)&str);
@@ -1086,7 +1087,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(const struct dsdb_
 
                out->value_ctr.values[i].blob   = &blobs[i];
 
-               ret = convert_string_talloc(blobs, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16,
+               ret = convert_string_talloc(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
                                            in->values[i].data,
                                            in->values[i].length,
                                            (void **)&data);
index 9c872da3e83c69e79f7ecae527749f36a13798a8..e970d4cd4c01032eaadb21376760da0558940f6b 100644 (file)
@@ -4,20 +4,20 @@ OBJ_FILES = dynconfig.o
 # set these to where to find various files
 # These can be overridden by command line switches (see smbd(8))
 # or in smb.conf (see smb.conf(5))
-CONFIGFILE = $(CONFIGDIR)/smb.conf
-PKGCONFIGDIR = $(LIBDIR)/pkgconfig
-LMHOSTSFILE = $(CONFIGDIR)/lmhosts
+CONFIGFILE = $(sysconfdir)/smb.conf
+PKGCONFIGDIR = $(libdir)/pkgconfig
+LMHOSTSFILE = $(sysconfdir)/lmhosts
 
 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \
-        -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
-        -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DDATADIR=\"$(DATADIR)\" \
-        -DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-        -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
+        -DBINDIR=\"$(bindir)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
+        -DLOCKDIR=\"$(lockdir)\" -DPIDDIR=\"$(piddir)\" -DDATADIR=\"$(datadir)\" \
+        -DLOGFILEBASE=\"$(logfilebase)\" \
+        -DCONFIGDIR=\"$(sysconfdir)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
         -DSWATDIR=\"$(SWATDIR)\" \
-        -DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
-        -DMODULESDIR=\"$(MODULESDIR)\" -DJSDIR=\"$(JSDIR)\" \
+        -DPRIVATE_DIR=\"$(privatedir)\" \
+        -DMODULESDIR=\"$(modulesdir)\" -DJSDIR=\"$(JSDIR)\" \
         -DTORTUREDIR=\"$(TORTUREDIR)\" \
-        -DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(WINBINDD_SOCKET_DIR)\"
+        -DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(winbindd_socket_dir)\"
 
 dynconfig.o: dynconfig.c Makefile
        @echo Compiling $<
index acbe81328e2026138d9ea97437a63c9bc8b1b16f..70ca92c01ca689fbdf5c0274b6a604780599a715 100644 (file)
@@ -120,3 +120,4 @@ lib/util/wrap_xattr.h: wrap_xattr.h
 lib/events/events.h: events/events.h
 lib/events/events_internal.h: events/events_internal.h
 libcli/ldap/ldap_ndr.h: ldb/ldap_ndr.h
+lib/gencache/gencache.h: gencache.h
index 604516ccf640a88d16d4b7c08fd2fc3195e80b12..45bfd8e81f0a79f13b4355c16287f916d403167d 100644 (file)
@@ -15,8 +15,7 @@ OBJ_FILES = \
        ../heimdal/kdc/digest.o \
        ../heimdal/kdc/process.o \
        ../heimdal/kdc/windc.o \
-       ../heimdal/kdc/kx509.o \
-       ../heimdal/lib/asn1/asn1_KRB5SignedPath.o
+       ../heimdal/kdc/kx509.o
 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
@@ -31,10 +30,9 @@ PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5
 [SUBSYSTEM::HEIMDAL_HDB_KEYS]
 CFLAGS = -Iheimdal_build -Iheimdal/lib/hdb
 OBJ_FILES = \
-       ../heimdal/lib/hdb/keys.o \
-       ../heimdal/lib/hdb/asn1_Key.o \
-       ../heimdal/lib/hdb/asn1_Salt.o
-PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5
+       ../heimdal/lib/hdb/keys.o
+PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_HCRYPTO HEIMDAL_KRB5 \
+                                          HEIMDAL_HDB_ASN1
 
 #######################
 # Start SUBSYSTEM HEIMDAL_HDB
@@ -278,9 +276,7 @@ OBJ_FILES = \
        ../heimdal/lib/asn1/der_cmp.o \
        ../heimdal/lib/asn1/extra.o \
        ../heimdal/lib/asn1/timegm.o \
-       ../heimdal/lib/asn1/asn1_err.o \
-       ../heimdal/lib/asn1/asn1_krb5int32.o \
-       ../heimdal/lib/asn1/asn1_krb5uint32.o
+       ../heimdal/lib/asn1/asn1_err.o
 PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_COM_ERR
 # End SUBSYSTEM HEIMDAL_KRB5
 #######################
@@ -341,7 +337,7 @@ PRIVATE_DEPENDENCIES = \
        HEIMDAL_CMS_ASN1 HEIMDAL_RFC2459_ASN1 \
        HEIMDAL_OCSP_ASN1 HEIMDAL_PKCS8_ASN1 \
        HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 \
-       HEIMDAL_PKINIT_ASN1
+       HEIMDAL_PKINIT_ASN1 HEIMDAL_PKCS10_ASN1
 OBJ_FILES = \
        ../heimdal/lib/hx509/ca.o \
        ../heimdal/lib/hx509/cert.o \
@@ -412,7 +408,6 @@ OBJ_FILES = \
        ../heimdal/lib/roken/estrdup.o \
        ../heimdal/lib/roken/erealloc.o \
        ../heimdal/lib/roken/simple_exec.o \
-       ../heimdal/lib/roken/simple_exec.o \
        ../heimdal/lib/roken/strcollect.o \
        ../heimdal/lib/roken/rtbl.o \
        replace.o
@@ -511,32 +506,32 @@ PRIVATE_DEPENDENCIES = HEIMDAL_COM_ERR_COMPILE_LEX HEIMDAL_ROKEN_GETPROGNAME_H E
 # End BINARY compile_et
 #######################
 
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hdb/hdb.asn1 hdb_asn1 heimdal/lib/hdb |
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/spnego/spnego.asn1 spnego_asn1 heimdal/lib/gssapi --sequence=MechTypeList |
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/mech/gssapi.asn1 gssapi_asn1 heimdal/lib/gssapi|
-include 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|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/digest.asn1 digest_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs8.asn1 pkcs8_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs9.asn1 pkcs9_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkcs12.asn1 pkcs12_asn1 heimdal/lib/asn1|
-include 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|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/pkinit.asn1 pkinit_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/CMS.asn1 cms_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hx509/ocsp.asn1 ocsp_asn1 heimdal/lib/hx509 --preserve-binary=OCSPTBSRequest --preserve-binary=OCSPResponseData|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/kx509.asn1 kx509_asn1 heimdal/lib/asn1|
-include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hx509/pkcs10.asn1 pkcs10_asn1 heimdal/lib/hx509 --preserve-binary=CertificationRequestInfo|
+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|
 
 #
 # Ensure to update ../static_deps.mk when you add a new entry here!
 #
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/asn1/asn1_err.et heimdal/lib/asn1|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/hdb/hdb_err.et heimdal/lib/hdb|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/heim_err.et heimdal/lib/krb5|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/k524_err.et heimdal/lib/krb5|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/krb_err.et heimdal/lib/krb5|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/krb5_err.et heimdal/lib/krb5|
-include perl_path_wrapper.sh et_deps.pl heimdal/lib/gssapi/krb5/gkrb5_err.et heimdal/lib/gssapi|
-include 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/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|
 
 clean::        
        @-rm -f bin/compile_et bin/asn1_compile
index c7873435150f5950fe8351a85ebe23d7b00c9a98..479cb36296ffa0bcaeedac32ea060a8620fdcf91 100644 (file)
@@ -22,7 +22,8 @@ OBJ_FILES = \
                hdb-ldb.o \
                pac-glue.o 
 PRIVATE_DEPENDENCIES = \
-               LIBLDB auth_sam auth_sam_reply KERBEROS CREDENTIALS
+               LIBLDB auth_sam auth_sam_reply KERBEROS CREDENTIALS \
+               HEIMDAL_HDB_ASN1
 # End SUBSYSTEM KDC
 #######################
 
index 86537790441f6e9db4612cf1b0076e2848b963a3..a118636c5205b7d8eb04d185dab3757ba2261ae8 100644 (file)
@@ -1,32 +1,28 @@
 # LIB BASIC subsystem
-include samba3/config.mk
-include socket/config.mk
-include charset/config.mk
-include ldb-samba/config.mk
-include tls/config.mk
-include registry/config.mk
-include policy/config.mk
-include messaging/config.mk
-include events/config.mk
-include cmdline/config.mk
-include socket_wrapper/config.mk
-include nss_wrapper/config.mk
-include appweb/config.mk
-include stream/config.mk
-include util/config.mk
-include tdr/config.mk
-include dbwrap/config.mk
-include crypto/config.mk
+mkinclude samba3/config.mk
+mkinclude socket/config.mk
+mkinclude charset/config.mk
+mkinclude ldb-samba/config.mk
+mkinclude tls/config.mk
+mkinclude registry/config.mk
+mkinclude policy/config.mk
+mkinclude messaging/config.mk
+mkinclude events/config.mk
+mkinclude cmdline/config.mk
+mkinclude socket_wrapper/config.mk
+mkinclude nss_wrapper/config.mk
+mkinclude appweb/config.mk
+mkinclude stream/config.mk
+mkinclude util/config.mk
+mkinclude tdr/config.mk
+mkinclude dbwrap/config.mk
+mkinclude crypto/config.mk
 
-################################################
-# Start SUBSYSTEM LIBCOMPRESSION
 [SUBSYSTEM::LIBCOMPRESSION]
 OBJ_FILES = compression/mszip.o
-# End SUBSYSTEM LIBCOMPRESION
-################################################
 
 [SUBSYSTEM::GENCACHE]
-PRIVATE_PROTO_HEADER = gencache/gencache.h
+PUBLIC_HEADERS = gencache/gencache.h
 OBJ_FILES = gencache/gencache.o
 PRIVATE_DEPENDENCIES = TDB_WRAP
 
index 3f9eeb5617cdef24bd68bfb23ed54c255ca78040..f4b7e4e5ebd1f67735a8c35b365dbcf55652a679 100644 (file)
@@ -300,7 +300,7 @@ bool events_select_init(void)
 }
 
 #if _SAMBA_BUILD_
-NTSTATUS s4_events_select_init(void)
+_PUBLIC_ NTSTATUS s4_events_select_init(void)
 {
        if (!events_select_init()) {
                return NT_STATUS_INTERNAL_ERROR;
index 5e529d66ab483bb0f2d1984a22b7ce9690958f3c..7b945b154d96780d1ff9a113b7f49afaa070991a 100644 (file)
@@ -602,7 +602,7 @@ bool events_standard_init(void)
 }
 
 #if _SAMBA_BUILD_
-NTSTATUS s4_events_standard_init(void)
+_PUBLIC_ NTSTATUS s4_events_standard_init(void)
 {
        if (!events_standard_init()) {
                return NT_STATUS_INTERNAL_ERROR;
diff --git a/source/lib/gencache/gencache.h b/source/lib/gencache/gencache.h
new file mode 100644 (file)
index 0000000..1481676
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __LIB_GENCACHE_GENCACHE_H__
+#define __LIB_GENCACHE_GENCACHE_H__
+
+/**
+ * Cache initialisation function. Opens cache tdb file or creates
+ * it if does not exist.
+ *
+ * @return true on successful initialisation of the cache or
+ *         false on failure
+ **/
+bool gencache_init(struct loadparm_context *lp_ctx);
+
+/**
+ * Cache shutdown function. Closes opened cache tdb file.
+ *
+ * @return true on successful closing the cache or
+ *         false on failure during cache shutdown
+ **/
+bool gencache_shutdown(void);
+
+/**
+ * Set an entry in the cache file. If there's no such
+ * one, then add it.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param value text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly stored
+ * @retval false on failure
+ **/
+bool gencache_set(const char *keystr, const char *value, time_t timeout);
+
+/**
+ * Set existing entry to the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly set
+ * @retval false on failure
+ **/
+bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout);
+
+/**
+ * Delete one entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ *
+ * @retval true upon successful deletion
+ * @retval false in case of failure
+ **/
+bool gencache_del(const char *keystr);
+
+/**
+ * Get existing entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr buffer that is allocated and filled with the entry value
+ *        buffer's disposing must be done outside
+ * @param timeout pointer to a time_t that is filled with entry's
+ *        timeout
+ *
+ * @retval true when entry is successfuly fetched
+ * @retval false for failure
+ **/
+bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+
+/**
+ * Iterate through all entries which key matches to specified pattern
+ *
+ * @param fn pointer to the function that will be supplied with each single
+ *        matching cache entry (key, value and timeout) as an arguments
+ * @param data void pointer to an arbitrary data that is passed directly to the fn
+ *        function on each call
+ * @param keystr_pattern pattern the existing entries' keys are matched to
+ *
+ **/
+void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
+                      void* data, const char* keystr_pattern);
+
+/********************************************************************
+ lock a key
+********************************************************************/
+int gencache_lock_entry( const char *key );
+
+/********************************************************************
+ unlock a key
+********************************************************************/
+void gencache_unlock_entry( const char *key );
+
+#endif /* __LIB_GENCACHE_GENCACHE_H__ */
+
index 7bd719cdd98a9c88c373fc4c2f2b49644ca20d56..d88f82b726fe738dd2d50cd1e3ee16c62cdd49b2 100644 (file)
@@ -19,6 +19,11 @@ SWIG = swig
 EXTRA_OBJ=@EXTRA_OBJ@
 TESTS=test-tdb.sh @TESTS@
 PACKAGE_VERSION = @PACKAGE_VERSION@
+PYTHON = @PYTHON@
+PYTHON_CONFIG = @PYTHON_CONFIG@
+tdbdir = @tdbdir@
+ldbdir = $(srcdir)
+tallocdir = @tallocdir@
 
 TALLOC_LIBS = @TALLOC_LIBS@
 TALLOC_CFLAGS = @TALLOC_CFLAGS@
@@ -53,35 +58,6 @@ CFLAGS=-g -I$(srcdir)/include -Iinclude -I$(srcdir) -I$(srcdir)/.. \
 MDLD = @MDLD@
 MDLD_FLAGS = @MDLD_FLAGS@
 
-LDB_LIB = $(STATICLIB)
-
-LIB_FLAGS=$(LDFLAGS) -Llib $(LDB_LIB) $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
-                 $(TDB_LIBS) $(LDAP_LIBS) $(LIBDL)
-
-LDB_TDB_DIR=ldb_tdb
-LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \
-       $(LDB_TDB_DIR)/ldb_pack.o $(LDB_TDB_DIR)/ldb_search.o $(LDB_TDB_DIR)/ldb_index.o \
-       $(LDB_TDB_DIR)/ldb_cache.o $(LDB_TDB_DIR)/ldb_tdb_wrap.o
-
-LDB_MAP_DIR=ldb_map
-LDB_MAP_OBJ=$(LDB_MAP_DIR)/ldb_map.o $(LDB_MAP_DIR)/ldb_map_inbound.o \
-           $(LDB_MAP_DIR)/ldb_map_outbound.o
-
-COMDIR=common
-COMMON_OBJ=$(COMDIR)/ldb.o $(COMDIR)/ldb_ldif.o \
-          $(COMDIR)/ldb_parse.o $(COMDIR)/ldb_msg.o $(COMDIR)/ldb_utf8.o \
-          $(COMDIR)/ldb_debug.o $(COMDIR)/ldb_modules.o \
-          $(COMDIR)/ldb_dn.o $(COMDIR)/ldb_match.o $(COMDIR)/ldb_attributes.o \
-          $(COMDIR)/attrib_handlers.o $(COMDIR)/ldb_controls.o $(COMDIR)/qsort.o
-
-MODDIR=modules
-MODULES_OBJ=$(MODDIR)/operational.o $(MODDIR)/rdn_name.o \
-          $(MODDIR)/paged_results.o $(MODDIR)/sort.o $(MODDIR)/asq.o
-
-NSSDIR=nssldb
-NSS_OBJ= $(NSSDIR)/ldb-nss.o $(NSSDIR)/ldb-pwd.o $(NSSDIR)/ldb-grp.o
-NSS_LIB = lib/libnss_ldb.$(SHLIBEXT).2
-
 OBJS = $(MODULES_OBJ) $(COMMON_OBJ) $(LDB_TDB_OBJ) $(TDB_OBJ) $(TALLOC_OBJ) $(POPT_OBJ) $(LDB_MAP_OBJ) @LIBREPLACEOBJ@ $(EXTRA_OBJ) 
 
 headers = $(srcdir)/include/ldb.h $(srcdir)/include/ldb_errors.h $(srcdir)/include/ldb_handlers.h
@@ -94,6 +70,8 @@ DIRS = lib bin common ldb_tdb ldb_ldap ldb_sqlite3 modules tools examples
 
 default: all
 
+include $(ldbdir)/rules.mk
+
 nss: nssdir all $(NSS_LIB)
 
 nssdir:
@@ -109,76 +87,22 @@ lib/$(SONAME): $(SOLIB)
 lib/libldb.$(SHLIBEXT): $(SOLIB)
        ln -fs libldb.$(SHLIBEXT).$(PACKAGE_VERSION) $@
 
+lib/libnss_ldb.$(SHLIBEXT).2: $(NSS_OBJ) $(SOLIB)
+       $(SHLD) $(SHLD_FLAGS) -o $@ $(NSS_OBJ) $(LDFLAGS) $(SOLIB) @SONAMEFLAG@libnss_ldb.$(SHLIBEXT).2
+
 $(SOLIB): $(OBJS)
        $(SHLD) $(SHLD_FLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) $(TALLOC_LIBS) $(TDB_LIBS) $(LIBDL) $(LDAP_LIBS) @SONAMEFLAG@$(SONAME)
 
 all: showflags dirs $(OBJS) $(STATICLIB) $(SOLIB) $(BINS) $(EXAMPLES) manpages \
        @PYTHON_BUILD_TARGET@
 
-showflags:
-       @echo 'ldb will be compiled with flags:'
-       @echo '  CFLAGS = $(CFLAGS)'
-       @echo '  LIBS = $(LIBS)'
-
-.c.o:
-       @echo Compiling $*.c
-       @mkdir -p `dirname $@`
-       @$(CC) $(CFLAGS) $(PICFLAG) -c $< -o $@
-
-.c.po:
-       @echo Compiling $*.c
-       @mkdir -p `dirname $@`
-       @$(CC) -fPIC $(CFLAGS) -c $< -o $@
-
 dirs:
        @mkdir -p $(DIRS)
 
-lib/libldb.a: $(OBJS)
-       ar -rv $@ $(OBJS)
-       @-ranlib $@
-
-lib/libnss_ldb.$(SHLIBEXT).2: $(NSS_OBJ) $(SOLIB)
-       $(SHLD) $(SHLD_FLAGS) -o $@ $(NSS_OBJ) $(LDFLAGS) $(SOLIB) @SONAMEFLAG@libnss_ldb.$(SHLIBEXT).2
-
-sample_module.$(SHLIBEXT): tests/sample_module.o
-       $(MDLD) $(MDLD_FLAGS) -o $@ tests/sample_module.o
-
-bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbdel: tools/ldbdel.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbedit: tools/ldbedit.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbrename: tools/ldbrename.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/ldbtest: tools/ldbtest.o tools/cmdline.o $(LIBS)
-       $(CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
-
-bin/oLschema2ldif: tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIBS)
-       $(CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIB_FLAGS)
-
-examples/ldbreader: examples/ldbreader.o $(LIBS)
-       $(CC) -o examples/ldbreader examples/ldbreader.o $(LIB_FLAGS)
-
-examples/ldifreader: examples/ldifreader.o $(LIBS)
-       $(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
-
-.SUFFIXES: .1 .1.xml .3 .3.xml .xml .html .c .o
-
-manpages:
+manpages::
        @$(srcdir)/docs/builddocs.sh "$(XSLTPROC)" "$(srcdir)"
 
-doxygen:
+doxygen::
        test -z "$(DOXYGEN)" || (cd $(srcdir) && "$(DOXYGEN)")
 
 clean::
@@ -191,7 +115,6 @@ clean::
        rm -rf tests/schema/
 
 distclean:: clean
-       rm -f *~ */*~
        rm -rf bin lib
        rm -f config.log config.status config.cache include/config.h
        rm -f ldb.pc
@@ -200,39 +123,39 @@ distclean:: clean
 realdistclean:: distclean
        rm -f configure.in include/config.h.in
 
-check:: test check-soloading
+check:: test @PYTHON_CHECK_TARGET@
 
-check-soloading: sample_module.$(SHLIBEXT)
+check-soloading: sample.$(SHLIBEXT)
        LDB_MODULES_PATH=$(builddir) $(srcdir)/tests/test-soloading.sh
 
-test: all check-soloading
+test:: all check-soloading
        for t in $(TESTS); do echo STARTING $${t}; $(srcdir)/tests/$${t} || exit 1; done
 
-valgrindtest: all
+valgrindtest:: all
        for t in $(TESTS); do echo STARTING $${t}; VALGRIND="valgrind -q --db-attach=yes --num-callers=30" $(srcdir)/tests/$${t} || exit 1; done
 
-installcheck: install test
+installcheck:: install test
 
 install:: all installdirs installheaders installlibs installbin installdocs \
                @PYTHON_INSTALL_TARGET@
 
-installdirs:
+installdirs::
        mkdir -p $(DESTDIR)$(includedir) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pkgconfig 
 
-installheaders: installdirs
+installheaders:: installdirs
        cp $(headers) $(DESTDIR)$(includedir)
 
-installlibs: installdirs
+installlibs:: installdirs
        cp $(STATICLIB) $(SOLIB) $(DESTDIR)$(libdir)
        cp ldb.pc $(DESTDIR)$(libdir)/pkgconfig
 
-installbin: installdirs
+installbin:: installdirs
        cp $(BINS) $(DESTDIR)$(bindir)
 
-installdocs: installdirs
+installdocs:: installdirs
        $(srcdir)/docs/installdocs.sh $(DESTDIR)$(mandir)
 
-gcov:
+gcov::
        $(GCOV) -po ldb_sqlite3 $(srcdir)/ldb_sqlite3/*.c 2| tee ldb_sqlite3.report.gcov
        $(GCOV) -po ldb_ldap $(srcdir)/ldb_ldap/*.c 2| tee ldb_ldap.report.gcov
        $(GCOV) -po ldb_tdb $(srcdir)/ldb_tdb/*.c 2| tee ldb_tdb.report.gcov
@@ -240,30 +163,4 @@ gcov:
        $(GCOV) -po modules $(srcdir)/modules/*.c 2| tee modules.report.gcov
        $(GCOV) -po tools $(srcdir)/tools/*.c 2| tee tools.report.gcov
 
-etags:
-       etags `find $(srcdir) -name "*.[ch]"`
-
-ctags:
-       ctags `find $(srcdir) -name "*.[ch]"`
-
-.SUFFIXES: _wrap.c .i
-
-.i_wrap.c:
-       [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -python -keyword $<
-
-# Python bindings
-build-python: lib/libldb.$(SHLIBEXT) ldb_wrap.c
-       ./setup.py build
-
-install-python: build-python
-       ./setup.py install --prefix=$(DESTDIR)$(prefix)
-
-install-swig: 
-       cp ldb.i `$(SWIG) -swiglib`
-
-check-python: build-python
-       # FIXME: This isn't portable
-       LD_LIBRARY_PATH=lib PYTHONPATH=.:build/lib.linux-i686-2.4/ trial tests/python/api.py
-
-clean-python:
-       ./setup.py clean
+include $(ldbdir)/ldb.mk
index 5601a3319126926d829ea710911ffbd728a713c4..3c9ef3ff6939f8095952e48766318be9bb52500c 100644 (file)
@@ -56,20 +56,51 @@ struct ldb_context *ldb_init(void *mem_ctx)
        return ldb;
 }
 
-struct ldb_backend {
-       const char *name;
-       ldb_connect_fn connect_fn;
-       struct ldb_backend *prev, *next;
+static struct backends_list_entry {
+       struct ldb_backend_ops *ops;
+       struct backends_list_entry *prev, *next;
 } *ldb_backends = NULL;
 
+#ifndef STATIC_LIBLDB_BACKENDS 
+
+#ifdef HAVE_LDB_LDAP
+#define LDAP_INIT &ldb_ldap_backend_ops, \
+                                 &ldb_ildap_backend_ops, \
+                                 &ldb_ldaps_backend_ops,
+#else
+#define LDAP_INIT
+#endif
+
+#ifdef HAVE_LDB_SQLITE3
+#define SQLITE3_INIT &ldb_sqlite3_backend_ops,
+#else
+#define SQLITE3_INIT
+#endif
+
+#define STATIC_LIBLDB_BACKENDS \
+       LDAP_INIT \
+       SQLITE3_INIT \
+       &ldb_tdb_backend_ops,   \
+       NULL
+#endif
+
+const static struct ldb_backend_ops *builtin_backends[] = {
+       STATIC_LIBLDB_BACKENDS
+};
 
 static ldb_connect_fn ldb_find_backend(const char *url)
 {
-       struct ldb_backend *backend;
+       struct backends_list_entry *backend;
+       int i;
+
+       for (i = 0; builtin_backends[i]; i++) {
+               if (strncmp(builtin_backends[i]->name, url, strlen(builtin_backends[i]->name)) == 0)
+                       return builtin_backends[i]->connect_fn;
+       }
 
        for (backend = ldb_backends; backend; backend = backend->next) {
-               if (strncmp(backend->name, url, strlen(backend->name)) == 0) {
-                       return backend->connect_fn;
+               if (strncmp(backend->ops->name, url, strlen(backend->ops->name)) == 0) {
+                       return backend->ops->connect_fn;
                }
        }
 
@@ -81,7 +112,8 @@ static ldb_connect_fn ldb_find_backend(const char *url)
 */
 int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn)
 {
-       struct ldb_backend *backend = talloc(talloc_autofree_context(), struct ldb_backend);
+       struct ldb_backend_ops *backend = talloc(talloc_autofree_context(), struct ldb_backend_ops);
+       struct backends_list_entry *entry = talloc(talloc_autofree_context(), struct backends_list_entry);
 
        if (ldb_find_backend(url_prefix)) {
                return LDB_SUCCESS;
@@ -91,7 +123,8 @@ int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn)
 
        backend->name = talloc_strdup(backend, url_prefix);
        backend->connect_fn = connectfn;
-       DLIST_ADD(ldb_backends, backend);
+       entry->ops = backend;
+       DLIST_ADD(ldb_backends, entry);
 
        return LDB_SUCCESS;
 }
@@ -135,6 +168,19 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op
                }
        }
 
+       if (fn == NULL) {
+               struct ldb_backend_ops *ops;
+               char *symbol_name = talloc_asprintf(ldb, "ldb_%s_backend_ops", backend);
+               if (symbol_name == NULL) {
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
+               ops = ldb_dso_load_symbol(ldb, backend, symbol_name);
+               if (ops != NULL) {
+                       fn = ops->connect_fn;
+               }
+               talloc_free(symbol_name);
+       }
+
        talloc_free(backend);
 
        if (fn == NULL) {
@@ -236,7 +282,6 @@ int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, co
        int ret;
        const char *url2;
        /* We seem to need to do this here, or else some utilities don't get ldb backends */
-       ldb_global_init();
 
        ldb->flags = flags;
 
index 18070bdb8633ba10f253871992196292739fd003..7da7b9ba34d073534947978d749d45cbe8817a9d 100644 (file)
@@ -126,9 +126,30 @@ static struct ops_list_entry {
        struct ops_list_entry *next;    
 } *registered_modules = NULL;
 
+#ifndef STATIC_LIBLDB_MODULES
+
+#define STATIC_LIBLDB_MODULES \
+       ldb_operational_module_ops,     \
+       ldb_rdn_name_module_ops,        \
+       ldb_paged_results_module_ops,   \
+       ldb_sort_module_ops,            \
+       ldb_asq_module_ops, \
+       NULL
+#endif
+
+const static struct ldb_module_ops *builtin_modules[] = {
+       STATIC_LIBLDB_MODULES
+};
+
 static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
 {
        struct ops_list_entry *e;
+       int i;
+
+       for (i = 0; builtin_modules[i]; i++) {
+               if (strcmp(builtin_modules[i]->name, name) == 0)
+                       return builtin_modules[i];
+       }
  
        for (e = registered_modules; e; e = e->next) {
                if (strcmp(e->ops->name, name) == 0) 
@@ -138,51 +159,6 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
        return NULL;
 }
 
-#ifndef STATIC_LIBLDB_MODULES
-
-#ifdef HAVE_LDB_LDAP
-#define LDAP_INIT ldb_ldap_init,
-#else
-#define LDAP_INIT
-#endif
-
-#ifdef HAVE_LDB_SQLITE3
-#define SQLITE3_INIT ldb_sqlite3_init,
-#else
-#define SQLITE3_INIT
-#endif
-
-#define STATIC_LIBLDB_MODULES \
-       LDAP_INIT \
-       SQLITE3_INIT \
-       ldb_tdb_init,   \
-       ldb_operational_init,   \
-       ldb_rdn_name_init,      \
-       ldb_paged_results_init, \
-       ldb_sort_init,          \
-       ldb_asq_init, \
-       NULL
-#endif
-
-int ldb_global_init(void)
-{
-       int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES };
-
-       static int initialized = 0;
-       int ret = 0, i;
-
-       if (initialized) 
-               return 0;
-
-       initialized = 1;
-       
-       for (i = 0; static_init_fns[i]; i++) {
-               if (static_init_fns[i]() == -1)
-                       ret = -1;
-       }
-
-       return ret;
-}
 
 int ldb_register_module(const struct ldb_module_ops *ops)
 {
@@ -257,8 +233,13 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str
                }
 
                if (ops == NULL) {
-                       ops = ldb_dso_load_symbol(ldb, module_list[i], 
-                                                     "ldb_module_ops");
+                       char *symbol_name = talloc_asprintf(ldb, "ldb_%s_module_ops", 
+                                                                                               module_list[i]);
+                       if (symbol_name == NULL) {
+                               return LDB_ERR_OPERATIONS_ERROR;
+                       }
+                       ops = ldb_dso_load_symbol(ldb, module_list[i], symbol_name);
+                       talloc_free(symbol_name);
                }
                
                if (ops == NULL) {
index 75ce89d6cfeee1c0d97cfdc9c2038ccb9c7ee6d0..6027acd0c76cd04e3d4a5b7da1a5f82e17d85813 100644 (file)
@@ -3,7 +3,7 @@
 [MODULE::ldb_asq]
 PRIVATE_DEPENDENCIES = LIBTALLOC
 CFLAGS = -Ilib/ldb/include
-INIT_FUNCTION = ldb_asq_init
+INIT_FUNCTION = &ldb_asq_module_ops
 SUBSYSTEM = LIBLDB
 OBJ_FILES = \
                modules/asq.o
@@ -15,7 +15,7 @@ OBJ_FILES = \
 [MODULE::ldb_server_sort]
 PRIVATE_DEPENDENCIES = LIBTALLOC
 CFLAGS = -Ilib/ldb/include
-INIT_FUNCTION = ldb_sort_init
+INIT_FUNCTION = &ldb_server_sort_module_ops
 SUBSYSTEM = LIBLDB
 OBJ_FILES = \
                modules/sort.o
@@ -25,7 +25,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_paged_results
 [MODULE::ldb_paged_results]
-INIT_FUNCTION = ldb_paged_results_init
+INIT_FUNCTION = &ldb_paged_results_module_ops
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
@@ -37,7 +37,7 @@ OBJ_FILES = \
 ################################################
 # Start MODULE ldb_paged_results
 [MODULE::ldb_paged_searches]
-INIT_FUNCTION = ldb_paged_searches_init
+INIT_FUNCTION = &ldb_paged_searches_module_ops
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
 SUBSYSTEM = LIBLDB
@@ -52,7 +52,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
-INIT_FUNCTION = ldb_operational_init
+INIT_FUNCTION = &ldb_operational_module_ops
 OBJ_FILES = \
                modules/operational.o
 # End MODULE ldb_operational
@@ -64,7 +64,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
-INIT_FUNCTION = ldb_rdn_name_init
+INIT_FUNCTION = &ldb_rdn_name_module_ops
 OBJ_FILES = \
                modules/rdn_name.o
 # End MODULE ldb_rdn_name
@@ -88,7 +88,7 @@ OBJ_FILES = \
 SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC
-INIT_FUNCTION = ldb_skel_init
+INIT_FUNCTION = &ldb_skel_module_ops
 OBJ_FILES = modules/skel.o
 # End MODULE ldb_skel
 ################################################
@@ -99,7 +99,7 @@ OBJ_FILES = modules/skel.o
 SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include
 PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC
-INIT_FUNCTION = ldb_sqlite3_init
+INIT_FUNCTION = &ldb_sqlite3_module_ops
 OBJ_FILES = \
                ldb_sqlite3/ldb_sqlite3.o
 # End MODULE ldb_sqlite3
@@ -110,7 +110,6 @@ OBJ_FILES = \
 [MODULE::ldb_tdb]
 SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_tdb
-INIT_FUNCTION = ldb_tdb_init
 OBJ_FILES = \
                ldb_tdb/ldb_tdb.o \
                ldb_tdb/ldb_search.o \
@@ -128,10 +127,9 @@ PRIVATE_DEPENDENCIES = \
 [LIBRARY::LIBLDB]
 VERSION = 0.0.1
 SO_VERSION = 0
-OUTPUT_TYPE = SHARED_LIBRARY
 CFLAGS = -Ilib/ldb/include
 PC_FILE = ldb.pc
-INIT_FUNCTION_TYPE = int (*) (void)
+INIT_FUNCTION_TYPE = extern const struct ldb_module_ops
 OBJ_FILES = \
                common/ldb.o \
                common/ldb_ldif.o \
@@ -193,5 +191,5 @@ PRIVATE_DEPENDENCIES = \
 ################################################
 
 
-include tools/config.mk
-include ldb_ildap/config.mk
+mkinclude tools/config.mk
+mkinclude ldb_ildap/config.mk
index 176cef0f3e067b5c0938c1b09c6f6df52701494b..4d9444ad104132a67c89d646998e38c51bc6ce55 100644 (file)
@@ -78,14 +78,18 @@ AC_LIBREPLACE_MDLD_FLAGS
 AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
 
 AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
+AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python])
 
 PYTHON_BUILD_TARGET="build-python"
 PYTHON_INSTALL_TARGET="install-python"
+PYTHON_CHECK_TARGET="check-python"
 AC_SUBST(PYTHON_BUILD_TARGET)
 AC_SUBST(PYTHON_INSTALL_TARGET)
+AC_SUBST(PYTHON_CHECK_TARGET)
 
 if test -z "$PYTHON_CONFIG"; then
        PYTHON_BUILD_TARGET=""  
+       PYTHON_CHECK_TARGET=""
        PYTHON_INSTALL_TARGET=""        
 fi
 
index d9f2defdc914931e3d12e0643ef7ec5b6faea8dc..d2dcc675a58a6b380992c2f3ab26feef7feabe86 100644 (file)
@@ -41,6 +41,8 @@ struct ldb_context;
 
 struct ldb_module_ops;
 
+struct ldb_backend_ops;
+
 /* basic module structure */
 struct ldb_module {
        struct ldb_module *prev, *next;
@@ -70,9 +72,16 @@ struct ldb_module_ops {
        int (*sequence_number)(struct ldb_module *, struct ldb_request *);
 };
 
+
 typedef int (*ldb_connect_fn) (struct ldb_context *ldb, const char *url, unsigned int flags, const char *options[],
                               struct ldb_module **module);
 
+
+struct ldb_backend_ops {
+       const char *name;
+       ldb_connect_fn connect_fn;
+};
+
 const char *ldb_default_modules_dir(void);
 
 /*
@@ -170,17 +179,23 @@ void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level,
 /* The following definitions come from lib/ldb/common/ldb_ldif.c  */
 int ldb_should_b64_encode(const struct ldb_val *val);
 
-int ldb_objectclass_init(void);
-int ldb_operational_init(void);
-int ldb_paged_results_init(void);
-int ldb_rdn_name_init(void);
-int ldb_schema_init(void);
-int ldb_asq_init(void);
-int ldb_sort_init(void);
-int ldb_ldap_init(void);
-int ldb_ildap_init(void);
-int ldb_tdb_init(void);
-int ldb_sqlite3_init(void);
+extern const struct ldb_module_ops ldb_objectclass_module_ops;
+extern const struct ldb_module_ops ldb_operational_module_ops;
+extern const struct ldb_module_ops ldb_paged_results_module_ops;
+extern const struct ldb_module_ops ldb_rdn_name_module_ops;
+extern const struct ldb_module_ops ldb_schema_module_ops;
+extern const struct ldb_module_ops ldb_asq_module_ops;
+extern const struct ldb_module_ops ldb_sort_module_ops;
+extern const struct ldb_module_ops ldb_ldap_module_ops;
+extern const struct ldb_module_ops ldb_ildap_module_ops;
+extern const struct ldb_module_ops ldb_tdb_module_ops;
+extern const struct ldb_module_ops ldb_sqlite3_module_ops;
+
+extern const struct ldb_backend_ops ldb_tdb_backend_ops;
+extern const struct ldb_backend_ops ldb_sqlite3_backend_ops;
+extern const struct ldb_backend_ops ldb_ldap_backend_ops;
+extern const struct ldb_backend_ops ldb_ildap_backend_ops;
+extern const struct ldb_backend_ops ldb_ldaps_backend_ops;
 
 int ldb_match_msg(struct ldb_context *ldb,
                  const struct ldb_message *msg,
diff --git a/source/lib/ldb/ldb.mk b/source/lib/ldb/ldb.mk
new file mode 100644 (file)
index 0000000..cc92017
--- /dev/null
@@ -0,0 +1,89 @@
+LDB_LIB = $(STATICLIB)
+
+LIB_FLAGS=$(LDFLAGS) -Llib $(LDB_LIB) $(LIBS) $(POPT_LIBS) $(TALLOC_LIBS) \
+                 $(TDB_LIBS) $(LDAP_LIBS) $(LIBDL)
+
+LDB_TDB_DIR=ldb_tdb
+LDB_TDB_OBJ=$(LDB_TDB_DIR)/ldb_tdb.o \
+       $(LDB_TDB_DIR)/ldb_pack.o $(LDB_TDB_DIR)/ldb_search.o $(LDB_TDB_DIR)/ldb_index.o \
+       $(LDB_TDB_DIR)/ldb_cache.o $(LDB_TDB_DIR)/ldb_tdb_wrap.o
+
+LDB_MAP_DIR=ldb_map
+LDB_MAP_OBJ=$(LDB_MAP_DIR)/ldb_map.o $(LDB_MAP_DIR)/ldb_map_inbound.o \
+           $(LDB_MAP_DIR)/ldb_map_outbound.o
+
+COMDIR=common
+COMMON_OBJ=$(COMDIR)/ldb.o $(COMDIR)/ldb_ldif.o \
+          $(COMDIR)/ldb_parse.o $(COMDIR)/ldb_msg.o $(COMDIR)/ldb_utf8.o \
+          $(COMDIR)/ldb_debug.o $(COMDIR)/ldb_modules.o \
+          $(COMDIR)/ldb_dn.o $(COMDIR)/ldb_match.o $(COMDIR)/ldb_attributes.o \
+          $(COMDIR)/attrib_handlers.o $(COMDIR)/ldb_controls.o $(COMDIR)/qsort.o
+
+MODDIR=modules
+MODULES_OBJ=$(MODDIR)/operational.o $(MODDIR)/rdn_name.o \
+          $(MODDIR)/paged_results.o $(MODDIR)/sort.o $(MODDIR)/asq.o
+
+NSSDIR=nssldb
+NSS_OBJ= $(NSSDIR)/ldb-nss.o $(NSSDIR)/ldb-pwd.o $(NSSDIR)/ldb-grp.o
+NSS_LIB = lib/libnss_ldb.$(SHLIBEXT).2
+
+lib/libldb.a: $(OBJS)
+       ar -rv $@ $(OBJS)
+       @-ranlib $@
+
+sample.$(SHLIBEXT): tests/sample_module.o
+       $(MDLD) $(MDLD_FLAGS) -o $@ tests/sample_module.o
+
+bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbadd tools/ldbadd.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbsearch: tools/ldbsearch.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbsearch tools/ldbsearch.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbdel: tools/ldbdel.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbdel tools/ldbdel.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbmodify: tools/ldbmodify.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbmodify tools/ldbmodify.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbedit: tools/ldbedit.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbedit tools/ldbedit.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbrename: tools/ldbrename.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbrename tools/ldbrename.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/ldbtest: tools/ldbtest.o tools/cmdline.o $(LIBS)
+       $(CC) -o bin/ldbtest tools/ldbtest.o tools/cmdline.o $(LIB_FLAGS) $(LD_EXPORT_DYNAMIC)
+
+bin/oLschema2ldif: tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIBS)
+       $(CC) -o bin/oLschema2ldif tools/oLschema2ldif.o tools/cmdline.o tools/convert.o $(LIB_FLAGS)
+
+examples/ldbreader: examples/ldbreader.o $(LIBS)
+       $(CC) -o examples/ldbreader examples/ldbreader.o $(LIB_FLAGS)
+
+examples/ldifreader: examples/ldifreader.o $(LIBS)
+       $(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
+
+# Python bindings
+build-python:: _ldb.$(SHLIBEXT)
+
+ldb_wrap.o: $(ldbdir)/ldb_wrap.c
+       $(CC) $(PICFLAG) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+       
+_ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o
+       $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS)
+
+install-python:: build-python
+       mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \
+               $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
+       cp $(ldbdir)/ldb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"`
+       cp _ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
+
+install-swig::
+       cp ldb.i `$(SWIG) -swiglib`
+
+check-python:: build-python
+       LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py
+
+clean::
+       rm -f _ldb.$(SHLIBEXT)
index 01d9ec88ffb12f6c02e3d17f5f1ca4b7f5da5d4e..3062dc886f8f609beb11d7890aa598c51f7f5bfe 100644 (file)
@@ -5,7 +5,6 @@ SUBSYSTEM = LIBLDB
 CFLAGS = -Ilib/ldb/include
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS
-INIT_FUNCTION = ldb_ildap_init
 ALIASES = ldapi ldaps ldap
 OBJ_FILES = \
                ldb_ildap.o
index a834e912d44a2c4078d00315ba427934a9aaaafa..995b584f51f97b8a0e5fd093db1731f926922b61 100644 (file)
@@ -811,9 +811,18 @@ failed:
        return -1;
 }
 
-int ldb_ildap_init(void)
-{
-       return ldb_register_backend("ldap", ildb_connect) + 
-                  ldb_register_backend("ldapi", ildb_connect) + 
-                  ldb_register_backend("ldaps", ildb_connect);
-}
+_PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = {
+       .name = "ldap",
+       .connect_fn = ildb_connect
+};
+
+_PUBLIC_ const struct ldb_backend_ops ldb_ildap_backend_ops = {
+       .name = "ildap",
+       .connect_fn = ildb_connect
+};
+
+_PUBLIC_ const struct ldb_backend_ops ldb_ldaps_backend_ops = {
+       .name = "ldaps",
+       .connect_fn = ildb_connect
+};
+
index d897350c2f02e25f4be18f94566adbb92b1067bf..3f6ff3fd5b8edadec611adb65f8119e6d0a674c3 100644 (file)
@@ -826,9 +826,17 @@ failed:
        return -1;
 }
 
-int ldb_ldap_init(void)
-{
-       return ldb_register_backend("ldap", lldb_connect) +
-                  ldb_register_backend("ldapi", lldb_connect) + 
-                  ldb_register_backend("ldaps", lldb_connect);
-}
+_PUBLIC_ struct ldb_backend_ops ldb_ldap_backend_ops = {
+       .name = "ldap",
+       .connect_fn = lldb_connect
+};
+
+_PUBLIC_ struct ldb_backend_ops ldb_ldapi_backend_ops = {
+       .name = "ldapi",
+       .connect_fn = lldb_connect
+};
+
+_PUBLIC_ struct ldb_backend_ops ldb_ldaps_backend_ops = {
+       .name = "ldaps",
+       .connect_fn = lldb_connect
+};
index 9582f3613098bf6d5f02926d2841f16316480c90..9c189feb11dc4e2e69d74ee2322fe373bdd49fad 100644 (file)
@@ -1186,7 +1186,7 @@ static int map_wait_all(struct ldb_handle *handle)
 }
 
 /* Wait for pending requests to finish. */
-static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type)
+int map_wait(struct ldb_handle *handle, enum ldb_wait_type type)
 {
        if (type == LDB_WAIT_ALL) {
                return map_wait_all(handle);
@@ -1199,16 +1199,6 @@ static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type)
 /* Module initialization
  * ===================== */
 
-/* Provided module operations */
-static const struct ldb_module_ops map_ops = {
-       .name           = "ldb_map",
-       .add            = map_add,
-       .modify         = map_modify,
-       .del            = map_delete,
-       .rename         = map_rename,
-       .search         = map_search,
-       .wait           = map_wait,
-};
 
 /* Builtin mappings for DNs and objectClasses */
 static const struct ldb_map_attribute builtin_attribute_maps[] = {
@@ -1344,12 +1334,6 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data
        return LDB_SUCCESS;
 }
 
-/* Copy the list of provided module operations. */
-_PUBLIC_ struct ldb_module_ops ldb_map_get_ops(void)
-{
-       return map_ops;
-}
-
 /* Initialize global private data. */
 _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, 
                          const struct ldb_map_objectclass *ocls,
@@ -1393,23 +1377,3 @@ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attrib
 
        return LDB_SUCCESS;
 }
-
-/* Usage note for initialization of this module:
- *
- * ldb_map is meant to be used from a different module that sets up
- * the mappings and gets registered in ldb.
- *
- * 'ldb_map_init' initializes the private data of this module and
- * stores the attribute and objectClass maps in there. It also looks
- * up the '@MAP' special DN so requests can be redirected to the
- * remote partition.
- *
- * This function should be called from the 'init_context' op of the
- * module using ldb_map.
- *
- * 'ldb_map_get_ops' returns a copy of ldb_maps module operations.
- *
- * It should be called from the initialize function of the using
- * module, which should then override the 'init_context' op with a
- * function making the appropriate calls to 'ldb_map_init'.
- */
index ef4da4e6546e4e5eb71ad1b2640f87928b60b36b..e40bb9cd7e3aadb5a9d02eb204fbf7c085ded130 100644 (file)
@@ -155,8 +155,19 @@ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attr
                 const char *add_objectclass,
                 const char *name);
 
-/* get copy of map_ops */
-struct ldb_module_ops
-ldb_map_get_ops(void);
+int map_add(struct ldb_module *module, struct ldb_request *req);
+int map_search(struct ldb_module *module, struct ldb_request *req);
+int map_rename(struct ldb_module *module, struct ldb_request *req);
+int map_delete(struct ldb_module *module, struct ldb_request *req);
+int map_modify(struct ldb_module *module, struct ldb_request *req);
+int map_wait(struct ldb_handle *handle, enum ldb_wait_type type);
+
+#define LDB_MAP_OPS \
+       .add            = map_add, \
+       .modify         = map_modify, \
+       .del            = map_delete, \
+       .rename         = map_rename, \
+       .search         = map_search, \
+       .wait           = map_wait,
 
 #endif /* __LDB_MAP_H__ */
index 2c35097069877b679d096f778e99a9a916b35caa..58a9f2704ef8eafd65457cb339304e1b57637cff 100644 (file)
@@ -98,20 +98,13 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx,
 /* The following definitions come from lib/ldb/modules/ldb_map_inbound.c */
 int map_add_do_remote(struct ldb_handle *handle);
 int map_add_do_local(struct ldb_handle *handle);
-int map_add(struct ldb_module *module, struct ldb_request *req);
 
 int map_modify_do_remote(struct ldb_handle *handle);
 int map_modify_do_local(struct ldb_handle *handle);
-int map_modify(struct ldb_module *module, struct ldb_request *req);
 
 int map_delete_do_remote(struct ldb_handle *handle);
 int map_delete_do_local(struct ldb_handle *handle);
-int map_delete(struct ldb_module *module, struct ldb_request *req);
 
 int map_rename_do_remote(struct ldb_handle *handle);
 int map_rename_do_fixup(struct ldb_handle *handle);
 int map_rename_do_local(struct ldb_handle *handle);
-int map_rename(struct ldb_module *module, struct ldb_request *req);
-
-/* The following definitions come from lib/ldb/modules/ldb_map_outbound.c */
-int map_search(struct ldb_module *module, struct ldb_request *req);
index 1ec3b1aabdf9355deaad024891da4c3ad7c11b67..214e7eec5fd3d16af1499072d783cf90db4dd501 100644 (file)
@@ -1903,7 +1903,7 @@ failed:
        return -1;
 }
 
-int ldb_sqlite3_init(void)
-{
-       return ldb_register_backend("sqlite3", lsqlite3_connect);
-}
+_PUBLIC_ const struct ldb_backend_ops ldb_sqlite3_backend_ops = {
+       .name = "sqlite3",
+       .connect_fn = lsqlite3_connect
+};
index 45a810958459d9e3e2e74be6a5ea79f84f4d4ea0..11d6c30710d7d91b6984ad12af20a93e8d4ab4a8 100644 (file)
@@ -1107,7 +1107,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
        return 0;
 }
 
-int ldb_tdb_init(void)
-{
-       return ldb_register_backend("tdb", ltdb_connect);
-}
+const struct ldb_backend_ops ldb_tdb_backend_ops = {
+       .name = "tdb",
+       .connect_fn = ltdb_connect
+};
index b6a85941664044e4e5e65f046a0da85dbcfc0e32..eb27263b16ffe2a0fc13f241665b4061bec36bc0 100644 (file)
@@ -473,15 +473,9 @@ static int asq_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-
-static const struct ldb_module_ops asq_ops = {
+const struct ldb_module_ops ldb_asq_module_ops = {
        .name              = "asq",
        .search            = asq_search,
        .wait              = asq_wait,
        .init_context      = asq_init
 };
-
-int ldb_asq_init(void)
-{
-       return ldb_register_module(&asq_ops);
-}
index 45f23aa0c16c491353c2a2a40f023a85bb7c3a87..7dc4ae08c380eee8947643e5afc7bb8394728ac8 100644 (file)
@@ -304,13 +304,8 @@ static int operational_init(struct ldb_module *ctx)
        return ldb_next_init(ctx);
 }
 
-static const struct ldb_module_ops operational_ops = {
+const struct ldb_module_ops ldb_operational_module_ops = {
        .name              = "operational",
        .search            = operational_search,
        .init_context      = operational_init
 };
-
-int ldb_operational_init(void)
-{
-       return ldb_register_module(&operational_ops);
-}
index ee1bbe03353799cf4c6dd593c1342dabdda04ee1..b62b1f92cbd7d0271fffbbef452664bfb89662fe 100644 (file)
@@ -549,15 +549,9 @@ static int paged_request_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops paged_ops = {
+const struct ldb_module_ops ldb_paged_results_module_ops = {
        .name           = "paged_results",
        .search         = paged_search,
        .wait           = paged_wait,
        .init_context   = paged_request_init
 };
-
-int ldb_paged_results_init(void)
-{
-       return ldb_register_module(&paged_ops);
-}
-
index fd580a3c4ac2ed038484791dbb5dba0fd579589a..40e87f70d60c83e124a5e7ae0877d941c6102c67 100644 (file)
@@ -455,15 +455,9 @@ static int ps_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops ps_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_paged_searches_module_ops = {
        .name           = "paged_searches",
        .search         = ps_search,
        .wait           = ps_wait,
        .init_context   = ps_init
 };
-
-int ldb_paged_searches_init(void)
-{
-       return ldb_register_module(&ps_ops);
-}
-
index 1a0ddbb3c462515b9571c829793935407dadcce1..c4de8e8da8b376ee5dd4f1127c3962d76e543db6 100644 (file)
@@ -326,15 +326,9 @@ static int rdn_name_wait(struct ldb_handle *handle, enum ldb_wait_type type)
        return rdn_name_wait_once(handle);
 }
 
-static const struct ldb_module_ops rdn_name_ops = {
+const struct ldb_module_ops ldb_rdn_name_module_ops = {
        .name              = "rdn_name",
        .add               = rdn_name_add,
        .rename            = rdn_name_rename,
        .wait              = rdn_name_wait
 };
-
-
-int ldb_rdn_name_init(void)
-{
-       return ldb_register_module(&rdn_name_ops);
-}
index 5400c502f13340149517a45bd774ab991c3dd9f1..0cd29ac4b7e0fc8839944481daf60fb908a3b805 100644 (file)
@@ -116,7 +116,7 @@ static int skel_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops skel_ops = {
+const struct ldb_module_ops ldb_skel_module_ops = {
        .name              = "skel",
        .init_context      = skel_init,
        .search            = skel_search,
@@ -129,8 +129,3 @@ static const struct ldb_module_ops skel_ops = {
        .end_transaction   = skel_end_trans,
        .del_transaction   = skel_del_trans,
 };
-
-int ldb_skel_init(void)
-{
-       return ldb_register_module(&skel_ops);
-}
index 89b9a4fb19c69ae96dda928e356f57099c4ecee0..746befa559208bb368a0a4bf875d5eb46b617da8 100644 (file)
@@ -450,14 +450,9 @@ static int server_sort_init(struct ldb_module *module)
        return ldb_next_init(module);
 }
 
-static const struct ldb_module_ops server_sort_ops = {
+const struct ldb_module_ops ldb_server_sort_module_ops = {
        .name              = "server_sort",
        .search            = server_sort_search,
        .wait              = server_sort_wait,
        .init_context      = server_sort_init
 };
-
-int ldb_sort_init(void)
-{
-       return ldb_register_module(&server_sort_ops);
-}
index 199212dbbf1cd4b05702d867cc98daee73bc7b49..e256f41a4db7b93eb77718de65bbbb12fc4cd9e5 100644 (file)
@@ -45,11 +45,6 @@ NSS_STATUS _ldb_nss_init(void)
 
        _ldb_nss_ctx->pid = mypid;
 
-       ret = ldb_global_init();
-       if (ret != 0) {
-               goto failed;
-       }
-
        _ldb_nss_ctx->ldb = ldb_init(_ldb_nss_ctx);
        if (_ldb_nss_ctx->ldb == NULL) {
                goto failed;
diff --git a/source/lib/ldb/rules.mk b/source/lib/ldb/rules.mk
new file mode 100644 (file)
index 0000000..534ba01
--- /dev/null
@@ -0,0 +1,30 @@
+etags:
+       etags `find $(srcdir) -name "*.[ch]"`
+
+ctags:
+       ctags `find $(srcdir) -name "*.[ch]"`
+
+.SUFFIXES: _wrap.c .i
+
+.i_wrap.c:
+       [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -python -keyword $<
+
+.SUFFIXES: .1 .1.xml .3 .3.xml .xml .html .c .o
+
+.c.o:
+       @echo Compiling $*.c
+       @mkdir -p `dirname $@`
+       @$(CC) $(CFLAGS) $(PICFLAG) -c $< -o $@
+
+.c.po:
+       @echo Compiling $*.c
+       @mkdir -p `dirname $@`
+       @$(CC) -fPIC $(CFLAGS) -c $< -o $@
+
+showflags::
+       @echo 'ldb will be compiled with flags:'
+       @echo '  CFLAGS = $(CFLAGS)'
+       @echo '  LIBS = $(LIBS)'
+
+distclean::
+       rm -f *~ */*~
diff --git a/source/lib/ldb/setup.py b/source/lib/ldb/setup.py
deleted file mode 100755 (executable)
index b04f3b0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/python
-from distutils.core import setup
-from distutils.extension import Extension
-
-setup(name="ldb",
-      version="1.0",
-      url="http://ldb.samba.org/",
-      author="LDB Developers",
-      author_email="ldb@samba.org",
-      license="LGPLv3",
-      keywords=["ldap","ldb","db","ldif"],
-      py_modules=["ldb"],
-      ext_modules=[Extension('_ldb', ['ldb_wrap.c'], include_dirs=['include'],
-                             library_dirs=["lib"], libraries=['ldb'])],
-      )
index d5346c30b09a244fcd1c892caa58298557b49f79..5f3f727b5d18694a3cb75b6b8791d9e44c20fc7e 100755 (executable)
@@ -418,3 +418,6 @@ class ModuleTests(unittest.TestCase):
     def test_register_module(self):
         ldb.register_module(ExampleModule())
 
+if __name__ == '__main__':
+    import unittest
+    unittest.TestProgram()
index a425ddc830474696d90381f6cfa9b753bebc2dee..f75bb8124d95fd0e81f745665eb3cf9fc703191c 100755 (executable)
@@ -6,17 +6,17 @@ import getopt
 import optparse
 import sys
 
-# Add path to the library for in-tree use
-sys.path.append("scripting/python")
 import samba.getopt as options
 
 from auth import system_session
 from ldb import (SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError,
                  LDB_ERR_NO_SUCH_OBJECT, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS,
                  LDB_ERR_ENTRY_ALREADY_EXISTS, LDB_ERR_UNWILLING_TO_PERFORM,
-                 LDB_ERR_NOT_ALLOWED_ON_NON_LEAF)
+                 LDB_ERR_NOT_ALLOWED_ON_NON_LEAF, LDB_ERR_OTHER)
 from samba import Ldb
+from subunit import SubunitTestRunner
 import param
+import unittest
 
 parser = optparse.OptionParser("ldap [options] <host>")
 sambaopts = options.SambaOptions(parser)
@@ -36,122 +36,122 @@ host = args[0]
 
 lp = sambaopts.get_loadparm()
 
-def delete_force(ldb, dn):
-    try:
-        ldb.delete(dn)
-    except LdbError, (num, _): 
-        if num != LDB_ERR_NO_SUCH_OBJECT:
-            assert False
-
-def assertEquals(a1, a2):
-    assert a1 == a2, "Expected %r == %r" % (a1, a2)
+class BasicTests(unittest.TestCase):
+    def delete_force(self, ldb, dn):
+        try:
+            ldb.delete(dn)
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+    def find_basedn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, 
+                         attrs=["defaultNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["defaultNamingContext"][0]
+
+    def find_configurationdn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["configurationNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["configurationNamingContext"][0]
+
+    def find_schemadn(self, ldb):
+        res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["schemaNamingContext"])
+        self.assertEquals(len(res), 1)
+        return res[0]["schemaNamingContext"][0]
+
+    def setUp(self):
+        self.ldb = ldb
+        self.gc_ldb = gc_ldb
+        self.base_dn = self.find_basedn(ldb)
+        self.configuration_dn = self.find_configurationdn(ldb)
+        self.schema_dn = self.find_schemadn(ldb)
+
+        print "baseDN: %s\n" % self.base_dn
+
+        self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
+        self.delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn)
+
+    def test_group_add_invalid_member(self):
+        """Testing group add with invalid member"""
+        try:
+            self.ldb.add({
+                "dn": "cn=ldaptestgroup,cn=uSers," + self.base_dn,
+                "objectclass": "group",
+                "member": "cn=ldaptestuser,cn=useRs," + self.base_dn})
+            self.fail()
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
 
-def basic_tests(ldb, gc_ldb, base_dn, configuration_dn, schema_dn):
-    print "Running basic tests"
+    def test_all(self):
+        """Basic tests"""
 
-    delete_force(ldb, "cn=ldaptestuser,cn=users," + base_dn)
-    delete_force(ldb, "cn=ldaptestgroup,cn=users," + base_dn)
+        self.delete_force(self.ldb, "cn=ldaptestuser,cn=users," + self.base_dn)
 
-    print "Testing group add with invalid member"
-    try:
-        ldb.add({
-        "dn": "cn=ldaptestgroup,cn=uSers," + base_dn,
-        "objectclass": "group",
-        "member": "cn=ldaptestuser,cn=useRs," + base_dn})
-    except LdbError, (num, _): 
-        if num != LDB_ERR_NO_SUCH_OBJECT:
-            assert False
-    else:
-        assert False
-
-    print "Testing user add"
-    try:
+        print "Testing user add"
         ldb.add({
-        "dn": "cn=ldaptestuser,cn=uSers," + base_dn,
+        "dn": "cn=ldaptestuser,cn=uSers," + self.base_dn,
         "objectclass": ["user", "person"],
         "cN": "LDAPtestUSER",
         "givenname": "ldap",
         "sn": "testy"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser,cn=users," + base_dn)
-        ldb.add({
-            "dn": "cn=ldaptestuser,cn=uSers," + base_dn,
-            "objectclass": ["user", "person"],
-            "cN": "LDAPtestUSER",
-            "givenname": "ldap",
-            "sn": "testy"})
-
-    ldb.add({
-        "dn": "cn=ldaptestgroup,cn=uSers," + base_dn,
-        "objectclass": "group",
-        "member": "cn=ldaptestuser,cn=useRs," + base_dn})
-
-    try:
-        ldb.add({
-        "dn": "cn=ldaptestcomputer,cn=computers," + base_dn,
-        "objectclass": "computer",
-        "cN": "LDAPtestCOMPUTER"})
-    except LdbError:
-        ldb.delete("cn=ldaptestcomputer,cn=computers," + base_dn)
+
         ldb.add({
-            "dn": "cn=ldaptestcomputer,cn=computers," + base_dn,
-            "objectClass": "computer",
-            "cn": "LDAPtestCOMPUTER"})
-
-    try:
-        ldb.add({"dn": "cn=ldaptest2computer,cn=computers," + base_dn,
-        "objectClass": "computer",
-        "cn": "LDAPtest2COMPUTER",
-        "userAccountControl": "4096",
-        "displayname": "ldap testy"})
-    except LdbError:
-        ldb.delete("cn=ldaptest2computer,cn=computers," + base_dn)
+            "dn": "cn=ldaptestgroup,cn=uSers," + self.base_dn,
+            "objectclass": "group",
+            "member": "cn=ldaptestuser,cn=useRs," + self.base_dn})
+
+        self.delete_force(ldb, "cn=ldaptestcomputer,cn=computers," + self.base_dn)
         ldb.add({
-            "dn": "cn=ldaptest2computer,cn=computers," + base_dn,
+            "dn": "cn=ldaptestcomputer,cn=computers," + self.base_dn,
+            "objectclass": "computer",
+            "cN": "LDAPtestCOMPUTER"})
+
+        self.delete_force(self.ldb, "cn=ldaptest2computer,cn=computers," + self.base_dn)
+        ldb.add({"dn": "cn=ldaptest2computer,cn=computers," + self.base_dn,
             "objectClass": "computer",
             "cn": "LDAPtest2COMPUTER",
             "userAccountControl": "4096",
             "displayname": "ldap testy"})
 
-    print "Testing attribute or value exists behaviour"
-    try:
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+        print "Testing attribute or value exists behaviour"
+        try:
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: cifs/ldaptest2computer
 """)
-    except LdbError, (num, msg):
-        assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
+        except LdbError, (num, msg):
+            self.assertEquals(num, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS)
 
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 servicePrincipalName: cifs/ldaptest2computer
 """)
-        try:
-            ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            try:
+                ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 add: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer
 """)
-        except LdbError, (num, msg):
-            assert num == LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
-        
-        print "Testing ranged results"
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            except LdbError, (num, msg):
+                self.assertEquals(num, LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS)
+            
+            print "Testing ranged results"
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 replace: servicePrincipalName
 """)
-        
-        ldb.modify_ldif("""
-dn: cn=ldaptest2computer,cn=computers,""" + base_dn + """
+            
+            ldb.modify_ldif("""
+dn: cn=ldaptest2computer,cn=computers,""" + self.base_dn + """
 changetype: modify
 add: servicePrincipalName
 servicePrincipalName: host/ldaptest2computer0
@@ -186,730 +186,685 @@ servicePrincipalName: host/ldaptest2computer28
 servicePrincipalName: host/ldaptest2computer29
 """)
 
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, 
-                         attrs=["servicePrincipalName;range=0-*"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        #print len(res[0]["servicePrincipalName;range=0-*"])
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-19"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-#        print res[0]["servicePrincipalName;range=0-19"].length
-        assertEquals(len(res[0]["servicePrincipalName;range=0-19"]), 20)
-
-        
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-30"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=30-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=30-*"]), 0)
-
-        
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=10-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=10-*"]), 20)
-#        pos_11 = res[0]["servicePrincipalName;range=10-*"][18]
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-40"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=11-*"]), 19)
-#        print res[0]["servicePrincipalName;range=11-*"][18]
-#        print pos_11
-#        assertEquals((res[0]["servicePrincipalName;range=11-*"][18]), pos_11)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-15"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-        assertEquals(len(res[0]["servicePrincipalName;range=11-15"]), 5)
-#        assertEquals(res[0]["servicePrincipalName;range=11-15"][4], pos_11)
-
-        res = ldb.search(base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName"])
-        assert len(res) == 1, "Could not find (cn=ldaptest2computer)"
-#        print res[0]["servicePrincipalName"][18]
-#        print pos_11
-        assertEquals(len(res[0]["servicePrincipalName"]), 30)
-#        assertEquals(res[0]["servicePrincipalName"][18], pos_11)
-
-    try:
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, 
+                             attrs=["servicePrincipalName;range=0-*"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            #print len(res[0]["servicePrincipalName;range=0-*"])
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-19"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            # print res[0]["servicePrincipalName;range=0-19"].length
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-19"]), 20)
+
+            
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-30"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=0-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=0-*"]), 30)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=30-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=30-*"]), 0)
+
+            
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=10-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=10-*"]), 20)
+            # pos_11 = res[0]["servicePrincipalName;range=10-*"][18]
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-40"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=11-*"]), 19)
+            # print res[0]["servicePrincipalName;range=11-*"][18]
+            # print pos_11
+            # self.assertEquals((res[0]["servicePrincipalName;range=11-*"][18]), pos_11)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName;range=11-15"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            self.assertEquals(len(res[0]["servicePrincipalName;range=11-15"]), 5)
+            # self.assertEquals(res[0]["servicePrincipalName;range=11-15"][4], pos_11)
+
+            res = ldb.search(self.base_dn, expression="(cn=ldaptest2computer))", scope=SCOPE_SUBTREE, attrs=["servicePrincipalName"])
+            self.assertEquals(len(res), 1, "Could not find (cn=ldaptest2computer)")
+            # print res[0]["servicePrincipalName"][18]
+            # print pos_11
+            self.assertEquals(len(res[0]["servicePrincipalName"]), 30)
+            # self.assertEquals(res[0]["servicePrincipalName"][18], pos_11)
+
+        self.delete_force(self.ldb, "cn=ldaptestuser2,cn=users," + self.base_dn)
         ldb.add({
-        "dn": "cn=ldaptestuser2,cn=useRs," + base_dn,
-        "objectClass": ["person", "user"],
-        "cn": "LDAPtestUSER2",
-        "givenname": "testy",
-        "sn": "ldap user2"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser2,cn=users," + base_dn)
-        ldb.add({
-                "dn": "cn=ldaptestuser2,cn=useRs," + base_dn,
-                "objectClass": ["person", "user"],
-                "cn": "LDAPtestUSER2",
-                "givenname": "testy",
-                "sn": "ldap user2"})
-
-    print "Testing Ambigious Name Resolution"
-#   Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=ldap testy)(objectClass=user))")
-    assert len(res) == 3, "Could not find (&(anr=ldap testy)(objectClass=user))"
-
-#   Testing ldb.search for (&(anr=testy ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=testy ldap)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr=ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr=ldap)(objectClass=user))")
-    assert len(res) == 4, "Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr==ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr==ldap)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==ldap)(objectClass=user)). Found only %d for (&(anr=ldap)(objectClass=user))" % len(res)
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"], "ldaptestuser")
-
-#   Testing ldb.search for (&(anr=testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=testy)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
-    assert len(res) == 2, "Found only %d for (&(anr=ldap testy)(objectClass=user))" % len(res)
-
-#   Testing ldb.search for (&(anr==ldap testy)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
-    assert len(res) == 1, "Found only %d for (&(anr==ldap testy)(objectClass=user))" % len(res)
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"][0], "ldaptestuser")
-
-# Testing ldb.search for (&(anr==testy ldap)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==testy ldap)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"][0], "ldaptestuser")
-    assertEquals(res[0]["name"][0], "ldaptestuser")
-
-    # Testing ldb.search for (&(anr=testy ldap user)(objectClass=user))
-    res = ldb.search(expression="(&(anr=testy ldap user)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr=testy ldap user)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==testy ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==testy ldap user2)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==testy ldap user2)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==ldap user2)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(anr==ldap user2)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser2")
-    assertEquals(res[0]["name"], "ldaptestuser2")
-
-    # Testing ldb.search for (&(anr==not ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr==not ldap user2)(objectClass=user))")
-    assert len(res) == 0, "Must not find (&(anr==not ldap user2)(objectClass=user))"
-
-    # Testing ldb.search for (&(anr=not ldap user2)(objectClass=user))
-    res = ldb.search(expression="(&(anr=not ldap user2)(objectClass=user))")
-    assert len(res) == 0, "Must not find (&(anr=not ldap user2)(objectClass=user))"
-
-    print "Testing Group Modifies"
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup,cn=users,""" + base_dn + """
+            "dn": "cn=ldaptestuser2,cn=useRs," + self.base_dn,
+            "objectClass": ["person", "user"],
+            "cn": "LDAPtestUSER2",
+            "givenname": "testy",
+            "sn": "ldap user2"})
+
+        print "Testing Ambigious Name Resolution"
+        # Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=ldap testy)(objectClass=user))")
+        self.assertEquals(len(res), 3, "Could not find (&(anr=ldap testy)(objectClass=user))")
+
+        # Testing ldb.search for (&(anr=testy ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=testy ldap)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr=ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr=ldap)(objectClass=user))")
+        self.assertEquals(len(res), 4, "Found only %d for (&(anr=ldap)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr==ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr==ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==ldap)(objectClass=user)). Found only %d for (&(anr=ldap)(objectClass=user))" % len(res))
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr=testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=testy)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr=ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 2, "Found only %d for (&(anr=ldap testy)(objectClass=user))" % len(res))
+
+        # Testing ldb.search for (&(anr==ldap testy)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Found only %d for (&(anr==ldap testy)(objectClass=user))" % len(res))
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"][0], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr==testy ldap)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==testy ldap)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"][0], "ldaptestuser")
+        self.assertEquals(res[0]["name"][0], "ldaptestuser")
+
+        # Testing ldb.search for (&(anr=testy ldap user)(objectClass=user))
+        res = ldb.search(expression="(&(anr=testy ldap user)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr=testy ldap user)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==testy ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==testy ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==testy ldap user2)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(anr==ldap user2)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestuser2,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestuser2")
+        self.assertEquals(res[0]["name"], "ldaptestuser2")
+
+        # Testing ldb.search for (&(anr==not ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr==not ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 0, "Must not find (&(anr==not ldap user2)(objectClass=user))")
+
+        # Testing ldb.search for (&(anr=not ldap user2)(objectClass=user))
+        res = ldb.search(expression="(&(anr=not ldap user2)(objectClass=user))")
+        self.assertEquals(len(res), 0, "Must not find (&(anr=not ldap user2)(objectClass=user))")
+
+        print "Testing Group Modifies"
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser2,cn=users,""" + base_dn + """
-member: cn=ldaptestcomputer,cn=computers,""" + base_dn + """
+member: cn=ldaptestuser2,cn=users,""" + self.base_dn + """
+member: cn=ldaptestcomputer,cn=computers,""" + self.base_dn + """
 """)
 
-    delete_force(ldb, "cn=ldaptestuser3,cn=users," + base_dn)
+        self.delete_force(ldb, "cn=ldaptestuser3,cn=users," + self.base_dn)
 
-    print "Testing adding non-existent user to a group"
-    try:
-        ldb.modify_ldif("""
-dn: cn=ldaptestgroup,cn=users,""" + base_dn + """
+        print "Testing adding non-existent user to a group"
+        try:
+            ldb.modify_ldif("""
+dn: cn=ldaptestgroup,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser3,cn=users,""" + base_dn + """
+member: cn=ldaptestuser3,cn=users,""" + self.base_dn + """
 """)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing Renames"
-
-    ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestUSER3,cn=users," + base_dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser3)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestUSER3")
-    assertEquals(res[0]["name"], "ldaptestUSER3")
-
-# This is a Samba special, and does not exist in real AD
-#    print "Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-#    res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
-#    if (res.error != 0 || len(res) != 1) {
-#        print "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-#        assertEquals(len(res), 1)
-#    }
-#    assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + base_dn))
-#    assertEquals(res[0].cn, "ldaptestUSER3")
-#    assertEquals(res[0].name, "ldaptestUSER3")
-
-    print "Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-    res = ldb.search(expression="(distinguishedName=CN=ldaptestUSER3,CN=Users," + base_dn + ")")
-    assert len(res) == 1, "Could not find (dn=CN=ldaptestUSER3,CN=Users," + base_dn + ")"
-    assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestUSER3")
-    assertEquals(res[0]["name"], "ldaptestUSER3")
-
-    # ensure we cannot add it again
-    try:
-        ldb.add({"dn": "cn=ldaptestuser3,cn=userS," + base_dn,
-                  "objectClass": ["person", "user"],
-                  "cn": "LDAPtestUSER3"})
-    except LdbError, (num, _):
-        assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
-    else:
-        assert False
-
-    # rename back
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
-
-    # ensure we cannnot rename it twice
-    try:
-        ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser2,cn=users," + base_dn)
-    except LdbError, (num, _): 
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    # ensure can now use that name
-    ldb.add({"dn": "cn=ldaptestuser3,cn=users," + base_dn,
-                  "objectClass": ["person", "user"],
-                  "cn": "LDAPtestUSER3"})
-    
-    # ensure we now cannnot rename
-    try:
-        ldb.rename("cn=ldaptestuser2,cn=users," + base_dn, "cn=ldaptestuser3,cn=users," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_ENTRY_ALREADY_EXISTS
-    else:
-        assert False
-    try:
-        ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser3,cn=configuration," + base_dn)
-    except LdbError, (num, _):
-        assert num in (71, 64)
-    else:
-        assert False
-
-    ldb.rename("cn=ldaptestuser3,cn=users," + base_dn, "cn=ldaptestuser5,cn=users," + base_dn)
-
-    ldb.delete("cn=ldaptestuser5,cn=users," + base_dn)
-
-    delete_force(ldb, "cn=ldaptestgroup2,cn=users," + base_dn)
-
-    ldb.rename("cn=ldaptestgroup,cn=users," + base_dn, "cn=ldaptestgroup2,cn=users," + base_dn)
-
-    print "Testing subtree Renames"
-
-    ldb.add({"dn": "cn=ldaptestcontainer," + base_dn, 
-             "objectClass": "container"})
-    
-    try:
-        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + base_dn, 
-             "objectClass": ["person", "user"],
-             "cn": "LDAPtestUSER4"})
-    except LdbError:
-        ldb.delete("cn=ldaptestuser4,cn=ldaptestcontainer," + base_dn)
-        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + base_dn,
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        print "Testing Renames"
+
+        ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestUSER3,cn=users," + self.base_dn)
+
+        print "Testing ldb.search for (&(cn=ldaptestuser3)(objectClass=user))"
+        res = ldb.search(expression="(&(cn=ldaptestuser3)(objectClass=user))")
+        self.assertEquals(len(res), 1, "Could not find (&(cn=ldaptestuser3)(objectClass=user))")
+
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestUSER3")
+        self.assertEquals(res[0]["name"], "ldaptestUSER3")
+
+        # This is a Samba special, and does not exist in real AD
+        #    print "Testing ldb.search for (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        #    res = ldb.search("(dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        #    if (res.error != 0 || len(res) != 1) {
+        #        print "Could not find (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        #        self.assertEquals(len(res), 1)
+        #    }
+        #    self.assertEquals(res[0].dn, ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        #    self.assertEquals(res[0].cn, "ldaptestUSER3")
+        #    self.assertEquals(res[0].name, "ldaptestUSER3")
+
+        print "Testing ldb.search for (distinguishedName=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")"
+        res = ldb.search(expression="(distinguishedName=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        self.assertEquals(len(res), 1, "Could not find (dn=CN=ldaptestUSER3,CN=Users," + self.base_dn + ")")
+        self.assertEquals(str(res[0].dn), ("CN=ldaptestUSER3,CN=Users," + self.base_dn))
+        self.assertEquals(res[0]["cn"], "ldaptestUSER3")
+        self.assertEquals(res[0]["name"], "ldaptestUSER3")
+
+        # ensure we cannot add it again
+        try:
+            ldb.add({"dn": "cn=ldaptestuser3,cn=userS," + self.base_dn,
                       "objectClass": ["person", "user"],
-                      "cn": "LDAPtestUSER4"})
+                      "cn": "LDAPtestUSER3"})
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_ENTRY_ALREADY_EXISTS)
+
+        # rename back
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser2,cn=users," + self.base_dn)
+
+        # ensure we cannnot rename it twice
+        try:
+            ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, 
+                       "cn=ldaptestuser2,cn=users," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _): 
+            self.assertEquals(num, LDB_ERR_NO_SUCH_OBJECT)
+
+        # ensure can now use that name
+        ldb.add({"dn": "cn=ldaptestuser3,cn=users," + self.base_dn,
+                      "objectClass": ["person", "user"],
+                      "cn": "LDAPtestUSER3"})
+        
+        # ensure we now cannnot rename
+        try:
+            ldb.rename("cn=ldaptestuser2,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=users," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertEquals(num, LDB_ERR_ENTRY_ALREADY_EXISTS)
+        try:
+            ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser3,cn=configuration," + self.base_dn)
+            self.fail()
+        except LdbError, (num, _):
+            self.assertTrue(num in (71, 64))
+
+        ldb.rename("cn=ldaptestuser3,cn=users," + self.base_dn, "cn=ldaptestuser5,cn=users," + self.base_dn)
 
-    ldb.modify_ldif("""
-dn: cn=ldaptestgroup2,cn=users,""" + base_dn + """
+        ldb.delete("cn=ldaptestuser5,cn=users," + self.base_dn)
+
+        self.delete_force(ldb, "cn=ldaptestgroup2,cn=users," + self.base_dn)
+
+        ldb.rename("cn=ldaptestgroup,cn=users," + self.base_dn, "cn=ldaptestgroup2,cn=users," + self.base_dn)
+
+        print "Testing subtree Renames"
+
+        ldb.add({"dn": "cn=ldaptestcontainer," + self.base_dn, 
+                 "objectClass": "container"})
+        
+        self.delete_force(self.ldb, "cn=ldaptestuser4,cn=ldaptestcontainer," + self.base_dn)
+        ldb.add({"dn": "CN=ldaptestuser4,CN=ldaptestcontainer," + self.base_dn, 
+                 "objectClass": ["person", "user"],
+                 "cn": "LDAPtestUSER4"})
+
+        ldb.modify_ldif("""
+dn: cn=ldaptestgroup2,cn=users,""" + self.base_dn + """
 changetype: modify
 add: member
-member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + base_dn + """
+member: cn=ldaptestuser4,cn=ldaptestcontainer,""" + self.base_dn + """
 """)
-    
-    print "Testing ldb.rename of cn=ldaptestcontainer," + base_dn + " to cn=ldaptestcontainer2," + base_dn
-    ldb.rename("CN=ldaptestcontainer," + base_dn, "CN=ldaptestcontainer2," + base_dn)
-
-    print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user))"
-
-    print "Testing subtree ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
-    try:
-        ldb.search("cn=ldaptestcontainer," + base_dn, 
-                expression="(&(cn=ldaptestuser4)(objectClass=user))", 
-                scope=SCOPE_SUBTREE)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in (just renamed from) cn=ldaptestcontainer," + base_dn
-    try:
-        res = ldb.search("cn=ldaptestcontainer," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_ONELEVEL)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NO_SUCH_OBJECT
-    else:
-        assert False
-
-    print "Testing ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in renamed container"
-    res = ldb.search("cn=ldaptestcontainer2," + base_dn, expression="(&(cn=ldaptestuser4)(objectClass=user))", scope=SCOPE_SUBTREE)
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser4)(objectClass=user)) under cn=ldaptestcontainer2," + base_dn
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
-    assertEquals(res[0]["memberOf"][0].upper(), ("CN=ldaptestgroup2,CN=Users," + base_dn).upper())
-
-    print "Testing ldb.search for (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)) to check subtree renames and linked attributes"
-    res = ldb.search(base_dn, expression="(&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group))", scope=SCOPE_SUBTREE)
-    assert len(res) == 1, "Could not find (&(member=CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn + ")(objectclass=group)), perhaps linked attributes are not conistant with subtree renames?"
-
-    print "Testing ldb.rename (into itself) of cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn
-    try:
-        ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer2," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_UNWILLING_TO_PERFORM
-    else:
-        assert False
-
-    print "Testing ldb.rename (into non-existent container) of cn=ldaptestcontainer2," + base_dn + " to cn=ldaptestcontainer,cn=ldaptestcontainer3," + base_dn
-    try:
-        ldb.rename("cn=ldaptestcontainer2," + base_dn, "cn=ldaptestcontainer,cn=ldaptestcontainer3," + base_dn)
-    except LdbError, (num, _):
-        assert num in (53, 80)
-    else:
-        assert False
-
-    print "Testing delete (should fail, not a leaf node) of renamed cn=ldaptestcontainer2," + base_dn
-    try:
-        ldb.delete("cn=ldaptestcontainer2," + base_dn)
-    except LdbError, (num, _):
-        assert num == LDB_ERR_NOT_ALLOWED_ON_NON_LEAF
-    else:
-        assert False
-
-    print "Testing base ldb.search for CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(objectclass=*)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
-    assert len(res) == 1
-    res = ldb.search(expression="(cn=ldaptestuser40)", base=("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn), scope=SCOPE_BASE)
-    assert len(res) == 0
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base=("cn=ldaptestcontainer2," + base_dn), scope=SCOPE_ONELEVEL)
-    assert len(res) == 0
-
-    print "Testing one-level ldb.search for (&(cn=ldaptestuser4)(objectClass=user)) in cn=ldaptestcontainer2," + base_dn
-    res = ldb.search(expression="(&(cn=ldaptestuser4)(objectClass=user))", base=("cn=ldaptestcontainer2," + base_dn), scope=SCOPE_SUBTREE)
-    assert len(res) == 0
-
-    print "Testing delete of subtree renamed "+("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn)
-    ldb.delete(("CN=ldaptestuser4,CN=ldaptestcontainer2," + base_dn))
-    print "Testing delete of renamed cn=ldaptestcontainer2," + base_dn
-    ldb.delete("cn=ldaptestcontainer2," + base_dn)
-    
-    try:
-        ldb.add({"dn": "cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-    except LdbError, (num, _):
-        ldb.delete("cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn)
-        ldb.add({"dn": "cn=ldaptestutf8user èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-
-    try:
-        ldb.add({"dn": "cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn, "objectClass": "user"})
-    except LdbError, (num, _):
-        ldb.delete("cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn)
-        ldb.add({"dn": "cn=ldaptestutf8user2  èùéìòà ,cn=users," + base_dn,
-                  "objectClass": "user"})
-
-    print "Testing ldb.search for (&(cn=ldaptestuser)(objectClass=user))"
-    res = ldb.search(expression="(&(cn=ldaptestuser)(objectClass=user))")
-    assert len(res) == 1, "Could not find (&(cn=ldaptestuser)(objectClass=user))"
-
-    assertEquals(str(res[0].dn), ("CN=ldaptestuser,CN=Users," + base_dn))
-    assertEquals(res[0]["cn"], "ldaptestuser")
-    assertEquals(res[0]["name"], "ldaptestuser")
-    assertEquals(res[0]["objectClass"], ["top", "person", "organizationalPerson", "user"])
-    assert("objectGUID&qu