You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2009/08/25 23:58:05 UTC
svn commit: r807822 - in /httpd/mod_fcgid/trunk/modules/fcgid:
fcgid_pm_unix.c fcgid_proc_unix.c fcgid_proctbl_unix.c
Author: wrowe
Date: Tue Aug 25 21:58:04 2009
New Revision: 807822
URL: http://svn.apache.org/viewvc?rev=807822&view=rev
Log:
Clean up httpd 2.x trunk compilation errors
Modified:
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=807822&r1=807821&r2=807822&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Tue Aug 25 21:58:04 2009
@@ -28,6 +28,17 @@
#include "fcgid_proctbl.h"
#include "fcgid_spawn_ctl.h"
#include <unistd.h>
+
+#if MODULE_MAGIC_NUMBER_MAJOR >= 20090209
+#include "mod_unixd.h"
+#endif
+
+#if MODULE_MAGIC_NUMBER_MAJOR < 20081201
+#define ap_unixd_config unixd_config
+#define ap_unixd_setup_child unixd_setup_child
+#define ap_unixd_set_global_mutex_perms unixd_set_global_mutex_perms
+#endif
+
static apr_status_t create_process_manager(server_rec * main_server,
apr_pool_t * configpool);
@@ -142,6 +153,7 @@
break;
}
}
+
static int set_group_privs(void)
{
if (!geteuid()) {
@@ -149,10 +161,10 @@
/* Get username if passed as a uid */
- if (unixd_config.user_name[0] == '#') {
+ if (ap_unixd_config.user_name[0] == '#') {
struct passwd *ent;
- uid_t uid = atoi(&unixd_config.user_name[1]);
+ uid_t uid = atoi(&ap_unixd_config.user_name[1]);
if ((ent = getpwuid(uid)) == NULL) {
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
@@ -165,7 +177,7 @@
}
else
- name = unixd_config.user_name;
+ name = ap_unixd_config.user_name;
#if !defined(OS2) && !defined(TPF)
/* OS/2 and TPF don't support groups. */
@@ -174,19 +186,19 @@
* Set the GID before initgroups(), since on some platforms
* setgid() is known to zap the group list.
*/
- if (setgid(unixd_config.group_id) == -1) {
+ if (setgid(ap_unixd_config.group_id) == -1) {
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"setgid: unable to set group id to Group %u",
- (unsigned) unixd_config.group_id);
+ (unsigned) ap_unixd_config.group_id);
return -1;
}
/* Reset `groups' attributes. */
- if (initgroups(name, unixd_config.group_id) == -1) {
+ if (initgroups(name, ap_unixd_config.group_id) == -1) {
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"initgroups: unable to set groups for User %s "
"and Group %u", name,
- (unsigned) unixd_config.group_id);
+ (unsigned) ap_unixd_config.group_id);
return -1;
}
#endif /* !defined(OS2) && !defined(TPF) */
@@ -195,7 +207,7 @@
}
-/* Base on unixd_setup_child() */
+/* Base on ap_unixd_setup_child() */
static int suexec_setup_child(void)
{
if (set_group_privs()) {
@@ -203,10 +215,10 @@
}
/* Only try to switch if we're running as root */
- if (!geteuid() && (seteuid(unixd_config.user_id) == -1)) {
+ if (!geteuid() && (seteuid(ap_unixd_config.user_id) == -1)) {
ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
"setuid: unable to change to uid: %ld",
- (long) unixd_config.user_id);
+ (long) ap_unixd_config.user_id);
exit(-1);
}
return 0;
@@ -233,7 +245,7 @@
}
/* if running as root, switch to configured user */
- if (unixd_config.suexec_enabled) {
+ if (ap_unixd_config.suexec_enabled) {
if (getuid() != 0) {
ap_log_error(APLOG_MARK, LOG_EMERG, rv, main_server,
"mod_fcgid: current user is not root while suexec is enabled, exit now");
@@ -241,7 +253,7 @@
}
suexec_setup_child();
} else
- unixd_setup_child();
+ ap_unixd_setup_child();
apr_file_pipe_timeout_set(g_pm_read_pipe,
apr_time_from_sec(g_wakeup_timeout));
apr_file_close(g_ap_write_pipe);
@@ -330,7 +342,8 @@
*/
if (!geteuid()) {
- if (chown(get_socketpath(main_server), unixd_config.user_id, -1) < 0) {
+ if (chown(get_socketpath(main_server),
+ ap_unixd_config.user_id, -1) < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"mod_fcgid: Can't set ownership of unix socket dir %s",
get_socketpath(main_server));
@@ -359,7 +372,7 @@
"mod_fcgid: Can't create global pipe mutex");
exit(1);
}
- if ((rv = unixd_set_global_mutex_perms(g_pipelock)) != APR_SUCCESS) {
+ if ((rv = ap_unixd_set_global_mutex_perms(g_pipelock)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, main_server,
"mod_fcgid: Can't set global pipe mutex perms");
exit(1);
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c?rev=807822&r1=807821&r2=807822&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proc_unix.c Tue Aug 25 21:58:04 2009
@@ -28,6 +28,8 @@
#include "apr_portable.h"
#include "apr_pools.h"
#include "apr_network_io.h"
+#include "ap_mpm.h"
+#include "http_config.h"
#include "mpm_common.h"
#include "util_script.h"
#include "unixd.h"
@@ -40,7 +42,15 @@
#include "fcgid_conf.h"
#include "fcgid_pm.h"
#include "fcgid_spawn_ctl.h"
+
+#if MODULE_MAGIC_NUMBER_MAJOR < 20081201
+#define ap_unixd_config unixd_config
+// #define ap_unixd_setup_child unixd_setup_child
+// #define ap_unixd_set_global_mutex_perms unixd_set_global_mutex_perms
+#endif
+
#define DEFAULT_FCGID_LISTENBACKLOG 5
+
typedef struct {
int handle_socket;
} fcgid_namedpipe_handle;
@@ -65,7 +75,7 @@
const char *execuser, *execgroup;
const char *argv0;
- if (!unixd_config.suexec_enabled) {
+ if (!ap_unixd_config.suexec_enabled) {
return apr_proc_create(newproc, progname, args, env, attr, p);
}
@@ -132,7 +142,7 @@
{
ap_unix_identity_t ugid;
- if (!unixd_config.suexec_enabled
+ if (!ap_unixd_config.suexec_enabled
|| (procinfo->uid == (uid_t) - 1
&& procinfo->gid == (gid_t) - 1)) {
return apr_proc_create(newproc, progname, args, env, attr, p);
@@ -156,7 +166,7 @@
static apr_status_t exec_setuid_cleanup(void *dummy)
{
seteuid(0);
- setuid(unixd_config.user_id);
+ setuid(ap_unixd_config.user_id);
return APR_SUCCESS;
}
@@ -231,7 +241,7 @@
}
/* Unlink it when process exit */
- if (unixd_config.suexec_enabled) {
+ if (ap_unixd_config.suexec_enabled) {
apr_pool_cleanup_register(procnode->proc_pool,
procnode, socket_file_cleanup,
exec_setuid_cleanup);
@@ -264,7 +274,7 @@
/* Correct the file owner */
if (!geteuid()) {
- if (chown(unix_addr.sun_path, unixd_config.user_id, -1) < 0) {
+ if (chown(unix_addr.sun_path, ap_unixd_config.user_id, -1) < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"mod_fcgid: couldn't change owner of unix domain socket %s",
unix_addr.sun_path);
@@ -408,14 +418,15 @@
/* su as root before sending kill signal, for suEXEC */
apr_status_t rv;
- if (unixd_config.suexec_enabled && seteuid(0) != 0) {
+ if (ap_unixd_config.suexec_enabled && seteuid(0) != 0) {
/* It's fatal error */
kill(getpid(), SIGTERM);
return APR_EACCES;
}
rv = apr_proc_kill(procnode->proc_id, SIGTERM);
- if (unixd_config.suexec_enabled && seteuid(unixd_config.user_id) != 0) {
+ if (ap_unixd_config.suexec_enabled && seteuid(ap_unixd_config.user_id) != 0)
+ {
kill(getpid(), SIGTERM);
return APR_EACCES;
}
@@ -427,14 +438,15 @@
{
apr_status_t rv;
- if (unixd_config.suexec_enabled && seteuid(0) != 0) {
+ if (ap_unixd_config.suexec_enabled && seteuid(0) != 0) {
/* It's fatal error */
kill(getpid(), SIGTERM);
return APR_EACCES;
}
rv = apr_proc_kill(procnode->proc_id, SIGKILL);
- if (unixd_config.suexec_enabled && seteuid(unixd_config.user_id) != 0) {
+ if (ap_unixd_config.suexec_enabled && seteuid(ap_unixd_config.user_id) != 0)
+ {
kill(getpid(), SIGTERM);
return APR_EACCES;
}
Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c?rev=807822&r1=807821&r2=807822&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl_unix.c Tue Aug 25 21:58:04 2009
@@ -24,6 +24,10 @@
#include "unixd.h"
#include <unistd.h>
+#if MODULE_MAGIC_NUMBER_MAJOR < 20081201
+#define ap_unixd_set_global_mutex_perms unixd_set_global_mutex_perms
+#endif
+
static apr_shm_t *g_sharemem = NULL;
static apr_global_mutex_t *g_sharelock = NULL;
char g_sharelock_name[L_tmpnam];
@@ -159,7 +163,7 @@
"mod_fcgid: Can't create global mutex");
exit(1);
}
- if ((rv = unixd_set_global_mutex_perms(g_sharelock)) != APR_SUCCESS) {
+ if ((rv = ap_unixd_set_global_mutex_perms(g_sharelock)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, main_server,
"mod_fcgid: Can't set global mutex perms");
exit(1);