* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: config.h.in,v 1.57 2006-05-20 16:27:43 thib Exp $ */
+ /* $Id: config.h.in,v 1.58 2006-06-05 20:03:05 thib Exp $ */
/* *********************************************************** */
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
+/* Define if (struct sockaddr) has an sa_len field. */
+#undef HAVE_SA_LEN
+
/* Define if you have the setenv function. */
#undef HAVE_SETENV
fi
+dnl Check for post-Reno style struct sockaddr
+AC_CACHE_CHECK([for sa_len],
+ ac_cv_sa_len,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>], [int main(void) {
+ struct sockaddr t;t.sa_len = 0;}],
+ ac_cv_sa_len=yes,ac_cv_sa_len=no)])
+if test $ac_cv_sa_len = yes; then
+ AC_DEFINE(HAVE_SA_LEN)
+fi
dnl ---------------------------------------------------------------------
dnl Check for fcron more specific stuffs (paths, progs, ...)
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: fcrontab.c,v 1.69 2006-05-20 16:26:37 thib Exp $ */
+ /* $Id: fcrontab.c,v 1.70 2006-06-05 20:02:55 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.69 2006-05-20 16:26:37 thib Exp $";
+char rcs_info[] = "$Id: fcrontab.c,v 1.70 2006-06-05 20:02:55 thib Exp $";
void info(void);
void usage(void);
/* Open PAM session for the user and obtain any security
credentials we might need */
+#ifdef USE_SETE_ID
+ if (seteuid(uid) != 0)
+ die_e("Could not change euid to %d", uid);
+#endif
debug("username: %s", user);
retcode = pam_start("fcrontab", user, &apamconv, &pamh);
if (retcode != PAM_SUCCESS) die_pame(pamh, retcode, "Could not start PAM");
/* Close the log here, because PAM calls openlog(3) and
our log messages could go to the wrong facility */
xcloselog();
+#ifdef USE_SETE_ID
+ if (seteuid(fcrontab_uid) != 0)
+ die_e("Couldn't change euid to fcrontab_uid[%d]",fcrontab_uid);
+#endif
#endif /* USE_PAM */
if (uid != fcrontab_uid)
* `LICENSE' that comes with the fcron source distribution.
*/
- /* $Id: socket.c,v 1.19 2006-01-11 00:58:21 thib Exp $ */
+ /* $Id: socket.c,v 1.20 2006-06-05 20:03:08 thib Exp $ */
/* This file contains all fcron's code (server) to handle communication with fcrondyn */
{
struct sockaddr_un addr;
int len = 0;
+ int sun_len = 0;
/* used in fcron.c:main_loop():select() */
FD_ZERO(&read_set);
}
addr.sun_family = AF_UNIX;
- if ( (len = strlen(fifofile)) > sizeof(addr.sun_path) ) {
- error("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path));
+ len = strlen(fifofile);
+ if ( len > sizeof(addr.sun_path) - 1 ) {
+ error("Error : fifo file path too long (max is %d)", sizeof(addr.sun_path) - 1);
goto err;
}
- strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path) - 1);
+ strncpy(addr.sun_path, fifofile, sizeof(addr.sun_path));
addr.sun_path[sizeof(addr.sun_path) -1 ] = '\0';
+ sun_len = (addr.sun_path - (char *)&addr) + len;
+#if HAVE_SA_LEN
+ addr.sun_len = sun_len;
+#endif
unlink(fifofile);
- if (bind(listen_fd, (struct sockaddr*) &addr, sizeof(addr.sun_family)+len+1) != 0){
+ if (bind(listen_fd, (struct sockaddr*) &addr, sun_len) != 0){
error_e("Cannot bind socket to '%s'", fifofile);
goto err;
}