(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/master/auth-process.c) |
| |
| 616 | | | static int create_auth_worker(struct auth_process *process, int fd) |
| 617 | | | { |
| 618 | | | struct log_io *log; |
| 619 | | | const char *prefix, *executable; |
| 620 | | | pid_t pid; |
| 621 | | | int log_fd, i; |
| 622 | | | |
| 623 | | | log_fd = log_create_pipe(&log, 0); |
| 624 | | | if (log_fd < 0) |
| 625 | | | pid = -1; |
| 626 | | | else { |
| 627 | | | pid = fork(); |
| 628 | | | if (pid < 0) |
| 629 | | | i_error("fork() failed: %m"); |
| 630 | | | } |
| 631 | | | |
| 632 | | | if (pid < 0) { |
| 633 | | | (void)close(log_fd); |
| 634 | | | return -1; |
| 635 | | | } |
| 636 | | | |
| 637 | | | if (pid != 0) { |
| 638 | | | |
| 639 | | | child_process_add(pid, &auth_worker_child_process); |
| 640 | | | prefix = t_strdup_printf("auth-worker(%s): ", |
| 641 | | | process->group->set->name); |
| 642 | | | log_set_prefix(log, prefix); |
| 643 | | | (void)close(fd); |
| 644 | | | (void)close(log_fd); |
| 645 | | | return 0; |
| 646 | | | } |
| 647 | | | |
| 648 | | | prefix = t_strdup_printf("master-auth-worker(%s): ", |
| 649 | | | process->group->set->name); |
| 650 | | | log_set_prefix(log, prefix); |
| 651 | | | |
| 652 | | | |
| 653 | | | |
| 654 | | | closelog(); |
| 655 | | | |
| 656 | | | |
| 657 | | | |
| 658 | | | if (dup2(null_fd, 0) < 0) |
| 659 | | | i_fatal("dup2(stdin) failed: %m"); |
| 660 | | | if (dup2(null_fd, 1) < 0) |
| 661 | | | i_fatal("dup2(stdout) failed: %m"); |
| 662 | | | |
| 663 | | | if (dup2(log_fd, 2) < 0) |
| 664 | | | i_fatal("dup2(stderr) failed: %m"); |
| 665 | | | |
| 666 | | | if (dup2(fd, 4) < 0) |
| 667 | | | i_fatal("dup2(4) failed: %m"); |
| 668 | | | |
| 669 | | | for (i = 0; i <= 2; i++) |
| 670 | | | fd_close_on_exec(i, FALSE); |
| 671 | | | fd_close_on_exec(4, FALSE); |
| 672 | | | |
| 673 | | | child_process_init_env(); |
| 674 | | | auth_set_environment(process->group->set); |
| 675 | | | |
| 676 | | | executable = t_strconcat(process->group->set->executable, " -w", NULL); |
| 677 | | | client_process_exec(executable, ""); |
| 678 | | | i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable); |
| 679 | | | return -1; |
Unreachable Computation
The highlighted code will not execute under any circumstances. |
|
| 680 | | | } |
| |