(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/login-process.c) |
| |
| 630 | | | static pid_t create_login_process(struct login_group *group) |
| 631 | | | { |
| 632 | | | struct log_io *log; |
| 633 | | | const struct listener *listens; |
| 634 | | | unsigned int max_log_lines_per_sec; |
| 635 | | | const char *prefix; |
| 636 | | | pid_t pid; |
| 637 | | | ARRAY_TYPE(dup2) dups; |
| 638 | | | unsigned int i, listen_count = 0, ssl_listen_count = 0; |
| 639 | | | int fd[2], log_fd, cur_fd, tmp_fd; |
| 640 | | | |
| 641 | | | if (group->set->login_uid == 0) |
Event 1:
Skipping " if". group->set->login_uid == 0 evaluates to false.
hide
|
|
| 642 | | | i_fatal("Login process must not run as root"); |
| 643 | | | |
| 644 | | | |
| 645 | | | if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
x /usr/include/bits/socket.h |
| |
76 | #define PF_UNIX PF_LOCAL /* POSIX name for PF_LOCAL. */ |
| |
x /usr/include/bits/socket.h |
| |
75 | #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ |
| |
x /usr/include/bits/socket.h |
| |
75 | #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ |
| |
x /usr/include/bits/socket.h |
| |
44 | #define SOCK_STREAM SOCK_STREAM |
| |
|
Event 2:
Skipping " if". socketpair(...) < 0 evaluates to false.
hide
|
|
| 646 | | | i_error("socketpair() failed: %m"); |
| 647 | | | return -1; |
| 648 | | | } |
| 649 | | | |
| 650 | | | max_log_lines_per_sec = |
| 651 | | | group->set->login_process_per_connection ? 10 : 0; |
Event 3:
group->set->login_process_per_connection evaluates to false.
hide
|
|
| 652 | | | log_fd = log_create_pipe(&log, max_log_lines_per_sec); |
| 653 | | | if (log_fd < 0) |
Event 4:
Taking false branch. log_fd < 0 evaluates to false.
hide
|
|
| 654 | | | pid = -1; |
| 655 | | | else { |
| 656 | | | pid = fork(); |
| 657 | | | if (pid < 0) |
Event 5:
Skipping " if". pid < 0 evaluates to false.
hide
|
|
| 658 | | | i_error("fork() failed: %m"); |
| 659 | | | } |
| 660 | | | |
| 661 | | | if (pid < 0) { |
Event 6:
Skipping " if". pid < 0 evaluates to false.
hide
|
|
| 662 | | | (void)close(fd[0]); |
| 663 | | | (void)close(fd[1]); |
| 664 | | | (void)close(log_fd); |
| 665 | | | return -1; |
| 666 | | | } |
| 667 | | | |
| 668 | | | if (pid != 0) { |
Event 7:
Skipping " if". pid != 0 evaluates to false.
hide
|
|
| 669 | | | |
| 670 | | | prefix = t_strdup_printf("%s-login: ", |
| 671 | | | process_names[group->mail_process_type]); |
| 672 | | | log_set_prefix(log, prefix); |
| 673 | | | log_set_pid(log, pid); |
| 674 | | | |
| 675 | | | net_set_nonblock(fd[0], TRUE); |
| 676 | | | fd_close_on_exec(fd[0], TRUE); |
| 677 | | | (void)login_process_new(group, pid, fd[0], FALSE); |
| 678 | | | (void)close(fd[1]); |
| 679 | | | (void)close(log_fd); |
| 680 | | | return pid; |
| 681 | | | } |
| 682 | | | |
| 683 | | | prefix = t_strdup_printf("master-%s-login: ", |
| 684 | | | process_names[group->mail_process_type]); |
| 685 | | | log_set_prefix(log, prefix); |
| 686 | | | |
| 687 | | | t_array_init(&dups, 16);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
39 | #define t_array_init(array, init_count) \ |
40 | p_array_init(array, pool_datastack_create(), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
35 | #define p_array_init(array, pool, init_count) \ |
36 | array_create(array, pool, sizeof(**(array)->v), init_count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
75 | #define array_create(array, pool, element_size, init_count) \ |
76 | array_create_i(&(array)->arr, pool, element_size, init_count) |
| |
|
| 688 | | | dup2_append(&dups, null_fd, STDIN_FILENO);
x /usr/include/unistd.h |
| |
211 | #define STDIN_FILENO 0 /* Standard input. */ |
| |
|
| 689 | | | |
| 690 | | | |
| 691 | | | dup2_append(&dups, log_fd, STDOUT_FILENO);
x /usr/include/unistd.h |
| |
212 | #define STDOUT_FILENO 1 /* Standard output. */ |
| |
|
| 692 | | | dup2_append(&dups, log_fd, STDERR_FILENO);
x /usr/include/unistd.h |
| |
213 | #define STDERR_FILENO 2 /* Standard error output. */ |
| |
|
| 693 | | | dup2_append(&dups, fd[1], LOGIN_MASTER_SOCKET_FD); |
| 694 | | | |
| 695 | | | |
| 696 | | | cur_fd = LOGIN_MASTER_SOCKET_FD + 1; |
| 697 | [+] | | if (array_is_created(&group->set->listens)) {
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
91 | #define array_is_created(array) \ |
92 | array_is_created_i(&(array)->arr) |
| |
|
 |
| 698 | | | listens = array_get(&group->set->listens, &listen_count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
156 | #define array_get(array, count) \ |
157 | ARRAY_TYPE_CAST_CONST(array)array_get_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 699 | | | for (i = 0; i < listen_count; i++, cur_fd++) |
| 700 | | | dup2_append(&dups, listens[i].fd, cur_fd); |
| 701 | | | } |
| 702 | | | |
| 703 | | | if (array_is_created(&group->set->ssl_listens)) {
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
91 | #define array_is_created(array) \ |
92 | array_is_created_i(&(array)->arr) |
| |
|
Event 10:
Taking true branch. array_is_created_i(...) evaluates to true.
hide
|
|
| 704 | | | listens = array_get(&group->set->ssl_listens,
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
156 | #define array_get(array, count) \ |
157 | ARRAY_TYPE_CAST_CONST(array)array_get_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
43 | # define ARRAY_TYPE_CAST_CONST(array) \ |
44 | (typeof(*(array)->v)) |
| |
|
| 705 | [+] | | &ssl_listen_count); |
 |
| 706 | | | for (i = 0; i < ssl_listen_count; i++, cur_fd++) |
Event 11:
Leaving loop. i < ssl_listen_count evaluates to false.
hide
|
|
| 707 | | | dup2_append(&dups, listens[i].fd, cur_fd); |
| 708 | | | } |
| 709 | | | |
| 710 | | | |
| 711 | | | |
| 712 | | | closelog(); |
| 713 | | | |
| 714 | [+] | | if (dup2_array(&dups) < 0) |
 |
| 715 | | | i_fatal("Failed to dup2() fds"); |
| 716 | | | |
| 717 | | | |
| 718 | | | for (tmp_fd = 0; tmp_fd < cur_fd; tmp_fd++) |
| 719 | | | fd_close_on_exec(tmp_fd, FALSE); |
| 720 | | | |
| 721 | | | (void)close(fd[0]); |
| 722 | | | (void)close(fd[1]); |
| 723 | | | |
| 724 | [+] | | login_process_init_env(group, getpid()); |
 |
| 725 | | | |
| 726 | [+][+] | | env_put(t_strdup_printf("LISTEN_FDS=%u", listen_count)); |
 |
 |
| |