password API needed

Luke Kenneth Casson Leighton lkcl at switchboard.net
Tue May 19 12:59:01 GMT 1998


On Mon, 18 May 1998, Jeremy Allison wrote:

> Luke Kenneth Casson Leighton wrote:
> > 
> > and if a function pointer is NULL, then a default / conversion routine
> > could be called instead.
> > 
> > hey, cool!
> > 
> 
> No, then you core dump to tell the idiot who initialized
> the structure to write or point to the correct functions 
> for their particular database.

ok, example to illustrate.  another example is with the database search
capability.  if the database does not have search capability, then the
default "linear" search routine in passdb.c could be used instead.


struct sam_passwd *getsampwent(void *vp)
{
	if (table->getsampwent == NULL && table->getsmbpwent == NULL)
	{
		report_damn_idiot_to_use_correct_functions();
	}

	/* if sampwent supported, use that */
	if (table->getsampwent != NULL)
	{
		return table->getsampwent(vp);
	}

	/* ok - use smbpwent instead and convert */
	return pdb_smb_to_sam(table->getsmbpwent(vp));
}

struct smb_passwd *getsmbpwent(void *vp)
{
	if (table->getsampwent == NULL && table->getsmbpwent == NULL)
	{
		report_damn_idiot_to_use_correct_functions();
	}

	/* if smbpwent supported, use that */
	if (table->getsmbpwent != NULL)
	{
		return table->getsmbpwent(vp);
	}

	/* ok - use sampwent instead and convert */
	return pdb_sam_to_smb(table->getsampwent(vp));
}




More information about the samba-technical mailing list