password API needed

Luke Kenneth Casson Leighton lkcl at switchboard.net
Thu May 7 18:18:05 GMT 1998


On Wed, 6 May 1998, Luke Kenneth Casson Leighton wrote:

> ok.  we need a xxx_pwd_xxx api.  these are the functions in smbpass.c:

ok, it looks like this:

/*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);

and i plan to have it look like this:


struct sam_passwd *getsampwnam(char *name);
struct sam_passwd *getsampwuid(unsigned int uid);
....

where struct sam_passwd will be something like:

1) nothing but the sam info.

	typedef sam_passwd SAM_USER_INFO_21

	this will require functions to internally call user_rid_to_uid and
	group_rid_to_gid as soon as possible, should they store data
	by uid not rid (e.g the private/smbpasswd mechanism).

2)

struct sam_passwd
{
	uid_t unix_uid;
	gid_t unix_gid;
	SAM_USER_INFO_21 sam_info;
};

	this provides you with the same information as 1) above, but does
	not necessitate the call to user_rid_to_uid or group_rid_to_gid
	more than once.
3)

struct sam_passwd
{
	struct smb_passwd smb_info;
	SAM_USER_INFO_21  sam_info;
};

	this is a "convenience" suggestion.  the SAM_USER_INFO_21 code
	has its strings stored in UNICODE format.

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.

luke




More information about the samba-technical mailing list