Commit Graph

44 Commits

Author SHA1 Message Date
Ned T. Crigler 7acac92277 dtach 0.9 2016-05-08 18:34:34 -07:00
Ned T. Crigler 3e2834966f Update copyrights for 2016. 2016-05-08 17:55:34 -07:00
Ned T. Crigler 487b802c4a Improve error message when dtach can't find a pty.
Also add some documentation mentioning the devices that dtach usually
needs access to on Linux.

Bug reported by David Bremner at https://bugs.debian.org/804944
2016-05-08 17:43:28 -07:00
Ned T. Crigler 35219aa11c Call init_pty before signals are set up.
Signals set to SIG_IGN (such as SIGPIPE) are not reset when execve is
called, which causes programs executed by dtach to start in a different
state than what they expect. Calling init_pty first is the simplest way
to fix this bug.

Bug reported by Robert de Bath at https://bugs.debian.org/805417
2015-12-01 18:46:58 -08:00
Ned T. Crigler c794d0615c Update copyrights for 2015. 2015-07-18 13:13:18 -07:00
Ned T. Crigler 087e89f7a8 Add dtach -p.
dtach -p copies the contents of standard input to a session.

Based on an initial patch by @johnlane.
2015-07-18 13:13:09 -07:00
Ned T. Crigler b7d5154c18 Try to use chdir to get around the sun_path length limit.
If a socket's path name would overflow sun_path, try to make it fit by
temporarily changing to the directory the socket is in and using the
path's basename in sun_path.

This should help for the case where the basename of the socket does fit
in sun_path, even if the rest of the path doesn't.
2014-08-04 13:00:24 -07:00
Ned T. Crigler a51207bf47 Prevent buffer overflow with a long socket path name.
The code wasn't checking for overflow before copying the socket path
name to to the sun_path field, which is usually much smaller than
PATH_MAX.

Report and initial patch by Paul Wilkinson.
2014-08-04 13:00:19 -07:00
Paul Wilkinson fc78d94e7f Silence valgrind memcheck error by memset()-ing pkt to 0
valgrind reports:

    Syscall param write(buf) points to uninitialised byte(s)

In this case, it is a false positive, but adding this single memset at
attach start-up means the program is now clean when run with "valgrind
--trace-children=yes dtach -c ...", which can make future debugging
easier.
2014-08-04 12:46:38 -07:00
Ned T. Crigler c7b68ae3fa Add dtach -N.
dtach -N is similar to dtach -n, except dtach will not daemonize.

Based on patches by Ciprian Dorin Craciun and Frank Hunleth.
2014-08-04 12:46:30 -07:00
Ned T. Crigler 8527d8e876 Make socket executable when there are attached clients.
Based on dtach-0.8-socket-exec-bit.diff by Kodest.
2014-08-04 12:46:26 -07:00
Ned T. Crigler 3fb977f175 Add .gitignore file. 2014-08-03 17:46:29 -07:00
Ned T. Crigler b5b466f982 Add AIX support to openpty and forkpty.
Patch by Ross Mohn.
2012-07-26 23:37:49 +00:00
Ned T. Crigler b87fa9970d Fix error handling for read from stdin in attach.c
attach.c did not correctly handle a read from stdin when read returned
an error. The code assigned the return value of read to pkt.len (an
unsigned char) before checking the value. This prevented the error check
from working correctly, since an unsigned integer can never be < 0.

A packet with an invalid length was then sent to the master, which then
sent 255 bytes of garbage to the program.

Fix the bug in attach.c and the unchecked packet length bug in master.c.

Report and initial patch by Enrico Scholz.
2012-07-01 21:44:34 +00:00
Ned T. Crigler aeb60e6d04 Use ssize_t for the return type of read/write instead of int. 2012-07-01 21:26:10 +00:00
Ned T. Crigler 637bafd129 dtach 0.8 2008-01-31 05:54:14 +00:00
Ned T. Crigler 4e2a059044 Fix -e ^<char> to work with lowercase characters. 2008-01-31 04:56:30 +00:00
Ned T. Crigler 10e85a316b Update copyrights for 2008. 2008-01-29 22:27:53 +00:00
Ned T. Crigler 81dfe2ae09 If FD_CLOEXEC works, create a pipe and use it to report any errors that occur
while trying to execute the program.
2008-01-26 03:03:25 +00:00
Ned T. Crigler 0b9fe28288 Always assume that stdin is not a terminal when tcgetattr fails, instead of
printing an error message.
2007-04-23 18:12:31 +00:00
Ned T. Crigler 99e7138017 Apply patch from esr@thyrsus.com to fix an ambiguous backslash in the man
page.
2007-04-23 17:53:28 +00:00
Ned T. Crigler 5dbd8fe920 Try to detect and remove stale sockets when dtach -A is used. Be
paranoid about this, and only remove the specified file if connect says
the connection was refused and stat says the file is a socket.

