X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=select.c;h=46b5372492611d3b8ed315cf203372dae41ba580;hb=4113e8c585d3da46bfa5326b866621cff854a737;hp=c26b54859fde1549f03f475fe961b70b3c43cd41;hpb=322ce333fb09ceb39b55a77eceff3ac0cbaf1522;p=adu.git diff --git a/select.c b/select.c index c26b548..46b5372 100644 --- a/select.c +++ b/select.c @@ -14,7 +14,8 @@ #include "fd.h" #include "string.h" #include "error.h" -#include "portable_io.h" +#include "user.h" +#include "select.cmdline.h" /* global list */ #define GLOBAL_LIST_ATOMS \ @@ -585,41 +586,6 @@ static int print_statistics(struct format_info *fi) return -ERRNO_TO_ERROR(-EINVAL); } -static int read_uid_file(struct uid_range *admissible_uids) -{ - size_t size; - uint32_t n; - char *filename = get_uid_list_name(), *map; - int ret = mmap_full_file(filename, O_RDONLY, (void **)&map, &size, NULL); - unsigned bits; - - if (ret < 0) { - INFO_LOG("failed to map %s\n", filename); - free(filename); - return ret; - } - num_uids = size / 4; - INFO_LOG("found %u uids in %s\n", (unsigned)num_uids, filename); - free(filename); - /* - * Compute number of hash table bits. The hash table size must be a - * power of two and larger than the number of uids. - */ - bits = 2; - while (1 << bits < num_uids) - bits++; - create_hash_table(bits); - for (n = 0; n < num_uids; n++) { - uint32_t uid = read_u32(map + n * sizeof(uid)); - ret = search_uid(uid, admissible_uids, OPEN_USER_TABLE, NULL); - if (ret < 0) - goto out; - } -out: - adu_munmap(map, size); - return ret; -} - int run_select_query(struct uid_range *admissible_uids, struct format_info *fi) { int ret;