Deleted Added
full compact
auth-pam.c (149753) auth-pam.c (157019)
1/*-
2 * Copyright (c) 2002 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by ThinkSec AS and
6 * NAI Labs, the Security Research Division of Network Associates, Inc.
7 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
8 * DARPA CHATS research program.

--- 33 unchanged lines hidden (view full) ---

42 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
43 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
44 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
45 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46 */
47
48/* Based on $xFreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */
49#include "includes.h"
1/*-
2 * Copyright (c) 2002 Networks Associates Technology, Inc.
3 * All rights reserved.
4 *
5 * This software was developed for the FreeBSD Project by ThinkSec AS and
6 * NAI Labs, the Security Research Division of Network Associates, Inc.
7 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
8 * DARPA CHATS research program.

--- 33 unchanged lines hidden (view full) ---

42 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
43 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
44 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
45 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46 */
47
48/* Based on $xFreeBSD: src/crypto/openssh/auth2-pam-freebsd.c,v 1.11 2003/03/31 13:48:18 des Exp $ */
49#include "includes.h"
50RCSID("$Id: auth-pam.c,v 1.126 2005/07/17 07:18:50 djm Exp $");
51RCSID("$FreeBSD: head/crypto/openssh/auth-pam.c 149753 2005-09-03 07:04:25Z des $");
50RCSID("$Id: auth-pam.c,v 1.128 2006/01/29 05:46:13 dtucker Exp $");
51RCSID("$FreeBSD: head/crypto/openssh/auth-pam.c 157019 2006-03-22 20:41:37Z des $");
52
53#ifdef USE_PAM
54#if defined(HAVE_SECURITY_PAM_APPL_H)
55#include <security/pam_appl.h>
56#elif defined (HAVE_PAM_PAM_APPL_H)
57#include <pam/pam_appl.h>
58#endif
59

--- 652 unchanged lines hidden (view full) ---

712 len = plen + mlen + 2;
713 **prompts = xrealloc(**prompts, len);
714 strlcpy(**prompts + plen, msg, len - plen);
715 plen += mlen;
716 strlcat(**prompts + plen, "\n", len - plen);
717 plen++;
718 xfree(msg);
719 break;
52
53#ifdef USE_PAM
54#if defined(HAVE_SECURITY_PAM_APPL_H)
55#include <security/pam_appl.h>
56#elif defined (HAVE_PAM_PAM_APPL_H)
57#include <pam/pam_appl.h>
58#endif
59

--- 652 unchanged lines hidden (view full) ---

712 len = plen + mlen + 2;
713 **prompts = xrealloc(**prompts, len);
714 strlcpy(**prompts + plen, msg, len - plen);
715 plen += mlen;
716 strlcat(**prompts + plen, "\n", len - plen);
717 plen++;
718 xfree(msg);
719 break;
720 case PAM_SUCCESS:
721 case PAM_AUTH_ERR:
720 case PAM_AUTH_ERR:
721 debug3("PAM: PAM_AUTH_ERR");
722 if (**prompts != NULL && strlen(**prompts) != 0) {
723 *info = **prompts;
724 **prompts = NULL;
725 *num = 0;
726 **echo_on = 0;
727 ctxt->pam_done = -1;
728 return 0;
729 }
730 /* FALLTHROUGH */
731 case PAM_SUCCESS:
722 if (**prompts != NULL) {
723 /* drain any accumulated messages */
724 debug("PAM: %s", **prompts);
725 buffer_append(&loginmsg, **prompts,
726 strlen(**prompts));
727 xfree(**prompts);
728 **prompts = NULL;
729 }

--- 29 unchanged lines hidden (view full) ---

759
760/* XXX - see also comment in auth-chall.c:verify_response */
761static int
762sshpam_respond(void *ctx, u_int num, char **resp)
763{
764 Buffer buffer;
765 struct pam_ctxt *ctxt = ctx;
766
732 if (**prompts != NULL) {
733 /* drain any accumulated messages */
734 debug("PAM: %s", **prompts);
735 buffer_append(&loginmsg, **prompts,
736 strlen(**prompts));
737 xfree(**prompts);
738 **prompts = NULL;
739 }

--- 29 unchanged lines hidden (view full) ---

769
770/* XXX - see also comment in auth-chall.c:verify_response */
771static int
772sshpam_respond(void *ctx, u_int num, char **resp)
773{
774 Buffer buffer;
775 struct pam_ctxt *ctxt = ctx;
776
767 debug2("PAM: %s entering, %d responses", __func__, num);
777 debug2("PAM: %s entering, %u responses", __func__, num);
768 switch (ctxt->pam_done) {
769 case 1:
770 sshpam_authenticated = 1;
771 return (0);
772 case 0:
773 break;
774 default:
775 return (-1);

--- 395 unchanged lines hidden ---
778 switch (ctxt->pam_done) {
779 case 1:
780 sshpam_authenticated = 1;
781 return (0);
782 case 0:
783 break;
784 default:
785 return (-1);

--- 395 unchanged lines hidden ---