From nobody@FreeBSD.org  Wed Mar 13 12:34:03 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id BB6BD37B405
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 13 Mar 2002 12:34:02 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g2DKY2N15690;
	Wed, 13 Mar 2002 12:34:02 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200203132034.g2DKY2N15690@freefall.freebsd.org>
Date: Wed, 13 Mar 2002 12:34:02 -0800 (PST)
From: Juha-Matti Tilli <juha-matti.tilli@pp.inet.fi>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pam_krb5 crashes in pam_sm_setcred()
X-Send-Pr-Version: www-1.0

>Number:         35865
>Category:       misc
>Synopsis:       pam_krb5 crashes in pam_sm_setcred()
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    nectar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 13 12:40:01 PST 2002
>Closed-Date:    Tue Sep 02 06:51:19 PDT 2003
>Last-Modified:  Tue Sep 02 06:51:19 PDT 2003
>Originator:     Juha-Matti Tilli
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
>Environment:
FreeBSD tykki 4.5-RELEASE FreeBSD 4.5-RELEASE #16: Fri Mar  1 19:04:50 EET 2002     juhis@tykki:/usr/obj/usr/src/sys/TYKKI  i386
>Description:
pam_krb5 contains a bug in pam_sm_setcred() which causes login to die on signal 10. I put many DLOG:s to function pam_sm_setcred() and noticed that the bug is in following code:
   while ((krbret = krb5_cc_next_cred(pam_context, ccache_temp,
        &cursor, &creds) == 0)) {
            if ((krbret = krb5_cc_store_cred(pam_context, ccache_perm,
                &creds)) != 0) {
            DLOG("krb5_cc_store_cred()", error_message(krbret));
            (void) krb5_cc_destroy(pam_context, ccache_perm);
            krb5_free_cred_contents(pam_context, &creds);
            pamret = PAM_SERVICE_ERR;
            goto cleanup2;
        }
        krb5_free_cred_contents(pam_context, &creds);
    }

>How-To-Repeat:
Put following lines in login.conf and try to login with kerberos username and password
login   auth    requisite       pam_cleartext_pass_ok.so
login   auth    sufficient      pam_krb5.so                     try_first_pass debug ccache=FILE:/tmp/krb5cc_%u
login   auth    required        pam_unix.so                     try_first_pass debug
login   session sufficient      pam_krb5.so             debug ccache=FILE:/tmp/krb5cc_%u
login   session required        pam_unix.so             debug
#login  password        required        pam_krb5.so
#login  account required        pam_krb5.so



>Fix:

>Release-Note:
>Audit-Trail:

From: Peter Much <pmc@citylink.dinoex.sub.org>
To: juha-matti.tilli@pp.inet.fi
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: misc/35865: pam_krb5 crashes in pam_sm_setcred()
Date: Sun, 24 Nov 2002 03:04:05 +0100 (CET)

 This call seems to have parameters exchanged:
 
    while ((krbret = krb5_cc_next_cred(pam_context, ccache_temp,
              &cursor, &creds) == 0)) {
 
 It works with:
 
    while ((krbret = krb5_cc_next_cred(pam_context, ccache_temp,
              &creds, &cursor) == 0)) {
 
 This is a difference (or inconsistency) with heimdal Kerberos,
 or whoever's to blame. See also this and the followup to it: 
 http://www.stacken.kth.se/lists/heimdal-discuss/2001-04/msg00008.html
 
 Juha-Matti: thanks for precise report, saved me time searching.:-)
 PMc
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Jul 18 15:09:53 PDT 2003 
Responsible-Changed-Why:  
Assign to PAM maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35865 
Responsible-Changed-From-To: des->nectar 
Responsible-Changed-By: des 
Responsible-Changed-When: Tue Aug 19 03:39:21 PDT 2003 
Responsible-Changed-Why:  
This is a Kerberos issue, not a PAM issue 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35865 
State-Changed-From-To: open->closed 
State-Changed-By: nectar 
State-Changed-When: Tue Sep 2 06:50:25 PDT 2003 
State-Changed-Why:  
This was fixed in 4.6-RELEASE (16 months ago) with the import of 
Heimdal 0.4e. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35865 
>Unformatted:
