summaryrefslogtreecommitdiff
path: root/source3/passdb/pdb_ldap.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-04-13 09:35:52 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-04-13 09:35:52 +0000
commit163a855d26106ac9c6eaf945a31a6495204de990 (patch)
tree508aa6282dac19468cd16635758e82ee98b32810 /source3/passdb/pdb_ldap.c
parentcc60b069836cbc355e828675e6f089b6ef22b32e (diff)
downloadsamba-163a855d26106ac9c6eaf945a31a6495204de990.tar.gz
samba-163a855d26106ac9c6eaf945a31a6495204de990.tar.bz2
samba-163a855d26106ac9c6eaf945a31a6495204de990.zip
Better handling of uid/gid -> RID and RID -> uid/gid code.
All uids and gids must create valid RIDs, becouse other code expects this, and can't handle the failure case. (ACL code in particular) Allow admins to adjust the base of the RID algorithm, so avoid clashes with users brought in from NT (for example). Put all the algorithm code back in one place, so that this change is global. Better coping with NULL sid pointers - but it still breaks a lot of stuff. BONUS: manpage entry for new paramater :-) counter based rids for normal users in tdbsam is disabled for the timebeing, idra and I will work out some things here soon I hope. Andrew Bartlett (This used to be commit 5275c94cdf0c64f347d4282f47088d084b1a7ea5)
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r--source3/passdb/pdb_ldap.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index dc6b9f97ff..d0280269aa 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -72,24 +72,6 @@ struct ldapsam_privates {
static uint32 ldapsam_get_next_available_nua_rid(struct ldapsam_privates *ldap_state);
/*******************************************************************
- 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);
-}
-
-/*******************************************************************
find the ldap password
******************************************************************/
static BOOL fetch_ldapsam_pw(char *dn, char* pw, int len)
@@ -347,7 +329,7 @@ static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
if (rc != LDAP_SUCCESS)
rc = ldapsam_search_one_user_by_uid(ldap_state, ldap_struct,
- pdb_user_rid_to_uid(rid),
+ fallback_user_rid_to_uid(rid),
result);
return rc;
@@ -754,7 +736,7 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
if ( pdb_get_user_rid(sampass) ) {
rid = pdb_get_user_rid(sampass);
} else if (IS_SAM_SET(sampass, FLAG_SAM_UID)) {
- rid = pdb_uid_to_user_rid(pdb_get_uid(sampass));
+ rid = fallback_uid_to_user_rid(pdb_get_uid(sampass));
} else if (ldap_state->permit_non_unix_accounts) {
rid = ldapsam_get_next_available_nua_rid(ldap_state);
if (rid == 0) {
@@ -1511,9 +1493,9 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method
return NT_STATUS_UNSUCCESSFUL;
}
- ldap_state->low_nua_rid=pdb_uid_to_user_rid(low_nua_uid);
+ ldap_state->low_nua_rid=fallback_uid_to_user_rid(low_nua_uid);
- ldap_state->high_nua_rid=pdb_uid_to_user_rid(high_nua_uid);
+ ldap_state->high_nua_rid=fallback_uid_to_user_rid(high_nua_uid);
return NT_STATUS_OK;
}