PATCH: auth module dynamic loading fix

Stefan (metze) Metzmacher metze at metzemix.de
Wed Dec 11 14:36:58 GMT 2002


At 22:46 11.12.2002 +1100, Luke Howard wrote:

>There was a small nit in the authentication subsystem that
>prevented dynamic loading of authentication providers. The
>attached patch fixes this.
Hi Luke,

I think your patch is wrong, then the builtin module will not be loaded...

the attached patch should fix your problem.


metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/auth/auth.c HEAD-pdb/source/auth/auth.c
--- HEAD/source/auth/auth.c	Wed Nov 13 19:52:30 2002
+++ HEAD-pdb/source/auth/auth.c	Wed Dec 11 15:31:38 2002
@@ -340,25 +340,24 @@ static NTSTATUS make_auth_context_text_l
 		DEBUG(5,("Attempting to find an auth method to match %s\n", *text_list));
 		for (i = 0; builtin_auth_init_functions[i].name; i++)
 		{
-			if (strequal(builtin_auth_init_functions[i].name, *text_list))
-			{
-				
-				char *module_name = smb_xstrdup(*text_list);
-				char *module_params = NULL;
-				char *p;
-				
-				p = strchr(module_name, ':');
+			char *module_name = smb_xstrdup(*text_list);
+			char *module_params = NULL;
+			char *p;
+			
+			p = strchr(module_name, ':');
+			
+			if (p) {
+				*p = 0;
 				
-				if (p) {
-					*p = 0;
-					
-					module_params = p+1;
-					
-					trim_string(module_params, " ", " ");
-				}
+				module_params = p+1;
 				
-				trim_string(module_name, " ", " ");
-
+				trim_string(module_params, " ", " ");
+			}
+			
+			trim_string(module_name, " ", " ");
+			
+			if (strequal(builtin_auth_init_functions[i].name, module_name))
+			{
 				DEBUG(5,("Found auth method %s (at pos %d)\n", *text_list, i));
 				if (NT_STATUS_IS_OK(builtin_auth_init_functions[i].init(*auth_context, module_params, &t))) {
 					DEBUG(5,("auth method %s has a valid init\n", *text_list));
@@ -369,6 +368,7 @@ static NTSTATUS make_auth_context_text_l
 				SAFE_FREE(module_name);
 				break;
 			}
+			SAFE_FREE(module_name);
 		}
 	}
 	


More information about the samba-technical mailing list