Deleted Added
sdiff udiff text old ( 52921 ) new ( 53183 )
full compact
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 22 unchanged lines hidden (view full) ---

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)pw_scan.c 8.3 (Berkeley) 4/2/94";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/lib/libc/gen/pw_scan.c 52921 1999-11-06 20:21:04Z eivind $";
40#endif /* not lint */
41
42/*
43 * This module is used to "verify" password entries by chpass(1) and
44 * pwd_mkdb(8).
45 */
46
47#include <sys/param.h>
48
49#include <err.h>
50#include <fcntl.h>
51#include <pwd.h>
52#include <stdio.h>
53#include <string.h>
54#include <stdlib.h>
55#include <unistd.h>
56
57#include "pw_scan.h"
58
59int
60pw_scan(bp, pw)
61 char *bp;
62 struct passwd *pw;
63{
64 long id;
65 int root;
66 char *p, *sh;

--- 17 unchanged lines hidden (view full) ---

84 warnx("no uid for user %s", pw->pw_name);
85 return (0);
86 }
87 id = atol(p);
88 if (root && id) {
89 warnx("root uid should be 0");
90 return (0);
91 }
92 if (id > USHRT_MAX) {
93 warnx("%s > max uid value (%d)", p, USHRT_MAX);
94 /*return (0);*/ /* THIS SHOULD NOT BE FATAL! */
95 }
96 pw->pw_uid = id;
97
98 if (!(p = strsep(&bp, ":"))) /* gid */
99 goto fmt;
100 if(p[0]) pw->pw_fields |= _PWF_GID;
101 id = atol(p);
102 if (id > USHRT_MAX) {
103 warnx("%s > max gid value (%d)", p, USHRT_MAX);
104 /* return (0); This should not be fatal! */
105 }
106 pw->pw_gid = id;
107
108 pw->pw_class = strsep(&bp, ":"); /* class */
109 if(pw->pw_class[0]) pw->pw_fields |= _PWF_CLASS;
110
111 if (!(p = strsep(&bp, ":"))) /* change */

--- 38 unchanged lines hidden ---