Commit Graph

32 Commits

Author SHA1 Message Date
kamil 171790efcf Fix stack use after scope in libutil/pty
The pt variable's elements are used after the end of the pt scope.
A move of pt to outer scope fixes this.

Detected with MKSANITIZER/ASan with tmux(1), a forkpty(3) user.
2018-06-24 09:30:26 +00:00
christos 47b68f7fe6 remove pointless static. 2009-02-20 16:44:06 +00:00
lukem c5eb4ab601 fix -Wsign-compare issues 2009-01-18 11:56:51 +00:00
christos 3ff3472e11 Use the re-entrant getgr*_r functions. From John Nemeth. 2005-09-14 02:12:34 +00:00
mycroft ebfdf0c012 If TIOCPTMGET fails, close /dev/ptm. 2005-01-19 01:54:09 +00:00
christos 5a55e0c902 Don't give write privileges at all if the tty group is missing. 2004-11-25 02:49:46 +00:00
christos db5d4e2d6a I really want to kill the hard-coding of _TTY_GID. Set the group to the
primary group of the user if the group tty does not exist.
2004-11-24 22:17:19 +00:00
christos 2611d5a68f KNF; Simplify some logic, so that lines don't wrap. Explain why we
break, continue, or return from the tty scanning loops.
2004-09-18 20:14:22 +00:00
yamt 2936303c19 openpty: just check errors of syscalls,
instead of checking permission beforehand in userland.
2004-09-18 16:44:38 +00:00
christos 92cd5ee20c Don't allow openpty to succeed if the caller is non-superuser.
XXX: we cross-reference ptm 4 which does not exist (yet)
2004-06-18 02:42:57 +00:00
christos f099fa154d use the pty multiplexor if it exists. 2004-05-27 03:12:48 +00:00
christos ad96bb0dec remove unused variable 2003-10-25 07:31:12 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
atatat d76e3cd5fe Fix openpty() so that it correctly scans the entire list of possible
ttys.  The new ttys (g-zA-Z) are "optional", since they may not be
present, and their absence is not a "fatal" error.
2002-03-09 20:09:28 +00:00
tls c6652502b9 Add support for up to 930 pty devices (instead of the current 256).
The openpty() routine has been modified to use the extra pty names
before the "traditional" names, so that programs too dumb to use
openpty() will, hopefully, find one of the "traditional" ptys free
even if many others are in use.  The modifications to MAKEDEV are
courtesy Andrew Brown, and are pretty clever: the unit numbers used
by the "traditional" names stay the same, to avoid trouble when
upgrading existing systems.  The unusual use of "dd" to index an
array in MAKEDEV is because no other simple method seemed feasible
using only the programs on the install media for all ports.
2002-02-02 05:48:30 +00:00
lukem 4db962fc85 revert over-zealous pcvt cull; we still need to skip ttyv* whilst pccons uses
ttyv0 on some ports (currently; arm32, bebox, i386, prep).  should fix PR 12862.
2001-05-10 01:57:47 +00:00
ad 6d078c7044 Remove PCVT hack. 2000-07-10 11:16:38 +00:00
ad fce98185a9 - __RCSID() police.
- ANSIfy.
- Miscellaneous style changes.
- Shutup lint(1) in one or two cases.
2000-07-05 11:46:40 +00:00
lukem d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
lukem b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
simonb 6bf3aa19f9 More trailing white space. 1999-07-02 15:46:05 +00:00
christos 983a6b1f22 Delint 1998-12-09 14:35:02 +00:00
perry b613a27fa7 unregisterify 1998-01-22 15:29:13 +00:00
perry 5e3388b0bf merge with lite-2 1998-01-22 15:23:05 +00:00
christos f5646a08d4 - RCSID police
- Add ttymsg.3
1997-06-29 18:44:03 +00:00
mycroft 7cc5f9cd7a Make openpty() work more than once. 1996-11-12 16:39:38 +00:00
jtc e42a94845a Minor reorganization of libutil, including the addition of passward
locking and editing functions.
From Greg Hudson <ghudson@MIT.EDU>
1996-05-15 21:42:23 +00:00
pk 8347998a01 Prototypes (PR#1100). 1995-06-05 19:43:53 +00:00
cgd 3a724adbf7 minor cleanup; kill unnecessary casts 1994-05-04 10:55:57 +00:00
andrew fc3e00430e Support up to 256 ptys. 1994-04-06 08:54:35 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00