summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/crontab.c14
-rw-r--r--usr.sbin/cron/funcs.h4
-rw-r--r--usr.sbin/cron/misc.c13
3 files changed, 15 insertions, 16 deletions
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c
index 51e3bd8ee40..319f555153b 100644
--- a/usr.sbin/cron/crontab.c
+++ b/usr.sbin/cron/crontab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crontab.c,v 1.77 2015/10/29 23:14:30 millert Exp $ */
+/* $OpenBSD: crontab.c,v 1.78 2015/10/31 12:13:01 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -30,6 +30,7 @@ enum opt_t { opt_unknown, opt_list, opt_delete, opt_edit, opt_replace };
static char *getoptargs = "u:ler";
static pid_t Pid;
+static gid_t save_egid;
static char User[MAX_UNAME], RealUser[MAX_UNAME];
static char Filename[MAX_FNAME], TempFilename[MAX_FNAME];
static FILE *NewCrontab;
@@ -46,6 +47,17 @@ static void list_cmd(void),
die(int);
static int replace_cmd(void);
+static int swap_gids(void)
+{
+ save_egid = getegid();
+ return (setegid(getgid()));
+}
+
+static int swap_gids_back(void)
+{
+ return (setegid(save_egid));
+}
+
static void
usage(const char *msg)
{
diff --git a/usr.sbin/cron/funcs.h b/usr.sbin/cron/funcs.h
index dd64da67331..6ea402b3d35 100644
--- a/usr.sbin/cron/funcs.h
+++ b/usr.sbin/cron/funcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: funcs.h,v 1.21 2015/10/29 22:41:27 millert Exp $ */
+/* $OpenBSD: funcs.h,v 1.22 2015/10/31 12:13:01 millert Exp $ */
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -45,8 +45,6 @@ void set_cron_uid(void),
int job_runqueue(void),
get_char(FILE *),
get_string(char *, int, FILE *, char *),
- swap_gids(void),
- swap_gids_back(void),
load_env(char *, FILE *),
cron_pclose(FILE *, pid_t),
glue_strings(char *, size_t, const char *, const char *, char),
diff --git a/usr.sbin/cron/misc.c b/usr.sbin/cron/misc.c
index 106d0821275..8aba8d9ee21 100644
--- a/usr.sbin/cron/misc.c
+++ b/usr.sbin/cron/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.63 2015/10/29 22:41:27 millert Exp $ */
+/* $OpenBSD: misc.c,v 1.64 2015/10/31 12:13:01 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -307,17 +307,6 @@ first_word(char *s, char *t)
return (rb);
}
-static gid_t save_egid;
-int swap_gids() { save_egid = getegid(); return (setegid(getgid())); }
-int swap_gids_back() { return (setegid(save_egid)); }
-
-/* Return the offset from GMT in seconds (algorithm taken from sendmail).
- *
- * warning:
- * clobbers the static storage space used by localtime() and gmtime().
- * If the local pointer is non-NULL it *must* point to a local copy.
- */
-
/* int open_socket(void)
* opens a UNIX domain socket that crontab uses to poke cron.
* If the socket is already in use, return an error.