diff options
author | Richard Lowe <richlowe@richlowe.net> | 2012-09-27 16:04:13 -0400 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2012-09-27 16:04:13 -0400 |
commit | 951bafea4a4c40f620a735a1b4827188d065e18c (patch) | |
tree | b78eb6917531670a6c0374d6a113d145c43a2842 /usr/src | |
parent | 7f0270d8054f4344295bbce126e51552a0cdf010 (diff) | |
download | illumos-joyent-951bafea4a4c40f620a735a1b4827188d065e18c.tar.gz |
3206 Long(er) username crontab setup failure
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/cron/cron.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/cron/cron.h | 12 | ||||
-rw-r--r-- | usr/src/cmd/cron/funcs.c | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c index 645fdbf17a..c6277a1f52 100644 --- a/usr/src/cmd/cron/cron.c +++ b/usr/src/cmd/cron/cron.c @@ -3025,7 +3025,7 @@ logit(int cc, struct runinfo *rp, int rc) if (cc == BCHAR) (void) printf("%c CMD: %s\n", cc, next_event->cmd); (void) strftime(timebuf, sizeof (timebuf), FORMAT, localtime(&t)); - (void) printf("%c %.8s %u %c %s", + (void) printf("%c %s %u %c %s", cc, (rp->rusr)->name, rp->pid, QUE(rp->que), timebuf); if ((ret = TSTAT(rc)) != 0) (void) printf(" ts=%d", ret); diff --git a/usr/src/cmd/cron/cron.h b/usr/src/cmd/cron/cron.h index e8f7fc7013..a76016299c 100644 --- a/usr/src/cmd/cron/cron.h +++ b/usr/src/cmd/cron/cron.h @@ -26,6 +26,8 @@ #ifndef _CRON_H #define _CRON_H +#include <unistd.h> + /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ @@ -53,8 +55,11 @@ extern "C" { #define RCODE(x) (((x)>>8)&0377) #define TSTAT(x) ((x)&0377) -#define FLEN 15 -#define LLEN 9 +/* This constant must be at least sysconf(_SC_LOGIN_NAME_MAX) in size */ +#define UNAMESIZE 32 /* max chars in a user name */ + +#define FLEN UNAMESIZE +#define LLEN UNAMESIZE /* * structure used for passing messages from the at and crontab commands to cron @@ -66,8 +71,6 @@ struct message { char logname[LLEN]; }; -/* anything below here can be changed */ - #define CRONDIR "/var/spool/cron/crontabs" #define ATDIR "/var/spool/cron/atjobs" #define ACCTFILE "/var/cron/log" @@ -87,7 +90,6 @@ struct message { #define ENV_HOME "HOME=" #define CTLINESIZE 1000 /* max chars in a crontab line */ -#define UNAMESIZE 20 /* max chars in a user name */ extern int allowed(char *, char *, char *); extern int days_in_mon(int, int); diff --git a/usr/src/cmd/cron/funcs.c b/usr/src/cmd/cron/funcs.c index aa479fcbde..f907d439cb 100644 --- a/usr/src/cmd/cron/funcs.c +++ b/usr/src/cmd/cron/funcs.c @@ -172,8 +172,8 @@ cron_sendmsg(char action, char *login, char *fname, char etype) } pmsg->etype = etype; pmsg->action = action; - (void) strncpy(pmsg->fname, fname, FLEN); - (void) strncpy(pmsg->logname, login, LLEN); + (void) strlcpy(pmsg->fname, fname, FLEN); + (void) strlcpy(pmsg->logname, login, LLEN); if ((i = write(msgfd, pmsg, sizeof (struct message))) < 0) (void) fprintf(stderr, gettext("error in message send\n")); else if (i != sizeof (struct message)) |