Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2002 11:35:45 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        freebsd-hackers@freebsd.org
Subject:   pw(8): $ (dollar sign) in username
Message-ID:  <20021227112033.N93884-100000@ren.sasknow.com>

next in thread | raw e-mail | index | archive | help

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.

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

-- 
  Ryan Thompson <ryan@sasknow.com>

  SaskNow Technologies - http://www.sasknow.com
  901-1st Avenue North - Saskatoon, SK - S7K 1Y4

        Tel: 306-664-3600   Fax: 306-244-7037   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


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?20021227112033.N93884-100000>