#if !defined(lint) && !defined(LINT)
static char rcsid
[] = "$Header: user.c,v 2.1 90/07/18 00:23:45 vixie Exp $";
/* vix 26jan87 [log is in RCS file]
/* Copyright 1988,1990 by Paul Vixie
* Distribute freely, except: don't remove my name from the source or
* documentation (don't take credit for my work), mark your changes (don't
* get me blamed for your possible bugs), don't alter or remove this
* notice. May be sold if buildable source is provided to buyer. No
* warrantee of any kind, express or implied, is included with this
* software; use at your own risk, responsibility for damages (if any) to
* anyone resulting from the use of this software rests entirely with the
* Send bug reports, bug fixes, enhancements, requests, flames, etc., and
* I'll try to keep a version up to date. I can be reached as follows:
* Paul Vixie, 329 Noe Street, San Francisco, CA, 94114, (415) 864-7013,
* paul@vixie.sf.ca.us || {hoptoad,pacbell,decwrl,crash}!vixie!paul
for (e
= u
->crontab
; e
!= NULL
; e
= e
->next
)
for (env
= u
->envp
; *env
; env
++)
load_user(crontab_fd
, name
, uid
, gid
, dir
, shell
)
char *malloc(), *sprintf(), **env_init(), **env_set();
if (!(file
= fdopen(crontab_fd
, "r")))
perror("fdopen on crontab_fd in load_user");
Debug(DPARS
, ("load_user()\n"))
/* file is open. build user entry, then read the crontab file.
u
= (user
*) malloc(sizeof(user
));
* do auto env settings that the user could reset in the cron tab
sprintf(envstr
, "SHELL=%s", (*shell
) ?shell
:"/bin/sh");
u
->envp
= env_set(u
->envp
, envstr
);
sprintf(envstr
, "HOME=%s", dir
);
u
->envp
= env_set(u
->envp
, envstr
);
while ((status
= load_env(envstr
, file
)) >= OK
)
u
->envp
= env_set(u
->envp
, envstr
);
if (NULL
!= (e
= load_entry(file
, NULL
)))
* do automatic env settings that should have precedence over any
(void) sprintf(envstr
, "%s=%s", USERENV
, name
);
u
->envp
= env_set(u
->envp
, envstr
);
* done. close file, return pointer to 'user' structure
Debug(DPARS
, ("...load_user() done\n"))