From 04607ee245f11eac84320879a3dce791625e4fc2 Mon Sep 17 00:00:00 2001 From: "zodiac@gmail.com" Date: Wed, 29 Sep 2010 18:15:05 +0000 Subject: [PATCH] Minor clean ups. Came up with a feature test for the function signature used by getgrouplist(). Added a few more UNUSED() macros. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@233 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- config.h | 5 ++++- config.h.in | 3 +++ configure | 23 ++++++++++++++++++++++- configure.ac | 10 +++++++++- demo/vt100.js | 2 +- shellinabox/launcher.c | 5 ++--- shellinabox/shell_in_a_box.js | 2 +- shellinabox/shellinaboxd.c | 3 +++ shellinabox/vt100.js | 2 +- 9 files changed, 46 insertions(+), 9 deletions(-) diff --git a/config.h b/config.h index 8441265..d7e2ebb 100644 --- a/config.h +++ b/config.h @@ -22,6 +22,9 @@ /* Define to 1 if you have the `getgrnam_r' function. */ #define HAVE_GETGRNAM_R 1 +/* Define to 1 if getgrouplist() takes ints as arguments */ +/* #undef HAVE_GETGROUPLIST_TAKES_INTS */ + /* Define to 1 if you have the `gethostbyname_r' function. */ #define HAVE_GETHOSTBYNAME_R 1 @@ -171,7 +174,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "232" +#define VCS_REVISION "233" /* Version number of package */ #define VERSION "2.10" diff --git a/config.h.in b/config.h.in index 94f6737..6a3ba1d 100644 --- a/config.h.in +++ b/config.h.in @@ -21,6 +21,9 @@ /* Define to 1 if you have the `getgrnam_r' function. */ #undef HAVE_GETGRNAM_R +/* Define to 1 if getgrouplist() takes ints as arguments */ +#undef HAVE_GETGROUPLIST_TAKES_INTS + /* Define to 1 if you have the `gethostbyname_r' function. */ #undef HAVE_GETHOSTBYNAME_R diff --git a/configure b/configure index 827be84..3656675 100755 --- a/configure +++ b/configure @@ -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 -VCS_REVISION=232 +VCS_REVISION=233 cat >>confdefs.h <<_ACEOF @@ -10805,6 +10805,27 @@ if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_ATTRIBUTE_UNUSED 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. */ +#define _BSD_SOURCE + #include + #include +int +main () +{ +int (*f)(const char *, int, int *, int *) = getgrouplist; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_GETGROUPLIST_TAKES_INTS 1" >>confdefs.h + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext diff --git a/configure.ac b/configure.ac index fb80da4..ef30c26 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.57) dnl This is the one location where the authoritative version number is stored AC_INIT(shellinabox, 2.10, markus@shellinabox.com) -VCS_REVISION=232 +VCS_REVISION=233 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) @@ -84,6 +84,14 @@ 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 Check the function signature of getgrouplist() +AC_TRY_LINK([#define _BSD_SOURCE + #include + #include ], + [int (*f)(const char *, int, int *, int *) = getgrouplist;], + [AC_DEFINE(HAVE_GETGROUPLIST_TAKES_INTS, 1, + Define to 1 if getgrouplist() takes ints as arguments)]) + 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. AC_ARG_ENABLE(login, diff --git a/demo/vt100.js b/demo/vt100.js index 16e7a8b..4182edf 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 232)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 233)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c index a60f419..49a51a7 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -168,9 +168,8 @@ static int (*x_misc_conv)(int, const struct pam_message **, #endif // MacOS X has a somewhat unusual definition of getgrouplist() which can -// trigger a compile warning. Unfortunately, there is no good feature test -// for this particular problem. -#if defined(__APPLE__) && defined(__MACH__) +// trigger a compile warning. +#if defined(HAVE_GETGROUPLIST_TAKES_INTS) static int x_getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups) { return getgrouplist(user, (int)group, (int *)groups, ngroups); diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index f0bed3d..0d214f0 100644 --- a/shellinabox/shell_in_a_box.js +++ b/shellinabox/shell_in_a_box.js @@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) { }; ShellInABox.prototype.about = function() { - alert("Shell In A Box version " + "2.10 (revision 232)" + + alert("Shell In A Box version " + "2.10 (revision 233)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com" + (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? diff --git a/shellinabox/shellinaboxd.c b/shellinabox/shellinaboxd.c index 5be1ca6..1716129 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -634,6 +634,7 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, // client session. return dataHandler(http, arg, buf, len, url); } + UNUSED(rootPageSize); char *html = stringPrintf(NULL, rootPageStart, enableSSL ? "true" : "false"); serveStaticFile(http, "text/html", html, strrchr(html, '\000')); @@ -846,6 +847,7 @@ static void parseArgs(int argc, char * const argv[]) { int verbosity = MSG_DEFAULT; externalFiles = newHashMap(destroyExternalFileHashEntry, NULL); HashMap *serviceTable = newHashMap(destroyServiceHashEntry, NULL); + UNUSED(stylesSize); check(cssStyleSheet = strdup(stylesStart)); for (;;) { @@ -1274,6 +1276,7 @@ int main(int argc, char * const argv[]) { "X-ShellInABox-Pid: %d\r\n" "Content-type: text/html; charset=utf-8\r\n\r\n", port, getpid()); + UNUSED(cgiRootSize); printfUnchecked(cgiRootStart, port, cgiSessionKey); fflush(stdout); check(!NOINTR(close(fds[1]))); diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 16e7a8b..4182edf 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 232)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 233)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); };