Deleted Added
full compact
pw_scan.c (50479) pw_scan.c (50644)
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[] =
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 50479 1999-08-28 01:35:59Z peter $";
39 "$FreeBSD: head/lib/libc/gen/pw_scan.c 50644 1999-08-30 09:55:42Z sheldonh $";
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
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
59static int big_uids = 0; /* Used for legacy max uid_t warning */
60static int big_gids = 0; /* Used for legacy max gid_t warning */
61
59int
60pw_scan(bp, pw)
61 char *bp;
62 struct passwd *pw;
63{
64 long id;
65 int root;
66 char *p, *sh;

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

79 if (!(p = strsep(&bp, ":"))) /* uid */
80 goto fmt;
81 if(p[0]) pw->pw_fields |= _PWF_UID;
82 id = atol(p);
83 if (root && id) {
84 warnx("root uid should be 0");
85 return (0);
86 }
62int
63pw_scan(bp, pw)
64 char *bp;
65 struct passwd *pw;
66{
67 long id;
68 int root;
69 char *p, *sh;

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

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

--- 37 unchanged lines hidden ---
103 }
104 pw->pw_gid = id;
105
106 pw->pw_class = strsep(&bp, ":"); /* class */
107 if(pw->pw_class[0]) pw->pw_fields |= _PWF_CLASS;
108
109 if (!(p = strsep(&bp, ":"))) /* change */
110 goto fmt;

--- 37 unchanged lines hidden ---