diff options
author | Simo Sorce <idra@samba.org> | 2002-03-19 13:57:53 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2002-03-19 13:57:53 +0000 |
commit | 050b80356edea52f1bbb0a27599186ad84c18b73 (patch) | |
tree | 1faea4cb8057ee92df2a188cb3bd0909d89ebc5f /source3/passdb/pdb_smbpasswd.c | |
parent | f464ceb109bc9bdc288e0219c4b83da15ba6f1fc (diff) | |
download | samba-050b80356edea52f1bbb0a27599186ad84c18b73.tar.gz samba-050b80356edea52f1bbb0a27599186ad84c18b73.tar.bz2 samba-050b80356edea52f1bbb0a27599186ad84c18b73.zip |
second step to gain free uid<->rid mapping
we still need to free gid<->rid mapping and few other stuff
(This used to be commit aa4b6f8181f34196a28951264dd8b631a5deef7f)
Diffstat (limited to 'source3/passdb/pdb_smbpasswd.c')
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 94bab7598e..6f3886a4b5 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -69,6 +69,24 @@ struct smbpasswd_privates enum pwf_access_type { PWF_READ, PWF_UPDATE, PWF_CREATE }; +/******************************************************************* + Converts NT user RID to a UNIX uid. + ********************************************************************/ + +static uid_t pdb_user_rid_to_uid(uint32 user_rid) +{ + return (uid_t)(((user_rid & (~USER_RID_TYPE))- 1000)/RID_MULTIPLIER); +} + +/******************************************************************* + converts UNIX uid to an NT User RID. + ********************************************************************/ + +static uint32 pdb_uid_to_user_rid(uid_t uid) +{ + return (((((uint32)uid)*RID_MULTIPLIER) + 1000) | USER_RID_TYPE); +} + /*************************************************************** Lock an fd. Abandon after waitsecs seconds. ****************************************************************/ @@ -1513,25 +1531,6 @@ static BOOL smbpasswd_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_ return True; } -/********************************************************************** - get rid by uid -*********************************************************************/ - -static uint32 smbpasswd_uid_to_rid(struct pdb_context *context, uid_t uid) -{ - return fallback_pdb_uid_to_user_rid(uid); -} - -/********************************************************************** - get uid by rid -*********************************************************************/ - -static uid_t smbpasswd_rid_to_uid(struct pdb_context *context, uint32 rid) -{ - return fallback_pdb_user_rid_to_uid(rid); -} - - static BOOL smbpasswd_add_sam_account(struct pdb_context *context, const SAM_ACCOUNT *sampass) { struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data; @@ -1605,8 +1604,6 @@ NTSTATUS pdb_init_smbpasswd(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, (*pdb_method)->add_sam_account = smbpasswd_add_sam_account; (*pdb_method)->update_sam_account = smbpasswd_update_sam_account; (*pdb_method)->delete_sam_account = smbpasswd_delete_sam_account; - (*pdb_method)->uid_to_user_rid = smbpasswd_uid_to_rid; - (*pdb_method)->user_rid_to_uid = smbpasswd_rid_to_uid; /* Setup private data and free function */ |