[8523] in Athena Bugs
vax 7.3P: /usr/ucb/finger (fix included)
daemon@ATHENA.MIT.EDU (Calvin Clark)
Fri Nov 1 16:39:02 1991
Date: Fri, 1 Nov 91 16:38:42 -0500
From: Calvin Clark <ckclark@Athena.MIT.EDU>
To: bugs@Athena.MIT.EDU
Cc: rnewman@Athena.MIT.EDU
Reply-To: ckclark@mit.edu
System name: hal-2000
Type and version: CVAXSTAR 7.3P
Display type: SM
What were you trying to do?
A user mentioned finger's strange behavior when it reads his
.plan file. (Finger did not print the 3rd and 4th characters if his
.plan file, even though they were ASCII.)
What's wrong:
finger will not echo any of the first 15 characters in a user's
.plan file which match the corresponding characters in the string
"%MENTION-MAIL%\n" For example, if a user with a .plan file which says:
DEVOTION IS LEARNING WHAT'S IMPORTANT, AND STICKING WITH IT.
will be tranlated by finger to:
DEVO IS EARNING WHAT'S IMPORTANT, AND STICKING WITH IT.
Needless to say, this bug could lead to embarrassment, and my
fix should be applied immediately.
What should have happened:
It should echo all of first 15 characters of the .plan file if
they don't match "%MENTION-MAIL%\n".
Fix:
*** /source/bsd-4.3/common/ucb/finger.c Tue Apr 14 19:49:01 1987
--- finger.c Fri Nov 1 15:29:19 1991
***************
*** 442,449 ****
free(s);
}
if (plan) {
! register int i = 0,j;
! register int okay = 1;
char mailbox[100]; /* mailbox name */
s = malloc(strlen(p->pwd->pw_dir) +
sizeof PLAN);
--- 442,450 ----
free(s);
}
if (plan) {
! register int i, cc;
! char mmline[15];
! register int checkmail = 0;
char mailbox[100]; /* mailbox name */
s = malloc(strlen(p->pwd->pw_dir) +
sizeof PLAN);
***************
*** 453,481 ****
printf("No Plan.\n");
else {
printf("Plan:\n");
! while ((c = getc(fp)) != EOF) {
! if (i<MMLEN) {
! if (c != MM[i]) {
! if (okay) {
! for (j=0;j<i;j++) {
! putchar(MM[j]);
! }
! }
! if (isprint(c) || isspace(c))
! putchar(c);
! else
! putchar(c ^ 100);
! okay = 0;
! }
}
! else if (isprint(c) || isspace(c))
! putchar(c);
! else
! putchar(c ^ 100);
! i++;
! }
! fclose(fp);
! if (okay) {
strcpy (mailbox, MAILDIR); /* start with the directory */
strcat (mailbox, (p->pwd)->pw_name);
if (access(mailbox, F_OK) == 0) {
--- 454,480 ----
printf("No Plan.\n");
else {
printf("Plan:\n");
! if ((cc = fread(mmline,sizeof(*mmline),MMLEN,fp)) > 0) {
! if (strcmp(mmline,MM) == 0)
! checkmail = 1;
! else
! for (i = 0; i < cc; i++) {
! c = mmline[i];
! if (isprint(c) || isspace(c))
! putchar(c);
! else
! putchar(c ^ 100);
! };
! while ((c = getc(fp)) != EOF) {
! if (isprint(c) || isspace(c))
! putchar(c);
! else
! putchar(c ^ 100);
! }
! fclose(fp);
}
! };
! if (checkmail) {
strcpy (mailbox, MAILDIR); /* start with the directory */
strcat (mailbox, (p->pwd)->pw_name);
if (access(mailbox, F_OK) == 0) {
***************
*** 485,491 ****
printf("User %s has new mail.\n", (p->pwd)->pw_name);
};
}
- }
}
free(s);
}
--- 484,489 ----
Please describe any relevant documentation references:
N/A