version 1.18, 2005/02/22 22:33:01 |
version 1.19, 2005/04/03 17:32:50 |
|
|
|
|
pwd = getpwnam(cvsd_user); |
pwd = getpwnam(cvsd_user); |
if (pwd == NULL) |
if (pwd == NULL) |
err(EX_NOUSER, "failed to get user `%s'", cvsd_user); |
err(1, "failed to get user `%s'", cvsd_user); |
|
|
grp = getgrnam(cvsd_group); |
grp = getgrnam(cvsd_group); |
if (grp == NULL) |
if (grp == NULL) |
err(EX_NOUSER, "failed to get group `%s'", cvsd_group); |
err(1, "failed to get group `%s'", cvsd_group); |
|
|
endpwent(); |
endpwent(); |
endgrent(); |
endgrent(); |
|
|
|
|
if (!cvsd_fg && daemon(0, 0) == -1) { |
if (!cvsd_fg && daemon(0, 0) == -1) { |
cvs_log(LP_ERRNO, "failed to become a daemon"); |
cvs_log(LP_ERRNO, "failed to become a daemon"); |
exit(EX_OSERR); |
exit(1); |
} |
} |
|
|
if ((cvsd_repo = cvs_repo_load(cvsd_root, repo_flags)) == NULL) { |
if ((cvsd_repo = cvs_repo_load(cvsd_root, repo_flags)) == NULL) { |
cvs_log(LP_ERR, "failed to load repository"); |
cvs_log(LP_ERR, "failed to load repository"); |
exit(EX_OSERR); |
exit(1); |
}; |
}; |
|
|
if (cvsd_sock_open() < 0) { |
if (cvsd_sock_open() < 0) { |
|
|
|
|
if (setegid(cvsd_gid) == -1) { |
if (setegid(cvsd_gid) == -1) { |
cvs_log(LP_ERRNO, "failed to drop group privileges"); |
cvs_log(LP_ERRNO, "failed to drop group privileges"); |
exit(EX_OSERR); |
exit(1); |
} |
} |
if (seteuid(cvsd_uid) == -1) { |
if (seteuid(cvsd_uid) == -1) { |
cvs_log(LP_ERRNO, "failed to drop user privileges"); |
cvs_log(LP_ERRNO, "failed to drop user privileges"); |
exit(EX_OSERR); |
exit(1); |
} |
} |
|
|
signal(SIGINFO, cvsd_sighdlr); |
signal(SIGINFO, cvsd_sighdlr); |
|
|
*/ |
*/ |
if (dup2(sock, CVSD_CHILD_SOCKFD) == -1) { |
if (dup2(sock, CVSD_CHILD_SOCKFD) == -1) { |
cvs_log(LP_ERRNO, "failed to dup child socket"); |
cvs_log(LP_ERRNO, "failed to dup child socket"); |
exit(EX_OSERR); |
exit(1); |
} |
} |
(void)close(sock); |
(void)close(sock); |
|
|
|
|
|
|
execv(CVSD_PATH_CHILD, argv); |
execv(CVSD_PATH_CHILD, argv); |
err(1, "FUCK"); |
err(1, "FUCK"); |
exit(EX_OSERR); |
exit(1); |
} |
} |
|
|
cvs_log(LP_INFO, "spawning child %d", pid); |
cvs_log(LP_INFO, "spawning child %d", pid); |