From ba47af4ec2c6f900c86b589b53cd238fecdba1f2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 22 Mar 2003 20:48:47 +0000 Subject: Never touch complicated if/else/elsif structures :-) This repairs domain join with fully existing wks-account which I broke with my last patch... Volker (This used to be commit 582a34efbe3c1570b852c93318ff6002954ddf6a) --- source3/passdb/pdb_ldap.c | 50 +++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'source3') diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 7cb092a9bc..9eab2863da 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1364,23 +1364,25 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state, rid = pdb_get_user_rid(sampass); - if ( (rid==0) && (!IS_SAM_DEFAULT(sampass, PDB_UID)) ) { - rid = fallback_pdb_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) { - DEBUG(0, ("NO user RID specified on account %s, and " - "findining next available NUA RID failed, " - "cannot store!\n", - pdb_get_username(sampass))); + if (rid == 0) { + if (!IS_SAM_DEFAULT(sampass, PDB_UID)) { + rid = fallback_pdb_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) { + DEBUG(0, ("NO user RID specified on account %s, and " + "findining next available NUA RID failed, " + "cannot store!\n", + pdb_get_username(sampass))); + ldap_mods_free(*mods, 1); + return False; + } + } else { + DEBUG(0, ("NO user RID specified on account %s, " + "cannot store!\n", pdb_get_username(sampass))); ldap_mods_free(*mods, 1); return False; } - } else { - DEBUG(0, ("NO user RID specified on account %s, " - "cannot store!\n", pdb_get_username(sampass))); - ldap_mods_free(*mods, 1); - return False; } slprintf(temp, sizeof(temp) - 1, "%i", rid); @@ -1390,15 +1392,17 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state, rid = pdb_get_group_rid(sampass); - if ( (rid==0) && (!IS_SAM_DEFAULT(sampass, PDB_GID)) ) { - rid = pdb_gid_to_group_rid(pdb_get_gid(sampass)); - } else if (ldap_state->permit_non_unix_accounts) { - rid = DOMAIN_GROUP_RID_USERS; - } else { - DEBUG(0, ("NO group RID specified on account %s, " - "cannot store!\n", pdb_get_username(sampass))); - ldap_mods_free(*mods, 1); - return False; + if (rid == 0) { + if (!IS_SAM_DEFAULT(sampass, PDB_GID)) { + rid = pdb_gid_to_group_rid(pdb_get_gid(sampass)); + } else if (ldap_state->permit_non_unix_accounts) { + rid = DOMAIN_GROUP_RID_USERS; + } else { + DEBUG(0, ("NO group RID specified on account %s, " + "cannot store!\n", pdb_get_username(sampass))); + ldap_mods_free(*mods, 1); + return False; + } } slprintf(temp, sizeof(temp) - 1, "%i", rid); -- cgit