s3:param: introduce new lp_idmap_backend() that takes the domain
authorMichael Adam <obnox@samba.org>
Tue, 29 Jan 2013 12:24:20 +0000 (13:24 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 5 Feb 2013 16:36:34 +0000 (17:36 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
source3/include/proto.h
source3/param/loadparm.c

index 0b7549d10408cda5072a923594a59a4d3f756403..4440d3c756cd21636f3f5ea72ff5092d27ce32dc 100644 (file)
@@ -1084,6 +1084,7 @@ int lp_idmap_cache_time(void);
 int lp_idmap_negative_cache_time(void);
 bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high);
 bool lp_idmap_default_range(uint32_t *low, uint32_t *high);
+const char *lp_idmap_backend(const char *domain_name);
 int lp_keepalive(void);
 bool lp_passdb_expand_explicit(void);
 char *lp_ldap_suffix(TALLOC_CTX *ctx);
index 961a002eb19bf26062a2512bdacb3301f8be2459..dab6d340404ec141a30c5594074ae768f7f9c866 100644 (file)
@@ -2955,6 +2955,33 @@ bool lp_idmap_default_range(uint32_t *low, uint32_t *high)
        return lp_idmap_range("*", low, high);
 }
 
+const char *lp_idmap_backend(const char *domain_name)
+{
+       char *config_option = NULL;
+       const char *backend = NULL;
+
+       if ((domain_name == NULL) || (domain_name[0] == '\0')) {
+               domain_name = "*";
+       }
+
+       config_option = talloc_asprintf(talloc_tos(), "idmap config %s",
+                                       domain_name);
+       if (config_option == NULL) {
+               DEBUG(0, ("out of memory\n"));
+               return false;
+       }
+
+       backend = lp_parm_const_string(-1, config_option, "backend", NULL);
+       if (backend == NULL) {
+               DEBUG(1, ("idmap backend not specified for domain '%s'\n", domain_name));
+               goto done;
+       }
+
+done:
+       talloc_free(config_option);
+       return backend;
+}
+
 /***************************************************************************
  Handle the DEBUG level list.
 ***************************************************************************/