Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpam/modules/pam_ssh Adapt to the new API.



details:   https://anonhg.NetBSD.org/src/rev/ba627956d5ff
branches:  trunk
changeset: 807281:ba627956d5ff
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 04 02:51:10 2015 +0000

description:
Adapt to the new API.

diffstat:

 lib/libpam/modules/pam_ssh/pam_ssh.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (66 lines):

diff -r eaf177b1c2ac -r ba627956d5ff lib/libpam/modules/pam_ssh/pam_ssh.c
--- a/lib/libpam/modules/pam_ssh/pam_ssh.c      Sat Apr 04 00:03:12 2015 +0000
+++ b/lib/libpam/modules/pam_ssh/pam_ssh.c      Sat Apr 04 02:51:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pam_ssh.c,v 1.22 2012/01/06 14:04:02 drochner Exp $    */
+/*     $NetBSD: pam_ssh.c,v 1.23 2015/04/04 02:51:10 christos Exp $    */
 
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/lib/libpam/modules/pam_ssh/pam_ssh.c,v 1.40 2004/02/10 10:13:21 des Exp $");
 #else
-__RCSID("$NetBSD: pam_ssh.c,v 1.22 2012/01/06 14:04:02 drochner Exp $");
+__RCSID("$NetBSD: pam_ssh.c,v 1.23 2015/04/04 02:51:10 christos Exp $");
 #endif
 
 #include <sys/param.h>
@@ -352,11 +352,11 @@
 static int
 pam_ssh_add_keys_to_agent(pam_handle_t *pamh)
 {
-       AuthenticationConnection *ac;
        const struct pam_ssh_key *psk;
        const char **kfn;
        char **envlist, **env;
        int pam_err;
+       int agent_fd;
 
        /* switch to PAM environment */
        envlist = environ;
@@ -368,11 +368,12 @@
        }
 
        /* get a connection to the agent */
-       if ((ac = ssh_get_authentication_connection()) == NULL) {
+       if (ssh_get_authentication_socket(&agent_fd) != 0) {
                openpam_log(PAM_LOG_DEBUG,
                    "%s: cannot get authentication connection",
                    __func__);
                pam_err = PAM_SYSTEM_ERR;
+               agent_fd = -1;
                goto end;
        }
 
@@ -382,7 +383,8 @@
                pam_err = pam_get_data(pamh, *kfn, &vp);
                psk = vp;
                if (pam_err == PAM_SUCCESS && psk != NULL) {
-                       if (ssh_add_identity(ac, psk->key, psk->comment))
+                       if (ssh_add_identity_constrained(agent_fd, psk->key,
+                           psk->comment, 0, 0))
                                openpam_log(PAM_LOG_DEBUG,
                                    "added %s to ssh agent", psk->comment);
                        else
@@ -395,8 +397,8 @@
        pam_err = PAM_SUCCESS;
  end:
        /* disconnect from agent */
-       if (ac != NULL)
-               ssh_close_authentication_connection(ac);
+       if (agent_fd != -1)
+               ssh_close_authentication_socket(agent_fd);
 
        /* switch back to original environment */
        for (env = environ; *env != NULL; ++env)



Home | Main Index | Thread Index | Old Index