Error in debug-message...

Mattias.Gronlund Mattias.Gronlund at sa.erisoft.se
Mon Aug 23 20:23:39 GMT 1999


Hi,

I was looking for trust_password_lock via LXR:ed samba-source, when I
found that get_trust_account_file_name() writes a debug-message that
start with: "trust_password_lock:" insted of
"get_trust_account_file_name".

If I get this right, the text sent to DEBUG should not include the name
of the function as that is handled by FUNCTION_MACRO inside DEBUG on
when compilde with supported compilers...

I send two patches, one that fixes the buggy message and one other
that removes all the extra function-name printings...

/Mattias
-------------- next part --------------
--- smbpassfile.c	Sat May 15 02:06:03 1999
+++ smbpassfile.c.fix	Mon Aug 23 22:20:39 1999
@@ -86,7 +86,7 @@
 
   if ((int)(sizeof(pstring) - mac_file_len - strlen(domain) - strlen(name) - 6) < 0)
   {
-    DEBUG(0,("trust_password_lock: path %s too long to add trust details.\n",
+    DEBUG(0,("get_trust_account_file_name: path %s too long to add trust details.\n",
               mac_file));
     return;
   }
-------------- next part --------------
--- smbpassfile.c	Sat May 15 02:06:03 1999
+++ smbpassfile.c.new	Mon Aug 23 22:08:10 1999
@@ -34,7 +34,7 @@
 
   if(*plock_depth == 0) {
     if (!do_file_lock(fd, secs, type)) {
-      DEBUG(10,("pw_file_lock: locking file failed, error = %s.\n",
+      DEBUG(10,("Locking file failed, error = %s.\n",
                  strerror(errno)));
       return False;
     }
@@ -60,7 +60,7 @@
     (*plock_depth)--;
 
   if(!ret)
-    DEBUG(10,("pw_file_unlock: unlocking file failed, error = %s.\n",
+    DEBUG(10,("Unlocking file failed, error = %s.\n",
                  strerror(errno)));
   return ret;
 }
@@ -86,7 +86,7 @@
 
   if ((int)(sizeof(pstring) - mac_file_len - strlen(domain) - strlen(name) - 6) < 0)
   {
-    DEBUG(0,("trust_password_lock: path %s too long to add trust details.\n",
+    DEBUG(0,("Path %s too long to add trust details.\n",
               mac_file));
     return;
   }
@@ -115,7 +115,7 @@
       }
 
       if(mach_passwd_fp == NULL) {
-        DEBUG(0,("trust_password_lock: cannot open file %s - Error was %s.\n",
+        DEBUG(0,("Cannot open file %s - Error was %s.\n",
               mac_file, strerror(errno) ));
         return False;
       }
@@ -126,7 +126,7 @@
     if(!pw_file_lock(fileno(mach_passwd_fp), (update ? F_WRLCK : F_RDLCK), 
                                       60, &mach_passwd_lock_depth))
     {
-      DEBUG(0,("trust_password_lock: cannot lock file %s\n", mac_file));
+      DEBUG(0,("Cannot lock file %s\n", mac_file));
       fclose(mach_passwd_fp);
       return False;
     }
@@ -177,14 +177,14 @@
   memset(ret_pwd, '\0', 16);
 
   if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
-    DEBUG(0,("get_trust_account_password: Failed to seek to start of file. Error was %s.\n",
+    DEBUG(0,("Failed to seek to start of file. Error was %s.\n",
               strerror(errno) ));
     return False;
   } 
 
   fgets(linebuf, sizeof(linebuf), mach_passwd_fp);
   if(ferror(mach_passwd_fp)) {
-    DEBUG(0,("get_trust_account_password: Failed to read password. Error was %s.\n",
+    DEBUG(0,("Failed to read password. Error was %s.\n",
               strerror(errno) ));
     return False;
   }
@@ -198,10 +198,10 @@
    */
 
   if(strlen(linebuf) != 45) {
-    DEBUG(0,("get_trust_account_password: Malformed trust password file (wrong length \
+    DEBUG(0,("Malformed trust password file (wrong length \
 - was %d, should be 45).\n", (int)strlen(linebuf)));
 #ifdef DEBUG_PASSWORD
-    DEBUG(100,("get_trust_account_password: line = |%s|\n", linebuf));
+    DEBUG(100,("Line = |%s|\n", linebuf));
 #endif
     return False;
   }
@@ -212,9 +212,9 @@
 
   if (!pdb_gethexpwd((char *)linebuf, (char *)ret_pwd) || linebuf[32] != ':' || 
          strncmp(&linebuf[33], "TLC-", 4)) {
-    DEBUG(0,("get_trust_account_password: Malformed trust password file (incorrect format).\n"));
+    DEBUG(0,("Malformed trust password file (incorrect format).\n"));
 #ifdef DEBUG_PASSWORD
-    DEBUG(100,("get_trust_account_password: line = |%s|\n", linebuf));
+    DEBUG(100,("Line = |%s|\n", linebuf));
 #endif
     return False;
   }
@@ -226,9 +226,9 @@
 
   for(i = 0; i < 8; i++) {
     if(p[i] == '\0' || !isxdigit((int)p[i])) {
-      DEBUG(0,("get_trust_account_password: Malformed trust password file (no timestamp).\n"));
+      DEBUG(0,("Malformed trust password file (no timestamp).\n"));
 #ifdef DEBUG_PASSWORD
-      DEBUG(100,("get_trust_account_password: line = |%s|\n", linebuf));
+      DEBUG(100,("Line = |%s|\n", linebuf));
 #endif
       return False;
     }
@@ -256,7 +256,7 @@
   int i;
 
   if(sys_fseek( mach_passwd_fp, (SMB_OFF_T)0, SEEK_SET) == -1) {
-    DEBUG(0,("set_trust_account_password: Failed to seek to start of file. Error was %s.\n",
+    DEBUG(0,("Failed to seek to start of file. Error was %s.\n",
               strerror(errno) ));
     return False;
   } 
@@ -267,7 +267,7 @@
   slprintf(&linebuf[32], 32, ":TLC-%08X\n", (unsigned)time(NULL));
 
   if(fwrite( linebuf, 1, 46, mach_passwd_fp)!= 46) {
-    DEBUG(0,("set_trust_account_password: Failed to write file. Warning - the trust \
+    DEBUG(0,("Failed to write file. Warning - the trust \
 account is now invalid. Please recreate. Error was %s.\n", strerror(errno) ));
     return False;
   }
@@ -284,13 +284,13 @@
    * Get the machine account password.
    */
   if(!trust_password_lock( domain, myname, False)) {
-    DEBUG(0,("domain_client_validate: unable to open the machine account password file for \
+    DEBUG(0,("Unable to open the machine account password file for \
 machine %s in domain %s.\n", myname, domain ));
     return False;
   }
 
   if(get_trust_account_password( trust_passwd, &lct) == False) {
-    DEBUG(0,("domain_client_validate: unable to read the machine account password for \
+    DEBUG(0,("Unable to read the machine account password for \
 machine %s in domain %s.\n", myname, domain ));
     trust_password_unlock();
     return False;


More information about the samba-technical mailing list