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
18 #if !defined(lint) && !defined(LINT)
19 static const char rcsid[] =
23 /* vix 26jan87 [log is in RCS file]
29 static char *User_name;
38 for (e = u->crontab; e != NULL; e = ne) {
49 log_it(User_name, getpid(), "PARSE", msg);
53 load_user(crontab_fd, pw, name)
55 struct passwd *pw; /* NULL implies syscrontab */
58 char envstr[MAX_ENVSTR];
65 if (!(file = fdopen(crontab_fd, "r"))) {
66 warn("fdopen on crontab_fd in load_user");
70 Debug(DPARS, ("load_user()\n"))
72 /* file is open. build user entry, then read the crontab file.
74 if ((u = (user *) malloc(sizeof(user))) == NULL) {
78 if ((u->name = strdup(name)) == NULL) {
86 * init environment. this will be copied/augmented for each entry.
88 if ((envp = env_init()) == NULL) {
97 while ((status = load_env(envstr, file)) >= OK) {
104 User_name = u->name; /* for log_error */
105 e = load_entry(file, log_error, pw, envp);
107 e->next = u->crontab;
112 if ((tenvp = env_set(envp, envstr))) {
126 Debug(DPARS, ("...load_user() done\n"))