summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1996-12-11 15:10:47 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1996-12-11 15:10:47 +0000
commitcbdf01eb15348503217bd55a271a00be190af29b (patch)
tree026cba90c608f9fafe63b2410a79f61e15032e1a /pw/pw_user.c
parent44a97fd42905de081ebf68b82478c10f9db608cc (diff)
downloadpw-darwin-cbdf01eb15348503217bd55a271a00be190af29b.tar.gz
pw-darwin-cbdf01eb15348503217bd55a271a00be190af29b.tar.zst
pw-darwin-cbdf01eb15348503217bd55a271a00be190af29b.zip
Update from David, reflecting Wolfram's wishes regarding limitation of
the allowable character set. Submitted by: David Nugent
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r--pw/pw_user.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index d8a2c24..055f676 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pw_user.c,v 1.1.1.2 1996/12/09 23:55:10 joerg Exp $
+ * $Id: pw_user.c,v 1.1.1.3 1996/12/10 23:59:02 joerg Exp $
*/
#include <unistd.h>
@@ -857,14 +857,17 @@ static char *
pw_checkname(char *name, int gecos)
{
int l = 0;
- char const *notch = gecos ? ":" : " :+-&#%$^()!@~*?<>=|\\/\"";
+ char const *notch = gecos ? ":" : " ,\t:+-&#%$^()!@~*?<>=|\\/\"";
while (name[l]) {
- if (strchr(notch, name[l]) != NULL || name[l] < ' ')
- cmderr(EX_DATAERR, "invalid character `%c' in field\n", name[l]);
+ if (strchr(notch, name[l]) != NULL || name[l] < ' ' || name[l] > 126)
+ cmderr(EX_DATAERR, (name[l]<' ' || (unsigned char)name[l] > 126)
+ ? "invalid character `%c' in field\n"
+ : "invalid character 0x$02x in field\n",
+ name[l]);
++l;
}
- if (!gecos && l > 8)
+ if (!gecos && l > MAXLOGNAME)
cmderr(EX_DATAERR, "name too long `%s'\n", name);
return name;
}