2007-02-09 16:58:14 +01:00
|
|
|
|
--- .pkgextract
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ .pkgextract 2007-02-15 00:00:00.000000000 +0100
|
2007-04-17 12:54:22 +02:00
|
|
|
|
@@ -0,0 +1,7 @@
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+bzcat ../man-db-2.4.3-3.diff.bz2 | patch -p1 -s --suffix=.debian
|
|
|
|
|
+patch -p0 -s --suffix=.groff < ../man-db-2.3.19deb4.0-groff.dif
|
|
|
|
|
+patch -p0 -s --suffix=.err < ../man-db-2.4.1-error.dif
|
|
|
|
|
+patch -p0 -s --suffix=.sect < ../man-db-2.4.3-section.dif
|
|
|
|
|
+patch -p0 -s --suffix=.secu2 < ../man-db-2.4.1-security2.dif
|
|
|
|
|
+patch -p0 -s --suffix=.secu4 < ../man-db-2.4.1-security4.dif
|
2007-04-17 12:54:22 +02:00
|
|
|
|
+patch -p0 -s --suffix=.064250 < ../man-db-2.4.3-CVE-2006-4250.dif
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- GNUmakefile.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ GNUmakefile.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -35,7 +35,7 @@
|
|
|
|
|
# Make targets are: #
|
|
|
|
|
# #
|
|
|
|
|
# all install uninstall mostlyclean clean distclean realclean TAGS ID #
|
|
|
|
|
-# FILES lib src man intl libdb zsoelim update RCS dist #
|
|
|
|
|
+# FILES lib src man libdb zsoelim update RCS dist #
|
|
|
|
|
#------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
|
|
srcdir = @srcdir@
|
|
|
|
|
@@ -51,9 +51,9 @@ USE_NLS = @USE_NLS@
|
|
|
|
|
# GNUmakefile and include/Defines are automatic targets, don't add below.
|
|
|
|
|
INCLUDES := config.h $(addprefix include/, manconfig.h comp_src.h)
|
|
|
|
|
CONF = src/man_db.conf
|
|
|
|
|
-EVERYTHING = lib intl libdb src zsoelim man po
|
|
|
|
|
-ALL = lib intl libdb src zsoelim man po
|
|
|
|
|
-INSTALL = src zsoelim man intl po
|
|
|
|
|
+EVERYTHING = lib libdb src zsoelim man po
|
|
|
|
|
+ALL = lib libdb src zsoelim man po
|
|
|
|
|
+INSTALL = src zsoelim man po
|
|
|
|
|
|
|
|
|
|
include include/Defines
|
|
|
|
|
|
|
|
|
|
@@ -162,7 +162,7 @@ __TAGS:
|
|
|
|
|
install: $(INCLUDES) $(CONF)
|
|
|
|
|
|
|
|
|
|
install uninstall:
|
|
|
|
|
- for i in $(INSTALL); do $(MAKE) prefix=$(prefix) -C $$i $@; done
|
|
|
|
|
+ for i in $(INSTALL); do $(MAKE) prefix=$(prefix) DESTDIR=$(DESTDIR) -C $$i $@; done
|
|
|
|
|
|
|
|
|
|
TAGS realclean distclean mostlyclean clean:
|
|
|
|
|
for i in $(EVERYTHING); do $(MAKE) prefix=$(prefix) -C $$i $@ clean=yes; done
|
|
|
|
|
@@ -220,7 +220,6 @@ dist: update
|
|
|
|
|
for file in $(FILES); do \
|
|
|
|
|
cp -p $(srcdir)/$$file $(man_db)/$$file; \
|
|
|
|
|
done
|
|
|
|
|
- $(MAKE) -C intl dist
|
|
|
|
|
# Maintainers may wish to run 'make -C po update-po' beforehand.
|
|
|
|
|
# This is not done automatically, since the .po files are stored
|
|
|
|
|
# in revision control.
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- Makefile.Linux
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ Makefile.Linux 2007-02-15 00:00:00.000000000 +0100
|
2007-02-09 16:58:14 +01:00
|
|
|
|
@@ -0,0 +1,75 @@
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+#
|
|
|
|
|
+#
|
|
|
|
|
+#
|
|
|
|
|
+# Makefile.Linux to integrate package into source tree of SuSE Linux.
|
|
|
|
|
+#
|
|
|
|
|
+# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany.
|
|
|
|
|
+#
|
|
|
|
|
+# please send bugfixes or comments to feedback@suse.de.
|
|
|
|
|
+#
|
|
|
|
|
+#
|
|
|
|
|
+
|
|
|
|
|
+ARCH = $(shell uname -m | sed 's@\(i\)[34567]\(86\)@\13\2@')
|
2007-02-09 16:58:14 +01:00
|
|
|
|
+ID = $(shell id -u)
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+CFLAGS = $(RPM_OPT_FLAGS) -funroll-loops -pipe \
|
|
|
|
|
+ -D_GNU_SOURCE -D_SVID_SOURCE -Wall
|
|
|
|
|
+MANDIR = /usr/share/man
|
|
|
|
|
+SYSCONFDIR = /etc
|
|
|
|
|
+export DESTDIR
|
|
|
|
|
+
|
|
|
|
|
+flags = CFLAGS="$(CFLAGS)" LDFLAGS= LIBS=
|
|
|
|
|
+
|
|
|
|
|
+GNUmakefile config.cache:
|
|
|
|
|
+ aclocal
|
|
|
|
|
+ autoconf
|
|
|
|
|
+ $(flags) sh configure --prefix=/usr --enable-dups \
|
|
|
|
|
+ --enable-setuid=man --with-device=latin1 \
|
|
|
|
|
+ --mandir=$(MANDIR) \
|
|
|
|
|
+ --with-zio \
|
|
|
|
|
+ --with-gnu-ld \
|
|
|
|
|
+ --disable-rpath \
|
|
|
|
|
+ --enable-mb-groff \
|
|
|
|
|
+ --with-db=gdbm \
|
|
|
|
|
+ --enable-nls \
|
|
|
|
|
+ --with-config-file=$(SYSCONFDIR)/manpath.config \
|
|
|
|
|
+ --without-included-gettext
|
|
|
|
|
+
|
|
|
|
|
+compile: GNUmakefile
|
|
|
|
|
+ make nls=all $(flags)
|
|
|
|
|
+
|
|
|
|
|
+install:
|
|
|
|
|
+ mkdir -p $(DESTDIR)/usr/lib/man-db
|
|
|
|
|
+ mkdir -p $(DESTDIR)/usr/bin
|
2007-02-09 16:58:14 +01:00
|
|
|
|
+ mkdir -p $(DESTDIR)/etc
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+ make nls=all install $(flags) DESTDIR=$(DESTDIR)
|
|
|
|
|
+ { \
|
|
|
|
|
+ if test -x $(DESTDIR)/usr/bin/wrapper ; then \
|
|
|
|
|
+ rm -f $(DESTDIR)/usr/bin/mandb; \
|
|
|
|
|
+ rm -f $(DESTDIR)/usr/bin/man; \
|
|
|
|
|
+ mv $(DESTDIR)/usr/bin/wrapper $(DESTDIR)/usr/bin/mandb; \
|
|
|
|
|
+ ln -sf mandb $(DESTDIR)/usr/bin/man; \
|
|
|
|
|
+ fi; \
|
2007-02-09 16:58:14 +01:00
|
|
|
|
+ if test $(ID) -eq 0 ; then \
|
|
|
|
|
+ chown root.root $(DESTDIR)/usr/bin/mandb $(DESTDIR)/usr/bin/man; \
|
|
|
|
|
+ chmod 4711 $(DESTDIR)/usr/bin/mandb $(DESTDIR)/usr/bin/man; \
|
|
|
|
|
+ chown root.root $(DESTDIR)/usr/lib/man-db/*; \
|
|
|
|
|
+ chmod 0711 $(DESTDIR)/usr/lib/man-db/*; \
|
|
|
|
|
+ fi; \
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+ }
|
|
|
|
|
+ { \
|
|
|
|
|
+ mkdir -p $(DESTDIR)/usr/share/man ; \
|
|
|
|
|
+ cd $(DESTDIR)/usr/share/man ; \
|
|
|
|
|
+ rm -rf *.ascii/ ; \
|
|
|
|
|
+ for d in *.88591 *.eucJP ; do \
|
|
|
|
|
+ mkdir -p $${d%_*} ; \
|
|
|
|
|
+ (cd $${d}/ > /dev/null ; tar cfps - * ) | tar xfC - $${d%_*} ; \
|
|
|
|
|
+ rm -rf $${d}/ ; \
|
|
|
|
|
+ done ; \
|
|
|
|
|
+ find -name '*.[1-9nlop]' | xargs gzip -9f ; \
|
|
|
|
|
+ for d in `find -name manpath.5.gz -printf '%h '` ; do \
|
|
|
|
|
+ ln -sf manpath.5.gz $$d/manpath.config.5.gz ; \
|
|
|
|
|
+ done; \
|
|
|
|
|
+ }
|
|
|
|
|
+ install -m 644 src/man_db.conf $(DESTDIR)/etc/manpath.config
|
|
|
|
|
+ sh ./mk_catdirs $(DESTDIR)
|
|
|
|
|
+
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- config.h.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ config.h.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -380,6 +380,9 @@
|
|
|
|
|
/* Define to 1 if `vfork' works. */
|
|
|
|
|
#undef HAVE_WORKING_VFORK
|
|
|
|
|
|
|
|
|
|
+/* Define to 1 if you have libzio for opening compressed manuals */
|
|
|
|
|
+#undef HAVE_ZIO
|
|
|
|
|
+
|
|
|
|
|
/* Define to 1 if you have the `__argz_count' function. */
|
|
|
|
|
#undef HAVE___ARGZ_COUNT
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- configure.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ configure.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -10,6 +10,18 @@ AC_CONFIG_HEADER(config.h)
|
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
|
AC_ARG_PROGRAM
|
|
|
|
|
dnl
|
|
|
|
|
+dnl Check $PATH for the following progs and append suitable options.
|
|
|
|
|
+dnl
|
|
|
|
|
+AC_PROG_CC
|
|
|
|
|
+AC_PROG_CPP
|
|
|
|
|
+AC_GNU_SOURCE
|
|
|
|
|
+dnl
|
|
|
|
|
+dnl check for system defaults
|
|
|
|
|
+dnl
|
|
|
|
|
+AC_AIX
|
|
|
|
|
+AC_MINIX
|
|
|
|
|
+AC_ISC_POSIX
|
|
|
|
|
+dnl
|
|
|
|
|
dnl Define below date and version information to be put into man pages etc.
|
|
|
|
|
dnl
|
|
|
|
|
datemark=20050703
|
|
|
|
|
@@ -97,6 +109,18 @@ AC_ARG_WITH(config-file,
|
|
|
|
|
config_file=$withval
|
|
|
|
|
fi],
|
|
|
|
|
: ${config_file=\$\{sysconfdir\}/man_db.conf})
|
|
|
|
|
+AC_ARG_WITH(zio,
|
|
|
|
|
+[ --with-zio=LIBRARY use zlib/libbz2 wrapper library LIBRARY (libzio)],
|
|
|
|
|
+ [if test -z "$withval" -o "$withval" = "yes"
|
|
|
|
|
+ then
|
|
|
|
|
+ zio=libzio
|
|
|
|
|
+ elif test "$withval" = "no"
|
|
|
|
|
+ then
|
|
|
|
|
+ AC_MSG_ERROR(--with-zio requires an argument)
|
|
|
|
|
+ else
|
|
|
|
|
+ zio=$withval
|
|
|
|
|
+ fi],
|
|
|
|
|
+ : ${zio=no})
|
|
|
|
|
dnl
|
|
|
|
|
dnl Finish the argument parsing
|
|
|
|
|
dnl
|
|
|
|
|
@@ -115,10 +139,10 @@ fi
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
|
AC_PROG_RANLIB
|
|
|
|
|
AC_PATH_PROG(cat, cat)
|
|
|
|
|
-AC_PATH_PROG(lynx, lynx)
|
|
|
|
|
+AC_PATH_PROG(lynx, lynx, /usr/bin/lynx)
|
|
|
|
|
AC_PATH_PROG(tr, tr)
|
|
|
|
|
AC_PATH_PROG(grep, grep)
|
|
|
|
|
-AC_PATH_PROGS(pager, pager less more)
|
|
|
|
|
+AC_PATH_PROGS(pager, less more)
|
|
|
|
|
test -n "$pager" && pager="$pager -s"
|
|
|
|
|
dnl
|
|
|
|
|
dnl define below (in list of preference) *roff macros to check for.
|
|
|
|
|
@@ -214,6 +238,14 @@ else
|
|
|
|
|
fi
|
|
|
|
|
dnl
|
|
|
|
|
AC_PATH_PROGS(eqn, eqn geqn)
|
|
|
|
|
+AC_PATH_PROG(geqn, geqn)
|
|
|
|
|
+dnl
|
|
|
|
|
+dnl if geqn is found and geqn is identical with eqn we use a GNU eqn
|
|
|
|
|
+dnl which its self can use -Tlatin1
|
|
|
|
|
+dnl
|
|
|
|
|
+if test -n "$geqn" -a -n "$eqn" ; then
|
|
|
|
|
+ test $geqn -ef $eqn && neqn="$eqn $nroff_device"
|
|
|
|
|
+fi
|
|
|
|
|
AC_PATH_PROGS(neqn, neqn gneqn)
|
|
|
|
|
dnl
|
|
|
|
|
dnl if we fail to find an neqn, use eqn and try to force it to output
|
|
|
|
|
@@ -242,10 +274,16 @@ then
|
|
|
|
|
decompressor="$gunzip"
|
|
|
|
|
fi
|
|
|
|
|
AC_PATH_PROG(compress, compress)
|
|
|
|
|
-if test -n "$compress"
|
|
|
|
|
+if test -n "$compress" || test -n "$gzip"
|
|
|
|
|
then
|
|
|
|
|
AC_DEFINE(HAVE_COMPRESS, 1, [Define if you have compress.])
|
|
|
|
|
- uncompress="$compress -dc"
|
|
|
|
|
+ if test -n "$gzip"
|
|
|
|
|
+ then
|
|
|
|
|
+ uncompress="$gzip -dc"
|
|
|
|
|
+ elif test -n "$compress"
|
|
|
|
|
+ then
|
|
|
|
|
+ uncompress="$compress -dc"
|
|
|
|
|
+ fi
|
|
|
|
|
if test -z "$gzip"
|
|
|
|
|
then
|
|
|
|
|
compressor="$compress -c"
|
|
|
|
|
@@ -299,9 +337,6 @@ AC_ARG_ENABLE(mandirs,
|
|
|
|
|
dnl
|
|
|
|
|
dnl check for various header files and associated libraries.
|
|
|
|
|
dnl
|
|
|
|
|
-AC_AIX
|
|
|
|
|
-AC_MINIX
|
|
|
|
|
-AC_ISC_POSIX
|
|
|
|
|
dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
|
|
|
|
|
AC_PROG_LEX
|
|
|
|
|
AC_HEADER_STDC
|
|
|
|
|
@@ -313,7 +348,7 @@ dnl
|
|
|
|
|
dnl Internationalization support.
|
|
|
|
|
dnl
|
|
|
|
|
AM_GNU_GETTEXT
|
|
|
|
|
-AM_GNU_GETTEXT_VERSION(0.12.1)
|
|
|
|
|
+AM_GNU_GETTEXT_VERSION([0.15])
|
|
|
|
|
AC_SUBST(LINGUAS)dnl
|
|
|
|
|
dnl
|
|
|
|
|
dnl Checks for structures and compiler characteristics.
|
|
|
|
|
@@ -336,6 +371,30 @@ MAN_FUNC_ANSI_SPRINTF
|
|
|
|
|
MAN_FUNC_PCLOSE
|
|
|
|
|
MAN_FUNC_STRSIGNAL
|
|
|
|
|
dnl
|
|
|
|
|
+dnl Check for zlib and libbz2 libraries to use this together
|
|
|
|
|
+dnl with SuSE's libzio to open compressed info files.
|
|
|
|
|
+dnl
|
|
|
|
|
+if test "$zio" = "no" || test -n "$zio"
|
|
|
|
|
+then
|
|
|
|
|
+ AC_CHECK_HEADER(zlib.h,[
|
|
|
|
|
+ for lib in z gz
|
|
|
|
|
+ do
|
|
|
|
|
+ AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break])
|
|
|
|
|
+ done])
|
|
|
|
|
+ AC_CHECK_HEADER(bzlib.h,[
|
|
|
|
|
+ for lib in bz2 bzip2
|
|
|
|
|
+ do
|
|
|
|
|
+ AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break])
|
|
|
|
|
+ done])
|
|
|
|
|
+ AC_CHECK_HEADER(zio.h,[
|
|
|
|
|
+ for lib in ${zio#lib} zio
|
|
|
|
|
+ do
|
|
|
|
|
+ AC_CHECK_LIB($lib, fzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib"
|
|
|
|
|
+ AC_DEFINE([COMP_SRC],[],[])
|
|
|
|
|
+ AC_DEFINE([HAVE_ZIO],[],[])])
|
|
|
|
|
+ done])
|
|
|
|
|
+fi
|
|
|
|
|
+dnl
|
|
|
|
|
dnl Find a suitable database interface header and library
|
|
|
|
|
dnl
|
|
|
|
|
dnl Check for Berkeley db routines (first version API)
|
|
|
|
|
@@ -492,7 +551,6 @@ AC_CONFIG_FILES(GNUmakefile
|
|
|
|
|
include/Defines
|
|
|
|
|
include/comp_src.h
|
|
|
|
|
include/manconfig.h
|
|
|
|
|
- intl/Makefile
|
|
|
|
|
po/Makefile.in)
|
|
|
|
|
AC_OUTPUT
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- mk_catdirs
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ mk_catdirs 2007-02-15 13:13:18.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -0,0 +1,24 @@
|
|
|
|
|
+#!/bin/sh
|
|
|
|
|
+
|
|
|
|
|
+OLDPWD="`pwd`"
|
|
|
|
|
+CACHE="$1/var/cache/man"
|
|
|
|
|
+
|
|
|
|
|
+ cats="cat{0,1,2,3,4,5,6,7,8,9,n}"
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+locale="{ca,cs,da,de,en,es,et,fi,fr,ga,hu,is,it,ja,ko,nl,no,pl,pt,ru,sk,sr,sv,uk}"
|
|
|
|
|
+ dirs="{local,opt}"
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+
|
|
|
|
|
+umask 022
|
|
|
|
|
+test -d ${CACHE} && rm -rf ${CACHE}
|
|
|
|
|
+mkdir -p ${CACHE}
|
|
|
|
|
+
|
|
|
|
|
+cd ${CACHE}
|
|
|
|
|
+eval echo ${cats} \
|
|
|
|
|
+ ${locale}/${cats} \
|
|
|
|
|
+ ${dirs}/${cats} \
|
|
|
|
|
+ ${dirs}/${locale}/${cats} \
|
|
|
|
|
+ | xargs mkdir -p
|
|
|
|
|
+sync
|
|
|
|
|
+cd ${OLDPWD}
|
|
|
|
|
+
|
2007-02-09 16:58:14 +01:00
|
|
|
|
+test "$(id -u)" -ne 0 || chown man:daemon -R ${CACHE}
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- include/Defines.in
|
|
|
|
|
+++ include/Defines.in 2007-02-09 12:58:18.000000000 +0100
|
|
|
|
|
@@ -97,7 +97,11 @@ DEFAULT_TARGETS = TAGS all install unins
|
|
|
|
|
debug = @debug@
|
|
|
|
|
date = @date@
|
|
|
|
|
version = @VERSION@
|
|
|
|
|
+ifeq ($(shell id -u),0)
|
|
|
|
|
man_install_flags = @man_install_flags@
|
|
|
|
|
+else
|
|
|
|
|
+man_install_flags = -m 0755
|
|
|
|
|
+endif
|
|
|
|
|
|
|
|
|
|
# some path definitions required by the manpage Makefile...
|
|
|
|
|
pager="@pager@"
|
|
|
|
|
--- include/comp_src.h.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ include/comp_src.h.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -53,7 +53,7 @@ struct compression comp_list[] = {
|
|
|
|
|
#endif /* HAVE_GZIP */
|
|
|
|
|
|
|
|
|
|
/* If we have compress, incorporate the following */
|
|
|
|
|
-#ifdef HAVE_COMPRESS
|
|
|
|
|
+#if defined(HAVE_COMPRESS) || defined(HAVE_GZIP)
|
|
|
|
|
{UNCOMPRESS, "Z", NULL},
|
|
|
|
|
#endif /* HAVE_COMPRESS */
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- include/manconfig.h.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ include/manconfig.h.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -68,7 +68,7 @@
|
|
|
|
|
MAN_DB_UPDATES - to allow man to update databases
|
|
|
|
|
MAN_CATS - to allow man to create/update cat files */
|
|
|
|
|
|
|
|
|
|
-#define MAN_DB_CREATES
|
|
|
|
|
+/* #define MAN_DB_CREATES */
|
|
|
|
|
#define MAN_DB_UPDATES
|
|
|
|
|
#define MAN_CATS
|
|
|
|
|
|
|
|
|
|
@@ -134,6 +134,8 @@
|
|
|
|
|
#ifndef NROFF_MISSING
|
|
|
|
|
# ifndef NROFF
|
|
|
|
|
# define NROFF "@nroff@"
|
|
|
|
|
+# undef NROFF
|
|
|
|
|
+# define NROFF "/usr/bin/nroff -mandocdb"
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
@@ -238,8 +240,12 @@
|
|
|
|
|
#ifdef inline
|
|
|
|
|
/* autoconf #defines inline to be either "__inline", "__inline__"
|
|
|
|
|
or "" if the compiler doesn't like inline */
|
|
|
|
|
-# define __inline__ inline
|
|
|
|
|
-# define __inline inline
|
|
|
|
|
+# ifndef __inline__
|
|
|
|
|
+# define __inline__ inline
|
|
|
|
|
+# endif
|
|
|
|
|
+# ifndef __inline
|
|
|
|
|
+# define __inline inline
|
|
|
|
|
+# endif
|
|
|
|
|
#endif /* inline */
|
|
|
|
|
|
|
|
|
|
/* my gcc specs file is hacked to define __profile__ if I compile with
|
|
|
|
|
@@ -307,14 +313,17 @@ extern struct compression *comp_file (co
|
|
|
|
|
extern char *decompress (const char *filename, const struct compression *comp);
|
|
|
|
|
extern __inline__ void remove_ztemp (void);
|
|
|
|
|
extern __inline__ char *get_ztemp (void);
|
|
|
|
|
+extern __inline__ void set_wbuf(const char* whatis);
|
|
|
|
|
+extern __inline__ char *get_wbuf(void);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
/* straycats.c */
|
|
|
|
|
extern int straycats (char *mandir);
|
|
|
|
|
|
|
|
|
|
/* lexgrog.l */
|
|
|
|
|
struct lexgrog;
|
|
|
|
|
-extern int find_name (const char *file, const char *filename,
|
|
|
|
|
- struct lexgrog *p_lg);
|
|
|
|
|
+extern int find_name (const char *file, const char *filename, struct lexgrog *p_lg);
|
|
|
|
|
+extern int find_name_str(char *buffer, const char *filename, struct lexgrog *p_lg);
|
|
|
|
|
|
|
|
|
|
/* util.c */
|
|
|
|
|
struct pipeline;
|
|
|
|
|
@@ -327,11 +336,17 @@ extern int remove_directory (const char
|
|
|
|
|
extern char *trim_spaces (const char *s);
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_BASENAME
|
|
|
|
|
-extern char *basename ();
|
|
|
|
|
+# ifndef _STRING_H
|
|
|
|
|
+# include <string.h>
|
|
|
|
|
+# endif
|
|
|
|
|
#endif /* HAVE_BASENAME */
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_STRSEP
|
|
|
|
|
extern char *strsep (char **stringp, const char *delim);
|
|
|
|
|
+#else
|
|
|
|
|
+# ifndef _STRING_H
|
|
|
|
|
+# include <string.h>
|
|
|
|
|
+# endif
|
|
|
|
|
#endif /* !HAVE_STRSEP */
|
|
|
|
|
|
|
|
|
|
#ifndef HAVE_GETCWD
|
|
|
|
|
@@ -356,7 +371,6 @@ extern char *program_name; /* the basena
|
|
|
|
|
#define FAIL 1 /* usage or syntax error */
|
|
|
|
|
#define FATAL 2 /* operational error */
|
|
|
|
|
#define CHILD_FAIL 3 /* child failed */
|
|
|
|
|
-#define INTERRUPTED 4 /* Interrupted by signal */
|
|
|
|
|
#define NOT_FOUND 16 /* No action was taken */
|
|
|
|
|
|
|
|
|
|
/* System or user catpaths? Allow bitwise disjunctions of these. */
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- intl/Makefile.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ intl/Makefile.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -133,7 +133,7 @@ COPYING.LIB-2 gettext.h libgettext.h plu
|
|
|
|
|
|
|
|
|
|
all: all-@USE_INCLUDED_LIBINTL@
|
|
|
|
|
all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed
|
|
|
|
|
-all-no: all-no-@BUILD_INCLUDED_LIBINTL@
|
|
|
|
|
+all-no: all-no-@USE_INCLUDED_LIBINTL@
|
|
|
|
|
all-no-yes: libgnuintl.$la
|
|
|
|
|
all-no-no:
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- lib/basename.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ lib/basename.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -37,11 +37,13 @@
|
|
|
|
|
extern char *strrchr();
|
|
|
|
|
#endif /* STDC_HEADERS */
|
|
|
|
|
|
|
|
|
|
+#ifndef HAVE_BASENAME
|
|
|
|
|
/* return basename of given filename */
|
|
|
|
|
-char *basename(char *filename)
|
|
|
|
|
+char *basename(const char *filename)
|
|
|
|
|
{
|
|
|
|
|
char *base;
|
|
|
|
|
|
|
|
|
|
base = strrchr(filename, '/');
|
|
|
|
|
return base ? base + 1 : filename;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- lib/cleanup.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ lib/cleanup.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -101,7 +101,7 @@ trap_signal (int signo, struct sigaction
|
|
|
|
|
|
|
|
|
|
act.sa_handler = sighandler;
|
|
|
|
|
sigemptyset (&act.sa_mask);
|
|
|
|
|
- act.sa_flags = 0;
|
|
|
|
|
+ act.sa_flags = SA_ONESHOT;
|
|
|
|
|
return sigaction (signo, &act, oldact);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- lib/xmalloc.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ lib/xmalloc.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -43,6 +43,8 @@ extern void error (int, int, const char
|
|
|
|
|
extern void error ();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#include "manconfig.h"
|
|
|
|
|
+
|
|
|
|
|
static void *
|
|
|
|
|
fixup_null_alloc (size_t n)
|
|
|
|
|
{
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- libdb/Makefile.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ libdb/Makefile.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -34,10 +34,7 @@ include $(top_srcdir)/include/Defines
|
|
|
|
|
.PHONY: $(DEFAULT_TARGETS)
|
|
|
|
|
|
|
|
|
|
MANDEFS =
|
|
|
|
|
-MANCPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir) -I-
|
|
|
|
|
-ifeq ($(USE_NLS),yes)
|
|
|
|
|
-MANCPPFLAGS += -I$(top_srcdir)/intl
|
|
|
|
|
-endif
|
|
|
|
|
+MANCPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir)
|
|
|
|
|
|
|
|
|
|
# The default programs to build
|
|
|
|
|
ALL = db_store.o db_delete.o db_lookup.o \
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- libdb/mydbm.h
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ libdb/mydbm.h 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -144,7 +144,7 @@ extern __inline__ int btree_nextkeydata(
|
|
|
|
|
# define DB_EXT ".bt"
|
|
|
|
|
# define MYDBM_FILE DB*
|
|
|
|
|
# define MYDBM_CTRWOPEN(file) btree_flopen(file, O_TRUNC|O_CREAT|O_RDWR, DBMODE)
|
|
|
|
|
-# define MYDBM_CRWOPEN(file) btree_flopen(file, O_CREAT|O_RDWR, DBMODE)
|
|
|
|
|
+# define MYDBM_CRWOPEN(file) btree_flopen(file, O_CREAT|O_RDWR, DBMODE)
|
|
|
|
|
# define MYDBM_RWOPEN(file) btree_flopen(file, O_RDWR, DBMODE)
|
|
|
|
|
# define MYDBM_RDOPEN(file) btree_flopen(file, O_RDONLY, DBMODE)
|
|
|
|
|
# define MYDBM_INSERT(dbf, key, cont) btree_insert(dbf, key, cont)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- man/de_DE.88591/man1/man.man1
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ man/de_DE.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -98,6 +98,7 @@ der Manualseiten gefolgt vom Typ der dor
|
|
|
|
|
.TS
|
|
|
|
|
tab (@);
|
|
|
|
|
l l.
|
|
|
|
|
+0@Dateiheader (gew<65>hnlich in \fI/usr/include\fR)
|
|
|
|
|
1@Ausf<73>hrbare Programme oder Shellbefehle
|
|
|
|
|
2@Systemaufrufe (Kernelfunktionen)
|
|
|
|
|
3@Bibliotheksaufrufe (Funktionen in System-Bibliotheken)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- man/es_ES.88591/man1/man.man1
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ man/es_ES.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -101,6 +101,7 @@ del manual y los tipos de p<>ginas que co
|
|
|
|
|
.TS
|
|
|
|
|
tab (@);
|
|
|
|
|
l l.
|
|
|
|
|
+0@Ficheros (se encuentran generalmente en \fI/usr/include\fR)
|
|
|
|
|
1@Programas ejecutables y guiones del int<6E>rprete de
|
|
|
|
|
@<40>rdenes
|
|
|
|
|
2@Llamadas del sistema (funciones servidas por el n<>cleo)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- man/it_IT.88591/man1/man.man1
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ man/it_IT.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -104,6 +104,7 @@ del manuale seguiti dai tipi di pagine c
|
|
|
|
|
.TS
|
|
|
|
|
tab (@);
|
|
|
|
|
l l.
|
|
|
|
|
+0@File (di solito trovabili in \fI/usr/include\fR)
|
|
|
|
|
1@Programmi eseguibili e comandi della shell
|
|
|
|
|
2@Chiamate al sistema (funzioni fornite dal kernel)
|
|
|
|
|
3@Chiamate alle librerie (funzioni all'interno delle
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- man/ja_JP.eucJP/man1/man.man1
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ man/ja_JP.eucJP/man1/man.man1 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -104,6 +104,7 @@
|
|
|
|
|
.TS
|
|
|
|
|
tab (@);
|
|
|
|
|
l l.
|
|
|
|
|
+0@
|
|
|
|
|
1@<40>¹ԥץ<D4A5><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4>ϥ<EFBFBD><CFA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><CEA5>ޥ<EFBFBD><DEA5><EFBFBD>
|
|
|
|
|
2@<40><><EFBFBD><EFBFBD><EFBFBD>ƥॳ<C6A5><E0A5B3><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD>ͥ뤬<CDA5><EFBFBD><F3B6A1A4><EFBFBD><EFBFBD>ؿ<EFBFBD>)
|
|
|
|
|
3@<40>饤<EFBFBD>֥<EFBFBD><D6A5>ꥳ<EFBFBD><EAA5B3><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>饤<EFBFBD>֥<EFBFBD><D6A5><EFBFBD><EFBFBD>˴ޤޤ<DEA4><DEA4><EFBFBD><EFBFBD>ؿ<EFBFBD>)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- man/man1/man.man1
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ man/man1/man.man1 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -110,6 +110,7 @@ numbers of the manual followed by the ty
|
|
|
|
|
.TS
|
|
|
|
|
tab (@);
|
|
|
|
|
l l.
|
|
|
|
|
+0@Header files (usually found in \fI/usr/include\fR)
|
|
|
|
|
1@Executable programs or shell commands
|
|
|
|
|
2@System calls (functions provided by the kernel)
|
|
|
|
|
3@Library calls (functions within program libraries)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/Makefile.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/Makefile.in 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -40,7 +40,7 @@ include ../include/Defines
|
|
|
|
|
|
|
|
|
|
MANDEFS = -DCONFIG_FILE=\"$(config_file)\" \
|
|
|
|
|
-DLOCALEDIR=\"$(gnulocaledir)\" $(DEFS_$(subst /,_,$@))
|
|
|
|
|
-MANCPPFLAGS = -I../include -I$(top_srcdir) -I$(srcdir) -I- -I../intl
|
|
|
|
|
+MANCPPFLAGS = -I../include -I$(top_srcdir) -I$(srcdir) -I.
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------#
|
|
|
|
|
# user changeable definitions can be found in ../include/Defines #
|
|
|
|
|
@@ -117,7 +117,7 @@ apropos: whatis.c
|
|
|
|
|
|
|
|
|
|
# Rules to test code as program unit
|
|
|
|
|
lexgrog: lexgrog.c compression.o fake_security.o ult_src.o util.o
|
|
|
|
|
- $(LINK.c) -DTEST $^ $(LDLIBS) -o $@
|
|
|
|
|
+ $(LINK.c) -g -DTEST $^ $(LDLIBS) -o $@
|
|
|
|
|
|
|
|
|
|
globbing: globbing.c util.o
|
|
|
|
|
$(LINK.c) -DTEST $^ $(LDLIBS) -o $@
|
|
|
|
|
@@ -126,8 +126,10 @@ globbing: globbing.c util.o
|
|
|
|
|
install:
|
|
|
|
|
$(MKINSTALLDIRS) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \
|
|
|
|
|
$(DESTDIR)$(libdir)/man-db
|
|
|
|
|
- $(INSTALL_PROGRAM) $(man_install_flags) man $(DESTDIR)$(bindir)/$(man)
|
|
|
|
|
- $(INSTALL_PROGRAM) $(man_install_flags) mandb $(DESTDIR)$(bindir)/$(mandb)
|
|
|
|
|
+ $(INSTALL_PROGRAM) $(man_install_flags) man $(DESTDIR)$(libdir)/man-db/$(man)
|
|
|
|
|
+ $(INSTALL_PROGRAM) $(man_install_flags) mandb $(DESTDIR)$(libdir)/man-db/$(mandb)
|
|
|
|
|
+ $(INSTALL_PROGRAM) $(man_install_flags) wrapper $(DESTDIR)$(bindir)/$(mandb)
|
|
|
|
|
+ ln -f $(DESTDIR)$(bindir)/$(mandb) $(DESTDIR)$(bindir)/$(man)
|
|
|
|
|
$(INSTALL_PROGRAM) manpath $(DESTDIR)$(bindir)/$(manpath)
|
|
|
|
|
$(INSTALL_PROGRAM) catman $(DESTDIR)$(bindir)/$(catman)
|
|
|
|
|
$(INSTALL_PROGRAM) whatis $(DESTDIR)$(bindir)/$(whatis)
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/check_mandirs.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/check_mandirs.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -161,7 +161,7 @@ void test_manfile (const char *file, con
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* see if we already have it, before going any further, this will
|
|
|
|
|
- save both an ult_src() a find_name(), amongst other time wastes */
|
|
|
|
|
+ save both an ult_src() a find_name()/find_name_str(), amongst other time wastes */
|
|
|
|
|
exists = dblookup_exact (base_name, info.ext, 1);
|
|
|
|
|
|
|
|
|
|
/* Ensure we really have the actual page. Gzip keeps the mtime
|
|
|
|
|
@@ -236,13 +236,20 @@ void test_manfile (const char *file, con
|
|
|
|
|
'.so manx/foo.x', which will give us an unobtainable
|
|
|
|
|
whatis for the entry. */
|
|
|
|
|
ult = ult_src (file, path, &buf,
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ SO_LINK | SOFT_LINK | HARD_LINK | WHATISBUF);
|
|
|
|
|
+#else /* !COMP_SRC || !HAVE_ZIO */
|
|
|
|
|
SO_LINK | SOFT_LINK | HARD_LINK);
|
|
|
|
|
+#endif /* !COMP_SRC || !HAVE_ZIO */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ult) {
|
|
|
|
|
error (0, 0,
|
|
|
|
|
_("warning: %s: bad symlink or ROFF `.so' request"),
|
|
|
|
|
file);
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ set_wbuf(NULL); /* get rid of temp buffer */
|
|
|
|
|
+#endif /* COMP_SRC && HAVE_ZIO */
|
|
|
|
|
free (manpage);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -256,7 +263,7 @@ void test_manfile (const char *file, con
|
|
|
|
|
|
|
|
|
|
/* Ok, here goes: Use a hash tree to store the ult_srcs with
|
|
|
|
|
* their whatis. Anytime after, check the hash tree, if it's there,
|
|
|
|
|
- * use it. This saves us a find_name() which is a real hog.
|
|
|
|
|
+ * use it. This saves us a find_name()/find_name_str() which is a real hog.
|
|
|
|
|
*
|
|
|
|
|
* Use the full path in ult as the hash key so we don't have to
|
|
|
|
|
* clear the hash between calls.
|
|
|
|
|
@@ -268,21 +275,38 @@ void test_manfile (const char *file, con
|
|
|
|
|
/* go get the whatis info in its raw state */
|
|
|
|
|
char *file_copy = xstrdup (file);
|
|
|
|
|
#ifdef COMP_SRC
|
|
|
|
|
+# ifdef HAVE_ZIO
|
|
|
|
|
+ /* if the nroff was compressed, an uncompressed copy is
|
|
|
|
|
+ shown by a call to get_wbuf(), grog this for a whatis
|
|
|
|
|
+ rather than ult. This is a bit difficult to follow, sorry:
|
|
|
|
|
+ ult_src() will leave a buffer with the head of the last
|
|
|
|
|
+ uncompressed nroff file it has to deal with in get_wbuf() */
|
|
|
|
|
+# else
|
|
|
|
|
/* if the nroff was compressed, an uncompressed version is
|
|
|
|
|
shown by a call to get_ztemp(), grog this for a whatis
|
|
|
|
|
rather than ult. This is a bit difficult to follow, sorry:
|
|
|
|
|
ult_src() will leave the last uncompressed nroff file it
|
|
|
|
|
has to deal with in get_ztemp() */
|
|
|
|
|
+# endif
|
|
|
|
|
char *ztemp;
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
|
|
|
|
|
lg.type = MANPAGE;
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
#ifdef COMP_SRC
|
|
|
|
|
+# ifdef HAVE_ZIO
|
|
|
|
|
+ ztemp = get_wbuf ();
|
|
|
|
|
+# else
|
|
|
|
|
ztemp = get_ztemp ();
|
|
|
|
|
+# endif
|
|
|
|
|
if (ztemp) {
|
|
|
|
|
+# ifdef HAVE_ZIO
|
|
|
|
|
+ find_name_str (ztemp, basename ((char*)file), &lg);
|
|
|
|
|
+ set_wbuf(NULL); /* get rid of temp file identifier */
|
|
|
|
|
+# else
|
|
|
|
|
find_name (ztemp, basename (file_copy), &lg);
|
|
|
|
|
remove_ztemp (); /* get rid of temp file identifier */
|
|
|
|
|
+# endif
|
|
|
|
|
} else
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
find_name (ult, basename (file_copy), &lg);
|
|
|
|
|
@@ -415,10 +439,10 @@ static short testmandirs (const char *pa
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!quiet) {
|
|
|
|
|
- fprintf (stderr, "\r");
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
_("Updating index cache for path "
|
|
|
|
|
"`%s/%s'. Wait..."), path, mandir->d_name);
|
|
|
|
|
+ putc ('\n', stderr);
|
|
|
|
|
}
|
|
|
|
|
add_dir_entries (path, mandir->d_name);
|
|
|
|
|
MYDBM_CLOSE (dbf);
|
|
|
|
|
@@ -576,7 +600,7 @@ short update_db (const char *manpath)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (debug)
|
|
|
|
|
- fprintf (stderr, "failed to open %s O_RDONLY\n", database);
|
|
|
|
|
+ fprintf (stderr, "failed to open database %s O_RDONLY\n", database);
|
|
|
|
|
|
|
|
|
|
return EOF;
|
|
|
|
|
}
|
|
|
|
|
@@ -762,6 +786,7 @@ static short purge_whatis (const char *p
|
|
|
|
|
name, info->ext);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
+ return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check that multi keys are correctly constructed. */
|
|
|
|
|
@@ -822,6 +847,11 @@ short purge_missing (const char *manpath
|
|
|
|
|
gripe_rwopen_failed (database);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
+ if (dbver_rd (dbf)) {
|
|
|
|
|
+ MYDBM_CLOSE (dbf);
|
|
|
|
|
+ dbf = NULL;
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
key = MYDBM_FIRSTKEY (dbf);
|
|
|
|
|
|
|
|
|
|
@@ -840,6 +870,14 @@ short purge_missing (const char *manpath
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* Ignore db identifier keys. */
|
|
|
|
|
+ if (*key.dptr == '.' && *(key.dptr+1) == 0) {
|
|
|
|
|
+ nextkey = MYDBM_NEXTKEY (dbf, key);
|
|
|
|
|
+ MYDBM_FREE (key.dptr);
|
|
|
|
|
+ key = nextkey;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
content = MYDBM_FETCH (dbf, key);
|
|
|
|
|
if (!content.dptr)
|
|
|
|
|
return count;
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/compression.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/compression.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -60,26 +60,30 @@ extern int errno;
|
|
|
|
|
#ifdef COMP_SRC /* must come after manconfig.h */
|
|
|
|
|
|
|
|
|
|
#include "lib/error.h"
|
|
|
|
|
+#include "lib/cleanup.h"
|
|
|
|
|
#include "lib/pipeline.h"
|
|
|
|
|
#include "security.h"
|
|
|
|
|
#include "comp_src.h"
|
|
|
|
|
|
|
|
|
|
static char *file; /* pointer to temp file name */
|
|
|
|
|
static int file_fd = -1;
|
|
|
|
|
+static char *wbuf = NULL; /* temporary buffer for the whatis scan */
|
|
|
|
|
|
|
|
|
|
+#ifndef HAVE_ZIO
|
|
|
|
|
/* initialise temp filename */
|
|
|
|
|
static __inline__ void create_ztemp (void)
|
|
|
|
|
{
|
|
|
|
|
int oldmask = umask (022);
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
file_fd = create_tempfile ("zman", &file);
|
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
|
|
|
|
|
|
if (file_fd < 0)
|
|
|
|
|
error (FATAL, errno, _("can't create a temporary filename"));
|
|
|
|
|
- regain_effective_privs ();
|
|
|
|
|
- umask (oldmask);
|
|
|
|
|
- atexit (remove_ztemp);
|
|
|
|
|
+ (void) umask (oldmask);
|
|
|
|
|
+ push_cleanup ((void (*)())remove_ztemp, NULL);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
/* Take filename as arg, return structure containing decompressor
|
|
|
|
|
and extension, or NULL if no comp extension found.
|
|
|
|
|
@@ -152,6 +156,7 @@ struct compression *comp_file (const cha
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#ifndef HAVE_ZIO
|
|
|
|
|
/* Set up a pointer to a unique temp filename on first call.
|
|
|
|
|
* If this returns NULL, an error message will have been printed and the
|
|
|
|
|
* caller should abort the current operation as appropriate.
|
|
|
|
|
@@ -215,6 +220,7 @@ void remove_ztemp (void)
|
|
|
|
|
(void) remove_with_dropped_privs (file);
|
|
|
|
|
free (file);
|
|
|
|
|
file = NULL;
|
|
|
|
|
+ pop_cleanup();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -223,4 +229,22 @@ char *get_ztemp (void)
|
|
|
|
|
{
|
|
|
|
|
return file;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+/* remember temporary the head of an nroff buffer */
|
|
|
|
|
+void set_wbuf(const char* whatis)
|
|
|
|
|
+{
|
|
|
|
|
+ if (wbuf)
|
|
|
|
|
+ free(wbuf);
|
|
|
|
|
+ wbuf = NULL;
|
|
|
|
|
+ if (whatis)
|
|
|
|
|
+ wbuf = xstrdup(whatis);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* return temporary buffer for whatis */
|
|
|
|
|
+char *get_wbuf(void)
|
|
|
|
|
+{
|
|
|
|
|
+ return wbuf;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
#endif /* COMP_SRC */
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/encodings.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/encodings.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -112,7 +112,7 @@ static struct directory_entry directory_
|
|
|
|
|
{ "ru", "KOI8-R", "KOI8-R" }, /* Russian */
|
|
|
|
|
{ "sk", "ISO-8859-2", "ISO-8859-2" }, /* Slovak */
|
|
|
|
|
{ "tr", "ISO-8859-9", "ISO-8859-9" }, /* Turkish */
|
|
|
|
|
-#endif /* MULTIBYTE_GROFF */
|
|
|
|
|
+#endif /* !MULTIBYTE_GROFF */
|
|
|
|
|
|
|
|
|
|
{ NULL, NULL, "NULL" }
|
|
|
|
|
};
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/fake_security.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/fake_security.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -45,6 +45,7 @@ extern int errno;
|
|
|
|
|
#include "security.h"
|
|
|
|
|
|
|
|
|
|
uid_t ruid, euid, uid;
|
|
|
|
|
+gid_t rgid, egid;
|
|
|
|
|
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
static struct passwd *man_owner;
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/lexgrog.l
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/lexgrog.l 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -45,6 +45,10 @@ extern int errno;
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
|
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+# include <zio.h>
|
|
|
|
|
+#endif /* COMP_SRC && HAVE_ZIO */
|
|
|
|
|
+
|
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
|
# include <string.h>
|
|
|
|
|
#elif defined (HAVE_STRINGS_H)
|
|
|
|
|
@@ -64,7 +68,7 @@ extern int errno;
|
|
|
|
|
#include "security.h"
|
|
|
|
|
#include "ult_src.h"
|
|
|
|
|
|
|
|
|
|
-#define YY_READ_BUF_SIZE 1024
|
|
|
|
|
+#define YY_READ_BUF_SIZE YY_BUF_SIZE
|
|
|
|
|
#define MAX_NAME 2048
|
|
|
|
|
|
|
|
|
|
#ifdef PROFILE
|
|
|
|
|
@@ -72,10 +76,10 @@ static int ctr[YY_NUM_RULES];
|
|
|
|
|
# define YY_USER_ACTION ++ctr[yy_act];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
-static void add_str_to_whatis (const char *string, size_t length);
|
|
|
|
|
-static void add_char_to_whatis (unsigned char c);
|
|
|
|
|
-static void add_separator_to_whatis (void);
|
|
|
|
|
-static void newline_found (void);
|
|
|
|
|
+static __inline__ void add_str_to_whatis (const char *string, size_t length);
|
|
|
|
|
+static __inline__ void add_char_to_whatis (unsigned char c);
|
|
|
|
|
+static __inline__ void add_separator_to_whatis (const char *, size_t);
|
|
|
|
|
+static __inline__ void newline_found (void);
|
|
|
|
|
|
|
|
|
|
static char newname[MAX_NAME];
|
|
|
|
|
static char *p_name;
|
|
|
|
|
@@ -84,6 +88,7 @@ static char filters[MAX_FILTERS];
|
|
|
|
|
|
|
|
|
|
static int fill_mode;
|
|
|
|
|
static int waiting_for_quote;
|
|
|
|
|
+static int have_separator;
|
|
|
|
|
|
|
|
|
|
#ifdef TEST
|
|
|
|
|
|
|
|
|
|
@@ -114,7 +119,7 @@ static const char args[] = "mcwfhV";
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%option ecs meta-ecs
|
|
|
|
|
-%option 8bit batch caseful never-interactive
|
|
|
|
|
+%option 8bit batch caseful never-interactive align
|
|
|
|
|
%option nostdinit
|
|
|
|
|
%option warn
|
|
|
|
|
%option noyywrap nounput
|
|
|
|
|
@@ -143,8 +148,9 @@ font_change \\f([[:upper:]1-4]|\({upper}
|
|
|
|
|
size_change \\s[+-]?{digit}
|
|
|
|
|
style_change ({font_change}{size_change}?|{size_change}{font_change}?)
|
|
|
|
|
typeface \.(B[IR]?|I[BR]?|R[BI])
|
|
|
|
|
+paragr \.[PITLH][Pp]
|
|
|
|
|
sec_request \.[Ss][HhYySs]
|
|
|
|
|
-comment ['.]\\{dbl_quote}
|
|
|
|
|
+comment (['.]\\{dbl_quote}|\'\-+|\\&)
|
|
|
|
|
|
|
|
|
|
/* Please add to this list if you know how. */
|
|
|
|
|
cs_name J[Mm][<5B><>Ee][Nn][Oo]
|
|
|
|
|
@@ -162,7 +168,26 @@ nl_name N[Aa][Aa][Mm]
|
|
|
|
|
pl_name N[Aa][Zz][Ww][Aa]
|
|
|
|
|
sv_name N[Aa][Mm][Nn]
|
|
|
|
|
name ({cs_name}|{de_name}|{en_name}|{es_name}|{fi_name}|{fr_name}|{hu_name}|{it_name}|{ja_name}|{latin_name}|{nl_name}|{pl_name}|{sv_name})
|
|
|
|
|
-name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})?
|
|
|
|
|
+name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})?\r?
|
|
|
|
|
+start {sec_request}{blank_eol}+{name_sec}
|
|
|
|
|
+
|
|
|
|
|
+N N(\bN)?
|
|
|
|
|
+n (N(\bN)?|n(\bn)?)
|
|
|
|
|
+a (A(\bA)?|a(\ba)?)
|
|
|
|
|
+o (O(\bO)?|o(\bo)?)
|
|
|
|
|
+m (M(\bM)?|M(\bM)?)
|
|
|
|
|
+e (E(\bE)?|e(\be)?)
|
|
|
|
|
+B B(\bB)
|
|
|
|
|
+b (B(\bB)?|b(\bb)?)
|
|
|
|
|
+r (R(\bR)?|r(\br)?)
|
|
|
|
|
+z (Z(\bZ)?|z(\bz)?)
|
|
|
|
|
+i (I(\bI)?|i(\bi)?)
|
|
|
|
|
+c (C(\bC)?|c(\bc)?)
|
|
|
|
|
+h (H(\bH)?|h(\bh)?)
|
|
|
|
|
+u (U(\bU)?|u(\bu)?)
|
|
|
|
|
+g (G(\bG)?|g(\bg)?)
|
|
|
|
|
+
|
|
|
|
|
+cname (({N}({a}|{o}){m}({n}|{e})|{N}{o}{m}|{N}{o}{m}{b}{r}{e}|{B}{e}{z}{e}{i}{c}{h}{n}{u}{n}{g})|{ja_name})
|
|
|
|
|
|
|
|
|
|
/* eptgrv : eqn, pic, tbl, grap, refer, vgrind */
|
|
|
|
|
tbl_request \.TS
|
|
|
|
|
@@ -176,8 +201,13 @@ vgrind_request \.vS
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
/* begin NAME section processing */
|
|
|
|
|
-<MAN_FILE>{sec_request}{blank_eol}+{name_sec}{blank}* BEGIN (MAN_PRENAME);
|
|
|
|
|
-<CAT_FILE>{empty}{2,}{name}{blank}*{indent} BEGIN (CAT_NAME);
|
|
|
|
|
+<MAN_FILE>{
|
|
|
|
|
+ {start}{blank}*{bol}{blank}*{paragr} | /* strange format */
|
|
|
|
|
+ {start}{blank}* { /* default */
|
|
|
|
|
+ BEGIN (MAN_PRENAME);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+<CAT_FILE>{empty}{2,}{cname}{blank}*{indent} BEGIN (CAT_NAME);
|
|
|
|
|
|
|
|
|
|
/* general text matching */
|
|
|
|
|
<MAN_FILE>\.[^Ss\r\n].* |
|
|
|
|
|
@@ -228,6 +258,7 @@ vgrind_request \.vS
|
|
|
|
|
<MAN_NAME>{bol}\.sp{blank}* | /* vertical spacing */
|
|
|
|
|
<MAN_NAME>{bol}\.ig{blank}* | /* block comment */
|
|
|
|
|
<MAN_NAME>{bol}\.de[1i]?{blank}* | /* macro definition */
|
|
|
|
|
+<MAN_NAME>{bol}\.V[be]{blank}* | /* special in perl pages */
|
|
|
|
|
<MAN_NAME>{empty}{bol}.+ |
|
|
|
|
|
<MAN_NAME><<EOF>> { /* terminate the string */
|
|
|
|
|
*p_name = '\0';
|
|
|
|
|
@@ -251,28 +282,31 @@ vgrind_request \.vS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{bol}{typeface}{blank}+ | /* type face commands */
|
|
|
|
|
- {bol}\.IX{blank}.* | /* .IX line */
|
|
|
|
|
+ {bol}\.IX{blank}.* | /* index request */
|
|
|
|
|
{next}{comment}.* { /* per line comments */
|
|
|
|
|
newline_found ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* No-op requests */
|
|
|
|
|
-<MAN_NAME>{bol}\.{blank}*$ newline_found ();
|
|
|
|
|
-<MAN_NAME>{bol}\.\.$ newline_found ();
|
|
|
|
|
+<MAN_NAME>{bol}\.{blank}*/{eol} newline_found ();
|
|
|
|
|
+<MAN_NAME>{bol}\.\./{eol} newline_found ();
|
|
|
|
|
|
|
|
|
|
- /* Toggle fill mode */
|
|
|
|
|
-<MAN_NAME>{bol}\.nf.* fill_mode = 0;
|
|
|
|
|
-<MAN_NAME>{bol}\.fi.* fill_mode = 1;
|
|
|
|
|
+ /* Toggle fill mode, also for roff macro definitions */
|
|
|
|
|
+<MAN_NAME>{bol}\.(nf|de).* fill_mode = 0;
|
|
|
|
|
+<MAN_NAME>{bol}\.(fi|\.).* fill_mode = 1;
|
|
|
|
|
|
|
|
|
|
<CAT_NAME>-{eol}{blank_eol}* /* strip continuations */
|
|
|
|
|
|
|
|
|
|
/* convert to DASH */
|
|
|
|
|
<MAN_NAME>{next}{blank}*\\\((mi|hy|em){blank}* |
|
|
|
|
|
+<MAN_NAME>{bol}\.sp{bol}{blank}+\\-{blank}* | /* strange spacing in NAME section */
|
|
|
|
|
+<MAN_NAME>{blank}+[-\\]?-{bol} | /* dash at end of line */
|
|
|
|
|
+<MAN_NAME>{next}{blank_eol}+(\\?-){2}{blank}+ | /* some man pages use -- as dash */
|
|
|
|
|
<MAN_NAME>{next}{blank_eol}+[-\\]-{blank}* |
|
|
|
|
|
<MAN_NAME>{next}{blank_eol}*[-\\]-{blank}+ |
|
|
|
|
|
<CAT_NAME>{next}{blank}+-{1,2}{blank_eol}+ |
|
|
|
|
|
-<MAN_NAME>{bol}\.Nd{blank}* add_separator_to_whatis ();
|
|
|
|
|
+<MAN_NAME>{bol}\.Nd{blank}* add_separator_to_whatis (yytext, yyleng);
|
|
|
|
|
|
|
|
|
|
/* escape sequences and special characters */
|
|
|
|
|
<MAN_NAME>{
|
|
|
|
|
@@ -288,6 +322,7 @@ vgrind_request \.vS
|
|
|
|
|
{next}\\[|^&!%acdpruz{}\r\n] /* various useless control chars */
|
|
|
|
|
{next}\\[bhlLvx]{blank}*'[^']+' /* various inline functions */
|
|
|
|
|
|
|
|
|
|
+ {next}\\\\\$[1-9] /* roff macro argument */
|
|
|
|
|
{next}\\\$[1-9] /* interpolate arg */
|
|
|
|
|
|
|
|
|
|
{next}\\\*(\({alpha})?{alpha} /* interpolate string */
|
|
|
|
|
@@ -316,8 +351,7 @@ vgrind_request \.vS
|
|
|
|
|
for later processing */
|
|
|
|
|
<MAN_NAME>{
|
|
|
|
|
{bol}\.br{blank}* |
|
|
|
|
|
- {bol}\.LP{blank}* |
|
|
|
|
|
- {bol}\.PP{blank}* |
|
|
|
|
|
+ {bol}{paragr}{blank}* |
|
|
|
|
|
{bol}\.P{blank}* add_char_to_whatis ((char) 0x11);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -329,7 +363,7 @@ vgrind_request \.vS
|
|
|
|
|
<MAN_NAME>[[:alnum:]]* add_str_to_whatis (yytext, yyleng);
|
|
|
|
|
|
|
|
|
|
/* normalise the period (,) separators */
|
|
|
|
|
-<CAT_NAME>{blank}*,[ \t\r\n]* |
|
|
|
|
|
+<CAT_NAME>{blank}*,{blank_eol}* |
|
|
|
|
|
<MAN_NAME>{blank}*,{blank}* add_str_to_whatis (", ", 2);
|
|
|
|
|
|
|
|
|
|
<CAT_NAME,MAN_NAME>{bol}. {
|
|
|
|
|
@@ -345,7 +379,7 @@ vgrind_request \.vS
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
/* print warning and force scanner to terminate */
|
|
|
|
|
-static void too_big (void)
|
|
|
|
|
+static __inline__ void too_big (void)
|
|
|
|
|
{
|
|
|
|
|
error (0, 0,
|
|
|
|
|
_("warning: whatis for %s exceeds %d bytes, truncating."),
|
|
|
|
|
@@ -355,7 +389,7 @@ static void too_big (void)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* append a string to newname if enough room */
|
|
|
|
|
-static void add_str_to_whatis (const char *string, size_t length)
|
|
|
|
|
+static __inline__ void add_str_to_whatis (const char *string, size_t length)
|
|
|
|
|
{
|
|
|
|
|
if (p_name - newname + length >= MAX_NAME)
|
|
|
|
|
too_big ();
|
|
|
|
|
@@ -366,8 +400,10 @@ static void add_str_to_whatis (const cha
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* append a char to newname if enough room */
|
|
|
|
|
-static void add_char_to_whatis (unsigned char c)
|
|
|
|
|
+static __inline__ void add_char_to_whatis (unsigned char c)
|
|
|
|
|
{
|
|
|
|
|
+ if (c == (char) 0x11 && *p_name == (char) 0x11)
|
|
|
|
|
+ return;
|
|
|
|
|
if (p_name - newname + 1 >= MAX_NAME)
|
|
|
|
|
too_big ();
|
|
|
|
|
else if (waiting_for_quote && c == '"')
|
|
|
|
|
@@ -379,14 +415,30 @@ static void add_char_to_whatis (unsigned
|
|
|
|
|
/* append the " - " separator to newname, trimming the first space if one's
|
|
|
|
|
* already there
|
|
|
|
|
*/
|
|
|
|
|
-static void add_separator_to_whatis (void)
|
|
|
|
|
+static __inline__ void add_separator_to_whatis (const char *string, size_t len)
|
|
|
|
|
{
|
|
|
|
|
+ if (have_separator) {
|
|
|
|
|
+ unsigned int n;
|
|
|
|
|
+ unsigned char c;
|
|
|
|
|
+
|
|
|
|
|
+ for (n = 0; (n < len) && (c = string[n]); n++) {
|
|
|
|
|
+ switch (c) {
|
|
|
|
|
+ case '-':
|
|
|
|
|
+ case ' ':
|
|
|
|
|
+ add_char_to_whatis (c);
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ have_separator = 1;
|
|
|
|
|
if (p_name != newname && *(p_name - 1) != ' ')
|
|
|
|
|
add_char_to_whatis (' ');
|
|
|
|
|
add_str_to_whatis ("- ", 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void newline_found (void)
|
|
|
|
|
+static __inline__ void newline_found (void)
|
|
|
|
|
{
|
|
|
|
|
/* If we are mid p_name and the last added char was not a space,
|
|
|
|
|
* best add one.
|
|
|
|
|
@@ -423,6 +475,10 @@ int find_name (const char *file, const c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef COMP_SRC
|
|
|
|
|
+# ifdef HAVE_ZIO
|
|
|
|
|
+ /* See if we need to use fzopen(). */
|
|
|
|
|
+ comp = comp_info (file, 0);
|
|
|
|
|
+# else
|
|
|
|
|
/* See if we need to decompress the file(s) first. */
|
|
|
|
|
comp = comp_info (file, 0);
|
|
|
|
|
if (comp) {
|
|
|
|
|
@@ -430,18 +486,25 @@ int find_name (const char *file, const c
|
|
|
|
|
if (!file)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
+# endif
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ if (comp)
|
|
|
|
|
+ yyin = fzopen (file, "r");
|
|
|
|
|
+ else
|
|
|
|
|
+#endif
|
|
|
|
|
yyin = fopen (file, "r");
|
|
|
|
|
regain_effective_privs ();
|
|
|
|
|
if (!yyin) {
|
|
|
|
|
error (0, errno, _("can't open %s"), file);
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
+ setvbuf(yyin, NULL, _IOFBF, YY_READ_BUF_SIZE);
|
|
|
|
|
|
|
|
|
|
fname = filename;
|
|
|
|
|
*(p_name = newname) = '\0';
|
|
|
|
|
@@ -449,6 +512,7 @@ int find_name (const char *file, const c
|
|
|
|
|
|
|
|
|
|
fill_mode = 1;
|
|
|
|
|
waiting_for_quote = 0;
|
|
|
|
|
+ have_separator = 0;
|
|
|
|
|
|
|
|
|
|
if (p_lg->type)
|
|
|
|
|
BEGIN (CAT_FILE);
|
|
|
|
|
@@ -461,7 +525,7 @@ int find_name (const char *file, const c
|
|
|
|
|
ret = yylex ();
|
|
|
|
|
fclose (yyin);
|
|
|
|
|
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
@@ -493,6 +557,58 @@ int find_name (const char *file, const c
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+int find_name_str(char *buffer, const char *filename, lexgrog *p_lg)
|
|
|
|
|
+{
|
|
|
|
|
+ int i;
|
|
|
|
|
+
|
|
|
|
|
+ if (!buffer || (i = strlen(buffer)) < 14)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+
|
|
|
|
|
+ fname = filename;
|
|
|
|
|
+ *(p_name = newname) = '\0';
|
|
|
|
|
+ memset(filters, '_', sizeof(filters));
|
|
|
|
|
+
|
|
|
|
|
+ fill_mode = 1;
|
|
|
|
|
+ waiting_for_quote = 0;
|
|
|
|
|
+ have_separator = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (p_lg->type)
|
|
|
|
|
+ BEGIN(CAT_FILE);
|
|
|
|
|
+ else
|
|
|
|
|
+ BEGIN(MAN_FILE);
|
|
|
|
|
+
|
|
|
|
|
+ buffer[i-1] = buffer[i-2] = YY_END_OF_BUFFER_CHAR;
|
|
|
|
|
+
|
|
|
|
|
+ yy_switch_to_buffer(yy_scan_buffer(buffer, i));
|
|
|
|
|
+ i = yylex();
|
|
|
|
|
+ yy_delete_buffer(YY_CURRENT_BUFFER);
|
|
|
|
|
+
|
|
|
|
|
+ if (i)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ else {
|
|
|
|
|
+ char f_tmp[MAX_FILTERS];
|
|
|
|
|
+ int j, k;
|
|
|
|
|
+
|
|
|
|
|
+ /* wipe out any leading or trailing spaces */
|
|
|
|
|
+ if (*newname) {
|
|
|
|
|
+ for (p_name = strchr (newname, '\0');
|
|
|
|
|
+ *(p_name - 1) == ' ';
|
|
|
|
|
+ p_name--);
|
|
|
|
|
+ if (*p_name == ' ')
|
|
|
|
|
+ *p_name = '\0';
|
|
|
|
|
+ }
|
|
|
|
|
+ for (p_name = newname; *p_name == ' '; p_name++);
|
|
|
|
|
+ p_lg->whatis = xstrdup (p_name);
|
|
|
|
|
+ memset(f_tmp, '\0', MAX_FILTERS);
|
|
|
|
|
+ f_tmp[0] = '-';
|
|
|
|
|
+ for (j = k = 0; j < MAX_FILTERS; j++ )
|
|
|
|
|
+ if (filters[j] != '_' )
|
|
|
|
|
+ f_tmp[k++] = filters[j];
|
|
|
|
|
+ p_lg->filters = xstrdup (f_tmp);
|
|
|
|
|
+ return p_name[0];
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
#ifdef TEST
|
|
|
|
|
|
|
|
|
|
static void usage (int status)
|
|
|
|
|
@@ -595,7 +711,7 @@ int main (int argc, char **argv)
|
|
|
|
|
&statbuf, SO_LINK);
|
|
|
|
|
if (path)
|
|
|
|
|
free (path);
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
if (file) {
|
|
|
|
|
char *ztemp = get_ztemp ();
|
|
|
|
|
if (ztemp)
|
|
|
|
|
@@ -617,7 +733,24 @@ int main (int argc, char **argv)
|
|
|
|
|
}
|
|
|
|
|
++optind;
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
+#if 0
|
|
|
|
|
+ printf("Tests with strings instead of files\n\n");
|
|
|
|
|
+ {
|
|
|
|
|
+ int type;
|
|
|
|
|
+ for (type = 0; type <= 1; type++) {
|
|
|
|
|
+ lexgrog lg;
|
|
|
|
|
+ lg.type = type;
|
|
|
|
|
+ if (lg.type == MANPAGE) {
|
|
|
|
|
+ printf("man: \"%d %s\"\n", find_name_str(xstrdup(".SH NAME\nman \\- String1\n.SH"), "-", &lg), lg.whatis);
|
|
|
|
|
+ printf("man: \"%d %s\"\n", find_name_str(xstrdup(".SH NAME\nman \\- String2\n.SH"), "-", &lg), lg.whatis);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (lg.type == CATPAGE) {
|
|
|
|
|
+ printf("cat: \"%d %s\"\n", find_name_str(xstrdup("\n\nNAME\n cat - String1\n\nD"), "-", &lg), lg.whatis);
|
|
|
|
|
+ printf("cat: \"%d %s\"\n", find_name_str(xstrdup("\n\nNAME\n cat - String2\n\nD"), "-", &lg), lg.whatis);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
|
|
if (some_failed)
|
|
|
|
|
return FATAL;
|
|
|
|
|
else
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/man.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/man.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -98,11 +98,16 @@ static char *cwd;
|
|
|
|
|
#include <utime.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
+#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
#if HAVE_SYS_WAIT_H
|
|
|
|
|
# include <sys/wait.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+# include <zio.h>
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
#ifndef STDC_HEADERS
|
|
|
|
|
extern char *getenv();
|
|
|
|
|
extern int errno;
|
|
|
|
|
@@ -144,6 +149,8 @@ extern int errno;
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
extern uid_t ruid;
|
|
|
|
|
extern uid_t euid;
|
|
|
|
|
+extern gid_t rgid;
|
|
|
|
|
+extern gid_t egid;
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
/* the magic cookie to request preprocessing */
|
|
|
|
|
@@ -177,6 +184,10 @@ const char *lang;
|
|
|
|
|
|
|
|
|
|
static int global_manpath = -1; /* global or user manual page hierarchy? */
|
|
|
|
|
static int skip; /* page exists but has been skipped */
|
|
|
|
|
+static struct termios tms; /* To save terminal settings in */
|
|
|
|
|
+static int tms_set = 0; /* Do we have saved terminal settings? */
|
|
|
|
|
+
|
|
|
|
|
+static void set_term(void) { if (tms_set) tcsetattr(fileno(stdin), TCSANOW, &tms); }
|
|
|
|
|
|
|
|
|
|
#if defined _AIX || defined __sgi
|
|
|
|
|
char **global_argv;
|
|
|
|
|
@@ -372,9 +383,9 @@ static const struct option long_options[
|
|
|
|
|
static const char args[] = "7DlM:P:S:adfhH::kVum:p:tT::wWe:L:Zcr:X::E:iIC:";
|
|
|
|
|
|
|
|
|
|
# ifdef TROFF_IS_GROFF
|
|
|
|
|
-static int ditroff;
|
|
|
|
|
+static int ditroff = 0;
|
|
|
|
|
static const char *gxditview;
|
|
|
|
|
-static int htmlout;
|
|
|
|
|
+static int htmlout = 0;
|
|
|
|
|
static const char *html_pager;
|
|
|
|
|
# endif /* TROFF_IS_GROFF */
|
|
|
|
|
|
|
|
|
|
@@ -475,26 +486,6 @@ static void gripe_no_name (const char *s
|
|
|
|
|
exit (FAIL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-static struct termios tms;
|
|
|
|
|
-static int tms_set = 0;
|
|
|
|
|
-
|
|
|
|
|
-static void set_term (void)
|
|
|
|
|
-{
|
|
|
|
|
- if (tms_set)
|
|
|
|
|
- tcsetattr (fileno (stdin), TCSANOW, &tms);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-static void get_term (void)
|
|
|
|
|
-{
|
|
|
|
|
- if (isatty (fileno (stdout))) {
|
|
|
|
|
- if (debug)
|
|
|
|
|
- fprintf(stderr, "is a tty\n");
|
|
|
|
|
- tcgetattr (fileno (stdin), &tms);
|
|
|
|
|
- if (!tms_set++)
|
|
|
|
|
- atexit (set_term);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/* Line length detection code adapted from Andries Brouwer's man. */
|
|
|
|
|
|
|
|
|
|
/* Try to determine the line length to use.
|
|
|
|
|
@@ -637,11 +628,11 @@ static __inline__ char **manopt_to_env (
|
|
|
|
|
{
|
|
|
|
|
char *manopt, *opt_start, **argv;
|
|
|
|
|
|
|
|
|
|
- manopt = getenv ("MANOPT");
|
|
|
|
|
+ opt_start = manopt = getenv ("MANOPT");
|
|
|
|
|
if (manopt == NULL || *manopt == '\0')
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
- opt_start = manopt = xstrdup (manopt);
|
|
|
|
|
+ manopt = xstrdup (manopt);
|
|
|
|
|
|
|
|
|
|
/* allocate space for the program name */
|
|
|
|
|
*argc = 0;
|
|
|
|
|
@@ -758,43 +749,56 @@ static int local_man_loop (const char *a
|
|
|
|
|
display (NULL, "", NULL, "(stdin)", NULL);
|
|
|
|
|
else {
|
|
|
|
|
struct stat st;
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
struct compression *comp;
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
+ char *pwd = cwd;
|
|
|
|
|
+ char *file = basename((char*)argv);
|
|
|
|
|
+
|
|
|
|
|
+ if (strcmp(argv, file)) {
|
|
|
|
|
+ char *dlm;
|
|
|
|
|
+ pwd = strdupa(argv);
|
|
|
|
|
+
|
|
|
|
|
+ if ((dlm = strrchr(pwd, '/')))
|
|
|
|
|
+ *dlm = '\0';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/* See if we need to decompress the file(s) first */
|
|
|
|
|
- if (cwd[0]) {
|
|
|
|
|
+ if (pwd[0]) {
|
|
|
|
|
if (debug)
|
|
|
|
|
- fprintf (stderr, "chdir %s\n", cwd);
|
|
|
|
|
- if (chdir (cwd)) {
|
|
|
|
|
- error (0, errno, _("can't chdir to %s"), cwd);
|
|
|
|
|
+ fprintf (stderr, "chdir %s\n", pwd);
|
|
|
|
|
+ if (chdir (pwd)) {
|
|
|
|
|
+ error (0, errno, _("can't chdir to %s"), pwd);
|
|
|
|
|
regain_effective_privs ();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check that the file exists and isn't e.g. a directory */
|
|
|
|
|
- if (stat (argv, &st)) {
|
|
|
|
|
+ if (stat (file, &st)) {
|
|
|
|
|
error (0, errno, "%s", argv);
|
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
|
return NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (S_ISDIR (st.st_mode)) {
|
|
|
|
|
error (0, EISDIR, "%s", argv);
|
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
|
return NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
- comp = comp_info (argv, 0);
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
+ comp = comp_info (file, 0);
|
|
|
|
|
if (comp)
|
|
|
|
|
- if (!decompress(argv, comp))
|
|
|
|
|
+ if (!decompress(file, comp))
|
|
|
|
|
exit_status = CHILD_FAIL;
|
|
|
|
|
-#endif /* COMP_SRC */
|
|
|
|
|
+#endif /* COMP_SRC && !HAVE_ZIO */
|
|
|
|
|
if (exit_status == OK) {
|
|
|
|
|
char *argv_copy = xstrdup (argv);
|
|
|
|
|
lang = lang_dir (argv);
|
|
|
|
|
- if (!display (NULL, argv, NULL, basename (argv_copy),
|
|
|
|
|
- NULL)) {
|
|
|
|
|
+ if (!lang || !*lang)
|
|
|
|
|
+ lang = internal_locale;
|
|
|
|
|
+ if (!display (NULL, file, NULL, file, NULL)) {
|
|
|
|
|
if (local_mf)
|
|
|
|
|
error (0, errno, "%s", argv);
|
|
|
|
|
exit_status = NOT_FOUND;
|
|
|
|
|
@@ -802,22 +806,15 @@ static int local_man_loop (const char *a
|
|
|
|
|
free (argv_copy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
-#endif /* COMP_SRC */
|
|
|
|
|
+#endif /* COMP_SRC && !HAVE_ZIO*/
|
|
|
|
|
}
|
|
|
|
|
local_man_file = local_mf;
|
|
|
|
|
regain_effective_privs ();
|
|
|
|
|
return exit_status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void int_handler (int signo)
|
|
|
|
|
-{
|
|
|
|
|
- if (debug)
|
|
|
|
|
- fprintf (stderr, "\ninterrupt signal %d handler\n", signo);
|
|
|
|
|
- exit (INTERRUPTED);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
int argc_env, exit_status = OK;
|
|
|
|
|
@@ -836,7 +833,16 @@ int main (int argc, char *argv[])
|
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
|
textdomain (PACKAGE);
|
|
|
|
|
|
|
|
|
|
- internal_locale = setlocale (LC_MESSAGES, NULL);
|
|
|
|
|
+ internal_locale = setlocale (LC_MESSAGES, "");
|
|
|
|
|
+#if defined(__GLIBC__)
|
|
|
|
|
+# if (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
|
|
|
|
|
+ if (!internal_locale) {
|
|
|
|
|
+ if ( !(internal_locale = getenv ("LC_ALL"))
|
|
|
|
|
+ && !(internal_locale = getenv ("LC_MESSAGES")))
|
|
|
|
|
+ internal_locale = getenv ("LANG");
|
|
|
|
|
+ }
|
|
|
|
|
+# endif
|
|
|
|
|
+#endif
|
|
|
|
|
/* Use LANGUAGE only when LC_MESSAGES locale category is
|
|
|
|
|
* neither "C" nor "POSIX". */
|
|
|
|
|
if (internal_locale && strcmp (internal_locale, "C") &&
|
|
|
|
|
@@ -889,8 +895,6 @@ int main (int argc, char *argv[])
|
|
|
|
|
init_security ();
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
- signal (SIGINT, int_handler);
|
|
|
|
|
-
|
|
|
|
|
pipeline_install_sigchld ();
|
|
|
|
|
|
|
|
|
|
if (!catman)
|
|
|
|
|
@@ -902,11 +906,16 @@ int main (int argc, char *argv[])
|
|
|
|
|
if (external)
|
|
|
|
|
do_extern (argc, argv);
|
|
|
|
|
|
|
|
|
|
- get_term (); /* stores terminal settings */
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
if (debug)
|
|
|
|
|
- fprintf (stderr, "real user = %d; effective user = %d\n",
|
|
|
|
|
- ruid, euid);
|
|
|
|
|
+ fprintf (stderr, "real user = %d; effective user = %d\n", ruid, euid);
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (isatty(fileno(stdin)) && isatty(fileno(stdout))) {
|
|
|
|
|
+ tcgetattr(fileno(stdin), &tms);
|
|
|
|
|
+ if (!tms_set++)
|
|
|
|
|
+ atexit(set_term);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SETLOCALE
|
|
|
|
|
@@ -927,6 +936,7 @@ int main (int argc, char *argv[])
|
|
|
|
|
setenv ("LANGUAGE", internal_locale, 1);
|
|
|
|
|
++_nl_msg_cat_cntr;
|
|
|
|
|
multiple_locale = NULL;
|
|
|
|
|
+#define MULTIPLE_LOCALE_IS_NULL 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -984,6 +994,22 @@ int main (int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (manp == NULL) {
|
|
|
|
|
+#if MULTIPLE_LOCALE_IS_NULL
|
|
|
|
|
+ char * tmp_locale = xstrdup(internal_locale);
|
|
|
|
|
+ char * ptr;
|
|
|
|
|
+
|
|
|
|
|
+ manp = manpath (alt_system_name);
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Use strsep () to not intermix with strtok ()
|
|
|
|
|
+ */
|
|
|
|
|
+ for (ptr = strsep (&tmp_locale, ":"); ptr; ptr = strsep (&tmp_locale, ":")) {
|
|
|
|
|
+ if (debug)
|
|
|
|
|
+ fprintf (stderr, "checking for locale %s\n", ptr);
|
|
|
|
|
+ manp = add_nls_manpath (manp, ptr);
|
|
|
|
|
+ }
|
|
|
|
|
+ free(tmp_locale);
|
|
|
|
|
+#else
|
|
|
|
|
char tmp_locale[3];
|
|
|
|
|
int idx;
|
|
|
|
|
|
|
|
|
|
@@ -1007,6 +1033,7 @@ int main (int argc, char *argv[])
|
|
|
|
|
tmp_locale);
|
|
|
|
|
manp = add_nls_manpath (manp, tmp_locale);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
} else
|
|
|
|
|
free (manpath (NULL));
|
|
|
|
|
|
|
|
|
|
@@ -1333,10 +1360,15 @@ static const char *get_preprocessors_fro
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ fp = fzopen(file, "r");
|
|
|
|
|
+#else
|
|
|
|
|
fp = fopen (file, "r");
|
|
|
|
|
+#endif
|
|
|
|
|
if (fp) {
|
|
|
|
|
if (fgets (line, sizeof (line), fp)) {
|
|
|
|
|
- if (!memcmp (line, PP_COOKIE, 4)) {
|
|
|
|
|
+ if (!memcmp (line, PP_COOKIE, 4) ||
|
|
|
|
|
+ (strlen(line) == 6 && !memcmp (line, ".\\\" ", 4))) {
|
|
|
|
|
int len;
|
|
|
|
|
directive = line + 4;
|
|
|
|
|
/* strip trailing newline */
|
|
|
|
|
@@ -1397,8 +1429,8 @@ static const char *get_preprocessors (co
|
|
|
|
|
/* This is so that we can store the temp file name used when input is
|
|
|
|
|
* stdin and remove it on exit.
|
|
|
|
|
*/
|
|
|
|
|
-static char *stdin_tmpfile;
|
|
|
|
|
-static int stdin_tmpfile_fd;
|
|
|
|
|
+static char *stdin_tmpfile = NULL;
|
|
|
|
|
+static int stdin_tmpfile_fd = -1;
|
|
|
|
|
|
|
|
|
|
static void remove_stdintmp (void)
|
|
|
|
|
{
|
|
|
|
|
@@ -1406,6 +1438,7 @@ static void remove_stdintmp (void)
|
|
|
|
|
if (stdin_tmpfile_fd >= 0)
|
|
|
|
|
close (stdin_tmpfile_fd);
|
|
|
|
|
(void) remove_with_dropped_privs (stdin_tmpfile);
|
|
|
|
|
+ pop_cleanup();
|
|
|
|
|
free (stdin_tmpfile);
|
|
|
|
|
stdin_tmpfile = NULL;
|
|
|
|
|
}
|
|
|
|
|
@@ -1419,12 +1452,12 @@ static __inline__ void create_stdintmp (
|
|
|
|
|
int oldmask = umask (022);
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
stdin_tmpfile_fd = create_tempfile ("sman", &stdin_tmpfile);
|
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
|
|
|
|
|
|
if (stdin_tmpfile_fd < 0)
|
|
|
|
|
error (FATAL, errno, _("can't create a temporary filename"));
|
|
|
|
|
- regain_effective_privs ();
|
|
|
|
|
- umask (oldmask);
|
|
|
|
|
- atexit (remove_stdintmp);
|
|
|
|
|
+ (void)umask (oldmask);
|
|
|
|
|
+ push_cleanup((void (*)())remove_stdintmp, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return pipeline to format file to stdout. */
|
|
|
|
|
@@ -1551,9 +1584,22 @@ static pipeline *make_roff_command (cons
|
|
|
|
|
const char *output_encoding = NULL, *locale_charset = NULL;
|
|
|
|
|
|
|
|
|
|
if (*file) {
|
|
|
|
|
+#ifdef COMP_SRC
|
|
|
|
|
+ struct compression *comp;
|
|
|
|
|
+
|
|
|
|
|
+ cmd = command_new_argstr (get_def ("soelim", SOELIM));
|
|
|
|
|
+ if ((comp = comp_info(file, 1))) {
|
|
|
|
|
+ /* zsoelim handels gziped files without extension */
|
|
|
|
|
+ command_arg(cmd, comp->stem);
|
|
|
|
|
+ free(comp->stem);
|
|
|
|
|
+ } else
|
|
|
|
|
+ command_arg (cmd, file);
|
|
|
|
|
+ pipeline_command (p, cmd);
|
|
|
|
|
+#else
|
|
|
|
|
cmd = command_new_argstr (get_def ("soelim", SOELIM));
|
|
|
|
|
command_arg (cmd, file);
|
|
|
|
|
pipeline_command (p, cmd);
|
|
|
|
|
+#endif
|
|
|
|
|
} else {
|
|
|
|
|
/* Reading from stdin: use cat to pick up the part we
|
|
|
|
|
* read in to figure out the format pipeline.
|
|
|
|
|
@@ -1887,6 +1933,18 @@ static void setenv_less (const char *tit
|
|
|
|
|
free (less_opts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void disable_x(void)
|
|
|
|
|
+{
|
|
|
|
|
+ char *bname = basename((char*)pager);
|
|
|
|
|
+ if (bname) {
|
|
|
|
|
+ if (!strcmp(bname, "less"))
|
|
|
|
|
+ unsetenv("DISPLAY");
|
|
|
|
|
+#if 0
|
|
|
|
|
+ free(bname);
|
|
|
|
|
+#endif
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
/* Return pipeline to display file. NULL means stdin.
|
|
|
|
|
*
|
|
|
|
|
* TODO: htmlout case is pretty weird now. I'd like the intelligence to be
|
|
|
|
|
@@ -1899,6 +1957,9 @@ static pipeline *make_display_command (c
|
|
|
|
|
|
|
|
|
|
setenv_less (title);
|
|
|
|
|
|
|
|
|
|
+ if (!htmlout)
|
|
|
|
|
+ disable_x();
|
|
|
|
|
+
|
|
|
|
|
if (file) {
|
|
|
|
|
if (ascii) {
|
|
|
|
|
p = pipeline_new ();
|
|
|
|
|
@@ -2360,16 +2421,24 @@ static int display (const char *dir, con
|
|
|
|
|
if (debug)
|
|
|
|
|
fprintf (stderr, "chdir %s\n", dir);
|
|
|
|
|
|
|
|
|
|
+ if (global_manpath)
|
|
|
|
|
+ drop_effective_privs();
|
|
|
|
|
+
|
|
|
|
|
if (chdir (dir)) {
|
|
|
|
|
error (0, errno, _("can't chdir to %s"), dir);
|
|
|
|
|
+ if (global_manpath)
|
|
|
|
|
+ regain_effective_privs();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (global_manpath)
|
|
|
|
|
+ regain_effective_privs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* define format_cmd */
|
|
|
|
|
{
|
|
|
|
|
const char *source_file = NULL;
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
if (man_file) {
|
|
|
|
|
source_file = get_ztemp ();
|
|
|
|
|
if (!source_file)
|
|
|
|
|
@@ -2377,11 +2446,10 @@ static int display (const char *dir, con
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
source_file = man_file;
|
|
|
|
|
-#endif /* COMP_SRC */
|
|
|
|
|
+#endif /* COMP_SRC && !HAVE_ZIO */
|
|
|
|
|
|
|
|
|
|
if (source_file)
|
|
|
|
|
- format_cmd = make_roff_command (dir, source_file,
|
|
|
|
|
- dbfilters);
|
|
|
|
|
+ format_cmd = make_roff_command (dir, source_file, dbfilters);
|
|
|
|
|
else
|
|
|
|
|
format_cmd = NULL;
|
|
|
|
|
}
|
|
|
|
|
@@ -2585,8 +2653,12 @@ static int display (const char *dir, con
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- pipeline_free (format_cmd);
|
|
|
|
|
-
|
|
|
|
|
+ if (format_cmd)
|
|
|
|
|
+ pipeline_free (format_cmd);
|
|
|
|
|
+
|
|
|
|
|
+ if (stdin_tmpfile)
|
|
|
|
|
+ remove_stdintmp();
|
|
|
|
|
+
|
|
|
|
|
if (!pause)
|
|
|
|
|
pause = found;
|
|
|
|
|
|
|
|
|
|
@@ -2925,13 +2997,13 @@ static int display_filesystem (struct ca
|
|
|
|
|
if (cat_file)
|
|
|
|
|
free (cat_file);
|
|
|
|
|
free (title);
|
|
|
|
|
-
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
/* If ult_src() produced a ztemp file, we need to remove it
|
|
|
|
|
* before proceeding.
|
|
|
|
|
*/
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
-#endif /* COMP_SRC */
|
|
|
|
|
+#endif /* COMP_SRC && !HAVE_ZIO */
|
|
|
|
|
|
|
|
|
|
return found;
|
|
|
|
|
}
|
|
|
|
|
@@ -3018,11 +3090,11 @@ static int display_database (struct cand
|
|
|
|
|
title, in->filter);
|
|
|
|
|
if (cat_file)
|
|
|
|
|
free (cat_file);
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
/* if ult_src() produced a ztemp file, we need to
|
|
|
|
|
remove it (and unexist it) before proceeding */
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
-#endif /* COMP_SRC */
|
|
|
|
|
+#endif /* COMP_SRC && !HAVE_ZIO */
|
|
|
|
|
|
|
|
|
|
} /* else {drop through to the bottom and return 0 anyway} */
|
|
|
|
|
} else
|
|
|
|
|
@@ -3099,8 +3171,8 @@ static int display_database_check (struc
|
|
|
|
|
#ifdef MAN_DB_UPDATES
|
|
|
|
|
if (!exists && !skip) {
|
|
|
|
|
if (debug)
|
|
|
|
|
- fprintf (stderr, "dbdelete_wrapper (%s, %p)\n",
|
|
|
|
|
- candp->req_name, candp->source);
|
|
|
|
|
+ fprintf (stderr, "dbdelete_wrapper (%s, %s)\n",
|
|
|
|
|
+ candp->req_name, candp->source->addr);
|
|
|
|
|
dbdelete_wrapper (candp->req_name, candp->source);
|
|
|
|
|
}
|
|
|
|
|
#endif /* MAN_DB_UPDATES */
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/man_db.conf.in
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/man_db.conf.in 2007-02-15 13:07:28.000000000 +0100
|
|
|
|
|
@@ -17,10 +17,17 @@
|
2006-12-19 00:17:06 +01:00
|
|
|
|
#
|
|
|
|
|
#MANDATORY_MANPATH /usr/src/pvm3/man
|
|
|
|
|
#
|
|
|
|
|
-MANDATORY_MANPATH /usr/man
|
|
|
|
|
MANDATORY_MANPATH /usr/share/man
|
2007-02-15 18:25:11 +01:00
|
|
|
|
-MANDATORY_MANPATH /usr/X11R6/man
|
2006-12-19 00:17:06 +01:00
|
|
|
|
MANDATORY_MANPATH /usr/local/man
|
|
|
|
|
+MANDATORY_MANPATH /usr/local/share/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/man
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDATORY_MANPATH /opt/dx/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/lsb/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/cross/share/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/mpich/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/lsb-tet3-lite/share/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/snavigator/man
|
|
|
|
|
+MANDATORY_MANPATH /opt/novell/man
|
2006-12-19 00:17:06 +01:00
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
# set up PATH to MANPATH mapping
|
|
|
|
|
# ie. what man tree holds man pages for what binary directory.
|
2007-02-15 18:25:11 +01:00
|
|
|
|
@@ -35,8 +42,10 @@ MANPATH_MAP /usr/local/bin /usr/local/m
|
|
|
|
|
MANPATH_MAP /usr/local/bin /usr/local/share/man
|
|
|
|
|
MANPATH_MAP /usr/local/sbin /usr/local/man
|
2006-12-19 00:17:06 +01:00
|
|
|
|
MANPATH_MAP /usr/local/sbin /usr/local/share/man
|
2007-02-15 18:25:11 +01:00
|
|
|
|
-MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
|
|
|
|
|
-MANPATH_MAP /usr/bin/X11 /usr/X11R6/man
|
|
|
|
|
+MANPATH_MAP /usr/X11R6/bin /usr/share/man
|
|
|
|
|
+MANPATH_MAP /usr/X11/bin /usr/share/man
|
|
|
|
|
+MANPATH_MAP /usr/bin/X11 /usr/share/man
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANPATH_MAP /usr/bin/mh /usr/share/man
|
|
|
|
|
MANPATH_MAP /usr/games /usr/share/man
|
|
|
|
|
MANPATH_MAP /opt/bin /opt/man
|
|
|
|
|
MANPATH_MAP /opt/sbin /opt/man
|
2007-02-15 18:25:11 +01:00
|
|
|
|
@@ -64,12 +73,133 @@ MANPATH_MAP /opt/sbin /opt/man
|
2006-12-19 00:17:06 +01:00
|
|
|
|
#
|
|
|
|
|
# *MANPATH* -> *CATPATH*
|
|
|
|
|
#
|
|
|
|
|
-MANDB_MAP /usr/man /var/cache/man/fsstnd
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/ca /var/cache/man/ca
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/cs /var/cache/man/cs
|
|
|
|
|
+MANDB_MAP /usr/share/man/cs_CZ /var/cache/man/cs
|
|
|
|
|
+MANDB_MAP /usr/share/man/da /var/cache/man/da
|
|
|
|
|
+MANDB_MAP /usr/share/man/de /var/cache/man/de
|
|
|
|
|
+MANDB_MAP /usr/share/man/de_AT /var/cache/man/de
|
|
|
|
|
+MANDB_MAP /usr/share/man/de_DE /var/cache/man/de
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/en /var/cache/man/en
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/es /var/cache/man/es
|
|
|
|
|
+MANDB_MAP /usr/share/man/es_ES /var/cache/man/es
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/et /var/cache/man/et
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/fi /var/cache/man/fi
|
|
|
|
|
+MANDB_MAP /usr/share/man/fr_FR /var/cache/man/fr
|
|
|
|
|
+MANDB_MAP /usr/share/man/ga /var/cache/man/ga
|
|
|
|
|
+MANDB_MAP /usr/share/man/is /var/cache/man/is
|
|
|
|
|
+MANDB_MAP /usr/share/man/it /var/cache/man/it
|
|
|
|
|
+MANDB_MAP /usr/share/man/ja /var/cache/man/ja
|
|
|
|
|
+MANDB_MAP /usr/share/man/ja_JP /var/cache/man/ja
|
|
|
|
|
+MANDB_MAP /usr/share/man/ja_JP.eucJP /var/cache/man/ja
|
|
|
|
|
+MANDB_MAP /usr/share/man/ko /var/cache/man/ko
|
|
|
|
|
+MANDB_MAP /usr/share/man/nl /var/cache/man/nl
|
|
|
|
|
+MANDB_MAP /usr/share/man/no /var/cache/man/no
|
|
|
|
|
+MANDB_MAP /usr/share/man/pl /var/cache/man/pl
|
|
|
|
|
+MANDB_MAP /usr/share/man/pt /var/cache/man/pt
|
|
|
|
|
+MANDB_MAP /usr/share/man/pt_BR /var/cache/man/pt
|
|
|
|
|
+MANDB_MAP /usr/share/man/ru /var/cache/man/ru
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/sk /var/cache/man/sk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/sr /var/cache/man/sr
|
|
|
|
|
+MANDB_MAP /usr/share/man/sv /var/cache/man/sv
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/share/man/uk /var/cache/man/uk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
MANDB_MAP /usr/share/man /var/cache/man
|
|
|
|
|
-MANDB_MAP /usr/local/man /var/cache/man/oldlocal
|
|
|
|
|
-MANDB_MAP /usr/local/share/man /var/cache/man/local
|
2007-02-15 18:25:11 +01:00
|
|
|
|
-MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6
|
|
|
|
|
-MANDB_MAP /opt/man /var/cache/man/opt
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+#
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/ca /var/cache/man/local/ca
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/cs /var/cache/man/local/cs
|
|
|
|
|
+MANDB_MAP /usr/local/man/cs_CZ /var/cache/man/local/cs
|
|
|
|
|
+MANDB_MAP /usr/local/man/da /var/cache/man/local/da
|
|
|
|
|
+MANDB_MAP /usr/local/man/de /var/cache/man/local/de
|
|
|
|
|
+MANDB_MAP /usr/local/man/de_AT /var/cache/man/local/de
|
|
|
|
|
+MANDB_MAP /usr/local/man/de_DE /var/cache/man/local/de
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/en /var/cache/man/local/en
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/es /var/cache/man/local/es
|
|
|
|
|
+MANDB_MAP /usr/local/man/es_ES /var/cache/man/local/es
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/et /var/cache/man/local/et
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/fi /var/cache/man/local/fi
|
|
|
|
|
+MANDB_MAP /usr/local/man/fr_FR /var/cache/man/local/fr
|
|
|
|
|
+MANDB_MAP /usr/local/man/ga /var/cache/man/local/ga
|
|
|
|
|
+MANDB_MAP /usr/local/man/is /var/cache/man/local/is
|
|
|
|
|
+MANDB_MAP /usr/local/man/it /var/cache/man/local/it
|
|
|
|
|
+MANDB_MAP /usr/local/man/ja /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/man/ja_JP /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/man/ja_JP.eucJP /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/man/ko /var/cache/man/local/ko
|
|
|
|
|
+MANDB_MAP /usr/local/man/nl /var/cache/man/local/nl
|
|
|
|
|
+MANDB_MAP /usr/local/man/no /var/cache/man/local/no
|
|
|
|
|
+MANDB_MAP /usr/local/man/pl /var/cache/man/local/pl
|
|
|
|
|
+MANDB_MAP /usr/local/man/pt /var/cache/man/local/pt
|
|
|
|
|
+MANDB_MAP /usr/local/man/pt_BR /var/cache/man/local/pt
|
|
|
|
|
+MANDB_MAP /usr/local/man/ru /var/cache/man/local/ru
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/sk /var/cache/man/local/sk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/sr /var/cache/man/local/sr
|
|
|
|
|
+MANDB_MAP /usr/local/man/sv /var/cache/man/local/sv
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man/uk /var/cache/man/local/uk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/man /var/cache/man/local
|
|
|
|
|
+#
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/ca /var/cache/man/local/ca
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/cs /var/cache/man/local/cs
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/cs_CZ /var/cache/man/local/cs
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/da /var/cache/man/local/da
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/de /var/cache/man/local/de
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/de_AT /var/cache/man/local/de
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/de_DE /var/cache/man/local/de
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/en /var/cache/man/local/en
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/es /var/cache/man/local/es
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/es_ES /var/cache/man/local/es
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/et /var/cache/man/local/et
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/fi /var/cache/man/local/fi
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/fr_FR /var/cache/man/local/fr
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ga /var/cache/man/local/ga
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/is /var/cache/man/local/is
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/it /var/cache/man/local/it
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ja /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ja_JP /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ja_JP.eucJP /var/cache/man/local/ja
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ko /var/cache/man/local/ko
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/nl /var/cache/man/local/nl
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/no /var/cache/man/local/no
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/pl /var/cache/man/local/pl
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/pt /var/cache/man/local/pt
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/pt_BR /var/cache/man/local/pt
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/ru /var/cache/man/local/ru
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/sk /var/cache/man/local/sk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/sr /var/cache/man/local/sr
|
|
|
|
|
+MANDB_MAP /usr/local/share/man/sv /var/cache/man/local/sv
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man/uk /var/cache/man/local/uk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /usr/local/share/man /var/cache/man/local
|
|
|
|
|
+#
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/ca /var/cache/man/opt/ca
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/cs /var/cache/man/opt/cs
|
|
|
|
|
+MANDB_MAP /opt/share/man/cs_CZ /var/cache/man/opt/cs
|
|
|
|
|
+MANDB_MAP /opt/share/man/da /var/cache/man/opt/da
|
|
|
|
|
+MANDB_MAP /opt/share/man/de /var/cache/man/opt/de
|
|
|
|
|
+MANDB_MAP /opt/share/man/de_AT /var/cache/man/opt/de
|
|
|
|
|
+MANDB_MAP /opt/share/man/de_DE /var/cache/man/opt/de
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/en /var/cache/man/opt/en
|
|
|
|
|
+MANDB_MAP /opt/share/man/es /var/cache/man/opt/es
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/es /var/cache/man/opt/es
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/et /var/cache/man/opt/et
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/fi /var/cache/man/opt/fi
|
|
|
|
|
+MANDB_MAP /opt/share/man/fr_FR /var/cache/man/opt/fr
|
|
|
|
|
+MANDB_MAP /opt/share/man/ga /var/cache/man/opt/ga
|
|
|
|
|
+MANDB_MAP /opt/share/man/is /var/cache/man/opt/is
|
|
|
|
|
+MANDB_MAP /opt/share/man/it /var/cache/man/opt/it
|
|
|
|
|
+MANDB_MAP /opt/share/man/ja /var/cache/man/opt/ja
|
|
|
|
|
+MANDB_MAP /opt/share/man/a_JP /var/cache/man/opt/ja
|
|
|
|
|
+MANDB_MAP /opt/share/man/ja_JP.eucJP /var/cache/man/opt/ja
|
|
|
|
|
+MANDB_MAP /opt/share/man/ko /var/cache/man/opt/ko
|
|
|
|
|
+MANDB_MAP /opt/share/man/nl /var/cache/man/opt/nl
|
|
|
|
|
+MANDB_MAP /opt/share/man/no /var/cache/man/opt/no
|
|
|
|
|
+MANDB_MAP /opt/share/man/pl /var/cache/man/opt/pl
|
|
|
|
|
+MANDB_MAP /opt/share/man/pt /var/cache/man/opt/pt
|
|
|
|
|
+MANDB_MAP /opt/share/man/pt_BR /var/cache/man/opt/pt
|
|
|
|
|
+MANDB_MAP /opt/share/man/ru /var/cache/man/opt/ru
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/sk /var/cache/man/opt/sk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/sr /var/cache/man/opt/sr
|
|
|
|
|
+MANDB_MAP /opt/share/man/sv /var/cache/man/opt/sv
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man/uk /var/cache/man/opt/uk
|
2006-12-19 00:17:06 +01:00
|
|
|
|
+MANDB_MAP /opt/share/man /var/cache/man/opt
|
|
|
|
|
#
|
|
|
|
|
#---------------------------------------------------------
|
|
|
|
|
# Program definitions. These are commented out by default as the value
|
2007-02-15 18:25:11 +01:00
|
|
|
|
@@ -81,7 +211,7 @@ MANDB_MAP /opt/man /var/cache/man/opt
|
2006-12-19 00:17:06 +01:00
|
|
|
|
#DEFINE tr @tr@ '\255\267\264\327' '\055\157\047\170'
|
|
|
|
|
#DEFINE grep @grep@
|
|
|
|
|
#DEFINE troff @troff@
|
|
|
|
|
-#DEFINE nroff @nroff@
|
|
|
|
|
+#DEFINE nroff /usr/bin/nroff -mandocdb
|
|
|
|
|
#DEFINE eqn @eqn@
|
|
|
|
|
#DEFINE neqn @neqn@
|
|
|
|
|
#DEFINE tbl @tbl@
|
2007-02-15 18:25:11 +01:00
|
|
|
|
@@ -109,4 +239,4 @@ MANDB_MAP /opt/man /var/cache/man/opt
|
2006-12-19 00:17:06 +01:00
|
|
|
|
# is that you only need to explicitly list extensions if you want to force a
|
|
|
|
|
# particular order. Sections with extensions should usually be adjacent to
|
|
|
|
|
# their main section (e.g. "1 1mh 8 ...").
|
|
|
|
|
-SECTION 1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+SECTION 0 1 n l 8 3 2 5 4 9 6 7 1x 3x 4x 5x 6x 8x 1bind 3bind 5bind 7bind 8bind 1cn 8cn 1m 1mh 5mh 8mh 1netpbm 3netpbm 5netpbm 0p 1p 3p 1pgsql 3C++ 3blt 3blt 3curses 3ncurses 3form 3menu 3db 3gdbm 3f 3gk 3mm 3paper 3perl 3pgsql 3pm 3posix 3pq 3qt 3pub 3readline 1ssl 3ssl 5ssl 7ssl 3t 3tk 3tcl 3tclx 3tix 5mm 5pgsql 7l 7nr 8C++ 8c Cg g s m
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/mandb.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/mandb.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -138,6 +138,8 @@ static char *xtmpfile;
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
extern uid_t ruid;
|
|
|
|
|
extern uid_t euid;
|
|
|
|
|
+extern gid_t rgid;
|
|
|
|
|
+extern gid_t egid;
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
extern char *optarg;
|
|
|
|
|
@@ -502,8 +504,14 @@ int main (int argc, char *argv[])
|
|
|
|
|
error (FAIL, 0,
|
|
|
|
|
_("the setuid man user \"%s\" does not exist"),
|
|
|
|
|
MAN_OWNER);
|
|
|
|
|
- if (!user && euid != 0 && euid != man_owner->pw_uid)
|
|
|
|
|
- user = 1;
|
|
|
|
|
+ if (!user) {
|
|
|
|
|
+ if (!ruid && euid != man_owner->pw_uid) {
|
|
|
|
|
+ seteuid(man_owner->pw_uid);
|
|
|
|
|
+ euid = geteuid();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (euid != man_owner->pw_uid)
|
|
|
|
|
+ user = 1;
|
|
|
|
|
+ }
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -579,7 +587,7 @@ int main (int argc, char *argv[])
|
|
|
|
|
if (!opt_test && amount_changed) {
|
|
|
|
|
finish_up ();
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
- if (global_manpath && euid == 0)
|
|
|
|
|
+ if (global_manpath && (euid == 0 || ruid == 0))
|
|
|
|
|
do_chown (man_owner->pw_uid);
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
} else
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/manp.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/manp.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -54,6 +54,7 @@
|
|
|
|
|
# include <strings.h>
|
|
|
|
|
#else /* no string(s) header */
|
|
|
|
|
extern char *strtok();
|
|
|
|
|
+extern char *strsep();
|
|
|
|
|
extern char *strchr();
|
|
|
|
|
extern char *strstr();
|
|
|
|
|
#endif
|
|
|
|
|
@@ -75,6 +76,7 @@ extern int errno;
|
|
|
|
|
#include "lib/getcwdalloc.h"
|
|
|
|
|
#include "security.h"
|
|
|
|
|
#include "manp.h"
|
|
|
|
|
+#include "security.h"
|
|
|
|
|
|
|
|
|
|
struct list {
|
|
|
|
|
char *key;
|
|
|
|
|
@@ -403,7 +405,7 @@ char *add_nls_manpath (char *manpathlist
|
|
|
|
|
fprintf (stderr, "add_nls_manpath(): processing %s\n",
|
|
|
|
|
manpathlist);
|
|
|
|
|
|
|
|
|
|
- if (locale == NULL || *locale == '\0' || *locale == 'C')
|
|
|
|
|
+ if (locale == NULL || *locale == '\0' || *locale == 'C' || (strcmp(locale, "POSIX") == 0))
|
|
|
|
|
return manpathlist;
|
|
|
|
|
|
|
|
|
|
temp_locale = xstrdup (locale);
|
|
|
|
|
@@ -411,7 +413,7 @@ char *add_nls_manpath (char *manpathlist
|
|
|
|
|
for (path = strsep (&manpathlist_ptr, ":"); path;
|
|
|
|
|
path = strsep (&manpathlist_ptr, ":") ) {
|
|
|
|
|
|
|
|
|
|
- static char locale_delims[] = "@,._";
|
|
|
|
|
+ static char locale_delims[] = ":@,._";
|
|
|
|
|
char *delim, *tempo;
|
|
|
|
|
char *testpath;
|
|
|
|
|
|
|
|
|
|
@@ -423,7 +425,7 @@ char *add_nls_manpath (char *manpathlist
|
|
|
|
|
free (testpath);
|
|
|
|
|
}
|
|
|
|
|
for (delim = locale_delims; *delim != '\0'; ++delim) {
|
|
|
|
|
- tempo = strchr (temp_locale, *delim);
|
|
|
|
|
+ tempo = strrchr (temp_locale, *delim);
|
|
|
|
|
if (tempo) {
|
|
|
|
|
/* Strip out the rest of the line */
|
|
|
|
|
*tempo = '\0';
|
|
|
|
|
@@ -633,6 +635,8 @@ char *manpath (const char *systems)
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
extern uid_t ruid; /* initial real user id */
|
|
|
|
|
extern uid_t euid; /* initial effective user id */
|
|
|
|
|
+extern gid_t rgid; /* initial real group id */
|
|
|
|
|
+extern gid_t egid; /* initial effective group id */
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
|
|
|
|
|
/* create the catman hierarchy if it doesn't exist */
|
|
|
|
|
@@ -664,6 +668,8 @@ mkcatdirs (const char *mandir, const cha
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
if (ruid == 0)
|
|
|
|
|
chown (catdir, man_owner->pw_uid, 0);
|
|
|
|
|
+ if (rgid == 0)
|
|
|
|
|
+ chown (catdir, -1, man_owner->pw_gid);
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
drop_effective_privs ();
|
|
|
|
|
}
|
|
|
|
|
@@ -677,9 +683,14 @@ mkcatdirs (const char *mandir, const cha
|
|
|
|
|
fprintf (stderr,
|
|
|
|
|
"creating catdir hierarchy %s ",
|
|
|
|
|
catdir);
|
|
|
|
|
- for (j = 1; j <= 9; j++) {
|
|
|
|
|
- catname[strlen (catname) - 1] = '0' + j;
|
|
|
|
|
- manname[strlen (manname) - 1] = '0' + j;
|
|
|
|
|
+ for (j = 0; j <= 10; j++) {
|
|
|
|
|
+ unsigned int c;
|
|
|
|
|
+ if (j < 10)
|
|
|
|
|
+ c = '0' + j;
|
|
|
|
|
+ else
|
|
|
|
|
+ c = 'n';
|
|
|
|
|
+ catname[strlen (catname) - 1] = c;
|
|
|
|
|
+ manname[strlen (manname) - 1] = c;
|
|
|
|
|
if ((is_directory (manname) == 1)
|
|
|
|
|
&& (is_directory (catname) != 1)) {
|
|
|
|
|
if (mkdir (catname,
|
|
|
|
|
@@ -689,11 +700,12 @@ mkcatdirs (const char *mandir, const cha
|
|
|
|
|
if (debug)
|
|
|
|
|
fprintf (stderr, "warning: cannot create catdir %s\n", catname);
|
|
|
|
|
} else if (debug)
|
|
|
|
|
- fprintf (stderr, " cat%d", j);
|
|
|
|
|
+ fprintf (stderr, " cat%c", c);
|
|
|
|
|
#ifdef SECURE_MAN_UID
|
|
|
|
|
if (ruid == 0)
|
|
|
|
|
- chown (catname,
|
|
|
|
|
- man_owner->pw_uid, 0);
|
|
|
|
|
+ chown (catname, man_owner->pw_uid, 0);
|
|
|
|
|
+ if (rgid == 0)
|
|
|
|
|
+ chown (catdir, -1, man_owner->pw_gid);
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -819,7 +831,7 @@ static char *def_path (int flag)
|
|
|
|
|
|
|
|
|
|
/* If we have complete config file failure... */
|
|
|
|
|
if (!manpath)
|
|
|
|
|
- return xstrdup ("/usr/man");
|
|
|
|
|
+ return xstrdup ("/usr/share/man");
|
|
|
|
|
|
|
|
|
|
return manpath;
|
|
|
|
|
}
|
|
|
|
|
@@ -1095,16 +1107,18 @@ char *get_catpath (const char *name, int
|
|
|
|
|
|
|
|
|
|
if (*suffix == '/') {
|
|
|
|
|
++suffix;
|
|
|
|
|
- catpath = strappend (catpath, "/",
|
|
|
|
|
- NULL);
|
|
|
|
|
+ catpath = strappend (catpath, "/", NULL);
|
|
|
|
|
}
|
|
|
|
|
if (STRNEQ (suffix, "man", 3)) {
|
|
|
|
|
suffix += 3;
|
|
|
|
|
- catpath = strappend (catpath, "cat",
|
|
|
|
|
- NULL);
|
|
|
|
|
+ catpath = strappend (catpath, "cat", NULL);
|
|
|
|
|
}
|
|
|
|
|
catpath = strappend (catpath, suffix, NULL);
|
|
|
|
|
- return catpath;
|
|
|
|
|
+
|
|
|
|
|
+ if (is_directory (catpath) == 1)
|
|
|
|
|
+ return catpath;
|
|
|
|
|
+ else
|
|
|
|
|
+ free (catpath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/security.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/security.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -87,10 +87,13 @@ extern int errno;
|
|
|
|
|
# ifdef POSIX_SAVED_IDS
|
|
|
|
|
# if defined (HAVE_SETEUID)
|
|
|
|
|
# define SET_EUID(euid) seteuid(euid)
|
|
|
|
|
+# define SET_EGID(egid) setegid(egid)
|
|
|
|
|
# elif defined (HAVE_SETREUID)
|
|
|
|
|
# define SET_EUID(euid) setreuid(-1, euid)
|
|
|
|
|
+# define SET_EGID(egid) setregid(-1, egid)
|
|
|
|
|
# elif defined (HAVE_SETRESUID)
|
|
|
|
|
# define SET_EUID(euid) setresuid(-1, euid, -1)
|
|
|
|
|
+# define SET_EGID(egid) setresgid(-1, egid, -1)
|
|
|
|
|
# endif /* HAVE_SETEUID */
|
|
|
|
|
|
|
|
|
|
/* Sort out the function to use to swap ruid with euid. Used if no suid. */
|
|
|
|
|
@@ -98,8 +101,10 @@ extern int errno;
|
|
|
|
|
# else /* !POSIX_SAVED_IDS */
|
|
|
|
|
# if defined (HAVE_SETREUID)
|
|
|
|
|
# define SWAP_UIDS(ida, idb) setreuid(idb, ida)
|
|
|
|
|
+# define SWAP_GIDS(ida, idb) setregid(idb, ida)
|
|
|
|
|
# elif defined (HAVE_SETRESUID)
|
|
|
|
|
# define SWAP_UIDS(ida, idb) setresuid(idb, ida, -1)
|
|
|
|
|
+# define SWAP_GIDS(ida, idb) setresgid(idb, ida, -1)
|
|
|
|
|
# warning Using setresuid() whithout _POSIX_SAVED_IDS!
|
|
|
|
|
# endif /* HAVE_SETREUID */
|
|
|
|
|
# endif /* POSIX_SAVED_IDS */
|
|
|
|
|
@@ -111,7 +116,10 @@ extern int errno;
|
|
|
|
|
|
|
|
|
|
uid_t ruid; /* initial real user id */
|
|
|
|
|
uid_t euid; /* initial effective user id */
|
|
|
|
|
+gid_t rgid; /* initial real group id */
|
|
|
|
|
+gid_t egid; /* initial effective group id */
|
|
|
|
|
uid_t uid; /* current euid */
|
|
|
|
|
+gid_t gid; /* current egid */
|
|
|
|
|
|
|
|
|
|
static struct passwd *man_owner;
|
|
|
|
|
|
|
|
|
|
@@ -125,10 +133,17 @@ static __inline__ void gripe_set_euid (v
|
|
|
|
|
error (FATAL, errno, _("can't set effective uid"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+static __inline__ void gripe_set_egid ()
|
|
|
|
|
+{
|
|
|
|
|
+ error (FATAL, errno, _( "can't set effective gid"));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
void init_security (void)
|
|
|
|
|
{
|
|
|
|
|
ruid = getuid ();
|
|
|
|
|
+ rgid = getgid ();
|
|
|
|
|
uid = euid = geteuid ();
|
|
|
|
|
+ gid = egid = getegid ();
|
|
|
|
|
if (debug)
|
|
|
|
|
fprintf (stderr, "ruid=%d, euid=%d\n", (int) ruid, (int) euid);
|
|
|
|
|
priv_drop_count = 0;
|
|
|
|
|
@@ -208,6 +223,28 @@ void regain_effective_privs (void)
|
|
|
|
|
|
|
|
|
|
uid = euid;
|
|
|
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (gid != rgid) {
|
|
|
|
|
+# ifdef POSIX_SAVED_IDS
|
|
|
|
|
+ if (SET_EGID (rgid))
|
|
|
|
|
+# else
|
|
|
|
|
+ if (SWAP_GIDS (egid, rgid))
|
|
|
|
|
+# endif
|
|
|
|
|
+ gripe_set_egid();
|
|
|
|
|
+
|
|
|
|
|
+ gid = rgid;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (gid != egid) {
|
|
|
|
|
+# ifdef POSIX_SAVED_IDS
|
|
|
|
|
+ if (SET_EGID (egid))
|
|
|
|
|
+# else
|
|
|
|
|
+ if (SWAP_GIDS (rgid, egid))
|
|
|
|
|
+# endif
|
|
|
|
|
+ gripe_set_egid();
|
|
|
|
|
+
|
|
|
|
|
+ gid = egid;
|
|
|
|
|
+ }
|
|
|
|
|
#endif /* SECURE_MAN_UID */
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/straycats.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/straycats.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -48,6 +48,7 @@ extern char *strrchr();
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
+#include <fcntl.h>
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_UNISTD_H)
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
@@ -92,8 +93,8 @@ extern char *canonicalize_file_name __P
|
|
|
|
|
#include "manp.h"
|
|
|
|
|
#include "security.h"
|
|
|
|
|
|
|
|
|
|
-static char *temp_name;
|
|
|
|
|
-static char *catdir, *mandir;
|
|
|
|
|
+static char *temp_name = NULL;
|
|
|
|
|
+static char *catdir = NULL, *mandir = NULL;
|
|
|
|
|
|
|
|
|
|
static int check_for_stray (void)
|
|
|
|
|
{
|
|
|
|
|
@@ -101,12 +102,6 @@ static int check_for_stray (void)
|
|
|
|
|
struct dirent *catlist;
|
|
|
|
|
size_t lenman, lencat;
|
|
|
|
|
int strays = 0;
|
|
|
|
|
-#ifdef HAVE_CANONICALIZE_FILE_NAME
|
|
|
|
|
- /* no PATH_MAX then */
|
|
|
|
|
- char *fullpath;
|
|
|
|
|
-#else
|
|
|
|
|
- char fullpath[PATH_MAX];
|
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
|
cdir = opendir (catdir);
|
|
|
|
|
if (!cdir) {
|
|
|
|
|
@@ -198,6 +193,11 @@ static int check_for_stray (void)
|
|
|
|
|
found = 0;
|
|
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
|
+#ifdef HAVE_CANONICALIZE_FILE_NAME
|
|
|
|
|
+ char *fullpath; /* no PATH_MAX then */
|
|
|
|
|
+#else
|
|
|
|
|
+ char fullpath[PATH_MAX];
|
|
|
|
|
+#endif
|
|
|
|
|
pipeline *filter;
|
|
|
|
|
struct mandata *exists;
|
|
|
|
|
lexgrog lg;
|
|
|
|
|
@@ -306,7 +306,8 @@ static int check_for_stray (void)
|
|
|
|
|
char *filter_str =
|
|
|
|
|
pipeline_tostring (filter);
|
|
|
|
|
remove_with_dropped_privs (temp_name);
|
|
|
|
|
- perror (filter_str);
|
|
|
|
|
+ if (debug)
|
|
|
|
|
+ perror (filter_str);
|
|
|
|
|
free (filter_str);
|
|
|
|
|
} else {
|
|
|
|
|
struct page_description *descs;
|
|
|
|
|
@@ -338,8 +339,11 @@ static int check_for_stray (void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- pipeline_free (filter);
|
|
|
|
|
- free (mandir_copy);
|
|
|
|
|
+ if (filter)
|
|
|
|
|
+ pipeline_free (filter);
|
|
|
|
|
+
|
|
|
|
|
+ if (mandir_copy)
|
|
|
|
|
+ free (mandir_copy);
|
|
|
|
|
|
|
|
|
|
if (lg.whatis)
|
|
|
|
|
free (lg.whatis);
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/ult_src.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/ult_src.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -37,6 +37,9 @@
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+# include <zio.h>
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
#ifndef STDC_HEADERS
|
|
|
|
|
extern int errno;
|
|
|
|
|
@@ -229,7 +232,7 @@ const char *ult_src (const char *name, c
|
|
|
|
|
struct stat *buf, int flags)
|
|
|
|
|
{
|
|
|
|
|
static char *basename; /* must be static */
|
|
|
|
|
- static short recurse; /* must be static */
|
|
|
|
|
+ static short recurse = 0; /* must be static */
|
|
|
|
|
|
|
|
|
|
/* initialise the function */
|
|
|
|
|
|
|
|
|
|
@@ -297,10 +300,10 @@ const char *ult_src (const char *name, c
|
|
|
|
|
FILE *fp;
|
|
|
|
|
#ifdef COMP_SRC
|
|
|
|
|
struct compression *comp;
|
|
|
|
|
-
|
|
|
|
|
+# ifndef HAVE_ZIO
|
|
|
|
|
/* get rid of the previous ztemp file (if any) */
|
|
|
|
|
remove_ztemp ();
|
|
|
|
|
-
|
|
|
|
|
+# endif
|
|
|
|
|
/* if we are handed the name of a compressed file, remove
|
|
|
|
|
the compression extension? */
|
|
|
|
|
comp = comp_info (basename, 1);
|
|
|
|
|
@@ -309,7 +312,7 @@ const char *ult_src (const char *name, c
|
|
|
|
|
basename = comp->stem;
|
|
|
|
|
comp->stem = NULL; /* steal memory */
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
+# ifndef HAVE_ZIO
|
|
|
|
|
/* if the open fails, try looking for compressed */
|
|
|
|
|
fp = fopen (basename, "r");
|
|
|
|
|
if (fp == NULL) {
|
|
|
|
|
@@ -334,6 +337,21 @@ const char *ult_src (const char *name, c
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
+# else
|
|
|
|
|
+ if ((comp = comp_file(basename))) {
|
|
|
|
|
+ free(comp->stem);
|
|
|
|
|
+ basename = strappend (basename, ".", comp->ext, NULL);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ drop_effective_privs ();
|
|
|
|
|
+ fp = fzopen(basename, "r");
|
|
|
|
|
+ regain_effective_privs ();
|
|
|
|
|
+
|
|
|
|
|
+ if (fp == NULL) {
|
|
|
|
|
+ error (0, errno, _( "can't open %s"), basename);
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+# endif
|
|
|
|
|
#else
|
|
|
|
|
fp = fopen (basename, "r");
|
|
|
|
|
if (fp == NULL) {
|
|
|
|
|
@@ -341,18 +359,35 @@ const char *ult_src (const char *name, c
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
- /* make sure that we skip over any comments */
|
|
|
|
|
+ /*
|
|
|
|
|
+ * make sure that we skip over any comments
|
|
|
|
|
+ * ... even if we handle TCL/TK manual pages
|
|
|
|
|
+ */
|
|
|
|
|
do {
|
|
|
|
|
bptr = fgets (buffer, 1024, fp);
|
|
|
|
|
- } while (bptr && STRNEQ (buffer, ".\\\"", 3));
|
|
|
|
|
-
|
|
|
|
|
+ } while (bptr && *bptr &&
|
|
|
|
|
+ (STRNEQ (buffer, ".\\\"", 3) ||
|
|
|
|
|
+ STRNEQ (buffer, "'\\\"", 3)
|
|
|
|
|
+ ));
|
|
|
|
|
+
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Isn't very useful to close it now ... maybe we need it
|
|
|
|
|
+ * later for further handling.
|
|
|
|
|
+ */
|
|
|
|
|
+ if (!(flags & WHATISBUF))
|
|
|
|
|
+#endif
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
- if (buffer) {
|
|
|
|
|
+ if (bptr && *bptr) {
|
|
|
|
|
char *include = test_for_include (buffer);
|
|
|
|
|
if (include) {
|
|
|
|
|
const char *ult;
|
|
|
|
|
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ if (flags & WHATISBUF) /* not needed */
|
|
|
|
|
+ fclose(fp);
|
|
|
|
|
+#endif
|
|
|
|
|
/* Restore the original path from before
|
|
|
|
|
* ult_softlink() etc., in case it went
|
|
|
|
|
* outside the mantree.
|
|
|
|
|
@@ -373,7 +408,32 @@ const char *ult_src (const char *name, c
|
|
|
|
|
|
|
|
|
|
return ult;
|
|
|
|
|
}
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ else if (flags & WHATISBUF) {
|
|
|
|
|
+ char whatis[8192], *w;
|
|
|
|
|
+ int len = 0;
|
|
|
|
|
+
|
|
|
|
|
+ while (bptr && *bptr && !(strncasecmp(buffer, ".SH", 3) == 0 ||
|
|
|
|
|
+ strncasecmp(buffer, ".SS", 3) == 0 ||
|
|
|
|
|
+ strncasecmp(buffer, ".SY", 3) == 0))
|
|
|
|
|
+ bptr = fgets(buffer, 1024, fp);
|
|
|
|
|
+
|
|
|
|
|
+ w = strcpy(whatis, buffer);
|
|
|
|
|
+ len = strlen(whatis);
|
|
|
|
|
+ w += len;
|
|
|
|
|
+
|
|
|
|
|
+ if ((len = fread(w, (8192 - len), sizeof(char), fp)) > 0) {
|
|
|
|
|
+ whatis[sizeof(whatis)-1] = '\0';
|
|
|
|
|
+ }
|
|
|
|
|
+ set_wbuf(whatis);
|
|
|
|
|
+ }
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
+#if defined(COMP_SRC) && defined(HAVE_ZIO)
|
|
|
|
|
+ /* Now we've handled whatis, close the manual page */
|
|
|
|
|
+ if (flags & WHATISBUF)
|
|
|
|
|
+ fclose(fp);
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We have the ultimate source */
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/ult_src.h
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/ult_src.h 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -21,9 +21,10 @@
|
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
-#define SO_LINK 0001
|
|
|
|
|
-#define SOFT_LINK 0002
|
|
|
|
|
-#define HARD_LINK 0004
|
|
|
|
|
+#define SO_LINK 0x0001
|
|
|
|
|
+#define SOFT_LINK 0x0002
|
|
|
|
|
+#define HARD_LINK 0x0004
|
|
|
|
|
+#define WHATISBUF 0x0008
|
|
|
|
|
|
|
|
|
|
extern const char *ult_src (const char *name, const char *path,
|
|
|
|
|
struct stat *buf, int flags);
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/util.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/util.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -58,6 +58,9 @@ extern char *strcpy();
|
|
|
|
|
# include <unistd.h>
|
|
|
|
|
#endif /* HAVE_UNISTD_H */
|
|
|
|
|
|
|
|
|
|
+#include <libintl.h>
|
|
|
|
|
+#define _(String) gettext (String)
|
|
|
|
|
+
|
|
|
|
|
#include "manconfig.h"
|
|
|
|
|
#include "libdb/mydbm.h" /* for full definition of MAN_DB */
|
|
|
|
|
#include "lib/pipeline.h"
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- src/wrapper.c
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ src/wrapper.c 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -25,6 +25,7 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
+#include <grp.h>
|
|
|
|
|
#include <pwd.h>
|
|
|
|
|
#include <grp.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
@@ -51,7 +52,7 @@
|
|
|
|
|
* it is fixed at compile time to avoid a full class of
|
|
|
|
|
* dangers ...
|
|
|
|
|
*/
|
|
|
|
|
-struct {
|
|
|
|
|
+static struct {
|
|
|
|
|
const char *prog;
|
|
|
|
|
const char *run;
|
|
|
|
|
const char *user;
|
|
|
|
|
@@ -65,12 +66,13 @@ struct {
|
|
|
|
|
{ "mandb", "/usr/lib/man-db/mandb", "man" },
|
|
|
|
|
{ 0, 0, 0, }};
|
|
|
|
|
|
|
|
|
|
-char *program_name;
|
|
|
|
|
+static char *program_name;
|
|
|
|
|
|
|
|
|
|
-int main (int argc, char **argv)
|
|
|
|
|
+int main (int argc, char *argv[], char *envp[])
|
|
|
|
|
{
|
|
|
|
|
- uid_t ruid;
|
|
|
|
|
- char *fakeroot;
|
|
|
|
|
+ uid_t ruid, euid;
|
|
|
|
|
+ gid_t rgid;
|
|
|
|
|
+// char *fakeroot;
|
|
|
|
|
char *p;
|
|
|
|
|
struct passwd *pwd;
|
|
|
|
|
|
|
|
|
|
@@ -88,57 +90,49 @@ int main (int argc, char **argv)
|
|
|
|
|
program_name = (p ? ++p : argv[0]);
|
|
|
|
|
|
|
|
|
|
ruid = getuid ();
|
|
|
|
|
- fakeroot = getenv ("FAKEROOTKEY");
|
|
|
|
|
+ euid = geteuid();
|
|
|
|
|
+ rgid = getgid ();
|
|
|
|
|
+// fakeroot = getenv ("FAKEROOTKEY");
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
printf ("%s:\n", program_name);
|
|
|
|
|
- printf ("real = %d, = %d, fakeroot = %d\n",
|
|
|
|
|
- (int) ruid, (fakeroot != 0));
|
|
|
|
|
+// printf ("real = %d, = %d, fakeroot = %d\n", (int) ruid, (fakeroot != 0));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
- for (wlp = wrapped_list; wlp->prog && strcmp (program_name, wlp->prog);
|
|
|
|
|
- ++wlp)
|
|
|
|
|
- ;
|
|
|
|
|
+ for (wlp = wrapped_list; wlp->prog && strcmp (program_name, wlp->prog); ++wlp)
|
|
|
|
|
+ /* __asm__ __volatile__("": : :"memory") */;
|
|
|
|
|
if (!wlp->prog) {
|
|
|
|
|
fprintf (stderr, _("Don't know which program should I run being >%s<\n"),
|
|
|
|
|
program_name);
|
|
|
|
|
return -ENOENT;
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
- if (!fakeroot && ruid == 0) {
|
|
|
|
|
+#ifdef DEBUG
|
|
|
|
|
+ printf ("%s\n", wlp->run);
|
|
|
|
|
+#endif
|
|
|
|
|
+ if (/* !fakeroot && */ (ruid == 0 || euid == 0)) {
|
|
|
|
|
pwd = getpwnam (wlp->user);
|
|
|
|
|
- /*
|
|
|
|
|
- if (!pwd
|
|
|
|
|
- || setgid (pwd->pw_gid)
|
|
|
|
|
- || initgroups (wlp->user, pwd->pw_gid)
|
|
|
|
|
- || setuid (pwd->pw_uid)) {
|
|
|
|
|
- fprintf (stderr, _("%s: Failed su to user %s\n"),
|
|
|
|
|
- wlp->prog, wlp->user);
|
|
|
|
|
- return -EACCES;
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
if (!pwd) {
|
|
|
|
|
- fprintf (stderr, _("%s: Failed su to user %s\n"),
|
|
|
|
|
- wlp->prog, wlp->user);
|
|
|
|
|
+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user);
|
|
|
|
|
return -EACCES;
|
|
|
|
|
}
|
|
|
|
|
- if (setgid (pwd->pw_gid)) {
|
|
|
|
|
- fprintf (stderr, _("%s: Failed su to user %s\n"),
|
|
|
|
|
- wlp->prog, wlp->user);
|
|
|
|
|
+ if (ruid == 0) {
|
|
|
|
|
+ ruid = pwd->pw_uid;
|
|
|
|
|
+ rgid = pwd->pw_gid;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (setregid (rgid, pwd->pw_gid)) {
|
|
|
|
|
+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user);
|
|
|
|
|
return -EACCES;
|
|
|
|
|
}
|
|
|
|
|
- if (initgroups (wlp->user, pwd->pw_gid)) {
|
|
|
|
|
- fprintf (stderr, _("%s: Failed su to user %s\n"),
|
|
|
|
|
- wlp->prog, wlp->user);
|
|
|
|
|
+ if (initgroups (wlp->user, rgid)) {
|
|
|
|
|
+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user);
|
|
|
|
|
return -EACCES;
|
|
|
|
|
}
|
|
|
|
|
- if (setuid (pwd->pw_uid)) {
|
|
|
|
|
- fprintf (stderr, _("%s: Failed su to user %s\n"),
|
|
|
|
|
- wlp->prog, wlp->user);
|
|
|
|
|
+ if (setreuid (ruid, pwd->pw_uid)) {
|
|
|
|
|
+ fprintf (stderr, _("%s: Failed su to user %s\n"), wlp->prog, wlp->user);
|
|
|
|
|
return -EACCES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
- execv (wlp->run, argv);
|
|
|
|
|
- perror ("execv");
|
|
|
|
|
+ execve (wlp->run, argv, envp);
|
|
|
|
|
+ perror ("execve");
|
|
|
|
|
return -errno;
|
|
|
|
|
}
|
2007-02-09 16:58:14 +01:00
|
|
|
|
--- zsoelim/zsoelim.l
|
2007-02-15 18:25:11 +01:00
|
|
|
|
+++ zsoelim/zsoelim.l 2007-02-15 00:00:00.000000000 +0100
|
2006-12-19 00:17:06 +01:00
|
|
|
|
@@ -31,8 +31,20 @@
|
|
|
|
|
* - added changes that were done to .c instead of -l source
|
|
|
|
|
* - added new start condition to avoid execution of .so requests
|
|
|
|
|
* inside a macro definition.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Fri Jun 4 18:18:34 CEST 1999 Werner Fink <werner@suse.de>
|
|
|
|
|
+ * - Create temporary file exclusive before decompresion
|
|
|
|
|
+ *
|
|
|
|
|
+ * Wed Jun 30 21:46:20 CEST 1999 Werner Fink <werner@suse.de>
|
|
|
|
|
+ * - Use cleanup functions, kill possible childs to close all
|
|
|
|
|
+ * open file handles of our temporary files.
|
|
|
|
|
+ * - Use fopencookie combined with zlib and a workaround to
|
|
|
|
|
+ * make cookie_close_function working.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Wed Apr 21 15:00:21 CEST 2004 Werner Fink <werner@suse.de>
|
|
|
|
|
+ * - Use libzio together with libz and libbz2
|
|
|
|
|
+ *
|
|
|
|
|
*/
|
|
|
|
|
-
|
|
|
|
|
#define MAX_SO_DEPTH 10 /* max .so recursion depth */
|
|
|
|
|
#undef ACCEPT_QUOTES /* accept quoted roff requests */
|
|
|
|
|
|
|
|
|
|
@@ -60,6 +72,7 @@ extern int strncmp();
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
+#include <signal.h>
|
|
|
|
|
|
|
|
|
|
#ifndef STDC_HEADERS
|
|
|
|
|
extern int errno;
|
|
|
|
|
@@ -88,8 +101,12 @@ extern int errno;
|
|
|
|
|
#endif /* HAVE_GETOPT_H */
|
|
|
|
|
|
|
|
|
|
#ifdef COMP_SRC
|
|
|
|
|
-#include "comp_src.h"
|
|
|
|
|
+# ifdef HAVE_ZIO
|
|
|
|
|
+# include <zio.h>
|
|
|
|
|
+# else
|
|
|
|
|
static char* so_delete[MAX_SO_DEPTH];
|
|
|
|
|
+# endif
|
|
|
|
|
+# include "comp_src.h"
|
|
|
|
|
#endif /* COMP_SRC */
|
|
|
|
|
|
|
|
|
|
static int open_file (char *filename);
|
|
|
|
|
@@ -284,9 +301,13 @@ W [ \t]
|
|
|
|
|
<<EOF>> {
|
|
|
|
|
fclose (yyin);
|
|
|
|
|
|
|
|
|
|
-#ifdef COMP_SRC
|
|
|
|
|
- if (so_delete[so_stack_ptr])
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
+ if (so_delete[so_stack_ptr]) {
|
|
|
|
|
remove (so_delete[so_stack_ptr]);
|
|
|
|
|
+ pop_cleanup();
|
|
|
|
|
+ /* was allocated by tempnam */
|
|
|
|
|
+ free(so_delete[so_stack_ptr]);
|
|
|
|
|
+ }
|
|
|
|
|
#endif
|
|
|
|
|
if (no_newline)
|
|
|
|
|
putchar ('\n');
|
|
|
|
|
@@ -346,6 +367,19 @@ static void parse_file (void)
|
|
|
|
|
yylex ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if defined(COMP_SRC) && !defined(HAVE_ZIO)
|
|
|
|
|
+static int do_emergency_unlink(const char* filename)
|
|
|
|
|
+{
|
|
|
|
|
+ /* kill pending childs because unlink only
|
|
|
|
|
+ works if no processes have the file open */
|
|
|
|
|
+ if ( setpgrp() == 0 ) {
|
|
|
|
|
+ signal(SIGHUP, SIG_IGN);
|
|
|
|
|
+ kill(-getpid(), SIGHUP);
|
|
|
|
|
+ }
|
|
|
|
|
+ return unlink (filename);
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
int c, option_index;
|
|
|
|
|
@@ -382,6 +416,7 @@ int main (int argc, char *argv[])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ pop_all_cleanups();
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -446,6 +481,7 @@ static int open_file (char *filename)
|
|
|
|
|
compfile = filename;
|
|
|
|
|
|
|
|
|
|
if (comp->ext) {
|
|
|
|
|
+#ifndef HAVE_ZIO
|
|
|
|
|
command *decompress_cmd;
|
|
|
|
|
pipeline *decompress;
|
|
|
|
|
int exit_status;
|
|
|
|
|
@@ -459,8 +495,13 @@ static int open_file (char *filename)
|
|
|
|
|
decompress = pipeline_new_commands
|
|
|
|
|
(decompress_cmd, NULL);
|
|
|
|
|
decompress->want_out = file_fd;
|
|
|
|
|
+
|
|
|
|
|
+ so_delete[so_stack_ptr] = filename;
|
|
|
|
|
+ push_cleanup ((void (*)())do_emergency_unlink, filename);
|
|
|
|
|
+
|
|
|
|
|
pipeline_start (decompress);
|
|
|
|
|
exit_status = pipeline_wait (decompress);
|
|
|
|
|
+
|
|
|
|
|
close (file_fd);
|
|
|
|
|
|
|
|
|
|
if (exit_status != 0) {
|
|
|
|
|
@@ -483,8 +524,14 @@ static int open_file (char *filename)
|
|
|
|
|
yyin = oldyyin;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
- so_delete[so_stack_ptr] = filename;
|
|
|
|
|
+#else /* HAVE_ZIO */
|
|
|
|
|
+ if ( !(yyin = fzopen(compfile, "r")) ) {
|
|
|
|
|
+ error (0, errno, "open compressed stream: %s",
|
|
|
|
|
+ compfile);
|
|
|
|
|
+ yyin = oldyyin;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
+#endif /* HAVE_ZIO */
|
|
|
|
|
NAME = compfile;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|