[7839] in Athena Bugs
rt 7.2R: expreserve
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Tue Jul 30 00:52:29 1991
Date: Tue, 30 Jul 91 00:52:38 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
System name: pit-manager
Type and version: RTPC-ROMPC 7.2R
Display type: apa16
megapel
What were you trying to do?
Have expreserve work properly after a workstation crash or
interrupted login session.
What's wrong:
It doesn't, because it looks for the username in the passwd
file and doesn't find it.
What should have happened:
It should use hesiod to look up the username if it can't find
it in the passwd file.
Please describe any relevant documentation references:
The patch below. Note that my hesiod.h needs to be applied
previous to this, so that hesiod.h declares hes_getpwuid, and
my sendmail fix needs to be applied, so that sendmail will not
claim that the return address is "postmaster" (although that
isn't as important).
I couldn't find other versions of expreserve in /source/FILES,
so I haven't submitted patches for any other platforms. The
fix, however, should be easy on all platforms.
Note that the Makefile/Imakefile in the ex directory will have
to have the correct -I and -L flags to get Athena libraries
added, and will need to define HESIOD, and will need to link
against the hesiod library.
jik
*** /source/bsd-4.3/common/ucb/ex/expreserve.c mon mar 9 15:10:33 1987
--- expreserve.c tue jul 30 00:44:04 1991
***************
*** 20,25 ****
--- 20,28 ----
#include <sys/stat.h>
#include <sys/dir.h>
#include <pwd.h>
+ #ifdef hesiod
+ #include <hesiod.h>
+ #endif
#include "uparm.h"
#define tmp "/tmp"
***************
*** 319,325 ****
char *fname;
time_t time;
{
! struct passwd *pp = getpwuid(uid);
register file *mf;
char cmd[bufsiz];
char hostname[128];
--- 322,328 ----
char *fname;
time_t time;
{
! struct passwd *pp;
register FILE *mf;
char cmd[BUFSIZ];
char hostname[128];
***************
*** 326,331 ****
--- 329,339 ----
char croak[128];
char *timestamp, *ctime();
+ pp = getpwuid(uid);
+ #ifdef HESIOD
+ if (pp == NULL)
+ pp = hes_getpwuid(uid);
+ #endif
if (pp == NULL)
return;
gethostname(hostname, sizeof(hostname));