Also dtach -A now only tries to create the socket if the connection was
refused or the socket did not exist, instead of on any random error as
before.
2006-09-27 23:56:29 +00:00
Ned T. Crigler e06f8dfcdf Add a comment to the waitattach code. 2006-09-27 23:08:22 +00:00
Ned T. Crigler 5f6d552d2c Print an error message if we could not execute the desired command, instead of
exiting silently.

Also make sure the master process waits until the client attaches when using
the -A and -c modes, so that the error message has a chance of being seen.
2006-06-03 01:28:20 +00:00
Ned T. Crigler 3b070abf7a Allow the dtach -n mode to be used without a terminal. If a terminal is not
present when dtach is started, we now rely on whatever default terminal
settings the kernel uses.
2005-04-10 19:38:43 +00:00
Ned T. Crigler 76b04f84f0 Use non-blocking mode a little better by repeatedly trying to send data out to
the clients until at least one write worked and no error (other than EAGAIN)
occurred when writing to any of the clients. This way, complete data loss can
be avoided since at least one client must get all of the data.

Also make sure that stdin/stdout/stderr point to /dev/null instead of just
closing them, to avoid confusion.
2004-11-03 20:00:18 +00:00
Ned T. Crigler 05a6e1678e Try to set non-blocking mode when accepting new clients. 2004-10-04 20:19:08 +00:00
Ned T. Crigler 43f172d0ed Updated the man page to use \- everywhere for the dashes in dtach's
command-line options.
2004-08-25 23:38:17 +00:00
Ned T. Crigler 21d386d004 Changed restore_term to remove the Linux-specific escape sequence to restore
the cursor size, which is handled incorrectly by some terminal emulators.
2004-08-25 23:31:06 +00:00
Ned T. Crigler 5c668a88cb dtach 0.7 2004-07-04 16:39:40 +00:00
Ned T. Crigler 945e54166a Add an extra signal call to the win_change function to make sure the SIGWINCH
handler isn't reset on certain systems.
2004-07-01 23:31:39 +00:00
Ned T. Crigler c869233b97 Add documentation for the new redraw option. 2004-07-01 17:17:29 +00:00
Ned T. Crigler a5599b4610 Allow the redraw method to be chosen by the user, and include the old Ctrl L
character method again.
2004-06-24 01:57:02 +00:00
Ned T. Crigler 302917ca33 First attempt at proper process group handling. 2004-06-23 04:48:07 +00:00
Ned T. Crigler 79b7d83ede Changed the attach code to be paranoid about checking the return value of
select when checking the file descriptors for activity.
2004-06-22 17:53:53 +00:00
Ned T. Crigler 2e0a880349 Oops, configure.ac wasn't being added to the tar.gz file created by make tar. 2004-06-21 17:46:31 +00:00
Ned T. Crigler abf2db3509 dtach 0.6 2004-05-26 17:30:44 +00:00
Ned T. Crigler b87318d1f3 Bump version. 2001-11-30 23:25:21 +00:00
Ned T. Crigler f598a8ad34 Applied dtach.spec patch from Trond Eivind Glomsrød <teg@redhat.com>. 2001-11-30 21:56:21 +00:00
Ned T. Crigler 3653366fd8 Fix fd leakage.
Prevent atexit from being called twice on dtach -A.
2001-11-28 22:56:40 +00:00
Ned T. Crigler 203193838d Portability updates thanks to sourceforge's compile farm. dtach should now
work on: FreeBSD, Debian/alpha, Debian/sparc, Debian/PPC, and Solaris.
Bump version.
2001-11-05 20:02:58 +00:00
Ned T. Crigler ba4a3a502f Slightly improved README and dtach.1 2001-09-28 18:40:50 +00:00
Ned T. Crigler 6085f4c79a Modified spec file URL: to point to http://dtach.sourceforge.net 2001-09-28 03:08:14 +00:00
Ned T. Crigler 6ffbd82a64 initial import to sourceforge 2001-09-28 00:50:56 +00:00