- Point users at the HOWTO Collection instead of 'README' in modules/mysql.c
authorJelmer Vernooij <jelmer@samba.org>
Sun, 30 Mar 2003 12:42:18 +0000 (12:42 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 30 Mar 2003 12:42:18 +0000 (12:42 +0000)
- Make passdb work with absolute paths (passdb backend = /path/to/smbpasswd.so works now). vfs, rpc and charset will follow
(This used to be commit 794d3ed03619a4e41558d9ff65783a1aa1b2be90)

source3/lib/module.c
source3/modules/mysql.c
source3/passdb/pdb_interface.c
source3/utils/pdbedit.c

index bf37078bb92d540d4f70c11605fc155fc1b2e11f..e400945a8bd343cd05e1c5b3a5f8f5f0332f5d09 100644 (file)
@@ -80,7 +80,7 @@ int smb_probe_module(const char *subsystem, const char *module)
        pstring full_path;
        
        /* Check for absolute path */
-       if(module[0] == '/')return smb_load_module(module);
+       if(strchr_m(module, '/'))return smb_load_module(module);
        
        pstrcpy(full_path, lib_path(subsystem));
        pstrcat(full_path, "/");
@@ -117,7 +117,31 @@ int smb_probe_module(const char *subsystem, const char *module)
 
 void init_modules(void)
 {
+       /* FIXME: This can cause undefined symbol errors :
+        *  smb_register_vfs() isn't available in nmbd, for example */
        if(lp_preload_modules()) 
                smb_load_modules(lp_preload_modules());
-       /* FIXME: load static modules */
+}
+
+
+/*************************************************************************
+ * This functions /path/to/foobar.so -> foobar
+ ************************************************************************/
+void module_path_get_name(char *path, pstring name)
+{
+       char *s;
+
+       /* First, make the path relative */
+       s = strrchr_m(path, '/');
+       if(s) pstrcpy(name, s+1);
+       else pstrcpy(name, path);
+       
+       if (dyn_SHLIBEXT && *dyn_SHLIBEXT && strlen(dyn_SHLIBEXT) < strlen(name)) {
+               int n = strlen(name) - strlen(dyn_SHLIBEXT);
+               
+               /* Remove extension if necessary */
+               if (name[n-1] == '.' && !strcmp(name+n, dyn_SHLIBEXT)) {
+                       name[n-1] = '\0';
+               }
+       }
 }
index 40694d6e7d49b18cb6435bfbc8a860d8093fd386..684eb96645ea6279dbf736988710adfb252cf302 100644 (file)
@@ -933,7 +933,7 @@ static NTSTATUS mysqlsam_init(struct pdb_context * pdb_context, struct pdb_metho
        data->pwent = NULL;
 
        if (!location) {
-               DEBUG(0, ("No identifier specified. See README for details\n"));
+               DEBUG(0, ("No identifier specified. Check the Samba HOWTO Collection for details\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
 
index 4d9ec7beea6901480c7ee872c17aefd5780392bb..95f587b07693aae65bd1360661b89a134959cd02 100644 (file)
@@ -64,9 +64,12 @@ BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
 struct pdb_init_function_entry *pdb_find_backend_entry(const char *name)
 {
        struct pdb_init_function_entry *entry = backends;
+       pstring stripped;
+
+       module_path_get_name(name, stripped);
 
        while(entry) {
-               if (strequal(entry->name, name)) return entry;
+               if (strequal(entry->name, stripped)) return entry;
                entry = entry->next;
        }
 
index f33dbd9f1c90cab58c17221ff6704f108abe05a8..bf42fb805f4faac760f3083ce2f0faec4f6b46f8 100644 (file)
@@ -563,8 +563,6 @@ int main (int argc, char **argv)
                exit(1);
        }
 
-       init_modules();
-       
        if (!init_names())
                exit(1);