s3:utils: Tell users that workgroup/realm is required for ADS mode
authorAndreas Schneider <asn@samba.org>
Wed, 28 Apr 2021 10:09:21 +0000 (12:09 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 29 Apr 2021 03:58:37 +0000 (03:58 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14695

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/utils/testparm.c

index e870104a2c5531a734057df3afc07d762a6cd506..bb4957ef557728cbab7084c052a2badea42e1449 100644 (file)
@@ -215,6 +215,8 @@ static int do_global_checks(void)
        const struct loadparm_substitution *lp_sub =
                loadparm_s3_global_substitution();
 
+       fprintf(stderr, "\n");
+
        if (lp_security() >= SEC_DOMAIN && !lp_encrypt_passwords()) {
                fprintf(stderr, "ERROR: in 'security=domain' mode the "
                                "'encrypt passwords' parameter must always be "
@@ -222,6 +224,26 @@ static int do_global_checks(void)
                ret = 1;
        }
 
+       if (lp_security() == SEC_ADS) {
+               const char *workgroup = lp_workgroup();
+               const char *realm = lp_realm();
+
+               if (workgroup == NULL || strlen(workgroup) == 0) {
+                       fprintf(stderr,
+                               "ERROR: The 'security=ADS' mode requires "
+                               "'workgroup' parameter to be set!\n\n ");
+                       ret = 1;
+               }
+
+               if (realm == NULL || strlen(realm) == 0) {
+                       fprintf(stderr,
+                               "ERROR: The 'security=ADS' mode requires "
+                               "'realm' parameter to be set!\n\n ");
+                       ret = 1;
+               }
+       }
+
+
        if (lp_we_are_a_wins_server() && lp_wins_server_list()) {
                fprintf(stderr, "ERROR: both 'wins support = true' and "
                                "'wins server = <server list>' cannot be set in "