passdb: Allow a passdb module to do idmap for everything
authorAndrew Bartlett <abartlet@samba.org>
Fri, 28 Mar 2014 02:36:22 +0000 (15:36 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 18 May 2014 23:00:11 +0000 (11:00 +1200)
This seems odd, but the pdb_samba_dsdb module has exactly this semantics, due to backing on to the idmap.ldb
allocator.  This option is added so we can continue to support the mappings written into that database
even when switching winbindd implementations.

Andrew Bartlett

Change-Id: I6b0d7a1463fe28dfd36715af0285911ecc07585c
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/include/passdb.h
source3/lib/util_sid_passdb.c
source3/passdb/pdb_interface.c
source3/passdb/pdb_samba_dsdb.c
source3/wscript_build

index 637c55a8402e5a7707c1392547b66ab9e831aa2f..f9918085da85247986b22bf82a7d6b62a45f3831 100644 (file)
@@ -414,9 +414,10 @@ enum pdb_policy_type {
  * Changed to 20, pdb_secret calls
  * Changed to 21, set/enum_upn_suffixes. AB.
  * Changed to 22, idmap control functions
+ * Changed to 23, new idmap control functions
  */
 
-#define PASSDB_INTERFACE_VERSION 22
+#define PASSDB_INTERFACE_VERSION 23
 
 struct pdb_methods 
 {
@@ -630,6 +631,7 @@ struct pdb_methods
        bool (*is_responsible_for_wellknown)(struct pdb_methods *methods);
        bool (*is_responsible_for_unix_users)(struct pdb_methods *methods);
        bool (*is_responsible_for_unix_groups)(struct pdb_methods *methods);
+       bool (*is_responsible_for_everything_else)(struct pdb_methods *methods);
 
        void *private_data;  /* Private data of some kind */
 
@@ -939,6 +941,7 @@ bool pdb_is_responsible_for_builtin(void);
 bool pdb_is_responsible_for_wellknown(void);
 bool pdb_is_responsible_for_unix_users(void);
 bool pdb_is_responsible_for_unix_groups(void);
+bool pdb_is_responsible_for_everything_else(void);
 
 /* The following definitions come from passdb/pdb_util.c  */
 
index 0138c7d5f367d002622ee6d053ca5c2fc08b6f51..b56837e62e6213a52602f33b61bd997db2a25c59 100644 (file)
@@ -55,6 +55,11 @@ bool sid_check_object_is_for_passdb(const struct dom_sid *sid)
                return true;
        }
 
+       if (pdb_is_responsible_for_everything_else())
+       {
+               return true;
+       }
+
        return false;
 }
 /**
@@ -115,5 +120,10 @@ bool sid_check_is_for_passdb(const struct dom_sid *sid)
                return true;
        }
 
+       if (pdb_is_responsible_for_everything_else())
+       {
+               return true;
+       }
+
        return false;
 }
index e2057e3b3617b8b3b2521942c5e6d4adb190060b..2c82856bc0aaf5fa78e430a4a13c09ba4a628fd0 100644 (file)
@@ -2447,6 +2447,12 @@ static bool pdb_default_is_responsible_for_unix_groups(
        return true;
 }
 
+static bool pdb_default_is_responsible_for_everything_else(
+                                       struct pdb_methods *methods)
+{
+       return false;
+}
+
 bool pdb_is_responsible_for_our_sam(void)
 {
        struct pdb_methods *pdb = pdb_get_methods();
@@ -2477,6 +2483,12 @@ bool pdb_is_responsible_for_unix_groups(void)
        return pdb->is_responsible_for_unix_groups(pdb);
 }
 
+bool pdb_is_responsible_for_everything_else(void)
+{
+       struct pdb_methods *pdb = pdb_get_methods();
+       return pdb->is_responsible_for_everything_else(pdb);
+}
+
 /*******************************************************************
  secret methods
  *******************************************************************/
@@ -2637,6 +2649,8 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
                                pdb_default_is_responsible_for_unix_users;
        (*methods)->is_responsible_for_unix_groups =
                                pdb_default_is_responsible_for_unix_groups;
+       (*methods)->is_responsible_for_everything_else =
+                               pdb_default_is_responsible_for_everything_else;
 
        return NT_STATUS_OK;
 }
index 01e747a00fc71ea054681fb69f2c39ac861ce4c3..6f7b1bad7bd258b297d6817c5652f5d341fd530d 100644 (file)
@@ -2144,6 +2144,11 @@ static bool pdb_samba_dsdb_is_responsible_for_wellknown(struct pdb_methods *m)
        return true;
 }
 
+static bool pdb_samba_dsdb_is_responsible_for_everything_else(struct pdb_methods *m)
+{
+       return true;
+}
+
 static void pdb_samba_dsdb_init_methods(struct pdb_methods *m)
 {
        m->name = "samba_dsdb";
@@ -2197,6 +2202,8 @@ static void pdb_samba_dsdb_init_methods(struct pdb_methods *m)
        m->enum_trusteddoms = pdb_samba_dsdb_enum_trusteddoms;
        m->is_responsible_for_wellknown =
                                pdb_samba_dsdb_is_responsible_for_wellknown;
+       m->is_responsible_for_everything_else =
+                               pdb_samba_dsdb_is_responsible_for_everything_else;
 }
 
 static void free_private_data(void **vp)
index f13aa630e8fe60eb97954d033753603621e58181..87c967508180d94f5db90496661fba05927b3750 100755 (executable)
@@ -172,7 +172,7 @@ bld.SAMBA3_LIBRARY('pdb',
                    passdb/lookup_sid.h''',
                    abi_match=private_pdb_match,
                    abi_directory='passdb/ABI',
-                   vnum='0.1.0')
+                   vnum='0.1.1')
 
 bld.SAMBA3_LIBRARY('smbldaphelper',
                    source='passdb/pdb_ldap_schema.c passdb/pdb_ldap_util.c',