Segfault with "net ads password"

Green, Paul Paul.Green at
Wed Nov 13 08:47:01 GMT 2002


I know you aren't going to be thrilled to hear me say this, but when you
don't get a response from the list, it is an indication that whoever knows
or owns the code in question is probably away from the list or otherwise
distracted.  Asking again is probably not going to help much.  I know it
isn't easy, but I suggest that you take a deep breath and start inserting
additional DEBUG** statements to work your way thru the logic of the code.
In my experience, finding these sorts of problems when you don't know the
source code, but do know the programming language and the general system
calls involved takes about a day or two of hard work.  If you have a nice
repeatable test case, then count yourself lucky.  By struggling through and
debugging it yourself, you will learn a lot about the modules and the code
involved, and that can be worth the trouble.  

**DEBUG is the Samba macro for printing out info into the log file. While
cryptic at first glance, a few minutes of study should reveal how it works,
and permit you to add more of them in key places.

Oh, and thanks for your patience.  By the way, sending HTML mail to this
list is generally a poor idea; anyone reading the mail in digest form will
see the raw HTML and probably ignore the mail.  Even some ordinary mail
programs still don't deal with HTML mail.  This alone might cause some
people to ignore your otherwise clearly-written posts. Note that there is
nothing in your letter that requires the use of HTML.  Perhaps you can
adjust your mail client to send text instead.

Paul Green, Senior Technical Consultant, Stratus Technologies. 
Voice: +1 (978) 461-7557; FAX: +1 (978) 461-3610 
Speaking from Stratus not for Stratus 
-----Original Message-----
From: James Willard [mailto:james at]
Sent: Monday, November 11, 2002 6:48 PM
To: samba-technical at
Subject: FW: Segfault with "net ads password"

Hi All,

I'm still having the issues I've described below. I've tried to give as much
detail as possible, and I'm hoping to help fix this segfault bug in what
will become Samba 3. I don't believe that this problem is isolated to me and
I do believe that it does affect every other user. Please help me and allow
me to help the Samba project.


James Willard
james at

-----Original Message-----
From: samba-technical-admin at
[mailto:samba-technical-admin at] On Behalf Of James Willard
Sent: Friday, November 01, 2002 6:04 PM
To: 'Esh, Andrew'; samba-technical at
Subject: RE: Segfault with "net ads password"


It seems like you're right about the null pointer. Given the code block you
mentioned, I rebuilt with --enable-krb5developer and ran gdb over it again
with a breakpoint at net_ads_password() and displaying ads, ads->auth, and
ads->auth.kdc_server. The following is the output from gdb at the line just
before line 885 where kerberos_set_password() is called:

3: ads->auth = {realm = 0x0, password = 0x0, user_name = 0x0, kdc_server =
0x0, flags = 0, time_offset = 0}
2: ads->auth.kdc_server = 0x0
1: ads = (ADS_STRUCT *) 0x81af8e0

And of course, the call itself... null values and all...
(usernames/passwords substituted)

kerberos_set_password (kpasswd_server=0x0, auth_principal=0x815c560
Admin at DOMAIN.COM, 
    auth_password=0x815c57c "Adminpass", target_principal=0xbffffbe5
User at DOMAIN.COM, 
    new_password=0x81535a0 "User", time_offset=0) at libads/krb5_setpw.c:470
470         return krb5_set_password(kpasswd_server, target_principal,
new_password, time_offset);

Ok, this officially goes beyond my abilities... who maintains the "net ads"
portion of Samba that could help me look into this further?


James Willard
james at

-----Original Message-----
From: Esh, Andrew [mailto:AEsh at] 
Sent: Friday, November 01, 2002 4:54 PM
To: 'James Willard'; samba-technical at
Subject: RE: Segfault with "net ads password"
Importance: High

Looks like this bit of code is failing: 
utils/net_ads.c, lines 877-886, function "net_ads_password" 
    /* use the realm so we can eventually change passwords for users 
    in realms other than default */ 
    if (!(ads = ads_init(realm, NULL, NULL))) return -1; 
    asprintf(&prompt, "Enter new password for %s:", argv[0]); 
    new_password = getpass(prompt); 
    ret = kerberos_set_password(ads->auth.kdc_server, auth_principal, 
                                auth_password, argv[0], new_password,
the last line is reached with "ads->auth.kdc_server" as a bad (null?)
pointer.  The "ads_init" function creates the ads structure and zeroes it.
It doesn't appear to me as though "ads_init" initializes ads->auth, and I
don't see where else it gets set.
-----Original Message----- 
From: James Willard [mailto:james at] 
Sent: Friday, November 01, 2002 2:23 PM 
To: samba-technical at 
Subject: RE: Segfault with "net ads password" 

And as a follow-up to myself... The following is a backtrace from gdb: 
Program received signal SIGSEGV, Segmentation fault. 
0x080ec329 in interpret_addr () 
(gdb) bt 
#0  0x080ec329 in interpret_addr () 
#1  0x080ec462 in interpret_addr2 () 
#2  0x080efbe0 in open_udp_socket () 
#3  0x0810f56c in krb5_set_password () 
#4  0x0810fdbf in kerberos_set_password () 
#5  0x0806b17c in net_ads_password () 
#6  0x08068690 in net_run_function () 
#7  0x0806b51c in net_ads () 
#8  0x08068690 in net_run_function () 
#9  0x080697d3 in main () 
#10 0x42017589 in __libc_start_main () from /lib/i686/ 
James Willard 
james at 
-----Original Message----- 
From: samba-technical-admin at 
[mailto:samba-technical-admin at] On Behalf Of James 
Sent: Friday, November 01, 2002 2:12 PM 
To: samba-technical at 
Subject: Segfault with "net ads password" 

I'm trying to troubleshoot a problem I've been having for the past 
several weeks with "net ads password" attempting to change a users' 
password. I'm using the Samba 3.0 CVS tree updated this morning (even 
though there has been no difference in behavior in the past month or 
so). I'm running: 
net ads password UserName at DOMAIN.COM -U Admin at REALM.COM%Password 
I receive a prompt: 
Enter new password for UserName at DOMAIN.COM: 
I enter a password and then it segfaults. Below are excerpts from a 
write(3, "kadmin", 6)                   = 6 
write(3, "\0\0\0\10", 4)                = 4 
write(3, "changepw", 8)                 = 8 
write(3, "\0\0\0\0", 4)                 = 4 
write(3, NULL, 0)                       = 0 
fcntl64(3, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 
close(3)                                = 0 
time(NULL)                              = 1036176903 
gettimeofday({1036176903, 994633}, NULL) = 0 gettimeofday({1036176903, 
995109}, NULL) = 0 
--- SIGSEGV (Segmentation fault) --- 
+++ killed by SIGSEGV +++ 
The operating system is RedHat Linux 7.3 on a PIII with krb5-1.2.5 and 
What other information would be useful in tracking down this bug? 
James Willard 
james at 

More information about the samba-technical mailing list