password API needed

Jean-Francois Micouleau Jean-Francois.Micouleau at
Thu May 7 19:48:31 GMT 1998

On Fri, 8 May 1998, Luke Kenneth Casson Leighton wrote:

you want to heat the discussion, OK :-)

> /*The following definitions come from  passdb.c  */
> struct smb_passwd *getsampwnam(char *name);
> struct smb_passwd *getsampwuid(unsigned int uid);

> void *startsampwent(BOOL update);
> void endsampwent(void *vp);
> struct smb_passwd *getsampwent(void *vp);

> unsigned long getsampwpos(void *vp);
> BOOL setsampwpos(void *vp, unsigned long tok);

> BOOL add_sampwd_entry(struct smb_passwd *newpwd);
> BOOL mod_sampwd_entry(struct smb_passwd* pwd, BOOL override);

If I understand (my english is limited), those are the function exported
by passdb.c to the others parts of samba ? 

I know Jeremy wants the Unix semantics in samba, and I agree. But I would
prefer a simpler getsampwent() function that lookup user based on filters
and which return a linked-list directly. Think of backend like SQL for

what are:
	unsigned long getsampwpos(void *vp);
	BOOL setsampwpos(void *vp, unsigned long tok);

why do you want to move in the file ? The core samba doesn't know anything
about the backend. This function have no existence.

> and i plan to have it look like this:
> struct sam_passwd *getsampwnam(char *name);
> struct sam_passwd *getsampwuid(unsigned int uid);
> ...
> i prefer 1) as a cleaner approach: what if an API writer forgets to update
> both sets of information.  two "smb_passwd_to_SAM_USER_INFO_21" and
> vice-versa functions can be written, which convert between these two
> structures.  they would hide the call of user_rid_to_uid and
> group_rid_to_gid and back again.

and why not a simpler struct with all the infos in ascii ?

and you have two conversions functions:

smb_passwd *complete_to_smb(complete)

SAM_USER_21 *complete_to_21(complete)

Pinky: "What are we going to do tonight, Brain?"
Brain: "The same thing we do every night, Pinky :
	try to install Windows NT !"

More information about the samba-technical mailing list