[Fwd: Re: Two patches to add self-checks, part 1 of 7]

Dave Collier-Brown davec-b at rogers.com
Fri Apr 25 00:57:25 GMT 2003


Here's a diff -u of just the corrections Andrew identified.
As testparm runs at debug level 2, this will work.

--dave



@@ -2283,7 +2282,7 @@
        }
        /* Self-test 2. */
        else if ((st.st_mode & 0777) != 0755) {
-          DEBUG(0,("WARNING: lock directory \"%s\" should have "
+          DEBUG(1,("WARNING: lock directory \"%s\" should have "
             "permissions 0755 for browsing and locks to work\n", 
             lp_lockdir()));
        }
@@ -2372,13 +2371,18 @@
        }
        if (*lp_winbind_separator() == '+') {
                /* Self-test 9 */
-               DEBUG(0,("WARNING: winbind separator = + may cause "
+               DEBUG(1,("WARNING: winbind separator = + may cause "
                         "problems with group membership.\n"));
        }
 
  
     /* Password server should be a netbios name or IP address. */
+    /* This will support DNS when the AD code is all done. */
     if (lp_passwordserver != NULL) {
+
+#define DNS_UNSUPPORTED_IN_PASSWORDSERVER 1
+#ifdef DNS_UNSUPPORTED_IN_PASSWORDSERVER
+
        if (strchr(lp_passwordserver(),'.') != NULL &&
            !isdigit(*lp_passwordserver())) {
                /* Self-test 10. */
@@ -2387,7 +2391,9 @@
                         lp_passwordserver()));
                bRetval = False;
        }
-       else if (strlen(lp_passwordserver()) >= 15) {
+       else 
+#endif /* DNS_UNSUPPORTED_IN_PASSWORDSERVER */
+       if (strlen(lp_passwordserver()) >= 15) {
                /* Self-test 11. */
                DEBUG(0,("ERROR: password server \"%s\" is too long to "
                         "be a legal NetBIOS name, logons will fail.\n",
@@ -2396,10 +2402,10 @@
        }
     }
     /* Be sure update encrypted is done with NON-encrypted passwords.
*/
-    if (lp_update_encrypted() && lp_encrypted_passwords()) {
+    if (lp_update_encrypted() && ! lp_encrypted_passwords()) {
        /* Self-test 12. */
-       DEBUG(0,("WARNING: update encrypted = yes requires encrypt "
-          "passwords = yes.\n"));
+       DEBUG(1,("WARNING: update encrypted = yes requires encrypt "
+          "passwords = no.\n"));
     }
     /* Er, should unix password sync be automatic if a smb */
     /* password file exists? */
@@ -2414,7 +2420,7 @@
          }
           if (access(passwd_prog, X_OK) == -1) {
             /* Self-test 13. */
-             DEBUG(0,("WARNING: the unix password sync program \"%s\" "
+             DEBUG(1,("WARNING: the unix password sync program \"%s\" "
                "can't be executed, errno was %d (\"%s\").\n",
                lp_passwd_program(),
                 errno, strerror(errno)));
@@ -2431,7 +2437,7 @@
        /* And the passwd chat isn't expecting the old password. */
        if (strstr(lp_passwd_chat(), "%o") != 0) {
          /* Self-test 15. */
-          DEBUG(0,("WARNING: the 'passwd chat' script [%s] depends on "
+          DEBUG(1,("WARNING: the 'passwd chat' script [%s] depends on "
             "getting the old password via the %%o substitution. With "
             "encrypted passwords and NT clients this will not work.\n",
              lp_passwd_chat()));
@@ -2443,7 +2449,7 @@
     /* interefere with serving browse lists. */
     if (lp_announce_as() != ANNOUNCE_AS_NT_SERVER) {
        /* Self-test 16. */
-       DEBUG(0,( "WARNING: announce as not set to \"NT\", this may "
+       DEBUG(1,( "WARNING: announce as not set to \"NT\", this may "
           "interfere with browsing.\n"));
     }
 
@@ -2482,13 +2488,13 @@
     if (s->szPath != NULL && s->szPath[0] != '\0') {
        if (stat(lp_pathname(iService),&buf) == -1) {
          /* Self-test 20. */
-          DEBUG(0,("WARNING: can't stat path \"%s\" in service
[%s].\n",
+          DEBUG(1,("WARNING: can't stat path \"%s\" in service
[%s].\n",
                 lp_pathname(iService), s->szService));
           DEBUGADD(0,("errno = %d (%s).\n", errno, strerror(errno)));
        }
        else if ((buf.st_mode & S_IFDIR) != S_IFDIR) {
          /* Self-test 21. */
-          DEBUG(0,("WARNING: Path %s in service [%s] isn't a
directory.\n",
+          DEBUG(1,("WARNING: Path %s in service [%s] isn't a
directory.\n",
                 lp_pathname(iService), s->szService));
        }
     }
@@ -2497,21 +2503,21 @@
     /* Ditto map system, map hidden. */
     if (s->bMap_archive == True && (s->iCreate_mask & 0100) == 0) {
        /* Self-test 22. */
-        DEBUG(0,( "WARNING: map archive = yes in share [%s], but create
"
+        DEBUG(1,( "WARNING: map archive = yes in share [%s], but create
"
                  "mask doesn't allow setting archive bit (100
octal).\n",
                  s->szService));
       }
    
      if (s->bMap_system == True && (s->iCreate_mask & 0010) ==  0) {
        /* Self-test 22b. */
-        DEBUG(0,( "WARNING: map system = yes in share [%s], but create
"
+        DEBUG(1,( "WARNING: map system = yes in share [%s], but create
"
                  "mask doesn't allow setting system bit (010
octal).\n",
                  s->szService));
      }
  
     if (s->bMap_hidden == True && (s->iCreate_mask & 0001) ==  0) {
        /* Self-test 22c. */
-        DEBUG(0,( "WARNING: map hidden = yes in share [%s], but create
"
+        DEBUG(1,( "WARNING: map hidden = yes in share [%s], but create
"
                  "mask doesn't allow setting hidden bit (001
octal).\n",
                  s->szService));
     }
@@ -2519,19 +2525,19 @@
     /* And see if force create mode sets any of the same three bits */
     if ((s->iCreate_force_mode & 0100) != 0) {
        /* Self-test 23. */
-        DEBUG(0,( "WARNING: force create mode forces archive bit on "
+        DEBUG(1,( "WARNING: force create mode forces archive bit on "
                  "on all files in share [%s].\n", 
                  s->szService));
     }
     if ((s->iCreate_force_mode & 0010) != 0) {
        /* Self-test 23b. */
-        DEBUG(0,( "WARNING: force create mode forces system bit on "
+        DEBUG(1,( "WARNING: force create mode forces system bit on "
                  "on all files in share [%s].\n", 
                  s->szService));
     }
     if ((s->iCreate_force_mode & 0001) != 0) {
        /* Self-test 23c. */
-        DEBUG(0,( "WARNING: force create mode forces hidden bit on "
+        DEBUG(1,( "WARNING: force create mode forces hidden bit on "
                  "on all file in share [%s].\n",
                  s->szService));
     }
@@ -2539,7 +2545,7 @@
     /* If a service is flagged unavailable, log the fact at level 0. */
     if (!s->bAvailable) {
        /* Self-test 24. */
-       DEBUG(1,( "NOTICE: Service [%s] is marked available = no.\n",
+       DEBUG(2,( "NOTICE: Service [%s] is marked available = no.\n",
              s->szService));
     }
  
@@ -2547,21 +2553,21 @@
     if (s->bBrowseable == False && Globals.bBrowseList == True
       && strwicmp(s->szService,HOMES_NAME) != 0) {
        /* Self-test 25. */
-       DEBUG(0,( "NOTICE: Service [%s] is unbrowsable, but browse "
-            "lists are being served.\n", s->szService));
+       DEBUG(2,( "NOTICE: Service [%s] is unbrowsable, but browse "
+            "lists are being served for other services.\n",
s->szService));
     }
  
     /* If we're syncing always, we need strict sync on too. */
     if (s->bSyncAlways == True && s->bStrictSync == False) {
        /* Self-test 26. */
-       DEBUG(0,("NOTICE: In service [%s], sync always = yes, which
requires "
+       DEBUG(2,("NOTICE: In service [%s], sync always = yes, which
requires "
          "strict sync = yes.\n", s->szService));
     }
  
     /* We need oplocks for level2 oplocks. */
     if (s->bLevel2OpLocks == True && s->bOpLocks == False) {
        /* Self-test 27. */
-       DEBUG(0,("NOTICE: In service [%s], level 2 oplocks = yes, which
"
+       DEBUG(2,("NOTICE: In service [%s], level 2 oplocks = yes, which
"
           "requires oplocks = yes as well.\n", s->szService));
     }
  
@@ -2570,7 +2576,7 @@
     if (s->szPath != NULL && s->szPath[0] == '\0' 
       && strwicmp(s->szService,HOMES_NAME) != 0) {
        /* Self-test 24. */
-       DEBUG(0,("NOTICE: No path in service [%s], using %s\n",
+       DEBUG(2,("NOTICE: No path in service [%s], using %s\n",
                s->szService,tmpdir()));
        string_set(&s->szPath,tmpdir());      
    }

@@ -2697,14 +2703,15 @@
   
     *buf = '\0';
     if (lp_security() != SEC_SERVER && lp_security() != SEC_DOMAIN) {
-        DEBUG(0,("WARNING: password server set to \"%s\",
",pszParmValue));
+        DEBUG(1,("WARNING: password server set to \"%s\",
",pszParmValue));
         DEBUGADD(0,("but security is neither server nor domain.\n"
          "password server value ignored\n"));
         return True;
     }
  
     /* A "*" by itself means search for Primary or Backup Domain
controllers */
-    if (lp_security() == SEC_DOMAIN && *pszParmValue == '*') {
+    if ((lp_security() == SEC_DOMAIN  || lp_security() == SEC_SERVER)
+       && *pszParmValue == '*') {
         pstrcpy(buf,pszParmValue); 
     }
     else {
@@ -2737,7 +2744,7 @@
  
     /* Alternative 1a: manage FQDN by removing domain */
     if ((p = strchr(pszParmValue, '.')) != NULL) {
-       DEBUG(0,("WARNING: netbios name \"%s\" contained a dot,\n",
+       DEBUG(1,("WARNING: netbios name \"%s\" contained a dot,\n",
                pszParmValue));
 #ifdef FIX
        *p = '\0';
@@ -2755,17 +2762,17 @@
 #ifdef FIX
        pszParmValue[15] = '\0';
        len = 15;
-       DEBUG(0,("netbios name is longer than 15 characters, "
+       DEBUG(1,("WARNING: netbios name is longer than 15 characters, "
                "and has been truncated to \"%s\".\n", pszParmValue));
 #else
-       DEBUG(0,("netbios name is longer than 15 characters\n",
pszParmValue));
+       DEBUG(0,("ERROR: netbios name is longer than 15 characters\n",
pszParmValue));
        return False;
 #endif
     }
 
     /* Alternative 2: fail non-alphanumerics. */
     if ((i = strspn(pszParmValue,legalNetbiosChars)) < len) {
-       DEBUG(0,("netbios name \"%s\" contains non-alphanumeric
character "
+       DEBUG(0,("ERROR: netbios name \"%s\" contains non-alphanumeric
character "
                "\"%c\", and cannot be set.\n", pszParmValue, 
                pszParmValue[i]));
        return False;


More information about the samba-technical mailing list