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

Patrick J. LoPresti patl at cag.lcs.mit.edu
Tue Feb 22 03:12:43 GMT 2000


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

> > Look again.  This is a different patch.
> 
> oo.  then can you do a cvs update, _then_ do a diff?

That's what I did :-).  I'll append it again...

> urr, the problem is that the \PIPE\NETLOGON conncetion is done
> anonymously.

Well, at least the user name is available by the time I need it; see
the patch.

> i described this in great detail on samba tech, last month.  see
> archives for details.

I'll see if I can find it.

Thanks!

 - Pat

diff -u -r1.5.2.6 sampass.c
--- sampass.c	2000/02/21 20:26:14	1.5.2.6
+++ sampass.c	2000/02/21 22:54:10
@@ -79,6 +79,7 @@
 static struct sam_passwd *getsamfile21pwent(void *vp)
 {
 	struct sam_passwd *user;
+        user_struct bogus_user_struct;
 
 	static pstring full_name;
 	static pstring home_dir;
@@ -90,6 +91,8 @@
 
 	DEBUG(5,("getsamfile21pwent\n"));
 
+        ZERO_STRUCT(bogus_user_struct);
+
 	user = pwdb_smb_to_sam(getsmbfilepwent(vp));
 	if (user == NULL)
 	{
@@ -101,11 +104,14 @@
 	 * as putting the nt name in is a bit meaningless.
 	 */
 
+        /* HACK to make %U work in substitutions below */
+        fstrcpy (bogus_user_struct.requested_name, user->unix_name);
+
 	pstrcpy(full_name    , "");
-	pstrcpy(logon_script , lp_logon_script       (NULL));
-	pstrcpy(profile_path , lp_logon_path         (NULL));
-	pstrcpy(home_drive   , lp_logon_drive        (NULL));
-	pstrcpy(home_dir     , lp_logon_home         (NULL));
+	pstrcpy(logon_script , lp_logon_script (&bogus_user_struct));
+	pstrcpy(profile_path , lp_logon_path (&bogus_user_struct));
+	pstrcpy(home_drive   , lp_logon_drive (&bogus_user_struct));
+	pstrcpy(home_dir     , lp_logon_home (&bogus_user_struct));
 	pstrcpy(acct_desc    , "");
 	pstrcpy(workstations , "");


More information about the samba-technical mailing list