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
92 lines
3.0 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../cron/hardened-remove.patch |
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
Never ever remove my crontab mistyping -e ... |
|
|
|
- Rene Rebe <rene@exactcode.de> |
|
|
|
diff -ur cron3.0pl1-orig/crontab.1 cron3.0pl1/crontab.1 |
|
--- cron3.0pl1-orig/crontab.1 2005-08-07 15:19:12.000000000 +0200 |
|
+++ cron3.0pl1/crontab.1 2005-08-07 15:26:58.175092641 +0200 |
|
@@ -24,7 +24,7 @@ |
|
.SH SYNOPSIS |
|
crontab [ -u user ] file |
|
.br |
|
-crontab [ -u user ] { -l | -r | -e } |
|
+crontab [ -u user ] { -l | -rr | -e } |
|
.SH DESCRIPTION |
|
.I crontab |
|
is the program used to install, deinstall or list the tables |
|
@@ -75,8 +75,11 @@ |
|
below. |
|
.PP |
|
The |
|
-.I -r |
|
-option causes the current crontab to be removed. |
|
+.I -rr |
|
+option causes the current crontab to be removed. NOTE: Since users accidently |
|
+managed to delet their crontab serveral times, accidently hitting -r instead |
|
+of -e, - we decided that -r needs to be specified two (!) times in order to |
|
+delete the user's crontab, on T2. |
|
.PP |
|
The |
|
.I -e |
|
diff -ur cron3.0pl1-orig/crontab.c cron3.0pl1/crontab.c |
|
--- cron3.0pl1-orig/crontab.c 2005-08-07 15:19:12.000000000 +0200 |
|
+++ cron3.0pl1/crontab.c 2005-08-07 15:23:59.485186577 +0200 |
|
@@ -81,11 +81,11 @@ |
|
{ |
|
fprintf(stderr, "%s: usage error: %s\n", ProgramName, msg); |
|
fprintf(stderr, "usage:\t%s [-u user] file\n", ProgramName); |
|
- fprintf(stderr, "\t%s [-u user] { -e | -l | -r }\n", ProgramName); |
|
+ fprintf(stderr, "\t%s [-u user] { -e | -l | -rr }\n", ProgramName); |
|
fprintf(stderr, "\t\t(default operation is replace, per 1003.2)\n"); |
|
fprintf(stderr, "\t-e\t(edit user's crontab)\n"); |
|
fprintf(stderr, "\t-l\t(list user's crontab)\n"); |
|
- fprintf(stderr, "\t-r\t(delete user's crontab)\n"); |
|
+ fprintf(stderr, "\t-rr\t(delete user's crontab)\n"); |
|
exit(ERROR_EXIT); |
|
} |
|
|
|
@@ -121,7 +121,7 @@ |
|
switch (Option) { |
|
case opt_list: list_cmd(); |
|
break; |
|
- case opt_delete: delete_cmd(); |
|
+ case opt_delete: printf("here\n") ; // delete_cmd(); |
|
break; |
|
case opt_edit: edit_cmd(); |
|
break; |
|
@@ -153,6 +153,7 @@ |
|
{ |
|
int argch; |
|
struct stat statbuf; |
|
+ static int really_delete = 0; |
|
|
|
if (!(pw = getpwuid(getuid()))) { |
|
fprintf(stderr, "%s: your UID isn't in the passwd file.\n", |
|
@@ -205,7 +206,10 @@ |
|
case 'r': |
|
if (Option != opt_unknown) |
|
usage("only one operation permitted"); |
|
- Option = opt_delete; |
|
+ if (really_delete) |
|
+ Option = opt_delete; |
|
+ else |
|
+ really_delete = 1; |
|
break; |
|
case 'e': |
|
if (Option != opt_unknown)
|
|
|