On Fri, Oct 25, 2002 at 02:39:16AM +0200, Jelmer Vernooij wrote: > On Thu, Oct 24, 2002 at 06:51:38PM -0500, Steve Langasek wrote about 'segfaults in >pam_smbpass in SAMBA_3_0 with unixsam backend': > > Currently, pam_smbpass calls initialize_password_db() with reload == True > > on every pass through the module. This is supposedly the Right Thing > > for the code to do, but recently the "reload" option took on actual > > meaning, and now pam_smbpass segfaults on the second pass when using > > the unixsam backend. :)
> > The nisplus and unixsam backends do not initialize the free_private_data > > method. Do these need to be implemented yet, or should they be stubbed > > off and have error checking added to free_pdb_context() to check for a > > null pointer? > Fixed. (Needed to check for a null pointer, as happens in all other passdb > functions) > Thanks for reporting! And thanks for the quick fix. There's still a problem in the nisplus backend, I believe; a chunk of private_data is allocated but never freed. Fortunately, this is a mere memory leak, and not a segfault. :) Steve Langasek postmodern programmer
Index: pdb_nisplus.c =================================================================== RCS file: /cvsroot/samba/source/passdb/pdb_nisplus.c,v retrieving revision 1.22.2.4 diff -u -r1.22.2.4 pdb_nisplus.c --- pdb_nisplus.c 26 Sep 2002 18:58:15 -0000 1.22.2.4 +++ pdb_nisplus.c 25 Oct 2002 00:07:50 -0000 @@ -1507,6 +1507,19 @@ return result; } +static void free_private_data(void **vp) +{ + struct nisplus_private_info **private = (struct nisplus_private_info **)vp; + + if ((*private)->result) { + nis_freeresult ((*private)->result); + } + + free(*private); + + /* No need to free any further, as it is talloc()ed */ +} + NTSTATUS pdb_init_nisplussam (PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method, const char *location) { @@ -1535,6 +1548,7 @@ (*pdb_method)->add_sam_account = nisplussam_add_sam_account; (*pdb_method)->update_sam_account = nisplussam_update_sam_account; (*pdb_method)->delete_sam_account = nisplussam_delete_sam_account; + (*pdb_method)->free_private_data = free_private_data; (*pdb_method)->private_data = private; return NT_STATUS_OK;
msg03933/pgp00000.pgp
Description: PGP signature