[Midnightbsd-cvs] src [9228] trunk/lib/libpam/modules/pam_ssh/pam_ssh.c: fix pam_ssh to work with newer openssh 7.3
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Nov 7 08:43:55 EST 2016
Revision: 9228
http://svnweb.midnightbsd.org/src/?rev=9228
Author: laffer1
Date: 2016-11-07 08:43:55 -0500 (Mon, 07 Nov 2016)
Log Message:
-----------
fix pam_ssh to work with newer openssh 7.3
Modified Paths:
--------------
trunk/lib/libpam/modules/pam_ssh/pam_ssh.c
Modified: trunk/lib/libpam/modules/pam_ssh/pam_ssh.c
===================================================================
--- trunk/lib/libpam/modules/pam_ssh/pam_ssh.c 2016-11-05 21:44:57 UTC (rev 9227)
+++ trunk/lib/libpam/modules/pam_ssh/pam_ssh.c 2016-11-07 13:43:55 UTC (rev 9228)
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: release/9.2.0/lib/libpam/modules/pam_ssh/pam_ssh.c 247568 2013-03-01 19:42:50Z des $");
+__FBSDID("$FreeBSD: stable/10/lib/libpam/modules/pam_ssh/pam_ssh.c 296781 2016-03-12 23:53:20Z des $");
#include <sys/param.h>
#include <sys/wait.h>
@@ -57,6 +57,7 @@
#include <openssl/evp.h>
+#define __bounded__(x, y, z)
#include "key.h"
#include "buffer.h"
#include "authfd.h"
@@ -84,7 +85,9 @@
};
static const char *pam_ssh_agent = "/usr/bin/ssh-agent";
-static char *const pam_ssh_agent_argv[] = { "ssh_agent", "-s", NULL };
+static char str_ssh_agent[] = "ssh-agent";
+static char str_dash_s[] = "-s";
+static char *const pam_ssh_agent_argv[] = { str_ssh_agent, str_dash_s, NULL };
static char *const pam_ssh_agent_envp[] = { NULL };
/*
@@ -321,12 +324,11 @@
static int
pam_ssh_add_keys_to_agent(pam_handle_t *pamh)
{
- AuthenticationConnection *ac;
const struct pam_ssh_key *psk;
const char **kfn;
const void *item;
char **envlist, **env;
- int pam_err;
+ int fd, pam_err;
/* switch to PAM environment */
envlist = environ;
@@ -336,7 +338,7 @@
}
/* get a connection to the agent */
- if ((ac = ssh_get_authentication_connection()) == NULL) {
+ if (ssh_get_authentication_socket(&fd) != 0) {
openpam_log(PAM_LOG_DEBUG, "failed to connect to the agent");
pam_err = PAM_SYSTEM_ERR;
goto end;
@@ -347,7 +349,7 @@
pam_err = pam_get_data(pamh, *kfn, &item);
if (pam_err == PAM_SUCCESS && item != NULL) {
psk = item;
- if (ssh_add_identity(ac, psk->key, psk->comment))
+ if (ssh_add_identity(fd, psk->key, psk->comment) == 0)
openpam_log(PAM_LOG_DEBUG,
"added %s to ssh agent", psk->comment);
else
@@ -358,11 +360,11 @@
}
}
pam_err = PAM_SUCCESS;
- end:
+
/* disconnect from agent */
- if (ac != NULL)
- ssh_close_authentication_connection(ac);
+ ssh_close_authentication_socket(fd);
+ end:
/* switch back to original environment */
for (env = environ; *env != NULL; ++env)
free(*env);
More information about the Midnightbsd-cvs
mailing list