1 /* Copyright 1988,1990,1993,1994 by Paul Vixie
6 * Copyright (c) 1997 by Internet Software Consortium
8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
13 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
14 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
18 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23 /* vix 26jan87 [log is in RCS file]
28 static char *User_name;
36 for (e = u->crontab; e != NULL; e = ne) {
44 log_error(const char *msg)
46 log_it(User_name, getpid(), "PARSE", msg);
49 /* NULL pw implies syscrontab */
51 load_user(int crontab_fd, struct passwd *pw, const char *name)
53 char envstr[MAX_ENVSTR];
60 if (!(file = fdopen(crontab_fd, "r"))) {
61 warn("fdopen on crontab_fd in load_user");
65 Debug(DPARS, ("load_user()\n"))
67 /* file is open. build user entry, then read the crontab file.
69 if ((u = (user *) malloc(sizeof(user))) == NULL) {
73 if ((u->name = strdup(name)) == NULL) {
81 * init environment. this will be copied/augmented for each entry.
83 if ((envp = env_init()) == NULL) {
92 while ((status = load_env(envstr, file)) >= OK) {
99 User_name = u->name; /* for log_error */
100 e = load_entry(file, log_error, pw, envp);
102 e->next = u->crontab;
107 if ((tenvp = env_set(envp, envstr))) {
121 Debug(DPARS, ("...load_user() done\n"))