aboutsummaryrefslogtreecommitdiff
path: root/lib/libpam/modules/pam_ssh/pam_ssh.c
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2016-01-20 09:50:54 +0000
committerGlen Barber <gjb@FreeBSD.org>2016-01-20 09:50:54 +0000
commit59d43d11fe3e3f490ad5fce4d0349e9eeaf8d765 (patch)
treeb62bad40f6761e8b139ebb94b63befbbbfc84604 /lib/libpam/modules/pam_ssh/pam_ssh.c
parenta11378bd93b579413444d7d4d2c102fa77580205 (diff)
parent7acd784290df33b5ff70f1f3f894ad64e9c25788 (diff)
downloadsrc-59d43d11fe3e3f490ad5fce4d0349e9eeaf8d765.tar.gz
src-59d43d11fe3e3f490ad5fce4d0349e9eeaf8d765.zip
MFH
Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/projects/release-pkg/; revision=294408
Diffstat (limited to 'lib/libpam/modules/pam_ssh/pam_ssh.c')
-rw-r--r--lib/libpam/modules/pam_ssh/pam_ssh.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/libpam/modules/pam_ssh/pam_ssh.c b/lib/libpam/modules/pam_ssh/pam_ssh.c
index 405dd6bbf416..8fc68fd324f4 100644
--- a/lib/libpam/modules/pam_ssh/pam_ssh.c
+++ b/lib/libpam/modules/pam_ssh/pam_ssh.c
@@ -321,12 +321,11 @@ pam_ssh_start_agent(pam_handle_t *pamh)
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 +335,7 @@ pam_ssh_add_keys_to_agent(pam_handle_t *pamh)
}
/* 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 +346,7 @@ pam_ssh_add_keys_to_agent(pam_handle_t *pamh)
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 +357,11 @@ pam_ssh_add_keys_to_agent(pam_handle_t *pamh)
}
}
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);