-
/*
* FCRON - periodic command scheduler
*
- * Copyright 2000-2004 Thibault Godouet <fcron@free.fr>
+ * Copyright 2000-2006 Thibault Godouet <fcron@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcrontab.c,v 1.67 2005-07-19 10:40:07 thib Exp $ */
+ /* $Id: fcrontab.c,v 1.68 2006-01-11 00:49:33 thib Exp $ */
/*
* The goal of this program is simple : giving a user interface to fcron
#include "temp_file.h"
#include "read_string.h"
-char rcs_info[] = "$Id: fcrontab.c,v 1.67 2005-07-19 10:40:07 thib Exp $";
+char rcs_info[] = "$Id: fcrontab.c,v 1.68 2006-01-11 00:49:33 thib Exp $";
void info(void);
void usage(void);
{
fprintf(stderr,
"fcrontab " VERSION_QUOTED " - user interface to daemon fcron\n"
- "Copyright 2000-2004 Thibault Godouet <fcron@free.fr>\n"
+ "Copyright " COPYRIGHT_QUOTED " Thibault Godouet <fcron@free.fr>\n"
"This program is free software distributed WITHOUT ANY WARRANTY.\n"
"See the GNU General Public License for more details.\n"
);
int retcode = 0;
const char * const * env;
#endif
-#ifdef USE_SETE_ID
struct passwd *pass;
-#endif
memset(buf, 0, sizeof(buf));
memset(file, 0, sizeof(file));
uid = getuid();
+ if ( ! (pass = getpwnam(USERNAME)) )
+ die_e("user \"%s\" is not in passwd file. Aborting.", USERNAME);
+ fcrontab_uid = pass->pw_uid;
+ fcrontab_gid = pass->pw_gid;
+
/* get current dir */
+#ifdef USE_SETE_ID
+ if (seteuid(uid) != 0)
+ die_e("Could not change euid to %d", uid);
+#endif
if ( getcwd(orig_dir, sizeof(orig_dir)) == NULL )
die_e("getcwd");
+#ifdef USE_SETE_ID
+ if (seteuid(fcrontab_uid) != 0)
+ die_e("Couldn't change euid to fcrontab_uid[%d]",fcrontab_uid);
+#endif
/* interpret command line options */
parseopt(argc, argv);
- if ( ! (pass = getpwnam(USERNAME)) )
- die_e("user \"%s\" is not in passwd file. Aborting.", USERNAME);
- fcrontab_uid = pass->pw_uid;
- fcrontab_gid = pass->pw_gid;
-
#ifdef USE_SETE_ID
#ifdef HAVE_LIBPAM