TNG works with Win2k, fails with Win98

Patrick J. LoPresti patl at cag.lcs.mit.edu
Mon Feb 21 19:51:18 GMT 2000


Luke Kenneth Casson Leighton <lkcl at samba.org> writes:

> > Second, my netlogon script is not running for Win98 nor for Win2k (is
> > it even supposed to for the latter?).
> 
> *ah*.  that.  see, we have a real problem, there.  netlogin scripts
> were added as a hack to the nt domain code.
> 
> hmmm...  let me take a look-see

I think I found the bug.  In sampass.c:getsamfile21pwent(), you are
checking a bunch of char *'s in the "user" structure against NULL to
see if you need to fill them in.  The problem is that they aren't
NULL, they are just empty; so things like the logon_script field end
up empty instead of acquiring their proper values from the smb.conf
file.

When I fixed this, my logon scripts started working again.

My patch is appended; rewrite it as you see fit...

 - Pat

-------------- next part --------------
Index: passdb/sampass.c
===================================================================
RCS file: /cvsroot/samba/source/passdb/Attic/sampass.c,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 sampass.c
--- sampass.c	2000/02/08 04:25:55	1.5.2.5
+++ sampass.c	2000/02/21 19:48:11
@@ -63,6 +63,11 @@
 	return setsmbpwpos(vp, tok);
 }
 
+static BOOL string_empty (const char *str)
+{
+  return str == NULL || *str == '\0';
+}
+
 /*************************************************************************
  Routine to return the next entry in the smbpasswd list.
  this function is a nice, messy combination of reading:
@@ -109,19 +114,19 @@
 	   didn't filled the values
 	*/ 
 
-	if (user->full_name == NULL)
+	if (string_empty (user->full_name))
 		user->full_name    = full_name;
-	if (user->home_dir == NULL)
+	if (string_empty (user->home_dir))
 		user->home_dir     = home_dir;
-	if (user->dir_drive == NULL)
+	if (string_empty (user->dir_drive))
 		user->dir_drive    = home_drive;
-	if (user->logon_script == NULL)
+	if (string_empty (user->logon_script))
 		user->logon_script = logon_script;
-	if (user->profile_path == NULL)
+	if (string_empty (user->profile_path))
 		user->profile_path = profile_path;
-	if (user->acct_desc == NULL)
+	if (string_empty (user->acct_desc))
 		user->acct_desc    = acct_desc;
-	if (user->workstations == NULL)
+	if (string_empty (user->workstations))
 		user->workstations = workstations;
 
 	user->unknown_str = NULL; /* don't know, yet! */


More information about the samba-ntdom mailing list