password API needed

Luke Kenneth Casson Leighton lkcl at switchboard.net
Thu May 7 19:52:57 GMT 1998


On Thu, 7 May 1998, Jean-Francois Micouleau wrote:

> 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 ? 

correct.  no calls (except by the client-side machine_xxx functions in
smbpass.c) to XXXsmbpwXXX or XXXldappwXXX should be made: only to
XXXsampwXXX.

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

then we can create a top-level function that wraps around startsampwent /
getsampwent / endsampwent that does exactly that.  in fact, one already
exists: get_sampwd_entries() in lib/rpc/server/srv_samr.c but it's not
very good: it returns a static array not a linked list

chriiis! help!
 
> 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.

i have no idea.  and you don't _know_ that it's a file: that is
implementation-specific to smbpass.c
 
> > 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)

uh............ hm.  YEAH!  i like it!  in addition, if we convert to the
NT 5 schema, you can add the extra fields to the "simpler struct with all
the infos in ascii".  the complete_to_21 function and the complete_to_smb
functions would be unaffected.

luke



More information about the samba-technical mailing list