- clean cvs, check patches

This commit is contained in:
Marcela Mašláňová 2009-06-01 11:47:22 +00:00
parent 26a0a82e64
commit 2938e27a31
12 changed files with 36 additions and 1167 deletions

View File

@ -1,2 +1,5 @@
at_3.1.10.tar.gz at_3.1.10.tar.gz
56atd 56atd
atd.init
atd.sysconf
test.pl

View File

@ -1,6 +1,6 @@
diff -up at-3.1.10/at.c.fix at-3.1.10/at.c diff -up at-3.1.10/at.c.fix at-3.1.10/at.c
--- at-3.1.10/at.c.fix 2009-02-26 14:31:55.000000000 +0100 --- at-3.1.10/at.c.fix 2009-03-18 10:49:06.000000000 +0100
+++ at-3.1.10/at.c 2009-02-26 14:37:49.000000000 +0100 +++ at-3.1.10/at.c 2009-03-18 10:59:19.000000000 +0100
@@ -61,12 +61,8 @@ @@ -61,12 +61,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -21,7 +21,7 @@ diff -up at-3.1.10/at.c.fix at-3.1.10/at.c
int mailsize = 128; int mailsize = 128;
+ struct timeval tv; + struct timeval tv;
+ struct timezone tz; + struct timezone tz;
+ int i; + long int i;
+ +
+ gettimeofday(&tv, &tz); + gettimeofday(&tv, &tz);
+ srandom(getpid()+tv.tv_usec); + srandom(getpid()+tv.tv_usec);
@ -34,7 +34,15 @@ diff -up at-3.1.10/at.c.fix at-3.1.10/at.c
- fprintf(fp, "${SHELL:-/bin/sh} << `(dd if=/dev/urandom count=200 bs=1 2>/dev/null|LC_ALL=C tr -d -c '[:alnum:]')`\n\n"); - fprintf(fp, "${SHELL:-/bin/sh} << `(dd if=/dev/urandom count=200 bs=1 2>/dev/null|LC_ALL=C tr -d -c '[:alnum:]')`\n\n");
+ i = random(); + i = random();
+ fprintf(fp, "${SHELL:-/bin/sh} << marcinDELIMITER%x\nmarcinDELIMITER%x\n", i,i); + fprintf(fp, "${SHELL:-/bin/sh} << marcinDELIMITER%08lx\n", i);
istty = isatty(fileno(stdin)); istty = isatty(fileno(stdin));
if (istty) { if (istty) {
@@ -473,6 +476,7 @@ writefile(time_t runtimer, char queue)
fprintf(stderr, "<EOT>\n");
}
fprintf(fp, "\n");
+ fprintf(fp, "marcinDELIMITER%08lx\n", i);
if (ferror(fp))
panic("Output error");

View File

@ -1,84 +0,0 @@
--- at-3.1.10/at.c.fix 2006-09-12 13:21:16.000000000 +0200
+++ at-3.1.10/at.c 2006-09-12 13:20:08.000000000 +0200
@@ -396,8 +396,9 @@
unsigned int i;
for (i = 0; i < sizeof(no_export) / sizeof(no_export[0]); i++) {
export = export
- && (strncmp(*atenv, no_export[i],
- (size_t) (eqp - *atenv)) != 0);
+ && ( (((size_t) (eqp - *atenv)) != strlen(no_export[i]))
+ ||(strncmp(*atenv, no_export[i],(size_t) (eqp - *atenv)) != 0)
+ );
}
eqp++;
}
--- at-3.1.10/at.1.in.fix 2006-09-12 13:21:16.000000000 +0200
+++ at-3.1.10/at.1.in 2006-09-12 13:10:28.000000000 +0200
@@ -42,8 +42,7 @@
and
.B batch
read commands from standard input or a specified file which are to
-be executed at a later time, using
-.BR /bin/sh .
+be executed at a later time.
.TP 8
.BR at
executes commands at a specified time.
@@ -244,8 +243,56 @@
option argument, which must have the same format as specified for the
.BR touch(1)
utility's
-.B -t
+.B \-t
time option argument ([[CC]YY]MMDDhhmm).
+.SH ENVIRONMENT
+.P
+.TP 8
+.B SHELL
+The value of the SHELL environment variable at the time of
+.B at
+invocation will determine which shell is used to execute the
+.B at
+job commands. If SHELL is unset when
+.B at
+is invoked, the user's login shell will be used; otherwise,
+if SHELL is set when
+.B at
+is invoked, it must contain the path of a shell interpreter
+executable that will be used to run the commands at the specified time.
+.P
+.B at
+will record the values of
+environment variables present at time of
+.B at
+invocation. When the commands are run at the specified time,
+.B at
+will restore these variables to their recorded values .
+These variables are excluded from this processing and are never
+set by
+.B at
+when the commands are run :
+.br
+.BI TERM,
+.BI DISPLAY,
+.BI SHELLOPTS,
+.BI _,
+.BI PPID,
+.BI BASH_VERSINFO,
+.BI EUID,
+.BI UID,
+.BI GROUPS.
+.br
+If the user submitting the
+.B at
+job is not the super-user, variables that alter the behaviour of the
+loader
+.BR ld.so(8),
+such as
+.B LD_LIBRARY_PATH
+, cannot be recorded and restored by
+.B at .
+.P
.SH FILES
.I @ATJBD@
.br

View File

