Hi Jelmer,

here's a patch witch changes the syntax of the sam backend parameter:

now it's plugin[|DOMAIN][:options] ... I think it nicer:-)

If you didn't accept that patch please move the 'strchr' to 'strrchr', (but 
there're also a few other bugs, in the parsing sam_backend_string in 
make_backend_entry()), because as it is now it didn't work with:

plugin[:options][|DOMAIN] :-(

plugin:/usr/lib/samba/sam_passdb.so:test|test2:test3|test4|MX.BASE

breaks it...


metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <[EMAIL PROTECTED]>
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* 
HEAD/source/sam/interface.c HEAD-fix/source/sam/interface.c
--- HEAD/source/sam/interface.c Mon Sep 30 07:29:04 2002
+++ HEAD-fix/source/sam/interface.c     Tue Oct  1 09:35:27 2002
@@ -136,23 +136,22 @@ static NTSTATUS make_backend_entry(SAM_B
        
        SAM_ASSERT(sam_backend_string && backend_entry);
        
-       backend_entry->module_name = sam_backend_string;
-       
-       DEBUG(5,("makeing backend_entry for %s\n", backend_entry->module_name));
-       
+       DEBUG(5,("makeing backend_entry for %s\n", sam_backend_string));
+
+       if ((tmp = strchr(tmp_string, ':')) != NULL) {
+               *tmp = 0;
+               backend_entry->module_params = smb_xstrdup(tmp + 1);
+               DEBUG(20,("options for the backend: 
+%s\n",backend_entry->module_params));
+       }
+               
        if ((tmp = strchr(tmp_string, '|')) != NULL) {
-               DEBUGADD(20,("a domain name has been specified\n"));
                *tmp = 0;
                backend_entry->domain_name = smb_xstrdup(tmp + 1);
-               tmp_string = tmp + 1;
+               DEBUGADD(20,("the domain name is: %s\n",backend_entry->domain_name));
        }
        
-       if ((tmp = strchr(tmp_string, ':')) != NULL) {
-               DEBUG(20,("options for the backend have been specified\n"));
-               *tmp = 0;
-               backend_entry->module_params = smb_xstrdup(tmp + 1);
-               tmp_string = tmp + 1;
-       }
+       backend_entry->module_name = smb_xstrdup(tmp_string);
+       DEBUGADD(20,("module name is: %s\n", backend_entry->module_name));
                
        if (backend_entry->domain_name == NULL) {
                DEBUG(10,("make_backend_entry: no domain was specified for sam module 
%s. Using default domain %s\n",
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* 
HEAD/source/torture/cmd_sam.c HEAD-fix/source/torture/cmd_sam.c
--- HEAD/source/torture/cmd_sam.c       Mon Sep 30 07:29:04 2002
+++ HEAD-fix/source/torture/cmd_sam.c   Tue Oct  1 09:26:32 2002
@@ -61,7 +61,7 @@ static NTSTATUS cmd_load_module(struct s
        }
 
        if (argc == 3)
-               asprintf(&plugin_arg[0], "plugin:%s|%s", argv[1], argv[2]);
+               asprintf(&plugin_arg[0], "plugin|%s:%s", argv[2], argv[1]);
        else
                asprintf(&plugin_arg[0], "plugin:%s", argv[1]);
 

Reply via email to