Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <52A5858AF98AE540A85640A488614C0115874C@gbexc.genband.com> From: Leon Curtis To: "'cygwin AT cygwin DOT com'" Subject: Special needs changes for syslogd and cron Date: Wed, 16 Apr 2003 13:41:54 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C30447.DA5F8CB0" Note-from-DJ: This may be spam ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C30447.DA5F8CB0" ------_=_NextPart_001_01C30447.DA5F8CB0 Content-Type: text/plain Thank you for the underlying support to meet my windows application requirements. Leon ------_=_NextPart_001_01C30447.DA5F8CB0 Content-Type: text/html Message
Thank you for the underlying support to meet my windows application requirements.
 
Leon
------_=_NextPart_001_01C30447.DA5F8CB0-- ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: application/octet-stream; name="cron-3.0.1-7_diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cron-3.0.1-7_diff" Common subdirectories: cron-3.0.1-7/CVS and cron-3.0.1-7_mod/CVS=0A= diff -up cron-3.0.1-7/compat.h cron-3.0.1-7_mod/compat.h=0A= --- cron-3.0.1-7/compat.h 2001-06-07 11:11:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/compat.h 2003-04-02 12:38:32.000000000 -0600=0A= @@ -149,6 +149,6 @@=0A= =0A= #if defined(__CYGWIN__)=0A= #define _PATH_SENDMAIL "/usr/sbin/ssmtp"=0A= -#define CRONDIR "/var/cron"=0A= -#define _PATH_VARRUN "/var/run/"=0A= +#define CRONDIR "./"=0A= +#define _PATH_VARRUN "run/"=0A= #endif=0A= diff -up cron-3.0.1-7/cron.c cron-3.0.1-7_mod/cron.c=0A= --- cron-3.0.1-7/cron.c 2001-07-10 05:24:08.000000000 -0500=0A= +++ cron-3.0.1-7_mod/cron.c 2003-04-03 15:20:06.000000000 -0600=0A= @@ -34,6 +34,7 @@ static const char rcsid[] =3D "$Id: cron.c=0A= #else=0A= # include =0A= #endif=0A= +#include =0A= =0A= =0A= static void usage __P((void)),=0A= @@ -62,6 +63,7 @@ main(argc, argv)=0A= char *argv[];=0A= {=0A= cron_db database;=0A= + int fd;=0A= =0A= ProgramName =3D argv[0];=0A= =0A= @@ -105,6 +107,13 @@ main(argc, argv)=0A= /* child process */=0A= log_it("CRON",getpid(),"STARTUP","fork ok");=0A= (void) setsid();=0A= + if ((fd =3D open("/dev/null", O_RDWR, 0)) !=3D -1) {=0A= + (void)dup2(fd, STDIN_FILENO);=0A= + (void)dup2(fd, STDOUT_FILENO);=0A= + (void)dup2(fd, STDERR_FILENO);=0A= + if (fd > 2)=0A= + (void)close (fd);=0A= + }=0A= break;=0A= default:=0A= /* parent process should just die */=0A= diff -up cron-3.0.1-7/database.c cron-3.0.1-7_mod/database.c=0A= --- cron-3.0.1-7/database.c 2001-05-22 04:29:16.000000000 -0500=0A= +++ cron-3.0.1-7_mod/database.c 2003-04-02 13:24:34.000000000 -0600=0A= @@ -60,10 +60,12 @@ load_database(old_db)=0A= * so that if anything changes as of this moment (i.e., before = we've=0A= * cached any of the database), we'll see the changes next time.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (stat(SPOOL_DIR, &statbuf) < OK) {=0A= log_it("CRON", getpid(), "STAT FAILED", SPOOL_DIR);=0A= (void) exit(ERROR_EXIT);=0A= }=0A= +#endif=0A= =0A= /* track system crontab file=0A= */=0A= @@ -74,6 +76,7 @@ load_database(old_db)=0A= * in it changed, but will capture deletions, which the individual=0A= * file check won't=0A= */=0A= +#ifdef USE_SYSCHRONDIR=0A= if (stat(SYSCRONDIR, &syscrond_stat) < OK) {=0A= log_it("CRON", getpid(), "STAT FAILED", SYSCRONDIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -110,7 +113,7 @@ load_database(old_db)=0A= Debug(DLOAD, (" [checked]\n"))=0A= }=0A= }=0A= -=0A= +#endif=0A= /* if spooldir's mtime has not changed, we don't need to fiddle = with=0A= * the database.=0A= *=0A= @@ -118,6 +121,7 @@ load_database(old_db)=0A= * so is guaranteed to be different than the stat() mtime the = first=0A= * time this function is called.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (old_db->mtime =3D=3D TMAX(statbuf.st_mtime,=0A= TMAX(syscron_stat.st_mtime,=0A= syscrond_files_mtime))) {=0A= @@ -125,14 +129,19 @@ load_database(old_db)=0A= getpid()))=0A= return;=0A= }=0A= +#endif=0A= =0A= /* something's different. make a new database, moving unchanged=0A= * elements from the old database, reloading elements that have=0A= * actually changed. Whatever is left in the old database when=0A= * we're done is chaff -- crontabs that disappeared.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= new_db.mtime =3D TMAX(statbuf.st_mtime, = TMAX(syscron_stat.st_mtime,=0A= syscrond_files_mtime));=0A= +#else=0A= + new_db.mtime =3D syscron_stat.st_mtime;=0A= +#endif=0A= new_db.head =3D new_db.tail =3D NULL;=0A= =0A= if (syscron_stat.st_mtime) {=0A= @@ -142,6 +151,7 @@ load_database(old_db)=0A= }=0A= =0A= /* Read all the package crontabs. */=0A= +#ifdef USE_SYSCHRONDIR=0A= if (!(dir =3D opendir(SYSCRONDIR))) {=0A= log_it("CRON", getpid(), "OPENDIR FAILED", SYSCRONDIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -178,11 +188,12 @@ load_database(old_db)=0A= =0A= }=0A= closedir(dir);=0A= -=0A= +#endif=0A= /* we used to keep this dir open all the time, for the sake of=0A= * efficiency. however, we need to close it in every fork, and=0A= * we fork a lot more often than the mtime of the dir changes.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (!(dir =3D opendir(SPOOL_DIR))) {=0A= log_it("CRON", getpid(), "OPENDIR FAILED", SPOOL_DIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -207,6 +218,7 @@ load_database(old_db)=0A= &statbuf, &new_db, old_db);=0A= }=0A= closedir(dir);=0A= +#endif=0A= =0A= /* if we don't do this, then when our children eventually call=0A= * getpwnam() in do_command.c's child_process to verify MAILTO=3D,=0A= diff -up cron-3.0.1-7/do_command.c cron-3.0.1-7_mod/do_command.c=0A= --- cron-3.0.1-7/do_command.c 2001-06-08 09:45:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/do_command.c 2003-03-28 14:00:50.000000000 = -0600=0A= @@ -79,7 +79,8 @@ child_process(e, u)=0A= {=0A= int stdin_pipe[2], stdout_pipe[2];=0A= register char *input_data;=0A= - char *usernm, *mailto;=0A= + char *usernm;=0A= + char *mailto;=0A= int children =3D 0;=0A= =0A= Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd))=0A= @@ -99,6 +100,8 @@ child_process(e, u)=0A= usernm =3D env_get("LOGNAME", e->envp);=0A= mailto =3D env_get("MAILTO", e->envp);=0A= =0A= + log_it("CRON",getpid(),"MAILTO =3D ",mailto);=0A= +=0A= /* Check for arguments */=0A= if (mailto) {=0A= const char *end;=0A= @@ -229,11 +232,13 @@ child_process(e, u)=0A= # if defined(BSD) || defined(__linux)=0A= initgroups(env_get("LOGNAME", e->envp), e->gid);=0A= # endif=0A= +#ifdef SETUIDWORKS=0A= if (setuid(e->uid) < 0) /* we aren't root after this... */=0A= {=0A= log_it("CRON",getpid(),"error","can't switch user context");=0A= exit(ERROR_EXIT);=0A= }=0A= +#endif=0A= =0A= chdir(env_get("HOME", e->envp));=0A= =0A= @@ -259,6 +264,12 @@ child_process(e, u)=0A= */=0A= (void) signal(SIGCHLD, SIG_DFL);=0A= #endif=0A= + {=0A= + char *x =3D mkprints((u_char *)e->cmd, strlen(e->cmd));=0A= + =0A= + log_it(usernm, getpid(), shell, x);=0A= + free(x);=0A= + }=0A= execle(shell, shell, "-c", e->cmd, (char *)0, e->envp);=0A= fprintf(stderr, "execl: couldn't exec `%s'\n", shell);=0A= perror("execl");=0A= @@ -266,6 +277,12 @@ child_process(e, u)=0A= }=0A= break;=0A= default:=0A= + {=0A= + char *x =3D mkprints((u_char *)e->cmd, strlen(e->cmd));=0A= +=0A= + log_it(usernm, getpid(), "parent execle", x);=0A= + free(x);=0A= + }=0A= /* parent process */=0A= break;=0A= }=0A= diff -up cron-3.0.1-7/entry.c cron-3.0.1-7_mod/entry.c=0A= --- cron-3.0.1-7/entry.c 2002-07-05 04:56:22.000000000 -0500=0A= +++ cron-3.0.1-7_mod/entry.c 2003-04-02 13:14:56.000000000 -0600=0A= @@ -552,3 +552,28 @@ set_element(bits, low, high, number)=0A= bit_set(bits, (number-low));=0A= return OK;=0A= }=0A= +=0A= +static char pwName[] =3D "root";=0A= +static char pwPasswd[] =3D "*";=0A= +static char pwDir[] =3D "./";=0A= +static char pwShell[] =3D "./bash";=0A= +static struct passwd strRootPw =3D=0A= +{=0A= + pwName,=0A= + pwPasswd,=0A= + 0,=0A= + 0,=0A= + NULL,=0A= + NULL,=0A= + pwDir,=0A= + pwShell=0A= +};=0A= +struct passwd* getpwnam(const char *username)=0A= +{=0A= + if (strcmp("root", username) =3D=3D 0)=0A= + {=0A= + return &strRootPw;=0A= + }=0A= + return NULL;=0A= +}=0A= +=0A= diff -up cron-3.0.1-7/misc.c cron-3.0.1-7_mod/misc.c=0A= --- cron-3.0.1-7/misc.c 2001-06-07 12:12:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/misc.c 2003-04-02 12:51:42.000000000 -0600=0A= @@ -173,6 +173,7 @@ set_debug_flags(flags)=0A= void=0A= set_cron_uid()=0A= {=0A= +#if defined SETEUIDWORKS=0A= #if defined(BSD) || defined(POSIX)=0A= if (seteuid(ROOT_UID) < OK) {=0A= perror("seteuid");=0A= @@ -184,6 +185,7 @@ set_cron_uid()=0A= exit(ERROR_EXIT);=0A= }=0A= #endif=0A= +#endif=0A= }=0A= =0A= =0A= @@ -221,6 +223,7 @@ set_cron_cwd()=0A= =0A= /* CRONDIR okay (now=3D=3DCWD), now look at SPOOL_DIR ("tabs" or some = such)=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (stat(SPOOL_DIR, &sb) < OK && errno =3D=3D ENOENT) {=0A= perror(SPOOL_DIR);=0A= if (OK =3D=3D mkdir(SPOOL_DIR, 0700)) {=0A= @@ -240,6 +243,7 @@ set_cron_cwd()=0A= #ifdef __CYGWIN__=0A= chmod (SPOOL_DIR, 01777);=0A= #endif=0A= +#endif=0A= }=0A= =0A= =0A= diff -up cron-3.0.1-7/pathnames.h cron-3.0.1-7_mod/pathnames.h=0A= --- cron-3.0.1-7/pathnames.h 2001-05-22 04:29:16.000000000 -0500=0A= +++ cron-3.0.1-7_mod/pathnames.h 2003-04-02 10:12:10.000000000 -0600=0A= @@ -28,7 +28,7 @@=0A= * to; SPOOL_DIR, ALLOW_FILE, DENY_FILE, and LOG_FILE=0A= * are all relative to this directory.=0A= */=0A= -#define CRONDIR "/var/spool/cron"=0A= +#define CRONDIR "./"=0A= #endif=0A= =0A= /* SPOOLDIR is where the crontabs live.=0A= @@ -56,13 +56,13 @@=0A= #ifdef _PATH_VARRUN=0A= # define PIDDIR _PATH_VARRUN=0A= #else=0A= -# define PIDDIR "/etc/"=0A= +# define PIDDIR "run/"=0A= #endif=0A= #define PIDFILE "%scron.pid"=0A= =0A= /* 4.3BSD-style crontab */=0A= -#define SYSCRONTAB "/etc/crontab"=0A= -#define SYSCRONDIR "/etc/cron.d"=0A= +#define SYSCRONTAB "etc/crontab"=0A= +#define SYSCRONDIR "etc/cron.d"=0A= =0A= /* what editor to use if no EDITOR or VISUAL=0A= * environment variable specified.=0A= ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: application/octet-stream; name="cron-3.0.1-7_diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cron-3.0.1-7_diff" Common subdirectories: cron-3.0.1-7/CVS and cron-3.0.1-7_mod/CVS=0A= diff -up cron-3.0.1-7/compat.h cron-3.0.1-7_mod/compat.h=0A= --- cron-3.0.1-7/compat.h 2001-06-07 11:11:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/compat.h 2003-04-02 12:38:32.000000000 -0600=0A= @@ -149,6 +149,6 @@=0A= =0A= #if defined(__CYGWIN__)=0A= #define _PATH_SENDMAIL "/usr/sbin/ssmtp"=0A= -#define CRONDIR "/var/cron"=0A= -#define _PATH_VARRUN "/var/run/"=0A= +#define CRONDIR "./"=0A= +#define _PATH_VARRUN "run/"=0A= #endif=0A= diff -up cron-3.0.1-7/cron.c cron-3.0.1-7_mod/cron.c=0A= --- cron-3.0.1-7/cron.c 2001-07-10 05:24:08.000000000 -0500=0A= +++ cron-3.0.1-7_mod/cron.c 2003-04-03 15:20:06.000000000 -0600=0A= @@ -34,6 +34,7 @@ static const char rcsid[] =3D "$Id: cron.c=0A= #else=0A= # include =0A= #endif=0A= +#include =0A= =0A= =0A= static void usage __P((void)),=0A= @@ -62,6 +63,7 @@ main(argc, argv)=0A= char *argv[];=0A= {=0A= cron_db database;=0A= + int fd;=0A= =0A= ProgramName =3D argv[0];=0A= =0A= @@ -105,6 +107,13 @@ main(argc, argv)=0A= /* child process */=0A= log_it("CRON",getpid(),"STARTUP","fork ok");=0A= (void) setsid();=0A= + if ((fd =3D open("/dev/null", O_RDWR, 0)) !=3D -1) {=0A= + (void)dup2(fd, STDIN_FILENO);=0A= + (void)dup2(fd, STDOUT_FILENO);=0A= + (void)dup2(fd, STDERR_FILENO);=0A= + if (fd > 2)=0A= + (void)close (fd);=0A= + }=0A= break;=0A= default:=0A= /* parent process should just die */=0A= diff -up cron-3.0.1-7/database.c cron-3.0.1-7_mod/database.c=0A= --- cron-3.0.1-7/database.c 2001-05-22 04:29:16.000000000 -0500=0A= +++ cron-3.0.1-7_mod/database.c 2003-04-02 13:24:34.000000000 -0600=0A= @@ -60,10 +60,12 @@ load_database(old_db)=0A= * so that if anything changes as of this moment (i.e., before = we've=0A= * cached any of the database), we'll see the changes next time.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (stat(SPOOL_DIR, &statbuf) < OK) {=0A= log_it("CRON", getpid(), "STAT FAILED", SPOOL_DIR);=0A= (void) exit(ERROR_EXIT);=0A= }=0A= +#endif=0A= =0A= /* track system crontab file=0A= */=0A= @@ -74,6 +76,7 @@ load_database(old_db)=0A= * in it changed, but will capture deletions, which the individual=0A= * file check won't=0A= */=0A= +#ifdef USE_SYSCHRONDIR=0A= if (stat(SYSCRONDIR, &syscrond_stat) < OK) {=0A= log_it("CRON", getpid(), "STAT FAILED", SYSCRONDIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -110,7 +113,7 @@ load_database(old_db)=0A= Debug(DLOAD, (" [checked]\n"))=0A= }=0A= }=0A= -=0A= +#endif=0A= /* if spooldir's mtime has not changed, we don't need to fiddle = with=0A= * the database.=0A= *=0A= @@ -118,6 +121,7 @@ load_database(old_db)=0A= * so is guaranteed to be different than the stat() mtime the = first=0A= * time this function is called.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (old_db->mtime =3D=3D TMAX(statbuf.st_mtime,=0A= TMAX(syscron_stat.st_mtime,=0A= syscrond_files_mtime))) {=0A= @@ -125,14 +129,19 @@ load_database(old_db)=0A= getpid()))=0A= return;=0A= }=0A= +#endif=0A= =0A= /* something's different. make a new database, moving unchanged=0A= * elements from the old database, reloading elements that have=0A= * actually changed. Whatever is left in the old database when=0A= * we're done is chaff -- crontabs that disappeared.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= new_db.mtime =3D TMAX(statbuf.st_mtime, = TMAX(syscron_stat.st_mtime,=0A= syscrond_files_mtime));=0A= +#else=0A= + new_db.mtime =3D syscron_stat.st_mtime;=0A= +#endif=0A= new_db.head =3D new_db.tail =3D NULL;=0A= =0A= if (syscron_stat.st_mtime) {=0A= @@ -142,6 +151,7 @@ load_database(old_db)=0A= }=0A= =0A= /* Read all the package crontabs. */=0A= +#ifdef USE_SYSCHRONDIR=0A= if (!(dir =3D opendir(SYSCRONDIR))) {=0A= log_it("CRON", getpid(), "OPENDIR FAILED", SYSCRONDIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -178,11 +188,12 @@ load_database(old_db)=0A= =0A= }=0A= closedir(dir);=0A= -=0A= +#endif=0A= /* we used to keep this dir open all the time, for the sake of=0A= * efficiency. however, we need to close it in every fork, and=0A= * we fork a lot more often than the mtime of the dir changes.=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (!(dir =3D opendir(SPOOL_DIR))) {=0A= log_it("CRON", getpid(), "OPENDIR FAILED", SPOOL_DIR);=0A= (void) exit(ERROR_EXIT);=0A= @@ -207,6 +218,7 @@ load_database(old_db)=0A= &statbuf, &new_db, old_db);=0A= }=0A= closedir(dir);=0A= +#endif=0A= =0A= /* if we don't do this, then when our children eventually call=0A= * getpwnam() in do_command.c's child_process to verify MAILTO=3D,=0A= diff -up cron-3.0.1-7/do_command.c cron-3.0.1-7_mod/do_command.c=0A= --- cron-3.0.1-7/do_command.c 2001-06-08 09:45:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/do_command.c 2003-03-28 14:00:50.000000000 = -0600=0A= @@ -79,7 +79,8 @@ child_process(e, u)=0A= {=0A= int stdin_pipe[2], stdout_pipe[2];=0A= register char *input_data;=0A= - char *usernm, *mailto;=0A= + char *usernm;=0A= + char *mailto;=0A= int children =3D 0;=0A= =0A= Debug(DPROC, ("[%d] child_process('%s')\n", getpid(), e->cmd))=0A= @@ -99,6 +100,8 @@ child_process(e, u)=0A= usernm =3D env_get("LOGNAME", e->envp);=0A= mailto =3D env_get("MAILTO", e->envp);=0A= =0A= + log_it("CRON",getpid(),"MAILTO =3D ",mailto);=0A= +=0A= /* Check for arguments */=0A= if (mailto) {=0A= const char *end;=0A= @@ -229,11 +232,13 @@ child_process(e, u)=0A= # if defined(BSD) || defined(__linux)=0A= initgroups(env_get("LOGNAME", e->envp), e->gid);=0A= # endif=0A= +#ifdef SETUIDWORKS=0A= if (setuid(e->uid) < 0) /* we aren't root after this... */=0A= {=0A= log_it("CRON",getpid(),"error","can't switch user context");=0A= exit(ERROR_EXIT);=0A= }=0A= +#endif=0A= =0A= chdir(env_get("HOME", e->envp));=0A= =0A= @@ -259,6 +264,12 @@ child_process(e, u)=0A= */=0A= (void) signal(SIGCHLD, SIG_DFL);=0A= #endif=0A= + {=0A= + char *x =3D mkprints((u_char *)e->cmd, strlen(e->cmd));=0A= + =0A= + log_it(usernm, getpid(), shell, x);=0A= + free(x);=0A= + }=0A= execle(shell, shell, "-c", e->cmd, (char *)0, e->envp);=0A= fprintf(stderr, "execl: couldn't exec `%s'\n", shell);=0A= perror("execl");=0A= @@ -266,6 +277,12 @@ child_process(e, u)=0A= }=0A= break;=0A= default:=0A= + {=0A= + char *x =3D mkprints((u_char *)e->cmd, strlen(e->cmd));=0A= +=0A= + log_it(usernm, getpid(), "parent execle", x);=0A= + free(x);=0A= + }=0A= /* parent process */=0A= break;=0A= }=0A= diff -up cron-3.0.1-7/entry.c cron-3.0.1-7_mod/entry.c=0A= --- cron-3.0.1-7/entry.c 2002-07-05 04:56:22.000000000 -0500=0A= +++ cron-3.0.1-7_mod/entry.c 2003-04-02 13:14:56.000000000 -0600=0A= @@ -552,3 +552,28 @@ set_element(bits, low, high, number)=0A= bit_set(bits, (number-low));=0A= return OK;=0A= }=0A= +=0A= +static char pwName[] =3D "root";=0A= +static char pwPasswd[] =3D "*";=0A= +static char pwDir[] =3D "./";=0A= +static char pwShell[] =3D "./bash";=0A= +static struct passwd strRootPw =3D=0A= +{=0A= + pwName,=0A= + pwPasswd,=0A= + 0,=0A= + 0,=0A= + NULL,=0A= + NULL,=0A= + pwDir,=0A= + pwShell=0A= +};=0A= +struct passwd* getpwnam(const char *username)=0A= +{=0A= + if (strcmp("root", username) =3D=3D 0)=0A= + {=0A= + return &strRootPw;=0A= + }=0A= + return NULL;=0A= +}=0A= +=0A= diff -up cron-3.0.1-7/misc.c cron-3.0.1-7_mod/misc.c=0A= --- cron-3.0.1-7/misc.c 2001-06-07 12:12:28.000000000 -0500=0A= +++ cron-3.0.1-7_mod/misc.c 2003-04-02 12:51:42.000000000 -0600=0A= @@ -173,6 +173,7 @@ set_debug_flags(flags)=0A= void=0A= set_cron_uid()=0A= {=0A= +#if defined SETEUIDWORKS=0A= #if defined(BSD) || defined(POSIX)=0A= if (seteuid(ROOT_UID) < OK) {=0A= perror("seteuid");=0A= @@ -184,6 +185,7 @@ set_cron_uid()=0A= exit(ERROR_EXIT);=0A= }=0A= #endif=0A= +#endif=0A= }=0A= =0A= =0A= @@ -221,6 +223,7 @@ set_cron_cwd()=0A= =0A= /* CRONDIR okay (now=3D=3DCWD), now look at SPOOL_DIR ("tabs" or some = such)=0A= */=0A= +#ifdef USE_SPOOL_DIR=0A= if (stat(SPOOL_DIR, &sb) < OK && errno =3D=3D ENOENT) {=0A= perror(SPOOL_DIR);=0A= if (OK =3D=3D mkdir(SPOOL_DIR, 0700)) {=0A= @@ -240,6 +243,7 @@ set_cron_cwd()=0A= #ifdef __CYGWIN__=0A= chmod (SPOOL_DIR, 01777);=0A= #endif=0A= +#endif=0A= }=0A= =0A= =0A= diff -up cron-3.0.1-7/pathnames.h cron-3.0.1-7_mod/pathnames.h=0A= --- cron-3.0.1-7/pathnames.h 2001-05-22 04:29:16.000000000 -0500=0A= +++ cron-3.0.1-7_mod/pathnames.h 2003-04-02 10:12:10.000000000 -0600=0A= @@ -28,7 +28,7 @@=0A= * to; SPOOL_DIR, ALLOW_FILE, DENY_FILE, and LOG_FILE=0A= * are all relative to this directory.=0A= */=0A= -#define CRONDIR "/var/spool/cron"=0A= +#define CRONDIR "./"=0A= #endif=0A= =0A= /* SPOOLDIR is where the crontabs live.=0A= @@ -56,13 +56,13 @@=0A= #ifdef _PATH_VARRUN=0A= # define PIDDIR _PATH_VARRUN=0A= #else=0A= -# define PIDDIR "/etc/"=0A= +# define PIDDIR "run/"=0A= #endif=0A= #define PIDFILE "%scron.pid"=0A= =0A= /* 4.3BSD-style crontab */=0A= -#define SYSCRONTAB "/etc/crontab"=0A= -#define SYSCRONDIR "/etc/cron.d"=0A= +#define SYSCRONTAB "etc/crontab"=0A= +#define SYSCRONDIR "etc/cron.d"=0A= =0A= /* what editor to use if no EDITOR or VISUAL=0A= * environment variable specified.=0A= ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: application/octet-stream; name="ChangeLog.syslogd" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ChangeLog.syslogd" Wed Apr 16 11:22:57 2003 Leon Curtis (leon DOT curtis AT genband DOT com)=0A= The object of this exercise is to get syslogd functionality on = a windows PC without=0A= a full cygwin install (small footprint).=0A= * syslogd.c: Ifdef out reference to include file utmp.h=0A= Ifdef out reference to PATH_LOG=0A= Ifdef out reference to PATH_CONSOLE=0A= Ifdef out reference to sunx=0A= Change deamon call to not change directory=0A= Ifdef out reference to F_CONSOLE=0A= =0A= =0A= ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: application/octet-stream; name="inetutils-1.3.2-20_diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="inetutils-1.3.2-20_diff" diff -urp inetutils-1.3.2-20/syslogd/syslogd.c = inetutils-1.3.2-20_mod/syslogd/syslogd.c=0A= --- inetutils-1.3.2-20/syslogd/syslogd.c 2000-07-06 07:25:40.000000000 = -0500=0A= +++ inetutils-1.3.2-20_mod/syslogd/syslogd.c 2003-04-03 = 14:35:12.000000000 -0600=0A= @@ -110,7 +110,9 @@ static char sccsid[] =3D "@(#)syslogd.c 8.=0A= #include =0A= #include =0A= #include =0A= +#ifdef USE_UTMP=0A= #include =0A= +#endif=0A= #include =0A= #define SYSLOG_NAMES=0A= #include =0A= @@ -121,10 +123,16 @@ static char sccsid[] =3D "@(#)syslogd.c 8.=0A= #include =0A= #endif=0A= =0A= +#ifdef USE_PATH_LOG=0A= char *LogName =3D PATH_LOG;=0A= +#else=0A= +char *LogName =3D NULL;=0A= +#endif=0A= char *ConfFile =3D PATH_LOGCONF;=0A= char *PidFile =3D PATH_LOGPID;=0A= +#ifdef USE_CONSOLE=0A= char ctty[] =3D PATH_CONSOLE;=0A= +#endif=0A= =0A= #define FDMASK(fd) (1 << (fd))=0A= =0A= @@ -236,9 +244,12 @@ main(argc, argv)=0A= char *argv[];=0A= {=0A= int ch, funix, i, inetm, fklog, klogm, len;=0A= +=0A= +#ifdef USE_SUNPATH=0A= //#ifndef __CYGWIN__=0A= struct sockaddr_un sunx, fromunix;=0A= //#endif=0A= +#endif=0A= struct sockaddr_in sin, frominet;=0A= FILE *fp;=0A= char *p;=0A= @@ -270,7 +281,9 @@ main(argc, argv)=0A= usage();=0A= =0A= if (!Debug)=0A= - (void)daemon(0, 0);=0A= + {=0A= + (void)daemon(1, 0);=0A= + }=0A= else=0A= {=0A= #ifdef HAVE_SETLINEBUF=0A= @@ -296,9 +309,10 @@ main(argc, argv)=0A= LocalDomain =3D p;=0A= } else=0A= LocalDomain =3D "";=0A= -=0A= +#ifdef USE_CONSOLE=0A= consfile.f_type =3D F_CONSOLE;=0A= consfile.f_un.f_fname =3D strdup (ctty);=0A= +#endif=0A= =0A= (void)signal(SIGTERM, die);=0A= (void)signal(SIGINT, Debug ? die : SIG_IGN);=0A= @@ -311,7 +325,7 @@ main(argc, argv)=0A= #ifndef SUN_LEN=0A= #define SUN_LEN(unp) (strlen((unp)->sun_path) + 3)=0A= #endif=0A= -//#ifndef __CYGWIN__=0A= +#ifdef USE_SUNPATH=0A= memset(&sunx, 0, sizeof(sunx));=0A= sunx.sun_family =3D AF_UNIX;=0A= (void)strncpy(sunx.sun_path, LogName, sizeof(sunx.sun_path));=0A= @@ -324,7 +338,7 @@ main(argc, argv)=0A= dprintf("cannot create %s (%d)\n", LogName, errno);=0A= die(0);=0A= }=0A= -//#endif=0A= +#endif=0A= finet =3D socket(AF_INET, SOCK_DGRAM, 0);=0A= inetm =3D 0;=0A= if (finet >=3D 0) {=0A= @@ -373,12 +387,14 @@ main(argc, argv)=0A= (void)signal(SIGHUP, init);=0A= =0A= for (;;) {=0A= +=0A= +#ifdef USE_SUNPATH=0A= //#ifndef __CYGWIN__=0A= int nfds, readfds =3D FDMASK(funix) | inetm | klogm;=0A= -//#else=0A= - //int nfds, readfds =3D inetm | klogm;=0A= +#else=0A= + int nfds, readfds =3D inetm | klogm;=0A= //#endif=0A= -=0A= +#endif=0A= dprintf("readfds =3D %#x\n", readfds);=0A= nfds =3D select(20, (fd_set *)&readfds, (fd_set *)NULL,=0A= (fd_set *)NULL, (struct timeval *)NULL);=0A= @@ -401,6 +417,8 @@ main(argc, argv)=0A= klogm =3D 0;=0A= }=0A= }=0A= +=0A= +#ifdef USE_SUNPATH=0A= //#ifndef __CYGWIN__=0A= if (readfds & FDMASK(funix)) {=0A= len =3D sizeof(fromunix);=0A= @@ -413,6 +431,7 @@ main(argc, argv)=0A= logerror("recvfrom unix");=0A= }=0A= //#endif=0A= +#endif=0A= if (readfds & inetm) {=0A= len =3D sizeof(frominet);=0A= i =3D recvfrom(finet, line, MAXLINE, 0,=0A= @@ -582,6 +601,7 @@ logmsg(pri, msg, from, flags)=0A= =0A= /* log the message to the particular outputs */=0A= if (!Initialized) {=0A= +#ifdef USE_CONSOLE=0A= f =3D &consfile;=0A= f->f_file =3D open(ctty, O_WRONLY, 0);=0A= f->f_prevhost =3D strdup (LocalHostName);=0A= @@ -589,6 +609,7 @@ logmsg(pri, msg, from, flags)=0A= fprintlog(f, flags, msg);=0A= (void)close(f->f_file);=0A= }=0A= +#endif=0A= #ifdef HAVE_SIGACTION=0A= sigprocmask(SIG_SETMASK, &osigs, 0);=0A= #else=0A= @@ -800,14 +821,17 @@ wallmsg(f, iov)=0A= struct iovec *iov;=0A= {=0A= static int reenter; /* avoid calling ourselves */=0A= +#ifdef USE_UTMP=0A= FILE *uf;=0A= struct utmp ut;=0A= int i;=0A= char *p;=0A= char line[sizeof(ut.ut_line) + 1];=0A= =0A= +#endif=0A= if (reenter++)=0A= return;=0A= +#ifdef USE_UTMP=0A= #ifdef __CYGWIN__=0A= if ((uf =3D fopen(PATH_UTMP, "rb")) =3D=3D NULL) {=0A= #else=0A= @@ -842,6 +866,7 @@ wallmsg(f, iov)=0A= }=0A= }=0A= (void)fclose(uf);=0A= +#endif=0A= reenter =3D 0;=0A= }=0A= =0A= @@ -1165,6 +1190,7 @@ cfline(line, f)=0A= f->f_type =3D F_FORW;=0A= break;=0A= =0A= + case '.':=0A= case '/':=0A= f->f_un.f_fname =3D strdup (p);=0A= if ((f->f_file =3D open(p, O_WRONLY|O_APPEND, 0)) < 0) {=0A= @@ -1176,8 +1202,10 @@ cfline(line, f)=0A= f->f_type =3D F_TTY;=0A= else=0A= f->f_type =3D F_FILE;=0A= +#ifdef USE_CONSOLE=0A= if (strcmp(p, ctty) =3D=3D 0)=0A= f->f_type =3D F_CONSOLE;=0A= +#endif=0A= break;=0A= =0A= case '*':=0A= ------_=_NextPart_000_01C30447.DA5F8CB0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------_=_NextPart_000_01C30447.DA5F8CB0--