Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2002 11:32:53 -0800 (PST)
From:      Richard Sharpe <rsharpe@richardsharpe.com>
To:        Ryan Thompson <ryan@sasknow.com>
Cc:        <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: pw(8): $ (dollar sign) in username
Message-ID:  <Pine.LNX.4.33.0212271129520.3939-100000@ns.aus.com>
In-Reply-To: <20021227112033.N93884-100000@ren.sasknow.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 27 Dec 2002, Ryan Thompson wrote:

> 
> Hi all,
> 
> I've recently had the pleasure of configuring a FreeBSD machine as a
> Samba Primary Domain Controller. In smb.conf, one can specify an "add
> user script" directive to automate the creation of machine accounts.
> Otherwise, you have to manually create accounts for each machine on
> the network. See:
> 
>   http://us1.samba.org/samba/ftp/docs/htmldocs/Samba-PDC-HOWTO.html
> 
> Problem is, smb requires a '$' at the end of the username, which our
> pw(8) doesn't allow.

Well, the $ is only required for machine accounts! In Samba 3.0, and 
possibly in the latest 2.2.x releases, there is a separate 'add machine 
script' parameters. I think it would be better to simply frob the entry in 
the master.passwd in that script. 

While I have not tried it myself, I am lead to believe that once you edit 
the entry and run the appropriate command, things work.
 
> Allowing the $ is a one-character change to usr.sbin/pw/pw_user.c .
> Aside from the obvious pain of accidentally inserting shell variables
> as part of a username if the $ is not escaped, are there any specific
> problems with this change?
> 
> Others would probably benefit from this. Is the change worth
> committing? Or would it be better to push this to pw.conf?
> 
> --- usr.sbin/pw/pw_user.c.orig      Sat Nov 16 21:55:28 2002
> +++ usr.sbin/pw/pw_user.c   Fri Dec 27 11:17:33 2002
> @@ -1195,7 +1195,7 @@
>  pw_checkname(u_char *name, int gecos)
>  {
>         int             l = 0;
> -       char const     *notch = gecos ? ":!@" : ",\t:+&#%$^()!@~*?<>=|\\/\"";
> +       char const     *notch = gecos ? ":!@" : ",\t:+&#%^()!@~*?<>=|\\/\"";
> 
>         while (name[l]) {
>                 if (strchr(notch, name[l]) != NULL || name[l] < ' ' || name[l] == 127 ||
> 
> - Ryan
> 
> 

-- 
Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0212271129520.3939-100000>