OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.0 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../cron/hardened-remove.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. Never ever remove my crontab mistyping -e ...
  17. - Rene Rebe <rene@exactcode.de>
  18. diff -ur cron3.0pl1-orig/crontab.1 cron3.0pl1/crontab.1
  19. --- cron3.0pl1-orig/crontab.1 2005-08-07 15:19:12.000000000 +0200
  20. +++ cron3.0pl1/crontab.1 2005-08-07 15:26:58.175092641 +0200
  21. @@ -24,7 +24,7 @@
  22. .SH SYNOPSIS
  23. crontab [ -u user ] file
  24. .br
  25. -crontab [ -u user ] { -l | -r | -e }
  26. +crontab [ -u user ] { -l | -rr | -e }
  27. .SH DESCRIPTION
  28. .I crontab
  29. is the program used to install, deinstall or list the tables
  30. @@ -75,8 +75,11 @@
  31. below.
  32. .PP
  33. The
  34. -.I -r
  35. -option causes the current crontab to be removed.
  36. +.I -rr
  37. +option causes the current crontab to be removed. NOTE: Since users accidently
  38. +managed to delet their crontab serveral times, accidently hitting -r instead
  39. +of -e, - we decided that -r needs to be specified two (!) times in order to
  40. +delete the user's crontab, on T2.
  41. .PP
  42. The
  43. .I -e
  44. diff -ur cron3.0pl1-orig/crontab.c cron3.0pl1/crontab.c
  45. --- cron3.0pl1-orig/crontab.c 2005-08-07 15:19:12.000000000 +0200
  46. +++ cron3.0pl1/crontab.c 2005-08-07 15:23:59.485186577 +0200
  47. @@ -81,11 +81,11 @@
  48. {
  49. fprintf(stderr, "%s: usage error: %s\n", ProgramName, msg);
  50. fprintf(stderr, "usage:\t%s [-u user] file\n", ProgramName);
  51. - fprintf(stderr, "\t%s [-u user] { -e | -l | -r }\n", ProgramName);
  52. + fprintf(stderr, "\t%s [-u user] { -e | -l | -rr }\n", ProgramName);
  53. fprintf(stderr, "\t\t(default operation is replace, per 1003.2)\n");
  54. fprintf(stderr, "\t-e\t(edit user's crontab)\n");
  55. fprintf(stderr, "\t-l\t(list user's crontab)\n");
  56. - fprintf(stderr, "\t-r\t(delete user's crontab)\n");
  57. + fprintf(stderr, "\t-rr\t(delete user's crontab)\n");
  58. exit(ERROR_EXIT);
  59. }
  60. @@ -121,7 +121,7 @@
  61. switch (Option) {
  62. case opt_list: list_cmd();
  63. break;
  64. - case opt_delete: delete_cmd();
  65. + case opt_delete: printf("here\n") ; // delete_cmd();
  66. break;
  67. case opt_edit: edit_cmd();
  68. break;
  69. @@ -153,6 +153,7 @@
  70. {
  71. int argch;
  72. struct stat statbuf;
  73. + static int really_delete = 0;
  74. if (!(pw = getpwuid(getuid()))) {
  75. fprintf(stderr, "%s: your UID isn't in the passwd file.\n",
  76. @@ -205,7 +206,10 @@
  77. case 'r':
  78. if (Option != opt_unknown)
  79. usage("only one operation permitted");
  80. - Option = opt_delete;
  81. + if (really_delete)
  82. + Option = opt_delete;
  83. + else
  84. + really_delete = 1;
  85. break;
  86. case 'e':
  87. if (Option != opt_unknown)