From: thib Date: Wed, 11 Jan 2006 00:49:33 +0000 (+0000) Subject: updated copyright X-Git-Tag: ver3_0_1~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d737460c1ab12bb3bb450ce43f7797e10254f94d;p=fcron updated copyright changed the policy about set(e)uid(): use the user rights when accessing his home directory (necessary if user/group fcron are not allowed to read the dir) --- diff --git a/fcrontab.c b/fcrontab.c index 3ed129e..4579305 100644 --- a/fcrontab.c +++ b/fcrontab.c @@ -1,8 +1,7 @@ - /* * FCRON - periodic command scheduler * - * Copyright 2000-2004 Thibault Godouet + * Copyright 2000-2006 Thibault Godouet * * 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 @@ -22,7 +21,7 @@ * `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 @@ -47,7 +46,7 @@ #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); @@ -105,7 +104,7 @@ info(void) { fprintf(stderr, "fcrontab " VERSION_QUOTED " - user interface to daemon fcron\n" - "Copyright 2000-2004 Thibault Godouet \n" + "Copyright " COPYRIGHT_QUOTED " Thibault Godouet \n" "This program is free software distributed WITHOUT ANY WARRANTY.\n" "See the GNU General Public License for more details.\n" ); @@ -978,9 +977,7 @@ main(int argc, char **argv) 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)); @@ -990,18 +987,26 @@ main(int argc, char **argv) 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