s4-ldb: convert the openldap ldb backend to the new style of module
authorAndrew Tridgell <tridge@samba.org>
Mon, 1 Nov 2010 01:37:35 +0000 (12:37 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 1 Nov 2010 07:55:19 +0000 (18:55 +1100)
source4/lib/ldb/ldb_ldap/ldb_ldap.c
source4/lib/ldb/wscript

index b83ca87c5cf117ad85cece77d345afcb2ebef9a3..5b8b2d7b7d14a4d486aeea10367984b975370f13 100644 (file)
@@ -954,17 +954,18 @@ failed:
        return LDB_ERR_OPERATIONS_ERROR;
 }
 
-const struct ldb_backend_ops ldb_ldap_backend_ops = {
-       .name = "ldap",
-       .connect_fn = lldb_connect
-};
-
-const struct ldb_backend_ops ldb_ldapi_backend_ops = {
-       .name = "ldapi",
-       .connect_fn = lldb_connect
-};
-
-const struct ldb_backend_ops ldb_ldaps_backend_ops = {
-       .name = "ldaps",
-       .connect_fn = lldb_connect
-};
+/*
+  initialise the module
+ */
+int ldb_ldap_init(const char *ldb_version)
+{
+       int ret, i;
+       const char *names[] = { "ldap", "ldaps", "ldapi", NULL };
+       for (i=0; names[i]; i++) {
+               ret = ldb_register_backend(names[i], lldb_connect);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
+       }
+       return LDB_SUCCESS;
+}
index d7e0efeeb3f8f31368cc1caf9913c95087ffcc07..600f3001ab2a81455b17f897aa2c04dd8ea759e4 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '0.9.17'
+VERSION = '0.9.18'
 
 blddir = 'bin'
 
@@ -95,7 +95,8 @@ def build(bld):
     else:
         # this is not included in the s4 build
         bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
-                         init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
+                         init_function='ldb_ldap_init',
+                         module_init_name='ldb_init_module',
                          deps='talloc lber ldap',
                          enabled=bld.env.ENABLE_LDAP_BACKEND,
                          internal_module=False,