s3-passdb Make pdb_element_is_changed available to all passdb modules
[idra/samba.git] / source3 / passdb / pdb_get_set.c
index 782c08fc1c36caccbffb4e0cfa956744ff86435b..d0d7317e68d44acbf678d7830c66fe2d1912321c 100644 (file)
@@ -25,6 +25,7 @@
 #include "passdb.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../libcli/security/security.h"
+#include "../lib/util/bitmap.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_PASSDB
@@ -511,7 +512,7 @@ bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum p
        if (!g_sid)
                return False;
 
-       if ( !(sampass->group_sid = TALLOC_P( sampass, struct dom_sid )) ) {
+       if ( !(sampass->group_sid = talloc( sampass, struct dom_sid )) ) {
                return False;
        }
 
@@ -1087,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));
+}