Re: password API needed

Jean-Francois Micouleau (Jean-Francois.Micouleau@utc.fr)
Thu, 7 May 1998 21:48:31 +0200 (MET DST)

Date:	Thu, 7 May 1998 21:48:31 +0200 (MET DST)
From:	Jean-Francois Micouleau <Jean-Francois.Micouleau@utc.fr>
To:	Luke Kenneth Casson Leighton <lkcl@switchboard.net>
Subject: Re: password API needed
In-Reply-To: <Pine.LNX.3.96.980507180841.98S-100000@regent.push.net>

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
instance.

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 !"
-----------------------------------------------------------