char *szUsershareTemplateShare; \
char *szIdmapUID; \
char *szIdmapGID; \
+ char *szIdmapBackend; \
int winbindMaxDomainConnections; \
int ismb2_max_credits; \
char *tls_keyfile; \
.bAccessBasedShareEnum = false,
.bAvailable = true,
.bRead_only = true,
- .bNo_set_dir = true,
.bGuest_only = false,
.bAdministrative_share = false,
.bGuest_ok = false,
return true;
}
-/***************************************************************************
- Handle idmap/non unix account uid and gid allocation parameters. The format of these
- parameters is:
+/*
+ * idmap related parameters
+ */
- [global]
+static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+{
+ lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
- idmap uid = 1000-1999
- idmap gid = 700-899
+ return true;
+}
- We only do simple parsing checks here. The strings are parsed into useful
- structures in the idmap daemon code.
+static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+{
+ lp_do_parameter(snum, "idmap config * : range", pszParmValue);
-***************************************************************************/
+ return true;
+}
-/* Some lp_ routines to return idmap [ug]id information */
+static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+{
+ lp_do_parameter(snum, "idmap config * : range", pszParmValue);
-static uid_t idmap_uid_low, idmap_uid_high;
-static gid_t idmap_gid_low, idmap_gid_high;
+ return true;
+}
-bool lp_idmap_uid(uid_t *low, uid_t *high)
+bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high)
{
- if (idmap_uid_low == 0 || idmap_uid_high == 0)
- return false;
+ char *config_option = NULL;
+ const char *range = NULL;
+ bool ret = false;
- if (low)
- *low = idmap_uid_low;
+ SMB_ASSERT(low != NULL);
+ SMB_ASSERT(high != NULL);
- if (high)
- *high = idmap_uid_high;
+ if ((domain_name == NULL) || (domain_name[0] == '\0')) {
+ domain_name = "*";
+ }
- return true;
-}
+ config_option = talloc_asprintf(talloc_tos(), "idmap config %s",
+ domain_name);
+ if (config_option == NULL) {
+ DEBUG(0, ("out of memory\n"));
+ return false;
+ }
-bool lp_idmap_gid(gid_t *low, gid_t *high)
-{
- if (idmap_gid_low == 0 || idmap_gid_high == 0)
- return false;
+ range = lp_parm_const_string(-1, config_option, "range", NULL);
+ if (range == NULL) {
+ DEBUG(1, ("idmap range not specified for domain '%s'\n", domain_name));
+ goto done;
+ }
- if (low)
- *low = idmap_gid_low;
+ if (sscanf(range, "%u - %u", low, high) != 2) {
+ DEBUG(1, ("error parsing idmap range '%s' for domain '%s'\n",
+ range, domain_name));
+ goto done;
+ }
- if (high)
- *high = idmap_gid_high;
+ ret = true;
+
+done:
+ talloc_free(config_option);
+ return ret;
- return true;
}
-static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+bool lp_idmap_default_range(uint32_t *low, uint32_t *high)
{
- lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
-
- return true;
+ return lp_idmap_range("*", low, high);
}
-/* Do some simple checks on "idmap [ug]id" parameter values */
-
-static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+const char *lp_idmap_backend(const char *domain_name)
{
- lp_do_parameter(snum, "idmap config * : range", pszParmValue);
+ char *config_option = NULL;
+ const char *backend = NULL;
- return true;
+ 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;
}
-static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
+const char *lp_idmap_default_backend(void)
{
- lp_do_parameter(snum, "idmap config * : range", pszParmValue);
-
- return true;
+ return lp_idmap_backend("*");
}
/***************************************************************************
lp_do_parameter(-1, "map hidden", "no");
lp_do_parameter(-1, "map system", "no");
lp_do_parameter(-1, "map readonly", "no");
+ lp_do_parameter(-1, "map archive", "no");
lp_do_parameter(-1, "store dos attributes", "yes");
- lp_do_parameter(-1, "create mask", "0777");
- lp_do_parameter(-1, "directory mask", "0777");
}
}
/***************************************************************************
Save the curent values of all global and sDefault parameters into the
- defaults union. This allows swat and testparm to show only the
+ defaults union. This allows testparm to show only the
changed (ie. non-default) parameters.
***************************************************************************/
/* This must be a regular file, not a symlink, directory or
other strange filetype. */
if (!check_usershare_stat(fname, &sbuf)) {
+ close(fd);
goto out;
}