From owner-svn-src-head@freebsd.org Wed Jan 20 00:26:52 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BAE8A8846C; Wed, 20 Jan 2016 00:26:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 009A01893; Wed, 20 Jan 2016 00:26:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0K0QpbJ095909; Wed, 20 Jan 2016 00:26:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0K0Qpsg095908; Wed, 20 Jan 2016 00:26:51 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201601200026.u0K0Qpsg095908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 20 Jan 2016 00:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294367 - head/lib/libpam/modules/pam_ssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2016 00:26:52 -0000 Author: jhb Date: Wed Jan 20 00:26:50 2016 New Revision: 294367 URL: https://svnweb.freebsd.org/changeset/base/294367 Log: Update for API changes in OpenSSH 6.8p1. First, the authfd API now uses a direct file descriptor for the control socket instead of a more abstract AuthenticationConnection structure. Second, the functions now consistently return an error value. Reviewed by: bdrewery Modified: head/lib/libpam/modules/pam_ssh/pam_ssh.c Modified: head/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- head/lib/libpam/modules/pam_ssh/pam_ssh.c Wed Jan 20 00:14:34 2016 (r294366) +++ head/lib/libpam/modules/pam_ssh/pam_ssh.c Wed Jan 20 00:26:50 2016 (r294367) @@ -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 * } /* 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 * 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 * } } 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);