recv a complete uid/gid mapping from the peer and map the uid/gid * in the file list to local names */
| 458 | /* recv a complete uid/gid mapping from the peer and map the uid/gid |
| 459 | * in the file list to local names */ |
| 460 | void recv_id_list(int f, struct file_list *flist) |
| 461 | { |
| 462 | id_t id; |
| 463 | int i; |
| 464 | |
| 465 | if ((preserve_uid || preserve_acls) && numeric_ids <= 0) { |
| 466 | /* read the uid list */ |
| 467 | while ((id = read_varint30(f)) != 0) |
| 468 | recv_user_name(f, id); |
| 469 | if (xmit_id0_names) |
| 470 | recv_user_name(f, 0); |
| 471 | } |
| 472 | |
| 473 | if ((preserve_gid || preserve_acls) && numeric_ids <= 0) { |
| 474 | /* read the gid list */ |
| 475 | while ((id = read_varint30(f)) != 0) |
| 476 | recv_group_name(f, id, NULL); |
| 477 | if (xmit_id0_names) |
| 478 | recv_group_name(f, 0, NULL); |
| 479 | } |
| 480 | |
| 481 | /* Now convert all the uids/gids from sender values to our values. */ |
| 482 | #ifdef SUPPORT_ACLS |
| 483 | if (preserve_acls && (!numeric_ids || usermap || groupmap)) |
| 484 | match_acl_ids(); |
| 485 | #endif |
| 486 | if (am_root && preserve_uid && (!numeric_ids || usermap)) { |
| 487 | for (i = 0; i < flist->used; i++) |
| 488 | F_OWNER(flist->files[i]) = match_uid(F_OWNER(flist->files[i])); |
| 489 | } |
| 490 | if (preserve_gid && (!am_root || !numeric_ids || groupmap)) { |
| 491 | for (i = 0; i < flist->used; i++) { |
| 492 | F_GROUP(flist->files[i]) = match_gid(F_GROUP(flist->files[i]), &flist->files[i]->flags); |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | void parse_name_map(char *map, BOOL usernames) |
| 498 | { |
no test coverage detected