diff --git a/CMakeLists.txt b/CMakeLists.txt index cbe73fe..9ad3b95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ ENDMACRO(ADD_TARGET_PROPERTIES) PROJECT(spawn-fcgi) SET(PACKAGE_VERSION 2.0.0) -EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE) OPTION(USE_LIMITS "Enable /etc/security/limits.conf support" ON) IF("${CMAKE_BUILD_TYPE}" STREQUAL "") SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) diff --git a/pam_limits.c b/pam_limits.c index 880de31..bebe16f 100644 --- a/pam_limits.c +++ b/pam_limits.c @@ -275,8 +275,8 @@ process_limit (int source, const char *lim_type, static gboolean pam_modutil_user_in_group_nam_nam(struct passwd *pwd, const char *group) { struct group *grp; - grp = getgrnam(group); size_t i; + grp = getgrnam(group); if (pwd == NULL || grp == NULL) return FALSE; if (pwd->pw_gid == grp->gr_gid) return TRUE; @@ -415,6 +415,7 @@ static int setup_limits(struct pam_limit_s *pl) { } /* now the session stuff */ +int pam_set_limits(const char *conf_file, const char *username); int pam_set_limits(const char *conf_file, const char *username) { int retval; struct pam_limit_s pl; diff --git a/spawn-fcgi.c b/spawn-fcgi.c index 134545e..17a4513 100644 --- a/spawn-fcgi.c +++ b/spawn-fcgi.c @@ -130,7 +130,7 @@ static options opts = { static struct data data; /* only require an entry for name != NULL, otherwise a id as key is ok */ -int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) { +static int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) { struct passwd *pwd; errno = 0; *gid = (gid_t) -1; @@ -145,7 +145,7 @@ int readpwdent(gchar *key, uid_t *uid, gid_t *gid, gchar** name) { return 0; } -int readgrpent(gchar *key, gid_t *gid) { +static int readgrpent(gchar *key, gid_t *gid) { struct group *grp; errno = 0; if (NULL == (grp = getgrnam(key)) && NULL == (grp = getgrgid(atoi(key)))) { @@ -157,7 +157,7 @@ int readgrpent(gchar *key, gid_t *gid) { return 0; } -int create_sockaddr() { +static int create_sockaddr() { if (opts.addr != 0 && opts.port == 0) { g_printerr("Specified address without port\n"); return -1; @@ -196,7 +196,7 @@ int create_sockaddr() { return 0; } -int bind_socket() { +static int bind_socket() { int s, val; /* Check if socket is already open */ @@ -264,7 +264,7 @@ int bind_socket() { return 0; } -int open_pidfile() { +static int open_pidfile() { if (opts.pid_file) { struct stat st; if (0 == (data.pid_fd = open(opts.pid_file, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) { @@ -294,7 +294,7 @@ int open_pidfile() { return 0; } -void prepare_env() { +static void prepare_env() { GString *tmp; if (-1 != opts.php_childs) { tmp = g_string_sized_new(0); @@ -304,7 +304,7 @@ void prepare_env() { } } -int drop_priv() { +static int drop_priv() { if (data.i_am_root) { /* set user and group */ @@ -368,7 +368,7 @@ int drop_priv() { } /* move a fd to another and close the old one */ -void move2fd(int srcfd, int dstfd) { +static void move2fd(int srcfd, int dstfd) { if (srcfd != dstfd) { close(dstfd); dup2(srcfd, dstfd); @@ -377,11 +377,11 @@ void move2fd(int srcfd, int dstfd) { } /* replace an fd with /dev/null */ -void move2devnull(int fd) { +static void move2devnull(int fd) { move2fd(open("/dev/null", O_RDWR), fd); } -pid_t daemonize() { +static pid_t daemonize() { pid_t child; int status; struct timeval tv = { 0, 100 * 1000 }; @@ -451,7 +451,7 @@ void start() { exit(errno); } -gboolean option_parse_address(const gchar *option_name, const gchar *value, gpointer d, GError **error) { +static gboolean option_parse_address(const gchar *option_name, const gchar *value, gpointer d, GError **error) { UNUSED(option_name); UNUSED(d); UNUSED(error); @@ -514,7 +514,7 @@ int main(int argc, char **argv) { if (opts.show_version) { g_printerr(PACKAGE_NAME "-" PACKAGE_VERSION " - spawns fastcgi processes\n"); - g_printerr("Build: " PACKAGE_BUILD_DATE "\n"); + g_printerr("Build-Date: " __DATE__ " " __TIME__ "\n"); return 0; }