1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

No functional change. I'm trying to understand pdb_ldap.c and

found an unecessary parameter to ldapsam_search_one_user.

Volker
This commit is contained in:
Volker Lendecke -
parent e2fc1de34a
commit a085670c7e

View File

@ -64,7 +64,7 @@ struct ldapsam_privates {
LDAPMessage *entry; LDAPMessage *entry;
int index; int index;
/* retrive-once info */ /* retrieve-once info */
const char *uri; const char *uri;
BOOL permit_non_unix_accounts; BOOL permit_non_unix_accounts;
@ -425,19 +425,22 @@ static BOOL ldapsam_connect_system(struct ldapsam_privates *ldap_state, LDAP * l
/******************************************************************* /*******************************************************************
run the search by name. run the search by name.
******************************************************************/ ******************************************************************/
static int ldapsam_search_one_user (struct ldapsam_privates *ldap_state, LDAP * ldap_struct, const char *filter, LDAPMessage ** result) static int ldapsam_search_one_user (LDAP * ldap_struct, const char *filter,
LDAPMessage ** result)
{ {
int scope = LDAP_SCOPE_SUBTREE; int scope = LDAP_SCOPE_SUBTREE;
int rc; int rc;
DEBUG(2, ("ldapsam_search_one_user: searching for:[%s]\n", filter)); DEBUG(2, ("ldapsam_search_one_user: searching for:[%s]\n", filter));
rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter, (char **)attr, 0, result); rc = ldap_search_s(ldap_struct, lp_ldap_suffix (), scope, filter,
(char **)attr, 0, result);
if (rc != LDAP_SUCCESS) { if (rc != LDAP_SUCCESS) {
DEBUG(0,("ldapsam_search_one_user: Problem during the LDAP search: %s\n", DEBUG(0,("ldapsam_search_one_user: Problem during the LDAP search: %s\n",
ldap_err2string (rc))); ldap_err2string (rc)));
DEBUG(3,("ldapsam_search_one_user: Query was: %s, %s\n", lp_ldap_suffix(), DEBUG(3,("ldapsam_search_one_user: Query was: %s, %s\n",
lp_ldap_suffix(),
filter)); filter));
} }
@ -447,8 +450,9 @@ static int ldapsam_search_one_user (struct ldapsam_privates *ldap_state, LDAP *
/******************************************************************* /*******************************************************************
run the search by name. run the search by name.
******************************************************************/ ******************************************************************/
static int ldapsam_search_one_user_by_name (struct ldapsam_privates *ldap_state, LDAP * ldap_struct, const char *user, static int ldapsam_search_one_user_by_name (LDAP * ldap_struct,
LDAPMessage ** result) const char *user,
LDAPMessage ** result)
{ {
pstring filter; pstring filter;
@ -464,14 +468,13 @@ static int ldapsam_search_one_user_by_name (struct ldapsam_privates *ldap_state,
*/ */
all_string_sub(filter, "%u", user, sizeof(pstring)); all_string_sub(filter, "%u", user, sizeof(pstring));
return ldapsam_search_one_user(ldap_state, ldap_struct, filter, result); return ldapsam_search_one_user(ldap_struct, filter, result);
} }
/******************************************************************* /*******************************************************************
run the search by uid. run the search by uid.
******************************************************************/ ******************************************************************/
static int ldapsam_search_one_user_by_uid(struct ldapsam_privates *ldap_state, static int ldapsam_search_one_user_by_uid(LDAP * ldap_struct, int uid,
LDAP * ldap_struct, int uid,
LDAPMessage ** result) LDAPMessage ** result)
{ {
struct passwd *user; struct passwd *user;
@ -490,14 +493,13 @@ static int ldapsam_search_one_user_by_uid(struct ldapsam_privates *ldap_state,
passwd_free(&user); passwd_free(&user);
return ldapsam_search_one_user(ldap_state, ldap_struct, filter, result); return ldapsam_search_one_user(ldap_struct, filter, result);
} }
/******************************************************************* /*******************************************************************
run the search by rid. run the search by rid.
******************************************************************/ ******************************************************************/
static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state, static int ldapsam_search_one_user_by_rid (LDAP * ldap_struct, uint32 rid,
LDAP * ldap_struct, uint32 rid,
LDAPMessage ** result) LDAPMessage ** result)
{ {
pstring filter; pstring filter;
@ -506,10 +508,10 @@ static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
/* check if the user rid exsists, if not, try searching on the uid */ /* check if the user rid exsists, if not, try searching on the uid */
snprintf(filter, sizeof(filter) - 1, "rid=%i", rid); snprintf(filter, sizeof(filter) - 1, "rid=%i", rid);
rc = ldapsam_search_one_user(ldap_state, ldap_struct, filter, result); rc = ldapsam_search_one_user(ldap_struct, filter, result);
if (rc != LDAP_SUCCESS) if (rc != LDAP_SUCCESS)
rc = ldapsam_search_one_user_by_uid(ldap_state, ldap_struct, rc = ldapsam_search_one_user_by_uid(ldap_struct,
fallback_pdb_user_rid_to_uid(rid), fallback_pdb_user_rid_to_uid(rid),
result); result);
@ -1080,7 +1082,7 @@ static uint32 check_nua_rid_is_avail(struct ldapsam_privates *ldap_state, uint32
return 0; return 0;
} }
if (ldapsam_search_one_user_by_rid(ldap_state, ldap_struct, final_rid, &result) != LDAP_SUCCESS) { if (ldapsam_search_one_user_by_rid(ldap_struct, final_rid, &result) != LDAP_SUCCESS) {
DEBUG(0, ("Cannot allocate NUA RID %d (0x%x), as the confirmation search failed!\n", final_rid, final_rid)); DEBUG(0, ("Cannot allocate NUA RID %d (0x%x), as the confirmation search failed!\n", final_rid, final_rid));
ldap_msgfree(result); ldap_msgfree(result);
return 0; return 0;
@ -1321,7 +1323,7 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT
ldap_unbind(ldap_struct); ldap_unbind(ldap_struct);
return ret; return ret;
} }
if (ldapsam_search_one_user_by_name(ldap_state, ldap_struct, sname, &result) != LDAP_SUCCESS) { if (ldapsam_search_one_user_by_name(ldap_struct, sname, &result) != LDAP_SUCCESS) {
ldap_unbind(ldap_struct); ldap_unbind(ldap_struct);
return ret; return ret;
} }
@ -1368,7 +1370,7 @@ static NTSTATUS ldapsam_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT
ldap_unbind(ldap_struct); ldap_unbind(ldap_struct);
return ret; return ret;
} }
if (ldapsam_search_one_user_by_rid(ldap_state, ldap_struct, rid, &result) != LDAP_SUCCESS) { if (ldapsam_search_one_user_by_rid(ldap_struct, rid, &result) != LDAP_SUCCESS) {
ldap_unbind(ldap_struct); ldap_unbind(ldap_struct);
return ret; return ret;
} }
@ -1408,7 +1410,7 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT
} }
/******************************************************************** /********************************************************************
Do the actual modification - also change a plaittext passord if Do the actual modification - also change a plaintext passord if
it it set. it it set.
**********************************************************************/ **********************************************************************/
@ -1536,7 +1538,7 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods, SAM_A
return ret; return ret;
} }
rc = ldapsam_search_one_user_by_name(ldap_state, ldap_struct, sname, &result); rc = ldapsam_search_one_user_by_name(ldap_struct, sname, &result);
if (ldap_count_entries (ldap_struct, result) == 0) { if (ldap_count_entries (ldap_struct, result) == 0) {
DEBUG (0, ("User doesn't exit!\n")); DEBUG (0, ("User doesn't exit!\n"));
ldap_msgfree (result); ldap_msgfree (result);
@ -1600,7 +1602,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A
return ret; return ret;
} }
rc = ldapsam_search_one_user_by_name(ldap_state, ldap_struct, rc = ldapsam_search_one_user_by_name(ldap_struct,
pdb_get_username(newpwd), &result); pdb_get_username(newpwd), &result);
if (ldap_count_entries(ldap_struct, result) == 0) { if (ldap_count_entries(ldap_struct, result) == 0) {
@ -1661,7 +1663,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
return ret; return ret;
} }
rc = ldapsam_search_one_user_by_name (ldap_state, ldap_struct, username, &result); rc = ldapsam_search_one_user_by_name (ldap_struct, username, &result);
if (ldap_count_entries(ldap_struct, result) != 0) { if (ldap_count_entries(ldap_struct, result) != 0) {
DEBUG(0,("User already in the base, with samba properties\n")); DEBUG(0,("User already in the base, with samba properties\n"));
@ -1672,7 +1674,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
ldap_msgfree(result); ldap_msgfree(result);
slprintf (filter, sizeof (filter) - 1, "uid=%s", username); slprintf (filter, sizeof (filter) - 1, "uid=%s", username);
rc = ldapsam_search_one_user(ldap_state, ldap_struct, filter, &result); rc = ldapsam_search_one_user(ldap_struct, filter, &result);
num_result = ldap_count_entries(ldap_struct, result); num_result = ldap_count_entries(ldap_struct, result);
if (num_result > 1) { if (num_result > 1) {