From: Christian Kastner <ckk@kvr.at>
Date: Sat, 26 Dec 2015 19:51:53 +0100
Subject: Permit user to use -u option on self

Instead of entirely prohibiting non-root users to use the -u option, allow them
to use it on themselves, as this should be a null-op.

Fix provided by Steve Greenland <stevegr@debian.org>.

Forwarded: no
Last-Update: 2015-12-26
Index: cron/crontab.c
===================================================================
--- cron.orig/crontab.c
+++ cron/crontab.c
@@ -176,18 +176,19 @@ parse_args(argc, argv)
 				usage("bad debug option");
 			break;
 		case 'u':
-			if (getuid() != ROOT_UID)
-			{
-				fprintf(stderr,
-					"must be privileged to use -u\n");
-				exit(ERROR_EXIT);
-			}
 			if (!(pw = getpwnam(optarg)))
 			{
 				fprintf(stderr, "%s:  user `%s' unknown\n",
 					ProgramName, optarg);
 				exit(ERROR_EXIT);
 			}
+			if ((getuid() != ROOT_UID) &&
+				(getuid() != pw->pw_uid))
+			{
+				fprintf(stderr,
+					"must be privileged to use -u\n");
+				exit(ERROR_EXIT);
+			}
 			free(User);
 			if ((User=strdup(pw->pw_name)) == NULL) {
 			        fprintf(stderr, "Memory allocation error\n");
