1 /* Copyright 1988,1990,1993,1994 by Paul Vixie
4 * Distribute freely, except: don't remove my name from the source or
5 * documentation (don't take credit for my work), mark your changes (don't
6 * get me blamed for your possible bugs), don't alter or remove this
7 * notice. May be sold if buildable source is provided to buyer. No
8 * warrantee of any kind, express or implied, is included with this
9 * software; use at your own risk, responsibility for damages (if any) to
10 * anyone resulting from the use of this software rests entirely with the
13 * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14 * I'll try to keep a version up to date. I can be reached as follows:
15 * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
17 * $FreeBSD: src/usr.sbin/cron/cron/user.c,v 1.8 1999/08/28 01:15:50 peter Exp $
18 * $DragonFly: src/usr.sbin/cron/cron/user.c,v 1.2 2003/06/17 04:29:53 dillon Exp $
21 /* vix 26jan87 [log is in RCS file]
27 static char *User_name;
36 for (e = u->crontab; e != NULL; e = ne) {
47 log_it(User_name, getpid(), "PARSE", msg);
51 load_user(crontab_fd, pw, name)
53 struct passwd *pw; /* NULL implies syscrontab */
56 char envstr[MAX_ENVSTR];
63 if (!(file = fdopen(crontab_fd, "r"))) {
64 warn("fdopen on crontab_fd in load_user");
68 Debug(DPARS, ("load_user()\n"))
70 /* file is open. build user entry, then read the crontab file.
72 if ((u = (user *) malloc(sizeof(user))) == NULL) {
76 if ((u->name = strdup(name)) == NULL) {
84 * init environment. this will be copied/augmented for each entry.
86 if ((envp = env_init()) == NULL) {
95 while ((status = load_env(envstr, file)) >= OK) {
102 User_name = u->name; /* for log_error */
103 e = load_entry(file, log_error, pw, envp);
105 e->next = u->crontab;
110 if ((tenvp = env_set(envp, envstr))) {
124 Debug(DPARS, ("...load_user() done\n"))