@ -5,8 +5,8 @@
+# +#
+# +#
+auth sufficient pam_rootok.so +auth sufficient pam_rootok.so
+auth include system-auth
+auth required pam_env.so +auth required pam_env.so
+auth include system-auth
+account include system-auth +account include system-auth
+session required pam_loginuid.so +session required pam_loginuid.so
+session include system-auth +session include system-auth
@ -336,7 +336,7 @@ diff -up at-3.1.10/atd.c.pam at-3.1.10/atd.c
+ if (selinux_enabled>0) + if (selinux_enabled>0)
+ if (setexeccon(NULL) < 0) + if (setexeccon(NULL) < 0)
+ if (security_getenforce()==1) + if (security_getenforce()==1)
+ perr("Could not resset exec context for user %s\n", pentry->pw_name); + perr("Could not reset exec context for user %s\n", pentry->pw_name);
#endif #endif
- perr("Exec failed for mail command"); - perr("Exec failed for mail command");

View File

@ -1,13 +0,0 @@
diff -up at-3.1.10/pam_atd.pamkeyring at-3.1.10/pam_atd
--- at-3.1.10/pam_atd.pamkeyring 2008-07-18 16:15:07.000000000 +0200
+++ at-3.1.10/pam_atd 2008-07-18 16:16:48.000000000 +0200
@@ -2,8 +2,8 @@
#
#
auth sufficient pam_rootok.so
-auth include system-auth
auth required pam_env.so
+auth include system-auth
account include system-auth
session required pam_loginuid.so
session include system-auth

View File

@ -1,27 +0,0 @@
--- at-3.1.10/Makefile.in.pie 2006-09-12 08:28:13.000000000 +0200
+++ at-3.1.10/Makefile.in 2006-09-12 08:30:47.000000000 +0200
@@ -69,13 +69,13 @@
all: at atd atrun
at: $(ATOBJECTS)
- $(CC) $(CFLAGS) -o at $(ATOBJECTS) $(LIBS) $(LEXLIB)
+ $(CC) $(CFLAGS) -o at -pie $(ATOBJECTS) $(LIBS) $(LEXLIB)
rm -f $(CLONES)
$(LN_S) -f at atq
$(LN_S) -f at atrm
atd: $(RUNOBJECTS)
- $(CC) $(CFLAGS) -o atd $(RUNOBJECTS) $(LIBS) $(PAMLIB)
+ $(CC) $(CFLAGS) -o atd -pie $(RUNOBJECTS) $(LIBS) $(PAMLIB)
y.tab.c y.tab.h: parsetime.y
$(YACC) -d parsetime.y
@@ -87,7 +87,7 @@
configure
.c.o:
- $(CC) -c $(CFLAGS) $(DEFS) $*.c
+ $(CC) -c $(CFLAGS) -fpie $(DEFS) $*.c
install: all
$(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)

View File

@ -1,12 +0,0 @@
--- at-3.1.10/panic.c.usage 2006-09-07 13:21:23.000000000 +0200
+++ at-3.1.10/panic.c 2006-09-07 13:24:00.000000000 +0200
@@ -92,7 +92,8 @@
/* Print usage and exit.
*/
fprintf(stderr, "Usage: at [-V] [-q x] [-f file] [-mldbv] time\n"
- " at -c job ...\n"
+ " at [-V] [-q x] [-f file] [-m] -t [[CC]YY]MMDDhhmm\n"
+ " at -c job [job...]\n"
" atq [-V] [-q x]\n"
" atrm [-V] job ...\n"
" batch\n");

View File

