NetBSD Problem Report #61091

From www@netbsd.org  Mon Nov 30 00:42:05 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 088171A923B
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 30 Nov 2026 00:42:05 +0000 (UTC)
Message-Id: <20261130004203.A2FE41A923D@mollari.NetBSD.org>
Date: Mon, 30 Nov 2026 00:42:03 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: MKPAM=no kerberized su(1) is busted
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         61091
>Category:       bin
>Synopsis:       MKPAM=no kerberized su(1) is busted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    riastradh
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 30 00:45:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Mon Nov 30 02:25:01 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, 8, 7, ...
>Organization:
Union of Soviet Socialist Kerpublics, pam_inc
>Environment:
>Description:

	$ su riastradh
	riastradh@EXAMPLE.COM's Password:
	su: chown 0x7e3294e318a0: No such file or directory

	Happened because a change in 2012 to make it build after a
	Heimdal update wasn't quite enough to make it _work_ after a
	Heimdal update:

-	ret = krb5_cc_gen_new(context, &krb5_mcc_ops, &ccache);
+	ret = krb5_cc_new_unique(context, krb5_mcc_ops.prefix, NULL, &ccache);
...
-	ret = krb5_cc_gen_new(context, &krb5_fcc_ops, &ccache2);
+	ret = krb5_cc_new_unique(context, krb5_mcc_ops.prefix, NULL, &ccache2);

	https://mail-index.netbsd.org/source-changes/2012/04/12/msg033638.html

	(Can you spot the typo?  Spoilers below!)

>How-To-Repeat:

	1. build with MKPAM=no MKKERBEROS=yes
	2. su <user>

>Fix:

	s/krb5_mcc_ops/krb5_fcc_ops/1 in the second hunk so that we
	write the credentials from an in-memory cache to a file cache
	instead of just to a second in-memory cache.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Mon, 30 Nov 2026 00:57:53 +0000
Responsible-Changed-Why:
preparing a fix along with PR 61084


State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 30 Nov 2026 02:24:13 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11 and pullup-10
(though one wonders whether anyone cares about this code path!)


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/61091 CVS commit: src/usr.bin/su
Date: Mon, 30 Nov 2026 02:22:39 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Nov 30 02:22:39 UTC 2026

 Modified Files:
 	src/usr.bin/su: su.c

 Log Message:
 su(1): Fix kerberized path with MKPAM=no MKKERBEROS=yes.

 Fixes:

 	$ su riastradh
 	riastradh@EXAMPLE.COM's Password:
 	su: chown 0x7e3294e318a0: No such file or directory

 After using the target user's password to get credentials (that is, a
 ticket-granting ticket) into an in-memory cache and verifying the
 credentials are valid, don't copy them into _another_ in-memory cache
 and then chown it -- that makes no sense and doesn't work.  Instead,
 copy them into a _file_ cache.

 This was broken in 2012 with a build fix that apparently nobody has
 ever tested since:

 https://mail-index.netbsd.org/source-changes/2012/04/12/msg033638.html

 PR bin/61091: MKPAM=no kerberized su(1) is busted


 To generate a diff of this commit:
 cvs rdiff -u -r1.75 -r1.76 src/usr.bin/su/su.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.