How unstable is the CVS source?: smbpasswd

Bertl bs at vpnet.at
Wed Jul 7 12:14:38 GMT 1999


"Lonnie J. Borntreger" wrote:
> 
> This was covered in the thread "SIGBUS Panic in smbd".  I submitted a fix to
> Luke who is having some people test it before it's posted. (see attached
> message and diff).

Hi!

I don't think the diff is right: When USE_HASHED_GETPWNAM is
set, the pw_passwd field is allocated with strdup (line 145),
so this looks like a (very small) memory leak...

I tried the following and it seems to work with hash and without:
(btw: why is pw-hashing not set by default?)

--- username.c.orig     Thu Jul  1 16:01:52 1999
+++ username.c  Wed Jul  7 13:38:23 1999
@@ -228,9 +228,8 @@

 struct passwd *hashed_getpwnam(const char *name)
 {
-#ifndef USE_HASHED_GETPWNAM
-  return getpwnam(name);
-#else
+  struct passwd *ret;
+#ifdef USE_HASHED_GETPWNAM
   struct passwd_hash_table_s *pht=&passwd_hash_table;

   DEBUG(5,("getpwnam(%s)\n", name));
@@ -259,8 +258,11 @@
     return NULL;
   }
   /* Fall back to real getpwnam() */
-  return getpwnam(name);
 #endif
+  ret = getpwnam(name);
+  if(ret != NULL)
+    ret->pw_passwd = strdup(ret->pw_passwd);
+  return ret;
 }


More information about the samba-ntdom mailing list