Subject: Re: pkg/30510: xterm utmp_update problem
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: pkgsrc-bugs
Date: 06/21/2005 18:47:01
The following reply was made to PR pkg/30510; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org,
	gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Cc: 
Subject: Re: pkg/30510: xterm utmp_update problem
Date: Tue, 21 Jun 2005 14:46:13 -0400

 On Jun 21,  6:41pm, asmodai@in-nomine.org (Jeroen Ruigrok/asmodai) wrote:
 -- Subject: Re: pkg/30510: xterm utmp_update problem
 
 | The following reply was made to PR pkg/30510; it has been noted by GNATS.
 | 
 | From: Jeroen Ruigrok/asmodai <asmodai@in-nomine.org>
 | To: Thomas Klausner <wiz@NetBSD.org>
 | Cc: gnats-bugs@NetBSD.org
 | Subject: Re: pkg/30510: xterm utmp_update problem
 | Date: Tue, 21 Jun 2005 20:40:20 +0200
 | 
 |  -On [20050615 15:12], Thomas Klausner (wiz@NetBSD.org) wrote:
 |  >Could you please take a look at this one and advise?
 |  
 |  It's not a part of xterm nor of X itself.
 |  
 |  It's part of NetBSD's sources:
 |  
 |  src/libexec/utmp_update/utmp_update.c
 |  
 |  110 (void)snprintf(tty, sizeof(tty), "%s%s", _PATH_DEV, utx->ut_line);
 |  111 fd = open(tty, O_RDONLY|O_NONBLOCK, 0);
 |  112 if (fd != -1) {
 |  113         if (fstat(fd, &st) == -1)
 |  114                 err(1, "Cannot stat `%s'", tty);
 |  115         if (ruid != 0 && st.st_uid != ruid)
 |  116                 errx(1, "%s: Is not owned by you", tty);
 |  117         if (!isatty(fd))
 |  118                 errx(1, "%s: Not a tty device", tty);
 |  119         (void)close(fd);
 |  120         if (access(tty, W_OK|R_OK) == -1)
 |  121                 err(1, "%s", tty);
 |  
 |  In xterm I have:
 |  
 |  main.c:
 |  
 |  2693 set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
 |  2694 {
 |  2695     if (chown(device, uid, gid) < 0) {
 |  2696         if (errno != ENOENT
 |  2697             && getuid() == 0) {
 |  2698             fprintf(stderr, "Cannot chown %s to %ld,%ld: %s\n",
 |  2699                     device, (long) uid, (long) gid, strerror(errno));
 |  2700         }
 |  2701     }
 |  2702     chmod(device, mode);
 |  2703 }
 |  
 |  What does your xtermcfg.h all contain after running bmake configure?
 
 xterm should not be running setuid, and the chowning of the slave device
 is happening in the kernel.
 
 christos