From ro@TechFak.Uni-Bielefeld.DE Thu Sep 14 14:34:44 2000
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2])
by rt-11.mit.edu (8.9.3/8.9.3) with SMTP id OAA23732
for <bugs@RT-11.MIT.EDU>; Thu, 14 Sep 2000 14:34:43 -0400 (EDT)
Received: from gemma.TechFak.Uni-Bielefeld.DE by MIT.EDU with SMTP
id AA15635; Thu, 14 Sep 00 14:34:01 EDT
Received: from xayide.TechFak.Uni-Bielefeld.DE (xayide.TechFak.Uni-Bielefeld.DE [129.70.136.3])
by gemma.TechFak.Uni-Bielefeld.DE (8.9.1/8.9.1/TechFak/pk+ro20000427) with ESMTP id UAA08960;
Thu, 14 Sep 2000 20:34:36 +0200 (MET DST)
Received: by xayide.TechFak.Uni-Bielefeld.DE (8.9.3+Sun/pk19971205)
id UAA03407; Thu, 14 Sep 2000 20:34:35 +0200 (MEST)
Message-Id: <yddzoladdqd.fsf@xayide.TechFak.Uni-Bielefeld.DE>
Date: 14 Sep 2000 20:34:34 +0200
From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Sender: ro@TechFak.Uni-Bielefeld.DE
To: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
Cc: Kerberos Devel list <krbdev@MIT.EDU>, krb5-bugs@MIT.EDU
In-Reply-To: Tim Mooney's message of "Thu, 14 Sep 2000 01:49:02 -0500 (CDT)"
Subject: Re: krb5 1.2.1 and utmpx problems
References: <Pine.OSF.4.21.0009132332450.337522-100000@dogbert.cc.ndsu.NoDak.edu>
I've seen the same problem with SEAM 1.0.1, Sun's implementation of krb5
1.1 running on Solaris 8. I filed a bug with Sun (Bug Id 4346410), and got
a modified /usr/krb5/lib/libpty.so.1 which fixes the problem. I noticed
(from the SCCS Ids) that they have changed update_utmp.c, so I digged
somewhat further in the 1.2.1 sources and found the cause of the problem:
util/pty/update_utmp.c (pty_update_utmp) uses both the pututline() and
pututxline() families of functions if both are available to update both
utmp and utmpx files. In my understanding, this is at least unnecessary,
pututxline() will update both files if they exist. In Solaris releases
before 8, this probably did no harm, but Solaris 8 removed the
/var/adm/utmp and /var/adm/wtmp files, as desribed in the release notes:
Changes to Application Programming Interfaces (APIs) for User Accounting
Data
http://docs.sun.com:80/ab2/coll.591.3/S8OLRNUPSPARC/@Ab2PageView/1715?Ab2Lang=C&Ab2Enc=iso-8859-1
Calling both families of functions seems to cause havoc. The following
patch fixed the problem for me (only tested on Solaris 8, but a similar
comment in update_wtmp.c (ptyint_update_wtmp) indicates it should be right
in general).
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
Thu Sep 14 20:19:53 2000 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* update_wtmp.c (ptyint_update_wtmp): Fixed typo.
* update_utmp.c (pty_update_utmp): Use only one of pututxline() or
pututline().
===================================================================
RCS file: util/pty/RCS/update_utmp.c,v
retrieving revision 1.1
diff -u -r1.1 util/pty/update_utmp.c
--- util/pty/update_utmp.c 2000/06/30 02:28:51 1.1
+++ util/pty/update_utmp.c 2000/09/14 18:06:07
@@ -110,30 +110,6 @@
strncpy(userbuf, username, sizeof(userbuf));
else userbuf[0] = '\0';
-#ifdef HAVE_SETUTENT
-
- utmpname(UTMP_FILE);
- setutent();
-/* If we need to preserve the user name in the wtmp structure and
- * Our flags tell us we can obtain it from the utmp and we succeed in
- * obtaining it, we then save the utmp structure we obtain, write
- * out the utmp structure and change the username pointer so it is used by
- * update_wtmp.*/
-#ifdef WTMP_REQUIRES_USERNAME
- if (( !username[0]) && (flags&PTY_UTMP_USERNAME_VALID)
- &&line)
- {
- struct utmp *utptr;
- strncpy(ut.ut_line, line, sizeof(ut.ut_line));
- utptr = getutline(&ut);
- if (utptr)
- strncpy(userbuf,utptr->ut_user,sizeof(ut.ut_user));
- }
-#endif
-
- pututline(&ent);
- endutent();
-
#ifdef HAVE_SETUTXENT
setutxent();
#ifdef HAVE_GETUTMPX
@@ -165,8 +141,32 @@
utx.ut_host[0] = 0;
pututxline(&utx);
endutxent();
-#endif /* HAVE_SETUTXENT */
+#else /* HAVE_SETUTXENT */
+
+#ifdef HAVE_SETUTENT
+ utmpname(UTMP_FILE);
+ setutent();
+/* If we need to preserve the user name in the wtmp structure and
+ * Our flags tell us we can obtain it from the utmp and we succeed in
+ * obtaining it, we then save the utmp structure we obtain, write
+ * out the utmp structure and change the username pointer so it is used by
+ * update_wtmp.*/
+#ifdef WTMP_REQUIRES_USERNAME
+ if (( !username[0]) && (flags&PTY_UTMP_USERNAME_VALID)
+ &&line)
+ {
+ struct utmp *utptr;
+ strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+ utptr = getutline(&ut);
+ if (utptr)
+ strncpy(userbuf,utptr->ut_user,sizeof(ut.ut_user));
+ }
+#endif
+
+ pututline(&ent);
+ endutent();
+
#else /* HAVE_SETUTENT */
if (flags&PTY_TTYSLOT_USABLE)
tty = ttyslot();
@@ -200,6 +200,7 @@
#endif /* HAVE_SETUTENT */
+#endif /* HAVE_SETUTXENT */
/* Don't record LOGIN_PROCESS entries. */
if (process_type == PTY_LOGIN_PROCESS)
===================================================================
RCS file: util/pty/RCS/update_wtmp.c,v
retrieving revision 1.1
diff -u -r1.1 util/pty/update_wtmp.c
--- util/pty/update_wtmp.c 2000/06/30 02:28:51 1.1
+++ util/pty/update_wtmp.c 2000/09/14 18:23:42
@@ -69,7 +69,7 @@
#ifdef HAVE_UPDWTMP
#ifndef HAVE_UPDWTMPX
-/* This is already performed byupdwtmpx if present.*/
+/* This is already performed by updwtmpx if present.*/
updwtmp(WTMP_FILE, ent);
#endif /* HAVE_UPDWTMPX*/
#else /* HAVE_UPDWTMP */
Responsible-Changed-From-To: gnats-admin->krb5-unassigned
Responsible-Changed-By: raeburn
Responsible-Changed-When: Fri Sep 14 13:44:17 2001
Responsible-Changed-Why:
reformat/refile
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2])
by rt-11.mit.edu (8.9.3/8.9.3) with SMTP id OAA23732
for <bugs@RT-11.MIT.EDU>; Thu, 14 Sep 2000 14:34:43 -0400 (EDT)
Received: from gemma.TechFak.Uni-Bielefeld.DE by MIT.EDU with SMTP
id AA15635; Thu, 14 Sep 00 14:34:01 EDT
Received: from xayide.TechFak.Uni-Bielefeld.DE (xayide.TechFak.Uni-Bielefeld.DE [129.70.136.3])
by gemma.TechFak.Uni-Bielefeld.DE (8.9.1/8.9.1/TechFak/pk+ro20000427) with ESMTP id UAA08960;
Thu, 14 Sep 2000 20:34:36 +0200 (MET DST)
Received: by xayide.TechFak.Uni-Bielefeld.DE (8.9.3+Sun/pk19971205)
id UAA03407; Thu, 14 Sep 2000 20:34:35 +0200 (MEST)
Message-Id: <yddzoladdqd.fsf@xayide.TechFak.Uni-Bielefeld.DE>
Date: 14 Sep 2000 20:34:34 +0200
From: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
Sender: ro@TechFak.Uni-Bielefeld.DE
To: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
Cc: Kerberos Devel list <krbdev@MIT.EDU>, krb5-bugs@MIT.EDU
In-Reply-To: Tim Mooney's message of "Thu, 14 Sep 2000 01:49:02 -0500 (CDT)"
Subject: Re: krb5 1.2.1 and utmpx problems
References: <Pine.OSF.4.21.0009132332450.337522-100000@dogbert.cc.ndsu.NoDak.edu>
Show quoted text
>Number: 887
>Category: pty
>Synopsis: Re: krb5 1.2.1 and utmpx problems
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Sep 14 14:35:00 EDT 2000
>Last-Modified: Fri Sep 14 13:44:22 EDT 2001
>Originator: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
>Organization:
>Release:
>Environment:
>Description:
Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu> writes:>Category: pty
>Synopsis: Re: krb5 1.2.1 and utmpx problems
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Sep 14 14:35:00 EDT 2000
>Last-Modified: Fri Sep 14 13:44:22 EDT 2001
>Originator: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
>Organization:
>Release:
>Environment:
>Description:
Show quoted text
> Anyone using MIT krb5 1.2.1 on Solaris 8? I've noticed that at least on
> that platform, if I log into the box via klogind that a "screwed up" file in
> /var/adm is created:
>
> 00:20am gyro adm$ls -alb utmp*
> -rw-r--r-- 1 root bin 10416 Sep 14 00:20 utmpx
> -rw-r--r-- 1 root root 372 Sep 13 23:50 utmp\376\376\377\201\001\001x
>
> The `utmpx' is obviously normal, the other one with the 6 additional
> non-printing characters in the filename is coming from krb5.
[...]> that platform, if I log into the box via klogind that a "screwed up" file in
> /var/adm is created:
>
> 00:20am gyro adm$ls -alb utmp*
> -rw-r--r-- 1 root bin 10416 Sep 14 00:20 utmpx
> -rw-r--r-- 1 root root 372 Sep 13 23:50 utmp\376\376\377\201\001\001x
>
> The `utmpx' is obviously normal, the other one with the 6 additional
> non-printing characters in the filename is coming from krb5.
Show quoted text
> Anyone else seeing the same? I'll investigate further if someone else isn't
> already way ahead of me.
> already way ahead of me.
I've seen the same problem with SEAM 1.0.1, Sun's implementation of krb5
1.1 running on Solaris 8. I filed a bug with Sun (Bug Id 4346410), and got
a modified /usr/krb5/lib/libpty.so.1 which fixes the problem. I noticed
(from the SCCS Ids) that they have changed update_utmp.c, so I digged
somewhat further in the 1.2.1 sources and found the cause of the problem:
util/pty/update_utmp.c (pty_update_utmp) uses both the pututline() and
pututxline() families of functions if both are available to update both
utmp and utmpx files. In my understanding, this is at least unnecessary,
pututxline() will update both files if they exist. In Solaris releases
before 8, this probably did no harm, but Solaris 8 removed the
/var/adm/utmp and /var/adm/wtmp files, as desribed in the release notes:
Changes to Application Programming Interfaces (APIs) for User Accounting
Data
http://docs.sun.com:80/ab2/coll.591.3/S8OLRNUPSPARC/@Ab2PageView/1715?Ab2Lang=C&Ab2Enc=iso-8859-1
Calling both families of functions seems to cause havoc. The following
patch fixed the problem for me (only tested on Solaris 8, but a similar
comment in update_wtmp.c (ptyint_update_wtmp) indicates it should be right
in general).
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Email: ro@TechFak.Uni-Bielefeld.DE
Thu Sep 14 20:19:53 2000 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* update_wtmp.c (ptyint_update_wtmp): Fixed typo.
* update_utmp.c (pty_update_utmp): Use only one of pututxline() or
pututline().
===================================================================
RCS file: util/pty/RCS/update_utmp.c,v
retrieving revision 1.1
diff -u -r1.1 util/pty/update_utmp.c
--- util/pty/update_utmp.c 2000/06/30 02:28:51 1.1
+++ util/pty/update_utmp.c 2000/09/14 18:06:07
@@ -110,30 +110,6 @@
strncpy(userbuf, username, sizeof(userbuf));
else userbuf[0] = '\0';
-#ifdef HAVE_SETUTENT
-
- utmpname(UTMP_FILE);
- setutent();
-/* If we need to preserve the user name in the wtmp structure and
- * Our flags tell us we can obtain it from the utmp and we succeed in
- * obtaining it, we then save the utmp structure we obtain, write
- * out the utmp structure and change the username pointer so it is used by
- * update_wtmp.*/
-#ifdef WTMP_REQUIRES_USERNAME
- if (( !username[0]) && (flags&PTY_UTMP_USERNAME_VALID)
- &&line)
- {
- struct utmp *utptr;
- strncpy(ut.ut_line, line, sizeof(ut.ut_line));
- utptr = getutline(&ut);
- if (utptr)
- strncpy(userbuf,utptr->ut_user,sizeof(ut.ut_user));
- }
-#endif
-
- pututline(&ent);
- endutent();
-
#ifdef HAVE_SETUTXENT
setutxent();
#ifdef HAVE_GETUTMPX
@@ -165,8 +141,32 @@
utx.ut_host[0] = 0;
pututxline(&utx);
endutxent();
-#endif /* HAVE_SETUTXENT */
+#else /* HAVE_SETUTXENT */
+
+#ifdef HAVE_SETUTENT
+ utmpname(UTMP_FILE);
+ setutent();
+/* If we need to preserve the user name in the wtmp structure and
+ * Our flags tell us we can obtain it from the utmp and we succeed in
+ * obtaining it, we then save the utmp structure we obtain, write
+ * out the utmp structure and change the username pointer so it is used by
+ * update_wtmp.*/
+#ifdef WTMP_REQUIRES_USERNAME
+ if (( !username[0]) && (flags&PTY_UTMP_USERNAME_VALID)
+ &&line)
+ {
+ struct utmp *utptr;
+ strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+ utptr = getutline(&ut);
+ if (utptr)
+ strncpy(userbuf,utptr->ut_user,sizeof(ut.ut_user));
+ }
+#endif
+
+ pututline(&ent);
+ endutent();
+
#else /* HAVE_SETUTENT */
if (flags&PTY_TTYSLOT_USABLE)
tty = ttyslot();
@@ -200,6 +200,7 @@
#endif /* HAVE_SETUTENT */
+#endif /* HAVE_SETUTXENT */
/* Don't record LOGIN_PROCESS entries. */
if (process_type == PTY_LOGIN_PROCESS)
===================================================================
RCS file: util/pty/RCS/update_wtmp.c,v
retrieving revision 1.1
diff -u -r1.1 util/pty/update_wtmp.c
--- util/pty/update_wtmp.c 2000/06/30 02:28:51 1.1
+++ util/pty/update_wtmp.c 2000/09/14 18:23:42
@@ -69,7 +69,7 @@
#ifdef HAVE_UPDWTMP
#ifndef HAVE_UPDWTMPX
-/* This is already performed byupdwtmpx if present.*/
+/* This is already performed by updwtmpx if present.*/
updwtmp(WTMP_FILE, ent);
#endif /* HAVE_UPDWTMPX*/
#else /* HAVE_UPDWTMP */
Show quoted text
>How-To-Repeat:
>Fix:
>Audit-Trail:
>Fix:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->krb5-unassigned
Responsible-Changed-By: raeburn
Responsible-Changed-When: Fri Sep 14 13:44:17 2001
Responsible-Changed-Why:
reformat/refile
Show quoted text
>Unformatted: