f5835d
diff -up openssh/auth.c.keycat openssh/misc.c
f5835d
--- openssh/auth.c.keycat	2015-06-24 10:57:50.158849606 +0200
f5835d
+++ openssh/auth.c	2015-06-24 11:04:23.989868638 +0200
f5835d
@@ -966,6 +966,14 @@ subprocess(const char *tag, struct passw
f5835d
 			_exit(1);
f5835d
 		}
f5835d
 
f5835d
+#ifdef WITH_SELINUX
f5835d
+		if (sshd_selinux_setup_env_variables() < 0) {
f5835d
+			error ("failed to copy environment:  %s",
f5835d
+			    strerror(errno));
f5835d
+			_exit(127);
f5835d
+		}
f5835d
+#endif
f5835d
+
f5835d
 		execve(av[0], av, child_env);
f5835d
 		error("%s exec \"%s\": %s", tag, command, strerror(errno));
f5835d
 		_exit(127);
f5835d
diff -up openssh/HOWTO.ssh-keycat.keycat openssh/HOWTO.ssh-keycat
f5835d
--- openssh/HOWTO.ssh-keycat.keycat	2015-06-24 10:57:50.157849608 +0200
f5835d
+++ openssh/HOWTO.ssh-keycat	2015-06-24 10:57:50.157849608 +0200
f5835d
@@ -0,0 +1,12 @@
f5835d
+The ssh-keycat retrieves the content of the ~/.ssh/authorized_keys
f5835d
+of an user in any environment. This includes environments with
f5835d
+polyinstantiation of home directories and SELinux MLS policy enabled.
f5835d
+
f5835d
+To use ssh-keycat, set these options in /etc/ssh/sshd_config file:
f5835d
+        AuthorizedKeysCommand /usr/libexec/openssh/ssh-keycat
f5835d
+        AuthorizedKeysCommandUser root
f5835d
+
f5835d
+Do not forget to enable public key authentication:
f5835d
+        PubkeyAuthentication yes
f5835d
+
f5835d
+
f5835d
diff -up openssh/Makefile.in.keycat openssh/Makefile.in
f5835d
--- openssh/Makefile.in.keycat	2015-06-24 10:57:50.152849621 +0200
f5835d
+++ openssh/Makefile.in	2015-06-24 10:57:50.157849608 +0200
f5835d
@@ -27,6 +27,7 @@ SFTP_SERVER=$(libexecdir)/sftp-server
f5835d
 SSH_KEYSIGN=$(libexecdir)/ssh-keysign
f5835d
 SSH_LDAP_HELPER=$(libexecdir)/ssh-ldap-helper
f5835d
 SSH_LDAP_WRAPPER=$(libexecdir)/ssh-ldap-wrapper
f5835d
+SSH_KEYCAT=$(libexecdir)/ssh-keycat
f5835d
 SSH_PKCS11_HELPER=$(libexecdir)/ssh-pkcs11-helper
f5835d
 PRIVSEP_PATH=@PRIVSEP_PATH@
f5835d
 SSH_PRIVSEP_USER=@SSH_PRIVSEP_USER@
f5835d
@@ -52,6 +52,7 @@ K5LIBS=@K5LIBS@
f5835d
 GSSLIBS=@GSSLIBS@
f5835d
 SSHLIBS=@SSHLIBS@
f5835d
 SSHDLIBS=@SSHDLIBS@
f5835d
+KEYCATLIBS=@KEYCATLIBS@
f5835d
 LIBEDIT=@LIBEDIT@
f5835d
 AR=@AR@
f5835d
 AWK=@AWK@
f5835d
@@ -65,7 +66,7 @@ EXEEXT=@EXEEXT@
f5835d
 MKDIR_P=@MKDIR_P@
f5835d
 INSTALL_SSH_LDAP_HELPER=@INSTALL_SSH_LDAP_HELPER@
f5835d
 
f5835d
-TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) ssh-ldap-helper$(EXEEXT)
f5835d
+TARGETS=ssh$(EXEEXT) sshd$(EXEEXT) ssh-add$(EXEEXT) ssh-keygen$(EXEEXT) ssh-keyscan${EXEEXT} ssh-keysign${EXEEXT} ssh-pkcs11-helper$(EXEEXT) ssh-agent$(EXEEXT) scp$(EXEEXT) sftp-server$(EXEEXT) sftp$(EXEEXT) ssh-ldap-helper$(EXEEXT) ssh-keycat$(EXEEXT)
f5835d
 
