Skip Menu |
 

Download (untitled) / with headers
text/plain 7.1KiB
From kdrenard@ARL.MIL Thu Apr 3 10:05:57 1997
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id KAA15918 for <bugs@RT-11.MIT.EDU>; Thu, 3 Apr 1997 10:05:52 -0500
Received: from smokey.arl.mil by MIT.EDU with SMTP
id AA28650; Thu, 3 Apr 97 10:05:35 EST
Message-Id: <9704031004.aa01179@SMOKEY.ARL.MIL>
Date: Thu, 3 Apr 97 10:04:51 EST
From: "Kenneth D. Renard" (CICC/HPCD) <kdrenard@ARL.MIL>
To: krb5-bugs@MIT.EDU
Cc: kdrenard@ARL.MIL
Subject: appl/bsd/login.c fixes

Show quoted text
>Number: 412
>Category: krb5-appl
>Synopsis: SGI fixes, Solaris ccaches & more syslog to appl/bsd/login.c
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: support
>Submitter-Id: unknown
>Arrival-Date: Thu Apr 03 10:06:00 EST 1997
>Last-Modified: Sun Apr 06 12:23:01 EDT 1997
>Originator: Kenneth D. Renard <kdrenard@arl.mil>
>Organization:
Army Research Lab, APG, MD
Show quoted text
>Release: 1.0
>Environment:
SGI Irix 5.x, 6.x, Sun Solaris 2.x
Show quoted text
>Description:
SGI Irix printed out 2 MOTDs
SGI Irix failed to print or update lastlog message
Solaris 2.x: login.krb5 parsing of ttyname into ccachename

Show quoted text
>How-To-Repeat:
SGI problems: use login.krb5
Solaris: Run login.krb5 without KRB5CCNAME pre-set on /dev/pts/0
and you'll get KRB5CCNAME=FILE:/tmp/krb5cc_0

Show quoted text
>Fix:

Here are a few additions that I have made to appl/bsd/login.c to help
out Solaris, SGIs and to do some extra SYSLOG-ing.

1. Moved char string rusername out to a global (line 271) so it can be
used in additional syslog msg at lines 1914-1920

2. Added "sgi" to ifdef (line 284) so SGIs wouldn't do 2nd MOTD

3. Parsed ttyname better for case of Solaris "/dev/pts/0" would produce
cachename "FILE:/tmp/krb5cc_pts-0" instead of "FILE:/tmp/krb5cc_0".
(lines 483-496)

4. In dolastlog(), added suuport for SGI Irix which stores its lastlog
info in LASTLOG/<username> instead of flat LASTLOG file.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
*** 1.1 1997/03/06 16:51:02
--- login.c 1997/04/03 14:37:15
***************
*** 268,273 ****
--- 268,274 ----
int timeout = 300;

char term[64], *hostname, *username;
+ char rusername[UT_NAMESIZE+1];

extern int errno;

***************
*** 281,287 ****
passsword */
#endif

! #ifdef __SVR4
#define NO_MOTD
#define NO_MAILCHECK
#endif
--- 282,288 ----
passsword */
#endif

! #if defined(__SVR4) || defined(sgi)
#define NO_MOTD
#define NO_MAILCHECK
#endif
***************
*** 482,488 ****

