s3:idmap: remove the special treatment of the default domain "*" from idmap_init_domain
authorMichael Adam <obnox@samba.org>
Wed, 2 Mar 2011 14:41:06 +0000 (15:41 +0100)
committerMichael Adam <obnox@samba.org>
Tue, 22 Mar 2011 21:49:56 +0000 (22:49 +0100)
source3/winbindd/idmap.c

index a2a727cdb0894d79db93eb7c4a1828e8d42fa692..94e164ef626a98256786ea2940f18db0a815fe34 100644 (file)
@@ -208,6 +208,8 @@ static struct idmap_domain *idmap_init_domain(TALLOC_CTX *mem_ctx,
 {
        struct idmap_domain *result;
        NTSTATUS status;
+       char *config_option = NULL;
+       const char *range;
 
        result = talloc_zero(mem_ctx, struct idmap_domain);
        if (result == NULL) {
@@ -224,78 +226,34 @@ static struct idmap_domain *idmap_init_domain(TALLOC_CTX *mem_ctx,
        /*
         * load ranges and read only information from the config
         */
-       if (strequal(result->name, "*")) {
-               /*
-                * The default domain "*" is configured differently
-                * from named domains.
-                */
-               uid_t low_uid = 0;
-               uid_t high_uid = 0;
-               gid_t low_gid = 0;
-               gid_t high_gid = 0;
-
-               result->low_id = 0;
-               result->high_id = 0;
-
-               if (!lp_idmap_uid(&low_uid, &high_uid)) {
-                       DEBUG(1, ("'idmap uid' not set!\n"));
-                       if (check_range) {
-                               goto fail;
-                       }
-               }
 
-               result->low_id = low_uid;
-               result->high_id = high_uid;
-
-               if (!lp_idmap_gid(&low_gid, &high_gid)) {
-                       DEBUG(1, ("'idmap gid' not set!\n"));
-                       if (check_range) {
-                               goto fail;
-                       }
-               }
-
-               if ((low_gid != low_uid) || (high_gid != high_uid)) {
-                       DEBUG(1, ("Warning: 'idmap uid' and 'idmap gid'"
-                             " ranges do not agree -- building "
-                             "intersection\n"));
-                       result->low_id = MAX(result->low_id, low_gid);
-                       result->high_id = MIN(result->high_id, high_gid);
-               }
-
-               result->read_only = lp_idmap_read_only();
-       } else {
-               char *config_option = NULL;
-               const char *range;
+       config_option = talloc_asprintf(result, "idmap config %s",
+                                       result->name);
+       if (config_option == NULL) {
+               DEBUG(0, ("Out of memory!\n"));
+               goto fail;
+       }
 
-               config_option = talloc_asprintf(result, "idmap config %s",
-                                               result->name);
-               if (config_option == NULL) {
-                       DEBUG(0, ("Out of memory!\n"));
+       range = lp_parm_const_string(-1, config_option, "range", NULL);
+       if (range == NULL) {
+               DEBUG(1, ("idmap range not specified for domain %s\n",
+                         result->name));
+               if (check_range) {
                        goto fail;
                }
-
-               range = lp_parm_const_string(-1, config_option, "range", NULL);
-               if (range == NULL) {
-                       DEBUG(1, ("idmap range not specified for domain %s\n",
-                                 result ->name));
-                       if (check_range) {
-                               goto fail;
-                       }
-               } else if (sscanf(range, "%u - %u", &result->low_id,
-                                 &result->high_id) != 2)
-               {
-                       DEBUG(1, ("invalid range '%s' specified for domain "
-                                 "'%s'\n", range, result->name));
-                       if (check_range) {
-                               goto fail;
-                       }
+       } else if (sscanf(range, "%u - %u", &result->low_id,
+                         &result->high_id) != 2)
+       {
+               DEBUG(1, ("invalid range '%s' specified for domain "
+                         "'%s'\n", range, result->name));
+               if (check_range) {
+                       goto fail;
                }
+       }
 
-               result->read_only = lp_parm_bool(-1, config_option, "read only",
-                                                false);
+       result->read_only = lp_parm_bool(-1, config_option, "read only", false);
 
-               talloc_free(config_option);
-       }
+       talloc_free(config_option);
 
        if (result->low_id > result->high_id) {
                DEBUG(1, ("Error: invalid idmap range detected: %lu - %lu\n",