diff --git a/Makefile.am b/Makefile.am index 92df0bc..c90a13b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,6 @@ AM_CPPFLAGS = AM_CFLAGS = -g -std=gnu99 -Wall AM_LDFLAGS = -g -lm -OBJCOPY ?= objcopy -OBJDUMP ?= objdump - noinst_LTLIBRARIES = libhttp.la \ liblogging.la noinst_DATA = $(top_srcdir)/demo/demo.js @@ -112,39 +109,36 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \ shellinabox/keyboard-layout.html \ shellinabox/beep.wav \ config.h +BUILT_SOURCES = shellinabox/beep.h \ + shellinabox/cgi_root.h \ + shellinabox/enabled.h \ + shellinabox/favicon.h \ + shellinabox/keyboard.h \ + shellinabox/keyboard-layout.h \ + shellinabox/print-styles.h \ + shellinabox/root_page.h \ + shellinabox/shell_in_a_box.h \ + shellinabox/shell_in_a_box.js \ + shellinabox/styles.h \ + shellinabox/vt100.h \ + shellinabox/vt100.js + + shellinaboxd_LDADD = liblogging.la \ libhttp.la shellinaboxd_LDFLAGS = -static -objcopyflags = case "$(host_cpu)" in \ - i[0-9]86)echo '-O elf32-i386 -B i386';; \ - x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \ - *) trap 'rm -f /tmp/probe$$$$.o' EXIT; \ - $(CC) $(AM_CFLAGS) $(CFLAGS) -c -xc \ - -o /tmp/probe$$$$.o /dev/null && \ - $(OBJDUMP) -f /tmp/probe$$$$.o | \ - sed -e 's/.*file format */-O /;t; \ - s/architecture: *\([^,]*\).*/-B \1/;t; \ - d';; \ - esac - -renamesymbols = \ - sed -e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \ +symbolname = \ + sed -e 's/.*\/\([^.]*\)[.].*/\1/' \ -e 't0' \ - -e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \ - -e 't0' \ - -e 's/.*/&=& /' \ + -e 's/\([^.]*\)[.].*/\1/' \ -e ':0' \ - -e 's/$$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ + -e 's/$$/ aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ -e ':1' \ - -e 's/\(=[^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ + -e 's/\([^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ -e 't1' \ -e 's/.\{53\}$$//' \ - -e 's/[-/.]/_/g' \ - -e 's/^/--redefine-sym _binary_/' \ - -e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \ - -e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \ - -e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/' + -e 's/[-/.]/_/g' libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck @@ -251,57 +245,72 @@ clean-local: debian/shellinabox*.debhelper* \ debian/shellinabox.substvars \ debian/tmp - -rm -rf GNU-stack + -rm -rf shellinabox/beep.h \ + shellinabox/cgi_root.h \ + shellinabox/enabled.h \ + shellinabox/favicon.h \ + shellinabox/keyboard.h \ + shellinabox/keyboard-layout.h \ + shellinabox/print-styles.h \ + shellinabox/root_page.h \ + shellinabox/shell_in_a_box.h \ + shellinabox/styles.h \ + shellinabox/vt100.h -.css.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.css.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.gif.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.gif.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.png.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.png.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.html.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.html.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.ico.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack - - -shellinabox/shell_in_a_box.o: ${top_srcdir}/shellinabox/shell_in_a_box.js \ - ${top_srcdir}/config.h - -${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp +.ico.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" .jspp.js: @echo preprocess "$<" "$@" + @mkdir -p "`dirname "$@"`" sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \ -e t \ -e d "$<"`" \ @@ -309,21 +318,24 @@ ${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp -e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \ "$<" >"$@" -.js.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.js.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.wav.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack - +.wav.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" diff --git a/Makefile.in b/Makefile.in index 1fb1a2b..875941c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,19 +72,9 @@ liblogging_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(docdir)" PROGRAMS = $(bin_PROGRAMS) -am__dirstamp = $(am__leading_dot)dirstamp am_shellinaboxd_OBJECTS = shellinaboxd.$(OBJEXT) \ externalfile.$(OBJEXT) launcher.$(OBJEXT) privileges.$(OBJEXT) \ - service.$(OBJEXT) session.$(OBJEXT) usercss.$(OBJEXT) \ - shellinabox/cgi_root.$(OBJEXT) shellinabox/root_page.$(OBJEXT) \ - shellinabox/vt100.$(OBJEXT) \ - shellinabox/shell_in_a_box.$(OBJEXT) \ - shellinabox/styles.$(OBJEXT) \ - shellinabox/print-styles.$(OBJEXT) \ - shellinabox/enabled.$(OBJEXT) shellinabox/favicon.$(OBJEXT) \ - shellinabox/keyboard.$(OBJEXT) \ - shellinabox/keyboard-layout.$(OBJEXT) \ - shellinabox/beep.$(OBJEXT) + service.$(OBJEXT) session.$(OBJEXT) usercss.$(OBJEXT) shellinaboxd_OBJECTS = $(am_shellinaboxd_OBJECTS) shellinaboxd_DEPENDENCIES = liblogging.la libhttp.la shellinaboxd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -375,45 +365,41 @@ shellinaboxd_SOURCES = shellinabox/shellinaboxd.c \ shellinabox/beep.wav \ config.h +BUILT_SOURCES = shellinabox/beep.h \ + shellinabox/cgi_root.h \ + shellinabox/enabled.h \ + shellinabox/favicon.h \ + shellinabox/keyboard.h \ + shellinabox/keyboard-layout.h \ + shellinabox/print-styles.h \ + shellinabox/root_page.h \ + shellinabox/shell_in_a_box.h \ + shellinabox/shell_in_a_box.js \ + shellinabox/styles.h \ + shellinabox/vt100.h \ + shellinabox/vt100.js + shellinaboxd_LDADD = liblogging.la \ libhttp.la shellinaboxd_LDFLAGS = -static -objcopyflags = case "$(host_cpu)" in \ - i[0-9]86)echo '-O elf32-i386 -B i386';; \ - x86_64) echo '-O elf64-x86-64 -B i386:x86-64';; \ - *) trap 'rm -f /tmp/probe$$$$.o' EXIT; \ - $(CC) $(AM_CFLAGS) $(CFLAGS) -c -xc \ - -o /tmp/probe$$$$.o /dev/null && \ - $(OBJDUMP) -f /tmp/probe$$$$.o | \ - sed -e 's/.*file format */-O /;t; \ - s/architecture: *\([^,]*\).*/-B \1/;t; \ - d';; \ - esac - -renamesymbols = \ - sed -e 's/\(.*\/\)\([^.]*\)\([.].*\)/\1\2\3=\2 /' \ +symbolname = \ + sed -e 's/.*\/\([^.]*\)[.].*/\1/' \ -e 't0' \ - -e 's/\([^.]*\)\([.].*\)/\1\2=\1 /' \ - -e 't0' \ - -e 's/.*/&=& /' \ + -e 's/\([^.]*\)[.].*/\1/' \ -e ':0' \ - -e 's/$$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ + -e 's/$$/ aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/' \ -e ':1' \ - -e 's/\(=[^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ + -e 's/\([^-_]*\)[-_]\([a-z]\)\([^ ]* .*\2\)\(.\)/\1\4\3\4/' \ -e 't1' \ -e 's/.\{53\}$$//' \ - -e 's/[-/.]/_/g' \ - -e 's/^/--redefine-sym _binary_/' \ - -e 's/\([^=]*\)\(=[^ ]*\)/& \1_end\2End/' \ - -e 's/\([^=]*\)\(=[^ ]*\)/& \1_start\2Start/' \ - -e 's/[^ ]*\([^=]*\)=[^ ]*/-N\1_size/' + -e 's/[-/.]/_/g' -all: config.h +all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .css .gif .html .ico .js .jspp .lo .o .obj .png .wav +.SUFFIXES: .c .css .gif .h .html .ico .js .jspp .lo .o .obj .png .wav am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @@ -521,51 +507,12 @@ clean-binPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -shellinabox/$(am__dirstamp): - @$(MKDIR_P) shellinabox - @: > shellinabox/$(am__dirstamp) -shellinabox/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) shellinabox/$(DEPDIR) - @: > shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/cgi_root.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/root_page.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/vt100.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/shell_in_a_box.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/styles.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/print-styles.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/enabled.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/favicon.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/keyboard.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/keyboard-layout.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) -shellinabox/beep.$(OBJEXT): shellinabox/$(am__dirstamp) \ - shellinabox/$(DEPDIR)/$(am__dirstamp) shellinaboxd$(EXEEXT): $(shellinaboxd_OBJECTS) $(shellinaboxd_DEPENDENCIES) @rm -f shellinaboxd$(EXEEXT) $(shellinaboxd_LINK) $(shellinaboxd_OBJECTS) $(shellinaboxd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f shellinabox/beep.$(OBJEXT) - -rm -f shellinabox/cgi_root.$(OBJEXT) - -rm -f shellinabox/enabled.$(OBJEXT) - -rm -f shellinabox/favicon.$(OBJEXT) - -rm -f shellinabox/keyboard-layout.$(OBJEXT) - -rm -f shellinabox/keyboard.$(OBJEXT) - -rm -f shellinabox/print-styles.$(OBJEXT) - -rm -f shellinabox/root_page.$(OBJEXT) - -rm -f shellinabox/shell_in_a_box.$(OBJEXT) - -rm -f shellinabox/styles.$(OBJEXT) - -rm -f shellinabox/vt100.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -1033,14 +980,16 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \ config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done -install: install-am +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -1061,12 +1010,11 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f shellinabox/$(DEPDIR)/$(am__dirstamp) - -rm -f shellinabox/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ @@ -1144,7 +1092,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \ uninstall-man: uninstall-man1 -.MAKE: all install-am install-strip +.MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool clean-local \ @@ -1166,9 +1114,6 @@ uninstall-man: uninstall-man1 uninstall-man uninstall-man1 -OBJCOPY ?= objcopy -OBJDUMP ?= objdump - libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck @@ -1273,55 +1218,71 @@ clean-local: debian/shellinabox*.debhelper* \ debian/shellinabox.substvars \ debian/tmp - -rm -rf GNU-stack + -rm -rf shellinabox/beep.h \ + shellinabox/cgi_root.h \ + shellinabox/enabled.h \ + shellinabox/favicon.h \ + shellinabox/keyboard.h \ + shellinabox/keyboard-layout.h \ + shellinabox/print-styles.h \ + shellinabox/root_page.h \ + shellinabox/shell_in_a_box.h \ + shellinabox/styles.h \ + shellinabox/vt100.h -.css.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.css.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.gif.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.gif.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.png.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.png.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.html.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.html.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.ico.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack - -shellinabox/shell_in_a_box.o: ${top_srcdir}/shellinabox/shell_in_a_box.js \ - ${top_srcdir}/config.h - -${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp +.ico.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" .jspp.js: @echo preprocess "$<" "$@" + @mkdir -p "`dirname "$@"`" sed -e "`sed -e 's/^#define *\([^ ]*\) *\(.*\)/\/^[^#]\/s\/\1\/\2 \\\\\/* \1 *\\\\\/\/g/' \ -e t \ -e d "$<"`" \ @@ -1329,21 +1290,25 @@ ${top_srcdir}/shellinabox/vt100.js: ${top_srcdir}/shellinabox/vt100.jspp -e "s/VERSION/\"@VERSION@ (revision @VCS_REVISION@)\"/g" \ "$<" >"$@" -.js.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.js.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" -.wav.o: - @echo $(OBJCOPY) "$<" "$@" - @$(OBJCOPY) -I binary `$(objcopyflags)` `echo "$<" | $(renamesymbols)`\ - "$<" "$@" - @-printf '\000' >GNU-stack && \ - $(OBJCOPY) --add-section .note.GNU-stack=GNU-stack "$@"; \ - rm -f GNU-stack +.wav.h: + @echo od "$<" '>'"$@" + @mkdir -p "`dirname "$@"`" + @{ sym="`echo "$<" | $(symbolname)`"; \ + echo "static const char $${sym}Start[]="; \ + od -vb "$<" | sed 's/[0-7]*/"/;s/ /\\/g;s/$$/"/'; \ + echo ';'; \ + echo "static const int $${sym}Size=(int)sizeof($${sym}Start);"; \ + } >"$@" # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/config.h b/config.h index 8af3437..c338884 100644 --- a/config.h +++ b/config.h @@ -156,7 +156,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "229" +#define VCS_REVISION "230" /* Version number of package */ #define VERSION "2.10" diff --git a/configure b/configure index 2026648..5b22ad2 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=229 +VCS_REVISION=230 cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index 20c2ee8..9949662 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=229 +VCS_REVISION=230 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) diff --git a/demo/vt100.js b/demo/vt100.js index b965626..c29d0f8 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 229)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 230)" + "\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 0bdb822..6bf5e34 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -1400,8 +1400,8 @@ static void childProcess(struct Service *service, int width, int height, // Finish all pending PAM operations. int status, rc; check(NOINTR(waitpid(pid, &status, 0)) == pid); - pam_close_session(pam, PAM_SILENT); - pam_end(pam, rc); + rc = pam_close_session(pam, PAM_SILENT); + pam_end(pam, rc | PAM_DATA_SILENT); _exit(WIFEXITED(status) ? WEXITSTATUS(status) : -WTERMSIG(status)); } } diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index 9496ec5..1fbda75 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 229)" + + alert("Shell In A Box version " + "2.10 (revision 230)" + "\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 43c685e..382d495 100644 --- a/shellinabox/shellinaboxd.c +++ b/shellinabox/shellinaboxd.c @@ -76,6 +76,20 @@ #include "shellinabox/session.h" #include "shellinabox/usercss.h" +// Embedded resources +#include "shellinabox/beep.h" +#include "shellinabox/cgi_root.h" +#include "shellinabox/enabled.h" +#include "shellinabox/favicon.h" +#include "shellinabox/keyboard.h" +#include "shellinabox/keyboard-layout.h" +#include "shellinabox/print-styles.h" +#include "shellinabox/root_page.h" +#include "shellinabox/shell_in_a_box.h" +#include "shellinabox/styles.h" +#include "shellinabox/vt100.h" + + #define PORTNUM 4200 #define MAX_RESPONSE 2048 @@ -584,13 +598,6 @@ static void serveStaticFile(HttpConnection *http, const char *contentType, 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, const char *buf, int len) { checkGraveyard(); @@ -620,49 +627,32 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, // client session. return dataHandler(http, arg, buf, len, url); } - extern char rootPageStart[]; - extern char rootPageEnd[]; - char *rootPage; - check(rootPage = malloc(rootPageEnd - rootPageStart + 1)); - memcpy(rootPage, rootPageStart, rootPageEnd - rootPageStart); - rootPage[rootPageEnd - rootPageStart] = '\000'; - char *html = stringPrintf(NULL, rootPage, + char *html = stringPrintf(NULL, rootPageStart, enableSSL ? "true" : "false"); serveStaticFile(http, "text/html", html, strrchr(html, '\000')); free(html); - free(rootPage); } else if (pathInfoLength == 8 && !memcmp(pathInfo, "beep.wav", 8)) { // Serve the audio sample for the console bell. - extern char beepStart[]; - extern char beepEnd[]; - serveStaticFile(http, "audio/x-wav", beepStart, beepEnd); + serveStaticFile(http, "audio/x-wav", beepStart, beepStart + beepSize - 1); } else if (pathInfoLength == 11 && !memcmp(pathInfo, "enabled.gif", 11)) { // Serve the checkmark icon used in the context menu - extern char enabledStart[]; - extern char enabledEnd[]; - serveStaticFile(http, "image/gif", enabledStart, enabledEnd); + serveStaticFile(http, "image/gif", enabledStart, + enabledStart + enabledSize - 1); } else if (pathInfoLength == 11 && !memcmp(pathInfo, "favicon.ico", 11)) { // Serve the favicon - extern char faviconStart[]; - extern char faviconEnd[]; - serveStaticFile(http, "image/x-icon", faviconStart, faviconEnd); + serveStaticFile(http, "image/x-icon", faviconStart, + faviconStart + faviconSize - 1); } else if (pathInfoLength == 13 && !memcmp(pathInfo, "keyboard.html", 13)) { // Serve the keyboard layout - extern char keyboardLayoutStart[]; - extern char keyboardLayoutEnd[]; - serveStaticFile(http, "text/html", keyboardLayoutStart, keyboardLayoutEnd); + serveStaticFile(http, "text/html", keyboardLayoutStart, + keyboardLayoutStart + keyboardLayoutSize - 1); } else if (pathInfoLength == 12 && !memcmp(pathInfo, "keyboard.png", 12)) { // Serve the keyboard icon - extern char keyboardStart[]; - extern char keyboardEnd[]; - serveStaticFile(http, "image/png", keyboardStart, keyboardEnd); + serveStaticFile(http, "image/png", keyboardStart, + keyboardStart + keyboardSize - 1); } else if (pathInfoLength == 14 && !memcmp(pathInfo, "ShellInABox.js", 14)) { // Serve both vt100.js and shell_in_a_box.js in the same transaction. // Also, indicate to the client whether the server is SSL enabled. - extern char vt100Start[]; - extern char vt100End[]; - extern char shellInABoxStart[]; - extern char shellInABoxEnd[]; char *userCSSString = getUserCSSString(userCSSList); char *stateVars = stringPrintf(NULL, "serverSupportsSSL = %s;\n" @@ -677,8 +667,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, free(userCSSString); int stateVarsLength = strlen(stateVars); int contentLength = stateVarsLength + - (addr(vt100End) - addr(vt100Start)) + - (addr(shellInABoxEnd) - addr(shellInABoxStart)); + vt100Size - 1 + + shellInABoxSize - 1; char *response = stringPrintf(NULL, "HTTP/1.1 200 OK\r\n" "Content-Type: text/javascript; charset=utf-8\r\n" @@ -690,8 +680,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, check(response = realloc(response, headerLength + contentLength)); memcpy(memcpy(memcpy( response + headerLength, stateVars, stateVarsLength)+stateVarsLength, - vt100Start, vt100End - vt100Start) + (vt100End - vt100Start), - shellInABoxStart, shellInABoxEnd - shellInABoxStart); + vt100Start, vt100Size - 1) + vt100Size - 1, + shellInABoxStart, shellInABoxSize - 1); } else { contentLength = 0; } @@ -703,10 +693,8 @@ static int shellInABoxHttpHandler(HttpConnection *http, void *arg, cssStyleSheet, strrchr(cssStyleSheet, '\000')); } else if (pathInfoLength == 16 && !memcmp(pathInfo, "print-styles.css",16)){ // Serve the style sheet. - extern char printStylesStart[]; - extern char printStylesEnd[]; serveStaticFile(http, "text/css; charset=utf-8", - printStylesStart, printStylesEnd); + printStylesStart, printStylesStart + printStylesSize - 1); } else if (pathInfoLength > 8 && !memcmp(pathInfo, "usercss-", 8)) { // Server user style sheets (if any) struct UserCSS *css = userCSSList; @@ -850,11 +838,7 @@ static void parseArgs(int argc, char * const argv[]) { int verbosity = MSG_DEFAULT; externalFiles = newHashMap(destroyExternalFileHashEntry, NULL); HashMap *serviceTable = newHashMap(destroyServiceHashEntry, NULL); - extern char stylesStart[]; - extern char stylesEnd[]; - check(cssStyleSheet = malloc(stylesEnd - stylesStart + 1)); - memcpy(cssStyleSheet, stylesStart, stylesEnd - stylesStart); - cssStyleSheet[stylesEnd - stylesStart] = '\000'; + check(cssStyleSheet = strdup(stylesStart)); for (;;) { static const char optstring[] = "+hb::c:df:g:np:s:tqu:v"; @@ -1278,19 +1262,12 @@ int main(int argc, char * const argv[]) { // Output a