%U and %u functionality change in 2.2??
Jeremy Allison
jeremy at valinux.com
Wed Apr 25 16:27:54 GMT 2001
Matthew Keller wrote:
>
> I've been using %U macros within "include" statements in Samba 2.0 for
> years now. 2.2 doesn't seem to like them anyore. Has this functionality
> changed? I checked the smb.conf man page, but it doesn't seem to say
> anything different. I'm really hurting without this functionality
> (including different conf files depending on user name). Any help would
> be most appreciated.
Yes, we broke this by accident in 2.2.0. The intent is to
fix this for 2.2.1 and make %U map to the incoming username
(enforced lowercase).
Here is the patch that will be in 2.2.1.
Sorry for the problem,
Jeremy.
Index: lib/substitute.c
===================================================================
RCS file: /data/cvs/samba/source/lib/substitute.c,v
retrieving revision 1.8.2.5
diff -u -r1.8.2.5 substitute.c
--- lib/substitute.c 2001/04/08 20:22:51 1.8.2.5
+++ lib/substitute.c 2001/04/25 18:24:31
@@ -172,9 +172,21 @@
fstring pidstr;
for (s=str; (p=strchr(s, '%'));s=p) {
+ fstring tmp_str;
+
int l = sizeof(pstring) - (int)(p-str);
switch (*(p+1)) {
+ case 'U' :
+ fstrcpy(tmp_str, sam_logon_in_ssb?samlogon_user:current_user_info.smb_name);
+ strlower(tmp_str);
+ string_sub(p,"%U",tmp_str,l);
+ break;
+ case 'D' :
+ fstrcpy(tmp_str, current_user_info.domain);
+ strupper(tmp_str);
+ string_sub(p,"%D", tmp_str,l);
+ break;
case 'I' : string_sub(p,"%I", client_addr(),l); break;
case 'L' : string_sub(p,"%L", local_machine,l); break;
case 'M' : string_sub(p,"%M", client_name(),l); break;
@@ -212,7 +224,6 @@
int l = sizeof(pstring) - (int)(p-str);
switch (*(p+1)) {
- case 'U' : string_sub(p,"%U",sam_logon_in_ssb?samlogon_user:current_user_info.smb_name,l); break;
case 'G' :
if ((pass = Get_Pwnam(user,False))!=NULL) {
string_sub(p,"%G",gidtoname(pass->pw_gid),l);
@@ -220,7 +231,6 @@
p += 2;
}
break;
- case 'D' : string_sub(p,"%D", current_user_info.domain,l); break;
case 'N' : string_sub(p,"%N", automount_server(user),l); break;
case 'H':
if ((home = get_user_home_dir(user))) {
--
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------
More information about the samba-ntdom
mailing list