dealing with usernames containing whitespace

SATOH Fumiyasu fumiya at samba.gr.jp
Wed Jan 31 03:43:10 GMT 2007


At Tue, 30 Jan 2007 13:27:06 -0600,
Gerald (Jerry) Carter wrote:
> Background: account names with whitespace such as "AD\Space Kadet"
> cause failures in various shell scripts, initialization files,
> Gnome, etc... because of the assumption that the IFS in base is
> whitespace.  This patch introduces the 'winbind replacement character'
> parameter which maps names like "Space Kadet" to "Space_Kadet".

As you know, the variable substitutions on the shell command-line
is very horrible because variables can contain special (meta)
characters for shells. 

But the "replace special characters in variables before
substituting" is bad too because:

  1) I want to pass the variable as is (without replacing) to
     a command-line in some cases, e.g. see
     https://bugzilla.samba.org/show_bug.cgi?id=2345
     (and https://bugzilla.samba.org/show_bug.cgi?id=593).
  2) There are many "/bin/sh" variants that have common
     "special characters and syntaxes" and **different** one.
     That is why you can not define what characters are
     special.

I think the best solution to fix this this problem is
"set environment variables (e.g. $SAMBA_XXXX?) to pass
values before shell executing". Of course a command,
executed from smbd via /bin/sh, must take care that
environment variables can contain special characters. 

Any opinions?

-- 
-- Name: SATOH Fumiyasu / fumiyas @ osstech.co.jp
-- Business Home: http://www.OSSTech.co.jp
-- Personal Home: http://www.SFO.jp/blog/

> For example:
> 
> $ ssh -l "ad\space kadet" localhost
> Password:
> Last login: Tue Jan 30 12:51:53 2007 from localhost
> 
> [AD\space_kadet at fiji ~]$ id
> uid=100012(AD\space_kadet) gid=100000(AD\domain_users)
> groups=100000(AD\domain_users)
> 
> [AD\space_kadet at fiji ~]$ getent group "AD\Domain Users"
> AD\domain_users:x:100000:AD\space_kadet
> 
> [AD\space_kadet at fiji ~]$ getent group "AD\Domain_Users"
> AD\domain_users:x:100000:AD\space_kadet
> 
> This is one of those patches I feel dirty about but have
> a legitimate need for.  What do others think?


More information about the samba-technical mailing list