Subject: bin/10937: yppasswd crashes
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 09/02/2000 18:24:17
>Number:         10937
>Category:       bin
>Synopsis:       yppasswd crashes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 02 18:25:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Dave Huang
>Release:        NetBSD-1.5_ALPHA2 as of September 1, 2000
>Organization:
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet: khym@bga.com   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 24 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Environment:
	
System: NetBSD yerfable.metonymy.com 1.5_ALPHA2 NetBSD 1.5_ALPHA2 (YERFABLE) #107: Thu Aug 31 02:43:29 CDT 2000 khym@yerfable.metonymy.com:/usr/src.local/sys/arch/alpha/compile/YERFABLE alpha
NetBSD dahan.metonymy.com 1.5_ALPHA2 NetBSD 1.5_ALPHA2 (SPIFF) #338: Fri Aug 25 06:21:24 CDT 2000     khym@dahan.metonymy.com:/usr/src.local/sys/arch/i386/compile/SPIFF i386


>Description:
	Running yppasswd with no argments causes a segmentation faul,
but "passwd -y" works. I don't have Kerberos set up (perhaps it'd work
if I did?)

>How-To-Repeat:
dahan# gdb yppasswd
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsd"...
(gdb) run
Starting program: /usr/obj.i386/usr.bin/passwd/yppasswd

Program received signal SIGSEGV, Segmentation fault.
0x4808b50d in krb5_free_context ()
(gdb) where
#0  0x4808b50d in krb5_free_context ()
#1  0x804abd3 in krb5_end () at /usr/src.local/usr.bin/passwd/krb5_passwd.c:92
#2  0x804a304 in main (argc=1, argv=0xbfbfd974)
    at /usr/src.local/usr.bin/passwd/passwd.c:134
#3  0x80494a1 in ___start ()

>Fix:
Perhaps something like this? krb5_init() calls krb5_init_context(),
which fails, leaving context == NULL (I assume this is okay, since I
don't have Kerberos set up). krb5_end() then calls krb5_free_context()
with a NULL context pointer... *crash*

--- /usr/src/usr.bin/passwd/krb5_passwd.c	Tue Jun 20 01:00:37 2000
+++ krb5_passwd.c	Sat Sep  2 20:05:03 2000
@@ -89,7 +89,8 @@
 {
     if(defprinc)
 	krb5_free_principal(context, defprinc);
-    krb5_free_context(context);
+    if(context)
+	krb5_free_context(context);
 }
>Release-Note:
>Audit-Trail:
>Unformatted: