diff options
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_guest.c | 6 | ||||
-rw-r--r-- | source3/passdb/pdb_interface.c | 50 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 20 | ||||
-rw-r--r-- | source3/passdb/pdb_nisplus.c | 10 | ||||
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 7 | ||||
-rw-r--r-- | source3/passdb/pdb_tdb.c | 19 | ||||
-rw-r--r-- | source3/passdb/pdb_unix.c | 5 |
7 files changed, 42 insertions, 75 deletions
diff --git a/source3/passdb/pdb_guest.c b/source3/passdb/pdb_guest.c index 3f0f06d18d..f5a15057e0 100644 --- a/source3/passdb/pdb_guest.c +++ b/source3/passdb/pdb_guest.c @@ -121,3 +121,9 @@ NTSTATUS pdb_init_guestsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, c /* There's not very much to initialise here */ return NT_STATUS_OK; } + +int pdb_guest_init(void) +{ + return smb_register_passdb("guest", pdb_init_guestsam, PASSDB_INTERFACE_VERSION); +} + diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 48a039b3de..9819df75ec 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -24,39 +24,14 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB -/** List of various built-in passdb modules */ -static const struct { - const char *name; - /* Function to create a member of the pdb_methods list */ - pdb_init_function init; -} builtin_pdb_init_functions[] = { - { "smbpasswd", pdb_init_smbpasswd }, - { "smbpasswd_nua", pdb_init_smbpasswd_nua }, - { "tdbsam", pdb_init_tdbsam }, - { "tdbsam_nua", pdb_init_tdbsam_nua }, - { "ldapsam", pdb_init_ldapsam }, - { "ldapsam_nua", pdb_init_ldapsam_nua }, - { "unixsam", pdb_init_unixsam }, - { "guest", pdb_init_guestsam }, - { "nisplussam", pdb_init_nisplussam }, - { NULL, NULL} -}; - -static struct pdb_init_function_entry *backends; -static void lazy_initialize_passdb(void); - -static void lazy_initialize_passdb() -{ - int i; - static BOOL initialised = False; - - if(!initialised) { - initialised = True; +static struct pdb_init_function_entry *backends = NULL; - for(i = 0; builtin_pdb_init_functions[i].name; i++) { - smb_register_passdb(builtin_pdb_init_functions[i].name, builtin_pdb_init_functions[i].init, PASSDB_INTERFACE_VERSION); - } - } +static void lazy_initialize_passdb(void) +{ + static BOOL initialized = FALSE; + if(initialized)return; + static_init_pdb; + initialized = TRUE; } BOOL smb_register_passdb(const char *name, pdb_init_function init, int version) @@ -451,13 +426,18 @@ static NTSTATUS make_pdb_methods_name(struct pdb_methods **methods, struct pdb_c entry = pdb_find_backend_entry(module_name); /* Try to find a module that contains this module */ - if(!entry) { - smb_probe_module("passdb", module_name); - entry = pdb_find_backend_entry(module_name); + if (!entry) { + DEBUG(2,("No builtin backend found, trying to load plugin\n")); + if(smb_probe_module("passdb", module_name) && !(entry = pdb_find_backend_entry(module_name))) { + DEBUG(0,("Plugin is available, but doesn't register passdb backend %s\n", module_name)); + SAFE_FREE(module_name); + return NT_STATUS_UNSUCCESSFUL; + } } /* No such backend found */ if(!entry) { + DEBUG(0,("No builtin nor plugin backend for %s found\n", module_name)); SAFE_FREE(module_name); return NT_STATUS_INVALID_PARAMETER; } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 2571ecd33a..98ddc72ed1 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -28,7 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB -#ifdef HAVE_LDAP /* TODO: * persistent connections: if using NSS LDAP, many connections are made * however, using only one within Samba would be nice @@ -2611,20 +2610,9 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method return NT_STATUS_OK; } - -#else - -NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location) +int pdb_ldap_init(void) { - DEBUG(0, ("ldap not detected at configure time, ldapsam not availalble!\n")); - return NT_STATUS_UNSUCCESSFUL; + smb_register_passdb("ldapsam", pdb_init_ldapsam, PASSDB_INTERFACE_VERSION); + smb_register_passdb("ldapsam_nua", pdb_init_ldapsam_nua, PASSDB_INTERFACE_VERSION); + return TRUE; } - -NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location) -{ - DEBUG(0, ("ldap not dectected at configure time, ldapsam_nua not available!\n")); - return NT_STATUS_UNSUCCESSFUL; -} - - -#endif diff --git a/source3/passdb/pdb_nisplus.c b/source3/passdb/pdb_nisplus.c index 0a42c36ea0..73d65af1c6 100644 --- a/source3/passdb/pdb_nisplus.c +++ b/source3/passdb/pdb_nisplus.c @@ -24,8 +24,6 @@ #include "includes.h" -#ifdef WITH_NISPLUS_SAM - #ifdef BROKEN_NISPLUS_INCLUDE_FILES /* @@ -1555,11 +1553,7 @@ NTSTATUS pdb_init_nisplussam (PDB_CONTEXT * pdb_context, return NT_STATUS_OK; } -#else -NTSTATUS pdb_init_nisplussam (PDB_CONTEXT * c, PDB_METHODS ** m, - const char *l) +int pdb_nisplus_init(void) { - DEBUG (0, ("nisplus sam not compiled in!\n")); - return NT_STATUS_UNSUCCESSFUL; + return smb_register_passdb("nisplussam", pdb_init_nisplussam, PASSDB_INTERFACE_VERSION); } -#endif /* WITH_NISPLUS_SAM */ diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index b5a2bbbfe7..bcbeb74808 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1579,3 +1579,10 @@ NTSTATUS pdb_init_smbpasswd_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_meth return NT_STATUS_OK; } + +int pdb_smbpasswd_init(void) +{ + smb_register_passdb("smbpasswd", pdb_init_smbpasswd, PASSDB_INTERFACE_VERSION); + smb_register_passdb("smbpasswd_nua", pdb_init_smbpasswd_nua, PASSDB_INTERFACE_VERSION); + return TRUE; +} diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index c48c9567b1..da6fcf70fc 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -37,8 +37,6 @@ static int tdbsam_debug_level = DBGC_ALL; #endif -#ifdef WITH_TDB_SAM - #define PDB_VERSION "20010830" #define PASSDB_FILE_NAME "passdb.tdb" #define TDB_FORMAT_STRING "ddddddBBBBBBBBBBBBddBBwdwdBdd" @@ -988,20 +986,9 @@ NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, return NT_STATUS_OK; } - -#else - -NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location) +int pdb_tdbsam_init(void) { - DEBUG(0, ("tdbsam not compiled in!\n")); - return NT_STATUS_UNSUCCESSFUL; + smb_register_passdb("tdbsam", pdb_init_tdbsam, PASSDB_INTERFACE_VERSION); + smb_register_passdb("tdbsam_nua", pdb_init_tdbsam_nua, PASSDB_INTERFACE_VERSION); } -NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location) -{ - DEBUG(0, ("tdbsam_nua not compiled in!\n")); - return NT_STATUS_UNSUCCESSFUL; -} - - -#endif diff --git a/source3/passdb/pdb_unix.c b/source3/passdb/pdb_unix.c index 07acd08a4e..dcdf5cf50b 100644 --- a/source3/passdb/pdb_unix.c +++ b/source3/passdb/pdb_unix.c @@ -123,3 +123,8 @@ NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co /* There's not very much to initialise here */ return NT_STATUS_OK; } + +int pdb_unix_init(void) +{ + return smb_register_passdb("unixsam", pdb_init_unixsam, PASSDB_INTERFACE_VERSION); +} |