From 6738b73cd67edb34bcf74dff14e84e2b6ffe46ea Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Fri, 23 Aug 1996 18:49:49 +0000 Subject: [PATCH] * kadmin.c: add newlines to "invalid date spec" msg * getdate.y: add "never" as a valid date specification git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8970 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/cli/ChangeLog | 6 ++++++ src/kadmin/cli/getdate.y | 16 +++++++++++++--- src/kadmin/cli/kadmin.c | 12 ++++++------ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/kadmin/cli/ChangeLog b/src/kadmin/cli/ChangeLog index 3756de622..8c39acb3b 100644 --- a/src/kadmin/cli/ChangeLog +++ b/src/kadmin/cli/ChangeLog @@ -1,3 +1,9 @@ +Fri Aug 23 14:47:55 1996 Barry Jaspan + + * kadmin.c: add newlines to "invalid date spec" msg + + * getdate.y: add "never" as a valid date specification + Wed Aug 21 14:10:36 1996 Barry Jaspan * kadmin.c: memset policy structures before passing them to diff --git a/src/kadmin/cli/getdate.y b/src/kadmin/cli/getdate.y index e105d19e5..459043017 100644 --- a/src/kadmin/cli/getdate.y +++ b/src/kadmin/cli/getdate.y @@ -193,7 +193,7 @@ static time_t yyRelSeconds; } %token tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT -%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST +%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST tNEVER %type tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT %type tSEC_UNIT tSNUMBER tUNUMBER tZONE @@ -203,6 +203,15 @@ static time_t yyRelSeconds; spec : /* NULL */ | spec item + | tNEVER { + yyYear = 1970; + yyMonth = 1; + yyDay = 1; + yyHour = yyMinutes = yySeconds = 0; + yyDSTmode = DSToff; + yyTimezone = 0; /* gmt */ + yyHaveDate++; + } ; item : time { @@ -466,7 +475,8 @@ static TABLE const OtherTable[] = { { "tenth", tUNUMBER, 10 }, { "eleventh", tUNUMBER, 11 }, { "twelfth", tUNUMBER, 12 }, - { "ago", tAGO, 1 }, + { "ago", tAGO, 1 }, + { "never", tNEVER, 0 }, { NULL } }; @@ -652,7 +662,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) Year += 1900; DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 29 : 28; - if (Year < EPOCH /* XXX DANGER! || Year > 1999 */ + if (Year < EPOCH || Month < 1 || Month > 12 /* Lint fluff: "conversion from long may lose accuracy" */ || Day < 1 || Day > DaysInMonth[(int)--Month]) diff --git a/src/kadmin/cli/kadmin.c b/src/kadmin/cli/kadmin.c index 1a0d9b64e..36395a659 100644 --- a/src/kadmin/cli/kadmin.c +++ b/src/kadmin/cli/kadmin.c @@ -683,7 +683,7 @@ int kadmin_parse_princ_args(argc, argv, oprinc, mask, pass, randkey, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } @@ -699,7 +699,7 @@ int kadmin_parse_princ_args(argc, argv, oprinc, mask, pass, randkey, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } @@ -715,7 +715,7 @@ int kadmin_parse_princ_args(argc, argv, oprinc, mask, pass, randkey, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } @@ -731,7 +731,7 @@ int kadmin_parse_princ_args(argc, argv, oprinc, mask, pass, randkey, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } @@ -1158,7 +1158,7 @@ int kadmin_parse_policy_args(argc, argv, policy, mask, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } @@ -1173,7 +1173,7 @@ int kadmin_parse_policy_args(argc, argv, policy, mask, caller) else { date = get_date(argv[i], NULL); if (date == (time_t)-1) { - fprintf(stderr, "Invalid date specification \"%s\".", + fprintf(stderr, "Invalid date specification \"%s\".\n", argv[i]); return -1; } -- 2.26.2