Some changes to improve compatibility with MacOS X.
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@231 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
81af285a8d
commit
301823036a
18 changed files with 242 additions and 59 deletions
17
config.h
17
config.h
|
@ -4,6 +4,9 @@
|
||||||
/* Define to 1 if you have support for symbol aliasing */
|
/* Define to 1 if you have support for symbol aliasing */
|
||||||
#define HAVE_ATTRIBUTE_ALIAS 1
|
#define HAVE_ATTRIBUTE_ALIAS 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have support for the "unused" attribute */
|
||||||
|
#define HAVE_ATTRIBUTE_UNUSED 1
|
||||||
|
|
||||||
/* Set if you want support for calling /bin/login */
|
/* Set if you want support for calling /bin/login */
|
||||||
#define HAVE_BIN_LOGIN 1
|
#define HAVE_BIN_LOGIN 1
|
||||||
|
|
||||||
|
@ -28,6 +31,12 @@
|
||||||
/* Define to 1 if you have the `getpwuid_r' function. */
|
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||||
#define HAVE_GETPWUID_R 1
|
#define HAVE_GETPWUID_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getresgid' function. */
|
||||||
|
#define HAVE_GETRESGID 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getresuid' function. */
|
||||||
|
#define HAVE_GETRESUID 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
@ -73,6 +82,12 @@
|
||||||
/* Define to 1 if you have the <security/pam_misc.h> header file. */
|
/* Define to 1 if you have the <security/pam_misc.h> header file. */
|
||||||
#define HAVE_SECURITY_PAM_MISC_H 1
|
#define HAVE_SECURITY_PAM_MISC_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setresgid' function. */
|
||||||
|
#define HAVE_SETRESGID 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setresuid' function. */
|
||||||
|
#define HAVE_SETRESUID 1
|
||||||
|
|
||||||
/* Define to 1 if you have a working sigwait */
|
/* Define to 1 if you have a working sigwait */
|
||||||
#define HAVE_SIGWAIT 1
|
#define HAVE_SIGWAIT 1
|
||||||
|
|
||||||
|
@ -156,7 +171,7 @@
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Most recent revision number in the version control system */
|
/* Most recent revision number in the version control system */
|
||||||
#define VCS_REVISION "230"
|
#define VCS_REVISION "231"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "2.10"
|
#define VERSION "2.10"
|
||||||
|
|
15
config.h.in
15
config.h.in
|
@ -3,6 +3,9 @@
|
||||||
/* Define to 1 if you have support for symbol aliasing */
|
/* Define to 1 if you have support for symbol aliasing */
|
||||||
#undef HAVE_ATTRIBUTE_ALIAS
|
#undef HAVE_ATTRIBUTE_ALIAS
|
||||||
|
|
||||||
|
/* Define to 1 if you have support for the "unused" attribute */
|
||||||
|
#undef HAVE_ATTRIBUTE_UNUSED
|
||||||
|
|
||||||
/* Set if you want support for calling /bin/login */
|
/* Set if you want support for calling /bin/login */
|
||||||
#undef HAVE_BIN_LOGIN
|
#undef HAVE_BIN_LOGIN
|
||||||
|
|
||||||
|
@ -27,6 +30,12 @@
|
||||||
/* Define to 1 if you have the `getpwuid_r' function. */
|
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||||
#undef HAVE_GETPWUID_R
|
#undef HAVE_GETPWUID_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getresgid' function. */
|
||||||
|
#undef HAVE_GETRESGID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getresuid' function. */
|
||||||
|
#undef HAVE_GETRESUID
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#undef HAVE_INTTYPES_H
|
#undef HAVE_INTTYPES_H
|
||||||
|
|
||||||
|
@ -72,6 +81,12 @@
|
||||||
/* Define to 1 if you have the <security/pam_misc.h> header file. */
|
/* Define to 1 if you have the <security/pam_misc.h> header file. */
|
||||||
#undef HAVE_SECURITY_PAM_MISC_H
|
#undef HAVE_SECURITY_PAM_MISC_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setresgid' function. */
|
||||||
|
#undef HAVE_SETRESGID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setresuid' function. */
|
||||||
|
#undef HAVE_SETRESUID
|
||||||
|
|
||||||
/* Define to 1 if you have a working sigwait */
|
/* Define to 1 if you have a working sigwait */
|
||||||
#undef HAVE_SIGWAIT
|
#undef HAVE_SIGWAIT
|
||||||
|
|
||||||
|
|
23
configure
vendored
23
configure
vendored
|
@ -2328,7 +2328,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
VCS_REVISION=230
|
VCS_REVISION=231
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
@ -10655,7 +10655,7 @@ done
|
||||||
|
|
||||||
|
|
||||||
for ac_func in getgrgid_r getgrnam_r gethostbyname_r getpwnam_r getpwuid_r \
|
for ac_func in getgrgid_r getgrnam_r gethostbyname_r getpwnam_r getpwuid_r \
|
||||||
openpty strcasestr
|
openpty strcasestr getresuid getresgid setresuid setresgid
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -10786,6 +10786,25 @@ if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
|
||||||
$as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h
|
$as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
void x(int i __attribute__((unused))) __attribute__((unused));
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_ATTRIBUTE_UNUSED 1" >>confdefs.h
|
||||||
|
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
|
10
configure.ac
10
configure.ac
|
@ -2,7 +2,7 @@ AC_PREREQ(2.57)
|
||||||
|
|
||||||
dnl This is the one location where the authoritative version number is stored
|
dnl This is the one location where the authoritative version number is stored
|
||||||
AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
|
AC_INIT(shellinabox, 2.10, markus@shellinabox.com)
|
||||||
VCS_REVISION=230
|
VCS_REVISION=231
|
||||||
AC_SUBST(VCS_REVISION)
|
AC_SUBST(VCS_REVISION)
|
||||||
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
|
AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}",
|
||||||
[Most recent revision number in the version control system])
|
[Most recent revision number in the version control system])
|
||||||
|
@ -34,7 +34,7 @@ AC_CHECK_FUNCS([strlcat])
|
||||||
|
|
||||||
dnl Prefer thread-safe functions, if available
|
dnl Prefer thread-safe functions, if available
|
||||||
AC_CHECK_FUNCS([getgrgid_r getgrnam_r gethostbyname_r getpwnam_r getpwuid_r \
|
AC_CHECK_FUNCS([getgrgid_r getgrnam_r gethostbyname_r getpwnam_r getpwuid_r \
|
||||||
openpty strcasestr ])
|
openpty strcasestr getresuid getresgid setresuid setresgid ])
|
||||||
|
|
||||||
dnl We prefer ptsname_r(), but will settle for ptsname() if necessary
|
dnl We prefer ptsname_r(), but will settle for ptsname() if necessary
|
||||||
AC_TRY_LINK([#ifndef _XOPEN_SOURCE
|
AC_TRY_LINK([#ifndef _XOPEN_SOURCE
|
||||||
|
@ -78,6 +78,12 @@ AC_TRY_LINK([void x(void) { };
|
||||||
[AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
|
[AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
|
||||||
Define to 1 if you have support for symbol aliasing)])
|
Define to 1 if you have support for symbol aliasing)])
|
||||||
|
|
||||||
|
dnl Check if the compiler has support to mark parameters as unused
|
||||||
|
AC_TRY_LINK([void x(int i __attribute__((unused))) __attribute__((unused));],
|
||||||
|
[],
|
||||||
|
[AC_DEFINE(HAVE_ATTRIBUTE_UNUSED, 1,
|
||||||
|
Define to 1 if you have support for the "unused" attribute)])
|
||||||
|
|
||||||
dnl On some systems, calling /bin/login does not work. Disable the LOGIN
|
dnl On some systems, calling /bin/login does not work. Disable the LOGIN
|
||||||
dnl feature, if the user tells us that it does not do the right thing.
|
dnl feature, if the user tells us that it does not do the right thing.
|
||||||
AC_ARG_ENABLE(login,
|
AC_ARG_ENABLE(login,
|
||||||
|
|
|
@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.10 (revision 230)" +
|
alert("VT100 Terminal Emulator " + "2.10 (revision 231)" +
|
||||||
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com");
|
"For more information check http://shellinabox.com");
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,6 +71,13 @@
|
||||||
#endif
|
#endif
|
||||||
#define max(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b); \
|
#define max(a, b) ({ typeof(a) _a = (a); typeof(b) _b = (b); \
|
||||||
_a > _b ? _a : _b; })
|
_a > _b ? _a : _b; })
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libhttp/httpconnection.h"
|
#include "libhttp/httpconnection.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
@ -270,8 +277,8 @@ static int httpFinishCommand(struct HttpConnection *http) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void httpDestroyHeaders(void *arg, char *key, char *value) {
|
static void httpDestroyHeaders(void *arg ATTR_UNUSED, char *key, char *value) {
|
||||||
(void)arg;
|
UNUSED(arg);
|
||||||
free(key);
|
free(key);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,14 @@
|
||||||
#include "libhttp/ssl.h"
|
#include "libhttp/ssl.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INITIAL_TIMEOUT (10*60)
|
#define INITIAL_TIMEOUT (10*60)
|
||||||
|
|
||||||
// Maximum amount of payload (e.g. form values that have been POST'd) that we
|
// Maximum amount of payload (e.g. form values that have been POST'd) that we
|
||||||
|
@ -128,8 +136,8 @@ static int serverCollectHandler(struct HttpConnection *http, void *handler_) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serverDestroyHandlers(void *arg, char *value) {
|
static void serverDestroyHandlers(void *arg ATTR_UNUSED, char *value) {
|
||||||
(void)arg;
|
UNUSED(arg);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +191,9 @@ void serverRegisterWebSocketHandler(struct Server *server, const char *url,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int serverQuitHandler(struct HttpConnection *http, void *arg) {
|
static int serverQuitHandler(struct HttpConnection *http ATTR_UNUSED,
|
||||||
(void)arg;
|
void *arg) {
|
||||||
|
UNUSED(arg);
|
||||||
httpSendReply(http, 200, "Good Bye", NO_MSG);
|
httpSendReply(http, 200, "Good Bye", NO_MSG);
|
||||||
httpExitLoop(http, 1);
|
httpExitLoop(http, 1);
|
||||||
return HTTP_DONE;
|
return HTTP_DONE;
|
||||||
|
|
|
@ -64,6 +64,14 @@
|
||||||
#include "libhttp/httpconnection.h"
|
#include "libhttp/httpconnection.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef pthread_once
|
#undef pthread_once
|
||||||
#undef pthread_sigmask
|
#undef pthread_sigmask
|
||||||
|
|
||||||
|
@ -541,8 +549,9 @@ static int sslSetCertificateFromFile(SSL_CTX *context,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TLSEXT
|
#ifdef HAVE_TLSEXT
|
||||||
static int sslSNICallback(SSL *sslHndl, int *al, struct SSLSupport *ssl) {
|
static int sslSNICallback(SSL *sslHndl, int *al ATTR_UNUSED,
|
||||||
(void)al;
|
struct SSLSupport *ssl) {
|
||||||
|
UNUSED(al);
|
||||||
check(!ERR_peek_error());
|
check(!ERR_peek_error());
|
||||||
const char *name = SSL_get_servername(sslHndl,
|
const char *name = SSL_get_servername(sslHndl,
|
||||||
TLSEXT_NAMETYPE_host_name);
|
TLSEXT_NAMETYPE_host_name);
|
||||||
|
@ -615,10 +624,10 @@ static int sslSNICallback(SSL *sslHndl, int *al, struct SSLSupport *ssl) {
|
||||||
// This is a not-thread-safe replacement for gethostbyname_r()
|
// This is a not-thread-safe replacement for gethostbyname_r()
|
||||||
#define gethostbyname_r x_gethostbyname_r
|
#define gethostbyname_r x_gethostbyname_r
|
||||||
static int gethostbyname_r(const char *name, struct hostent *ret,
|
static int gethostbyname_r(const char *name, struct hostent *ret,
|
||||||
char *buf, size_t buflen,
|
char *buf ATTR_UNUSED, size_t buflen ATTR_UNUSED,
|
||||||
struct hostent **result, int *h_errnop) {
|
struct hostent **result, int *h_errnop) {
|
||||||
(void)buf;
|
UNUSED(buf);
|
||||||
(void)buflen;
|
UNUSED(buflen);
|
||||||
if (result) {
|
if (result) {
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,14 @@
|
||||||
|
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *urlUnescape(char *s) {
|
static char *urlUnescape(char *s) {
|
||||||
int warned = 0;
|
int warned = 0;
|
||||||
char *r = s;
|
char *r = s;
|
||||||
|
@ -86,8 +94,9 @@ static char *urlUnescape(char *s) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void urlDestroyHashMapEntry(void *arg, char *key, char *value) {
|
static void urlDestroyHashMapEntry(void *arg ATTR_UNUSED, char *key,
|
||||||
(void)arg;
|
char *value) {
|
||||||
|
UNUSED(arg);
|
||||||
free(key);
|
free(key);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,10 @@
|
||||||
#if defined(HAVE_SECURITY_PAM_MISC_H)
|
#if defined(HAVE_SECURITY_PAM_MISC_H)
|
||||||
#include <security/pam_misc.h>
|
#include <security/pam_misc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PAM_DATA_SILENT
|
||||||
|
#define PAM_DATA_SILENT 0
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
struct pam_message;
|
struct pam_message;
|
||||||
struct pam_response;
|
struct pam_response;
|
||||||
|
@ -116,6 +120,14 @@ typedef struct pam_handle pam_handle_t;
|
||||||
#include "libhttp/hashmap.h"
|
#include "libhttp/hashmap.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef pthread_once
|
#undef pthread_once
|
||||||
#undef execle
|
#undef execle
|
||||||
int execle(const char *, const char *, ...);
|
int execle(const char *, const char *, ...);
|
||||||
|
@ -562,9 +574,10 @@ void deleteUtmp(struct Utmp *utmp) {
|
||||||
free(utmp);
|
free(utmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyUtmpHashEntry(void *arg, char *key, char *value) {
|
static void destroyUtmpHashEntry(void *arg ATTR_UNUSED, char *key ATTR_UNUSED,
|
||||||
(void)arg;
|
char *value) {
|
||||||
(void)key;
|
UNUSED(arg);
|
||||||
|
UNUSED(key);
|
||||||
deleteUtmp((struct Utmp *)value);
|
deleteUtmp((struct Utmp *)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,10 +804,11 @@ static const struct passwd *getPWEnt(uid_t uid) {
|
||||||
return passwd;
|
return passwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sigAlrmHandler(int sig, siginfo_t *info, void *unused) {
|
static void sigAlrmHandler(int sig ATTR_UNUSED, siginfo_t *info ATTR_UNUSED,
|
||||||
(void)sig;
|
void *unused ATTR_UNUSED) {
|
||||||
(void)info;
|
UNUSED(sig);
|
||||||
(void)unused;
|
UNUSED(info);
|
||||||
|
UNUSED(unused);
|
||||||
puts("\nLogin timed out after 60 seconds.");
|
puts("\nLogin timed out after 60 seconds.");
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1079,17 +1093,18 @@ static pam_handle_t *internalLogin(struct Service *service, struct Utmp *utmp,
|
||||||
return pam;
|
return pam;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyVariableHashEntry(void *arg, char *key, char *value) {
|
static void destroyVariableHashEntry(void *arg ATTR_UNUSED, char *key,
|
||||||
(void)arg;
|
char *value) {
|
||||||
|
UNUSED(arg);
|
||||||
free(key);
|
free(key);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void execService(int width, int height, struct Service *service,
|
static void execService(int width ATTR_UNUSED, int height ATTR_UNUSED,
|
||||||
const char *peerName, char **environment,
|
struct Service *service, const char *peerName,
|
||||||
const char *url) {
|
char **environment, const char *url) {
|
||||||
(void)width;
|
UNUSED(width);
|
||||||
(void)height;
|
UNUSED(height);
|
||||||
|
|
||||||
// Create a hash table with all the variables that we can expand. This
|
// Create a hash table with all the variables that we can expand. This
|
||||||
// includes all environment variables being passed to the child.
|
// includes all environment variables being passed to the child.
|
||||||
|
@ -1450,10 +1465,11 @@ static void childProcess(struct Service *service, int width, int height,
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sigChildHandler(int sig, siginfo_t *info, void *unused) {
|
static void sigChildHandler(int sig ATTR_UNUSED, siginfo_t *info ATTR_UNUSED,
|
||||||
(void)sig;
|
void *unused ATTR_UNUSED) {
|
||||||
(void)info;
|
UNUSED(sig);
|
||||||
(void)unused;
|
UNUSED(info);
|
||||||
|
UNUSED(unused);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void launcherDaemon(int fd) {
|
static void launcherDaemon(int fd) {
|
||||||
|
|
|
@ -63,6 +63,36 @@ int runAsUser = -1;
|
||||||
int runAsGroup = -1;
|
int runAsGroup = -1;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_GETRESUID
|
||||||
|
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid) {
|
||||||
|
*ruid = getuid();
|
||||||
|
*euid = geteuid();
|
||||||
|
*suid = -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_GETRESGID
|
||||||
|
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) {
|
||||||
|
*rgid = getgid();
|
||||||
|
*egid = getegid();
|
||||||
|
*sgid = -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SETRESUID
|
||||||
|
int setresuid(uid_t ruid, uid_t euid, uid_t suid) {
|
||||||
|
return setreuid(ruid, euid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SETRESGID
|
||||||
|
int setresgid(gid_t rgid, gid_t egid, gid_t sgid) {
|
||||||
|
return setregid(rgid, egid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void removeGroupPrivileges(int showError) {
|
static void removeGroupPrivileges(int showError) {
|
||||||
gid_t rg, eg, sg;
|
gid_t rg, eg, sg;
|
||||||
check(!getresgid(&rg, &eg, &sg));
|
check(!getresgid(&rg, &eg, &sg));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// privileges.h -- Manage process privileges
|
// privileges.h -- Manage process privileges
|
||||||
// Copyright (C) 2008-2009 Markus Gutschke <markus@shellinabox.com>
|
// Copyright (C) 2008-2010 Markus Gutschke <markus@shellinabox.com>
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License version 2 as
|
// it under the terms of the GNU General Public License version 2 as
|
||||||
|
@ -60,4 +60,17 @@ const char *getGroupName(gid_t gid);
|
||||||
gid_t getGroupId(const char *name);
|
gid_t getGroupId(const char *name);
|
||||||
gid_t parseGroup(const char *arg, const char **name);
|
gid_t parseGroup(const char *arg, const char **name);
|
||||||
|
|
||||||
|
#ifndef HAVE_GETRESUID
|
||||||
|
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_GETRESGID
|
||||||
|
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_SETRESUID
|
||||||
|
int setresuid(uid_t ruid, uid_t euid, uid_t suid);
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_SETRESGID
|
||||||
|
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,6 +55,13 @@
|
||||||
#include "shellinabox/privileges.h"
|
#include "shellinabox/privileges.h"
|
||||||
#include "shellinabox/service.h"
|
#include "shellinabox/service.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
struct Service **services;
|
struct Service **services;
|
||||||
int numServices;
|
int numServices;
|
||||||
|
@ -242,15 +249,17 @@ void deleteService(struct Service *service) {
|
||||||
free(service);
|
free(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyServiceHashEntry(void *arg, char *key, char *value) {
|
void destroyServiceHashEntry(void *arg ATTR_UNUSED, char *key ATTR_UNUSED,
|
||||||
(void)arg;
|
char *value ATTR_UNUSED) {
|
||||||
(void)key;
|
UNUSED(arg);
|
||||||
(void)value;
|
UNUSED(key);
|
||||||
|
UNUSED(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int enumerateServicesHelper(void *arg, const char *key, char **value) {
|
static int enumerateServicesHelper(void *arg ATTR_UNUSED,
|
||||||
(void)arg;
|
const char *key ATTR_UNUSED, char **value) {
|
||||||
(void)key;
|
UNUSED(arg);
|
||||||
|
UNUSED(key);
|
||||||
|
|
||||||
check(services = realloc(services,
|
check(services = realloc(services,
|
||||||
++numServices * sizeof(struct Service *)));
|
++numServices * sizeof(struct Service *)));
|
||||||
|
|
|
@ -54,6 +54,14 @@
|
||||||
#include "shellinabox/session.h"
|
#include "shellinabox/session.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
static HashMap *sessions;
|
static HashMap *sessions;
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,9 +160,10 @@ void finishAllSessions(void) {
|
||||||
deleteHashMap(sessions);
|
deleteHashMap(sessions);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroySessionHashEntry(void *arg, char *key, char *value) {
|
static void destroySessionHashEntry(void *arg ATTR_UNUSED,
|
||||||
(void)arg;
|
char *key ATTR_UNUSED, char *value) {
|
||||||
(void)key;
|
UNUSED(arg);
|
||||||
|
UNUSED(key);
|
||||||
|
|
||||||
deleteSession((struct Session *)value);
|
deleteSession((struct Session *)value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.about = function() {
|
ShellInABox.prototype.about = function() {
|
||||||
alert("Shell In A Box version " + "2.10 (revision 230)" +
|
alert("Shell In A Box version " + "2.10 (revision 231)" +
|
||||||
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com" +
|
"For more information check http://shellinabox.com" +
|
||||||
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
(typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ?
|
||||||
|
|
|
@ -89,6 +89,13 @@
|
||||||
#include "shellinabox/styles.h"
|
#include "shellinabox/styles.h"
|
||||||
#include "shellinabox/vt100.h"
|
#include "shellinabox/vt100.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PORTNUM 4200
|
#define PORTNUM 4200
|
||||||
#define MAX_RESPONSE 2048
|
#define MAX_RESPONSE 2048
|
||||||
|
@ -275,8 +282,8 @@ static void sessionDone(void *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleSession(struct ServerConnection *connection, void *arg,
|
static int handleSession(struct ServerConnection *connection, void *arg,
|
||||||
short *events, short revents) {
|
short *events ATTR_UNUSED, short revents) {
|
||||||
(void)events;
|
UNUSED(events);
|
||||||
struct Session *session = (struct Session *)arg;
|
struct Session *session = (struct Session *)arg;
|
||||||
session->connection = connection;
|
session->connection = connection;
|
||||||
int len = MAX_RESPONSE - session->len;
|
int len = MAX_RESPONSE - session->len;
|
||||||
|
@ -330,8 +337,8 @@ static int invalidatePendingHttpSession(void *arg, const char *key,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dataHandler(HttpConnection *http, struct Service *service,
|
static int dataHandler(HttpConnection *http, struct Service *service,
|
||||||
const char *buf, int len, URL *url) {
|
const char *buf, int len ATTR_UNUSED, URL *url) {
|
||||||
(void)len;
|
UNUSED(len);
|
||||||
if (!buf) {
|
if (!buf) {
|
||||||
// Somebody unexpectedly closed our http connection (e.g. because of a
|
// Somebody unexpectedly closed our http connection (e.g. because of a
|
||||||
// timeout). This is the last notification that we will get.
|
// timeout). This is the last notification that we will get.
|
||||||
|
@ -815,8 +822,9 @@ static void usage(void) {
|
||||||
free((char *)group);
|
free((char *)group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroyExternalFileHashEntry(void *arg, char *key, char *value) {
|
static void destroyExternalFileHashEntry(void *arg ATTR_UNUSED, char *key,
|
||||||
(void)arg;
|
char *value) {
|
||||||
|
UNUSED(arg);
|
||||||
free(key);
|
free(key);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,20 @@
|
||||||
#include "shellinabox/usercss.h"
|
#include "shellinabox/usercss.h"
|
||||||
#include "libhttp/hashmap.h"
|
#include "libhttp/hashmap.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNUSED
|
||||||
|
#defined ATTR_UNUSED __attribute__((unused))
|
||||||
|
#defined UNUSED(x) do { } while (0)
|
||||||
|
#else
|
||||||
|
#define ATTR_UNUSED
|
||||||
|
#define UNUSED(x) do { (void)(x); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct HashMap *defines;
|
static struct HashMap *defines;
|
||||||
|
|
||||||
static void definesDestructor(void *arg, char *key, char *value) {
|
static void definesDestructor(void *arg ATTR_UNUSED, char *key,
|
||||||
(void)arg;
|
char *value ATTR_UNUSED) {
|
||||||
(void)value;
|
UNUSED(arg);
|
||||||
|
UNUSED(value);
|
||||||
|
|
||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.10 (revision 230)" +
|
alert("VT100 Terminal Emulator " + "2.10 (revision 231)" +
|
||||||
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
"\nCopyright 2008-2010 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com");
|
"For more information check http://shellinabox.com");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue