}
if (first_is_numeric && last_is_numeric) {
- if (simple_archiver_hash_map_get(IDToID, first_id, sizeof(uint32_t))) {
+ if (simple_archiver_hash_map_get(IDToID, first_id, sizeof(uint32_t))
+ || simple_archiver_hash_map_get(IDToName, first_id, sizeof(uint32_t))) {
fprintf(stderr,
"ERROR: Mapping with key \"%" PRIu32 "\" already exists!\n",
*first_id);
last_id = NULL;
first_id = NULL;
} else if (first_is_numeric) {
- if (simple_archiver_hash_map_get(IDToName, first_id, sizeof(uint32_t))) {
+ if (simple_archiver_hash_map_get(IDToName, first_id, sizeof(uint32_t))
+ || simple_archiver_hash_map_get(IDToID, first_id, sizeof(uint32_t))) {
fprintf(stderr,
"ERROR: Mapping with key \"%" PRIu32 "\" already exists!\n",
*first_id);
} else if (last_is_numeric) {
if (simple_archiver_hash_map_get(NameToID,
first_buf,
- strlen(first_buf) + 1)) {
+ strlen(first_buf) + 1)
+ || simple_archiver_hash_map_get(NameToName,
+ first_buf,
+ strlen(first_buf) + 1)) {
fprintf(stderr,
"ERROR: Mapping with key \"%s\" already exists!\n",
first_buf);
} else {
if (simple_archiver_hash_map_get(NameToName,
first_buf,
- strlen(first_buf) + 1)) {
+ strlen(first_buf) + 1)
+ || simple_archiver_hash_map_get(NameToID,
+ first_buf,
+ strlen(first_buf) + 1)) {
fprintf(stderr,
"ERROR: Mapping with key \"%s\" already exists!\n",
first_buf);
parsed.mappings.UidToUid,
parsed.mappings.UnameToUname) != 0);
fprintf(stderr, "Expecting ERROR output on next line:\n");
+ CHECK_TRUE(simple_archiver_handle_map_user_or_group(
+ "1000:other",
+ parsed.mappings.UidToUname,
+ parsed.mappings.UnameToUid,
+ parsed.mappings.UidToUid,
+ parsed.mappings.UnameToUname) != 0);
+ fprintf(stderr, "Expecting ERROR output on next line:\n");
CHECK_TRUE(simple_archiver_handle_map_user_or_group(
"1002:user00",
parsed.mappings.UidToUname,
parsed.mappings.UidToUid,
parsed.mappings.UnameToUname) != 0);
fprintf(stderr, "Expecting ERROR output on next line:\n");
+ CHECK_TRUE(simple_archiver_handle_map_user_or_group(
+ "1002:100",
+ parsed.mappings.UidToUname,
+ parsed.mappings.UnameToUid,
+ parsed.mappings.UidToUid,
+ parsed.mappings.UnameToUname) != 0);
+ fprintf(stderr, "Expecting ERROR output on next line:\n");
CHECK_TRUE(simple_archiver_handle_map_user_or_group(
"user1:1033",
parsed.mappings.UidToUname,
parsed.mappings.UidToUid,
parsed.mappings.UnameToUname) != 0);
fprintf(stderr, "Expecting ERROR output on next line:\n");
+ CHECK_TRUE(simple_archiver_handle_map_user_or_group(
+ "user1:user10",
+ parsed.mappings.UidToUname,
+ parsed.mappings.UnameToUid,
+ parsed.mappings.UidToUid,
+ parsed.mappings.UnameToUname) != 0);
+ fprintf(stderr, "Expecting ERROR output on next line:\n");
CHECK_TRUE(simple_archiver_handle_map_user_or_group(
"user2:us3r3",
parsed.mappings.UidToUname,
parsed.mappings.UnameToUid,
parsed.mappings.UidToUid,
parsed.mappings.UnameToUname) != 0);
+ fprintf(stderr, "Expecting ERROR output on next line:\n");
+ CHECK_TRUE(simple_archiver_handle_map_user_or_group(
+ "user2:3",
+ parsed.mappings.UidToUname,
+ parsed.mappings.UnameToUid,
+ parsed.mappings.UidToUid,
+ parsed.mappings.UnameToUname) != 0);
uint32_t id_check = 1000;
uint32_t *id_get;