In our last episode, <liehcugk1eqn4kge8ejb08ot8mrmtgb...@4ax.com>,
the lovely and talented Itchy and Scratchy broadcast on
comp.unix.bsd.freebsd.misc:
> No luck with this nice little application, it seems. And there is no
> other similar proggie for FreeBSD. Damn! :-(
Okay, I'm only going to do this once.
I am an idiot. I know nothing about C, graphics, or FreeBSD
security. If you do this you are a big idiot too, especially
if you have other users. I have got zgv to work. I don't know
how I did it, but I am pretty sure I did lots of bad things
to security and all kind of other stuff.
Zgv only works if you launch it from the console (i.e. ttyv0),
so in every application that uses zqv (e.g. as an image viewer
in lynx) must call a script to test whether it is in the console
before it launches zgv because if you launch zgv as I have it
from any other virtual term the system *WILL* lock up and you will
have to reboot, and you will be lucky if you can get a clean shutdown
with the three finger salute before the reboot. Obviously for
command line use you should alias zgv to a similar script.
If your computer blows up, your security lets Hong Kong gain
control of your computer, or your hard disks crash, it is because
you were an idiot and followed these instructions, so don't
come crying to me.
First install svgalib. At the time I think I had to hack the
hell out of svgalib to get it to work, but there is a port now.
I am not 100% certain the port svgalib will work, but it comes
with test stuff (I think) so get it up and running first.
Now am about to give you the diffs for zgv-5.1. I am pretty sure
some of the hacks serve no useful purpose. I am positive that
I have not done it elegantly. And it is a good bet you security
will be screwed.
Here are the diffs. What you do with them is your own damn
business. May the Daemon have mercy on your soul
diff -C 2 -r share/zgv-5.1/Makefile zgv-5.1/Makefile
*** share/zgv-5.1/Makefile Thu Jun 1 09:48:58 2000
--- zgv-5.1/Makefile Wed Oct 11 17:25:57 2000
***************
*** 29,33 ****
all: src man infowarn
! src: zgv src/install-info
# We try this the whole time, as the dependancies are a bit
--- 29,33 ----
all: src man infowarn
! src: zgv
# We try this the whole time, as the dependancies are a bit
***************
*** 36,41 ****
$(MAKE) -C src zgv
! src/install-info: src/install-info.c
! $(MAKE) -C src install-info
man: doc/zgv.1
--- 36,41 ----
$(MAKE) -C src zgv
! #src/install-info: src/install-info.c
! # $(MAKE) -C src install-info
man: doc/zgv.1
diff -C 2 -r share/zgv-5.1/config.mk zgv-5.1/config.mk
*** share/zgv-5.1/config.mk Thu Jun 1 09:53:23 2000
--- zgv-5.1/config.mk Wed Oct 11 20:00:07 2000
***************
*** 14,18 ****
# Usually it will be simpler to just set PREFIX.
#
! PREFIX=/usr
# comment this out to use traditional info/man locations, e.g.
--- 14,18 ----
# Usually it will be simpler to just set PREFIX.
#
! PREFIX=/usr/local
# comment this out to use traditional info/man locations, e.g.
***************
*** 20,24 ****
# /usr/share/info and /usr/share/man/man1.
#
! SHARE_INFIX=/share
BINDIR=$(PREFIX)/bin
--- 20,24 ----
# /usr/share/info and /usr/share/man/man1.
#
! #SHARE_INFIX=/share
BINDIR=$(PREFIX)/bin
***************
*** 33,37 ****
# you) you should uncomment this to prevent `make install' doing that.
#
! #INFO_DIR_UPDATE=no
--- 33,37 ----
# you) you should uncomment this to prevent `make install' doing that.
#
! INFO_DIR_UPDATE=no
diff -C 2 -r share/zgv-5.1/doc/Makefile zgv-5.1/doc/Makefile
*** share/zgv-5.1/doc/Makefile Thu Jun 1 09:52:43 2000
--- zgv-5.1/doc/Makefile Wed Oct 11 20:19:33 2000
***************
*** 30,38 ****
# I think this one's getting just a tiny bit confusing :-}
! ifeq ($(INFO_DIR_UPDATE),no)
install:
! else
! install: ../src/install-info
! endif
install -m 444 zgv.1 $(MANDIR)
install -m 444 zgv zgv-? $(INFODIR)
--- 30,38 ----
# I think this one's getting just a tiny bit confusing :-}
! #ifeq ($(INFO_DIR_UPDATE),no)
install:
! #else
! #install: ../src/install-info
! #endif
install -m 444 zgv.1 $(MANDIR)
install -m 444 zgv zgv-? $(INFODIR)
***************
*** 40,55 ****
# Info always uses a dir file in preference to a dir.gz, so we don't use
# dir.gz unless it's the only game in town.
! ifneq ($(INFO_DIR_UPDATE),no)
! if [ -f $(INFODIR)/dir.gz -a ! -f $(INFODIR)/dir ]; then \
! gzip -d $(INFODIR)/dir.gz; \
! ../src/install-info zgv $(INFODIR)/dir; \
! gzip $(INFODIR)/dir; \
! else \
! ../src/install-info zgv $(INFODIR)/dir; \
! fi
! endif
!
! ../src/install-info: ../src/install-info.c
! make -C ../src install-info
# can't easily fix dir :-/, but do remove the files.
--- 40,55 ----
# Info always uses a dir file in preference to a dir.gz, so we don't use
# dir.gz unless it's the only game in town.
! #ifneq ($(INFO_DIR_UPDATE),no)
! # if [ -f $(INFODIR)/dir.gz -a ! -f $(INFODIR)/dir ]; then \
! # gzip -d $(INFODIR)/dir.gz; \
! # ../src/install-info zgv $(INFODIR)/dir; \
! # gzip $(INFODIR)/dir; \
! # else \
! # ../src/install-info zgv $(INFODIR)/dir; \
! # fi
! #endif
! install-info $(INFODIR)/zgv $(INFODIR)/dir
! #../src/install-info: ../src/install-info.c
! # make -C ../src install-info
# can't easily fix dir :-/, but do remove the files.
Only in share/zgv-5.1/doc: zgv
Only in share/zgv-5.1/doc: zgv-1
Only in share/zgv-5.1/doc: zgv-2
Only in share/zgv-5.1/doc: zgv-3
Only in share/zgv-5.1/doc: zgv-4
diff -C 2 -r share/zgv-5.1/src/Makefile zgv-5.1/src/Makefile
*** share/zgv-5.1/src/Makefile Thu Jun 1 09:51:08 2000
--- zgv-5.1/src/Makefile Wed Oct 11 18:34:18 2000
***************
*** 17,22 ****
CFLAGS = $(WARNOPTS) $(PCDDEF) \
-DRGB_DB_FILE=\"$(RGB_DB)\" \
! -O2 -fomit-frame-pointer -finline-functions
!
ZGV_LIBS = -lvgagl -lvga -ljpeg -lpng -lz -lm
ifeq ($(PCDDEF),-DPCD_SUPPORT)
--- 17,22 ----
CFLAGS = $(WARNOPTS) $(PCDDEF) \
-DRGB_DB_FILE=\"$(RGB_DB)\" \
! -O2 -fomit-frame-pointer -finline-functions \
! -idirafter /usr/local/include -idirafter /usr/local -L /usr/local/lib
ZGV_LIBS = -lvgagl -lvga -ljpeg -lpng -lz -lm
ifeq ($(PCDDEF),-DPCD_SUPPORT)
***************
*** 28,32 ****
# (It would also be weird to have it made by the `doc' Makefile, IMHO.)
! all: zgv install-info
ZGV_OBJS = zgv.o vgadisp.o font.o 3deffects.o mousecur.o \
--- 28,32 ----
# (It would also be weird to have it made by the `doc' Makefile, IMHO.)
! all: zgv
ZGV_OBJS = zgv.o vgadisp.o font.o 3deffects.o mousecur.o \
***************
*** 49,57 ****
$(CC) $(CFLAGS) -o bdf2h bdf2h.o
! install-info: install-info.c
! $(CC) $(INFODIRDEF) -o install-info install-info.c
install: all
! install -m 4511 -o root -g root -s zgv $(BINDIR)
uninstall:
--- 49,57 ----
$(CC) $(CFLAGS) -o bdf2h bdf2h.o
! #install-info: install-info.c
! # $(CC) $(INFODIRDEF) -o install-info install-info.c
install: all
! install -m 4511 -o root -g wheel -s zgv $(BINDIR)
uninstall:
***************
*** 70,74 ****
helppage.o: helppage.c 3deffects.h font.h readnbkey.h rc_config.h \
rcfile.h mousecur.h zgv.h
! install-info.o: install-info.c
magic.o: magic.c magic.h
mousecur.o: mousecur.c rc_config.h rcfile.h zgv.h
--- 70,74 ----
helppage.o: helppage.c 3deffects.h font.h readnbkey.h rc_config.h \
rcfile.h mousecur.h zgv.h
! #install-info.o: install-info.c
magic.o: magic.c magic.h
mousecur.o: mousecur.c rc_config.h rcfile.h zgv.h
diff -C 2 -r share/zgv-5.1/src/readnbkey.c zgv-5.1/src/readnbkey.c
*** share/zgv-5.1/src/readnbkey.c Thu Mar 9 22:02:03 2000
--- zgv-5.1/src/readnbkey.c Wed Oct 11 18:47:36 2000
***************
*** 17,21 ****
#include <vgamouse.h>
#include <vgakeyboard.h> /* for SCANCODE_{F1,F11} */
! #include <linux/kd.h>
#include "zgv.h"
#include "readnbkey.h"
--- 17,21 ----
#include <vgamouse.h>
#include <vgakeyboard.h> /* for SCANCODE_{F1,F11} */
! #include <sys/kbio.h> /* #include <linux/kd.h> */
#include "zgv.h"
#include "readnbkey.h"
***************
*** 46,55 ****
int is_logical_keymap(int ttyfd)
{
! struct kbentry ent1,ent2;
/* this is horrible, but I really do need the scancodes to check this :-(
* as the mapping is done at that level.
*/
! ent1.kb_table=K_NORMTAB;
ent1.kb_index=SCANCODE_F11;
ent2.kb_table=K_SHIFTTAB;
--- 46,55 ----
int is_logical_keymap(int ttyfd)
{
! /* struct kbentry ent1,ent2; */
/* this is horrible, but I really do need the scancodes to check this :-(
* as the mapping is done at that level.
*/
! /* ent1.kb_table=K_NORMTAB;
ent1.kb_index=SCANCODE_F11;
ent2.kb_table=K_SHIFTTAB;
***************
*** 60,64 ****
if(ent1.kb_value==ent2.kb_value)
! return(0);
return(1);
--- 60,64 ----
if(ent1.kb_value==ent2.kb_value)
! return(0); */
return(1);
diff -C 2 -r share/zgv-5.1/src/zgv.c zgv-5.1/src/zgv.c
*** share/zgv-5.1/src/zgv.c Thu Apr 13 11:02:18 2000
--- zgv-5.1/src/zgv.c Wed Oct 11 19:14:14 2000
***************
*** 34,38 ****
#include <sys/file.h>
#include <sys/ioctl.h>
! #include <sys/vt.h>
#include <errno.h>
#include <vga.h>
--- 34,38 ----
#include <sys/file.h>
#include <sys/ioctl.h>
! #include <sys/consio.h> /* #include <sys/vt.h> */
#include <errno.h>
#include <vga.h>
***************
*** 3109,3113 ****
static char vt_filename[128];
struct stat sbuf;
! struct vt_stat vts;
int major,minor;
int fd;
--- 3109,3113 ----
static char vt_filename[128];
struct stat sbuf;
! int vts;
int major,minor;
int fd;
***************
*** 3120,3124 ****
zgv_vt=minor=sbuf.st_rdev&0xff;
close(fd);
! if(major==4 && minor<64)
return(1); /* if on a console, already ok */
--- 3120,3124 ----
zgv_vt=minor=sbuf.st_rdev&0xff;
close(fd);
! if(major==12 && minor<64)
return(1); /* if on a console, already ok */
***************
*** 3131,3136 ****
/* still root perms, so this shouldn't be a problem...
...
read more »