dcron.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. diff -ru3 dcron-2.3.3.orig/database.c dcron-2.3.3/database.c
  2. --- dcron-2.3.3.orig/database.c Mon May 2 17:28:08 1994
  3. +++ dcron-2.3.3/database.c Wed Jun 13 09:49:57 2001
  4. @@ -179,7 +179,7 @@
  5. if (--maxEntries == 0)
  6. break;
  7. - bzero(&line, sizeof(line));
  8. + memset(&line, 0, sizeof(line));
  9. if (DebugOpt)
  10. log9("User %s Entry %s\n", fileName, buf);
  11. diff -ru3 dcron-2.3.3.orig/defs.h dcron-2.3.3/defs.h
  12. --- dcron-2.3.3.orig/defs.h Fri Sep 5 21:44:32 1997
  13. +++ dcron-2.3.3/defs.h Wed Jun 13 09:51:08 2001
  14. @@ -21,12 +21,16 @@
  15. #include <sys/wait.h>
  16. #include <sys/stat.h>
  17. #include <sys/resource.h>
  18. +#include <sys/termios.h>
  19. #define Prototype extern
  20. #define arysize(ary) (sizeof(ary)/sizeof((ary)[0]))
  21. #ifndef CRONTABS
  22. #define CRONTABS "/var/spool/cron/crontabs"
  23. +#endif
  24. +#ifndef PIDFILE
  25. +#define PIDFILE "/var/run/dcron.pid"
  26. #endif
  27. #ifndef TMPDIR
  28. #define TMPDIR "/tmp"
  29. diff -ru3 dcron-2.3.3.orig/main.c dcron-2.3.3/main.c
  30. --- dcron-2.3.3.orig/main.c Mon May 2 17:28:24 1994
  31. +++ dcron-2.3.3/main.c Wed Jun 13 09:53:09 2001
  32. @@ -122,8 +122,14 @@
  33. perror("fork");
  34. exit(1);
  35. }
  36. - if (pid > 0)
  37. + if (pid > 0) {
  38. + FILE *fp;
  39. + if ((fp = fopen(PIDFILE, "w")) != NULL) {
  40. + fprintf(fp, "%d\n", pid);
  41. + fclose(fp);
  42. + }
  43. exit(0);
  44. + }
  45. }
  46. /*
  47. diff -ru3 dcron-2.3.3.orig/subs.c dcron-2.3.3/subs.c
  48. --- dcron-2.3.3.orig/subs.c Mon Feb 16 20:35:10 1998
  49. +++ dcron-2.3.3/subs.c Wed Jun 13 09:49:57 2001
  50. @@ -15,7 +15,6 @@
  51. Prototype int ChangeUser(const char *user, short dochdir);
  52. Prototype void vlog(int level, int fd, const char *ctl, va_list va);
  53. Prototype int slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate);
  54. -Prototype char *strdup(const char *);
  55. void
  56. log9(const char *ctl, ...)
  57. @@ -80,7 +79,7 @@
  58. buf[0] = 0;
  59. if (useDate)
  60. - strftime(buf, 128, "%d-%b-%y %H:%M ", tp);
  61. + strftime(buf, 128, "%d-%b-%Y %H:%M ", tp);
  62. vsnprintf(buf + strlen(buf), sz - strlen(buf), ctl, va);
  63. return(strlen(buf));
  64. }
  65. @@ -98,9 +97,15 @@
  66. log(9, "failed to get uid for %s", user);
  67. return(-1);
  68. }
  69. - setenv("USER", pas->pw_name, 1);
  70. - setenv("HOME", pas->pw_dir, 1);
  71. - setenv("SHELL", "/bin/sh", 1);
  72. + {
  73. + char buf[256];
  74. + snprintf(buf, sizeof(buf), "USER=%s", pas->pw_name);
  75. + putenv(buf);
  76. + snprintf(buf, sizeof(buf), "HOME=%s", pas->pw_dir);
  77. + putenv(buf);
  78. + snprintf(buf, sizeof(buf), "SHELL=%s", "/bin/sh");
  79. + putenv(buf);
  80. + }
  81. /*
  82. * Change running state to the user in question
  83. @@ -129,15 +134,5 @@
  84. }
  85. }
  86. return(pas->pw_uid);
  87. -}
  88. -
  89. -char *
  90. -strdup(const char *str)
  91. -{
  92. - char *ptr = malloc(strlen(str) + 1);
  93. -
  94. - if (ptr)
  95. - strcpy(ptr, str);
  96. - return(ptr);
  97. }