From b0f66028a9a17a845590a4fe737a4f5e46f6b778 Mon Sep 17 00:00:00 2001 From: mdw Date: Sat, 29 Nov 2003 23:47:33 +0000 Subject: [PATCH] Debianization. --- .cvsignore | 2 ++ Makefile.am | 7 ++++- acconfig.h | 10 +++++-- conf/Makefile.am | 16 +++++++---- configure.in | 19 ++++++++++-- debian/.cvsignore | 2 ++ debian/become-doc.doc-base | 13 +++++++++ debian/become.config | 18 ++++++++++++ debian/become.init | 63 ++++++++++++++++++++++++++++++++++++++++ debian/become.postinst | 40 ++++++++++++++++++++++++++ debian/become.postrm | 14 +++++++++ debian/become.templates | 18 ++++++++++++ debian/changelog | 5 ++++ debian/control | 43 +++++++++++++++++++++++++++ debian/copyright | 16 +++++++++++ debian/rules | 72 ++++++++++++++++++++++++++++++++++++++++++++++ manual/Makefile.am | 9 ++++-- manual/become.texi | 12 ++++++-- src/bcquery.c | 9 ++++-- src/become.c | 7 +++-- src/become.h | 7 +++++ src/check.c | 7 +++-- src/daemon.c | 14 +++++---- 23 files changed, 395 insertions(+), 28 deletions(-) create mode 100644 debian/.cvsignore create mode 100644 debian/become-doc.doc-base create mode 100644 debian/become.config create mode 100755 debian/become.init create mode 100644 debian/become.postinst create mode 100644 debian/become.postrm create mode 100644 debian/become.templates create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules diff --git a/.cvsignore b/.cvsignore index ac43b98..5ba8600 100644 --- a/.cvsignore +++ b/.cvsignore @@ -17,3 +17,5 @@ sgi stamp-h.in sun test +deb-build +deb-nonet diff --git a/Makefile.am b/Makefile.am index e3ce1c3..828b3c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with `automake' to generate `Makefile.in' ## -*-makefile-*- ## -## $Id: Makefile.am,v 1.3 1998/01/12 16:45:19 mdw Exp $ +## $Id: Makefile.am,v 1.4 2003/11/29 23:39:16 mdw Exp $ ## ## Makefile for `become' ## @@ -29,6 +29,9 @@ ##----- Revision history ---------------------------------------------------- ## ## $Log: Makefile.am,v $ +## Revision 1.4 2003/11/29 23:39:16 mdw +## Debianization. +## ## Revision 1.3 1998/01/12 16:45:19 mdw ## Fix copyright date. ## @@ -44,4 +47,6 @@ AUTOMAKE_OPTIONS = foreign SUBDIRS = src manual conf +EXTRA_DIST = debian/rules debian/copyright debian/control debian/changelog + ##----- That's all, folks --------------------------------------------------- diff --git a/acconfig.h b/acconfig.h index b6fe638..09e9813 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: acconfig.h,v 1.10 2003/10/12 00:14:44 mdw Exp $ + * $Id: acconfig.h,v 1.11 2003/11/29 23:39:16 mdw Exp $ * * Default settings for `become' config.h * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: acconfig.h,v $ + * Revision 1.11 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.10 2003/10/12 00:14:44 mdw * Major overhaul. Now uses DSA signatures rather than the bogus symmetric * encrypt-and-hope thing. Integrated with mLib and Catacomb. @@ -78,6 +81,10 @@ /* The `etcdir' contains configuration and state information. */ #define ETCDIR "/etc/become" +/* The `pidfile' is where Become puts its process id if it runs as a + * daemon. */ +#define file_PID "/etc/become/become.pid" + /* Default login style can be `l_preserve', `l_setuser' or `l_login'. */ #define DEFAULT_LOGIN_STYLE l_preserve @@ -108,7 +115,6 @@ #define file_KEY ETCDIR "/become.key" #define file_PUBKEY ETCDIR "/become.pubkey" -#define file_PID ETCDIR "/become.pid" #define file_RULES ETCDIR "/become.conf" #define file_SERVER ETCDIR "/become.server" diff --git a/conf/Makefile.am b/conf/Makefile.am index 7a20864..0bf1c28 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with `automake' to generate `Makefile.in' ## -*-makefile-*- ## -## $Id: Makefile.am,v 1.4 1999/05/04 16:18:39 mdw Exp $ +## $Id: Makefile.am,v 1.5 2003/11/29 23:39:16 mdw Exp $ ## ## Makefile for `become' ## @@ -29,6 +29,9 @@ ##----- Revision history ---------------------------------------------------- ## ## $Log: Makefile.am,v $ +## Revision 1.5 2003/11/29 23:39:16 mdw +## Debianization. +## ## Revision 1.4 1999/05/04 16:18:39 mdw ## Make sure the sample configuration gets distributed. (Automake changed ## behaviour here.) @@ -51,18 +54,19 @@ noinst_DATA = become.conf EXTRA_DIST = become.conf install-data-local: become.conf - $(mkinstalldirs) $(etcdir) - if test -r $(etcdir)/become.conf; then \ + $(mkinstalldirs) $(DESTDIR)$(etcdir) + if test -r $(DESTDIR)$(etcdir)/become.conf; then \ echo ">>>>>"; \ echo ">>>>> become.conf NOT installed"; \ echo ">>>>>"; \ else \ - $(INSTALL_DATA) $(srcdir)/become.conf $(etcdir)/become.conf; \ + $(INSTALL_DATA) $(srcdir)/become.conf \ + $(DESTDIR)$(etcdir)/become.conf; \ fi uninstall-local: - if cmp -s $(srcdir)/become.conf $(etcdir)/become.conf; then \ - rm -f $(etcdir)/become.conf; \ + if cmp -s $(srcdir)/become.conf $(DESTDIR)$(etcdir)/become.conf; then \ + rm -f $(DESTDIR)$(etcdir)/become.conf; \ else \ echo ">>>>>"; \ echo ">>>>> $(etcdir)/become.conf NOT uninstalled."; \ diff --git a/configure.in b/configure.in index ff93341..8d334d4 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ -dnl -*-fundamental-*- +dnl -*-m4-*- dnl -dnl $Id: configure.in,v 1.19 2003/10/12 00:14:44 mdw Exp $ +dnl $Id: configure.in,v 1.20 2003/11/29 23:39:16 mdw Exp $ dnl dnl Source for auto configuration for `become' dnl @@ -28,6 +28,9 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl----- Revision history --------------------------------------------------- dnl dnl $Log: configure.in,v $ +dnl Revision 1.20 2003/11/29 23:39:16 mdw +dnl Debianization. +dnl dnl Revision 1.19 2003/10/12 00:14:44 mdw dnl Major overhaul. Now uses DSA signatures rather than the bogus symmetric dnl encrypt-and-hope thing. Integrated with mLib and Catacomb. @@ -135,7 +138,12 @@ AC_ARG_WITH([etcdir], [default is /etc/become]], [etcdir="$withval"], [etcdir="/etc/become"]) AC_SUBST(etcdir) -AC_DEFINE_UNQUOTED(ETCDIR, "$etcdir") + +AC_ARG_WITH([pidfile], +[ --with-pidfile=PATH set filename for pidfile + [default is ETCDIR/become/pid]], +[pidfile="$withval"], [pidfile="${etcdir}/become.pid"]) +AC_SUBST(pidfile) AC_ARG_WITH([htmldir], [ --with-htmldir=PATH set directory for HTML documentation @@ -143,6 +151,11 @@ AC_ARG_WITH([htmldir], [htmldir="$withval"], [htmldir='${prefix}/html/become']) AC_SUBST(htmldir) +mdw_DEFINE_PATHS([ + mdw_DEFINE_PATH([ETCDIR], [$etcdir]) + mdw_DEFINE_PATH([file_PID], [$pidfile]) +]) + dnl --- Debugging stuff --- mdw_OPT_EFENCE diff --git a/debian/.cvsignore b/debian/.cvsignore new file mode 100644 index 0000000..9a1e0ce --- /dev/null +++ b/debian/.cvsignore @@ -0,0 +1,2 @@ +files tmp substvars *.substvars *.debhelper +become become-doc become-nonet diff --git a/debian/become-doc.doc-base b/debian/become-doc.doc-base new file mode 100644 index 0000000..38f41a6 --- /dev/null +++ b/debian/become-doc.doc-base @@ -0,0 +1,13 @@ +Document: become-manual +Title: Become +Author: Mark Wooding +Abstract: + Become is a system for managing shared accounts. It allows users to + `become' other users in order to do useful work. It can be managed on a + central server (or a small number of central servers), or it can run + standalone. +Section: Admin + +Format: HTML +Index: /usr/share/doc/become/html/become_toc.html +Files: /usr/share/doc/become/html/become_*.html diff --git a/debian/become.config b/debian/become.config new file mode 100644 index 0000000..19ce925 --- /dev/null +++ b/debian/become.config @@ -0,0 +1,18 @@ +#! /bin/sh -e +. /usr/share/debconf/confmodule +db_version 2 + +if test -f /etc/default/become; then + . /etc/default/become + db_set become/run-daemon $START +fi + +if test -f /etc/become/become.server; then + db_set become/servers $(sed -n \ + 'H; $!d; g; s/[[:space:]]\+/ /g; s/ \?: \?/:/g; s/^ //; s/ $//; p' \ + /etc/become/become.server) +fi + +db_input medium become/run-daemon || true +db_input medium become/servers || true +db_go || true diff --git a/debian/become.init b/debian/become.init new file mode 100755 index 0000000..c3170ea --- /dev/null +++ b/debian/become.init @@ -0,0 +1,63 @@ +#! /bin/sh +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg . +# Modified for Debian GNU/Linux +# by Ian Murdock . +# +# Version: @(#)skeleton 1.9.1 08-Apr-2002 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/become +NAME=become +DESC="Become authentication server" + +test -x $DAEMON || exit 0 +START=false +test -f /etc/default/$NAME && . /etc/default/$NAME +if test "$START" != true; then + echo "Not starting $DESC -- disabled in /etc/default/$NAME." + exit 0 +fi + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + start-stop-daemon --start --quiet --pidfile /var/run/become.pid \ + --exec $DAEMON -- --daemon + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + start-stop-daemon --stop --oknodo --quiet \ + --pidfile /var/run/become.pid --exec $DAEMON + echo "." + ;; + reload|force-reload) + echo -n "Reloading $DESC configuration..." + start-stop-daemon --stop --signal 1 --quiet --pidfile \ + /var/run/become.pid --exec $DAEMON + echo "done." + ;; + restart) + echo -n "Restarting $DESC: $NAME" + start-stop-daemon --stop --quiet --pidfile \ + /var/run/become.pid --exec $DAEMON + sleep 1 + start-stop-daemon --start --quiet --pidfile \ + /var/run/become.pid --exec $DAEMON -- --daemon + echo "." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/become.postinst b/debian/become.postinst new file mode 100644 index 0000000..b99a2cd --- /dev/null +++ b/debian/become.postinst @@ -0,0 +1,40 @@ +#! /bin/sh -e +. /usr/share/debconf/confmodule +db_version 2 + +db_get become/run-daemon; run=$RET +db_get become/servers; servers=$RET +db_stop + +cat >/etc/default/become.new </etc/become/become.server.new + mv /etc/become/become.server.new /etc/become/become.server + ;; +esac + +#DEBHELPER# diff --git a/debian/become.postrm b/debian/become.postrm new file mode 100644 index 0000000..62c75d8 --- /dev/null +++ b/debian/become.postrm @@ -0,0 +1,14 @@ +#! /bin/sh + +set -e +if test "$1" = purge; then + rm -f /etc/default/become + rm -f /etc/become/become.key + rm -f /etc/become/become.pubkey + rm -f /etc/become/become.key.old + rm -f /etc/become/become.pubkey.old + rm -f /etc/become/become.server + rm -f /etc/become/become.conf +fi + +#DEBHELPER# diff --git a/debian/become.templates b/debian/become.templates new file mode 100644 index 0000000..c7e6a47 --- /dev/null +++ b/debian/become.templates @@ -0,0 +1,18 @@ +Template: become/run-daemon +Type: boolean +Default: false +Description: Run a become server? + If you say `yes' here, I'll start a Become server. Client machines don't + want this, so `no' is usually the right answer. + +Template: become/servers +Type: string +Default: +Description: List of server names and ports + Type a list of SERVER names or SERVER:PORT pairs, separated by spaces, + one for each Become server you've set up or will install. The default + port is 35523. + . + As a special case, if you say `STANDALONE', I'll remove the `become.server' + file, and `become' will read its local rules file rather than querying a + server. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..17a520e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +become (1.4.0) experimental; urgency=low + + * Debianization! + + -- Mark Wooding Tue, 11 Nov 2003 13:54:54 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..405bf5d --- /dev/null +++ b/debian/control @@ -0,0 +1,43 @@ +Source: become +Section: admin +Priority: extra +Maintainer: Mark Wooding +Build-Depends: mlib (>= 2.0.2), catacomb (>= 2.0.1) +Standards-Version: 3.1.1 + +Package: become +Architecture: any +Depends: ${shlibs:Depends}, catacomb-bin +Conflicts: become-nonet +Suggests: become-doc +Description: Controlled access to shared accounts + Become is a setuid-root program which allows users to `become' other + users -- typically shared accounts -- under the control of a configuration + file. + . + This is the client-server version. Clients will ask a server for + permission. The network protocol is authenticated using digitial + signatures, so the network needn't be trusted. + +Package: become-nonet +Architecture: any +Depends: ${shlibs:Depends} +Provides: become +Suggests: become-doc +Conflicts: become +Description: Controlled access to shared accounts + Become is a setuid-root program which allows users to `become' other + users -- typically shared accounts -- under the control of a configuration + file. + . + This is the standalone version. The program reads a locally-installed + configuration file to decide which users are authorized. + +Package: become-doc +Architecture: all +Description: Controlled access to shared accounts + Become is a setuid-root program which allows users to `become' other + users -- typically shared accounts -- under the control of a configuration + file. + . + This package contains the HTML and Info documentation for Become. \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..108bfeb --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +become is copyright (c) 2003 EBI + +become is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +become is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have a copy of the GNU General Public License in +/usr/share/common-licenses/GPL; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b18a1e2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,72 @@ +#! /usr/bin/make -f + +export DH_COMPAT = 4 + +build: + rm -rf build deb-build deb-nonet + mkdir deb-build deb-nonet + cd deb-build; ../configure \ + --prefix=/usr --infodir=/usr/share/info \ + --with-pidfile=/var/run/become.pid \ + --with-htmldir=/usr/share/doc/become/html + make -C deb-build + cd deb-nonet; ../configure \ + --prefix=/usr --infodir=/usr/share/info \ + --with-htmldir=/usr/share/doc/become/html \ + --disable-network + make -C deb-nonet + touch build + +clean: + dh_clean + rm -rf deb-build deb-nonet build + +install: build + dh_clean + make -C deb-build install DESTDIR=`pwd`/debian/become + make -C deb-nonet install DESTDIR=`pwd`/debian/become-nonet + mkdir -p debian/become-doc/usr/share/doc/become + mv debian/become/usr/share/doc/become/html \ + debian/become-doc/usr/share/doc/become + mv debian/become/usr/share/info debian/become-doc/usr/share/info + rm -rf debian/become-nonet/usr/share/doc/become/html + rm -rf debian/become-nonet/usr/share/info + +binary-indep: + dh_testdir -i + dh_testroot -i + dh_installinfo -i manual/become.info + dh_compress -i + dh_installdocs -i + dh_gencontrol -i + dh_fixperms -i + dh_installdeb -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: + dh_testdir -a + dh_testroot -a + dh_compress -a + dh_installdocs -a + dh_installdebconf -a + dh_strip -a + dh_shlibdeps -a + dh_installinit -a + dh_gencontrol -a + dh_fixperms -a -X usr/bin/become + dh_installdeb -a + dh_md5sums -a + dh_builddeb -a + +binary: install binary-indep binary-arch + +source: + rm -rf deb-build/*.tar.gz deb-build/=deb= + make -C deb-build dist + mkdir deb-build/=deb= + cd deb-build/=deb=; tar xvfz ../*.tar.gz + d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/* + rm -rf deb-build/=deb= + +.PHONY: binary binary-arch binary-indep clean install source diff --git a/manual/Makefile.am b/manual/Makefile.am index 81fc336..de535d6 100644 --- a/manual/Makefile.am +++ b/manual/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with `automake' to generate `Makefile.in' ## -*-makefile-*- ## -## $Id: Makefile.am,v 1.8 1999/05/04 16:24:42 mdw Exp $ +## $Id: Makefile.am,v 1.9 2003/11/29 23:39:16 mdw Exp $ ## ## Makefile for `become' ## @@ -29,6 +29,9 @@ ##----- Revision history ---------------------------------------------------- ## ## $Log: Makefile.am,v $ +## Revision 1.9 2003/11/29 23:39:16 mdw +## Debianization. +## ## Revision 1.8 1999/05/04 16:24:42 mdw ## Distribute the generated HTML files. ## @@ -70,9 +73,9 @@ stamp-html.in: $(srcdir)/become.texi echo datestamp >$(srcdir)/stamp-html.in install-data-local: stamp-html.in - $(mkinstalldirs) $(htmldir) + $(mkinstalldirs) $(DESTDIR)$(htmldir) for i in $(srcdir)/become_*.html; do \ - $(INSTALL_DATA) $$i $(htmldir); \ + $(INSTALL_DATA) $$i $(DESTDIR)$(htmldir); \ done uninstall-local: diff --git a/manual/become.texi b/manual/become.texi index 76ce702..6097465 100644 --- a/manual/become.texi +++ b/manual/become.texi @@ -1,6 +1,6 @@ \input texinfo @c -*-texinfo-*- @c -@c $Id: become.texi,v 1.6 2003/10/26 11:57:46 mdw Exp $ +@c $Id: become.texi,v 1.7 2003/11/29 23:39:16 mdw Exp $ @c @c Documentation for `become' @c @@ -10,6 +10,9 @@ @c ----- Revision history --------------------------------------------------- @c @c $Log: become.texi,v $ +@c Revision 1.7 2003/11/29 23:39:16 mdw +@c Debianization. +@c @c Revision 1.6 2003/10/26 11:57:46 mdw @c Fix key reloading core dumps. Change advice on keys. @c @@ -47,9 +50,14 @@ @end iftex @c %**end of header +@dircategory Administration tools +@direntry +* Become: (become). Shared account administration tool +@end direntry + @c ----- Useful macros ------------------------------------------------------ -@set version 1.3 +@set version 1.4 @c ----- Copyright matters -------------------------------------------------- diff --git a/src/bcquery.c b/src/bcquery.c index 2d07ad3..9b92877 100644 --- a/src/bcquery.c +++ b/src/bcquery.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: bcquery.c,v 1.4 2003/10/12 00:14:55 mdw Exp $ + * $Id: bcquery.c,v 1.5 2003/11/29 23:39:16 mdw Exp $ * * Query and dump Become's configuration file * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: bcquery.c,v $ + * Revision 1.5 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.4 2003/10/12 00:14:55 mdw * Major overhaul. Now uses DSA signatures rather than the bogus symmetric * encrypt-and-hope thing. Integrated with mLib and Catacomb. @@ -461,8 +464,10 @@ static qnode *qparse(void) static void dumptree(qnode *q, int indent) { - if (!q) + if (!q) { printf(" -- magic query which matches everything\n"); + return; + } again: printf("%*s", indent * 2, ""); diff --git a/src/become.c b/src/become.c index 7c7c2aa..1edb89c 100644 --- a/src/become.c +++ b/src/become.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: become.c,v 1.24 2003/10/15 09:27:06 mdw Exp $ + * $Id: become.c,v 1.25 2003/11/29 23:39:16 mdw Exp $ * * Main code for `become' * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: become.c,v $ + * Revision 1.25 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.24 2003/10/15 09:27:06 mdw * Make sure standard file descriptors are open before starting properly. * @@ -1323,7 +1326,7 @@ done_options: for (pp = banned; *pp; pp++) { if (**pp == '-') { p = *pp + 1; - if (memcmp(e->_base.name, p, strlen(p)) == 0) + if (strncmp(e->_base.name, p, strlen(p)) == 0) goto expunge; } else if (strcmp(e->_base.name, *pp) == 0) goto expunge; diff --git a/src/become.h b/src/become.h index 69588fd..c3c06ee 100644 --- a/src/become.h +++ b/src/become.h @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: become.h,v $ + * Revision 1.4 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.3 1998/04/23 13:21:28 mdw * Disable trace constants for networking when it's not compiled in. * @@ -86,6 +89,10 @@ TRACE_DAEMON | TRACE_CHECK ) #define TRACE_ALL 0xFFFFu +/*----- Other magic constants ---------------------------------------------*/ + +#define SERVER_PORT 35523 /* Not allocated properly */ + /*----- Type definitions --------------------------------------------------*/ /* --- Request buffer (plaintext) --- */ diff --git a/src/check.c b/src/check.c index 5b29b72..ed561a7 100644 --- a/src/check.c +++ b/src/check.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: check.c,v 1.11 2003/10/12 00:14:55 mdw Exp $ + * $Id: check.c,v 1.12 2003/11/29 23:39:16 mdw Exp $ * * Check validity of requests * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: check.c,v $ + * Revision 1.12 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.11 2003/10/12 00:14:55 mdw * Major overhaul. Now uses DSA signatures rather than the bogus symmetric * encrypt-and-hope thing. Integrated with mLib and Catacomb. @@ -423,7 +426,7 @@ int check__client(request *rq, FILE *fp) { struct servent *s = getservbyname(quis(), "udp"); - port = (s ? s->s_port : -1); + port = (s ? s->s_port : htons(SERVER_PORT)); } /* --- Initialise for scanning the file --- */ diff --git a/src/daemon.c b/src/daemon.c index 3d29735..20698ec 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: daemon.c,v 1.15 2003/10/26 11:57:46 mdw Exp $ + * $Id: daemon.c,v 1.16 2003/11/29 23:39:16 mdw Exp $ * * Running a `become' daemon * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: daemon.c,v $ + * Revision 1.16 2003/11/29 23:39:16 mdw + * Debianization. + * * Revision 1.15 2003/10/26 11:57:46 mdw * Fix key reloading core dumps. Change advice on keys. * @@ -146,7 +149,7 @@ /*----- Static variables --------------------------------------------------*/ static int daemon__port = -1; /* No particular port yet */ -static fwatch daemon__cwatch, daemon__kwatch; /* Watching key / config files */ +static fwatch daemon__cwatch, daemon__kwatch; /* Watching key/config files */ static sel_timer daemon__timer; /* Timer for reading */ static sel_state daemon__sel; /* Select context */ static sel_file daemon__listen; /* Listening socket selector */ @@ -537,9 +540,10 @@ void daemon_init(const char *cf, int port, unsigned f) if (daemon__port == 0) { struct servent *se = getservbyname(quis(), "udp"); - if (!se) - die(1, "no idea which port to listen to"); - daemon__port = se->s_port; + if (se) + daemon__port = se->s_port; + else + daemon__port = htons(SERVER_PORT); } /* --- Now set up a socket --- */ -- 2.11.0