Ignore:
Timestamp:
Jun 17, 2009, 2:19:52 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.3 branch to 3.3.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/winbindd/idmap_ldap.c

    r222 r274  
    766766        struct idmap_ldap_context *ctx = NULL;
    767767        char *config_option = NULL;
    768         const char *range = NULL;
    769768        const char *tmp = NULL;
    770769
     
    780779        }
    781780
    782         config_option = talloc_asprintf(ctx, "idmap config %s", dom->name);
    783         if ( ! config_option) {
    784                 DEBUG(0, ("Out of memory!\n"));
    785                 ret = NT_STATUS_NO_MEMORY;
    786                 goto done;
    787         }
    788 
    789         /* load ranges */
    790         range = lp_parm_const_string(-1, config_option, "range", NULL);
    791         if (range && range[0]) {
    792                 if ((sscanf(range, "%u - %u", &ctx->filter_low_id,
    793                                                 &ctx->filter_high_id) != 2) ||
    794                     (ctx->filter_low_id > ctx->filter_high_id)) {
    795                         DEBUG(1, ("ERROR: invalid filter range [%s]", range));
    796                         ctx->filter_low_id = 0;
    797                         ctx->filter_high_id = 0;
    798                 }
     781        if (strequal(dom->name, "*")) {
     782                uid_t low_uid = 0;
     783                uid_t high_uid = 0;
     784                gid_t low_gid = 0;
     785                gid_t high_gid = 0;
     786
     787                ctx->filter_low_id = 0;
     788                ctx->filter_high_id = 0;
     789
     790                if (lp_idmap_uid(&low_uid, &high_uid)) {
     791                        ctx->filter_low_id = low_uid;
     792                        ctx->filter_high_id = high_uid;
     793                } else {
     794                        DEBUG(3, ("Warning: 'idmap uid' not set!\n"));
     795                }
     796
     797                if (lp_idmap_gid(&low_gid, &high_gid)) {
     798                        if ((low_gid != low_uid) || (high_gid != high_uid)) {
     799                                DEBUG(1, ("Warning: 'idmap uid' and 'idmap gid'"
     800                                      " ranges do not agree -- building "
     801                                      "intersection\n"));
     802                                ctx->filter_low_id = MAX(ctx->filter_low_id,
     803                                                         low_gid);
     804                                ctx->filter_high_id = MIN(ctx->filter_high_id,
     805                                                          high_gid);
     806                        }
     807                } else {
     808                        DEBUG(3, ("Warning: 'idmap gid' not set!\n"));
     809                }
     810        } else {
     811                const char *range = NULL;
     812
     813                config_option = talloc_asprintf(ctx, "idmap config %s", dom->name);
     814                if ( ! config_option) {
     815                        DEBUG(0, ("Out of memory!\n"));
     816                        ret = NT_STATUS_NO_MEMORY;
     817                        goto done;
     818                }
     819
     820                /* load ranges */
     821                range = lp_parm_const_string(-1, config_option, "range", NULL);
     822                if (range && range[0]) {
     823                        if ((sscanf(range, "%u - %u", &ctx->filter_low_id,
     824                                                        &ctx->filter_high_id) != 2))
     825                        {
     826                                DEBUG(1, ("ERROR: invalid filter range [%s]", range));
     827                                ctx->filter_low_id = 0;
     828                                ctx->filter_high_id = 0;
     829                        }
     830                }
     831        }
     832
     833        if (ctx->filter_low_id > ctx->filter_high_id) {
     834                DEBUG(1, ("ERROR: invalid filter range [%u-%u]",
     835                      ctx->filter_low_id, ctx->filter_high_id));
     836                ctx->filter_low_id = 0;
     837                ctx->filter_high_id = 0;
    799838        }
    800839
Note: See TracChangeset for help on using the changeset viewer.