diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/passdb.h | 14 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 2 | ||||
-rw-r--r-- | source3/passdb/pdb_plugin.c | 18 |
3 files changed, 32 insertions, 2 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h index bd1d1e159b..a79c8a0289 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -27,6 +27,20 @@ Functions to be implemented by the new (v2) passdb API ****************************************************************/ +/* + * This next constant specifies the version number of the PASSDB interface + * this SAMBA will load. Increment this if *ANY* changes are made to the interface. + */ + +#define PASSDB_INTERFACE_VERSION 2 + +/* 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_ldap.c b/source3/passdb/pdb_ldap.c index 0a16071419..a5530efdb6 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -693,7 +693,7 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, if (!get_single_attribute(ldap_struct, entry, "homeDrive", dir_drive)) { pdb_set_dir_drive(sampass, standard_sub_specified(sampass->mem_ctx, - lp_logon_path(), + lp_logon_drive(), username, domain, uid, gid), False); diff --git a/source3/passdb/pdb_plugin.c b/source3/passdb/pdb_plugin.c index f7ab2b90e2..1a246631fe 100644 --- a/source3/passdb/pdb_plugin.c +++ b/source3/passdb/pdb_plugin.c @@ -29,6 +29,7 @@ NTSTATUS pdb_init_plugin(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con void * dl_handle; char *plugin_location, *plugin_name, *p; pdb_init_function plugin_init; + int (*plugin_version)(void); if (location == NULL) { DEBUG(0, ("The plugin module needs an argument!\n")); @@ -51,8 +52,23 @@ NTSTATUS pdb_init_plugin(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con return NT_STATUS_UNSUCCESSFUL; } + plugin_version = sys_dlsym(dl_handle, "pdb_version"); + if (!plugin_version) { + sys_dlclose(dl_handle); + DEBUG(0, ("Failed to find function 'pdb_version' using sys_dlsym in sam plugin %s (%s)\n", plugin_name, sys_dlerror())); + return NT_STATUS_UNSUCCESSFUL; + } + + if (plugin_version()!=PASSDB_INTERFACE_VERSION) { + sys_dlclose(dl_handle); + DEBUG(0, ("Wrong PASSDB_INTERFACE_VERSION! sam plugin has version %d and version %d is needed! Please update!\n", + plugin_version(),PASSDB_INTERFACE_VERSION)); + return NT_STATUS_UNSUCCESSFUL; + } + plugin_init = sys_dlsym(dl_handle, "pdb_init"); - if (!plugin_init){ + if (!plugin_init) { + sys_dlclose(dl_handle); DEBUG(0, ("Failed to find function 'pdb_init' using sys_dlsym in sam plugin %s (%s)\n", plugin_name, sys_dlerror())); return NT_STATUS_UNSUCCESSFUL; } |