From 8ca5f6852b5711aac45c497f0051b717dc2062a4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 17 Jan 2006 15:17:39 +0000 Subject: [PATCH] logging.C --- src/Makefile.in | 249 +++++++++++++++++++++++------------------------- src/fdpass.C | 4 - src/fdpass.h | 3 - src/feature.h | 8 ++ src/init.C | 20 +--- src/logging.C | 9 +- src/main.C | 18 ---- src/ptytty.C | 198 +++++++++++++++++++++++++++++++++++--- src/ptytty.h | 7 +- src/rxvt.h | 7 +- src/rxvtc.C | 4 +- src/rxvtd.C | 6 +- 12 files changed, 326 insertions(+), 207 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index f42779f9..bce760c2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -66,9 +66,9 @@ COMMON = \ command.o rxvtfont.o init.o logging.o main.o misc.o netdisp.o \ ptytty.o screen.o scrollbar.o scrollbar-next.o scrollbar-rxvt.o \ scrollbar-xterm.o scrollbar-plain.o xdefaults.o xpm.o encoding.o \ - rxvttoolkit.o rxvtutil.o iom.o keyboard.o @PERL_O@ + rxvttoolkit.o rxvtutil.o iom.o keyboard.o fdpass.o @PERL_O@ -COMMON_DAEMON = rxvtdaemon.o fdpass.o +COMMON_DAEMON = rxvtdaemon.o RXVT_BASENAME=`$(ECHO) $(RXVTNAME)|$(SED) 's/$(EXEEXT)$$//'|$(SED) '$(transform)'` RXVT_BINNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)$(EXEEXT) @@ -107,7 +107,7 @@ rxvtd: rxvtd.o $(COMMON) $(COMMON_DAEMON) $(LINK) -o $@ $^ $(LIBS) $(XLIB) $(DLIB) @PERLLIB@ # $(LIBTOOL) --mode=link $(LINK) rxvtd.o rxvtdaemon.o librxvt.la $(LIBS) $(XLIB) $(DLIB) -o $@ -rxvtc: rxvtc.o $(COMMON_DAEMON) +rxvtc: rxvtc.o $(COMMON_DAEMON) fdpass.o $(LINK) -o $@ $^ $(LIBS) $(DLIB) # $(LIBTOOL) --mode=link $(LINK) rxvtc.o rxvtdaemon.o $(LIBS) $(DLIB) -o $@ @@ -163,10 +163,10 @@ depend: # DO NOT DELETE: nice dependency list follows -command.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -command.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -command.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h version.h -command.o: command.h keyboard.h +command.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +command.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +command.o: salloc.h rxvtperl.h hookinc.h rsinc.h version.h command.h +command.o: keyboard.h encoding.o: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.o: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.o: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -182,86 +182,81 @@ encoding.o: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h encoding.o: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h encoding.o: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h encoding.o: table/compose.h table/category.h -fdpass.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +fdpass.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h fdpass.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h fdpass.o: salloc.h rxvtperl.h hookinc.h rsinc.h fdpass.h -init.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -init.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -init.o: salloc.h rxvtperl.h hookinc.h rsinc.h init.h +init.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +init.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +init.o: rxvtperl.h hookinc.h rsinc.h init.h iom.o: iom.h iom_conf.h rxvtutil.h callback.h -keyboard.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -keyboard.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -keyboard.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -keyboard.o: command.h -logging.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -logging.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -logging.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -main.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -main.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -main.o: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -misc.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -misc.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -misc.o: salloc.h rxvtperl.h hookinc.h rsinc.h -netdisp.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -netdisp.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -netdisp.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -ptytty.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +keyboard.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +keyboard.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +keyboard.o: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h command.h +logging.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +logging.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +logging.o: salloc.h rxvtperl.h hookinc.h rsinc.h ptytty.h +main.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +main.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +main.o: rxvtperl.h hookinc.h rsinc.h keyboard.h +misc.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +misc.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +misc.o: rxvtperl.h hookinc.h rsinc.h +netdisp.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +netdisp.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +netdisp.o: salloc.h rxvtperl.h hookinc.h rsinc.h +ptytty.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h ptytty.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -ptytty.o: salloc.h rxvtperl.h hookinc.h rsinc.h -rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -rxvt.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -rxvt.o: salloc.h rxvtperl.h hookinc.h rsinc.h +ptytty.o: salloc.h rxvtperl.h hookinc.h rsinc.h fdpass.h ptytty.h +rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +rxvt.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +rxvt.o: rxvtperl.h hookinc.h rsinc.h rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h fdpass.h rxvt.h rxvtlib.h -rxvtc.o: ptytty.h feature.h optinc.h encoding.h rxvtfont.h rxvttoolkit.h -rxvtc.o: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -rxvtd.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +rxvtc.o: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h +rxvtc.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtd.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtd.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h rxvtd.o: salloc.h rxvtperl.h hookinc.h rsinc.h rxvtdaemon.h fdpass.h rxvtdaemon.o: rxvtdaemon.h rxvtutil.h -rxvtfont.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -rxvtfont.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -rxvtfont.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h table/linedraw.h +rxvtfont.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvtfont.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +rxvtfont.o: salloc.h rxvtperl.h hookinc.h rsinc.h table/linedraw.h rxvtperl.o: ../config.h iom.h iom_conf.h rxvtutil.h callback.h rxvt.h -rxvtperl.o: rxvtlib.h ptytty.h feature.h optinc.h encoding.h rxvtfont.h -rxvtperl.o: rxvttoolkit.h salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -rxvtperl.o: perlxsi.c -rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -rxvttoolkit.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -rxvttoolkit.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtperl.o: rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h +rxvtperl.o: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h perlxsi.c +rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvttoolkit.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +rxvttoolkit.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h rxvtutil.o: rxvtutil.h salloc.o: salloc.h -screen.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +screen.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h screen.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h screen.o: salloc.h rxvtperl.h hookinc.h rsinc.h salloc.C -scrollbar-next.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-next.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-next.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-plain.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-plain.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-plain.o: rsinc.h -scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-rxvt.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-rxvt.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-xterm.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-xterm.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-xterm.o: rsinc.h -scrollbar.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -xdefaults.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -xdefaults.o: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -xdefaults.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h version.h -xdefaults.o: keyboard.h -xpm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -xpm.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -xpm.o: salloc.h rxvtperl.h hookinc.h rsinc.h - -command.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -command.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -command.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h version.h -command.lo: command.h keyboard.h +scrollbar-next.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-next.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-next.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-plain.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-plain.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-rxvt.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-rxvt.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-xterm.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-xterm.o: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +scrollbar.o: salloc.h rxvtperl.h hookinc.h rsinc.h +xdefaults.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +xdefaults.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +xdefaults.o: salloc.h rxvtperl.h hookinc.h rsinc.h version.h keyboard.h +xpm.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +xpm.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +xpm.o: rxvtperl.h hookinc.h rsinc.h + +command.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +command.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +command.lo: salloc.h rxvtperl.h hookinc.h rsinc.h version.h command.h +command.lo: keyboard.h encoding.lo: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.lo: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.lo: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -277,81 +272,75 @@ encoding.lo: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h encoding.lo: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h encoding.lo: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h encoding.lo: table/compose.h table/category.h -fdpass.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -fdpass.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -fdpass.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h fdpass.h -init.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +fdpass.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +fdpass.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +fdpass.lo: salloc.h rxvtperl.h hookinc.h rsinc.h fdpass.h +init.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h init.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h init.lo: salloc.h rxvtperl.h hookinc.h rsinc.h init.h iom.lo: iom.h iom_conf.h rxvtutil.h callback.h -keyboard.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -keyboard.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -keyboard.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -keyboard.lo: command.h -logging.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -logging.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -logging.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -main.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +keyboard.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +keyboard.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +keyboard.lo: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h command.h +logging.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +logging.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +logging.lo: salloc.h rxvtperl.h hookinc.h rsinc.h ptytty.h +main.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h main.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h main.lo: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -misc.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +misc.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h misc.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h misc.lo: salloc.h rxvtperl.h hookinc.h rsinc.h -netdisp.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -netdisp.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -netdisp.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -ptytty.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -ptytty.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -ptytty.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +netdisp.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +netdisp.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +netdisp.lo: salloc.h rxvtperl.h hookinc.h rsinc.h +ptytty.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +ptytty.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +ptytty.lo: salloc.h rxvtperl.h hookinc.h rsinc.h fdpass.h ptytty.h +rxvt.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h rxvt.lo: salloc.h rxvtperl.h hookinc.h rsinc.h rxvtc.lo: ../config.h rxvtdaemon.h rxvtutil.h fdpass.h rxvt.h rxvtlib.h -rxvtc.lo: ptytty.h feature.h optinc.h encoding.h rxvtfont.h rxvttoolkit.h -rxvtc.lo: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -rxvtd.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h +rxvtc.lo: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h +rxvtc.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtd.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtd.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h rxvtd.lo: salloc.h rxvtperl.h hookinc.h rsinc.h rxvtdaemon.h fdpass.h rxvtdaemon.lo: rxvtdaemon.h rxvtutil.h -rxvtfont.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -rxvtfont.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -rxvtfont.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -rxvtfont.lo: table/linedraw.h +rxvtfont.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvtfont.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +rxvtfont.lo: salloc.h rxvtperl.h hookinc.h rsinc.h table/linedraw.h rxvtperl.lo: ../config.h iom.h iom_conf.h rxvtutil.h callback.h rxvt.h -rxvtperl.lo: rxvtlib.h ptytty.h feature.h optinc.h encoding.h rxvtfont.h -rxvtperl.lo: rxvttoolkit.h salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h -rxvtperl.lo: perlxsi.c -rxvttoolkit.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -rxvttoolkit.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -rxvttoolkit.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +rxvtperl.lo: rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h +rxvtperl.lo: salloc.h rxvtperl.h hookinc.h rsinc.h keyboard.h perlxsi.c +rxvttoolkit.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvttoolkit.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +rxvttoolkit.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h rxvtutil.lo: rxvtutil.h salloc.lo: salloc.h -screen.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -screen.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -screen.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h salloc.C -scrollbar-next.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-next.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-next.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-next.lo: rsinc.h -scrollbar-plain.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h +screen.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +screen.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +screen.lo: salloc.h rxvtperl.h hookinc.h rsinc.h salloc.C +scrollbar-next.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-next.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-next.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar-plain.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h scrollbar-plain.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h scrollbar-plain.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h scrollbar-plain.lo: rsinc.h -scrollbar-rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar-rxvt.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h -scrollbar-rxvt.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-rxvt.lo: rsinc.h -scrollbar-xterm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h +scrollbar-rxvt.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar-rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h +scrollbar-rxvt.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar-xterm.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h scrollbar-xterm.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h scrollbar-xterm.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h scrollbar-xterm.lo: rsinc.h -scrollbar.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -scrollbar.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -scrollbar.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h -xdefaults.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h -xdefaults.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h -xdefaults.lo: callback.h salloc.h rxvtperl.h hookinc.h rsinc.h version.h -xdefaults.lo: keyboard.h -xpm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h optinc.h encoding.h -xpm.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h -xpm.lo: salloc.h rxvtperl.h hookinc.h rsinc.h +scrollbar.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +scrollbar.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +scrollbar.lo: salloc.h rxvtperl.h hookinc.h rsinc.h +xdefaults.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +xdefaults.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h +xdefaults.lo: salloc.h rxvtperl.h hookinc.h rsinc.h version.h keyboard.h +xpm.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtfont.h +xpm.lo: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h +xpm.lo: rxvtperl.h hookinc.h rsinc.h diff --git a/src/fdpass.C b/src/fdpass.C index 69cb0ad0..51bfd8fa 100644 --- a/src/fdpass.C +++ b/src/fdpass.C @@ -23,8 +23,6 @@ #include "../config.h" #include "rxvt.h" -#if ENABLE_FRILLS && HAVE_UNIX_FDPASS - #include #include @@ -102,5 +100,3 @@ rxvt_recv_fd (int socket) return *(int *)CMSG_DATA (cmsg); } -#endif - diff --git a/src/fdpass.h b/src/fdpass.h index 2c3c3905..b8a576d2 100644 --- a/src/fdpass.h +++ b/src/fdpass.h @@ -23,10 +23,7 @@ #include "../config.h" #include "rxvt.h" -#if ENABLE_FRILLS && HAVE_UNIX_FDPASS - int rxvt_send_fd (int socket, int fd); int rxvt_recv_fd (int socket); -#endif diff --git a/src/feature.h b/src/feature.h index 07acf73f..c0825881 100644 --- a/src/feature.h +++ b/src/feature.h @@ -34,6 +34,14 @@ # define XAPPLOADDIRLOCALE X11LIBDIR "/%s/app-defaults" #endif +/*-------------------------------SECURITY-------------------------------*/ + +/* + * define if you want to use a separate process for pty/tty handling + * when running setuid/setgid. You need this when making it setuid/setgid. + */ +#define PTYTTY_HELPER 1 + /*-----------------------SCREEN OPTIONS AND COLOURS---------------------*/ /* diff --git a/src/init.C b/src/init.C index adbc9805..bfee0820 100644 --- a/src/init.C +++ b/src/init.C @@ -1445,24 +1445,8 @@ rxvt_term::run_command (const char *const *argv) _exit (EXIT_FAILURE); default: - { -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) - int fdstdin; - - fdstdin = dup (STDIN_FILENO); - dup2 (pty->tty, STDIN_FILENO); -#endif - -#ifdef UTMP_SUPPORT - privileged_utmp (SAVE); -#endif - -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) - - dup2 (fdstdin, STDIN_FILENO); - close (fdstdin); -#endif - } + if (!OPTION (Opt_utmpInhibit)) + pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); pty->close_tty (); break; diff --git a/src/logging.C b/src/logging.C index 86d3bdf1..46424481 100644 --- a/src/logging.C +++ b/src/logging.C @@ -165,14 +165,19 @@ rxvt_ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname) #endif #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) - { # ifdef HAVE_TTYSLOT + int fdstdin = dup (STDIN_FILENO); + dup2 (pty->tty, STDIN_FILENO); + i = ttyslot (); if (rxvt_write_bsd_utmp (i, ut)) utmp_pos = i; + + dup2 (fdstdin, STDIN_FILENO); + close (fdstdin); # else - FILE *fd0; + FILE *fd0; if ((fd0 = fopen (TTYTAB_FILENAME, "r")) != NULL) { diff --git a/src/main.C b/src/main.C index 0bfadb68..e65fd233 100644 --- a/src/main.C +++ b/src/main.C @@ -717,24 +717,6 @@ rxvt_privileges (rxvt_privaction action) #endif } -#ifdef UTMP_SUPPORT -void -rxvt_term::privileged_utmp (rxvt_privaction action) -{ - if (OPTION (Opt_utmpInhibit)) - return; - - rxvt_privileges (RESTORE); - - if (action == SAVE) - pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); - else - pty->logout (); - - rxvt_privileges (IGNORE); -} -#endif - /*----------------------------------------------------------------------*/ /* * window size/position calculcations for XSizeHint and other storage. diff --git a/src/ptytty.C b/src/ptytty.C index bab59bde..9f4740d6 100644 --- a/src/ptytty.C +++ b/src/ptytty.C @@ -24,18 +24,14 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" -# include -# include +#include +#include + +#include +#include +#include +#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_FCNTL_H -# include -#endif #ifdef HAVE_SYS_IOCTL_H # include #endif @@ -56,6 +52,8 @@ #include #include +#include "rxvtutil.h" +#include "fdpass.h" #include "ptytty.h" ///////////////////////////////////////////////////////////////////////////// @@ -445,10 +443,184 @@ rxvt_ptytty_unix::get () return true; } +#if PTYTTY_HELPER + +static int sock_fd; +static int pid; + +struct command +{ + enum { get, login, destroy } type; + + rxvt_ptytty *id; + + bool login_shell; + int cmd_pid; + char hostname[512]; // arbitrary, but should be plenty +}; + +struct rxvt_ptytty_proxy : zero_initialized, rxvt_ptytty +{ + rxvt_ptytty *id; + + rxvt_ptytty_proxy (); + ~rxvt_ptytty_proxy (); + + bool get (); + void login (int cmd_pid, bool login_shell, const char *hostname); +}; + +bool +rxvt_ptytty_proxy::get () +{ + command cmd; + + cmd.type = command::get; + + write (sock_fd, &cmd, sizeof (cmd)); + + if (read (sock_fd, &id, sizeof (id)) != sizeof (id)) + rxvt_fatal ("protocol error while creating pty using helper process, aborting.\n"); + + if (!id) + return false; + + if ((pty = rxvt_recv_fd (sock_fd)) < 0 + || (tty = rxvt_recv_fd (sock_fd)) < 0) + rxvt_fatal ("protocol error while reading pty/tty fds from helper process, aborting.\n"); + + return true; +} + +void +rxvt_ptytty_proxy::login (int cmd_pid, bool login_shell, const char *hostname) +{ + command cmd; + + cmd.type = command::login; + cmd.id = id; + cmd.cmd_pid = cmd_pid; + cmd.login_shell = login_shell; + strncpy (cmd.hostname, hostname, sizeof (cmd.hostname)); + + write (sock_fd, &cmd, sizeof (cmd)); +} + +rxvt_ptytty_proxy::~rxvt_ptytty_proxy () +{ + command cmd; + + cmd.type = command::destroy; + cmd.id = id; + + write (sock_fd, &cmd, sizeof (cmd)); +} + +static +void serve () +{ + command cmd; + vector ptys; + + while (read (sock_fd, &cmd, sizeof (command)) == sizeof (command)) + { + if (cmd.type == command::get) + { + // -> id ptyfd ttyfd + cmd.id = new rxvt_ptytty_unix; + + if (cmd.id->get ()) + { + write (sock_fd, &cmd.id, sizeof (cmd.id)); + ptys.push_back (cmd.id); + + rxvt_send_fd (sock_fd, cmd.id->pty); + rxvt_send_fd (sock_fd, cmd.id->tty); + } + else + { + delete cmd.id; + cmd.id = 0; + write (sock_fd, &cmd.id, sizeof (cmd.id)); + } + } + else if (cmd.type == command::login) + { + if (find (ptys.begin (), ptys.end (), cmd.id)) + { + cmd.hostname[sizeof (cmd.hostname) - 1] = 0; + cmd.id->login (cmd.cmd_pid, cmd.login_shell, cmd.hostname); + } + else printf ("xxx hiya login no match %p\n", cmd.id); + } + else if (cmd.type == command::destroy) + { + rxvt_ptytty **pty = find (ptys.begin (), ptys.end (), cmd.id); + + if (*pty) + { + ptys.erase (pty); + delete *pty; + } + else printf ("xxx hiya destroy no match %p\n", cmd.id); + } + else + break; + } + + // destroy all ptys + for (rxvt_ptytty **i = ptys.end (); i-- > ptys.begin (); ) + delete *i; +} + +void rxvt_ptytty_server () +{ + int sv[2]; + + if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv)) + rxvt_fatal ("could not create socket to communicate with pty/sessiondb helper, aborting.\n"); + + pid = fork (); + + if (pid < 0) + rxvt_fatal ("could not create pty/sessiondb helper process, aborting.\n"); + + if (pid) + { + // client, urxvt + sock_fd = sv[0]; + close (sv[1]); + fcntl (sock_fd, F_SETFD, FD_CLOEXEC); + } + else + { + // server, pty-helper + sock_fd = sv[1]; + + close (sv[0]);//D +// for (int fd = 0; fd < 1023; fd++) +// if (fd != sock_fd) +// close (fd); + + serve (); + _exit (EXIT_SUCCESS); + } +} +#endif + // a "factory" *g* -rxvt_ptytty *rxvt_new_ptytty () +rxvt_ptytty * +rxvt_new_ptytty () { - return new rxvt_ptytty_unix; +#if PTYTTY_HELPER + if (pid > 0) + { + // use helper process + return new rxvt_ptytty_proxy; + } + else +#endif + return new rxvt_ptytty_unix; } /*----------------------- end-of-file (C source) -----------------------*/ diff --git a/src/ptytty.h b/src/ptytty.h index 8fcef857..5b380c67 100644 --- a/src/ptytty.h +++ b/src/ptytty.h @@ -51,12 +51,7 @@ #endif -struct rxvt_ptytty_base : rxvt_ptytty -{ - virtual void put () = 0; -}; - -struct rxvt_ptytty_unix : rxvt_ptytty_base +struct rxvt_ptytty_unix : rxvt_ptytty { char *name; diff --git a/src/rxvt.h b/src/rxvt.h index 66d781dc..312d728f 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -186,18 +186,15 @@ struct rxvt_ptytty { } virtual bool get () = 0; - virtual void login (int cmd_pid, bool login_shell, const char *hostname) = 0; - virtual void logout () = 0; void close_tty (); - bool make_controlling_tty (); void set_utf8_mode (bool on); }; -// a "factory" *g* -rxvt_ptytty *rxvt_new_ptytty (); +rxvt_ptytty *rxvt_new_ptytty (); // create a new pty object +void rxvt_ptytty_server (); // start the ptytty server process /* * the 'essential' information for reporting Mouse Events diff --git a/src/rxvtc.C b/src/rxvtc.C index e49bb203..31a7ff4c 100644 --- a/src/rxvtc.C +++ b/src/rxvtc.C @@ -41,7 +41,7 @@ struct client : rxvt_connection { client::client () { - if ((fd = socket (PF_UNIX, SOCK_STREAM, 0)) < 0) + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { perror ("unable to create communications socket"); exit (EXIT_FAILURE); @@ -110,7 +110,6 @@ main (int argc, const char *const *argv) } else if (!strcmp (tok, "MSG") && c.recv (tok)) fprintf (stderr, "%s", (const char *)tok); -#if ENABLE_FRILLS && HAVE_UNIX_FDPASS else if (!strcmp (tok, "GETFD") && c.recv (cint)) { if (rxvt_send_fd (c.fd, cint) < 0) @@ -119,7 +118,6 @@ main (int argc, const char *const *argv) exit (EXIT_FAILURE); } } -#endif else if (!strcmp (tok, "END")) { int success; diff --git a/src/rxvtd.C b/src/rxvtd.C index ddc7b76f..b79c70f8 100644 --- a/src/rxvtd.C +++ b/src/rxvtd.C @@ -73,7 +73,7 @@ struct unix_listener { unix_listener::unix_listener (const char *sockname) : accept_ev (this, &unix_listener::accept_cb) { - if ((fd = socket (PF_UNIX, SOCK_STREAM, 0)) < 0) + if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { perror ("unable to create listening socket"); exit (EXIT_FAILURE); @@ -120,13 +120,9 @@ void unix_listener::accept_cb (io_watcher &w, short revents) int server::getfd (int remote_fd) { -#if ENABLE_FRILLS && HAVE_UNIX_FDPASS send ("GETFD"); send (remote_fd); return rxvt_recv_fd (fd); -#else - return -1; -#endif } void server::log_msg (const char *msg) -- 2.34.1