@ -1,894 +0,0 @@
diff -u at-3.1.8-orig/parsetime.l at-3.1.8/parsetime.l
--- at-3.1.8-orig/parsetime.l Sun Sep 28 13:26:30 1997
+++ at-3.1.8/parsetime.l Sat Jan 26 14:18:10 2002
@@ -32,7 +32,6 @@
} while(0)
%}
-WORD [a-z][a-z0-9]+
%%
now { COPY_TOK ; return NOW; }
@@ -57,6 +56,7 @@
day(s)? { COPY_TOK ; return DAY; }
week(s)? { COPY_TOK ; return WEEK; }
month(s)? { COPY_TOK ; return MONTH; }
+year(s)? { COPY_TOK ; return YEAR; }
jan(uary)? { COPY_TOK ; return JAN; }
feb(ruary)? { COPY_TOK ; return FEB; }
mar(ch)? { COPY_TOK ; return MAR; }
@@ -69,9 +69,16 @@
oct(ober)? { COPY_TOK ; return OCT; }
nov(ember)? { COPY_TOK ; return NOV; }
dec(ember)? { COPY_TOK ; return DEC; }
+utc { COPY_TOK ; return UTC; }
+[0-9]{1} { COPY_TOK ; COPY_VAL; return INT1DIGIT; }
+[0-9]{2} { COPY_TOK ; COPY_VAL; return INT2DIGIT; }
+[0-9]{4} { COPY_TOK ; COPY_VAL; return INT4DIGIT; }
+[0-9]{5,8} { COPY_TOK ; COPY_VAL; return INT5_8DIGIT; }
[0-9]+ { COPY_TOK ; COPY_VAL; return INT; }
+[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{2}([0-9]{2})? { COPY_TOK ; COPY_VAL; return DOTTEDDATE; }
+[0-9]{2}([0-9]{2})?-[0-9]{1,2}-[0-9]{1,2} { COPY_TOK ; COPY_VAL; return HYPHENDATE; }
+[012]?[0-9][:'h,.][0-9]{2} { COPY_TOK ; COPY_VAL; return HOURMIN; }
[ \t\n] ;
-{WORD} { COPY_TOK ; COPY_VAL; return WORD; }
. { COPY_TOK ; return yytext[0]; }
%%
diff -u at-3.1.8-orig/parsetime.y at-3.1.8/parsetime.y
--- at-3.1.8-orig/parsetime.y Thu Jan 17 22:15:27 2002
+++ at-3.1.8/parsetime.y Sat Jan 26 14:25:25 2002
@@ -22,6 +22,13 @@
int intval;
}
+%token <charval> DOTTEDDATE
+%token <charval> HYPHENDATE
+%token <charval> HOURMIN
+%token <charval> INT1DIGIT
+%token <charval> INT2DIGIT
+%token <charval> INT4DIGIT
+%token <charval> INT5_8DIGIT
%token <charval> INT
%token NOW
%token AM PM
@@ -31,48 +38,61 @@
%token NEXT
%token MINUTE HOUR DAY WEEK MONTH YEAR
%token JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
-%token <charval> WORD
+%token UTC
-%type <intval> inc_period
-%type <intval> inc_number
+%type <charval> concatenated_date
+%type <charval> hr24clock_hr_min
+%type <charval> int1_2digit
+%type <charval> int2_or_4digit
+%type <charval> integer
+%type <intval> inc_dec_period
+%type <intval> inc_dec_number
%type <intval> day_of_week
%start timespec
%%
-timespec : date
+timespec : spec_base
+ | spec_base inc_or_dec
+ {
+ time_only = 0;
+
+ }
+ ;
+
+spec_base : date
| time
{
time_only = 1;
}
| time date
- | time_or_not inc_or_dec
- | time_or_not date inc_or_dec
- | nowspec
- ;
+ | NOW
+ ;
-nowspec : now
- | now inc_or_dec
+time : time_base
+ | time_base timezone_name
;
-now : NOW
- | TOMORROW
- {
- add_date(1, DAY);
- }
- ;
-
-time_or_not : time
- |
+time_base : hr24clock_hr_min
+ {
+ exectm.tm_min = -1;
+ exectm.tm_hour = -1;
+ sscanf($1, "%2d %2d", &exectm.tm_hour,
+ &exectm.tm_min);
+ free($1);
-time : hr24clock_hr_min
- | hr24clock_hr_min timezone_name
- | hr24clock_hour time_sep minute
- | hr24clock_hour time_sep minute timezone_name
- | hr24clock_hour am_pm
- | hr24clock_hour am_pm timezone_name
- | hr24clock_hour time_sep minute am_pm
- | hr24clock_hour time_sep minute am_pm timezone_name
- | NOON
+ if (exectm.tm_min > 60 || exectm.tm_min < 0) {
+ yyerror("Problem in minutes specification");
+ YYERROR;
+ }
+ if (exectm.tm_hour > 24 || exectm.tm_hour < 0) {
+ yyerror("Problem in hours specification");
+ YYERROR;
+ }
+ }
+ | time_hour am_pm
+ | time_hour_min
+ | time_hour_min am_pm
+ | NOON
{
exectm.tm_hour = 12;
exectm.tm_min = 0;
@@ -81,128 +101,23 @@
{
exectm.tm_hour = 0;
exectm.tm_min = 0;
- add_date(1, DAY);
}
| TEATIME
{
exectm.tm_hour = 16;
exectm.tm_min = 0;
}
- ;
-
-date : month_name day_number
- | month_name day_number year_number
- | month_name day_number ',' year_number
- | day_of_week
- {
- add_date ((6 + $1 - exectm.tm_wday) %7 + 1, DAY);
- }
- | TODAY
- | TOMORROW
- {
- add_date(1, DAY);
- }
- | year_number '-' month_number '-' day_number
- | day_number '.' month_number '.' year_number
- | day_number '.' month_number
- | day_number month_name
- | day_number month_name year_number
- | month_number '/' day_number '/' year_number
- ;
-
-inc_or_dec : increment
- | decrement
-
-increment : '+' inc_number inc_period
- {
- add_date($2, $3);
- }
- | NEXT inc_period
- {
- add_date(1, $2);
- }
- | NEXT day_of_week
- {
- add_date ((6 + $2 - exectm.tm_wday) %7 +1, DAY);
- }
- ;
-
-decrement : '-' inc_number inc_period
- {
- add_date(-$2, $3);
- }
;
-inc_period : MINUTE { $$ = MINUTE ; }
- | HOUR { $$ = HOUR ; }
- | DAY { $$ = DAY ; }
- | WEEK { $$ = WEEK ; }
- | MONTH { $$ = MONTH ; }
- | YEAR { $$ = YEAR ; }
- ;
+hr24clock_hr_min: INT4DIGIT
+ ;
-hr24clock_hr_min: INT
+time_hour : int1_2digit
{
- if (strlen($1) == 4) {
- exectm.tm_min = -1;
- exectm.tm_hour = -1;
- sscanf($1, "%2d %2d", &exectm.tm_hour,
- &exectm.tm_min);
- } else if (strlen($1) >= 5 && strlen($1) <= 8) {
- /* Ok, this is a kluge. I hate design errors... -Joey */
- char shallot[5];
- char *onion;
-
- onion=$1;
- memset (shallot, 0, sizeof (shallot));
- if (strlen($1) == 5 || strlen($1) == 7) {
- strncpy (shallot,onion,1);
- onion++;
- } else {
- strncpy (shallot,onion,2);
- onion+=2;
- }
- sscanf(shallot, "%d", &exectm.tm_mon);
-
- if (exectm.tm_mon < 1 || exectm.tm_mon > 12) {
- yyerror("Error in month number");
- YYERROR;
- }
- exectm.tm_mon--;
-
- memset (shallot, 0, sizeof (shallot));
- strncpy (shallot,onion,2);
- sscanf(shallot, "%d", &exectm.tm_mday);
- if (exectm.tm_mday < 0 || exectm.tm_mday > 31)
- {
- yyerror("Error in day of month");
- YYERROR;
- }
-
- onion+=2;
- memset (shallot, 0, sizeof (shallot));
- strncpy (shallot,onion,4);
- if ( sscanf(shallot, "%d", &exectm.tm_year) != 1) {
- yyerror("Error in year");
- YYERROR;
- }
- if (exectm.tm_year < 70) {
- exectm.tm_year += 100;
- }
- else if (exectm.tm_year > 1900) {
- exectm.tm_year -= 1900;
- }
- }
- else {
- sscanf($1, "%d", &exectm.tm_hour);
- exectm.tm_min = 0;
- }
+ sscanf($1, "%d", &exectm.tm_hour);
+ exectm.tm_min = 0;
free($1);
- if (exectm.tm_min > 60 || exectm.tm_min < 0) {
- yyerror("Problem in minutes specification");
- YYERROR;
- }
if (exectm.tm_hour > 24 || exectm.tm_hour < 0) {
yyerror("Problem in hours specification");
YYERROR;
@@ -210,29 +125,22 @@
}
;
-timezone_name : WORD
+time_hour_min : HOURMIN
{
- if (strcasecmp($1,"utc") == 0) {
- isgmt = 1;
- }
- else {
- yyerror("Only UTC timezone is supported");
- YYERROR;
- }
+ exectm.tm_min = -1;
+ exectm.tm_hour = -1;
+ sscanf($1, "%d %*c %d", &exectm.tm_hour,
+ &exectm.tm_min);
free($1);
- }
- ;
-
-hr24clock_hour : hr24clock_hr_min
- ;
-minute : INT
- {
- if (sscanf($1, "%d", &exectm.tm_min) != 1) {
- yyerror("Error in minute");
+ if (exectm.tm_min > 60 || exectm.tm_min < 0) {
+ yyerror("Problem in minutes specification");
+ YYERROR;
+ }
+ if (exectm.tm_hour > 24 || exectm.tm_hour < 0) {
+ yyerror("Problem in hours specification");
YYERROR;
}
- free($1);
}
;
@@ -258,6 +166,171 @@
}
;
+timezone_name : UTC
+ {
+ isgmt = 1;
+ }
+ ;
+
+date : month_name day_number
+ | month_name day_number year_number
+ | month_name day_number ',' year_number
+ | day_of_week
+ {
+ add_date ((6 + $1 - exectm.tm_wday) %7 + 1, DAY);
+ }
+ | TODAY
+ | TOMORROW
+ {
+ add_date(1, DAY);
+ }
+ | HYPHENDATE
+ {
+ int ynum = -1;
+ int mnum = -1;
+ int dnum = -1;
+
+ if (sscanf($1, "%d %*c %d %*c %d", &ynum, &mnum, &dnum) != 3) {
+ yyerror("Error in hypenated date");
+ YYERROR;
+ }
+
+ if (mnum < 1 || mnum > 12) {
+ yyerror("Error in month number");
+ YYERROR;
+ }
+ exectm.tm_mon = mnum -1;
+
+ if (ynum < 70) {
+ ynum += 100;
+ }
+ else if (ynum > 1900) {
+ ynum -= 1900;
+ }
+ exectm.tm_year = ynum ;
+
+ if ( dnum < 0
+ || ((mnum == 1 || mnum == 3 || mnum == 5 ||
+ mnum == 7 || mnum == 8 || mnum == 10 ||
+ mnum == 12) && dnum > 31)
+ || ((mnum == 4 || mnum == 6 || mnum == 9 ||
+ mnum == 11) && dnum > 30)
+ || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
+ || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
+ )
+ {
+ yyerror("Error in day of month");
+ YYERROR;
+ }
+ exectm.tm_mday = dnum;
+
+ free($1);
+ }
+ | DOTTEDDATE
+ {
+ int ynum = -1;
+ int mnum = -1;
+ int dnum = -1;
+
+ if (sscanf($1, "%d %*c %d %*c %d", &dnum, &mnum, &ynum) != 3) {
+ yyerror("Error in dotted date");
+ YYERROR;
+ }
+
+ if (mnum < 1 || mnum > 12) {
+ yyerror("Error in month number");
+ YYERROR;
+ }
+ exectm.tm_mon = mnum -1;
+
+ if (ynum < 70) {
+ ynum += 100;
+ }
+ else if (ynum > 1900) {
+ ynum -= 1900;
+ }
+ exectm.tm_year = ynum ;
+
+ if ( dnum < 0
+ || ((mnum == 1 || mnum == 3 || mnum == 5 ||
+ mnum == 7 || mnum == 8 || mnum == 10 ||
+ mnum == 12) && dnum > 31)
+ || ((mnum == 4 || mnum == 6 || mnum == 9 ||
+ mnum == 11) && dnum > 30)
+ || (mnum == 2 && dnum > 29 && __isleap(ynum+1900))
+ || (mnum == 2 && dnum > 28 && !__isleap(ynum+1900))
+ )
+ {
+ yyerror("Error in day of month");
+ YYERROR;
+ }
+ exectm.tm_mday = dnum;
+
+ free($1);
+ }
+ | day_number month_name
+ | day_number month_name year_number
+ | month_number '/' day_number '/' year_number
+ | concatenated_date
+ {
+ /* Ok, this is a kluge. I hate design errors... -Joey */
+ char shallot[5];
+ char *onion;
+
+ onion=$1;
+ memset (shallot, 0, sizeof (shallot));
+ if (strlen($1) == 5 || strlen($1) == 7) {
+ strncpy (shallot,onion,1);
+ onion++;
+ } else {
+ strncpy (shallot,onion,2);
+ onion+=2;
+ }
+ sscanf(shallot, "%d", &exectm.tm_mon);
+
+ if (exectm.tm_mon < 1 || exectm.tm_mon > 12) {
+ yyerror("Error in month number");
+ YYERROR;
+ }
+ exectm.tm_mon--;
+
+ memset (shallot, 0, sizeof (shallot));
+ strncpy (shallot,onion,2);
+ sscanf(shallot, "%d", &exectm.tm_mday);
+ if (exectm.tm_mday < 0 || exectm.tm_mday > 31)
+ {
+ yyerror("Error in day of month");
+ YYERROR;
+ }
+
+ onion+=2;
+ memset (shallot, 0, sizeof (shallot));
+ strncpy (shallot,onion,4);
+ if ( sscanf(shallot, "%d", &exectm.tm_year) != 1) {
+ yyerror("Error in year");
+ YYERROR;
+ }
+ if (exectm.tm_year < 70) {
+ exectm.tm_year += 100;
+ }
+ else if (exectm.tm_year > 1900) {
+ exectm.tm_year -= 1900;
+ }
+
+ free ($1);
+ }
+ | NEXT inc_dec_period
+ {
+ add_date(1, $2);
+ }
+ | NEXT day_of_week
+ {
+ add_date ((6 + $2 - exectm.tm_wday) %7 +1, DAY);
+ }
+ ;
+
+concatenated_date: INT5_8DIGIT
+ ;
month_name : JAN { exectm.tm_mon = 0; }
| FEB { exectm.tm_mon = 1; }
@@ -273,7 +346,7 @@
| DEC { exectm.tm_mon =11; }
;
-month_number : INT
+month_number : int1_2digit
{
{
int mnum = -1;
@@ -287,7 +360,9 @@
free($1);
}
}
-day_number : INT
+ ;
+
+day_number : int1_2digit
{
exectm.tm_mday = -1;
sscanf($1, "%d", &exectm.tm_mday);
@@ -300,7 +375,7 @@
}
;
-year_number : INT
+year_number : int2_or_4digit
{
{
int ynum;
@@ -322,7 +397,6 @@
}
;
-
day_of_week : SUN { $$ = 0; }
| MON { $$ = 1; }
| TUE { $$ = 2; }
@@ -332,7 +406,23 @@
| SAT { $$ = 6; }
;
-inc_number : INT
+inc_or_dec : increment
+ | decrement
+ ;
+
+increment : '+' inc_dec_number inc_dec_period
+ {
+ add_date($2, $3);
+ }
+ ;
+
+decrement : '-' inc_dec_number inc_dec_period
+ {
+ add_date(-$2, $3);
+ }
+ ;
+
+inc_dec_number : integer
{
if (sscanf($1, "%d", &$$) != 1) {
yyerror("Unknown increment");
@@ -342,11 +432,27 @@
}
;
-time_sep : ':'
- | '\''
- | '.'
- | 'h'
- | ','
+inc_dec_period : MINUTE { $$ = MINUTE ; }
+ | HOUR { $$ = HOUR ; }
+ | DAY { $$ = DAY ; }
+ | WEEK { $$ = WEEK ; }
+ | MONTH { $$ = MONTH ; }
+ | YEAR { $$ = YEAR ; }
+ ;
+
+int1_2digit : INT1DIGIT
+ | INT2DIGIT
+ ;
+
+int2_or_4digit : INT2DIGIT
+ | INT4DIGIT
+ ;
+
+integer : INT
+ | INT1DIGIT
+ | INT2DIGIT
+ | INT4DIGIT
+ | INT5_8DIGIT
;
%%
@@ -370,10 +476,7 @@
if (exectime == (time_t)-1)
return 0;
if (isgmt) {
- exectime += timezone;
- if (daylight) {
- exectime -= 3600;
- }
+ exectime -= timezone;
}
if (time_only && (currtime > exectime)) {
exectime += 24*3600;
@@ -386,39 +489,29 @@
}
#ifdef TEST_PARSER
-/*
-
-Here are some lines to test:
-
-./parsetest 7AM Mar 24 2000
-./parsetest 7AM Mar 24 00
-./parsetest 7AM 032400
-./parsetest 7AM 03/24/00
-./parsetest 7AM 24.03.00
-./parsetest 7AM Mar 24
-
-./parsetest 03242000
-./parsetest noon 03242000
-./parsetest 5:30
-./parsetest 4pm + 3 days
-./parsetest 10am Jul 31
-
- */
+
int
main(int argc, char **argv)
{
+ int retval = 1;
time_t res;
res = parsetime(argc-1, &argv[1]);
+ if (time_only) {
+ fprintf(stderr, "time_only = 1\n");
+ }
if (res > 0) {
printf("%s",ctime(&res));
+ retval = 0;
}
else {
printf("Ooops...\n");
+ retval = 1;
}
- return 0;
+ return retval;
}
#endif
+
int yyerror(char *s)
{
if (last_token == NULL)
@@ -430,12 +523,36 @@
void
add_seconds(struct tm *tm, long numsec)
{
+ struct tm basetm = *tm;
time_t timeval;
+
timeval = mktime(tm);
if (timeval == (time_t)-1)
timeval = (time_t)0;
timeval += numsec;
*tm = *localtime(&timeval);
+
+ /*
+ * Adjust +-1 hour when moving in or out of DST
+ */
+
+ if (daylight > 0) /* Only check if DST is used here */
+ {
+ /* Set tm_isdst on &basetm and tm */
+ (void) mktime(&basetm);
+ (void) mktime(tm);
+
+ if (basetm.tm_isdst > 0 && tm->tm_isdst < 1)
+ { /* DST to no DST */
+ timeval += 3600l;
+ *tm = *localtime(&timeval);
+ }
+ else if (basetm.tm_isdst < 1 && tm->tm_isdst > 0)
+ { /* no DST to DST */
+ timeval -= 3600l;
+ *tm = *localtime(&timeval);
+ }
+ }
}
int
@@ -468,6 +585,10 @@
}
exectm.tm_mon = newmonth % 12;
number += newmonth / 12 ;
+
+ /* Recalculate tm_isdst so we don't get a +-1 hour creep */
+ exectm.tm_isdst = -1;
+ (void) mktime(&exectm);
}
if (number == 0) {
break;
@@ -476,6 +597,9 @@
case YEAR:
exectm.tm_year += number;
+ /* Recalculate tm_isdst so we don't get a +-1 hour creep */
+ exectm.tm_isdst = -1;
+ (void) mktime(&exectm);
break;
default:
@@ -483,5 +607,6 @@
fprintf(stderr,"Unexpected case %d\n", period);
abort();
}
+
return 0;
}
diff -u at-3.1.8-orig/timespec at-3.1.8/timespec
--- at-3.1.8-orig/timespec Wed Mar 12 12:11:05 1997
+++ at-3.1.8/timespec Sat Jan 26 14:18:10 2002
@@ -2,6 +2,13 @@
* Abbreviated version of the yacc grammar used by at(1).
*/
+%token <charval> DOTTEDDATE
+%token <charval> HYPHENDATE
+%token <charval> HOURMIN
+%token <charval> INT1DIGIT
+%token <charval> INT2DIGIT
+%token <charval> INT4DIGIT
+%token <charval> INT5_8DIGIT
%token <charval> INT
%token NOW
%token AM PM
@@ -11,100 +18,115 @@
%token NEXT
%token MINUTE HOUR DAY WEEK MONTH YEAR
%token JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
-%token <charval> WORD
+%token UTC
-%type <intval> inc_period
-%type <intval> inc_number
+%type <charval> concatenated_date
+%type <charval> hr24clock_hr_min
+%type <charval> int1_2digit
+%type <charval> int2_or_4digit
+%type <charval> integer
+%type <intval> inc_dec_period
+%type <intval> inc_dec_number
%type <intval> day_of_week
%start timespec
%%
-timespec : time
- | time date
- | time increment
- | time date increment
- | time decrement
- | time date decrement
- | nowspec
- ;
-
-nowspec : now
- | now increment
- | now decrement
+timespec : spec_base
+ | spec_base inc_or_dec
;
-now : NOW
+spec_base : date
+ | time
+ | time date
+ | NOW
;
-time : hr24clock_hr_min
- | hr24clock_hr_min timezone_name
- | hr24clock_hour time_sep minute
- | hr24clock_hour time_sep minute timezone_name
- | hr24clock_hour am_pm
- | hr24clock_hour am_pm timezone_name
- | hr24clock_hour time_sep minute am_pm
- | hr24clock_hour time_sep minute am_pm timezone_name
- | NOON
+time : time_base
+ | time_base timezone_name
+ ;
+
+time_base : hr24clock_hr_min
+ | time_hour am_pm
+ | time_hour_min
+ | time_hour_min am_pm
+ | NOON
| MIDNIGHT
| TEATIME
- ;
+ ;
+
+hr24clock_hr_min: INT4DIGIT
+ ;
+
+time_hour : int1_2digit
+ ;
+
+time_hour_min : HOURMIN
+ ;
+
+am_pm : AM
+ | PM
+ ;
+
+timezone_name : UTC
+ ;
date : month_name day_number
+ | month_name day_number year_number
| month_name day_number ',' year_number
| day_of_week
| TODAY
| TOMORROW
- | year_number '-' month_number '-' day_number
- | day_number '.' month_number '.' year_number
- | day_number '.' month_number
+ | HYPHENDATE
+ | DOTTEDDATE
| day_number month_name
| day_number month_name year_number
| month_number '/' day_number '/' year_number
- ;
-
-increment : '+' inc_number inc_period
- | NEXT inc_period
+ | concatenated_date
+ | NEXT inc_dec_period
| NEXT day_of_week
;
-decrement : '-' inc_number inc_period
+concatenated_date: INT5_8DIGIT
;
-inc_period : MINUTE | HOUR | DAY | WEEK | MONTH | YEAR
+month_name : JAN | FEB | MAR | APR | MAY | JUN
+ | JUL | AUG | SEP | OCT | NOV | DEC
;
-hr24clock_hr_min: INT
+month_number : int1_2digit
;
-timezone_name : WORD
+day_number : int1_2digit
;
-hr24clock_hour : hr24clock_hr_min
+year_number : int2_or_4digit
;
-minute : INT
+day_of_week : SUN | MON | TUE | WED | THU | FRI | SAT
;
-am_pm : AM | PM
+inc_or_dec : increment | decrement
;
-month_name : JAN | FEB | MAR | APR | MAY | JUN | JUL
- | AUG | SEP | OCT | NOV | DEC
- ;
+increment : '+' inc_dec_number inc_dec_period
+ ;
-month_number : INT
+decrement : '-' inc_dec_number inc_dec_period
;
-day_number : INT
+
+inc_dec_number : integer
;
-year_number : INT
+inc_dec_period : MINUTE | HOUR | DAY | WEEK | MONTH | YEAR
;
-day_of_week : SUN | MON | TUE | WED | THU | FRI | SAT
+int1_2digit : INT1DIGIT | INT2DIGIT
;
-inc_number : INT
+int2_or_4digit : INT2DIGIT | INT4DIGIT
;
-time_sep : ':' | '\'' | '.' | 'h' | ','
+integer : INT | INT1DIGIT | INT2DIGIT | INT4DIGIT | INT5_8DIGIT
;
+
+%%

View File

@ -1,67 +0,0 @@
--- at-3.1.8/daemon.c.dontfork 2002-01-18 05:15:27.000000000 +0100
+++ at-3.1.8/daemon.c 2006-08-23 12:13:11.000000000 +0200
@@ -50,7 +50,8 @@
static char rcsid[] = "$Id: daemon.c,v 1.9 1996/08/12 08:23:55 ig25 Exp $";
-int daemon_debug;
+int daemon_debug = 0;
+int daemon_nofork = 0;
static int
lock_fd(int fd)
@@ -119,15 +120,18 @@
(open("/dev/null", O_RDWR) != 2)) {
perr("Error redirecting I/O");
}
+ }
+ if (daemon_nofork) pid = getpid();
+ else {
pid = fork();
if (pid == -1) {
perr("Cannot fork");
} else if (pid != 0) {
exit(0);
}
+ (void) setsid();
}
old_umask = umask(S_IWGRP | S_IWOTH);
- (void) setsid();
PRIV_START
--- at-3.1.8/atd.8.in.dontfork 2002-01-18 08:41:03.000000000 +0100
+++ at-3.1.8/atd.8.in 2006-08-23 12:18:38.000000000 +0200
@@ -1,5 +1,5 @@
.Id $Id: atd.8.in,v 1.6 1997/09/28 20:00:26 ig25 Exp $
-.TH ATD 8 "Mar 1997" local "Linux Programmer's Manual"
+.TH ATD "8" "Mar 1997" "at-3.1.8" "Linux Programmer's Manual"
.SH NAME
atd \- run jobs queued for later execution
.SH SYNOPSIS
@@ -10,6 +10,7 @@
.IR batch_interval ]
.RB [ -d ]
.RB [ -s ]
+.RB [ -n ]
.SH DESCRIPTION
.B atd
runs jobs queued by
@@ -46,6 +47,9 @@
is installed as
.B @prefix@/sbin/atrun
for backward compatibility.
+.TP 8
+.B -n
+Don't fork option.
.SH WARNING
.B atd
won't work if its spool directory is mounted via NFS even if
--- at-3.1.8/daemon.h.dontfork 1997-05-06 10:28:18.000000000 +0200
+++ at-3.1.8/daemon.h 2006-08-23 12:14:10.000000000 +0200
@@ -14,3 +14,5 @@
perr (const char *fmt, ...);
extern int daemon_debug;
+extern int daemon_nofork;
+

