[RFC] smbcquotas: correct init order

Uri Simchoni uri at samba.org
Tue Oct 4 20:06:32 UTC 2016


Hi,

The attached patch (not even a git commit yet) changes the order of
loadparm initialization and command line processing in smbcquotas.

Andreas brought to my attention that something in the free-disk+quota
tests (samba3.blackbox.dfree_quota) isn't reading the self-test env
smb.conf, but is instead reading the default smb.conf for the binary.
This seems to fix it for this test.

I'd like some input whether this is sufficient for fixing the issue. I
see that some test scripts are handed the location of smb.conf, but it
seems to be unnecessary because the selftest env is setting
SMB_CONF_PATH env var which directly affects smb.conf location if the
command line is processed prior to loading smb.conf. What I'm asking
really is whether we should consider the place of smb.conf when writing
black-box tests, or is it taken care of automatically via SMB_CONF_PATH.

Also please comment if there are things to watch out for with respect to
order of lp_ and popt processing.

Thanks,
Uri.
-------------- next part --------------
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 06ecea1..0dac046 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -617,7 +617,6 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
 
 	fault_setup();
 
-	lp_load_global(get_dyn_CONFIGFILE());
 	load_interfaces();
 
 	smbcquotas_auth_info = user_auth_info_init(frame);
@@ -714,6 +713,11 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
 	poptFreeContext(pc);
 	popt_burn_cmdline_password(argc, argv);
 
+	if (!lp_load_global(get_dyn_CONFIGFILE())) {
+		DEBUG(0, ("ERROR loading config file...\n"));
+		exit(1);
+	}
+
 	string_replace(path, '/', '\\');
 
 	server = SMB_STRDUP(path+2);


More information about the samba-technical mailing list