TNG: making %U work again for logon path et. al.

Patrick J. LoPresti patl at
Mon Feb 21 23:17:53 GMT 2000

Our smb.conf file for 2.0.x relies on the %U substitution working in
the "logon path", "logon drive", and "logon home" parameters.  I
suspect we are not alone in this, especially since the example
smb.conf file suggests it.

Anyway, this substitution is currently broken in TNG because of Luke's
simplification of the relevant interfaces.  The appended patch is a
(simple but ugly) hack to allow %U to work again for "logon script",
"logon path", and "logon home".  It only works for smbpasswd
authentication, I think.

Note that "%u" (as opposed to "%U") does not work, either, because
lp_user_string() calls standard_sub_vuser(), which calls
standard_sub_basic() and not standard_sub().  My patch does nothing to
address this.

I do not understand this stuff well enough to know the "right" way to
fix this, but I thought I would throw it out for discussion.

 - Pat

-------------- next part --------------
Index: passdb/sampass.c
RCS file: /cvsroot/samba/source/passdb/Attic/sampass.c,v
retrieving revision
diff -u -r1.5.2.5 sampass.c
--- sampass.c	2000/02/08 04:25:55
+++ 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-technical mailing list