Deleted Added
full compact
util.c (99112) util.c (124692)
1/*-
2 * Copyright (c) 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * Portions of this software were developed for the FreeBSD Project by
8 * ThinkSec AS and NAI Labs, the Security Research Division of Network

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

39 */
40
41#ifndef lint
42#if 0
43static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94";
44#endif
45#endif /* not lint */
46#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1988, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * Portions of this software were developed for the FreeBSD Project by
8 * ThinkSec AS and NAI Labs, the Security Research Division of Network

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

39 */
40
41#ifndef lint
42#if 0
43static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94";
44#endif
45#endif /* not lint */
46#include <sys/cdefs.h>
47__FBSDID("$FreeBSD: head/usr.bin/chpass/util.c 99112 2002-06-30 05:25:07Z obrien $");
47__FBSDID("$FreeBSD: head/usr.bin/chpass/util.c 124692 2004-01-18 21:46:39Z charnier $");
48
49#include <sys/types.h>
50
51#include <ctype.h>
48
49#include <sys/types.h>
50
51#include <ctype.h>
52#include <pwd.h>
53#include <stdio.h>
54#include <stdlib.h>
55#include <string.h>
56#include <time.h>
57#include <unistd.h>
58
59#include "chpass.h"
60

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

134 lt->tm_sec = 0;
135 lt->tm_isdst = -1;
136 if ((tval = mktime(lt)) < 0)
137 return (1);
138 *store = tval;
139 return (0);
140}
141
52#include <stdio.h>
53#include <stdlib.h>
54#include <string.h>
55#include <time.h>
56#include <unistd.h>
57
58#include "chpass.h"
59

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

133 lt->tm_sec = 0;
134 lt->tm_isdst = -1;
135 if ((tval = mktime(lt)) < 0)
136 return (1);
137 *store = tval;
138 return (0);
139}
140
142char *
141int
143ok_shell(char *name)
144{
145 char *p, *sh;
146
147 setusershell();
148 while ((sh = getusershell())) {
142ok_shell(char *name)
143{
144 char *p, *sh;
145
146 setusershell();
147 while ((sh = getusershell())) {
149 if (!strcmp(name, sh))
150 return (name);
148 if (!strcmp(name, sh)) {
149 endusershell();
150 return (1);
151 }
151 /* allow just shell name, but use "real" path */
152 /* allow just shell name, but use "real" path */
152 if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0)
153 return (sh);
153 if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) {
154 endusershell();
155 return (1);
156 }
154 }
157 }
158 endusershell();
159 return (0);
160}
161
162char *
163dup_shell(char *name)
164{
165 char *p, *sh, *ret;
166
167 setusershell();
168 while ((sh = getusershell())) {
169 if (!strcmp(name, sh)) {
170 endusershell();
171 return (strdup(name));
172 }
173 /* allow just shell name, but use "real" path */
174 if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) {
175 ret = strdup(sh);
176 endusershell();
177 return (ret);
178 }
179 }
180 endusershell();
155 return (NULL);
156}
181 return (NULL);
182}