summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-08-11 15:39:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-13 12:30:49 +1000
commitadd8505fde9d178b3a0dbb71a207485cdb8fc161 (patch)
tree6d2ac4133765e15af15004caa368ca39e55a7533
parentc5e41a21dd2dad9b43b40b38f75cea0da67c2cce (diff)
downloadsamba-add8505fde9d178b3a0dbb71a207485cdb8fc161.tar.gz
samba-add8505fde9d178b3a0dbb71a207485cdb8fc161.tar.bz2
samba-add8505fde9d178b3a0dbb71a207485cdb8fc161.zip
s3-passdb Make pdb_element_is_changed available to all passdb modules
This will allow pdb_samba4 to use this Andrew Bartlett
-rw-r--r--source3/passdb/pdb_get_set.c23
-rw-r--r--source3/passdb/pdb_ldap.c35
-rw-r--r--source3/passdb/proto.h4
3 files changed, 33 insertions, 29 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 4ff13808c3..d0d7317e68 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -1088,3 +1088,26 @@ uint32_t pdb_build_fields_present(struct samu *sampass)
/* value set to all for testing */
return 0x00ffffff;
}
+
+/**********************************************************************
+ Helper function to determine for update_sam_account whether
+ we need LDAP modification.
+*********************************************************************/
+
+bool pdb_element_is_changed(const struct samu *sampass,
+ enum pdb_elements element)
+{
+ return IS_SAM_CHANGED(sampass, element);
+}
+
+/**********************************************************************
+ Helper function to determine for update_sam_account whether
+ we need LDAP modification.
+ *********************************************************************/
+
+bool pdb_element_is_set_or_changed(const struct samu *sampass,
+ enum pdb_elements element)
+{
+ return (IS_SAM_SET(sampass, element) ||
+ IS_SAM_CHANGED(sampass, element));
+}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index f8da0ff255..74dcceca4e 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1942,17 +1942,6 @@ static NTSTATUS ldapsam_delete_sam_account(struct pdb_methods *my_methods,
}
/**********************************************************************
- Helper function to determine for update_sam_account whether
- we need LDAP modification.
-*********************************************************************/
-
-static bool element_is_changed(const struct samu *sampass,
- enum pdb_elements element)
-{
- return IS_SAM_CHANGED(sampass, element);
-}
-
-/**********************************************************************
Update struct samu.
*********************************************************************/
@@ -1997,7 +1986,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struc
DEBUG(4, ("ldapsam_update_sam_account: user %s to be modified has dn: %s\n", pdb_get_username(newpwd), dn));
if (!init_ldap_from_sam(ldap_state, entry, &mods, newpwd,
- element_is_changed)) {
+ pdb_element_is_changed)) {
DEBUG(0, ("ldapsam_update_sam_account: init_ldap_from_sam failed!\n"));
TALLOC_FREE(dn);
if (mods != NULL)
@@ -2013,7 +2002,7 @@ static NTSTATUS ldapsam_update_sam_account(struct pdb_methods *my_methods, struc
return NT_STATUS_OK;
}
- ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,LDAP_MOD_REPLACE, element_is_changed);
+ ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,LDAP_MOD_REPLACE, pdb_element_is_changed);
if (mods != NULL) {
ldap_mods_free(mods,True);
@@ -2133,18 +2122,6 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
}
/**********************************************************************
- Helper function to determine for update_sam_account whether
- we need LDAP modification.
- *********************************************************************/
-
-static bool element_is_set_or_changed(const struct samu *sampass,
- enum pdb_elements element)
-{
- return (IS_SAM_SET(sampass, element) ||
- IS_SAM_CHANGED(sampass, element));
-}
-
-/**********************************************************************
Add struct samu to LDAP.
*********************************************************************/
@@ -2194,7 +2171,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s
ldap_msgfree(result);
result = NULL;
- if (element_is_set_or_changed(newpwd, PDB_USERSID)) {
+ if (pdb_element_is_set_or_changed(newpwd, PDB_USERSID)) {
rc = ldapsam_get_ldap_user_by_sid(ldap_state,
sid, &result);
if (rc == LDAP_SUCCESS) {
@@ -2330,7 +2307,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s
}
if (!init_ldap_from_sam(ldap_state, entry, &mods, newpwd,
- element_is_set_or_changed)) {
+ pdb_element_is_set_or_changed)) {
DEBUG(0, ("ldapsam_add_sam_account: init_ldap_from_sam failed!\n"));
if (mods != NULL) {
ldap_mods_free(mods, true);
@@ -2354,7 +2331,7 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s
break;
}
- ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,ldap_op, element_is_set_or_changed);
+ ret = ldapsam_modify_entry(my_methods,newpwd,dn,mods,ldap_op, pdb_element_is_set_or_changed);
if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("ldapsam_add_sam_account: failed to modify/add user with uid = %s (dn = %s)\n",
pdb_get_username(newpwd),dn));
@@ -5367,7 +5344,7 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
return NT_STATUS_UNSUCCESSFUL;
}
- if (!init_ldap_from_sam(ldap_state, entry, &mods, user, element_is_set_or_changed)) {
+ if (!init_ldap_from_sam(ldap_state, entry, &mods, user, pdb_element_is_set_or_changed)) {
DEBUG(1,("ldapsam_create_user: Unable to fill user structs\n"));
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source3/passdb/proto.h b/source3/passdb/proto.h
index ee945ac452..24a7cba891 100644
--- a/source3/passdb/proto.h
+++ b/source3/passdb/proto.h
@@ -197,6 +197,10 @@ bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
bool pdb_set_pass_can_change(struct samu *sampass, bool canchange);
bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext);
uint32_t pdb_build_fields_present(struct samu *sampass);
+bool pdb_element_is_changed(const struct samu *sampass,
+ enum pdb_elements element);
+bool pdb_element_is_set_or_changed(const struct samu *sampass,
+ enum pdb_elements element);
/* The following definitions come from passdb/pdb_interface.c */