Bug 7766 - smb.conf manpage documentation suggests improper use of %S.
Summary: smb.conf manpage documentation suggests improper use of %S.
Status: NEW
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: Docs (show other bugs)
Version: unspecified
Hardware: All Linux
: P3 minor
Target Milestone: ---
Assignee: John H Terpstra (mail address dead(
QA Contact: Samba Documentation QA Contact~
Depends on:
Reported: 2010-10-29 09:34 UTC by Adam Buchbinder
Modified: 2012-05-12 18:24 UTC (History)
1 user (show)

See Also:

Patch against current master to fix smb.conf(5) manpage. (1.11 KB, patch)
2010-10-29 09:35 UTC, Adam Buchbinder
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Buchbinder 2010-10-29 09:34:14 UTC
The smb.conf(5) manpage suggests using the %S macro to substitute in a username.

"If you decide to use a path = line in your [homes] section, it may be useful to use the %S macro. For example:

  path = /data/pchome/%S</userinput>

is useful if you have different home directories for your PCs than for UNIX access."

As far as I can tell, these sorts of substitutions are made in alloc_sub_basic() and alloc_sub_advanced() in source3/lib/substitute.c. There was, some years ago, a standard_sub_home() function there which substituted '%S' for the username and '%p' for the user's automount path, but it's no longer there, as far as I can tell. (This section of the documentation hasn't been modified since 2005.)

I think that the manpage should reference %U rather than %S; I'll be attaching a patch to this effect. I haven't worked with the Samba source before, so I'm not absolutely certain there's not a good reason to keep it the old way; please let me know if there is.
Comment 1 Adam Buchbinder 2010-10-29 09:35:42 UTC
Created attachment 6040 [details]
Patch against current master to fix smb.conf(5) manpage.
Comment 2 Matthias Dieter Wallnöfer 2010-10-30 03:38:28 UTC
Well, but isn't this Samba 3.x related? If yes, I've to reassign it.
Comment 3 Adam Buchbinder 2010-10-30 08:27:35 UTC
I reported it against Samba 4 because It exists in the current master branch, but you make a very good point; those manpages are clearly Samba 3-related. I don't have permission to reassign bugs, so please move this to the appropriate product and section.
Comment 4 Matthias Dieter Wallnöfer 2010-10-30 08:37:25 UTC
Thanks, I will take care on this.
Comment 5 Michael Adam 2010-10-30 17:03:24 UTC
Right, this is samba3-related.
The master branch contains both the sources for both samba3 and samba4 as well as shared code.

To my understanding, %S (== the name of the service connected to) is appropriate here, since the user connects to a share with name equal to the user's name, so in this special case, %S is the same as the username. 
Comment 6 Christian Perrier (dead mail address) 2012-05-12 18:24:12 UTC
%S works perfectly to match the user name in [homes] as the service name is equal to the user name. This bug is imho invalid