View | Details | Raw Unified | Return to bug 536 | Differences between
and this patch

Collapse All | Expand All

(-)acconfig.h (-2 / +2 lines)
Lines 374-381 Link Here
374
/* Some systems put this outside of libc */
374
/* Some systems put this outside of libc */
375
#undef HAVE_NANOSLEEP
375
#undef HAVE_NANOSLEEP
376
376
377
/* Pushing STREAMS modules incorrectly acquires a controlling TTY */
377
/* Define if sshd somehow reacquires a controlling TTY after setsid() */
378
#undef STREAMS_PUSH_ACQUIRES_CTTY
378
#undef SSHD_ACQUIRES_CTTY
379
379
380
/* Define if cmsg_type is not passed correctly */
380
/* Define if cmsg_type is not passed correctly */
381
#undef BROKEN_CMSG_TYPE
381
#undef BROKEN_CMSG_TYPE
(-)configure.ac (-12 / +52 lines)
Lines 51-56 Link Here
51
	CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
51
	CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
52
fi
52
fi
53
53
54
dnl    Checks for libutil functions
55
AC_CHECK_HEADERS(libutil.h)
56
AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
57
AC_CHECK_FUNCS(logout updwtmp logwtmp)
58
54
# Check for some target-specific stuff
59
# Check for some target-specific stuff
55
case "$host" in
60
case "$host" in
56
*-*-aix*)
61
*-*-aix*)
Lines 188-202 Link Here
188
	AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
193
	AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
189
	AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
194
	AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
190
	inet6_default_4in6=yes
195
	inet6_default_4in6=yes
191
	AC_MSG_CHECKING(for broken cmsg_type)
196
	dnl make sure that openpty does not reacquire controlling terminal
197
	AC_MSG_CHECKING(for non-broken openpty)
198
	AC_TRY_RUN(
199
		[
200
#include <stdio.h>
201
#include <sys/fcntl.h>
202
#include <sys/types.h>
203
#include <sys/wait.h>
204
205
int
206
main()
207
{
208
        pid_t pid;
209
        int fd, ptyfd, ttyfd, status;
210
211
	pid = fork();
212
	if (pid < 0) {		/* failed */
213
		exit(1);
214
	} else if (pid > 0) {	/* parent */
215
                waitpid(pid, &status, 0);
216
		if (WIFEXITED(status)) 
217
                	exit(WEXITSTATUS(status));
218
		else
219
			exit(2);
220
        } else {		/* child */
221
                close(0); close(1); close(2);
222
                setsid();
223
                openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
224
                fd = open("/dev/tty", O_RDWR | O_NOCTTY);
225
                if (fd >= 0)
226
                        exit(3);        /* Acquired ctty: broken */
227
                else
228
                        exit(0);        /* Did not acquire ctty: OK */
229
        }
230
}
231
		],
232
		[
233
			AC_MSG_RESULT(yes)
234
		],
235
		[
236
			AC_MSG_RESULT(no)
237
			AC_DEFINE(SSHD_ACQUIRES_CTTY)
238
		]
239
	)
192
	case `uname -r` in
240
	case `uname -r` in
193
	2.0.*)
241
	1.*|2.0.*)
194
		AC_MSG_RESULT(yes)
195
		AC_DEFINE(BROKEN_CMSG_TYPE)
242
		AC_DEFINE(BROKEN_CMSG_TYPE)
196
		;;
243
		;;
197
	*)
198
		AC_MSG_RESULT(no)
199
		;;
200
	esac
244
	esac
201
	;;
245
	;;
202
mips-sony-bsd|mips-sony-newsos4)
246
mips-sony-bsd|mips-sony-newsos4)
Lines 230-236 Link Here
230
	AC_DEFINE(LOGIN_NEEDS_UTMPX)
274
	AC_DEFINE(LOGIN_NEEDS_UTMPX)
231
	AC_DEFINE(LOGIN_NEEDS_TERM)
275
	AC_DEFINE(LOGIN_NEEDS_TERM)
232
	AC_DEFINE(PAM_TTY_KLUDGE)
276
	AC_DEFINE(PAM_TTY_KLUDGE)
233
	AC_DEFINE(STREAMS_PUSH_ACQUIRES_CTTY)
277
	# Pushing STREAMS modules will cause sshd to acquire a controlling tty.
278
	AC_DEFINE(SSHD_ACQUIRES_CTTY)
234
	# hardwire lastlog location (can't detect it on some versions)
279
	# hardwire lastlog location (can't detect it on some versions)
235
	conf_lastlog_location="/var/adm/lastlog"
280
	conf_lastlog_location="/var/adm/lastlog"
236
	AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
281
	AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
Lines 473-483 Link Here
473
	[], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
518
	[], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
474
					LIBS="$LIBS -lc89"]) ]
519
					LIBS="$LIBS -lc89"]) ]
475
)
520
)
476
477
dnl    Checks for libutil functions
478
AC_CHECK_HEADERS(libutil.h)
479
AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
480
AC_CHECK_FUNCS(logout updwtmp logwtmp)
481
521
482
AC_FUNC_STRFTIME
522
AC_FUNC_STRFTIME
483
523
(-)sshd.c (-4 / +4 lines)
Lines 1400-1410 Link Here
1400
	 * setlogin() affects the entire process group.  We don't
1400
	 * setlogin() affects the entire process group.  We don't
1401
	 * want the child to be able to affect the parent.
1401
	 * want the child to be able to affect the parent.
1402
	 */
1402
	 */
1403
#if !defined(STREAMS_PUSH_ACQUIRES_CTTY)
1403
#if !defined(SSHD_ACQUIRES_CTTY)
1404
	/*
1404
	/*
1405
	 * If setsid is called on Solaris, sshd will acquire the controlling
1405
	 * If setsid is called on some platforms, sshd will later acquire a
1406
	 * terminal while pushing STREAMS modules. This will prevent the
1406
	 * controlling terminal, which will cause "could not set controlling
1407
	 * shell from acquiring it later.
1407
	 * tty" errors.
1408
	 */
1408
	 */
1409
	if (!debug_flag && !inetd_flag && setsid() < 0)
1409
	if (!debug_flag && !inetd_flag && setsid() < 0)
1410
		error("setsid: %.100s", strerror(errno));
1410
		error("setsid: %.100s", strerror(errno));

Return to bug 536