-/* $OpenBSD: cron.c,v 1.55 2015/10/25 21:30:11 millert Exp $ */
+/* $OpenBSD: cron.c,v 1.56 2015/10/26 14:27:41 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
sact.sa_handler = SIG_IGN;
(void) sigaction(SIGPIPE, &sact, NULL);
- set_cron_uid();
set_cron_cwd();
cronSock = open_socket();
-/* $OpenBSD: crontab.c,v 1.72 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: crontab.c,v 1.73 2015/10/26 14:27:41 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
while (-1 != (argch = getopt(argc, argv, getoptargs))) {
switch (argch) {
case 'u':
- if (getuid() != ROOT_UID) {
+ if (getuid() != 0) {
fprintf(stderr,
"must be privileged to use -u\n");
exit(EXIT_FAILURE);
-/* $OpenBSD: database.c,v 1.26 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: database.c,v 1.27 2015/10/26 14:27:41 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
new_db.head = new_db.tail = NULL;
if (syscron_stat.st_mtime) {
- process_crontab(ROOT_USER, NULL, SYSCRONTAB, &syscron_stat,
+ process_crontab("root", NULL, SYSCRONTAB, &syscron_stat,
&new_db, old_db);
}
goto next_crontab;
}
}
- if (statbuf->st_uid != ROOT_UID && (pw == NULL ||
+ if (statbuf->st_uid != 0 && (pw == NULL ||
statbuf->st_uid != pw->pw_uid || strcmp(uname, pw->pw_name) != 0)) {
log_it(fname, getpid(), "WRONG FILE OWNER", tabname);
goto next_crontab;
-/* $OpenBSD: entry.c,v 1.42 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: entry.c,v 1.43 2015/10/26 14:27:41 millert Exp $ */
/*
* Copyright 1988,1990,1993,1994 by Paul Vixie
if (ch == '*')
e->flags |= MIN_STAR;
ch = get_list(e->minute, FIRST_MINUTE, LAST_MINUTE,
- PPC_NULL, ch, file);
+ NULL, ch, file);
if (ch == EOF) {
ecode = e_minute;
goto eof;
if (ch == '*')
e->flags |= HR_STAR;
ch = get_list(e->hour, FIRST_HOUR, LAST_HOUR,
- PPC_NULL, ch, file);
+ NULL, ch, file);
if (ch == EOF) {
ecode = e_hour;
goto eof;
if (ch == '*')
e->flags |= DOM_STAR;
ch = get_list(e->dom, FIRST_DOM, LAST_DOM,
- PPC_NULL, ch, file);
+ NULL, ch, file);
if (ch == EOF) {
ecode = e_dom;
goto eof;
* element id, it's a step size. 'low' is
* sent as a 0 since there is no offset either.
*/
- ch = get_number(&num3, 0, PPC_NULL, ch, file, ", \t\n");
+ ch = get_number(&num3, 0, NULL, ch, file, ", \t\n");
if (ch == EOF || num3 == 0)
return (EOF);
} else {
-/* $OpenBSD: macros.h,v 1.12 2015/10/06 14:58:37 tedu Exp $ */
+/* $OpenBSD: macros.h,v 1.13 2015/10/26 14:27:41 millert Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
#define TRUE 1
#define FALSE 0
-#define INIT_PID 1 /* parent of orphans */
#define READ_PIPE 0 /* which end of a pipe pair do you read? */
#define WRITE_PIPE 1 /* or write to? */
#define MAX_FNAME 100 /* max length of internally generated fn */
#define MAX_ENVSTR 1000 /* max length of envvar=value\0 strings */
#define MAX_TEMPSTR 100 /* obvious */
#define MAX_UNAME (_PW_NAME_LEN+1) /* max length of username, should be overkill */
-#define ROOT_UID 0 /* don't change this, it really must be root */
-#define ROOT_USER "root" /* ditto */
-
-#define PPC_NULL ((const char **)NULL)
#define Skip_Blanks(c, f) \
while (c == '\t' || c == ' ') \
-/* $OpenBSD: misc.c,v 1.58 2015/10/25 21:30:11 millert Exp $ */
+/* $OpenBSD: misc.c,v 1.59 2015/10/26 14:27:41 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
return (*left - *right);
}
-void
-set_cron_uid(void)
-{
- if (seteuid(ROOT_UID) < 0) {
- perror("seteuid");
- exit(EXIT_FAILURE);
- }
-}
-
void
set_cron_cwd(void)
{
FILE *fp;
int isallowed;
- if (strcmp(username, ROOT_USER) == 0)
+ if (strcmp(username, "root") == 0)
return (TRUE);
isallowed = FALSE;
if ((fp = fopen(allow_file, "r")) != NULL) {