summaryrefslogtreecommitdiff
path: root/examples/pdb
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2002-11-15 17:49:47 +0000
committerJelmer Vernooij <jelmer@samba.org>2002-11-15 17:49:47 +0000
commit794ecd30f9bb9dee5408b248894957ee2d3fd07a (patch)
tree46b243fc8180b826283276be3c55761619226c1d /examples/pdb
parent52412699c1b92f82e9e3623d9959019f2a53ec0c (diff)
downloadsamba-794ecd30f9bb9dee5408b248894957ee2d3fd07a.tar.gz
samba-794ecd30f9bb9dee5408b248894957ee2d3fd07a.tar.bz2
samba-794ecd30f9bb9dee5408b248894957ee2d3fd07a.zip
Update to use smb_register_passdb()
(This used to be commit b10541b71ba288783976e8c124b6667b7df3b12d)
Diffstat (limited to 'examples/pdb')
-rw-r--r--examples/pdb/README46
-rw-r--r--examples/pdb/pdb_test.c14
2 files changed, 13 insertions, 47 deletions
diff --git a/examples/pdb/README b/examples/pdb/README
index 561473129b..7fe4524882 100644
--- a/examples/pdb/README
+++ b/examples/pdb/README
@@ -1,46 +1,7 @@
README for Samba Password Database (PDB) examples
====================================================
-8-8-2002 Jelmer Vernooij <jelmer@samba.org>
-
-Added mysql and xml modules. See README in xml/ and mysql/ for details.
-
-21-6-2002 Stefan (metze) Metzmacher <metze@metzemix.de>
-
-I have added an interface versioning.
-
-Every module MUST have a pdb_version() function.
-
-this is defined in include/passdb.h:
-#define PDB_MODULE_VERSIONING_MAGIC \
-int pdb_version(void)\
-{\
- return PASSDB_INTERFACE_VERSION;\
-}
-
-You MUST add this line inside a module:
-PDB_MODULE_VERSIONING_MAGIC
-
-21-6-2002 Stefan (metze) Metzmacher <metze@metzemix.de>
-
-The pdb_interface was changed:
-
-this function are deleted:
-static BOOL testsam_getsampwrid (struct pdb_methods *methods, SAM_ACCOUNT *user, uint32 rid)
-
-this function are added:
-static BOOL testsam_getsampwsid (struct pdb_methods *methods, SAM_ACCOUNT *user, DOM_SID sid)
-
-In the SAM_ACCOUNT struct:
-
-this fields are deleted:
-uint32 user_rid;
-uint32 group_rid;
-
-this fields are added:
-DOM_SID user_sid;
-DOM_SID group_sid;
-
-15-2-2002 Jelmer Vernooij <jelmer@nl.linux.org>
+Jelmer Vernooij <jelmer@nl.linux.org>
+Stefan (metze) Metzmacher <metze@metzemix.de>
The pdb_test.c file in this directory contains a very basic example of
a pdb plugin. It just prints the name of the function that is executed using
@@ -50,6 +11,5 @@ future too..
To debug passdb backends, try to run gdb on the 'pdbedit' executable. That's really much easier than restarting smbd constantly and attaching with your debugger.
New passdb plugins should go into the samba lib directory, (/usr/lib/samba/ for
-most distributions) and should be prefixed with 'pdb_'. An example would be:
-/usr/lib/samba/pdb_test.so
+most distributions). An example would be: /usr/lib/samba/test.so
diff --git a/examples/pdb/pdb_test.c b/examples/pdb/pdb_test.c
index c5ba094e42..f5fb57ddb2 100644
--- a/examples/pdb/pdb_test.c
+++ b/examples/pdb/pdb_test.c
@@ -25,9 +25,6 @@ static int testsam_debug_level = DBGC_ALL;
#undef DBGC_CLASS
#define DBGC_CLASS testsam_debug_level
-/* define the version of the passdb interface */
-PDB_MODULE_VERSIONING_MAGIC
-
/***************************************************************
Start enumeration of the passwd list.
****************************************************************/
@@ -107,7 +104,7 @@ static NTSTATUS testsam_add_sam_account (struct pdb_methods *methods, SAM_ACCOUN
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS pdb_init(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+NTSTATUS testsam_init(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
{
NTSTATUS nt_status;
@@ -141,3 +138,12 @@ NTSTATUS pdb_init(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char
return NT_STATUS_OK;
}
+
+int init_module(void);
+
+int init_module() {
+ if(smb_register_passdb("testsam", testsam_init, PASSDB_INTERFACE_VERSION))
+ return 0;
+
+ return 1;
+}