summaryrefslogtreecommitdiff
path: root/source3/passdb/pdb_ldap.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2002-10-17 07:08:43 +0000
committerVolker Lendecke <vlendec@samba.org>2002-10-17 07:08:43 +0000
commit41a427b6ba3265e52e8fbcd95242dc354b279190 (patch)
treeb5f25bac6b9afb8c92238e6ce83e6f8448d201ba /source3/passdb/pdb_ldap.c
parentb1aba7b03b1df1dad779c21445a74b56696efdc0 (diff)
downloadsamba-41a427b6ba3265e52e8fbcd95242dc354b279190.tar.gz
samba-41a427b6ba3265e52e8fbcd95242dc354b279190.tar.bz2
samba-41a427b6ba3265e52e8fbcd95242dc354b279190.zip
Revert changes
(This used to be commit 84b62f6d96a77ccbc1b4475ab0780a4e4c9d4875)
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r--source3/passdb/pdb_ldap.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 622b102fea..3f625d1690 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -64,7 +64,7 @@ struct ldapsam_privates {
LDAPMessage *entry;
int index;
- /* retrieve-once info */
+ /* retrive-once info */
const char *uri;
BOOL permit_non_unix_accounts;
@@ -425,22 +425,19 @@ static BOOL ldapsam_connect_system(struct ldapsam_privates *ldap_state, LDAP * l
/*******************************************************************
run the search by name.
******************************************************************/
-static int ldapsam_search_one_user (LDAP * ldap_struct, const char *filter,
- LDAPMessage ** result)
+static int ldapsam_search_one_user (struct ldapsam_privates *ldap_state, LDAP * ldap_struct, const char *filter, LDAPMessage ** result)
{
int scope = LDAP_SCOPE_SUBTREE;
int rc;
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) {
DEBUG(0,("ldapsam_search_one_user: Problem during the LDAP search: %s\n",
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));
}
@@ -450,9 +447,8 @@ static int ldapsam_search_one_user (LDAP * ldap_struct, const char *filter,
/*******************************************************************
run the search by name.
******************************************************************/
-static int ldapsam_search_one_user_by_name (LDAP * ldap_struct,
- const char *user,
- LDAPMessage ** result)
+static int ldapsam_search_one_user_by_name (struct ldapsam_privates *ldap_state, LDAP * ldap_struct, const char *user,
+ LDAPMessage ** result)
{
pstring filter;
@@ -468,13 +464,14 @@ static int ldapsam_search_one_user_by_name (LDAP * ldap_struct,
*/
all_string_sub(filter, "%u", user, sizeof(pstring));
- return ldapsam_search_one_user(ldap_struct, filter, result);
+ return ldapsam_search_one_user(ldap_state, ldap_struct, filter, result);
}
/*******************************************************************
run the search by uid.
******************************************************************/
-static int ldapsam_search_one_user_by_uid(LDAP * ldap_struct, int uid,
+static int ldapsam_search_one_user_by_uid(struct ldapsam_privates *ldap_state,
+ LDAP * ldap_struct, int uid,
LDAPMessage ** result)
{
struct passwd *user;
@@ -493,13 +490,14 @@ static int ldapsam_search_one_user_by_uid(LDAP * ldap_struct, int uid,
passwd_free(&user);
- return ldapsam_search_one_user(ldap_struct, filter, result);
+ return ldapsam_search_one_user(ldap_state, ldap_struct, filter, result);
}
/*******************************************************************
run the search by rid.
******************************************************************/
-static int ldapsam_search_one_user_by_rid (LDAP * ldap_struct, uint32 rid,
+static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
+ LDAP * ldap_struct, uint32 rid,
LDAPMessage ** result)
{
pstring filter;
@@ -508,10 +506,10 @@ static int ldapsam_search_one_user_by_rid (LDAP * ldap_struct, uint32 rid,
/* check if the user rid exsists, if not, try searching on the uid */
snprintf(filter, sizeof(filter) - 1, "rid=%i", rid);
- rc = ldapsam_search_one_user(ldap_struct, filter, result);
+ rc = ldapsam_search_one_user(ldap_state, ldap_struct, filter, result);
if (rc != LDAP_SUCCESS)
- rc = ldapsam_search_one_user_by_uid(ldap_struct,
+ rc = ldapsam_search_one_user_by_uid(ldap_state, ldap_struct,
fallback_pdb_user_rid_to_uid(rid),
result);
@@ -1082,7 +1080,7 @@ static uint32 check_nua_rid_is_avail(struct ldapsam_privates *ldap_state, uint32
return 0;
}
- if (ldapsam_search_one_user_by_rid(ldap_struct, final_rid, &result) != LDAP_SUCCESS) {
+ if (ldapsam_search_one_user_by_rid(ldap_state, 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));
ldap_msgfree(result);
return 0;
@@ -1323,7 +1321,7 @@ static NTSTATUS ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT
ldap_unbind(ldap_struct);
return ret;
}
- if (ldapsam_search_one_user_by_name(ldap_struct, sname, &result) != LDAP_SUCCESS) {
+ if (ldapsam_search_one_user_by_name(ldap_state, ldap_struct, sname, &result) != LDAP_SUCCESS) {
ldap_unbind(ldap_struct);
return ret;
}
@@ -1370,7 +1368,7 @@ static NTSTATUS ldapsam_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT
ldap_unbind(ldap_struct);
return ret;
}
- if (ldapsam_search_one_user_by_rid(ldap_struct, rid, &result) != LDAP_SUCCESS) {
+ if (ldapsam_search_one_user_by_rid(ldap_state, ldap_struct, rid, &result) != LDAP_SUCCESS) {
ldap_unbind(ldap_struct);
return ret;
}
@@ -1410,7 +1408,7 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT
}
/********************************************************************
-Do the actual modification - also change a plaintext passord if
+Do the actual modification - also change a plaittext passord if
it it set.
**********************************************************************/
@@ -1538,7 +1536,7 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods, SAM_A
return ret;
}
- rc = ldapsam_search_one_user_by_name(ldap_struct, sname, &result);
+ rc = ldapsam_search_one_user_by_name(ldap_state, ldap_struct, sname, &result);
if (ldap_count_entries (ldap_struct, result) == 0) {
DEBUG (0, ("User doesn't exit!\n"));
ldap_msgfree (result);
@@ -1602,7 +1600,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, SAM_A
return ret;
}
- rc = ldapsam_search_one_user_by_name(ldap_struct,
+ rc = ldapsam_search_one_user_by_name(ldap_state, ldap_struct,
pdb_get_username(newpwd), &result);
if (ldap_count_entries(ldap_struct, result) == 0) {
@@ -1663,7 +1661,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
return ret;
}
- rc = ldapsam_search_one_user_by_name (ldap_struct, username, &result);
+ rc = ldapsam_search_one_user_by_name (ldap_state, ldap_struct, username, &result);
if (ldap_count_entries(ldap_struct, result) != 0) {
DEBUG(0,("User already in the base, with samba properties\n"));
@@ -1674,7 +1672,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, SAM_ACCO
ldap_msgfree(result);
slprintf (filter, sizeof (filter) - 1, "uid=%s", username);
- rc = ldapsam_search_one_user(ldap_struct, filter, &result);
+ rc = ldapsam_search_one_user(ldap_state, ldap_struct, filter, &result);
num_result = ldap_count_entries(ldap_struct, result);
if (num_result > 1) {