Fixed various issues with building on OpenBSD
git-svn-id: https://shellinabox.googlecode.com/svn/trunk@119 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
abb9a50f3b
commit
41fd8f3ea5
18 changed files with 17070 additions and 21678 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2009-05-20 Markus Gutschke <markus@shellinabox.com>
|
||||||
|
|
||||||
|
* Fixed various issues with building on OpenBSD
|
||||||
|
|
||||||
2009-04-28 Markus Gutschke <markus@shellinabox.com>
|
2009-04-28 Markus Gutschke <markus@shellinabox.com>
|
||||||
|
|
||||||
* Fixed variable expansion in service descriptions.
|
* Fixed variable expansion in service descriptions.
|
||||||
|
|
12
Makefile.am
12
Makefile.am
|
@ -143,7 +143,7 @@ clean-local:
|
||||||
debian/tmp
|
debian/tmp
|
||||||
|
|
||||||
.css.o:
|
.css.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -169,7 +169,7 @@ clean-local:
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.html.o:
|
.html.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -195,7 +195,7 @@ clean-local:
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.ico.o:
|
.ico.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -223,7 +223,7 @@ clean-local:
|
||||||
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
|
|
||||||
.jspp.js:
|
.jspp.js:
|
||||||
@$(ECHO) preprocess "$<" "$@"
|
@echo preprocess "$<" "$@"
|
||||||
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
||||||
-e t \
|
-e t \
|
||||||
-e d "$<"`" \
|
-e d "$<"`" \
|
||||||
|
@ -232,7 +232,7 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
"$<" >"$@"
|
"$<" >"$@"
|
||||||
|
|
||||||
.js.o:
|
.js.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo $(host_cpu) | \
|
-I binary `echo $(host_cpu) | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -258,7 +258,7 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.wav.o:
|
.wav.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
|
41
Makefile.in
41
Makefile.in
|
@ -1,4 +1,4 @@
|
||||||
# Makefile.in generated by automake 1.10.1 from Makefile.am.
|
# Makefile.in generated by automake 1.10.2 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
@ -137,39 +137,40 @@ CCDEPMODE = @CCDEPMODE@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
CXX = @CXX@
|
|
||||||
CXXCPP = @CXXCPP@
|
|
||||||
CXXDEPMODE = @CXXDEPMODE@
|
|
||||||
CXXFLAGS = @CXXFLAGS@
|
|
||||||
CYGPATH_W = @CYGPATH_W@
|
CYGPATH_W = @CYGPATH_W@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
DEPDIR = @DEPDIR@
|
DEPDIR = @DEPDIR@
|
||||||
DSYMUTIL = @DSYMUTIL@
|
DSYMUTIL = @DSYMUTIL@
|
||||||
ECHO = @ECHO@
|
DUMPBIN = @DUMPBIN@
|
||||||
ECHO_C = @ECHO_C@
|
ECHO_C = @ECHO_C@
|
||||||
ECHO_N = @ECHO_N@
|
ECHO_N = @ECHO_N@
|
||||||
ECHO_T = @ECHO_T@
|
ECHO_T = @ECHO_T@
|
||||||
EGREP = @EGREP@
|
EGREP = @EGREP@
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
F77 = @F77@
|
FGREP = @FGREP@
|
||||||
FFLAGS = @FFLAGS@
|
|
||||||
GREP = @GREP@
|
GREP = @GREP@
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
LD = @LD@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
LIBOBJS = @LIBOBJS@
|
LIBOBJS = @LIBOBJS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
LIBTOOL = @LIBTOOL@
|
LIBTOOL = @LIBTOOL@
|
||||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
||||||
|
LIPO = @LIPO@
|
||||||
LN_S = @LN_S@
|
LN_S = @LN_S@
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
MKDIR_P = @MKDIR_P@
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NM = @NM@
|
||||||
NMEDIT = @NMEDIT@
|
NMEDIT = @NMEDIT@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
OBJEXT = @OBJEXT@
|
OBJEXT = @OBJEXT@
|
||||||
|
OTOOL = @OTOOL@
|
||||||
|
OTOOL64 = @OTOOL64@
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
@ -189,8 +190,7 @@ abs_srcdir = @abs_srcdir@
|
||||||
abs_top_builddir = @abs_top_builddir@
|
abs_top_builddir = @abs_top_builddir@
|
||||||
abs_top_srcdir = @abs_top_srcdir@
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
ac_ct_CC = @ac_ct_CC@
|
ac_ct_CC = @ac_ct_CC@
|
||||||
ac_ct_CXX = @ac_ct_CXX@
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
ac_ct_F77 = @ac_ct_F77@
|
|
||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
|
@ -221,6 +221,7 @@ libdir = @libdir@
|
||||||
libexecdir = @libexecdir@
|
libexecdir = @libexecdir@
|
||||||
localedir = @localedir@
|
localedir = @localedir@
|
||||||
localstatedir = @localstatedir@
|
localstatedir = @localstatedir@
|
||||||
|
lt_ECHO = @lt_ECHO@
|
||||||
mandir = @mandir@
|
mandir = @mandir@
|
||||||
mkdir_p = @mkdir_p@
|
mkdir_p = @mkdir_p@
|
||||||
oldincludedir = @oldincludedir@
|
oldincludedir = @oldincludedir@
|
||||||
|
@ -638,7 +639,7 @@ clean-libtool:
|
||||||
-rm -rf .libs _libs
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
distclean-libtool:
|
distclean-libtool:
|
||||||
-rm -f libtool
|
-rm -f libtool config.lt
|
||||||
install-man1: $(man1_MANS) $(man_MANS)
|
install-man1: $(man1_MANS) $(man_MANS)
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
||||||
|
@ -650,8 +651,8 @@ install-man1: $(man1_MANS) $(man_MANS)
|
||||||
esac; \
|
esac; \
|
||||||
done; \
|
done; \
|
||||||
for i in $$list; do \
|
for i in $$list; do \
|
||||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
if test -f $$i; then file=$$i; \
|
||||||
else file=$$i; fi; \
|
else file=$(srcdir)/$$i; fi; \
|
||||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||||
case "$$ext" in \
|
case "$$ext" in \
|
||||||
1*) ;; \
|
1*) ;; \
|
||||||
|
@ -707,7 +708,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
unique=`for i in $$list; do \
|
unique=`for i in $$list; do \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
done | \
|
done | \
|
||||||
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
mkid -fID $$unique
|
mkid -fID $$unique
|
||||||
tags: TAGS
|
tags: TAGS
|
||||||
|
@ -1056,7 +1057,7 @@ clean-local:
|
||||||
debian/tmp
|
debian/tmp
|
||||||
|
|
||||||
.css.o:
|
.css.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -1082,7 +1083,7 @@ clean-local:
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.html.o:
|
.html.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -1108,7 +1109,7 @@ clean-local:
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.ico.o:
|
.ico.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -1136,7 +1137,7 @@ clean-local:
|
||||||
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
|
|
||||||
.jspp.js:
|
.jspp.js:
|
||||||
@$(ECHO) preprocess "$<" "$@"
|
@echo preprocess "$<" "$@"
|
||||||
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
@sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \
|
||||||
-e t \
|
-e t \
|
||||||
-e d "$<"`" \
|
-e d "$<"`" \
|
||||||
|
@ -1145,7 +1146,7 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
"$<" >"$@"
|
"$<" >"$@"
|
||||||
|
|
||||||
.js.o:
|
.js.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo $(host_cpu) | \
|
-I binary `echo $(host_cpu) | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
@ -1171,7 +1172,7 @@ shellinabox/shell_in_a_box.o: shellinabox/shell_in_a_box.js config.h
|
||||||
"$<" "$@"
|
"$<" "$@"
|
||||||
|
|
||||||
.wav.o:
|
.wav.o:
|
||||||
@$(ECHO) objcopy "$<" "$@"
|
@echo objcopy "$<" "$@"
|
||||||
@objcopy \
|
@objcopy \
|
||||||
-I binary `echo "$(host_cpu)" | \
|
-I binary `echo "$(host_cpu)" | \
|
||||||
grep -q '^i[0-9]86$$' && \
|
grep -q '^i[0-9]86$$' && \
|
||||||
|
|
9380
aclocal.m4
vendored
9380
aclocal.m4
vendored
File diff suppressed because it is too large
Load diff
40
config.h
40
config.h
|
@ -7,6 +7,18 @@
|
||||||
/* Define to 1 if you have the `dlopen' function. */
|
/* Define to 1 if you have the `dlopen' function. */
|
||||||
#define HAVE_DLOPEN 1
|
#define HAVE_DLOPEN 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getgrgid_r' function. */
|
||||||
|
#define HAVE_GETGRGID_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getgrnam_r' function. */
|
||||||
|
#define HAVE_GETGRNAM_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||||
|
#define HAVE_GETPWNAM_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||||
|
#define HAVE_GETPWUID_R 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
|
||||||
|
|
||||||
|
@ -19,6 +31,9 @@
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `openpty' function. */
|
||||||
|
#define HAVE_OPENPTY 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <openssl/bio.h> header file. */
|
/* Define to 1 if you have the <openssl/bio.h> header file. */
|
||||||
#define HAVE_OPENSSL_BIO_H 1
|
#define HAVE_OPENSSL_BIO_H 1
|
||||||
|
|
||||||
|
@ -34,6 +49,9 @@
|
||||||
/* Define to 1 if you have a re-entrant version of ptsname */
|
/* Define to 1 if you have a re-entrant version of ptsname */
|
||||||
#define HAVE_PTSNAME_R 1
|
#define HAVE_PTSNAME_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pty.h> header file. */
|
||||||
|
#define HAVE_PTY_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <security/pam_appl.h> header file. */
|
/* Define to 1 if you have the <security/pam_appl.h> header file. */
|
||||||
#define HAVE_SECURITY_PAM_APPL_H 1
|
#define HAVE_SECURITY_PAM_APPL_H 1
|
||||||
|
|
||||||
|
@ -43,6 +61,9 @@
|
||||||
/* 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 a working sigwait */
|
||||||
|
#define HAVE_SIGWAIT 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
@ -55,8 +76,11 @@
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/prctrl.h> header file. */
|
/* Define to 1 if you have the `strlcat' function. */
|
||||||
/* #undef HAVE_SYS_PRCTRL_H */
|
/* #undef HAVE_STRLCAT */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||||
|
#define HAVE_SYS_PRCTL_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
#define HAVE_SYS_STAT_H 1
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
@ -64,15 +88,25 @@
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||||
|
#define HAVE_SYS_UIO_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#define HAVE_UNISTD_H 1
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <util.h> header file. */
|
||||||
|
/* #undef HAVE_UTIL_H */
|
||||||
|
|
||||||
/* Define to 1 if you have the <utmpx.h> header file. */
|
/* Define to 1 if you have the <utmpx.h> header file. */
|
||||||
#define HAVE_UTMPX_H 1
|
#define HAVE_UTMPX_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <utmp.h> header file. */
|
/* Define to 1 if you have the <utmp.h> header file. */
|
||||||
#define HAVE_UTMP_H 1
|
#define HAVE_UTMP_H 1
|
||||||
|
|
||||||
|
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||||
|
*/
|
||||||
|
#define LT_OBJDIR ".libs/"
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#define PACKAGE "shellinabox"
|
#define PACKAGE "shellinabox"
|
||||||
|
|
||||||
|
@ -95,7 +129,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 "118"
|
#define VCS_REVISION "119"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "2.7"
|
#define VERSION "2.7"
|
||||||
|
|
38
config.h.in
38
config.h.in
|
@ -6,6 +6,18 @@
|
||||||
/* Define to 1 if you have the `dlopen' function. */
|
/* Define to 1 if you have the `dlopen' function. */
|
||||||
#undef HAVE_DLOPEN
|
#undef HAVE_DLOPEN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getgrgid_r' function. */
|
||||||
|
#undef HAVE_GETGRGID_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getgrnam_r' function. */
|
||||||
|
#undef HAVE_GETGRNAM_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||||
|
#undef HAVE_GETPWNAM_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||||
|
#undef HAVE_GETPWUID_R
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
|
@ -18,6 +30,9 @@
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `openpty' function. */
|
||||||
|
#undef HAVE_OPENPTY
|
||||||
|
|
||||||
/* Define to 1 if you have the <openssl/bio.h> header file. */
|
/* Define to 1 if you have the <openssl/bio.h> header file. */
|
||||||
#undef HAVE_OPENSSL_BIO_H
|
#undef HAVE_OPENSSL_BIO_H
|
||||||
|
|
||||||
|
@ -33,6 +48,9 @@
|
||||||
/* Define to 1 if you have a re-entrant version of ptsname */
|
/* Define to 1 if you have a re-entrant version of ptsname */
|
||||||
#undef HAVE_PTSNAME_R
|
#undef HAVE_PTSNAME_R
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pty.h> header file. */
|
||||||
|
#undef HAVE_PTY_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <security/pam_appl.h> header file. */
|
/* Define to 1 if you have the <security/pam_appl.h> header file. */
|
||||||
#undef HAVE_SECURITY_PAM_APPL_H
|
#undef HAVE_SECURITY_PAM_APPL_H
|
||||||
|
|
||||||
|
@ -42,6 +60,9 @@
|
||||||
/* 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 a working sigwait */
|
||||||
|
#undef HAVE_SIGWAIT
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
#undef HAVE_STDINT_H
|
#undef HAVE_STDINT_H
|
||||||
|
|
||||||
|
@ -54,8 +75,11 @@
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
#undef HAVE_STRING_H
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/prctrl.h> header file. */
|
/* Define to 1 if you have the `strlcat' function. */
|
||||||
#undef HAVE_SYS_PRCTRL_H
|
#undef HAVE_STRLCAT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||||||
|
#undef HAVE_SYS_PRCTL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
#undef HAVE_SYS_STAT_H
|
#undef HAVE_SYS_STAT_H
|
||||||
|
@ -63,15 +87,25 @@
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||||
|
#undef HAVE_SYS_UIO_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <util.h> header file. */
|
||||||
|
#undef HAVE_UTIL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <utmpx.h> header file. */
|
/* Define to 1 if you have the <utmpx.h> header file. */
|
||||||
#undef HAVE_UTMPX_H
|
#undef HAVE_UTMPX_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <utmp.h> header file. */
|
/* Define to 1 if you have the <utmp.h> header file. */
|
||||||
#undef HAVE_UTMP_H
|
#undef HAVE_UTMP_H
|
||||||
|
|
||||||
|
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||||
|
*/
|
||||||
|
#undef LT_OBJDIR
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
|
|
||||||
|
|
22
configure.ac
22
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.7, markus@shellinabox.com)
|
AC_INIT(shellinabox, 2.7, markus@shellinabox.com)
|
||||||
VCS_REVISION=118
|
VCS_REVISION=119
|
||||||
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])
|
||||||
|
@ -20,7 +20,8 @@ AC_C_CONST
|
||||||
AC_PROG_GCC_TRADITIONAL
|
AC_PROG_GCC_TRADITIONAL
|
||||||
|
|
||||||
dnl Check for header files that do not exist on all platforms
|
dnl Check for header files that do not exist on all platforms
|
||||||
AC_CHECK_HEADERS([libutil.h pthread.h sys/prctrl.h utmp.h utmpx.h])
|
AC_CHECK_HEADERS([libutil.h pthread.h pty.h sys/prctl.h sys/uio.h util.h \
|
||||||
|
utmp.h utmpx.h])
|
||||||
|
|
||||||
dnl Most systems require linking against libutil.so in order to get login_tty()
|
dnl Most systems require linking against libutil.so in order to get login_tty()
|
||||||
AC_CHECK_FUNCS(login_tty, [],
|
AC_CHECK_FUNCS(login_tty, [],
|
||||||
|
@ -28,6 +29,12 @@ AC_CHECK_FUNCS(login_tty, [],
|
||||||
[LIBS="-lutil $LIBS"
|
[LIBS="-lutil $LIBS"
|
||||||
AC_DEFINE(HAVE_LOGIN_TTY)])])
|
AC_DEFINE(HAVE_LOGIN_TTY)])])
|
||||||
|
|
||||||
|
dnl Use strlcat() instead of strncat() to avoid spurious warnings
|
||||||
|
AC_CHECK_FUNCS([strlcat])
|
||||||
|
|
||||||
|
dnl Prefer thread-safe functions, if available
|
||||||
|
AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r openpty])
|
||||||
|
|
||||||
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
|
||||||
#define _XOPEN_SOURCE
|
#define _XOPEN_SOURCE
|
||||||
|
@ -40,6 +47,13 @@ AC_TRY_LINK([#ifndef _XOPEN_SOURCE
|
||||||
[AC_DEFINE(HAVE_PTSNAME_R, 1,
|
[AC_DEFINE(HAVE_PTSNAME_R, 1,
|
||||||
Define to 1 if you have a re-entrant version of ptsname)])
|
Define to 1 if you have a re-entrant version of ptsname)])
|
||||||
|
|
||||||
|
dnl Apparently, some systems define sigwait() but fail to implement it
|
||||||
|
AC_TRY_LINK([#include <pthread.h>
|
||||||
|
#include <signal.h>],
|
||||||
|
[sigset_t s; int n; sigwait(&s, &n);],
|
||||||
|
[AC_DEFINE(HAVE_SIGWAIT, 1,
|
||||||
|
Define to 1 if you have a working sigwait)])
|
||||||
|
|
||||||
dnl We automatically detect SSL support, but allow users to disable it
|
dnl We automatically detect SSL support, but allow users to disable it
|
||||||
AC_ARG_ENABLE(ssl,
|
AC_ARG_ENABLE(ssl,
|
||||||
[ --disable-ssl if available at built-time, support for SSL
|
[ --disable-ssl if available at built-time, support for SSL
|
||||||
|
@ -95,7 +109,9 @@ dnl dependencies.
|
||||||
if test "x$enable_runtime_loading" == xno; then
|
if test "x$enable_runtime_loading" == xno; then
|
||||||
dnl Link against OpenSSL libraries, unless SSL support has been disabled
|
dnl Link against OpenSSL libraries, unless SSL support has been disabled
|
||||||
if test "x$enable_ssl" != xno; then
|
if test "x$enable_ssl" != xno; then
|
||||||
AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl $LIBS"])
|
AC_CHECK_HEADER(openssl/bio.h,
|
||||||
|
[AC_CHECK_HEADER(openssl/err.h,
|
||||||
|
[AC_CHECK_HEADER(openssl/ssl.h, [LIBS="-lssl $LIBS"])])])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Link against PAM libraries, unless PAM support has been disabled
|
dnl Link against PAM libraries, unless PAM support has been disabled
|
||||||
|
|
|
@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.7 (revision 118)" +
|
alert("VT100 Terminal Emulator " + "2.7 (revision 119)" +
|
||||||
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com");
|
"For more information check http://shellinabox.com");
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,6 +57,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_STRLCAT
|
||||||
|
#define strncat(a,b,c) ({ char *_a = (a); strlcat(_a, (b), (c)+1); _a; })
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libhttp/httpconnection.h"
|
#include "libhttp/httpconnection.h"
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
|
@ -219,9 +223,10 @@ static int httpFinishCommand(struct HttpConnection *http) {
|
||||||
check(strftime(timeBuf, sizeof(timeBuf),
|
check(strftime(timeBuf, sizeof(timeBuf),
|
||||||
"[%d/%b/%Y:%H:%M:%S %z]", ltime));
|
"[%d/%b/%Y:%H:%M:%S %z]", ltime));
|
||||||
if (http->totalWritten > 0) {
|
if (http->totalWritten > 0) {
|
||||||
sprintf(lengthBuf, "%d", http->totalWritten);
|
snprintf(lengthBuf, sizeof(lengthBuf), "%d", http->totalWritten);
|
||||||
} else {
|
} else {
|
||||||
strcpy(lengthBuf, "-");
|
*lengthBuf = '\000';
|
||||||
|
strncat(lengthBuf, "-", sizeof(lengthBuf)-1);
|
||||||
}
|
}
|
||||||
info("%s - - %s \"%s %s %s\" %d %s",
|
info("%s - - %s \"%s %s %s\" %d %s",
|
||||||
http->peerName, timeBuf, http->method, http->path, http->version,
|
http->peerName, timeBuf, http->method, http->path, http->version,
|
||||||
|
@ -1373,14 +1378,15 @@ const char *httpGetQuery(const struct HttpConnection *http) {
|
||||||
const char *httpGetURL(const struct HttpConnection *http) {
|
const char *httpGetURL(const struct HttpConnection *http) {
|
||||||
if (!http->url) {
|
if (!http->url) {
|
||||||
const char *host = httpGetHost(http);
|
const char *host = httpGetHost(http);
|
||||||
check(*(char **)&http->url = malloc(8 + strlen(host) + 25 +
|
int s_size = 8 + strlen(host) + 25 + strlen(http->path);
|
||||||
strlen(http->path) + 1));
|
check(*(char **)&http->url = malloc(s_size + 1));
|
||||||
strcpy(http->url, http->sslHndl ? "https://" : "http://");
|
*http->url = '\000';
|
||||||
strcat(http->url, host);
|
strncat(http->url, http->sslHndl ? "https://" : "http://", s_size);
|
||||||
|
strncat(http->url, host, s_size);
|
||||||
if (http->port != (http->sslHndl ? 443 : 80)) {
|
if (http->port != (http->sslHndl ? 443 : 80)) {
|
||||||
sprintf(strrchr(http->url, '\000'), ":%d", http->port);
|
snprintf(strrchr(http->url, '\000'), 25, ":%d", http->port);
|
||||||
}
|
}
|
||||||
strcat(http->url, http->path);
|
strncat(http->url, http->path, s_size);
|
||||||
}
|
}
|
||||||
return http->url;
|
return http->url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,6 +572,33 @@ static int sslSNICallback(SSL *sslHndl, int *al, struct SSLSupport *ssl) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_OPENSSL) && 1
|
||||||
|
// This is a not-thread-safe replacement for gethostbyname_r()
|
||||||
|
#define gethostbyname_r x_gethostbyname_r
|
||||||
|
static int gethostbyname_r(const char *name, struct hostent *ret,
|
||||||
|
char *buf, size_t buflen,
|
||||||
|
struct hostent **result, int *h_errnop) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (h_errnop) {
|
||||||
|
*h_errnop = ERANGE;
|
||||||
|
}
|
||||||
|
if (!ret) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
struct hostent *he = gethostbyname(name);
|
||||||
|
*ret = *he;
|
||||||
|
if (result) {
|
||||||
|
*result = ret;
|
||||||
|
}
|
||||||
|
if (h_errnop) {
|
||||||
|
*h_errnop = h_errno;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void sslSetCertificate(struct SSLSupport *ssl, const char *filename,
|
void sslSetCertificate(struct SSLSupport *ssl, const char *filename,
|
||||||
int autoGenerateMissing) {
|
int autoGenerateMissing) {
|
||||||
#if defined(HAVE_OPENSSL)
|
#if defined(HAVE_OPENSSL)
|
||||||
|
@ -696,6 +723,45 @@ void sslBlockSigPipe(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_SIGWAIT
|
||||||
|
// This is a non-thread-safe replacement for sigwait()
|
||||||
|
static int dummysignalno;
|
||||||
|
static void dummysignal(int signo) {
|
||||||
|
dummysignalno = signo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define sigwait x_sigwait
|
||||||
|
static int sigwait(const sigset_t *set, int *sig) {
|
||||||
|
sigset_t mask, old_mask;
|
||||||
|
sigfillset(&mask);
|
||||||
|
if (&pthread_sigmask) {
|
||||||
|
dcheck(!pthread_sigmask(SIG_BLOCK, &mask, &old_mask));
|
||||||
|
} else {
|
||||||
|
dcheck(!sigprocmask(SIG_BLOCK, &mask, &old_mask));
|
||||||
|
}
|
||||||
|
#ifndef NSIG
|
||||||
|
#define NSIG 32
|
||||||
|
#endif
|
||||||
|
struct sigaction sa[NSIG];
|
||||||
|
memset(sa, 0, sizeof(sa));
|
||||||
|
sa->sa_handler = dummysignal;
|
||||||
|
for (int i = 1; i <= NSIG; i++) {
|
||||||
|
if (sigismember(set, i)) {
|
||||||
|
sigdelset(&mask, i);
|
||||||
|
sigaction(i, sa, sa + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dummysignalno = -1;
|
||||||
|
sigsuspend(&mask);
|
||||||
|
if (&pthread_sigmask) {
|
||||||
|
dcheck(!pthread_sigmask(SIG_SETMASK, &old_mask, NULL));
|
||||||
|
} else {
|
||||||
|
dcheck(!sigprocmask(SIG_BLOCK, &old_mask, NULL));
|
||||||
|
}
|
||||||
|
return dummysignalno;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int sslUnblockSigPipe(void) {
|
int sslUnblockSigPipe(void) {
|
||||||
int signum = 0;
|
int signum = 0;
|
||||||
sigset_t set;
|
sigset_t set;
|
||||||
|
|
|
@ -74,17 +74,19 @@ static int externalFileHttpHandler(HttpConnection *http, void *arg,
|
||||||
|
|
||||||
// Compute file name of external file
|
// Compute file name of external file
|
||||||
char *fn;
|
char *fn;
|
||||||
check(fn = malloc(strlen((char *)arg) +
|
int s_size = strlen((char *)arg) +
|
||||||
(*pathInfo ? strlen(pathInfo) + 1 : 0) + 1));
|
(*pathInfo ? strlen(pathInfo) + 1 : 0);
|
||||||
strcpy(fn, (char *)arg);
|
check(fn = malloc(s_size + 1));
|
||||||
|
*fn = '\000';
|
||||||
|
strncat(fn, (char *)arg, s_size);
|
||||||
if (*pathInfo) {
|
if (*pathInfo) {
|
||||||
// Append pathInfo, if available
|
// Append pathInfo, if available
|
||||||
strcat(fn, "/");
|
strncat(fn, "/", s_size);
|
||||||
const char *ptr = pathInfo;
|
const char *ptr = pathInfo;
|
||||||
while (*ptr == '/') {
|
while (*ptr == '/') {
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
strcat(fn, ptr);
|
strncat(fn, ptr, s_size);
|
||||||
|
|
||||||
// Any files/directories starting with a dot are inaccessible to us
|
// Any files/directories starting with a dot are inaccessible to us
|
||||||
do {
|
do {
|
||||||
|
@ -250,13 +252,15 @@ int registerExternalFiles(void *arg, const char *key, char **value) {
|
||||||
// Relative URL paths get registered for each of the services
|
// Relative URL paths get registered for each of the services
|
||||||
for (int i = 0; i < numServices; i++) {
|
for (int i = 0; i < numServices; i++) {
|
||||||
char *path;
|
char *path;
|
||||||
check(path = malloc(strlen(services[i]->path) + strlen(key) + 2));
|
int s_size = strlen(services[i]->path) + strlen(key) + 1;
|
||||||
strcpy(path, services[i]->path);
|
check(path = malloc(s_size + 1));
|
||||||
|
*path = '\000';
|
||||||
|
strncat(path, services[i]->path, s_size);
|
||||||
if (!*services[i]->path ||
|
if (!*services[i]->path ||
|
||||||
strrchr(services[i]->path, '\000')[-1] != '/') {
|
strrchr(services[i]->path, '\000')[-1] != '/') {
|
||||||
strcat(path, "/");
|
strncat(path, "/", s_size);
|
||||||
}
|
}
|
||||||
strcat(path, key);
|
strncat(path, key, s_size);
|
||||||
serverRegisterHttpHandler(server, path, externalFileHttpHandler, *value);
|
serverRegisterHttpHandler(server, path, externalFileHttpHandler, *value);
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define pthread_once x_pthread_once
|
#define pthread_once x_pthread_once
|
||||||
|
#define execle x_execle
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
@ -72,6 +73,18 @@
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PTY_H
|
||||||
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_UIO_H
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UTIL_H
|
||||||
|
#include <util.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UTMP_H
|
#ifdef HAVE_UTMP_H
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -93,6 +106,10 @@ struct pam_conv;
|
||||||
typedef struct pam_handle pam_handle_t;
|
typedef struct pam_handle pam_handle_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STRLCAT
|
||||||
|
#define strncat(a,b,c) ({ char *_a = (a); strlcat(_a, (b), (c)+1); _a; })
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "shellinabox/launcher.h"
|
#include "shellinabox/launcher.h"
|
||||||
#include "shellinabox/privileges.h"
|
#include "shellinabox/privileges.h"
|
||||||
#include "shellinabox/service.h"
|
#include "shellinabox/service.h"
|
||||||
|
@ -100,6 +117,8 @@ typedef struct pam_handle pam_handle_t;
|
||||||
#include "logging/logging.h"
|
#include "logging/logging.h"
|
||||||
|
|
||||||
#undef pthread_once
|
#undef pthread_once
|
||||||
|
#undef execle
|
||||||
|
int execle(const char *, const char *, ...);
|
||||||
|
|
||||||
#if defined(HAVE_PTHREAD_H) && defined(__linux__)
|
#if defined(HAVE_PTHREAD_H) && defined(__linux__)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -359,6 +378,30 @@ int supportsPAM(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_GETPWUID_R
|
||||||
|
// This is a not-thread-safe replacement for getpwuid_r()
|
||||||
|
#define getpwuid_r x_getpwuid_r
|
||||||
|
static int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen,
|
||||||
|
struct passwd **result) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (!pwd) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
struct passwd *p = getpwuid(uid);
|
||||||
|
if (!p) {
|
||||||
|
return errno ? -1 : 0;
|
||||||
|
}
|
||||||
|
*pwd = *p;
|
||||||
|
if (result) {
|
||||||
|
*result = pwd;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int launchChild(int service, struct Session *session) {
|
int launchChild(int service, struct Session *session) {
|
||||||
if (launcher < 0) {
|
if (launcher < 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
@ -533,7 +576,7 @@ void closeAllFds(int *exceptFds, int num) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_PTSNAME_R
|
#if !defined(HAVE_PTSNAME_R) && 0
|
||||||
static int ptsname_r(int fd, char *buf, size_t buflen) {
|
static int ptsname_r(int fd, char *buf, size_t buflen) {
|
||||||
// It is unfortunate that ptsname_r is not universally available.
|
// It is unfortunate that ptsname_r is not universally available.
|
||||||
// For the time being, this is not a big problem, as ShellInABox is
|
// For the time being, this is not a big problem, as ShellInABox is
|
||||||
|
@ -561,6 +604,13 @@ static int forkPty(int *pty, int useLogin, struct Utmp **utmp,
|
||||||
const char *peerName) {
|
const char *peerName) {
|
||||||
int slave;
|
int slave;
|
||||||
char ptyPath[PATH_MAX];
|
char ptyPath[PATH_MAX];
|
||||||
|
#ifdef HAVE_OPENPTY
|
||||||
|
if (openpty(pty, &slave, ptyPath, NULL, NULL) < 0) {
|
||||||
|
*pty = -1;
|
||||||
|
*utmp = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ((*pty = posix_openpt(O_RDWR|O_NOCTTY)) < 0 ||
|
if ((*pty = posix_openpt(O_RDWR|O_NOCTTY)) < 0 ||
|
||||||
grantpt(*pty) < 0 ||
|
grantpt(*pty) < 0 ||
|
||||||
unlockpt(*pty) < 0 ||
|
unlockpt(*pty) < 0 ||
|
||||||
|
@ -599,6 +649,7 @@ static int forkPty(int *pty, int useLogin, struct Utmp **utmp,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
success:
|
success:
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fill in utmp entry
|
// Fill in utmp entry
|
||||||
*utmp = newUtmp(useLogin, ptyPath, peerName);
|
*utmp = newUtmp(useLogin, ptyPath, peerName);
|
||||||
|
@ -658,31 +709,35 @@ static int forkPty(int *pty, int useLogin, struct Utmp **utmp,
|
||||||
static const struct passwd *getPWEnt(uid_t uid) {
|
static const struct passwd *getPWEnt(uid_t uid) {
|
||||||
struct passwd pwbuf, *pw;
|
struct passwd pwbuf, *pw;
|
||||||
char *buf;
|
char *buf;
|
||||||
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
#ifdef _SC_GETPW_R_SIZE_MAX
|
||||||
|
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
len = 4096;
|
len = 4096;
|
||||||
}
|
}
|
||||||
check(buf = malloc(len));
|
#else
|
||||||
|
int len = 4096;
|
||||||
|
#endif
|
||||||
|
check(buf = malloc(len));
|
||||||
check(!getpwuid_r(uid, &pwbuf, buf, len, &pw) && pw);
|
check(!getpwuid_r(uid, &pwbuf, buf, len, &pw) && pw);
|
||||||
struct passwd *passwd;
|
struct passwd *passwd;
|
||||||
check(passwd = malloc(sizeof(struct passwd) +
|
check(passwd = calloc(sizeof(struct passwd) +
|
||||||
strlen(pw->pw_name) +
|
strlen(pw->pw_name) +
|
||||||
strlen(pw->pw_passwd) +
|
strlen(pw->pw_passwd) +
|
||||||
strlen(pw->pw_gecos) +
|
strlen(pw->pw_gecos) +
|
||||||
strlen(pw->pw_dir) +
|
strlen(pw->pw_dir) +
|
||||||
strlen(pw->pw_shell) + 5));
|
strlen(pw->pw_shell) + 5, 1));
|
||||||
passwd->pw_uid = pw->pw_uid;
|
passwd->pw_uid = pw->pw_uid;
|
||||||
passwd->pw_gid = pw->pw_gid;
|
passwd->pw_gid = pw->pw_gid;
|
||||||
strcpy(passwd->pw_shell = strrchr(
|
strncat(passwd->pw_shell = strrchr(
|
||||||
strcpy(passwd->pw_dir = strrchr(
|
strncat(passwd->pw_dir = strrchr(
|
||||||
strcpy(passwd->pw_gecos = strrchr(
|
strncat(passwd->pw_gecos = strrchr(
|
||||||
strcpy(passwd->pw_passwd = strrchr(
|
strncat(passwd->pw_passwd = strrchr(
|
||||||
strcpy(passwd->pw_name = (char *)(passwd + 1),
|
strncat(passwd->pw_name = (char *)(passwd + 1),
|
||||||
pw->pw_name), '\000') + 1,
|
pw->pw_name, strlen(pw->pw_name)), '\000') + 1,
|
||||||
pw->pw_passwd), '\000') + 1,
|
pw->pw_passwd, strlen(pw->pw_passwd)), '\000') + 1,
|
||||||
pw->pw_gecos), '\000') + 1,
|
pw->pw_gecos, strlen(pw->pw_gecos)), '\000') + 1,
|
||||||
pw->pw_dir), '\000') + 1,
|
pw->pw_dir, strlen(pw->pw_dir)), '\000') + 1,
|
||||||
pw->pw_shell);
|
pw->pw_shell, strlen(pw->pw_shell));
|
||||||
free(buf);
|
free(buf);
|
||||||
return passwd;
|
return passwd;
|
||||||
}
|
}
|
||||||
|
@ -997,8 +1052,10 @@ static void execService(int width, int height, struct Service *service,
|
||||||
int len = strlen(key);
|
int len = strlen(key);
|
||||||
for (char **e = environment; *e; e++, numEnvVars++) {
|
for (char **e = environment; *e; e++, numEnvVars++) {
|
||||||
if (!strncmp(*e, key, len) && (*e)[len] == '=') {
|
if (!strncmp(*e, key, len) && (*e)[len] == '=') {
|
||||||
check(*e = realloc(*e, len + strlen(value) + 2));
|
int s_size = len + strlen(value) + 1;
|
||||||
strcpy((*e) + len + 1, value);
|
check(*e = realloc(*e, s_size + 1));
|
||||||
|
(*e)[len + 1] = '\000';
|
||||||
|
strncat(*e, value, s_size);
|
||||||
numEnvVars = -1;
|
numEnvVars = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1157,7 +1214,8 @@ static void childProcess(struct Service *service, int width, int height,
|
||||||
check(service->cwd);
|
check(service->cwd);
|
||||||
if (!*service->cwd || *service->cwd != '/' || chdir(service->cwd)) {
|
if (!*service->cwd || *service->cwd != '/' || chdir(service->cwd)) {
|
||||||
check(service->cwd = realloc((char *)service->cwd, 2));
|
check(service->cwd = realloc((char *)service->cwd, 2));
|
||||||
strcpy((char *)service->cwd, "/");
|
*(char *)service->cwd = '\000';
|
||||||
|
strncat((char *)service->cwd, "/", 1);
|
||||||
puts("No directory, logging in with HOME=/");
|
puts("No directory, logging in with HOME=/");
|
||||||
check(!chdir("/"));
|
check(!chdir("/"));
|
||||||
for (int i = 0; environment[i]; i++) {
|
for (int i = 0; environment[i]; i++) {
|
||||||
|
@ -1171,8 +1229,10 @@ static void childProcess(struct Service *service, int width, int height,
|
||||||
|
|
||||||
// Finally, launch the child process.
|
// Finally, launch the child process.
|
||||||
if (service->useLogin) {
|
if (service->useLogin) {
|
||||||
execle("/bin/login", "login", "-p", "-h", peerName, NULL, environment);
|
execle("/bin/login", "login", "-p", "-h", peerName,
|
||||||
execle("/usr/bin/login", "login", "-p", "-h", peerName, NULL, environment);
|
(void *)0, environment);
|
||||||
|
execle("/usr/bin/login", "login", "-p", "-h", peerName,
|
||||||
|
(void *)0, environment);
|
||||||
} else {
|
} else {
|
||||||
execService(width, height, service, peerName, environment);
|
execService(width, height, service, peerName, environment);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,13 +153,41 @@ void dropPrivileges(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_GETPWUID_R
|
||||||
|
// This is a not-thread-safe replacement for getpwuid_r()
|
||||||
|
#define getpwuid_r x_getpwuid_r
|
||||||
|
static int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen,
|
||||||
|
struct passwd **result) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (!pwd) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
struct passwd *p = getpwuid(uid);
|
||||||
|
if (!p) {
|
||||||
|
return errno ? -1 : 0;
|
||||||
|
}
|
||||||
|
*pwd = *p;
|
||||||
|
if (result) {
|
||||||
|
*result = pwd;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *getUserName(uid_t uid) {
|
const char *getUserName(uid_t uid) {
|
||||||
struct passwd pwbuf, *pw;
|
struct passwd pwbuf, *pw;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
#ifdef _SC_GETPW_R_SIZE_MAX
|
||||||
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
len = 4096;
|
len = 4096;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int len = 4096;
|
||||||
|
#endif
|
||||||
check(buf = malloc(len));
|
check(buf = malloc(len));
|
||||||
char *user;
|
char *user;
|
||||||
if (getpwuid_r(uid, &pwbuf, buf, len, &pw) || !pw) {
|
if (getpwuid_r(uid, &pwbuf, buf, len, &pw) || !pw) {
|
||||||
|
@ -172,13 +200,41 @@ const char *getUserName(uid_t uid) {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_GETPWNAM_R
|
||||||
|
// This is a not-thread-safe replacement for getpwnam_r()
|
||||||
|
#define getpwnam_r x_getpwnam_r
|
||||||
|
static int getpwnam_r(const char *name, struct passwd *pwd, char *buf,
|
||||||
|
size_t buflen, struct passwd **result) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (!pwd) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
struct passwd *p = getpwnam(name);
|
||||||
|
if (!p) {
|
||||||
|
return errno ? -1 : 0;
|
||||||
|
}
|
||||||
|
*pwd = *p;
|
||||||
|
if (result) {
|
||||||
|
*result = pwd;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uid_t getUserId(const char *name) {
|
uid_t getUserId(const char *name) {
|
||||||
struct passwd pwbuf, *pw;
|
struct passwd pwbuf, *pw;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
#ifdef _SC_GETPW_R_SIZE_MAX
|
||||||
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
int len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
len = 4096;
|
len = 4096;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int len = 4096;
|
||||||
|
#endif
|
||||||
check(buf = malloc(len));
|
check(buf = malloc(len));
|
||||||
if (getpwnam_r(name, &pwbuf, buf, len, &pw) || !pw) {
|
if (getpwnam_r(name, &pwbuf, buf, len, &pw) || !pw) {
|
||||||
fatal("Cannot look up user id \"%s\"", name);
|
fatal("Cannot look up user id \"%s\"", name);
|
||||||
|
@ -205,13 +261,41 @@ uid_t parseUser(const char *arg, const char **name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_GETGRGID_R
|
||||||
|
// This is a not-thread-safe replacement for getgrgid_r()
|
||||||
|
#define getgrgid_r x_getgrgid_r
|
||||||
|
static int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen,
|
||||||
|
struct group **result) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (!grp) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
struct group *g = getgrgid(gid);
|
||||||
|
if (!g) {
|
||||||
|
return errno ? -1 : 0;
|
||||||
|
}
|
||||||
|
*grp = *g;
|
||||||
|
if (result) {
|
||||||
|
*result = grp;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *getGroupName(gid_t gid) {
|
const char *getGroupName(gid_t gid) {
|
||||||
struct group grbuf, *gr;
|
struct group grbuf, *gr;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
#ifdef _SC_GETGR_R_SIZE_MAX
|
||||||
int len = sysconf(_SC_GETGR_R_SIZE_MAX);
|
int len = sysconf(_SC_GETGR_R_SIZE_MAX);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
len = 4096;
|
len = 4096;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int len = 4096;
|
||||||
|
#endif
|
||||||
check(buf = malloc(len));
|
check(buf = malloc(len));
|
||||||
char *group;
|
char *group;
|
||||||
if (getgrgid_r(gid, &grbuf, buf, len, &gr) || !gr) {
|
if (getgrgid_r(gid, &grbuf, buf, len, &gr) || !gr) {
|
||||||
|
@ -224,23 +308,55 @@ const char *getGroupName(gid_t gid) {
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_GETGRNAM_R
|
||||||
|
// This is a not-thread-safe replacement for getgrnam_r()
|
||||||
|
#define getgrnam_r x_getgrnam_r
|
||||||
|
static int getgrnam_r(const char *name, struct group *grp, char *buf,
|
||||||
|
size_t buflen, struct group **result) {
|
||||||
|
if (result) {
|
||||||
|
*result = NULL;
|
||||||
|
}
|
||||||
|
if (!grp) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
errno = 0;
|
||||||
|
struct group *g = getgrnam(name);
|
||||||
|
if (!g) {
|
||||||
|
return errno ? -1 : 0;
|
||||||
|
}
|
||||||
|
*grp = *g;
|
||||||
|
if (result) {
|
||||||
|
*result = grp;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gid_t getGroupId(const char *name) {
|
gid_t getGroupId(const char *name) {
|
||||||
struct group grbuf, *gr;
|
struct group grbuf, *gr;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
#ifdef _SC_GETGR_R_SIZE_MAX
|
||||||
int gr_len = sysconf(_SC_GETGR_R_SIZE_MAX);
|
int gr_len = sysconf(_SC_GETGR_R_SIZE_MAX);
|
||||||
if (gr_len <= 0) {
|
if (gr_len <= 0) {
|
||||||
gr_len = 4096;
|
gr_len = 4096;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int gr_len = 4096;
|
||||||
|
#endif
|
||||||
check(buf = malloc(gr_len));
|
check(buf = malloc(gr_len));
|
||||||
if (getgrnam_r(name, &grbuf, buf, gr_len, &gr) || !gr) {
|
if (getgrnam_r(name, &grbuf, buf, gr_len, &gr) || !gr) {
|
||||||
// Maybe, this system does not have a "nogroup" group. Substitute the
|
// Maybe, this system does not have a "nogroup" group. Substitute the
|
||||||
// group of the "nobody" user.
|
// group of the "nobody" user.
|
||||||
if (!strcmp(name, "nogroup")) {
|
if (!strcmp(name, "nogroup")) {
|
||||||
struct passwd pwbuf, *pw;
|
struct passwd pwbuf, *pw;
|
||||||
|
#ifdef _SC_GETPW_R_SIZE_MAX
|
||||||
int pw_len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
int pw_len = sysconf(_SC_GETPW_R_SIZE_MAX);
|
||||||
if (pw_len <= 0) {
|
if (pw_len <= 0) {
|
||||||
pw_len = 4096;
|
pw_len = 4096;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int pw_len = 4096;
|
||||||
|
#endif
|
||||||
if (pw_len > gr_len) {
|
if (pw_len > gr_len) {
|
||||||
check(buf = realloc(buf, pw_len));
|
check(buf = realloc(buf, pw_len));
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ShellInABox.prototype.about = function() {
|
ShellInABox.prototype.about = function() {
|
||||||
alert("Shell In A Box version " + "2.7 (revision 118)" +
|
alert("Shell In A Box version " + "2.7 (revision 119)" +
|
||||||
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
"\nCopyright 2008-2009 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 ?
|
||||||
|
|
|
@ -450,6 +450,13 @@ static void serveStaticFile(HttpConnection *http, const char *contentType,
|
||||||
httpTransfer(http, response, len);
|
httpTransfer(http, response, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *addr(const char *a) {
|
||||||
|
// Work-around for a gcc bug that could occasionally generate invalid
|
||||||
|
// assembly instructions when optimizing code too agressively.
|
||||||
|
asm volatile("");
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
||||||
const char *buf, int len) {
|
const char *buf, int len) {
|
||||||
checkGraveyard();
|
checkGraveyard();
|
||||||
|
@ -520,8 +527,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg,
|
||||||
noBeep ? "true" : "false");
|
noBeep ? "true" : "false");
|
||||||
int stateVarsLength = strlen(stateVars);
|
int stateVarsLength = strlen(stateVars);
|
||||||
int contentLength = stateVarsLength +
|
int contentLength = stateVarsLength +
|
||||||
(vt100End - vt100Start) +
|
(addr(vt100End) - addr(vt100Start)) +
|
||||||
(shellInABoxEnd - shellInABoxStart);
|
(addr(shellInABoxEnd) - addr(shellInABoxStart));
|
||||||
char *response = stringPrintf(NULL,
|
char *response = stringPrintf(NULL,
|
||||||
"HTTP/1.1 200 OK\r\n"
|
"HTTP/1.1 200 OK\r\n"
|
||||||
"Content-Type: text/javascript; charset=utf-8\r\n"
|
"Content-Type: text/javascript; charset=utf-8\r\n"
|
||||||
|
|
|
@ -1500,7 +1500,7 @@ VT100.prototype.toggleBell = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
VT100.prototype.about = function() {
|
VT100.prototype.about = function() {
|
||||||
alert("VT100 Terminal Emulator " + "2.7 (revision 118)" +
|
alert("VT100 Terminal Emulator " + "2.7 (revision 119)" +
|
||||||
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
"\nCopyright 2008-2009 by Markus Gutschke\n" +
|
||||||
"For more information check http://shellinabox.com");
|
"For more information check http://shellinabox.com");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue