summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-11-15 17:01:24 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-11-15 17:01:24 +0000
commit9da3d41f3cf64372b85da0be169f62a115552294 (patch)
tree351d241129dace0d7fdcc9f8caf80b25dee08c92
parente1fa4b1d484e7856ad3aee26197d32d63dca90d5 (diff)
downloadsamba-9da3d41f3cf64372b85da0be169f62a115552294.tar.gz
samba-9da3d41f3cf64372b85da0be169f62a115552294.tar.bz2
samba-9da3d41f3cf64372b85da0be169f62a115552294.zip
Use smb_register_passdb() - plus some small fixes
(This used to be commit 2addbaff358993923a58ad3845c63168678c2c21)
-rw-r--r--source3/Makefile.in16
-rw-r--r--source3/include/passdb.h7
-rw-r--r--source3/modules/mysql.c (renamed from source3/passdb/pdb_mysql.c)18
-rw-r--r--source3/modules/xml.c (renamed from source3/passdb/pdb_xml.c)14
-rw-r--r--source3/passdb/pdb_interface.c1
5 files changed, 32 insertions, 24 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index c82eb5dad3..453a87d0d5 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -116,7 +116,7 @@ SCRIPTS = $(srcdir)/script/smbtar $(srcdir)/script/addtosmbpass $(srcdir)/script
QUOTAOBJS=@QUOTAOBJS@
-MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@ bin/developer.@SHLIBEXT@ @MODULE_PDB_MYSQL@ @MODULE_PDB_XML@
+MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@ bin/developer.@SHLIBEXT@ @MODULE_MYSQL@ @MODULE_XML@
######################################################################
# object file lists
@@ -223,12 +223,12 @@ PASSDB_GET_SET_OBJ = passdb/pdb_get_set.o
PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \
passdb/machine_sid.o passdb/pdb_smbpasswd.o \
- passdb/pdb_tdb.o passdb/pdb_ldap.o passdb/pdb_plugin.o \
+ passdb/pdb_tdb.o passdb/pdb_ldap.o \
passdb/pdb_unix.o passdb/util_sam_sid.o \
passdb/pdb_compat.o passdb/pdb_nisplus.o
-PDB_XML_OBJ = passdb/pdb_xml.o
-PDB_MYSQL_OBJ = passdb/pdb_mysql.o
+XML_OBJ = modules/xml.o
+MYSQL_OBJ = modules/mysql.o
DEVEL_HELP_OBJ = modules/developer.o
SAM_STATIC_MODULES = sam/sam_plugin.o sam/sam_skel.o sam/sam_ads.o
@@ -838,9 +838,9 @@ nsswitch/pam_winbind.@SHLIBEXT@: $(PAM_WINBIND_OBJ) bin/.dummy
@$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) \
@SONAMEFLAG@`basename $@` -lpam
-bin/pdb_mysql.@SHLIBEXT@: $(PDB_MYSQL_OBJ)
+bin/mysql.@SHLIBEXT@: $(MYSQL_OBJ)
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_MYSQL_OBJ) @MYSQL_LIBS@ \
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(MYSQL_OBJ) @MYSQL_LIBS@ \
@SONAMEFLAG@`basename $@`
bin/developer.@SHLIBEXT@: $(DEVEL_HELP_OBJ)
@@ -848,9 +848,9 @@ bin/developer.@SHLIBEXT@: $(DEVEL_HELP_OBJ)
@$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_OBJ) \
@SONAMEFLAG@`basename $@`
-bin/pdb_xml.@SHLIBEXT@: $(PDB_XML_OBJ)
+bin/xml.@SHLIBEXT@: $(XML_OBJ)
@echo "Building plugin $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_XML_OBJ) @XML_LIBS@ \
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ) @XML_LIBS@ \
@SONAMEFLAG@`basename $@`
bin/vfs_audit.@SHLIBEXT@: $(VFS_AUDIT_OBJ)
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 9436f255d4..f1e15f614a 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -34,13 +34,6 @@
#define PASSDB_INTERFACE_VERSION 4
-/* use this inside a passdb module */
-#define PDB_MODULE_VERSIONING_MAGIC \
-int pdb_version(void)\
-{\
- return PASSDB_INTERFACE_VERSION;\
-}
-
typedef struct pdb_context
{
struct pdb_methods *pdb_methods;
diff --git a/source3/passdb/pdb_mysql.c b/source3/modules/mysql.c
index 319bad7da2..5516befc08 100644
--- a/source3/passdb/pdb_mysql.c
+++ b/source3/modules/mysql.c
@@ -64,12 +64,10 @@ static int mysqlsam_debug_level = DBGC_ALL;
#undef DBGC_CLASS
#define DBGC_CLASS mysqlsam_debug_level
-PDB_MODULE_VERSIONING_MAGIC
-
typedef struct pdb_mysql_data {
MYSQL *handle;
MYSQL_RES *pwent;
- char *location;
+ const char *location;
} pdb_mysql_data;
/* Used to construct insert and update queries */
@@ -948,8 +946,8 @@ static NTSTATUS mysqlsam_enum_group_mapping(struct pdb_methods *methods,
}
-NTSTATUS pdb_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
- char *location)
+static NTSTATUS mysqlsam_init(struct pdb_context * pdb_context, struct pdb_methods ** pdb_method,
+ const char *location)
{
NTSTATUS nt_status;
struct pdb_mysql_data *data;
@@ -1033,3 +1031,13 @@ NTSTATUS pdb_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
return NT_STATUS_OK;
}
+
+int init_module(void);
+
+int init_module()
+{
+ if(smb_register_passdb("mysql", mysqlsam_init, PASSDB_INTERFACE_VERSION))
+ return 0;
+
+ return 1;
+}
diff --git a/source3/passdb/pdb_xml.c b/source3/modules/xml.c
index edf70250e2..ead3e3a874 100644
--- a/source3/passdb/pdb_xml.c
+++ b/source3/modules/xml.c
@@ -40,8 +40,6 @@ static int xmlsam_debug_level = DBGC_ALL;
#undef DBGC_CLASS
#define DBGC_CLASS xmlsam_debug_level
-PDB_MODULE_VERSIONING_MAGIC
-
static char * iota(int a) {
static char tmp[10];
@@ -514,7 +512,7 @@ static NTSTATUS xmlsam_add_sam_account(struct pdb_methods *methods, SAM_ACCOUNT
return NT_STATUS_OK;
}
-NTSTATUS pdb_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
+NTSTATUS xmlsam_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
const char *location)
{
NTSTATUS nt_status;
@@ -565,3 +563,13 @@ NTSTATUS pdb_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
return NT_STATUS_OK;
}
+
+int init_module(void);
+
+int init_module()
+{
+ if(smb_register_passdb("xml", xmlsam_init, PASSDB_INTERFACE_VERSION))
+ return 0;
+
+ return 1;
+}
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 2f79d305d3..79ce598149 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -38,7 +38,6 @@ const struct {
{ "ldapsam_nua", pdb_init_ldapsam_nua },
{ "unixsam", pdb_init_unixsam },
{ "nisplussam", pdb_init_nisplussam },
- { "plugin", pdb_init_plugin },
{ NULL, NULL}
};