diff options
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/passdb/passdb.c | 41 |
2 files changed, 23 insertions, 19 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index eac1093450..38d02becea 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1129,6 +1129,7 @@ void pdb_init_smb(struct smb_passwd *user); void pdb_init_sam(struct sam_passwd *user); struct sam_disp_info *pdb_sam_to_dispinfo(struct sam_passwd *user); struct smb_passwd *pdb_sam_to_smb(struct sam_passwd *user); +struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user); char *pdb_encode_acct_ctrl(uint16 acct_ctrl, size_t length); uint16 pdb_decode_acct_ctrl(char *p); time_t pdb_get_last_set_time(char *p); diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 55c64f7622..dbe5a48763 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -56,25 +56,6 @@ DOM_SID global_machine_sid; * */ -#if 0 -static struct smb_passwd *getPDBpwent (void *vp) { return pdb_sam_to_smb(getPDB21pwent(vp)); } -static BOOL add_PDBpwd_entry (struct smb_passwd *newpwd) { return add_PDB21pwd_entry(pdb_smb_to_sam(newpwd)); } -static BOOL mod_PDBpwd_entry (struct smb_passwd* pwd, BOOL override) { return mod_PDB21pwd_entry(pdb_smb_to_sam(pwd), override); } -static struct smb_passwd *getPDBpwnam (char *name) { return pdb_sam_to_smb(getPDB21pwnam(name)); } -static struct smb_passwd *getPDBpwuid (uid_t smb_userid) { return pdb_sam_to_smb(getPDB21pwuid(pdb_uid_to_user_rid(smb_userid))); } - -static struct sam_passwd *getPDB21pwent (void *vp) { return pdb_smb_to_sam(getPDBpwent(vp)); } -static BOOL add_PDB21pwd_entry (struct sam_passwd *newpwd) { return add_PDBpwd_entry(pdb_sam_to_smb(newpwd)); } -static BOOL mod_PDB21pwd_entry (struct sam_passwd* pwd, BOOL override) { return mod_PDBpwd_entry(pdb_sam_to_smb(pwd), override); } -static struct sam_passwd *getPDB21pwnam (char *name) { return pdb_smb_to_sam(getPDBpwnam(name)); } -static struct sam_passwd *getPDB21pwrid (uint32 rid) { return pdb_smb_to_sam(getPDBpwuid(pdb_user_rid_to_uid(rid))); } -static struct sam_passwd *getPDB21pwuid (uid_t uid) { return pdb_smb_to_sam(getPDBpwuid(uid)); } - -static struct sam_disp_info *getPDBdispnam (char *name) { return pdb_sam_to_dispinfo(getPDB21pwnam(name)); } -static struct sam_disp_info *getPDBdisprid (uint32 rid) { return pdb_sam_to_dispinfo(getPDB21pwrid(rid)); } -static struct sam_disp_info *getPDBdispent (void *vp) { return pdb_sam_to_dispinfo(getPDB21pwent(vp)); } -#endif /* 0 */ - static struct passdb_ops *pdb_ops; /*************************************************************** @@ -489,6 +470,28 @@ struct smb_passwd *pdb_sam_to_smb(struct sam_passwd *user) } +/************************************************************* + converts a smb_passwd structure to a sam_passwd structure. + **************************************************************/ + +struct sam_passwd *pdb_smb_to_sam(struct smb_passwd *user) +{ + static struct sam_passwd pw_buf; + + if (user == NULL) return NULL; + + pdb_init_sam(&pw_buf); + + pw_buf.smb_userid = user->smb_userid; + pw_buf.smb_name = user->smb_name; + pw_buf.smb_passwd = user->smb_passwd; + pw_buf.smb_nt_passwd = user->smb_nt_passwd; + pw_buf.acct_ctrl = user->acct_ctrl; + pw_buf.pass_last_set_time = user->pass_last_set_time; + + return &pw_buf; +} + /********************************************************** Encode the account control bits into a string. length = length of string to encode into (including terminating |