aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/wall/ttymsg.c
Commit message (Collapse)AuthorAgeFilesLines
* ttymsg: OverhaulDag-Erling Smørgrav2026-05-251-56/+64
| | | | | | | | | | | | | | | | | | | | | | | | | * Instead of an error string, return the usual 0 or -1 and let the caller figure out what, if anything, to tell the user. * Avoid string manipulations by opening /dev first and using openat() with O_RESOLVE_BENEATH. * Add a boolean argument which, if false, causes ttymsg() to return without sending the message if the tty's group-writable bit is not set. This saves programs that respect this setting (like syslogd(8)) from having to check before calling ttymsg(). * Update all callers. The observable effect of this change is minimal except for slightly different error messages when ttymsg() fails. However, syslogd(8) will no longer print spurious error messages on the console after trying and failing to write a log message to an X11 session. PR: 295171 MFC after: 1 week Reviewed by: jfree, markj Differential Revision: https://reviews.freebsd.org/D57018
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: two-line .c patternWarner Losh2023-08-161-3/+0
| | | | Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
* Add RFC 5424 syslog message output to syslogd.Ed Schouten2018-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move all of the code responsible for transmitting log messages into a separate function, fprintlog_write(). - Instead of manually modifying a list of iovecs, add a structure iovlist with some helper functions. - Alter the F_FORW (UDP message forwarding) case to also use iovecs like the other cases. Use sendmsg() instead of sendto(). - In the case of F_FORW, truncate the message to a size dependent on the address family (AF_INET, AF_INET6), as proposed by RFC 5426. - Move all traditional message formatting into fprintlog_bsd(). Get rid of some of the string copying and snprintf()'ing. Simply emit more iovecs to get the job done. - Increase ttymsg()'s limit of 7 iovecs to 32. Add a definition for this limit, so it can be reused by iovlist. - Add fprintlog_rfc5424() to emit RFC 5424 formatted log entries. - Add a "-O" command line option to enable RFC 5424 formatting. It would have been nicer if we supported "-o rfc5424", just like on NetBSD. Unfortunately, the "-o" flag is already used for a different purpose on FreeBSD. - Don't truncate hostnames in the RFC 5424 case, as suggested by that specific RFC. For people interested in using this, this feature can be enabled by adding the following line to /etc/rc.conf: syslogd_flags="-s -O rfc5424" Differential Revision: https://reviews.freebsd.org/D15011 Notes: svn path=/head/; revision=332510
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Revert r286144 leaving the original fix to the buffer overflow.Pedro F. Giffuni2015-08-041-3/+2
| | | | | | | | | | Some developers consider the new code unnecessarily obfuscated. There was also a benign off-by-one. Discussed with: bde, vangyzen, jmallett Notes: svn path=/head/; revision=286268
* Buffer overflow in wall(1).Pedro F. Giffuni2015-08-011-2/+3
| | | | | | | | | | | | | Revert r286102 and apply a cleaner fix. Tested for overflows by FORTIFY_SOURCE GSoC (with clang). Suggested by: bde Reviewed by: Oliver Pinter Tested by: Oliver Pinter MFC after: 3 days Notes: svn path=/head/; revision=286144
* Buffer overflow in wall(1).Pedro F. Giffuni2015-07-311-2/+2
| | | | | | | | | | | | | This affected syslogd, wall and talkd. Detected by FORTIFY_SOURCE GSoC (with clang). Submitted by: Oliver Pinter Differential Revision: https://reviews.freebsd.org/D3254 Reviewed by: delphij, jmg MFC after: 3 days Notes: svn path=/head/; revision=286102
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson Notes: svn path=/head/; revision=216370
* Revert most part of 200420 as requested, as more review and polish isXin LI2009-12-131-0/+1
| | | | | | | needed. Notes: svn path=/head/; revision=200462
* Remove unneeded header includes from usr.bin/ except contributed code.Xin LI2009-12-111-1/+0
| | | | | | | Tested with: make universe Notes: svn path=/head/; revision=200420
* make wall(1) work with pts.Hajimu UMEMOTO2006-01-271-2/+6
| | | | Notes: svn path=/head/; revision=154898
* Change iov_base's type from `char *' to the standard `void *'. AllMike Barcroft2002-10-111-1/+1
| | | | | | | | uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'. Notes: svn path=/head/; revision=104908
* WARNS=2 fix, use __FBSDID().Mark Murray2001-12-111-5/+5
| | | | | | | Not added to Makefile as WARNS=2 will be made default. Notes: svn path=/head/; revision=87675
* - Move the prototype of ttymsg() into ttymsg.h. syslogd and talkdDima Dorfman2001-09-091-5/+8
| | | | | | | | | | | | | also use this, and they shouldn't have to have their own prototypes. - Silence warnings about constness and signedness in ttymsg(). This includes changing the return value to a `const char *', and changing the types of `left' and `wret' (both byte counts) to ssize_t. Reviewed by: bde Notes: svn path=/head/; revision=83242
* Fix ttynames generation broken with strlcatAndrey A. Chernov2001-03-051-1/+1
| | | | | | | | PR: 25541 Submitted by: Nickolay Dudorov <nnd@mail.nsk.ru> Notes: svn path=/head/; revision=73752
* o Add support for wall -g. This will send a message to all members ofWarner Losh2001-03-011-14/+11
| | | | | | | | | | a given group. o Minor code style cleanups while I'm here Reviewed by: bde, kris, markm, audit@ Notes: svn path=/head/; revision=73255
* O_NONBLOCK was used as a command with a bogus arg to fcntl(2).Guy Helmer2000-06-091-2/+2
| | | | | | | | | | | Change it to F_SETFD with an arg of 0 to clear O_NONBLOCK. PR: bin/8681 Submitted by: koyama takahiro <tah@d1.dion.ne.jp> Prompted by: Nathan Ahlstrom <nrahlstr@winternet.com> Notes: svn path=/head/; revision=61464
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* A bit of PR7278 which belongs here.Poul-Henning Kamp1998-07-221-2/+2
| | | | | | | | | PR: 7278 Reviewed by: phk Submitted by: Harlan.Stenn@pfcs.com Notes: svn path=/head/; revision=37846
* Add rcsid. Sort #includes.Philippe Charnier1998-03-231-3/+7
| | | | Notes: svn path=/head/; revision=34800
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+163
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590