f5835d
 XMSS_OBJS=\
f5835d
 	ssh-xmss.o \
f5835d
@@ -190,6 +191,9 @@ ssh-pkcs11-helper$(EXEEXT): $(LIBCOMPAT)
f5835d
 ssh-ldap-helper$(EXEEXT): $(LIBCOMPAT) libssh.a ldapconf.o ldapbody.o ldapmisc.o ldap-helper.o
0d83e7
 	$(LD) -o $@ ldapconf.o ldapbody.o ldapmisc.o ldap-helper.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh -lopenbsd-compat $(LIBS) $(LDAPLIBS)
f5835d
 
f5835d
+ssh-keycat$(EXEEXT): $(LIBCOMPAT) $(SSHDOBJS) libssh.a ssh-keycat.o uidswap.o
0d83e7
+	$(LD) -o $@ ssh-keycat.o uidswap.o $(LDFLAGS) -lssh -lopenbsd-compat $(KEYCATLIBS) $(LIBS)
f5835d
+
f5835d
 ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
f5835d
 	$(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS)
f5835d
 
f5835d
@@ -321,6 +325,7 @@ install-files:
f5835d
 		$(INSTALL) -m 0700 $(STRIP_OPT) ssh-ldap-helper $(DESTDIR)$(SSH_LDAP_HELPER) ; \
f5835d
 		$(INSTALL) -m 0700 ssh-ldap-wrapper $(DESTDIR)$(SSH_LDAP_WRAPPER) ; \
f5835d
 	fi
f5835d
+	$(INSTALL) -m 0755 $(STRIP_OPT) ssh-keycat$(EXEEXT) $(DESTDIR)$(libexecdir)/ssh-keycat$(EXEEXT)
f5835d
 	$(INSTALL) -m 0755 $(STRIP_OPT) sftp$(EXEEXT) $(DESTDIR)$(bindir)/sftp$(EXEEXT)
f5835d
 	$(INSTALL) -m 0755 $(STRIP_OPT) sftp-server$(EXEEXT) $(DESTDIR)$(SFTP_SERVER)$(EXEEXT)
f5835d
 	$(INSTALL) -m 644 ssh.1.out $(DESTDIR)$(mandir)/$(mansubdir)1/ssh.1
