[PATCH] winbind kills nscd on Solaris

Mike Gerdts Michael.Gerdts at alcatel.com
Thu May 9 11:32:36 GMT 2002

The problem:

Solaris has a couple extra fields in struct passwd.  Since getpwent(3c)
says that pw_age and pw_comment are not used, it seems reasonable not to
fill them in.  nscd may not use them, but assumes that they at least are
pointers to allocated buffers.  Since they are are not pointers to
allocated buffers, a SEGV occurs.

Those with Solaris source can see this in
osnet_volume/usr/src/cmd/nscd/getpw.c in fixbuffer().  Adding these
assertions just before the series of strlen()s confirms the problem, as
it fails the check for pw_age.

    assert(in != NULL);
    assert(in->nsc_u.pwd.pw_name != NULL);
    assert(in->nsc_u.pwd.pw_passwd != NULL);
    assert(in->nsc_u.pwd.pw_age != NULL);
    assert(in->nsc_u.pwd.pw_comment != NULL);
    assert(in->nsc_u.pwd.pw_gecos != NULL);
    assert(in->nsc_u.pwd.pw_dir != NULL);
    assert(in->nsc_u.pwd.pw_shell != NULL);

The Solution

The following patch fixes this problem.  If it is blessed as the right
solution, I will create a patch that includes the appropriate checks in
configure.in along with some #ifdefs in the code so it doesn't break
other platforms.


Index: winbind_nss.c
RCS file: /cvsroot/samba/source/nsswitch/winbind_nss.c,v
retrieving revision
diff -c -r1.4.6.4 winbind_nss.c
*** winbind_nss.c	30 Apr 2002 13:27:23 -0000
--- winbind_nss.c	9 May 2002 18:28:53 -0000
*** 594,599 ****
--- 594,600 ----
  				  struct winbindd_pw *pw,
  				  char **buffer, int *buflen)
+	static const char *static_null_string = "";
  	/* User name */
  	if ((result->pw_name = 
*** 656,661 ****
--- 657,665 ----
+	result->pw_age = static_null_string;
+	result->pw_comment = static_null_string;
  	strcpy(result->pw_shell, pw->pw_shell);

More information about the samba-technical mailing list