/* Set up the credential cache environment variable */
if (!getenv(KRB5_ENV_CCNAME)) {
! sprintf(ccfile, "FILE:/tmp/krb5cc_%s", strrchr(ttyn, '/')+1);
setenv(KRB5_ENV_CCNAME, ccfile, 1);
unlink(ccfile+strlen("FILE:"));
} else {
--- 483,496 ----

/* Set up the credential cache environment variable */
if (!getenv(KRB5_ENV_CCNAME)) {
! char *ttyname, *c;
! if ((ttyname = strchr(ttyn,'/')) && (ttyname = strchr(ttyname+1,'/')))
! ++ttyname;
! else
! ttyname = ttyn;
! while (c = strchr(ttyname, '/'))
! *c = '-';
! sprintf(ccfile, "FILE:/tmp/krb5cc_%s",ttyname);
setenv(KRB5_ENV_CCNAME, ccfile, 1);
unlink(ccfile+strlen("FILE:"));
} else {
***************
*** 1903,1908 ****
--- 1911,1924 ----

afs_login ();

+ #ifdef LOG_ALL_LOGINS
+ if ( !(hflag || rflag))
+ syslog(LOG_AUTH|LOG_INFO,"%s on %s", pwd->pw_name, tty);
+ else
+ syslog(LOG_AUTH|LOG_INFO,"%s@%s as %s", (rusername) ? rusername : "?",
+ (hostname) ? (hostname) : "unknown host", pwd->pw_name);
+ #endif
+
if (!quietlog) {
#ifdef KRB4_KLOGIN
if (!krbflag && !fflag && !eflag )
***************
*** 2185,2192 ****
--- 2201,2216 ----
struct lastlog ll;
int fd;

+ #ifdef sgi
+ char *fname = malloc(strlen(LASTLOG) + strlen(pwd->pw_name) + 1);
+ if (!fname) return;
+ sprintf(fname,"%s/%s", LASTLOG, pwd->pw_name);
+ if ((fd = open(fname, (O_RDWR|O_CREAT), 0)) >= 0) {
+
+ #else
if ((fd = open(LASTLOG, O_RDWR, 0)) >= 0) {
(void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET);
+ #endif
if (!quiet) {
if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) &&
ll.ll_time != 0) {
***************
*** 2199,2205 ****
--- 2223,2233 ----
printf("on %.*s\n",
sizeof(ll.ll_line), ll.ll_line);
}
+ #ifdef sgi
+ (void)lseek(fd, 0, SEEK_SET);
+ #else
(void)lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET);
+ #endif
}
(void)time(&ll.ll_time);
(void) strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
***************
*** 2210,2215 ****
--- 2238,2246 ----
(void)write(fd, (char *)&ll, sizeof(ll));
(void)close(fd);
}
+ #ifdef sgi
+ free(fname);
+ #endif
#endif
}

***************
*** 2242,2248 ****
char *host;
{
static char lusername[UT_NAMESIZE+1];
- char rusername[UT_NAMESIZE+1];

lgetstr(rusername, sizeof(rusername), "Remote user");
lgetstr(lusername, sizeof(lusername), "Local user");
--- 2273,2278 ----
Show quoted text
>Audit-Trail:

From: "Richard Basch" <basch@MIT.EDU>
To: Unassigned Problem Report <krb5-unassigned@RT-11.MIT.EDU>
Cc: krb5-bugs@MIT.EDU
Subject: Re: krb5-appl/412: SGI fixes, Solaris ccaches & more syslog to appl/bsd/login.c
Date: Sun, 6 Apr 1997 12:22:08 -0400

`Richard Basch' made changes to this PR.

--- /tmp/gnatsa000IA Sun Apr 6 12:13:16 1997
+++ /tmp/gnatsb000IA Sun Apr 6 12:21:26 1997
@@ -182,5 +182,22 @@
--- 2273,2278 ----
Show quoted text
>Audit-Trail:
>Unformatted:
+
+ *** Sun Apr 6 12:15:13 EDT 1997 *** probe
+
+Notes to krbdev:
+1. The ccache name has already been dealt with. I noticed this problem on
+ various platforms, but decided to change the ccache name to the manner
+ in which it is generated by telnet... krb5cc_p<pid> instead of the pty
+ munging which is unnecessarily complex and has no advantage. Sometimes,
+ I think we should be using tempnam.
+2. I believe the SGI double motd patch is already checked in.
+
+The only patches remaining are moving rusername to a global and the
+change to the SGI lastlog. Please note that the patch is incorrect
+since the malloc should read +2, not +1, to account for the '/' and
+the trailing null. Since I don't have a SGI at my disposal, I will
+let someone else on krbdev deal.
+
Show quoted text
>Architecture: *

Show quoted text
>Unformatted:
>Architecture: *


*** Sun Apr 6 12:15:13 EDT 1997 *** probe

Notes to krbdev:
1. The ccache name has already been dealt with. I noticed this problem on
various platforms, but decided to change the ccache name to the manner
in which it is generated by telnet... krb5cc_p<pid> instead of the pty
munging which is unnecessarily complex and has no advantage. Sometimes,
I think we should be using tempnam.
2. I believe the SGI double motd patch is already checked in.

The only patches remaining are moving rusername to a global and the
change to the SGI lastlog. Please note that the patch is incorrect
since the malloc should read +2, not +1, to account for the '/' and
the trailing null. Since I don't have a SGI at my disposal, I will
let someone else on krbdev deal.