f5835d
diff -up openssh/openbsd-compat/port-linux.h.keycat openssh/openbsd-compat/port-linux.h
f5835d
--- openssh/openbsd-compat/port-linux.h.keycat	2015-06-24 10:57:50.150849626 +0200
f5835d
+++ openssh/openbsd-compat/port-linux.h	2015-06-24 10:57:50.160849601 +0200
f5835d
@@ -25,8 +25,10 @@ void ssh_selinux_setup_pty(char *, const
f5835d
 void ssh_selinux_change_context(const char *);
f5835d
 void ssh_selinux_setfscreatecon(const char *);
f5835d
 
f5835d
+int sshd_selinux_enabled(void);
f5835d
 void sshd_selinux_copy_context(void);
f5835d
 void sshd_selinux_setup_exec_context(char *);
f5835d
+int sshd_selinux_setup_env_variables(void);
f5835d
 #endif
f5835d
 
f5835d
 #ifdef LINUX_OOM_ADJUST
f5835d
diff -up openssh/openbsd-compat/port-linux-sshd.c.keycat openssh/openbsd-compat/port-linux-sshd.c
f5835d
--- openssh/openbsd-compat/port-linux-sshd.c.keycat	2015-06-24 10:57:50.150849626 +0200
f5835d
+++ openssh/openbsd-compat/port-linux-sshd.c	2015-06-24 10:57:50.159849603 +0200
f5835d
@@ -54,6 +54,20 @@ extern Authctxt *the_authctxt;
f5835d
 extern int inetd_flag;
f5835d
 extern int rexeced_flag;
f5835d
 
f5835d
+/* Wrapper around is_selinux_enabled() to log its return value once only */
f5835d
+int
f5835d
+sshd_selinux_enabled(void)
f5835d
+{
f5835d
+	static int enabled = -1;
f5835d
+
f5835d
+	if (enabled == -1) {
f5835d
+		enabled = (is_selinux_enabled() == 1);
f5835d
+		debug("SELinux support %s", enabled ? "enabled" : "disabled");
f5835d
+	}
f5835d
+
f5835d
+	return (enabled);
f5835d
+}
f5835d
+
f5835d
 /* Send audit message */
f5835d
 static int
f5835d
 sshd_selinux_send_audit_message(int success, security_context_t default_context,
f5835d
@@ -308,7 +322,7 @@ sshd_selinux_getctxbyname(char *pwname,
f5835d
 
f5835d
 /* Setup environment variables for pam_selinux */
f5835d
 static int
f5835d
-sshd_selinux_setup_pam_variables(void)
f5835d
+sshd_selinux_setup_variables(int(*set_it)(char *, const char *))
f5835d
 {
f5835d
 	const char *reqlvl;
f5835d
 	char *role;
f5835d
@@ -319,16 +333,16 @@ sshd_selinux_setup_pam_variables(void)
f5835d
 
f5835d
 	ssh_selinux_get_role_level(&role, &reqlvl);
f5835d
 
f5835d
-	rv = do_pam_putenv("SELINUX_ROLE_REQUESTED", role ? role : "");
f5835d
+	rv = set_it("SELINUX_ROLE_REQUESTED", role ? role : "");
f5835d
 
f5835d
 	if (inetd_flag && !rexeced_flag) {
f5835d
 		use_current = "1";
f5835d
 	} else {
f5835d
 		use_current = "";
f5835d
-		rv = rv || do_pam_putenv("SELINUX_LEVEL_REQUESTED", reqlvl ? reqlvl: "");
f5835d
+		rv = rv || set_it("SELINUX_LEVEL_REQUESTED", reqlvl ? reqlvl: "");
f5835d
 	}
f5835d
 
f5835d
-	rv = rv || do_pam_putenv("SELINUX_USE_CURRENT_RANGE", use_current);
f5835d
+	rv = rv || set_it("SELINUX_USE_CURRENT_RANGE", use_current);
f5835d
 
f5835d
 	if (role != NULL)
f5835d
 		free(role);
f5835d
@@ -336,6 +350,24 @@ sshd_selinux_setup_pam_variables(void)
f5835d
 	return rv;
f5835d
 }
f5835d
 
f5835d
+static int
f5835d
+sshd_selinux_setup_pam_variables(void)
f5835d
+{
f5835d
+	return sshd_selinux_setup_variables(do_pam_putenv);
f5835d
+}
f5835d
+
f5835d
+static int
f5835d
+do_setenv(char *name, const char *value)
f5835d
+{
f5835d
+	return setenv(name, value, 1);
f5835d
+}
f5835d
+
f5835d
+int
f5835d
+sshd_selinux_setup_env_variables(void)
f5835d
+{
f5835d
+	return sshd_selinux_setup_variables(do_setenv);
f5835d
+}
f5835d
+
f5835d
 /* Set the execution context to the default for the specified user */
f5835d
 void
f5835d
 sshd_selinux_setup_exec_context(char *pwname)
f5835d
@@ -344,7 +376,7 @@ sshd_selinux_setup_exec_context(char *pw
f5835d
 	int r = 0;
f5835d
 	security_context_t default_ctx = NULL;
f5835d
 
f5835d
-	if (!ssh_selinux_enabled())
f5835d
+	if (!sshd_selinux_enabled())
f5835d
 		return;
f5835d
 
f5835d
 	if (options.use_pam) {
f5835d
@@ -415,7 +447,7 @@ sshd_selinux_copy_context(void)
f5835d
 {
f5835d
 	security_context_t *ctx;
f5835d
 
f5835d
-	if (!ssh_selinux_enabled())
f5835d
+	if (!sshd_selinux_enabled())
f5835d
 		return;
f5835d
 
f5835d
 	if (getexeccon((security_context_t *)&ctx) != 0) {
f5835d
diff -up openssh/platform.c.keycat openssh/platform.c
f5835d
--- openssh/platform.c.keycat	2015-06-24 10:57:50.147849633 +0200
f5835d
+++ openssh/platform.c	2015-06-24 10:57:50.160849601 +0200
f5835d
@@ -103,7 +103,7 @@ platform_setusercontext(struct passwd *p
f5835d
 {
f5835d
 #ifdef WITH_SELINUX
f5835d
 	/* Cache selinux status for later use */
f5835d
-	(void)ssh_selinux_enabled();
f5835d
+	(void)sshd_selinux_enabled();
f5835d
 #endif
f5835d
 
f5835d
 #ifdef USE_SOLARIS_PROJECTS
f5835d
diff -up openssh/ssh-keycat.c.keycat openssh/ssh-keycat.c
f5835d
--- openssh/ssh-keycat.c.keycat	2015-06-24 10:57:50.161849599 +0200
f5835d
+++ openssh/ssh-keycat.c	2015-06-24 10:57:50.161849599 +0200
f5835d
@@ -0,0 +1,241 @@
f5835d
+/*
f5835d
+ * Redistribution and use in source and binary forms, with or without
f5835d
+ * modification, are permitted provided that the following conditions
f5835d
+ * are met:
f5835d
+ * 1. Redistributions of source code must retain the above copyright
f5835d
+ *    notice, and the entire permission notice in its entirety,
f5835d
+ *    including the disclaimer of warranties.
f5835d
+ * 2. Redistributions in binary form must reproduce the above copyright
f5835d
+ *    notice, this list of conditions and the following disclaimer in the
f5835d
+ *    documentation and/or other materials provided with the distribution.
f5835d
+ * 3. The name of the author may not be used to endorse or promote
f5835d
+ *    products derived from this software without specific prior
f5835d
+ *    written permission.
f5835d
+ *
f5835d
+ * ALTERNATIVELY, this product may be distributed under the terms of
f5835d
+ * the GNU Public License, in which case the provisions of the GPL are
f5835d
+ * required INSTEAD OF the above restrictions.  (This clause is
f5835d
+ * necessary due to a potential bad interaction between the GPL and
f5835d
+ * the restrictions contained in a BSD-style copyright.)
f5835d
+ *
f5835d
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
f5835d
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
f5835d
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f5835d
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
f5835d
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
f5835d
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
f5835d
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
f5835d
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
f5835d
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
f5835d
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
f5835d
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
f5835d
+ */
f5835d
+
f5835d
+/*
f5835d
+ * Copyright (c) 2011 Red Hat, Inc.
f5835d
+ * Written by Tomas Mraz <tmraz@redhat.com>
f5835d
+*/
f5835d
+
f5835d
+#define _GNU_SOURCE
f5835d
+
f5835d
+#include "config.h"
f5835d
+#include <stdio.h>
f5835d
+#include <stdlib.h>
f5835d
+#include <string.h>
f5835d
+#include <sys/types.h>
f5835d
+#include <sys/stat.h>
f5835d
+#include <pwd.h>
f5835d
+#include <fcntl.h>
f5835d
+#include <unistd.h>
f5835d
+#ifdef HAVE_STDINT_H
f5835d
+#include <stdint.h>
f5835d
+#endif
f5835d
+
f5835d
+#include <security/pam_appl.h>
f5835d
+
f5835d
+#include "uidswap.h"
f5835d
+#include "misc.h"
f5835d
+
f5835d
+#define ERR_USAGE 1
f5835d
+#define ERR_PAM_START 2
f5835d
+#define ERR_OPEN_SESSION 3
f5835d
+#define ERR_CLOSE_SESSION 4
f5835d
+#define ERR_PAM_END 5
f5835d
+#define ERR_GETPWNAM 6
f5835d
+#define ERR_MEMORY 7
f5835d
+#define ERR_OPEN 8
f5835d
+#define ERR_FILE_MODE 9
f5835d
+#define ERR_FDOPEN 10
f5835d
+#define ERR_STAT 11
f5835d
+#define ERR_WRITE 12
f5835d
+#define ERR_PAM_PUTENV 13
f5835d
+#define BUFLEN 4096
f5835d
+
f5835d
+/* Just ignore the messages in the conversation function */
f5835d
+static int
f5835d
+dummy_conv(int num_msg, const struct pam_message **msgm,
f5835d
+	   struct pam_response **response, void *appdata_ptr)
f5835d
+{
f5835d
+	struct pam_response *rsp;
f5835d
+
f5835d
+	(void)msgm;
f5835d
+	(void)appdata_ptr;
f5835d
+
f5835d
+	if (num_msg <= 0)
f5835d
+		return PAM_CONV_ERR;
f5835d
+
f5835d
+	/* Just allocate the array as empty responses */
f5835d
+	rsp = calloc (num_msg, sizeof (struct pam_response));
f5835d
+	if (rsp == NULL)
f5835d
+		return PAM_CONV_ERR;
f5835d
+
f5835d
+	*response = rsp;
f5835d
+	return PAM_SUCCESS;
f5835d
+}
f5835d
+
f5835d
+static struct pam_conv conv = {
f5835d
+	dummy_conv,
f5835d
+	NULL
f5835d
+};
f5835d
+
f5835d
+char *
f5835d
+make_auth_keys_name(const struct passwd *pwd)
f5835d
+{
f5835d
+	char *fname;
f5835d
+
f5835d
+	if (asprintf(&fname, "%s/.ssh/authorized_keys", pwd->pw_dir) < 0)
f5835d
+		return NULL;
f5835d
+
f5835d
+	return fname;
f5835d
+}
f5835d
+
f5835d
+int
f5835d
+dump_keys(const char *user)
f5835d
+{
f5835d
+	struct passwd *pwd;
f5835d
+	int fd = -1;
f5835d
+	FILE *f = NULL;
f5835d
+	char *fname = NULL;
f5835d
+	int rv = 0;
f5835d
+	char buf[BUFLEN];
f5835d
+	size_t len;
f5835d
+	struct stat st;
f5835d
+
f5835d
+	if ((pwd = getpwnam(user)) == NULL) {
f5835d
+		return ERR_GETPWNAM;
f5835d
+	}
f5835d
+
f5835d
+	if ((fname = make_auth_keys_name(pwd)) == NULL) {
f5835d
+		return ERR_MEMORY;
f5835d
+	}
f5835d
+
f5835d
+	temporarily_use_uid(pwd);
f5835d
+
f5835d
+	if ((fd = open(fname, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) < 0) {
f5835d
+		rv = ERR_OPEN;
f5835d
+		goto fail;
f5835d
+	}
f5835d
+
f5835d
+	if (fstat(fd, &st) < 0) {
f5835d
+		rv = ERR_STAT;
f5835d
+		goto fail;
f5835d
+	}
f5835d
+
f5835d
+	if (!S_ISREG(st.st_mode) || 
f5835d
+		(st.st_uid != pwd->pw_uid && st.st_uid != 0)) {
f5835d
+		rv = ERR_FILE_MODE;
f5835d
+		goto fail;
f5835d
+	}
f5835d
+
f5835d
+	unset_nonblock(fd);
f5835d
+
f5835d
+	if ((f = fdopen(fd, "r")) == NULL) {
f5835d
+		rv = ERR_FDOPEN;
f5835d
+		goto fail;
f5835d
+	}
f5835d
+
f5835d
+	fd = -1;
f5835d
+
f5835d
+	while ((len = fread(buf, 1, sizeof(buf), f)) > 0) {
f5835d
+		rv = fwrite(buf, 1, len, stdout) != len ? ERR_WRITE : 0;
f5835d
+	}
f5835d
+
f5835d
+fail:
f5835d
+	if (fd != -1)
f5835d
+		close(fd);
f5835d
+	if (f != NULL)
f5835d
+		fclose(f);
f5835d
+	free(fname);
f5835d
+	restore_uid();
f5835d
+	return rv;
f5835d
+}
f5835d
+
f5835d
+static const char *env_names[] = { "SELINUX_ROLE_REQUESTED",
f5835d
+	"SELINUX_LEVEL_REQUESTED",
f5835d
+	"SELINUX_USE_CURRENT_RANGE"
f5835d
+};
f5835d
+
f5835d
+extern char **environ;
f5835d
+
f5835d
+int
f5835d
+set_pam_environment(pam_handle_t *pamh)
f5835d
+{
f5835d
+	int i;
f5835d
+	size_t j;
f5835d
+
f5835d
+	for (j = 0; j < sizeof(env_names)/sizeof(env_names[0]); ++j) {
f5835d
+		int len = strlen(env_names[j]);
f5835d
+
f5835d
+		for (i = 0; environ[i] != NULL; ++i) {
f5835d
+			if (strncmp(env_names[j], environ[i], len) == 0 &&
f5835d
+			    environ[i][len] == '=') {
f5835d
+				if (pam_putenv(pamh, environ[i]) != PAM_SUCCESS)
f5835d
+					return ERR_PAM_PUTENV;
f5835d
+			}
f5835d
+		}
f5835d
+	}
f5835d
+
f5835d
+	return 0;
f5835d
+}
f5835d
+
f5835d
+int
f5835d
+main(int argc, char *argv[])
f5835d
+{
f5835d
+	pam_handle_t *pamh = NULL;
f5835d
+	int retval;
f5835d
+	int ev = 0;
f5835d
+
f5835d
+	if (argc != 2) {
f5835d
+		fprintf(stderr, "Usage: %s <user-name>\n", argv[0]);
f5835d
+		return ERR_USAGE;
f5835d
+	}
f5835d
+
f5835d
+	retval = pam_start("ssh-keycat", argv[1], &conv, &pamh);
f5835d
+	if (retval != PAM_SUCCESS) {
f5835d
+		return ERR_PAM_START;
f5835d
+	}
f5835d
+
f5835d
+	ev = set_pam_environment(pamh);
f5835d
+	if (ev != 0)
f5835d
+		goto finish;
f5835d
+
f5835d
+	retval = pam_open_session(pamh, PAM_SILENT);
f5835d
+	if (retval != PAM_SUCCESS) {
f5835d
+		ev = ERR_OPEN_SESSION;
f5835d
+		goto finish;
f5835d
+	}
f5835d
+
f5835d
+	ev = dump_keys(argv[1]);
f5835d
+
f5835d
+	retval = pam_close_session(pamh, PAM_SILENT);
f5835d
+	if (retval != PAM_SUCCESS) {
f5835d
+		ev = ERR_CLOSE_SESSION;
f5835d
+	}
f5835d
+
f5835d
+finish:
f5835d
+	retval = pam_end (pamh,retval);
f5835d
+	if (retval != PAM_SUCCESS) {
f5835d
+		ev = ERR_PAM_END;
f5835d
+	}
f5835d
+	return ev;
f5835d
+}
f5835d
diff --git a/configure.ac b/configure.ac
f5835d
index 3bbccfd..6481f1f 100644
f5835d
--- a/configure.ac
f5835d
+++ b/configure.ac
f5835d
@@ -2952,6 +2952,7 @@ AC_ARG_WITH([pam],
f5835d
 			PAM_MSG="yes"
f5835d
 
f5835d
 			SSHDLIBS="$SSHDLIBS -lpam"
f5835d
+			KEYCATLIBS="$KEYCATLIBS -lpam"
f5835d
 			AC_DEFINE([USE_PAM], [1],
f5835d
 				[Define if you want to enable PAM support])
f5835d
 
f5835d
@@ -3105,6 +3106,7 @@
f5835d
 					;;
f5835d
 				*)
f5835d
 					SSHDLIBS="$SSHDLIBS -ldl"
f5835d
+					KEYCATLIBS="$KEYCATLIBS -ldl"
f5835d
 					;;
f5835d
 				esac
f5835d
 			fi
f5835d
@@ -4042,6 +4044,7 @@ AC_ARG_WITH([selinux],
f5835d
 )
f5835d
 AC_SUBST([SSHLIBS])
f5835d
 AC_SUBST([SSHDLIBS])
f5835d
+AC_SUBST([KEYCATLIBS])
f5835d
 
f5835d
 # Check whether user wants Kerberos 5 support
f5835d
 KRB5_MSG="no"
f5835d
@@ -5031,6 +5034,9 @@ fi
f5835d
 if test ! -z "${SSHLIBS}"; then
f5835d
 echo "          +for ssh: ${SSHLIBS}"
f5835d
 fi
f5835d
+if test ! -z "${KEYCATLIBS}"; then
f5835d
+echo "   +for ssh-keycat: ${KEYCATLIBS}"
f5835d
+fi
f5835d
 
f5835d
 echo ""
f5835d