View File

@ -1,58 +0,0 @@
--- at-3.1.8/Makefile.in.noroot Fri Jun 9 11:45:52 2000
+++ at-3.1.8/Makefile.in Fri Jun 9 11:46:39 2000
@@ -87,11 +87,11 @@
$(CC) -c $(CFLAGS) $(DEFS) $*.c
install: all
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(etcdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(bindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 -d $(IROOT)$(docdir)
+ $(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
$(INSTALL) -m 755 -d $(IROOT)$(ATJOB_DIR)
$(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR)
chmod 700 $(IROOT)$(ATJOB_DIR) $(IROOT)$(ATSPOOL_DIR)
@@ -99,25 +99,25 @@
touch $(IROOT)$(LFILE)
chmod 600 $(IROOT)$(LFILE)
chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(LFILE)
- test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -o root -m 600 at.deny $(IROOT)$(etcdir)/
- $(INSTALL) -g root -o root -m 4755 -s at $(IROOT)$(bindir)
+ test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(IROOT)$(etcdir)/
+ $(INSTALL) -m 4755 -s at $(IROOT)$(bindir)
$(LN_S) -f at $(IROOT)$(bindir)/atq
$(LN_S) -f at $(IROOT)$(bindir)/atrm
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)
- $(INSTALL) -g root -o root -m 755 -s atd $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 atrun $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 644 at.1 $(IROOT)$(man1dir)/
+ $(INSTALL) -m 755 batch $(IROOT)$(bindir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man1dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man5dir)
+ $(INSTALL) -d -m 755 $(IROOT)$(man8dir)
+ $(INSTALL) -m 755 -s atd $(IROOT)$(sbindir)
+ $(INSTALL) -m 755 atrun $(IROOT)$(sbindir)
+ $(INSTALL) -m 644 at.1 $(IROOT)$(man1dir)/
cd $(IROOT)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
- $(INSTALL) -g root -o root -m 644 atd.8 $(IROOT)$(man8dir)/
+ $(INSTALL) -m 644 atd.8 $(IROOT)$(man8dir)/
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
- $(INSTALL) -g root -o root -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
+ $(INSTALL) -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
rm -f tmpman
- $(INSTALL) -g root -o root -m 644 at_allow.5 $(IROOT)$(man5dir)/
+ $(INSTALL) -m 644 at_allow.5 $(IROOT)$(man5dir)/
cd $(IROOT)$(man5dir) && $(LN_S) -f at_allow.5 at_deny.5
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(IROOT)$(atdocdir)
+ $(INSTALL) -m 644 $(DOCS) $(IROOT)$(atdocdir)
rm -f $(IROOT)$(mandir)/cat1/at.1* $(IROOT)$(mandir)/cat1/batch.1* \
$(IROOT)$(mandir)/cat1/atq.1*
rm -f $(IROOT)$(mandir)/cat1/atd.8*

22
at.spec
View File

@ -6,7 +6,7 @@
Summary: Job spooling tools Summary: Job spooling tools
Name: at Name: at
Version: 3.1.10 Version: 3.1.10
Release: 30%{?dist} Release: 33%{?dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://ftp.debian.org/debian/pool/main/a/at URL: http://ftp.debian.org/debian/pool/main/a/at
@ -29,11 +29,12 @@ Patch10: at-3.1.10-perm.patch
Patch11: at-3.1.10-opt_V.patch Patch11: at-3.1.10-opt_V.patch
Patch12: at-3.1.10-session.patch Patch12: at-3.1.10-session.patch
Patch13: at-3.1.10-havepam.patch Patch13: at-3.1.10-havepam.patch
Patch14: at-3.1.10-pam_keyring.patch # included in another pam patch
#Patch14: at-3.1.10-pam_keyring.patch
Patch15: at-3.1.10-PIE.patch Patch15: at-3.1.10-PIE.patch
Patch16: at-3.1.10-pamfix.patch Patch16: at-3.1.10-pamfix.patch
Patch17: nonposix.patch Patch17: at-3.1.10-nonposix.patch
Patch18: selinux_mail.patch Patch18: at-3.1.10-selinux_mail.patch
Patch19: at-3.1.10-man_hyphen.patch Patch19: at-3.1.10-man_hyphen.patch
Patch20: at-3.1.10-different_shell.patch Patch20: at-3.1.10-different_shell.patch
@ -84,7 +85,7 @@ cp %{SOURCE1} .
%patch11 -p1 -b .opt_V %patch11 -p1 -b .opt_V
%patch12 -p1 -b .session %patch12 -p1 -b .session
%patch13 -p1 -b .havepam %patch13 -p1 -b .havepam
%patch14 -p1 -b .pamkeyring ##%patch14 -p1 -b .pamkeyring
%patch15 -p1 -b .PIE %patch15 -p1 -b .PIE
%patch16 -p1 -b .pamfix %patch16 -p1 -b .pamfix
%patch17 -p1 -b .nonposix %patch17 -p1 -b .nonposix
@ -166,7 +167,7 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ
/sbin/chkconfig --add atd /sbin/chkconfig --add atd
%preun %preun
if [ "$1" = 0 ] ; then if [ "$1" = "0" ] ; then
/sbin/service atd stop >/dev/null 2>&1 ||: /sbin/service atd stop >/dev/null 2>&1 ||:
/sbin/chkconfig --del atd /sbin/chkconfig --del atd
fi fi
@ -196,6 +197,15 @@ fi
%attr(0755,root,root) %{_libdir}/pm-utils/sleep.d/56atd %attr(0755,root,root) %{_libdir}/pm-utils/sleep.d/56atd
%changelog %changelog
* Mon Jun 1 2009 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-33
- clean cvs, check patches
* Wed Mar 18 2009 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-32
- add the forgotten add delimiter thanks to Cong Ma
* Thu Feb 26 2009 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-31
- preun script is sometimes failing. Add apostrofs around zero.
* Thu Feb 26 2009 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-30 * Thu Feb 26 2009 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-30
- 435765 and 486844 in some cases could be used bash for at commands - 435765 and 486844 in some cases could be used bash for at commands
even if user sets different default shell. Also bash4.0 fix Here Documents even if user sets different default shell. Also bash4.0 fix Here Documents

View File

@ -1,2 +1,5 @@
6e5857e23b3c32ea6995fb7f8989987e at_3.1.10.tar.gz 6e5857e23b3c32ea6995fb7f8989987e at_3.1.10.tar.gz
053188856f8d971c6239ed973cb85794 56atd 053188856f8d971c6239ed973cb85794 56atd
b117781fd68e393443b2a8e478c7c22f atd.init
ac1471fe22f63f666dc7d31173f47ea0 atd.sysconf
67aece5997fbe1f93072e0afd69e5280 test.pl