]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: handle --build-options without parsing smb.conf
authorAndreas Schneider <asn@samba.org>
Thu, 13 Jan 2022 14:31:33 +0000 (15:31 +0100)
committerDavid Disseldorp <ddiss@samba.org>
Mon, 17 Jan 2022 12:23:33 +0000 (12:23 +0000)
The smb.conf is parsed in post mode of a popt callback. The smbd
--build-options parameter should be handled when first encountered
to avoid requiring smb.conf presence.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14945

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
source3/smbd/server.c

index 39aa0d91624917050e496c5736081d6fc1e1870d..abb54d3ced8afe063378bf6308948e390f925554 100644 (file)
@@ -1554,7 +1554,6 @@ extern void build_options(bool screen);
        char *profile_level = NULL;
        int opt;
        poptContext pc;
-       bool print_build_options = False;
        struct server_id main_server_id = {0};
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -1657,7 +1656,8 @@ extern void build_options(bool screen);
        while((opt = poptGetNextOpt(pc)) != -1) {
                switch (opt)  {
                case 'b':
-                       print_build_options = True;
+                       build_options(true); /* Display output to screen as well as debug */
+                       exit(0);
                        break;
                default:
                        d_fprintf(stderr, "\nInvalid option %s: %s\n\n",
@@ -1674,11 +1674,6 @@ extern void build_options(bool screen);
                log_stdout = True;
        }
 
-       if (print_build_options) {
-               build_options(True); /* Display output to screen as well as debug */
-               exit(0);
-       }
-
 #ifdef HAVE_SETLUID
        /* needed for SecureWare on SCO */
        setluid(0);