This commit is contained in:
Graeme Walker 2002-04-25 12:00:00 +00:00
parent a21313453c
commit 38eb15ca53
98 changed files with 3110 additions and 1427 deletions

View File

@ -1,9 +1,9 @@
AUTHORS AUTHORS
======= =======
Graeme Walker <graeme_walker@users.sourceforge.net> Graeme Walker <graeme_walker@users.sourceforge.net>
Credits
-------
The source in "glib/gmd5.cpp" is "derived from the RSA Data The source in "glib/gmd5.cpp" is "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" by incorporating Security, Inc. MD5 Message-Digest Algorithm" by incorporating
the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" which the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" which

View File

@ -1,11 +1,28 @@
E-MailRelay Change Log E-MailRelay Change Log
====================== ======================
0.9.8 -> 0.9.9
--------------
* More flexible logging options ("--verbose" and "--debug" work better).
* File Hierarchy Standard (FHS) option for "configure" ("--enable-fhs").
* FHS-compatible RPMs.
* Spool files writeable by preprocessor when server started as root.
* Default directories in executables and scripts come from "configure".
* The "init.d" script is renamed "emailrelay" (was "emailrelay.sh").
* Man pages are gzippped when installed.
* Fix for access violation under Windows NT when client disconnects.
* Use of event log when compiled on Windows NT.
* Fix for info-after-flush bug when using the administration interface. [rc2]
* New "resubmit" script. [rc2]
* Submit utility works under Windows. [rc2]
* Improved Windows project files. [rc2]
0.9.7 -> 0.9.8 0.9.7 -> 0.9.8
-------------- --------------
* Fix for running preprocessor ("--filter") as root. * Fix for running preprocessor ("--filter") as root.
* Ignore bogus "AUTH=LOGIN" lines in EHLO response. * Ignore bogus "AUTH=LOGIN" lines in EHLO response.
* Submit utility improved to work with mutt. * Submit utility improved to work with mutt.
* Installation of submit man page.
0.9.6 -> 0.9.7 0.9.6 -> 0.9.7
-------------- --------------

21
INSTALL
View File

@ -1,16 +1,23 @@
Introduction Introduction
============ ============
What follows are generic installation instructions for doing a standard GNU
"./configure; make; make install" installation from source under Linux, FreeBSD
etc. The Windows installation instructions are in a separate document.
What follows are generic installation instructions for doing a Note that a non-standard "configure" switch is available, "--enable-fhs",
standard GNU "./configure; make; make install" installation from source. which overrides all other directory modifiers, forcing compliance with the File
The E-MailRelay userguide describes what you have to do after the "make Hierarchy Standard. There are also a set of variables which can be defined on
install" (under GNU/Linux) in order to get the emailrelay daemon to start the "configure" command line for controlling all the installation directories
up at boot-time, automatically forward e-mail to your ISP when connected, in more detail, augmenting the standard command-line switches like "--sbindir"
and bounce failed mail. and "--libexecdir". For more information refer to the E-MailRelay reference
document.
The E-MailRelay user guide describes what needs to be done after the "make
install" in order to get the emailrelay daemon to start up at boot-time,
automatically forward e-mail and bounce failed mail.
Basic Installation Basic Installation
================== ==================
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package. those values to create a `Makefile' in each directory of the package.

View File

@ -1,2 +1,24 @@
EXTRA_DIST = emailrelay.spec #
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
EXTRA_DIST = emailrelay.spec ChangeLog
SUBDIRS = src bin lib doc SUBDIRS = src bin lib doc
e_doc_DATA = NEWS README changelog.gz
CLEANFILES = changelog.gz
changelog.gz: ChangeLog
if test -n "$(GZIP)" ; then $(GZIP) -c $< > changelog.tmp && mv changelog.tmp changelog.gz ; fi

View File

@ -10,6 +10,25 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SHELL = @SHELL@ SHELL = @SHELL@
@ -61,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -68,16 +88,27 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = emailrelay.spec EXTRA_DIST = emailrelay.spec ChangeLog
SUBDIRS = src bin lib doc SUBDIRS = src bin lib doc
e_doc_DATA = NEWS README changelog.gz
CLEANFILES = changelog.gz
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
DATA = $(e_doc_DATA)
DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \
Makefile.am Makefile.in NEWS aclocal.m4 config.h.in configure \ Makefile.am Makefile.in NEWS acinclude.m4 aclocal.m4 config.h.in \
configure.in install-sh missing mkinstalldirs configure configure.ac install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@ -86,19 +117,19 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \ cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): configure.in $(ACLOCAL_M4): configure.ac acinclude.m4
cd $(srcdir) && $(ACLOCAL) cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) $(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF) cd $(srcdir) && $(AUTOCONF)
config.h: stamp-h config.h: stamp-h
@ -116,7 +147,7 @@ $(srcdir)/config.h.in: $(srcdir)/stamp-h.in
rm -f $(srcdir)/stamp-h.in; \ rm -f $(srcdir)/stamp-h.in; \
$(MAKE) $(srcdir)/stamp-h.in; \ $(MAKE) $(srcdir)/stamp-h.in; \
else :; fi else :; fi
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/stamp-h.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER) cd $(top_srcdir) && $(AUTOHEADER)
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
@ -129,6 +160,25 @@ distclean-hdr:
maintainer-clean-hdr: maintainer-clean-hdr:
install-e_docDATA: $(e_doc_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(e_docdir)
@list='$(e_doc_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_docdir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_docdir)/$$p; \
else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(e_docdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(e_docdir)/$$p; \
fi; fi; \
done
uninstall-e_docDATA:
@$(NORMAL_UNINSTALL)
list='$(e_doc_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(e_docdir)/$$p; \
done
# This directory's subdirectories are mostly independent; you can cd # This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile. # into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles, # To change the values of `make' variables: instead of editing Makefiles,
@ -290,25 +340,27 @@ all-recursive-am: config.h
install-exec-am: install-exec-am:
install-exec: install-exec-recursive install-exec: install-exec-recursive
install-data-am: install-data-am: install-e_docDATA
install-data: install-data-recursive install-data: install-data-recursive
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-recursive install: install-recursive
uninstall-am: uninstall-am: uninstall-e_docDATA
uninstall: uninstall-recursive uninstall: uninstall-recursive
all-am: Makefile config.h all-am: Makefile $(DATA) config.h
all-redirect: all-recursive-am all-redirect: all-recursive-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs-recursive installdirs: installdirs-recursive
installdirs-am: installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(e_docdir)
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f Makefile $(CONFIG_CLEAN_FILES)
@ -337,7 +389,8 @@ maintainer-clean: maintainer-clean-recursive
-rm -f config.status -rm -f config.status
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
install-data-recursive uninstall-data-recursive install-exec-recursive \ uninstall-e_docDATA install-e_docDATA install-data-recursive \
uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \ all-recursive check-recursive installcheck-recursive info-recursive \
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
@ -349,6 +402,8 @@ install uninstall-am uninstall all-redirect all-am all installdirs-am \
installdirs mostlyclean-generic distclean-generic clean-generic \ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
changelog.gz: ChangeLog
if test -n "$(GZIP)" ; then $(GZIP) -c $< > changelog.tmp && mv changelog.tmp changelog.gz ; fi
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

36
README
View File

@ -5,12 +5,12 @@ Abstract
-------- --------
E-MailRelay is a simple SMTP store-and-forward message transfer agent (MTA). E-MailRelay is a simple SMTP store-and-forward message transfer agent (MTA).
It runs as an SMTP server, storing e-mail in a local spool directory, and It runs as an SMTP server, storing e-mail in a local spool directory, and
then forwarding the stored messages to a downstream SMTP server on request. then forwarding the stored messages to the next SMTP server on request.
It can also run as a proxy server, forwarding (and optionally pre-processing) It can also run as a proxy server, forwarding (and optionally pre-processing)
e-mail as soon as it is received. It does not do any message routing, other e-mail as soon as it is received. It does not do any message routing, other
than to a local postmaster. Because of this functional simplicity it is than to a local postmaster. Because of this functional simplicity it is
extremely easy to configure, typically only requiring the address of the extremely easy to configure, typically only requiring the address of the
downstream SMTP server to be put on the command line. next-hop SMTP server to be put on the command line.
C++ source code is available for Linux, FreeBSD and Windows. Distribution is C++ source code is available for Linux, FreeBSD and Windows. Distribution is
under the GNU General Public License. under the GNU General Public License.
@ -20,7 +20,7 @@ Quick start
E-MailRelay can be built and installed from source using the ususal E-MailRelay can be built and installed from source using the ususal
"./configure ; make ; make install" incantation. The program runs as an SMTP "./configure ; make ; make install" incantation. The program runs as an SMTP
server daemon using the "emailrelay --as-server" command, and stored mail is server daemon using the "emailrelay --as-server" command, and stored mail is
forwarded to a downstream server by running "emailrelay --as-client <isp-mail-server>:smtp". forwarded to the next-hop server by running "emailrelay --as-client <isp-mail-server>:smtp".
The "--as-server" command is typically run automatically at boot time, using The "--as-server" command is typically run automatically at boot time, using
the boot scripts under "/etc/init.d" or "/sbin/init.d", while the "--as-client" the boot scripts under "/etc/init.d" or "/sbin/init.d", while the "--as-client"
@ -28,7 +28,7 @@ command is normally put into pppd's "ip-up" script ("/etc/ppp/ip-up")
in place of "sendmail -q". in place of "sendmail -q".
The program can also run as a proxy server ("--as-proxy") so that e-mail The program can also run as a proxy server ("--as-proxy") so that e-mail
messages are forwarded immediately to a downstream server -- usually the local messages are forwarded immediately to the next-hop server -- usually the local
system's default MTA. This can be usefully combined with a mail pre-processor system's default MTA. This can be usefully combined with a mail pre-processor
program by using the "--filter" switch. program by using the "--filter" switch.
@ -50,35 +50,43 @@ To test the program out without a full installation:
Documentation Documentation
------------- -------------
The following documentation is provided: The following documentation is provided in the source distribution:
* README -- this document * README -- this document
* COPYING -- the GNU General Public License * COPYING -- the GNU General Public License
* INSTALL -- build & install instructions (based on generic GNU text) * INSTALL -- build & install instructions (including the generic GNU text)
* AUTHORS -- authors, credits and additional copyrights
* copyright -- main copyright and GPL reference
* doc/userguide.txt -- user guide * doc/userguide.txt -- user guide
* doc/reference.txt -- reference document * doc/reference.txt -- reference document
* doc/developer.txt -- developer guide
* ChangeLog -- change log for releases * ChangeLog -- change log for releases
Source code documentation can be generated by using doxygen (www.doxygen.org). Additional documents, including source-code documentation generated by
doxygen (www.doxygen.org), is available in a separate package,
"emailrelay-doc".
Configurations Configurations
-------------- --------------
The code was developed on SuSE Linux 7.1 using: The code was developed on SuSE Linux 7.1 using:
* linux 2.4.10, * linux 2.4.10
* gcc 2.95.3, * gcc 2.95.3
* glibc 2.2.4 (libc.so.6), * glibc 2.2.4 (libc.so.6)
* gnu make 3.79.1, * gnu make 3.79.1
* autoconf 2.52 * autoconf 2.52
and ported to Windows 98 using and ported to Windows 98 using:
* MSVC 6.0 * MSVC 6.0
The code has also been built successfully on: The code has also been built successfully on:
* Windows NT 4.0
* Linux on Alpha hardware (Debian 2.2) * Linux on Alpha hardware (Debian 2.2)
* Linux on Sparc hardware * Linux on Sparc hardware
* Linux on RS6000 PPC hardware * Linux on RS6000 PPC hardware
* FreeBSD on Intel hardware * FreeBSD on Intel hardware
* Solaris, using gcc, on Sparc hardware * Solaris, using gcc, on Sparc hardware
(courtesy of SourceForge's compile farm).
Feedback
--------
Please feel free to email the author at
"mailto:graeme_walker@users.sourceforge.net".

60
acinclude.m4 Normal file
View File

@ -0,0 +1,60 @@
dnl
dnl Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later
dnl version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl ===
AC_DEFUN([ENABLE_FHS],
[
if test "$enable_fhs" = "yes"
then
FHS_COMPLIANCE
fi
])
AC_DEFUN([FHS_COMPLIANCE],
[
# tweaks for fhs compliance...
#
prefix='/usr'
exec_prefix='/usr'
#
sbindir='/usr/sbin'
libexecdir='/usr/lib'
localstatedir='/var'
mandir='/usr/man'
datadir='/usr/share'
#
# not used by emailrelay
#bindir=
#sysconfdir=
#sharedstatedir=
#libdir=
#includedir=
#oldincludedir=
#infodir=
#
# emailrelay-specific
e_sbindir="$sbindir"
e_libexecdir="$libexecdir/$PACKAGE"
e_docdir="$datadir/doc/$PACKAGE"
e_initdir="/etc/init.d"
e_spooldir="$localstatedir/spool/$PACKAGE"
e_man1dir="$datadir/man/man1"
e_examplesdir="$datadir/doc/$PACKAGE/examples"
])

61
aclocal.m4 vendored
View File

@ -10,6 +10,67 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE. dnl PARTICULAR PURPOSE.
dnl
dnl Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later
dnl version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl ===
AC_DEFUN([ENABLE_FHS],
[
if test "$enable_fhs" = "yes"
then
FHS_COMPLIANCE
fi
])
AC_DEFUN([FHS_COMPLIANCE],
[
# tweaks for fhs compliance...
#
prefix='/usr'
exec_prefix='/usr'
#
sbindir='/usr/sbin'
libexecdir='/usr/lib'
localstatedir='/var'
mandir='/usr/man'
datadir='/usr/share'
#
# not used by emailrelay
#bindir=
#sysconfdir=
#sharedstatedir=
#libdir=
#includedir=
#oldincludedir=
#infodir=
#
# emailrelay-specific
e_sbindir="$sbindir"
e_libexecdir="$libexecdir/$PACKAGE"
e_docdir="$datadir/doc/$PACKAGE"
e_initdir="/etc/init.d"
e_spooldir="$localstatedir/spool/$PACKAGE"
e_man1dir="$datadir/man/man1"
e_examplesdir="$datadir/doc/$PACKAGE/examples"
])
# Do all the work for Automake. This macro actually does too much -- # Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things. # some checks are only needed if your package does certain things.
# But this isn't really a big deal. # But this isn't really a big deal.

View File

@ -1,10 +1,45 @@
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh
libexec_SCRIPTS = emailrelay.sh e_init_SCRIPTS = emailrelay
pkgdata_DATA = emailrelay-notify.sh emailrelay-deliver.sh emailrelay-process.sh e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
CLEANFILES = $(noinst_SCRIPTS) $(libexec_SCRIPTS) $(pkgdata_DATA) CLEANFILES = $(noinst_SCRIPTS) $(e_init_SCRIPTS) $(e_examples_DATA)
TESTS = emailrelay-test.sh TESTS = emailrelay-test.sh
SUFFIXES = .sh_ .sh SUFFIXES = .sh_ .sh
.sh_.sh: .sh_.sh:
cp $(srcdir)/../bin/$*.sh_ $*.sh cat $(srcdir)/../bin/$*.sh_ | sed "s%__SPOOL_DIR__%${e_spooldir}%g;s%__SBIN_DIR__%${e_sbindir}%g" > $*.tmp && mv $*.tmp $*.sh
chmod ugo+x $*.sh chmod ugo+x $*.sh
emailrelay: emailrelay.sh
cp emailrelay.sh emailrelay
chmod ugo+x emailrelay
install-data-local:
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-notify.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-resubmit.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-deliver.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-process.sh

View File

@ -10,6 +10,25 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SHELL = @SHELL@ SHELL = @SHELL@
@ -61,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -68,20 +88,31 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-resubmit.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh noinst_SCRIPTS = emailrelay-doxygen-filter.sh emailrelay-test.sh emailrelay-soak.sh
libexec_SCRIPTS = emailrelay.sh e_init_SCRIPTS = emailrelay
pkgdata_DATA = emailrelay-notify.sh emailrelay-deliver.sh emailrelay-process.sh e_examples_DATA = emailrelay-process.sh emailrelay-notify.sh emailrelay-deliver.sh emailrelay-resubmit.sh
EXTRA_DIST = emailrelay-doxygen-filter.sh_ emailrelay-test.sh_ emailrelay-soak.sh_ emailrelay.sh_ txt2html.sh_ txt2mu.sh_ mu2html.sh_ expand.sh_ emailrelay-notify.sh_ emailrelay-deliver.sh_ emailrelay-process.sh_
CLEANFILES = $(noinst_SCRIPTS) $(libexec_SCRIPTS) $(pkgdata_DATA) CLEANFILES = $(noinst_SCRIPTS) $(e_init_SCRIPTS) $(e_examples_DATA)
TESTS = emailrelay-test.sh TESTS = emailrelay-test.sh
SUFFIXES = .sh_ .sh SUFFIXES = .sh_ .sh
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
SCRIPTS = $(libexec_SCRIPTS) $(noinst_SCRIPTS) SCRIPTS = $(e_init_SCRIPTS) $(noinst_SCRIPTS)
DATA = $(pkgdata_DATA) DATA = $(e_examples_DATA)
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = Makefile.am Makefile.in
@ -93,7 +124,7 @@ GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .sh .sh_ .SUFFIXES: .sh .sh_
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps bin/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps bin/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@ -101,42 +132,42 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
install-libexecSCRIPTS: $(libexec_SCRIPTS) install-e_initSCRIPTS: $(e_init_SCRIPTS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(mkinstalldirs) $(DESTDIR)$(e_initdir)
@list='$(libexec_SCRIPTS)'; for p in $$list; do \ @list='$(e_init_SCRIPTS)'; for p in $$list; do \
if test -f $$p; then \ if test -f $$p; then \
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`"; \ echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(e_initdir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \ $(INSTALL_SCRIPT) $$p $(DESTDIR)$(e_initdir)/`echo $$p|sed '$(transform)'`; \
else if test -f $(srcdir)/$$p; then \ else if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`"; \ echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(e_initdir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \ $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(e_initdir)/`echo $$p|sed '$(transform)'`; \
else :; fi; fi; \ else :; fi; fi; \
done done
uninstall-libexecSCRIPTS: uninstall-e_initSCRIPTS:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(libexec_SCRIPTS)'; for p in $$list; do \ list='$(e_init_SCRIPTS)'; for p in $$list; do \
rm -f $(DESTDIR)$(libexecdir)/`echo $$p|sed '$(transform)'`; \ rm -f $(DESTDIR)$(e_initdir)/`echo $$p|sed '$(transform)'`; \
done done
install-pkgdataDATA: $(pkgdata_DATA) install-e_examplesDATA: $(e_examples_DATA)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir) $(mkinstalldirs) $(DESTDIR)$(e_examplesdir)
@list='$(pkgdata_DATA)'; for p in $$list; do \ @list='$(e_examples_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \ if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p"; \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_examplesdir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_examplesdir)/$$p; \
else if test -f $$p; then \ else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p"; \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(e_examplesdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p; \ $(INSTALL_DATA) $$p $(DESTDIR)$(e_examplesdir)/$$p; \
fi; fi; \ fi; fi; \
done done
uninstall-pkgdataDATA: uninstall-e_examplesDATA:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(pkgdata_DATA)'; for p in $$list; do \ list='$(e_examples_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(pkgdatadir)/$$p; \ rm -f $(DESTDIR)$(e_examplesdir)/$$p; \
done done
tags: TAGS tags: TAGS
TAGS: TAGS:
@ -191,23 +222,24 @@ check-am: all-am
check: check-am check: check-am
installcheck-am: installcheck-am:
installcheck: installcheck-am installcheck: installcheck-am
install-exec-am: install-libexecSCRIPTS install-exec-am:
install-exec: install-exec-am install-exec: install-exec-am
install-data-am: install-pkgdataDATA install-data-am: install-e_initSCRIPTS install-e_examplesDATA \
install-data-local
install-data: install-data-am install-data: install-data-am
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am install: install-am
uninstall-am: uninstall-libexecSCRIPTS uninstall-pkgdataDATA uninstall-am: uninstall-e_initSCRIPTS uninstall-e_examplesDATA
uninstall: uninstall-am uninstall: uninstall-am
all-am: Makefile $(SCRIPTS) $(DATA) all-am: Makefile $(SCRIPTS) $(DATA)
all-redirect: all-am all-redirect: all-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(pkgdatadir) $(mkinstalldirs) $(DESTDIR)$(e_initdir) $(DESTDIR)$(e_examplesdir)
mostlyclean-generic: mostlyclean-generic:
@ -238,18 +270,30 @@ maintainer-clean-am: maintainer-clean-generic distclean-am
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
.PHONY: uninstall-libexecSCRIPTS install-libexecSCRIPTS \ .PHONY: uninstall-e_initSCRIPTS install-e_initSCRIPTS \
uninstall-pkgdataDATA install-pkgdataDATA tags distdir check-TESTS \ uninstall-e_examplesDATA install-e_examplesDATA tags distdir \
info-am info dvi-am dvi check check-am installcheck-am installcheck \ check-TESTS info-am info dvi-am dvi check check-am installcheck-am \
install-exec-am install-exec install-data-am install-data install-am \ installcheck install-exec-am install-exec install-data-local \
install uninstall-am uninstall all-redirect all-am all installdirs \ install-data-am install-data install-am install uninstall-am uninstall \
mostlyclean-generic distclean-generic clean-generic \ all-redirect all-am all installdirs mostlyclean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
.sh_.sh: .sh_.sh:
cp $(srcdir)/../bin/$*.sh_ $*.sh cat $(srcdir)/../bin/$*.sh_ | sed "s%__SPOOL_DIR__%${e_spooldir}%g;s%__SBIN_DIR__%${e_sbindir}%g" > $*.tmp && mv $*.tmp $*.sh
chmod ugo+x $*.sh chmod ugo+x $*.sh
emailrelay: emailrelay.sh
cp emailrelay.sh emailrelay
chmod ugo+x emailrelay
install-data-local:
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-notify.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-resubmit.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-deliver.sh
chmod ugo+x $(DESTDIR)$(e_examplesdir)/emailrelay-process.sh
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -21,20 +21,15 @@
# #
# emailrelay-deliver.sh # emailrelay-deliver.sh
# #
# An example script which looks for local mail in the E-MailRelay # Looks for local mail in the E-MailRelay spool directory, and delivers
# spool directory, and delivers it using 'procmail'. # it using 'procmail'. Note that the only local mail should be for the local
# postmaster, since E-MailRelay will not accept mail for any other
# local recipient.
# #
# usage: emailrelay-deliver.sh [<spool-dir>] # usage: emailrelay-deliver.sh [<spool-dir>]
# #
# Note that (1) E-MailRelay will only accept mail to a local recipient
# if that recipient is "postmaster", and the (2) by default E-MailRelay
# will only accept connections from local e-mail clients. This means that
# this script is only relevant if you are in the habit of sending
# yourself mail as "postmaster". It is provided for completeness,
# in response to certain requirements in the SMTP specification.
#
store="/usr/local/var/spool/emailrelay" store="__SPOOL_DIR__/emailrelay"
postmaster="root" postmaster="root"
procmail="procmail" procmail="procmail"
@ -61,7 +56,7 @@ do
then then
content="`echo ${file} | sed 's/envelope/content/'`" content="`echo ${file} | sed 's/envelope/content/'`"
deliver_to="`fgrep X-MailRelay-LocalTo ${file} | sed 's/X-MailRelay-LocalTo: //' | tr -d '\015' | sed \"s/postmaster/${postmaster}/g\"`" deliver_to="`fgrep X-MailRelay-To-Local ${file} | sed 's/X-MailRelay-To-Local: //' | tr -d '\015' | sed \"s/postmaster/${postmaster}/g\"`"
if test "${deliver_to}" = "" if test "${deliver_to}" = ""
then then
deliver_to="${postmaster}" deliver_to="${postmaster}"

View File

@ -21,8 +21,8 @@
# #
# emailrelay-notify.sh # emailrelay-notify.sh
# #
# An example script which looks for failed mail in the E-MailRelay spool # Looks for failed mail in the E-MailRelay spool directory, and sends failure
# directory, and sends failure notification messages using 'procmail'. # notification messages using 'procmail'.
# #
# usage: emailrelay-notify.sh [<spool-dir>] # usage: emailrelay-notify.sh [<spool-dir>]
# #
@ -31,11 +31,11 @@
# approach might be more appropriate -- for example, a line like this in # approach might be more appropriate -- for example, a line like this in
# a ".profile" script: # a ".profile" script:
# #
# if test -f /usr/local/var/spool/emailrelay/*.envelope.bad ; then echo Failed mail >&2 ; fi # if test -f /var/spool/emailrelay/*.envelope.bad ; then echo Failed mail >&2 ; fi
# #
# or perhaps a cron entry like this (since output from a cron job gets sent as mail): # or perhaps a cron entry like this (since output from a cron job gets sent as mail):
# #
# 0 0 * * * /bin/cat /usr/local/var/spool/emailrelay/*.envelope.bad 2>/dev/null # 0 0 * * * /bin/cat /var/spool/emailrelay/*.envelope.bad 2>/dev/null
# #
tmp="/tmp/`basename $0`.$$.tmp" tmp="/tmp/`basename $0`.$$.tmp"
@ -44,7 +44,7 @@ procmail="procmail"
# parse the command line # parse the command line
# #
store="/usr/local/var/spool/emailrelay" store="__SPOOL_DIR__/emailrelay"
if test $# -ge 1 if test $# -ge 1
then then
store="${1}" store="${1}"
@ -72,7 +72,7 @@ do
deliver_to="${from}" deliver_to="${from}"
if test "${deliver_to}" = "" if test "${deliver_to}" = ""
then then
deliver_to="postmaster" deliver_to="root"
fi fi
# create a notification message header # create a notification message header

View File

@ -22,7 +22,9 @@
# emailrelay-process.sh # emailrelay-process.sh
# #
# An example pre-processing script for the E-MailRelay # An example pre-processing script for the E-MailRelay
# system which does rot-13 masking. # SMTP server which does rot-13 masking. (The pre-processor
# is specified using the "--filter" switch on the emailrelay
# command line.)
# #
awk="awk" awk="awk"

View File

@ -0,0 +1,63 @@
#!/bin/sh
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# ===
#
# emailrelay-resubmit.sh
#
# Looks for all failed e-mails in the E-MailRelay spool directory
# and resubmits them. However, if an e-mail has been retried five
# times already then it is not resubmitted again.
#
# usage: emailrelay-resubmit.sh [<spool-dir>]
#
store="__SPOOL_DIR__/emailrelay"
retry_limit="5"
# parse the command line
#
if test $# -ge 1
then
store="${1}"
fi
# check the spool directory is valid
#
if test \! -d "${store}"
then
echo `basename $0`: invalid spool directory >&2
exit 1
fi
# for each failed e-mail...
#
for file in ${store}/emailrelay.*.envelope.bad ""
do
if test -f "${file}"
then
failures="`fgrep MailRelay-Reason: < ${file} | wc -l`"
if test "${failures}" -lt "${retry_limit}"
then
good_file="`echo ${file} | sed 's/\.bad$//'`"
mv -f ${file} ${good_file}
fi
fi
done

View File

@ -19,18 +19,18 @@
# #
# === # ===
# #
# emailrelay.sh # emailrelay
# #
# A shell-script wrapper for E-MailRelay designed for # A shell-script wrapper for E-MailRelay designed for
# use in the SysV-init system (/etc/init.d). # use in the SysV-init system (/etc/init.d).
# #
# usage: emailrelay.sh { start [<emailrelay-switches>] | stop } # usage: emailrelay { start [<emailrelay-switches>] | stop }
# #
# configuration # configuration
# #
var_run="/var/run" var_run="/var/run"
emailrelay="/usr/local/sbin/emailrelay" emailrelay="__SBIN_DIR__/emailrelay"
switches="" switches=""
# configuration fallback # configuration fallback

View File

@ -1,4 +1,4 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated automatically from configure.ac by autoheader. */
/* Define if you have the <dirent.h> header file, and it defines `DIR'. */ /* Define if you have the <dirent.h> header file, and it defines `DIR'. */
#undef HAVE_DIRENT_H #undef HAVE_DIRENT_H

745
configure vendored

File diff suppressed because it is too large Load Diff

50
configure.in → configure.ac Normal file → Executable file
View File

@ -17,29 +17,11 @@ dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl dnl
dnl === dnl ===
dnl dnl
dnl Copyright (C) 2001 Graeme Walker <graeme_walker@users.sourceforge.net>
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later
dnl version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl ===
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/main/gsmtp.h) AC_INIT(src/main/gsmtp.h)
AM_INIT_AUTOMAKE(emailrelay,0.9.8) AM_INIT_AUTOMAKE(emailrelay,0.9.9)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
dnl === dnl ===
@ -52,6 +34,7 @@ AC_PROG_INSTALL
AC_PROG_AWK AC_PROG_AWK
AC_CHECK_PROGS(MAKE,make gmake) AC_CHECK_PROGS(MAKE,make gmake)
AC_CHECK_PROGS(AR,ar gar) AC_CHECK_PROGS(AR,ar gar)
AC_CHECK_PROGS(GZIP,gzip)
AC_CHECK_PROG(HAVE_DOXYGEN,doxygen,yes) AC_CHECK_PROG(HAVE_DOXYGEN,doxygen,yes)
AC_CHECK_PROG(HAVE_MAN2HTML,man2html,yes) AC_CHECK_PROG(HAVE_MAN2HTML,man2html,yes)
@ -75,8 +58,31 @@ AC_LANG_CPLUSPLUS
dnl check for *_r() declarations -- using ac_check_funcs dnl check for *_r() declarations -- using ac_check_funcs
dnl is no good here since they may be in the library but dnl is no good here since they may be in the library but
dnl not the header (depending on preprocessor switches) dnl not the header (depending on preprocessor switches)
AC_EGREP_HEADER(localtime_r,time.h,AC_DEFINE(HAVE_LOCALTIME_R,1,have reentrant localtime)) AC_EGREP_HEADER(localtime_r,time.h,[AC_DEFINE(HAVE_LOCALTIME_R,1,[have reentrant localtime])])
AC_EGREP_HEADER(gmtime_r,time.h,AC_DEFINE(HAVE_GMTIME_R,1,have reentrant gmtime)) AC_EGREP_HEADER(gmtime_r,time.h,[AC_DEFINE(HAVE_GMTIME_R,1,[have reentrant gmtime])])
dnl ===
dnl directory tweaking...
dnl
dnl not AC_PREFIX_DEFAULT([/usr])
AC_ARG_ENABLE(fhs,AC_HELP_STRING([--enable-fhs],[force FHS-compliant directories, ignoring --prefix etc]))
AC_SUBST(e_sbindir)
if test "$e_sbindir" = "" ; then e_sbindir="$sbindir" ; fi
AC_SUBST(e_libexecdir)
if test "$e_libexecdir" = "" ; then e_libexecdir="$libexecdir" ; fi
AC_SUBST(e_docdir)
if test "$e_docdir" = "" ; then e_docdir="$datadir/$PACKAGE/doc" ; fi
AC_SUBST(e_initdir)
if test "$e_initdir" = "" ; then e_initdir="$libexecdir" ; fi
AC_SUBST(e_spooldir)
if test "$e_spooldir" = "" ; then e_spooldir="$localstatedir/spool/emailrelay" ; fi
AC_SUBST(e_man1dir)
if test "$e_man1dir" = "" ; then e_man1dir="$mandir/man1" ; fi
AC_SUBST(e_examplesdir)
if test "$e_examplesdir" = "" ; then e_examplesdir="$libexecdir" ; fi
ENABLE_FHS
dnl ===
dnl attempt to fix recursive makes where make is gmake -- may break something else dnl attempt to fix recursive makes where make is gmake -- may break something else
SET_MAKE="" SET_MAKE=""

76
doc/Makefile.am Executable file → Normal file
View File

@ -1,12 +1,38 @@
EXTRA_DIST = developer.txt reference.txt userguide.txt windows.txt index.html emailrelay.1 emailrelay-passwd.1 emailrelay-poke.1 emailrelay-submit.1 doxygen_header.html graphics/bullet.gif emailrelay.css #
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
noinst_SCRIPTS = .dox #
pkgdata_DATA = readme.html developer.html reference.html userguide.html man.html index.html windows.html changelog.html # This program is free software; you can redistribute it and/or
CLEANFILES = $(noinst_SCRIPTS) html *.ht readme.html developer.html reference.html userguide.html man.html # modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either
SUFFIXES = .txt .html .ht # version 2 of the License, or (at your option) any later
# version.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
stylesheet=emailrelay.css stylesheet=emailrelay.css
txt_files=developer.txt reference.txt userguide.txt windows.txt
man_files_in=emailrelay.1 emailrelay-passwd.1 emailrelay-poke.1 emailrelay-submit.1
man_files_out=emailrelay.1.gz emailrelay-passwd.1.gz emailrelay-poke.1.gz emailrelay-submit.1.gz
html_files_in=doxygen_header.html
html_files_thru=index.html $(stylesheet)
html_files_out=readme.html developer.html reference.html userguide.html windows.html emailrelay-man.html changelog.html
EXTRA_DIST = $(man_files_in) $(txt_files) $(html_files_in) $(html_files_thru)
noinst_SCRIPTS = .dox
e_man1_DATA = $(man_files_out)
e_doc_DATA = $(txt_files) $(html_files_out) $(html_files_thru)
CLEANFILES = $(noinst_SCRIPTS) $(man_files_out) $(html_files_out) doxygen/*
SUFFIXES = .txt .html
filter=$(top_builddir)/bin/emailrelay-doxygen-filter.sh filter=$(top_builddir)/bin/emailrelay-doxygen-filter.sh
filter_src=$(top_srcdir)/bin/emailrelay-doxygen-filter.sh_ filter_src=$(top_srcdir)/bin/emailrelay-doxygen-filter.sh_
converter=$(top_builddir)/bin/txt2html.sh converter=$(top_builddir)/bin/txt2html.sh
@ -21,9 +47,6 @@ converter_helper3_src=$(top_srcdir)/bin/expand.sh_
.txt.html: .txt.html:
$(converter) -a "$(AWK)" $< $(stylesheet) > $*.html $(converter) -a "$(AWK)" $< $(stylesheet) > $*.html
.txt.ht:
$(converter) -a "$(AWK)" -x $< $(stylesheet) > $*.ht
$(filter): $(filter_src) $(filter): $(filter_src)
cp $(filter_src) $(filter) cp $(filter_src) $(filter)
chmod ugo+x $(filter) chmod ugo+x $(filter)
@ -47,8 +70,8 @@ $(converter_helper3): $(converter_helper3_src)
.dox: $(filter) .dox: $(filter)
if test "$(HAVE_DOXYGEN)" = "yes" ; then cat $(top_srcdir)/src/main/doxygen.cfg | sed "s:__TOP_SRC__:$(top_srcdir):g" | sed "s:__TOP_BUILD__:$(top_builddir):g" | doxygen - && touch .dox ; else echo no doxygen ; fi if test "$(HAVE_DOXYGEN)" = "yes" ; then cat $(top_srcdir)/src/main/doxygen.cfg | sed "s:__TOP_SRC__:$(top_srcdir):g" | sed "s:__TOP_BUILD__:$(top_builddir):g" | doxygen - && touch .dox ; else echo no doxygen ; fi
man.html: emailrelay.1 emailrelay-man.html: emailrelay.1
if test "$(HAVE_MAN2HTML)" = "yes" ; then man2html emailrelay.1 > man.html ; else echo no man2html ; fi if test "$(HAVE_MAN2HTML)" = "yes" ; then man2html $< > emailrelay-man.html ; fi
developer.html reference.html userguide.html: $(converter) developer.html reference.html userguide.html: $(converter)
@ -58,21 +81,22 @@ readme.html: $(top_srcdir)/README $(converter)
changelog.html: $(top_srcdir)/ChangeLog $(converter) changelog.html: $(top_srcdir)/ChangeLog $(converter)
$(converter) -a "$(AWK)" $(top_srcdir)/ChangeLog $(stylesheet) > changelog.html $(converter) -a "$(AWK)" $(top_srcdir)/ChangeLog $(stylesheet) > changelog.html
emailrelay.1.gz : emailrelay.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay.1.gz ; fi
emailrelay-passwd.1.gz : emailrelay-passwd.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-passwd.1.gz ; fi
emailrelay-submit.1.gz : emailrelay-submit.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-submit.1.gz ; fi
emailrelay-poke.1.gz: emailrelay-poke.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-poke.1.gz ; fi
install-data-local: install-data-local:
$(mkinstalldirs) $(destdir)$(mandir)/man1 $(mkinstalldirs) $(DESTDIR)$(e_docdir)/doxygen
$(INSTALL) $(top_srcdir)/doc/emailrelay.1 $(destdir)$(mandir)/man1/emailrelay.1 if test "$(HAVE_DOXYGEN)" = "yes" ; then for file in doxygen/* ; do $(INSTALL) $$file $(DESTDIR)$(e_docdir)/$$file ; done ; fi
$(INSTALL) $(top_srcdir)/doc/emailrelay-passwd.1 $(destdir)$(mandir)/man1/emailrelay-passwd.1
$(INSTALL) $(top_srcdir)/doc/emailrelay-poke.1 $(destdir)$(mandir)/man1/emailrelay-poke.1
$(INSTALL) $(top_srcdir)/doc/emailrelay-submit.1 $(destdir)$(mandir)/man1/emailrelay-submit.1
$(mkinstalldirs) $(destdir)$(pkgdatadir)/graphics
$(INSTALL) $(top_srcdir)/doc/graphics/bullet.gif $(destdir)$(pkgdatadir)/graphics/bullet.gif
$(mkinstalldirs) $(destdir)$(pkgdatadir)/html
if test "$(HAVE_DOXYGEN)" = "yes" ; then for file in html/* ; do $(INSTALL) $$file $(destdir)$(pkgdatadir)/$$file ; done ; fi
uninstall-local: uninstall-local:
-rm -f $(destdir)$(pkgdatadir)/graphics/bullet.gif -rm -f $(DESTDIR)$(e_docdir)/html/* 2>/dev/null
-rm -f $(destdir)$(pkgdatadir)/html/* 2>/dev/null
-rm -f $(destdir)$(mandir)/man1/emailrelay.1
-rm -f $(destdir)$(mandir)/man1/emailrelay-passwd.1
-rm -f $(destdir)$(mandir)/man1/emailrelay-poke.1

View File

@ -10,6 +10,25 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SHELL = @SHELL@ SHELL = @SHELL@
@ -61,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -68,16 +88,30 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
EXTRA_DIST = developer.txt reference.txt userguide.txt windows.txt index.html emailrelay.1 emailrelay-passwd.1 emailrelay-poke.1 emailrelay-submit.1 doxygen_header.html graphics/bullet.gif emailrelay.css e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
noinst_SCRIPTS = .dox e_libexecdir = @e_libexecdir@
pkgdata_DATA = readme.html developer.html reference.html userguide.html man.html index.html windows.html changelog.html e_man1dir = @e_man1dir@
CLEANFILES = $(noinst_SCRIPTS) html *.ht readme.html developer.html reference.html userguide.html man.html e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
SUFFIXES = .txt .html .ht
stylesheet = emailrelay.css stylesheet = emailrelay.css
txt_files = developer.txt reference.txt userguide.txt windows.txt
man_files_in = emailrelay.1 emailrelay-passwd.1 emailrelay-poke.1 emailrelay-submit.1
man_files_out = emailrelay.1.gz emailrelay-passwd.1.gz emailrelay-poke.1.gz emailrelay-submit.1.gz
html_files_in = doxygen_header.html
html_files_thru = index.html $(stylesheet)
html_files_out = readme.html developer.html reference.html userguide.html windows.html emailrelay-man.html changelog.html
EXTRA_DIST = $(man_files_in) $(txt_files) $(html_files_in) $(html_files_thru)
noinst_SCRIPTS = .dox
e_man1_DATA = $(man_files_out)
e_doc_DATA = $(txt_files) $(html_files_out) $(html_files_thru)
CLEANFILES = $(noinst_SCRIPTS) $(man_files_out) $(html_files_out) doxygen/*
SUFFIXES = .txt .html
filter = $(top_builddir)/bin/emailrelay-doxygen-filter.sh filter = $(top_builddir)/bin/emailrelay-doxygen-filter.sh
filter_src = $(top_srcdir)/bin/emailrelay-doxygen-filter.sh_ filter_src = $(top_srcdir)/bin/emailrelay-doxygen-filter.sh_
converter = $(top_builddir)/bin/txt2html.sh converter = $(top_builddir)/bin/txt2html.sh
@ -97,7 +131,7 @@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DATA = $(pkgdata_DATA) DATA = $(e_doc_DATA) $(e_man1_DATA)
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = Makefile.am Makefile.in
@ -108,8 +142,8 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .ht .html .txt .SUFFIXES: .html .txt
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@ -117,23 +151,42 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
install-pkgdataDATA: $(pkgdata_DATA) install-e_docDATA: $(e_doc_DATA)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir) $(mkinstalldirs) $(DESTDIR)$(e_docdir)
@list='$(pkgdata_DATA)'; for p in $$list; do \ @list='$(e_doc_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \ if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p"; \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_docdir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkgdatadir)/$$p; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_docdir)/$$p; \
else if test -f $$p; then \ else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p"; \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(e_docdir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(pkgdatadir)/$$p; \ $(INSTALL_DATA) $$p $(DESTDIR)$(e_docdir)/$$p; \
fi; fi; \ fi; fi; \
done done
uninstall-pkgdataDATA: uninstall-e_docDATA:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(pkgdata_DATA)'; for p in $$list; do \ list='$(e_doc_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(pkgdatadir)/$$p; \ rm -f $(DESTDIR)$(e_docdir)/$$p; \
done
install-e_man1DATA: $(e_man1_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(e_man1dir)
@list='$(e_man1_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_man1dir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_man1dir)/$$p; \
else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(e_man1dir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(e_man1dir)/$$p; \
fi; fi; \
done
uninstall-e_man1DATA:
@$(NORMAL_UNINSTALL)
list='$(e_man1_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(e_man1dir)/$$p; \
done done
tags: TAGS tags: TAGS
TAGS: TAGS:
@ -144,7 +197,6 @@ distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = doc subdir = doc
distdir: $(DISTFILES) distdir: $(DISTFILES)
$(mkinstalldirs) $(distdir)/graphics
@for file in $(DISTFILES); do \ @for file in $(DISTFILES); do \
d=$(srcdir); \ d=$(srcdir); \
if test -d $$d/$$file; then \ if test -d $$d/$$file; then \
@ -166,20 +218,20 @@ installcheck: installcheck-am
install-exec-am: install-exec-am:
install-exec: install-exec-am install-exec: install-exec-am
install-data-am: install-pkgdataDATA install-data-local install-data-am: install-e_docDATA install-e_man1DATA install-data-local
install-data: install-data-am install-data: install-data-am
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am install: install-am
uninstall-am: uninstall-pkgdataDATA uninstall-local uninstall-am: uninstall-e_docDATA uninstall-e_man1DATA uninstall-local
uninstall: uninstall-am uninstall: uninstall-am
all-am: Makefile $(SCRIPTS) $(DATA) all-am: Makefile $(SCRIPTS) $(DATA)
all-redirect: all-am all-redirect: all-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir) $(mkinstalldirs) $(DESTDIR)$(e_docdir) $(DESTDIR)$(e_man1dir)
mostlyclean-generic: mostlyclean-generic:
@ -210,21 +262,18 @@ maintainer-clean-am: maintainer-clean-generic distclean-am
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
.PHONY: uninstall-pkgdataDATA install-pkgdataDATA tags distdir info-am \ .PHONY: uninstall-e_docDATA install-e_docDATA uninstall-e_man1DATA \
info dvi-am dvi check check-am installcheck-am installcheck \ install-e_man1DATA tags distdir info-am info dvi-am dvi check check-am \
install-exec-am install-exec install-data-local install-data-am \ installcheck-am installcheck install-exec-am install-exec \
install-data install-am install uninstall-local uninstall-am uninstall \ install-data-local install-data-am install-data install-am install \
all-redirect all-am all installdirs mostlyclean-generic \ uninstall-local uninstall-am uninstall all-redirect all-am all \
distclean-generic clean-generic maintainer-clean-generic clean \ installdirs mostlyclean-generic distclean-generic clean-generic \
mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
.txt.html: .txt.html:
$(converter) -a "$(AWK)" $< $(stylesheet) > $*.html $(converter) -a "$(AWK)" $< $(stylesheet) > $*.html
.txt.ht:
$(converter) -a "$(AWK)" -x $< $(stylesheet) > $*.ht
$(filter): $(filter_src) $(filter): $(filter_src)
cp $(filter_src) $(filter) cp $(filter_src) $(filter)
chmod ugo+x $(filter) chmod ugo+x $(filter)
@ -248,8 +297,8 @@ $(converter_helper3): $(converter_helper3_src)
.dox: $(filter) .dox: $(filter)
if test "$(HAVE_DOXYGEN)" = "yes" ; then cat $(top_srcdir)/src/main/doxygen.cfg | sed "s:__TOP_SRC__:$(top_srcdir):g" | sed "s:__TOP_BUILD__:$(top_builddir):g" | doxygen - && touch .dox ; else echo no doxygen ; fi if test "$(HAVE_DOXYGEN)" = "yes" ; then cat $(top_srcdir)/src/main/doxygen.cfg | sed "s:__TOP_SRC__:$(top_srcdir):g" | sed "s:__TOP_BUILD__:$(top_builddir):g" | doxygen - && touch .dox ; else echo no doxygen ; fi
man.html: emailrelay.1 emailrelay-man.html: emailrelay.1
if test "$(HAVE_MAN2HTML)" = "yes" ; then man2html emailrelay.1 > man.html ; else echo no man2html ; fi if test "$(HAVE_MAN2HTML)" = "yes" ; then man2html $< > emailrelay-man.html ; fi
developer.html reference.html userguide.html: $(converter) developer.html reference.html userguide.html: $(converter)
@ -259,23 +308,24 @@ readme.html: $(top_srcdir)/README $(converter)
changelog.html: $(top_srcdir)/ChangeLog $(converter) changelog.html: $(top_srcdir)/ChangeLog $(converter)
$(converter) -a "$(AWK)" $(top_srcdir)/ChangeLog $(stylesheet) > changelog.html $(converter) -a "$(AWK)" $(top_srcdir)/ChangeLog $(stylesheet) > changelog.html
emailrelay.1.gz : emailrelay.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay.1.gz ; fi
emailrelay-passwd.1.gz : emailrelay-passwd.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-passwd.1.gz ; fi
emailrelay-submit.1.gz : emailrelay-submit.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-submit.1.gz ; fi
emailrelay-poke.1.gz: emailrelay-poke.1
if test -n "$(GZIP)" ; then $(GZIP) -c $< > emailrelay-poke.1.gz ; fi
install-data-local: install-data-local:
$(mkinstalldirs) $(destdir)$(mandir)/man1 $(mkinstalldirs) $(DESTDIR)$(e_docdir)/doxygen
$(INSTALL) $(top_srcdir)/doc/emailrelay.1 $(destdir)$(mandir)/man1/emailrelay.1 if test "$(HAVE_DOXYGEN)" = "yes" ; then for file in doxygen/* ; do $(INSTALL) $$file $(DESTDIR)$(e_docdir)/$$file ; done ; fi
$(INSTALL) $(top_srcdir)/doc/emailrelay-passwd.1 $(destdir)$(mandir)/man1/emailrelay-passwd.1
$(INSTALL) $(top_srcdir)/doc/emailrelay-poke.1 $(destdir)$(mandir)/man1/emailrelay-poke.1
$(INSTALL) $(top_srcdir)/doc/emailrelay-submit.1 $(destdir)$(mandir)/man1/emailrelay-submit.1
$(mkinstalldirs) $(destdir)$(pkgdatadir)/graphics
$(INSTALL) $(top_srcdir)/doc/graphics/bullet.gif $(destdir)$(pkgdatadir)/graphics/bullet.gif
$(mkinstalldirs) $(destdir)$(pkgdatadir)/html
if test "$(HAVE_DOXYGEN)" = "yes" ; then for file in html/* ; do $(INSTALL) $$file $(destdir)$(pkgdatadir)/$$file ; done ; fi
uninstall-local: uninstall-local:
-rm -f $(destdir)$(pkgdatadir)/graphics/bullet.gif -rm -f $(DESTDIR)$(e_docdir)/html/* 2>/dev/null
-rm -f $(destdir)$(pkgdatadir)/html/* 2>/dev/null
-rm -f $(destdir)$(mandir)/man1/emailrelay.1
-rm -f $(destdir)$(mandir)/man1/emailrelay-passwd.1
-rm -f $(destdir)$(mandir)/man1/emailrelay-poke.1
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -30,7 +30,9 @@ line in an
.B emailrelay .B emailrelay
secrets file. secrets file.
.SH SEE ALSO .SH SEE ALSO
.BR emailrelay (1) .BR emailrelay (1),
.BR emailrelay-submit (1),
.BR emailrelay-poke (1)
.br .br
.B RFC2104 .B RFC2104
.br .br

View File

@ -24,12 +24,14 @@ emailrelay-poke \- forces an E-MailRelay server to deliver spooled mail
[ admin-port [ admin-command ] ] [ admin-port [ admin-command ] ]
.SH DESCRIPTION .SH DESCRIPTION
.I emailrelay-poke .I emailrelay-poke
is a small utility which connects to the is a lightweight utility which connects to the
.I emailrelay .I emailrelay
administration interface and executes the administration interface and executes the
.B flush .B flush
command. command.
.SH SEE ALSO .SH SEE ALSO
.BR emailrelay (1) .BR emailrelay (1),
.BR emailrelay-submit (1),
.BR emailrelay-passwd (1)
.SH AUTHOR .SH AUTHOR
Graeme Walker, mailto:graeme_walker@users.sourceforge.net Graeme Walker, mailto:graeme_walker@users.sourceforge.net

View File

@ -21,7 +21,9 @@
emailrelay-submit \- a submission utility for E-MailRelay emailrelay-submit \- a submission utility for E-MailRelay
.SH SYNOPSIS .SH SYNOPSIS
.B emailrelay-submit .B emailrelay-submit
[--help] [--from [--help] [--spool-dir
.IR spool-directory ]
[--from
.IR from-address ] .IR from-address ]
.I to-address .I to-address
.RI [ to-address \ ...] .RI [ to-address \ ...]
@ -33,6 +35,8 @@ command-line, and writes it into the
.B E-MailRelay .B E-MailRelay
spool directory. spool directory.
.SH SEE ALSO .SH SEE ALSO
.BR emailrelay (1) .BR emailrelay (1),
.BR emailrelay-poke (1),
.BR emailrelay-passwd (1)
.SH AUTHOR .SH AUTHOR
Graeme Walker, mailto:graeme_walker@users.sourceforge.net Graeme Walker, mailto:graeme_walker@users.sourceforge.net

View File

@ -36,7 +36,7 @@ emailrelay \- e-mail transfer agent
.SH DESCRIPTION .SH DESCRIPTION
.I emailrelay .I emailrelay
is an simple e-mail message transfer agent. It does store-and-forward is an simple e-mail message transfer agent. It does store-and-forward
mail relay to a fixed downstream server, without any routing. mail relay to a fixed next-hop server, without any routing.
.LP .LP
It runs in two main modes: a storage deamon It runs in two main modes: a storage deamon
.RI ( --as-server ) .RI ( --as-server )
@ -45,12 +45,12 @@ agent
.RI ( --as-client ). .RI ( --as-client ).
The storage daemon is an SMTP server which stores e-mail The storage daemon is an SMTP server which stores e-mail
messages in a local spool directory. The forwarding agent acts as an messages in a local spool directory. The forwarding agent acts as an
SMTP client, which passes the spooled e-mail messages on to a downstrema SMTP client, which passes the spooled e-mail messages on to the next
SMTP server. SMTP server in the chain.
.LP .LP
It can also run in a third mode, as a proxy server It can also run in a third mode, as a proxy server
.RI ( --as-proxy ). .RI ( --as-proxy ).
In this mode all messages are forwarded immediately to the downstream In this mode all messages are forwarded immediately to the next-hop
server. server.
.SH OPTIONS .SH OPTIONS
.TP .TP
@ -135,35 +135,137 @@ Generates more verbose logging (if compiled-in and logging enabled and stderr op
.B \-V,--version .B \-V,--version
Displays version information and exits. Displays version information and exits.
.SH FILES .SH FILES
.IP \(bu 2 GNU style...
/usr/local/sbin/emailrelay .br
.IP \(bu 2 /usr/local/libexec/emailrelay-passwd
.br
/usr/local/libexec/emailrelay-poke /usr/local/libexec/emailrelay-poke
.IP \(bu 2 .br
/usr/local/libexec/emailrelay.sh /usr/local/libexec/emailrelay
.IP \(bu 2 .br
/usr/local/share/emailrelay/*.html /usr/local/libexec/emailrelay-notify.sh
.IP \(bu 2 .br
/usr/local/share/emailrelay/html/*.html /usr/local/libexec/emailrelay-deliver.sh
.IP \(bu 2 .br
/usr/local/share/emailrelay/emailrelay-notify.sh /usr/local/libexec/emailrelay-process.sh
.IP \(bu 2 .br
/usr/local/share/emailrelay/emailrelay-deliver.sh /usr/local/sbin/emailrelay-submit
.IP \(bu 2 .br
/usr/local/share/emailrelay/emailrelay-filter.sh /usr/local/sbin/emailrelay
.IP \(bu 2 .br
/usr/local/man/man1/emailrelay.1 /usr/local/share/emailrelay/doc/developer.txt
.IP \(bu 2 .br
/usr/local/man/man1/emailrelay-poke.1 /usr/local/share/emailrelay/doc/reference.txt
.IP \(bu 2 .br
/usr/local/share/emailrelay/doc/userguide.txt
.br
/usr/local/share/emailrelay/doc/windows.txt
.br
/usr/local/share/emailrelay/doc/readme.html
.br
/usr/local/share/emailrelay/doc/developer.html
.br
/usr/local/share/emailrelay/doc/reference.html
.br
/usr/local/share/emailrelay/doc/userguide.html
.br
/usr/local/share/emailrelay/doc/windows.html
.br
/usr/local/share/emailrelay/doc/emailrelay-man.html
.br
/usr/local/share/emailrelay/doc/index.html
.br
/usr/local/share/emailrelay/doc/changelog.html
.br
/usr/local/share/emailrelay/doc/emailrelay.css
.br
/usr/local/share/emailrelay/doc/NEWS
.br
/usr/local/share/emailrelay/doc/README
.br
/usr/local/share/emailrelay/doc/changelog.gz
.br
/usr/local/man/man1/emailrelay.1.gz
.br
/usr/local/man/man1/emailrelay-passwd.1.gz
.br
/usr/local/man/man1/emailrelay-poke.1.gz
.br
/usr/local/man/man1/emailrelay-submit.1.gz
.br
/usr/local/var/spool/emailrelay/emailrelay.*.envelope /usr/local/var/spool/emailrelay/emailrelay.*.envelope
.IP \(bu 2 .br
/usr/local/var/spool/emailrelay/emailrelay.*.content /usr/local/var/spool/emailrelay/emailrelay.*.content
.LP
FHS style...
.br
/usr/lib/emailrelay-passwd
.br
/usr/lib/emailrelay-poke
.br
/usr/sbin/emailrelay-submit
.br
/usr/sbin/emailrelay
.br
/usr/share/doc/emailrelay/examples/emailrelay-notify.sh
.br
/usr/share/doc/emailrelay/examples/emailrelay-deliver.sh
.br
/usr/share/doc/emailrelay/examples/emailrelay-process.sh
.br
/usr/share/doc/emailrelay/developer.txt
.br
/usr/share/doc/emailrelay/reference.txt
.br
/usr/share/doc/emailrelay/userguide.txt
.br
/usr/share/doc/emailrelay/windows.txt
.br
/usr/share/doc/emailrelay/readme.html
.br
/usr/share/doc/emailrelay/developer.html
.br
/usr/share/doc/emailrelay/reference.html
.br
/usr/share/doc/emailrelay/userguide.html
.br
/usr/share/doc/emailrelay/windows.html
.br
/usr/share/doc/emailrelay/emailrelay-man.html
.br
/usr/share/doc/emailrelay/index.html
.br
/usr/share/doc/emailrelay/changelog.html
.br
/usr/share/doc/emailrelay/emailrelay.css
.br
/usr/share/doc/emailrelay/NEWS
.br
/usr/share/doc/emailrelay/README
.br
/usr/share/doc/emailrelay/changelog.gz
.br
/usr/share/man/man1/emailrelay.1.gz
.br
/usr/share/man/man1/emailrelay-passwd.1.gz
.br
/usr/share/man/man1/emailrelay-poke.1.gz
.br
/usr/share/man/man1/emailrelay-submit.1.gz
.br
/etc/init.d/emailrelay
.br
/var/spool/emailrelay/emailrelay.*.envelope
.br
/var/spool/emailrelay/emailrelay.*.content
.SH SEE ALSO .SH SEE ALSO
E-MailRelay user guide E-MailRelay user guide
.br .br
E-MailRelay reference E-MailRelay reference
.br .br
.BR emailrelay-submit (1),
.BR emailrelay-poke (1),
.BR emailrelay-passwd (1),
.BR syslog (3), .BR syslog (3),
.BR pppd (8), .BR pppd (8),
.BR init.d (7) .BR init.d (7)

View File

@ -19,13 +19,16 @@ div.two-column-menu
border-width: 1px ; border-width: 1px ;
border-color: #999 ; border-color: #999 ;
width: 150px ; width: 230px ; /* IE5 */
voice-family: "\"}\"" ; /* IE5 trick */
voice-family: inherit ;
width: 190px ; /* STD */
} }
body body
{ {
font-family: verdana, arial, helvetica, sans-serif ; font-family: verdana, arial, helvetica, sans-serif ;
background-color: white ; background-color: white ;
} }
div.div-main div.div-main
@ -37,12 +40,15 @@ div.div-main
div.div-toc div.div-toc
{ {
background: #eee ; background: #eee ;
padding: 0.5em ;
} }
div.two-column-menu div.div-toc p.p-toc
{ {
padding: 0px ; padding: 5px ;
margin-top: 0px ;
margin-bottom: 0px ;
margin-left: 0.5em ;
text-align: left ;
} }
div.div-pre div.div-pre
@ -57,7 +63,7 @@ div.div-pre
h1 h1
{ {
text-align: center ; text-align: center ;
color: #09c ; color: #09c ;
} }
img img
@ -67,12 +73,12 @@ img
h2 h2
{ {
color: #09c ; color: #09c ;
} }
p p
{ {
font: verdana, arial, helvetica, sans-serif ; font: verdana, arial, helvetica, sans-serif ;
text-align: justify ; text-align: justify ;
} }
@ -80,7 +86,6 @@ a.a-toc
{ {
color: #09c ; color: #09c ;
text-decoration: none ; text-decoration: none ;
padding-left: 0% ;
} }
a.a-toc:hover a.a-toc:hover
@ -90,13 +95,13 @@ a.a-toc:hover
a.a-header a.a-header
{ {
text-decoration:none ; text-decoration:none ;
} }
a.a-href a.a-href
{ {
text-decoration: none ; text-decoration: none ;
font-weight: bold ; font-weight: bold ;
} }
a.a-href:link a.a-href:link
@ -116,11 +121,11 @@ a.a-href:hover
div.two-column-header div.two-column-header
{ {
background-color: #eee ; background-color: #eee ;
border-style: solid ; border-style: solid ;
border-color: #999 ; border-color: #999 ;
border-width: 1px 0px ; /* top/bottom left/right */ border-width: 1px 0px ; /* top/bottom left/right */
} }
em.quote em.quote
@ -152,24 +157,6 @@ dd
padding-bottom: 4px ; /* for konqueror */ padding-bottom: 4px ; /* for konqueror */
} }
h3.h3-toc
{
margin-bottom: 0px ;
}
ul.ul-toc
{
list-style-type: none ;
margin-top: 0px ;
margin-bottom: 0px ;
padding-left: 15% ;
}
li.li-toc
{
padding-top: 3%
}
span.span-mailto span.span-mailto
{ {
font-size: smaller ; font-size: smaller ;
@ -178,6 +165,6 @@ span.span-mailto
#img-sourceforge #img-sourceforge
{ {
border-width: 0px ; border-width: 0px ;
border-style: none ; /* check */ border-style: none ; /* check */
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

View File

@ -14,10 +14,11 @@
<li><a href="reference.html">Reference manual</a></li> <li><a href="reference.html">Reference manual</a></li>
<li><a href="windows.html">Windows installation guide</a></li> <li><a href="windows.html">Windows installation guide</a></li>
<li><a href="developer.html">Notes for developers</a></li> <li><a href="developer.html">Notes for developers</a></li>
<li><a href="html/index.html">Source code documentation</a> (generated by <a href="http://www.doxygen.org">doxygen</a>, if available)</li> <li><a href="doxygen/index.html">Source code documentation</a> (generated by <a href="http://www.doxygen.org">doxygen</a>, if available)</li>
<li><a href="man.html">Man page</a> (generated by man2html, if available)</li> <li><a href="emailrelay-man.html">Man page</a> (generated by man2html, if available)</li>
<li><a href="http://emailrelay.sourceforge.net">Web site</a></li> <li><a href="http://emailrelay.sourceforge.net">Web site</a></li>
</ul> </ul>
</div> </div>
</body> </body>
</html> </html>
<!-- Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>. All rights reserved. -->

View File

@ -132,9 +132,9 @@ The envelope suffixes are:
* <none> -- while the message is spooled * <none> -- while the message is spooled
* ".busy" -- while the message is being forwarded * ".busy" -- while the message is being forwarded
* ".bad" -- if the message cannot be forwarded * ".bad" -- if the message cannot be forwarded
* ".local" -- for copies of the envelope file for delivery to local recipeints * ".local" -- for copies of the envelope file for delivery to local recipients
Copies of the content file for delivery to local recipeints will also have Copies of the content file for delivery to local recipients will also have
a "local" suffix. a "local" suffix.
If a message cannot be forwarded the envelope file is given a "bad" suffix, If a message cannot be forwarded the envelope file is given a "bad" suffix,
@ -152,7 +152,7 @@ SMTP issues
(where "fqdn" is the host's fully qualified domain name) are treated as the local (where "fqdn" is the host's fully qualified domain name) are treated as the local
postmaster, resulting in local delivery rather than mail forwarding. postmaster, resulting in local delivery rather than mail forwarding.
Receipient addresses (other than "postmaster" addresses) with no "at" sign (@) or Recipient addresses (other than "postmaster" addresses) with no "at" sign (@) or
ending in "@localhost" will be rejected at the time the message is submitted by the ending in "@localhost" will be rejected at the time the message is submitted by the
e-mail front-end. This is in line with E-MailRelay's intended purpose as a simple e-mail front-end. This is in line with E-MailRelay's intended purpose as a simple
mail relay, rather than a fully-fledged routing MTA. mail relay, rather than a fully-fledged routing MTA.
@ -178,7 +178,7 @@ SMTP issues
# Eight bit messages: # Eight bit messages:
The 8BITMIME SMTP extension is supported, however no attempt is made to The 8BITMIME SMTP extension is supported, however no attempt is made to
re-encode 8-bit messages into 7-bit messages if the downstream server re-encode 8-bit messages into 7-bit messages if the next-hop server
does not. does not.
Administration interface Administration interface
@ -188,8 +188,8 @@ administration tasks. This is a simple command-line interface which is
compatible with "telnet". compatible with "telnet".
Currently the only supported commands are "flush" and "info". The "flush" command Currently the only supported commands are "flush" and "info". The "flush" command
is used to forward spooled mail to the configured dowstream SMTP server. The is used to forward spooled mail to the configured next-hop SMTP server. The
downstream server address must have been defined on the "emailrelay" command next-hop server address must have been defined on the "emailrelay" command
line at start-up using the "--forward-to" switch; it cannot be specified through line at start-up using the "--forward-to" switch; it cannot be specified through
the administration interface. the administration interface.
@ -251,15 +251,19 @@ A major security concern is the use of an external mail pre-processor (using the
# effective userid # effective userid
Root or suid privileges are revoked at start-up, switching to the real userid Suid privileges are revoked at start-up, switching the effective userid/groupid
or "daemon" if the real userid is root. Special privileges are only reclaimed to be the real userid/groupid values. If started as "root" then the effective
when needed to bind sockets and do file i/o. userid/groupid are taken from the "daemon" user. Special privileges are only
reclaimed when needed to bind sockets and do file i/o. Normally this means
temporarily switching the userid and groupid back to what they were at start-up.
However, when writing spool files only the effective userid is changed, not the
groupid.
# execution environment # execution environment
The pre-processor runs with an almost empty set of environment variables, The pre-processor runs with an almost empty set of environment variables ("PATH"
and with no open file descriptors other than "stdin"/"stdout"/"stderr" open and "IFS"), and with no open file descriptors other than "stdin"/"stdout"/"stderr"
onto "/dev/null". open onto "/dev/null".
# configuration # configuration
@ -276,11 +280,12 @@ such as those which use digital signatures."
The "Authentication" section below also relates to security. The "Authentication" section below also relates to security.
Some other points are: Some other points are:
* The program runs with a "umask" of 177 so files are created with "-rw-------" permissions. * The program runs for most of the time with a "umask" of 177, switching to 117 when creating spool files.
* Strings are dynamically allocated, so buffer overflow/truncation issues are avoided. * Strings are dynamically allocated, so buffer overflow/truncation issues are avoided.
* By default connections to the SMTP and administrative ports will be rejected if they come from remote machines. * By default connections to the SMTP and administrative ports will be rejected if they come from remote machines.
* No configuration parameters can be changed through the administrative interface. * No configuration parameters can be changed through the administrative interface.
* No exec(), system() or popen() calls are used other than execve() to spawn the mail pre-processor. * No exec(), system() or popen() calls are used other than execve() to spawn the mail pre-processor.
* The submit utility is installed as set-group-id with group ownership of "daemon".
Authentication Authentication
-------------- --------------
@ -303,12 +308,12 @@ identifier; and the "secret" field is the xtext-encoded "LOGIN" password or
"CRAM-MD5" keys can be generated using the "emailrelay-passwd" utility. "CRAM-MD5" keys can be generated using the "emailrelay-passwd" utility.
A client-side secrets file should contain at least one "LOGIN client" or A client-side secrets file should contain at least one "LOGIN client" or
"CRAM-MD5 client" entry. A server-side secrets file should contains zero or "CRAM-MD5 client" entry. A server-side secrets file should contain zero or
more "LOGIN server" or "CRAM-MD5 server" entries. The same secrets file may more "LOGIN server" or "CRAM-MD5 server" entries. The same secrets file may
be specified for both "--auth-client" and "--auth-server" switches. be specified for both "--auth-client" and "--auth-server" switches.
For example, the following secrets file defines "jsmith" as the username to be For example, the following secrets file defines "jsmith" as the username to be
used when E-MailRelay authenticates with a downstream server, and defines two used when E-MailRelay authenticates with a next-hop server, and defines two
usernames ("user1" and "user2") which can be used by clients when they usernames ("user1" and "user2") which can be used by clients when they
authenticate with the E-MailRelay server: authenticate with the E-MailRelay server:
@ -337,7 +342,7 @@ On the server side authentication is advertised in the response to the SMTP
"EHLO" command if the "--auth-server" command line switch is used, but "EHLO" command if the "--auth-server" command line switch is used, but
authentication by the client is optional. If the client does authenticate then authentication by the client is optional. If the client does authenticate then
the authenticated user-id is stored with the message and then passed on to a the authenticated user-id is stored with the message and then passed on to a
downstream server using an "AUTH=userid" parameter on the SMTP "MAIL FROM" next-hop server using an "AUTH=userid" parameter on the SMTP "MAIL FROM"
command. If the client chooses not to authenticate then the submitted messages command. If the client chooses not to authenticate then the submitted messages
will be forwarded using "AUTH=<>" on the "MAIL FROM" command. Note that any will be forwarded using "AUTH=<>" on the "MAIL FROM" command. Note that any
"AUTH=userid" information on incoming submitted messages is ignored and "AUTH=userid" information on incoming submitted messages is ignored and
@ -357,25 +362,101 @@ from a particular IP address is allowed. This type of POP-before-SMTP
authentication can be done outside the E-MailRelay system by POP/IMAP utilities authentication can be done outside the E-MailRelay system by POP/IMAP utilities
such as "fetchmail". such as "fetchmail".
Files Installation directories
----- ------------------------
By default "make install" installs files in the following locations: By default "make install" installs files in the following locations:
* /usr/local/libexec/emailrelay-poke * /usr/local/libexec/emailrelay-poke
* /usr/local/libexec/emailrelay-passwd * /usr/local/libexec/emailrelay-notify.sh
* /usr/local/libexec/emailrelay.sh * /usr/local/libexec/emailrelay-deliver.sh
* /usr/local/libexec/emailrelay-resubmit.sh
* /usr/local/libexec/emailrelay
* /usr/local/libexec/emailrelay-process.sh
* /usr/local/sbin/emailrelay * /usr/local/sbin/emailrelay
* /usr/local/var/spool/emailrelay/empty_file * /usr/local/sbin/emailrelay-passwd
* /usr/local/share/emailrelay/emailrelay-notify.sh * /usr/local/sbin/emailrelay-submit
* /usr/local/share/emailrelay/emailrelay-deliver.sh * /usr/local/var/spool/emailrelay/*
* /usr/local/share/emailrelay/emailrelay-process.sh * /usr/local/share/emailrelay/doc/developer.txt
* /usr/local/share/emailrelay/*.html * /usr/local/share/emailrelay/doc/reference.txt
* /usr/local/share/emailrelay/graphics/bullet.gif * /usr/local/share/emailrelay/doc/userguide.txt
* /usr/local/man/man1/emailrelay.1 * /usr/local/share/emailrelay/doc/windows.txt
* /usr/local/man/man1/emailrelay-poke.1 * /usr/local/share/emailrelay/doc/readme.html
* /usr/local/share/emailrelay/doc/developer.html
* /usr/local/share/emailrelay/doc/reference.html
* /usr/local/share/emailrelay/doc/userguide.html
* /usr/local/share/emailrelay/doc/windows.html
* /usr/local/share/emailrelay/doc/emailrelay-man.html
* /usr/local/share/emailrelay/doc/index.html
* /usr/local/share/emailrelay/doc/changelog.html
* /usr/local/share/emailrelay/doc/emailrelay.css
* /usr/local/share/emailrelay/doc/NEWS
* /usr/local/share/emailrelay/doc/README
* /usr/local/share/emailrelay/doc/changelog.gz
* /usr/local/share/emailrelay/doc/doxygen/*
* /usr/local/man/man1/emailrelay.1.gz
* /usr/local/man/man1/emailrelay-passwd.1.gz
* /usr/local/man/man1/emailrelay-poke.1.gz
* /usr/local/man/man1/emailrelay-submit.1.gz
This directory structure is constrained by the GNU/"autoconf" conventions rather This directory structure is constrained by the GNU/"autoconf" conventions rather
than the Filesystem Hierarchy Standard. than the Filesystem Hierarchy Standard (FHS).
To force FHS compliance you can use the "--enable-fhs" switch when running
"configure". This results in the following file locations:
* /usr/lib/emailrelay/emailrelay-poke
* /usr/sbin/emailrelay
* /usr/sbin/emailrelay-passwd
* /usr/sbin/emailrelay-submit
* /usr/share/doc/emailrelay/examples/emailrelay-notify.sh
* /usr/share/doc/emailrelay/examples/emailrelay-deliver.sh
* /usr/share/doc/emailrelay/examples/emailrelay-resubmit.sh
* /usr/share/doc/emailrelay/examples/emailrelay-process.sh
* /usr/share/doc/emailrelay/developer.txt
* /usr/share/doc/emailrelay/reference.txt
* /usr/share/doc/emailrelay/userguide.txt
* /usr/share/doc/emailrelay/windows.txt
* /usr/share/doc/emailrelay/readme.html
* /usr/share/doc/emailrelay/developer.html
* /usr/share/doc/emailrelay/reference.html
* /usr/share/doc/emailrelay/userguide.html
* /usr/share/doc/emailrelay/windows.html
* /usr/share/doc/emailrelay/emailrelay-man.html
* /usr/share/doc/emailrelay/index.html
* /usr/share/doc/emailrelay/changelog.html
* /usr/share/doc/emailrelay/emailrelay.css
* /usr/share/doc/emailrelay/NEWS
* /usr/share/doc/emailrelay/README
* /usr/share/doc/emailrelay/changelog.gz
* /usr/share/doc/emailrelay/doxygen/*
* /usr/share/man/man1/emailrelay.1.gz
* /usr/share/man/man1/emailrelay-passwd.1.gz
* /usr/share/man/man1/emailrelay-poke.1.gz
* /usr/share/man/man1/emailrelay-submit.1.gz
* /var/spool/emailrelay/*
* /etc/init.d/emailrelay
For finer control of the directory structure the following variables
can be specified on the "configure" command line (but note that the
"--enable-fhs" will override them):
* e_sbindir
* e_libexecdir
* e_docdir
* e_initdir
* e_spooldir
* e_man1dir
* e_examplesdir
For example, running "./configure --prefix=/usr e_spooldir=/tmp/spool" will
create the GNU-style directory structure under "/usr" rather than "/usr/local",
and create the E-MailRelay spool directory as "/tmp/spool" rather than
"/usr/local/var/spool/emailrelay".
The default spool directory path which is built into the executables and scripts
comes from "configure", via the makefiles. So if you re-run "configure" with a
different spool directory you should also do a "make clean" in at least
"src/main" and "bin".
The "emailrelay" script in "init.d" creates a pid file in "/var/run" if the
directory exists, or in "/tmp" otherwise.
Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>. All rights reserved. Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>. All rights reserved.

View File

@ -6,7 +6,7 @@ What is it?
E-MailRelay is a simple store-and-forward e-mail transfer agent. It's a program E-MailRelay is a simple store-and-forward e-mail transfer agent. It's a program
which runs in the background and accepts e-mail from front-ends (KMail, Outlook, which runs in the background and accepts e-mail from front-ends (KMail, Outlook,
Netscape etc.), stores the messages on the hard disk, and when next connected Netscape etc.), stores the messages on the hard disk, and when next connected
to the Internet forwards them to a downstream SMTP server for onward delivery. to the Internet forwards them to a next SMTP server for onward delivery.
The E-MailRelay program ("emailrelay") can run in two main modes: a storage The E-MailRelay program ("emailrelay") can run in two main modes: a storage
daemon, or a forwarding agent. As a storage daemon it waits for connections daemon, or a forwarding agent. As a storage daemon it waits for connections
@ -19,7 +19,7 @@ storage daemon it acts as an SMTP server, and when running as a forwarding
agent it acts as an SMTP client. agent it acts as an SMTP client.
The program can also run as a proxy server. In this mode e-mails submitted at The program can also run as a proxy server. In this mode e-mails submitted at
the server interface are passed on to the dowstream server immediately, without the server interface are passed on to the next server immediately, without
spooling. This can be useful when combined with mail pre-processing to do things spooling. This can be useful when combined with mail pre-processing to do things
like encryption, message archiving, addition of digital signatures, etc. like encryption, message archiving, addition of digital signatures, etc.
@ -113,9 +113,10 @@ found and what your default run level is:
$ runlevel | awk '{print $2}' $ runlevel | awk '{print $2}'
Assuming these are "/etc/init.d" and "5" you should (as root) copy the Assuming these are "/etc/init.d" and "5" you should (as root) copy the
E-MailRelay start/stop script into "/etc/init.d": E-MailRelay start/stop script into "/etc/init.d" (if it is not already
installed there):
$ cp /usr/local/libexec/emailrelay.sh /etc/init.d $ cp /usr/local/libexec/emailrelay /etc/init.d
Then determine an appropriate numeric value for the link names by looking at Then determine an appropriate numeric value for the link names by looking at
the "sendmail" links: the "sendmail" links:
@ -127,8 +128,8 @@ Assuming sendmail links are "S10sendmail" and "K10sendmail", create
the "emailrelay" links in the same format: the "emailrelay" links in the same format:
$ cd /etc/init.d/rc5.d $ cd /etc/init.d/rc5.d
$ ln -s ../emailrelay.sh S10emailrelay $ ln -s ../emailrelay S10emailrelay
$ ln -s ../emailrelay.sh K10emailrelay $ ln -s ../emailrelay K10emailrelay
And finally remove sendmail from the run-level (otherwise both And finally remove sendmail from the run-level (otherwise both
daemons compete for the standard SMTP listening port): daemons compete for the standard SMTP listening port):
@ -173,8 +174,9 @@ Notification of failed e-mails
If e-mail messages become corrupted or inaccessible within the spool directory If e-mail messages become corrupted or inaccessible within the spool directory
then they will get failed within the E-MailRelay system. In order to get failed then they will get failed within the E-MailRelay system. In order to get failed
e-mails to 'bounce' back into your in-tray you will need to run the e-mails to 'bounce' back into your in-tray you will need to run the
"emailrelay-notify.sh" script periodically. Note that this script requires "emailrelay-notify.sh" script (as "root") periodically. Note that this script
that you have "procmail" installed on your system to act as a "delivery agent". requires that you have "procmail" installed on your system to act as a
"delivery agent".
There are not many ways in which an e-mail can fail within the E-MailRelay There are not many ways in which an e-mail can fail within the E-MailRelay
system. If everything is set up correctly then perhaps the most likely case is system. If everything is set up correctly then perhaps the most likely case is
@ -184,9 +186,14 @@ a simple check in your ".profile" script for "*.bad" files in the spool
directory may be sufficient: directory may be sufficient:
$ cat <<EOF >> ~/.profile $ cat <<EOF >> ~/.profile
if test -f /usr/local/var/spool/emailrelay/*.envelope.bad ; then echo Failed mail >&2 ; fi if test -f /var/spool/emailrelay/*.envelope.bad ; then echo Failed mail >&2 ; fi
EOF EOF
If you want failed e-mails to be retried a few times before bouncing back into
your in-tray, you can run the "emailrelay-resubmit.sh" script. This simply
removes the ".bad" suffix from files in the spool directory, as long as they
have not been retried too many times already.
Logging Logging
------- -------
The E-MailRelay program uses the "syslog" system to issue warnings and error messages, The E-MailRelay program uses the "syslog" system to issue warnings and error messages,

View File

@ -1,21 +1,21 @@
Summary: Simple e-mail message transfer agent using SMTP Summary: Simple e-mail message transfer agent using SMTP
Name: emailrelay Name: emailrelay
Version: 0.9.8 Version: 0.9.9
Release: 1 Release: 1
Copyright: GPL Copyright: GPL
Group: System Environment/Daemons Group: System Environment/Daemons
Source: http://emailrelay.sourceforge.net/.../emailrelay-src-0.9.8.tar.gz Source: http://emailrelay.sourceforge.net/.../emailrelay-src-0.9.9.tar.gz
BuildRoot: /tmp/emailrelay-install BuildRoot: /tmp/emailrelay-install
%description %description
E-MailRelay is a simple SMTP store-and-forward message transfer agent (MTA). E-MailRelay is a simple SMTP store-and-forward message transfer agent (MTA).
It runs as an SMTP server, storing e-mail in a local spool directory, and It runs as an SMTP server, storing e-mail in a local spool directory, and
then forwarding the stored messages to a downstream SMTP server on request. then forwarding the stored messages to the next SMTP server on request.
It can also run as a proxy server, forwarding (and optionally pre-processing) It can also run as a proxy server, forwarding (and optionally pre-processing)
e-mail as soon as it is received. It does not do any message routing, other e-mail as soon as it is received. It does not do any message routing, other
than to a local postmaster. Because of this functional simplicity it is than to a local postmaster. Because of this functional simplicity it is
extremely easy to configure, typically only requiring the address of the extremely easy to configure, typically only requiring the address of the
downstream SMTP server to be put on the command line. next-hop SMTP server to be put on the command line.
C++ source code is available for Linux, FreeBSD and Windows. Distribution is C++ source code is available for Linux, FreeBSD and Windows. Distribution is
under the GNU General Public License. under the GNU General Public License.
@ -24,38 +24,46 @@ under the GNU General Public License.
%setup %setup
%build %build
./configure ./configure --enable-fhs
make HAVE_DOXYGEN=no make HAVE_DOXYGEN=no HAVE_MAN2HTML=no
%install %install
make install destdir=$RPM_BUILD_ROOT DESTDIR=$RPM_BUILD_ROOT HAVE_DOXYGEN=no make install destdir=$RPM_BUILD_ROOT DESTDIR=$RPM_BUILD_ROOT HAVE_DOXYGEN=no HAVE_MAN2HTML=no
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%files %files
/usr/local/libexec/emailrelay-passwd /usr/lib/emailrelay/emailrelay-poke
/usr/local/libexec/emailrelay-poke /usr/sbin/emailrelay
/usr/local/libexec/emailrelay-submit /usr/sbin/emailrelay-passwd
/usr/local/libexec/emailrelay.sh /usr/sbin/emailrelay-submit
/usr/local/sbin/emailrelay /usr/share/doc/emailrelay/examples/emailrelay-process.sh
/usr/local/var/spool/emailrelay/empty_file /usr/share/doc/emailrelay/examples/emailrelay-notify.sh
/usr/local/share/emailrelay/emailrelay-notify.sh /usr/share/doc/emailrelay/examples/emailrelay-deliver.sh
/usr/local/share/emailrelay/emailrelay-deliver.sh /usr/share/doc/emailrelay/examples/emailrelay-resubmit.sh
/usr/local/share/emailrelay/emailrelay-process.sh /usr/share/doc/emailrelay/developer.txt
/usr/local/share/emailrelay/readme.html /usr/share/doc/emailrelay/reference.txt
/usr/local/share/emailrelay/developer.html /usr/share/doc/emailrelay/userguide.txt
/usr/local/share/emailrelay/reference.html /usr/share/doc/emailrelay/windows.txt
/usr/local/share/emailrelay/userguide.html /usr/share/doc/emailrelay/readme.html
/usr/local/share/emailrelay/man.html /usr/share/doc/emailrelay/developer.html
/usr/local/share/emailrelay/index.html /usr/share/doc/emailrelay/reference.html
/usr/local/share/emailrelay/windows.html /usr/share/doc/emailrelay/userguide.html
/usr/local/share/emailrelay/changelog.html /usr/share/doc/emailrelay/windows.html
/usr/local/share/emailrelay/graphics/bullet.gif /usr/share/doc/emailrelay/index.html
/usr/local/man/man1/emailrelay.1 /usr/share/doc/emailrelay/changelog.html
/usr/local/man/man1/emailrelay-passwd.1 /usr/share/doc/emailrelay/emailrelay.css
/usr/local/man/man1/emailrelay-poke.1 /usr/share/doc/emailrelay/NEWS
/usr/share/doc/emailrelay/README
/usr/share/doc/emailrelay/changelog.gz
/usr/share/doc/emailrelay/doxygen
/usr/share/man/man1/emailrelay.1.gz
/usr/share/man/man1/emailrelay-passwd.1.gz
/usr/share/man/man1/emailrelay-poke.1.gz
/usr/share/man/man1/emailrelay-submit.1.gz
/etc/init.d/emailrelay
%changelog %changelog

View File

@ -1 +1,19 @@
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SUBDIRS = gcc2.95 msvc6.0 SUBDIRS = gcc2.95 msvc6.0

View File

@ -10,6 +10,25 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SHELL = @SHELL@ SHELL = @SHELL@
@ -61,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -68,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
SUBDIRS = gcc2.95 msvc6.0 SUBDIRS = gcc2.95 msvc6.0
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -82,7 +109,7 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
EXTRA_DIST = iostream limits sstream xlocale EXTRA_DIST = iostream limits sstream xlocale

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
SHELL = @SHELL@ SHELL = @SHELL@
@ -81,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -88,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = iostream limits sstream xlocale EXTRA_DIST = iostream limits sstream xlocale
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -102,7 +109,7 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/gcc2.95/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/gcc2.95/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -16,6 +16,5 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
EXTRA_DIST = cstdio cstdlib cstring ctime EXTRA_DIST = cstdio cstdlib cstring ctime

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
SHELL = @SHELL@ SHELL = @SHELL@
@ -81,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -88,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = cstdio cstdlib cstring ctime EXTRA_DIST = cstdio cstdlib cstring ctime
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -102,7 +109,7 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/msvc6.0/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/msvc6.0/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -1 +1,19 @@
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SUBDIRS = glib gnet main win32 SUBDIRS = glib gnet main win32

View File

@ -10,6 +10,25 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
#
# Copyright (C) 2001-2002 Graeme Walker <graeme_walker@users.sourceforge.net>
#
# This program 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.
#
# This program 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 received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
SHELL = @SHELL@ SHELL = @SHELL@
@ -61,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -68,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
SUBDIRS = glib gnet main win32 SUBDIRS = glib gnet main win32
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@ -82,7 +109,7 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
EXTRA_DIST=garg_win32.cpp \ EXTRA_DIST=garg_win32.cpp \
gdaemon_win32.cpp \ gdaemon_win32.cpp \
gdatetime_win32.cpp \ gdatetime_win32.cpp \

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
SHELL = @SHELL@ SHELL = @SHELL@
@ -81,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -88,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = garg_win32.cpp gdaemon_win32.cpp gdatetime_win32.cpp gdirectory_win32.cpp gfs_win32.cpp glogoutput_win32.cpp gprocess_win32.cpp gfile_win32.cpp md5c.c md5.h EXTRA_DIST = garg_win32.cpp gdaemon_win32.cpp gdatetime_win32.cpp gdirectory_win32.cpp gfs_win32.cpp glogoutput_win32.cpp gprocess_win32.cpp gfile_win32.cpp md5c.c md5.h
@ -132,7 +139,7 @@ OBJECTS = $(libglib_a_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .S .c .cpp .o .s .SUFFIXES: .S .c .cpp .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/glib/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/glib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -29,7 +29,4 @@
#include "glog.h" #include "glog.h"
#include "gassert.h" #include "gassert.h"
// backwards compatibility...
//typedef LogOutput GDebug ;
#endif #endif

View File

@ -49,7 +49,7 @@ class G::Log
{ {
public: public:
typedef std::ostream Stream ; typedef std::ostream Stream ;
enum Severity { s_Log , s_Debug , s_Warning , s_Error , s_Assertion } ; enum Severity { s_LogVerbose , s_LogSummary , s_Debug , s_Warning , s_Error , s_Assertion } ;
struct End // A private implementation class for Log. An End object from end() must be streamed out to flush a spooled message. struct End // A private implementation class for Log. An End object from end() must be streamed out to flush a spooled message.
{ Severity m_s ; End(Severity s) : m_s(s) {} } ; { Severity m_s ; End(Severity s) : m_s(s) {} } ;
@ -105,7 +105,7 @@ namespace G
} }
} ; } ;
// Macros: G_LOG, G_DEBUG, G_WARNING, G_ERROR // Macros: G_LOG, G_LOG_S, G_DEBUG, G_WARNING, G_ERROR
// The debug macro is for debugging during development. The log macro // The debug macro is for debugging during development. The log macro
// is used for progress logging, typically in long-lived server processes. // is used for progress logging, typically in long-lived server processes.
// The warning and error macros are used for error warning/error messages. // The warning and error macros are used for error warning/error messages.
@ -113,16 +113,18 @@ namespace G
// then warning/error messages should also get raised by some another // then warning/error messages should also get raised by some another
// independent means. // independent means.
// //
#define G_LOG_OUTPUT( expr , severity ) { try { G::Log::stream() << G::Log::Line(__FILE__,__LINE__) << expr << G::Log::end(severity) ; } catch(...) {} } #define G_LOG_OUTPUT( expr , severity ) { G::Log::stream() << G::Log::Line(__FILE__,__LINE__) << expr << G::Log::end(severity) ; }
#if defined(_DEBUG) && ! defined(G_NO_DEBUG) #if defined(_DEBUG) && ! defined(G_NO_DEBUG)
#define G_DEBUG( expr ) G_LOG_OUTPUT( expr , G::Log::s_Debug ) #define G_DEBUG( expr ) G_LOG_OUTPUT( expr , G::Log::s_Debug )
#else #else
#define G_DEBUG( expr ) #define G_DEBUG( expr )
#endif #endif
#if ! defined(G_NO_LOG) #if ! defined(G_NO_LOG)
#define G_LOG( expr ) G_LOG_OUTPUT( expr , G::Log::s_Log ) #define G_LOG( expr ) G_LOG_OUTPUT( expr , G::Log::s_LogVerbose )
#define G_LOG_S( expr ) G_LOG_OUTPUT( expr , G::Log::s_LogSummary )
#else #else
#define G_LOG( expr ) #define G_LOG( expr )
#define G_LOG_S( expr )
#endif #endif
#define G_WARNING( expr ) G_LOG_OUTPUT( expr , G::Log::s_Warning ) #define G_WARNING( expr ) G_LOG_OUTPUT( expr , G::Log::s_Warning )
#define G_ERROR( expr ) G_LOG_OUTPUT( expr , G::Log::s_Error ) #define G_ERROR( expr ) G_LOG_OUTPUT( expr , G::Log::s_Error )

View File

@ -27,23 +27,56 @@
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
G::LogOutput *G::LogOutput::m_this = NULL ; G::LogOutput * G::LogOutput::m_this = NULL ;
G::LogOutput::LogOutput( bool enabled , bool verbose ) : G::LogOutput::LogOutput( const std::string & prefix , bool enabled , bool summary_log ,
m_enabled(enabled) , bool verbose_log , bool debug , bool level , bool timestamp , bool strip ) :
m_verbose(verbose) , m_prefix(prefix) ,
m_syslog(false) , m_enabled(enabled) ,
m_time(0) , m_summary_log(summary_log) ,
m_timestamp(false) m_verbose_log(verbose_log) ,
m_debug(debug) ,
m_level(level) ,
m_strip(strip) ,
m_syslog(false) ,
m_time(0) ,
m_timestamp(timestamp) ,
m_handle(0) ,
m_handle_set(false)
{ {
if( m_this == NULL ) if( m_this == NULL )
m_this = this ; m_this = this ;
init() ;
}
G::LogOutput::LogOutput( bool enabled_and_summary , bool verbose_and_debug ) :
m_enabled(enabled_and_summary) ,
m_summary_log(enabled_and_summary) ,
m_verbose_log(verbose_and_debug) ,
m_debug(verbose_and_debug) ,
m_level(false) ,
m_strip(false) ,
m_syslog(false) ,
m_time(0) ,
m_timestamp(false) ,
m_handle(0) ,
m_handle_set(false)
{
if( m_this == NULL )
m_this = this ;
init() ;
} }
G::LogOutput::~LogOutput() G::LogOutput::~LogOutput()
{ {
if( m_this == this ) if( m_this == this )
m_this = NULL ; m_this = NULL ;
cleanup() ;
}
G::LogOutput * G::LogOutput::instance()
{
return m_this ;
} }
bool G::LogOutput::enable( bool enabled ) bool G::LogOutput::enable( bool enabled )
@ -53,41 +86,80 @@ bool G::LogOutput::enable( bool enabled )
return was_enabled ; return was_enabled ;
} }
//static
void G::LogOutput::itoa( char *out , unsigned int n )
{
n = n % 1000000U ;
if( n == 0U )
{
out[0U] = '0' ;
out[1U] = '\0' ;
}
else
{
char buffer[15U] ;
char *p = buffer + sizeof(buffer) - 1 ;
*p-- = '\0' ;
for( ; n > 0U ; --p )
{
*p = '0' + (n % 10U) ;
n /= 10U ;
}
std::strcpy( out , p+1 ) ;
}
}
void G::LogOutput::timestamp() void G::LogOutput::timestamp()
{ {
m_timestamp = true ; m_timestamp = true ;
} }
void G::LogOutput::syslog()
{
syslog( User ) ;
}
void G::LogOutput::syslog( SyslogFacility facility )
{
m_syslog = true ;
m_facility = facility ;
}
//static
void G::LogOutput::output( Log::Severity severity , const char * file , unsigned int line , const char * text )
{
if( m_this != NULL )
m_this->doOutput( severity , file , line , text ) ;
}
void G::LogOutput::doOutput( Log::Severity severity , const char * file , unsigned int line , const char * text )
{
bool do_output = m_enabled ;
if( severity == Log::s_Debug )
do_output = m_enabled && m_debug ;
else if( severity == Log::s_LogSummary )
do_output = m_enabled && m_summary_log ;
else if( severity == Log::s_LogVerbose )
do_output = m_enabled && m_verbose_log ;
if( do_output )
{
text = text ? text : "" ;
char buffer[500U] ;
buffer[0U] = '\0' ;
if( severity == Log::s_Debug )
{
addFileAndLine( buffer , sizeof(buffer) , file , line ) ;
}
else
{
if( m_prefix.length() )
add( buffer , sizeof(buffer) , m_prefix + ": " ) ;
if( m_timestamp )
add( buffer , sizeof(buffer) , timestampString() ) ;
if( m_level )
add( buffer , sizeof(buffer) , levelString(severity) ) ;
if( m_strip )
text = std::strchr(text,' ') ? (std::strchr(text,' ')+1U) : text ;
}
add( buffer , sizeof(buffer) , text ) ;
rawOutput( severity , buffer ) ;
}
}
void G::LogOutput::onAssert()
{
// no-op
}
const char * G::LogOutput::timestampString() const char * G::LogOutput::timestampString()
{ {
std::time_t now = std::time(NULL) ; std::time_t now = std::time(NULL) ;
if( m_time == 0 || m_time != now ) if( m_time == 0 || m_time != now ) // optimise calls to localtime() & strftime()
{ {
m_time = now ; m_time = now ;
struct std::tm * tm_p = std::localtime( &m_time ) ; struct std::tm * tm_p = std::localtime( &m_time ) ;
@ -97,123 +169,95 @@ const char * G::LogOutput::timestampString()
} }
return m_time_buffer ; return m_time_buffer ;
} }
//static
void G::LogOutput::output( G::Log::Severity severity , const char *text )
{
if( m_this != NULL )
m_this->doOutput( severity , text ) ;
}
void G::LogOutput::doOutput( G::Log::Severity severity , const char *text )
{
if( m_enabled )
{
if( severity != G::Log::s_Debug || m_verbose )
{
rawOutput( severity , text ? text : "" ) ;
if( text && text[0U] && text[std::strlen(text)-1U] != '\n' )
rawOutput( severity , "\n" ) ;
}
}
}
//static
void G::LogOutput::output( G::Log::Severity severity , const char *file, unsigned line, const char *text )
{
if( m_this != NULL )
m_this->doOutput( severity , file , line , text ) ;
}
void G::LogOutput::doOutput( G::Log::Severity severity , const char *file, unsigned line, const char *text )
{
if( m_enabled )
{
file = file ? file : "" ;
text = text ? text : "" ;
char buffer[500U] ;
buffer[0U] = '\0' ;
if( severity == G::Log::s_Debug )
addFileAndLine( buffer , sizeof(buffer) , file , line ) ;
else if( m_timestamp )
addTimestamp( buffer , sizeof(buffer) , timestampString() ) ;
std::strncat( buffer + std::strlen(buffer) , text , sizeof(buffer) - 1U - std::strlen(buffer) ) ;
output( severity , buffer ) ;
}
}
G::LogOutput *G::LogOutput::instance()
{
return m_this ;
}
void G::LogOutput::onAssert()
{
// no-op
}
//static //static
void G::LogOutput::addFileAndLine( char *buffer , size_t size , const char *file , int line ) void G::LogOutput::addFileAndLine( char *buffer , size_t size , const char *file , int line )
{ {
const char *forward = std::strrchr( file , '/' ) ; if( file != NULL )
const char *back = std::strrchr( file , '\\' ) ; {
const char *last = forward > back ? forward : back ; const char *forward = std::strrchr( file , '/' ) ;
const char *basename = last ? (last+1) : file ; const char *back = std::strrchr( file , '\\' ) ;
const char *last = forward > back ? forward : back ;
const char *basename = last ? (last+1) : file ;
std::strncat( buffer+std::strlen(buffer) , basename , size-std::strlen(buffer)-1U ) ; add( buffer , size , basename ) ;
std::strncat( buffer+std::strlen(buffer) , "(" , size-std::strlen(buffer)-1U ) ; add( buffer , size , "(" ) ;
char b[15U] ; char b[15U] ;
itoa( b , line ) ; // (implemented above) add( buffer , sizeof(buffer) , itoa(b,sizeof(b),line) ) ;
std::strncat( buffer+std::strlen(buffer) , b , size-std::strlen(buffer)-1U ) ; add( buffer , sizeof(buffer) , "): " ) ;
std::strncat( buffer+std::strlen(buffer) , "): " , size-std::strlen(buffer)-1U ) ; }
} }
//static //static
void G::LogOutput::addTimestamp( char *buffer , size_t size , const char * ts ) void G::LogOutput::add( char * buffer , size_t size , const std::string & p )
{ {
std::strncat( buffer+std::strlen(buffer) , ts , size-std::strlen(buffer)-1U ) ; add( buffer , size , p.c_str() ) ;
}
//static
void G::LogOutput::add( char * buffer , size_t size , const char * p )
{
std::strncat( buffer+std::strlen(buffer) , p , size-std::strlen(buffer)-1U ) ;
} }
void G::LogOutput::assertion( const char *file , unsigned line , bool test , const char *test_string ) void G::LogOutput::assertion( const char *file , unsigned line , bool test , const char *test_string )
{ {
if( !test ) if( !test )
{ {
char buffer[100U] ;
std::strcpy( buffer , "Assertion error: " ) ;
size_t size = sizeof(buffer) - 10U ; // -10 for luck
if( file )
{
addFileAndLine( buffer , size , file , line ) ;
}
if( test_string )
{
std::strncat( buffer+std::strlen(buffer) , test_string , size-std::strlen(buffer)-1U);
}
if( instance() ) if( instance() )
{ instance()->doAssertion( file , line , test_string ) ;
// forward to derived classes -- these
// overrides may safely re-enter this method --
// all code in this class is re-entrant
//
instance()->onAssert() ;
}
output( G::Log::s_Assertion , buffer ) ;
halt() ; halt() ;
} }
} }
void G::LogOutput::doAssertion( const char * file , unsigned line , const char * test_string )
{
char buffer[100U] ;
std::strcpy( buffer , "Assertion error: " ) ;
size_t size = sizeof(buffer) - 10U ; // -10 for luck
if( file )
{
addFileAndLine( buffer , size , file , line ) ;
}
if( test_string )
{
add( buffer , size , test_string ) ;
}
// forward to derived classes -- these
// overrides may safely re-enter this method --
// all code in this class is re-entrant
//
onAssert() ;
rawOutput( Log::s_Assertion , buffer ) ;
}
//static //static
void G::LogOutput::halt() void G::LogOutput::halt()
{ {
abort() ; abort() ;
} }
void G::LogOutput::syslog( SyslogFacility facility ) //static
const char * G::LogOutput::levelString( Log::Severity s )
{ {
m_syslog = true ; if( s == Log::s_Debug ) return "debug: " ;
m_facility = facility ; else if( s == Log::s_LogSummary ) return "info: " ;
else if( s == Log::s_LogVerbose ) return "info: " ;
else if( s == Log::s_Warning ) return "warning: " ;
else if( s == Log::s_Error ) return "error: " ;
else if( s == Log::s_Assertion ) return "fatal: " ;
return "" ;
} }
//static
const char * G::LogOutput::itoa( char * buffer , size_t buffer_size , unsigned int n )
{
buffer[0U] = '0' ; buffer[1U] = '\0' ;
n %= 1000000U ;
bool zero = n == 0U ;
char * p = buffer + buffer_size - 1U ;
for( *p-- = '\0' ; n > 0U ; --p , n /= 10U )
*p = '0' + (n % 10U) ;
return zero ? buffer : (p+1U) ;
}

View File

@ -43,17 +43,26 @@ class G::LogOutput
public: public:
enum SyslogFacility { User , Daemon , Mail , Cron } ; // etc. enum SyslogFacility { User , Daemon , Mail , Cron } ; // etc.
explicit LogOutput( bool logging_enabled , bool verbose = true ) ; LogOutput( const std::string & prefix , bool output , bool with_logging ,
// Constructor. If there is no LogOutput object, bool with_verbose_logging , bool with_debug , bool with_level ,
// or if 'logging_enabled' is false, then there is no bool with_timestamp , bool strip_context ) ;
// output of any sort. If both parameters are true // Constructor. If there is no LogOutput object,
// then debug messages will be generated in addition // or if 'output' is false, then there is no
// to the log/warning/error messages (as long // output of any sort. Otherwise at least
// as it was compiled in). // warning and error messages are generated.
// //
// More than one LogOutput object may be created, but // If 'with-logging' is true then log[summary] messages
// only the first one controls output. // are output. If 'with-verbose-logging' is true then
// log[verbose] messages are output. If 'with_debug' is
// true then debug messages will also be generated
// (but only if compiled in).
//
// More than one LogOutput object may be created, but
// only the first one controls output.
explicit LogOutput( bool output_with_logging , bool verbose_and_debug = true ) ;
// Constructor.
virtual ~LogOutput() ; virtual ~LogOutput() ;
// Destructor. // Destructor.
@ -61,12 +70,12 @@ public:
// Overridable. Used to do the final message // Overridable. Used to do the final message
// output (with OutputDebugString() or stderr). // output (with OutputDebugString() or stderr).
static LogOutput *instance() ; static LogOutput * instance() ;
// Returns a pointer to the controlling // Returns a pointer to the controlling
// LogOutput object. Returns NULL if none. // LogOutput object. Returns NULL if none.
bool enable( bool debug_enabled = true ) ; bool enable( bool enabled = true ) ;
// Enables or disables debug output. // Enables or disables output.
// Returns the previous setting. // Returns the previous setting.
void syslog() ; void syslog() ;
@ -79,12 +88,8 @@ public:
// Enables logging to the syslog system under Unix, // Enables logging to the syslog system under Unix,
// using the specified facility. // using the specified facility.
static void output( G::Log::Severity s , const char *raw_output ) ;
// Generates debug output if there is an extant
// LogOutput object which is enabled. Uses rawOutput().
static void output( G::Log::Severity s , const char *file , unsigned line , const char *text ) ; static void output( G::Log::Severity s , const char *file , unsigned line , const char *text ) ;
// Generates debug output if there is an extant // Generates output if there is an existing
// LogOutput object which is enabled. Uses rawOutput(). // LogOutput object which is enabled. Uses rawOutput().
static void assertion( const char *file , unsigned line , bool test , const char *test_string ) ; static void assertion( const char *file , unsigned line , bool test , const char *test_string ) ;
@ -94,30 +99,42 @@ public:
virtual void onAssert() ; virtual void onAssert() ;
// Called during an assertion failure. This allows // Called during an assertion failure. This allows
// Windows applications to stop timers etc. which // Windows applications to stop timers etc. (Timers
// cause reentrancy problems and infinitely recursive // can cause reentrancy problems and infinitely
// dialog box creation. // recursive dialog box creation.)
private: private:
LogOutput( const LogOutput & ) ; LogOutput( const LogOutput & ) ;
void operator=( const LogOutput & ) ; void operator=( const LogOutput & ) ;
static void itoa( char *out , unsigned int ) ; static const char * itoa( char * , size_t , unsigned int ) ;
static void addFileAndLine( char * , size_t , const char * , int ) ; static void addFileAndLine( char * , size_t , const char * , int ) ;
static void addTimestamp( char * , size_t , const char * ) ; static void add( char * , size_t , const char * ) ;
static void add( char * , size_t , const std::string & ) ;
const char * timestampString() ; const char * timestampString() ;
static void halt() ; static void halt() ;
void doOutput( G::Log::Severity , const char * ) ; void doOutput( G::Log::Severity , const char * ) ;
void doOutput( G::Log::Severity s , const char * , unsigned , const char * ) ; void doOutput( G::Log::Severity s , const char * , unsigned , const char * ) ;
void doAssertion( const char * , unsigned , const char * ) ;
const char * levelString( Log::Severity s ) ;
void init() ;
void cleanup() ;
private: private:
static LogOutput * m_this ; static LogOutput * m_this ;
std::string m_prefix ;
bool m_enabled ; bool m_enabled ;
bool m_verbose ; bool m_summary_log ;
bool m_verbose_log ;
bool m_debug ;
bool m_level ;
bool m_strip ;
bool m_syslog ; bool m_syslog ;
SyslogFacility m_facility ; SyslogFacility m_facility ;
time_t m_time ; time_t m_time ;
char m_time_buffer[40U] ; char m_time_buffer[40U] ;
bool m_timestamp ; bool m_timestamp ;
HANDLE m_handle ; // windows
bool m_handle_set ;
} ; } ;
#endif #endif

View File

@ -40,7 +40,8 @@ namespace
if( severity == G::Log::s_Warning ) m |= LOG_WARNING ; if( severity == G::Log::s_Warning ) m |= LOG_WARNING ;
else if( severity == G::Log::s_Error ) m |= LOG_ERR ; else if( severity == G::Log::s_Error ) m |= LOG_ERR ;
else if( severity == G::Log::s_Log ) m |= LOG_INFO ; else if( severity == G::Log::s_LogSummary ) m |= LOG_INFO ;
else if( severity == G::Log::s_LogVerbose ) m |= LOG_INFO ;
else m |= LOG_CRIT ; else m |= LOG_CRIT ;
return m ; return m ;
@ -49,16 +50,18 @@ namespace
void G::LogOutput::rawOutput( G::Log::Severity severity , const char *message ) void G::LogOutput::rawOutput( G::Log::Severity severity , const char *message )
{ {
if( severity != G::Log::s_Debug && m_syslog && !(message[0]=='\n'&&message[1]=='\0') ) if( severity != G::Log::s_Debug && m_syslog )
{ {
::syslog( mode(m_facility,severity) , "%s" , message ) ; ::syslog( mode(m_facility,severity) , "%s" , message ) ;
} }
std::cerr << message ; std::cerr << message << std::endl ;
std::cerr.flush() ;
} }
void G::LogOutput::syslog() void G::LogOutput::init()
{
}
void G::LogOutput::cleanup()
{ {
syslog( User ) ;
} }

View File

@ -23,32 +23,129 @@
#include "gdef.h" #include "gdef.h"
#include "glogoutput.h" #include "glogoutput.h"
#include "gpath.h"
#include <cstdlib> // getenv #include <cstdlib> // getenv
static HANDLE source() ;
#if ! defined(RegisterEventSource)
static void RegisterEventSource( const char * , const char * ) {}
static void DeregisterEventSource( HANDLE ) {}
static void ReportEvent( HANDLE , DWORD , int , DWORD , const char * ,
size_t , int , const char ** , const char * ) {}
#endif
void G::LogOutput::cleanup()
{
if( m_handle != 0 )
::DeregisterEventSource( m_handle ) ;
}
void G::LogOutput::rawOutput( G::Log::Severity severity , const char *message ) void G::LogOutput::rawOutput( G::Log::Severity severity , const char *message )
{ {
std::cerr << message ; // standard error
std::cerr.flush() ; //
std::cerr << message << std::endl ;
// debugger
//
static bool debugger = std::getenv("GLOGOUTPUT_DEBUGGER") != NULL ; static bool debugger = std::getenv("GLOGOUTPUT_DEBUGGER") != NULL ;
if( debugger ) if( debugger )
{ {
::OutputDebugString( message ) ; ::OutputDebugString( message ) ;
} }
// file
//
static const char * key = "GLOGOUTPUT_FILE" ; static const char * key = "GLOGOUTPUT_FILE" ;
static const char * filename = std::getenv( key ) ; static const char * filename = std::getenv( key ) ;
if( filename != NULL && *filename != '\0' ) if( filename != NULL && *filename != '\0' )
{ {
static std::ofstream file( filename ) ; static std::ofstream file( filename ) ;
file << message ; file << message << std::endl ;
file.flush() ; }
// event log
//
if( m_syslog && severity != Log::s_Debug && m_handle != 0 )
{
// (assume suitable string resources of 1001..1003)
DWORD id = 0x400003E9L ;
DWORD type = EVENTLOG_INFORMATION_TYPE ;
if( severity == Log::s_Warning )
{
id = 0x800003EAL ;
type = EVENTLOG_WARNING_TYPE ;
}
else if( severity == Log::s_Error || severity == Log::s_Assertion )
{
id = 0xC00003EBL ;
type = EVENTLOG_ERROR_TYPE ;
}
const char * p[] = { message , NULL } ;
(void) ::ReportEvent( m_handle, type, 0, id, NULL, 1, 0, p, NULL ) ;
} }
} }
void G::LogOutput::syslog() void G::LogOutput::init()
{ {
// no-op #if defined(RegisterEventSource)
// see also ::RegisterEventSource() and ::ReportEvent() for NT m_handle = ::source() ;
#endif
}
static HANDLE source()
{
G::Path exe_path ;
{
HINSTANCE hinstance = 0 ;
char buffer[260U*4U] ; // *4 for luck
size_t size = sizeof(buffer) ;
*buffer = '\0' ;
::GetModuleFileName( hinstance , buffer , size-1U ) ;
buffer[size-1U] = '\0' ;
exe_path = G::Path(buffer) ;
}
std::string exe_name ;
{
G::Path p( exe_path ) ;
p.removeExtension() ;
exe_name = p.basename() ;
}
std::string reg_path_prefix( "SYSTEM\\CurrentControlSet\\Services\\"
"EventLog\\Application\\" ) ;
std::string reg_path = reg_path_prefix + exe_name ;
HKEY key = 0 ;
::RegCreateKey( HKEY_LOCAL_MACHINE , reg_path.c_str() , &key ) ;
bool ok = key != 0 ;
if( ok )
{
std::string value = exe_path.str() ;
char * value_p = const_cast<char*>(value.c_str()) ;
ok = ! ::RegSetValueEx( key , "EventMessageFile" , 0 , REG_EXPAND_SZ ,
reinterpret_cast<LPBYTE>(value_p) , value.length()+1U ) ;
}
if( ok )
{
DWORD value =
EVENTLOG_INFORMATION_TYPE |
EVENTLOG_WARNING_TYPE |
EVENTLOG_ERROR_TYPE ;
ok = ! ::RegSetValueEx( key , "TypesSupported" , 0 , REG_DWORD ,
reinterpret_cast<LPBYTE>(&value) , sizeof(value) ) ;
}
if( key != 0 )
::RegCloseKey( key ) ;
return ok ?
::RegisterEventSource( NULL , exe_name.c_str() ) :
0 ;
} }

View File

@ -83,7 +83,7 @@ public:
static void closeStderr() ; static void closeStderr() ;
// Closes stderr. // Closes stderr.
static void setUmask() ; static void setUmask( bool tightest = true ) ;
// Sets a tight umask. // Sets a tight umask.
static void cd( const Path & dir ) ; static void cd( const Path & dir ) ;
@ -108,12 +108,12 @@ public:
static int errno_() ; static int errno_() ;
// Returns the process's current 'errno' value. // Returns the process's current 'errno' value.
static void beSpecial( Identity special ) ; static void beSpecial( Identity special , bool change_group = true ) ;
// Aquires special privileges (either root // Aquires special privileges (either root
// or suid). The parameter must have come from // or suid). The parameter must have come from
// a previous call to beOrdinary(). // a previous call to beOrdinary().
static Identity beOrdinary( Identity nobody ) ; static Identity beOrdinary( Identity nobody , bool change_group = true ) ;
// Revokes special privileges (root or suid). // Revokes special privileges (root or suid).
// If really root (as opposed to suid root) // If really root (as opposed to suid root)
// then the effective id is changed to that // then the effective id is changed to that

View File

@ -59,9 +59,9 @@ bool G::Process::cd( const Path & dir , NoThrow )
} }
//static //static
void G::Process::setUmask() void G::Process::setUmask( bool tightest )
{ {
mode_t new_mode = 0177 ; // create as -rw------- mode_t new_mode = tightest ? 0177 : 0117 ; // tightest => -rw-------
(void) ::umask( new_mode ) ; (void) ::umask( new_mode ) ;
} }
@ -209,9 +209,9 @@ void G::Process::execCore( const G::Path & exe , const std::string & arg )
char * env[3U] ; char * env[3U] ;
std::string path( "PATH=/usr/bin:/bin" ) ; // no "." std::string path( "PATH=/usr/bin:/bin" ) ; // no "."
std::string ifr( "IFR= \t\n" ) ; std::string ifs( "IFS= \t\n" ) ;
env[0U] = const_cast<char*>( path.c_str() ) ; env[0U] = const_cast<char*>( path.c_str() ) ;
env[1U] = const_cast<char*>( ifr.c_str() ) ; env[1U] = const_cast<char*>( ifs.c_str() ) ;
env[2U] = NULL ; env[2U] = NULL ;
::execve( exe.str().c_str() , argv , env ) ; ::execve( exe.str().c_str() , argv , env ) ;
@ -220,7 +220,7 @@ void G::Process::execCore( const G::Path & exe , const std::string & arg )
G_WARNING( "G::Process::exec: execve() returned: errno=" << error << ": " << exe ) ; G_WARNING( "G::Process::exec: execve() returned: errno=" << error << ": " << exe ) ;
} }
void G::Process::beSpecial( Identity identity ) void G::Process::beSpecial( Identity identity , bool change_group )
{ {
// try to change our effective id -- this // try to change our effective id -- this
// will only work if our real uid is root, or if // will only work if our real uid is root, or if
@ -231,18 +231,18 @@ void G::Process::beSpecial( Identity identity )
// //
Identity old_identity ; Identity old_identity ;
(void) ::seteuid( identity.uid ) ; (void) ::seteuid( identity.uid ) ;
(void) ::setegid( identity.gid ) ; if( change_group) (void) ::setegid( identity.gid ) ;
(void) old_identity.str() ; // pacify the compiler (void) old_identity.str() ; // pacify the compiler
G_DEBUG( "G::Process::beSpecial: " << old_identity << " -> " << Identity() ) ; G_DEBUG( "G::Process::beSpecial: " << old_identity << " -> " << Identity() ) ;
} }
G::Process::Identity G::Process::beOrdinary( Identity nobody ) G::Process::Identity G::Process::beOrdinary( Identity nobody , bool change_group )
{ {
Identity special_identity ; Identity special_identity ;
if( ::getuid() == 0 ) if( ::getuid() == 0 )
{ {
if( ::seteuid(0) ) throw UidError("0") ; // first if( ::seteuid(0) ) throw UidError("0") ; // first
if( ::setegid(nobody.gid) ) throw GidError(nobody.str()) ; // second if( change_group && ::setegid(nobody.gid) ) throw GidError(nobody.str()) ; // second
if( ::seteuid(nobody.uid) ) throw UidError(nobody.str()) ; // third if( ::seteuid(nobody.uid) ) throw UidError(nobody.str()) ; // third
} }
else else
@ -250,7 +250,7 @@ G::Process::Identity G::Process::beOrdinary( Identity nobody )
// switch our effective id back to our real id -- // switch our effective id back to our real id --
// ie. turn off the effects of a suid executable // ie. turn off the effects of a suid executable
if( ::seteuid( ::getuid() ) ) throw UidError() ; if( ::seteuid( ::getuid() ) ) throw UidError() ;
if( ::setegid( ::getgid() ) ) throw GidError() ; if( change_group && ::setegid( ::getgid() ) ) throw GidError() ;
} }
G_DEBUG( "G::Process::beOrdinary: " << special_identity << " -> " << Identity() ) ; G_DEBUG( "G::Process::beOrdinary: " << special_identity << " -> " << Identity() ) ;
return special_identity ; return special_identity ;

View File

@ -92,7 +92,7 @@ void G::Process::closeFiles( bool keep_stderr )
} }
} }
void G::Process::setUmask() void G::Process::setUmask( bool )
{ {
// _umask() is available but not very useful // _umask() is available but not very useful
; // no-op ; // no-op
@ -115,7 +115,7 @@ bool G::Process::cd( const Path & dir , NoThrow )
return 0 == ::_chdir( dir.str().c_str() ) ; return 0 == ::_chdir( dir.str().c_str() ) ;
} }
int G::Process::spawn( const Path & exe , const std::string & arg , int G::Process::spawn( Identity , const Path & exe , const std::string & arg ,
int error_return ) int error_return )
{ {
// open file descriptors are inherited across ::_spawn() -- // open file descriptors are inherited across ::_spawn() --
@ -129,24 +129,17 @@ int G::Process::spawn( const Path & exe , const std::string & arg ,
const int mode = _P_WAIT ; const int mode = _P_WAIT ;
::_flushall() ; ::_flushall() ;
G_LOG( "G::Process::spawn: " << exe << " " << arg ) ;
int rc = ::_spawnv( mode , exe.str().c_str() , argv ) ; int rc = ::_spawnv( mode , exe.str().c_str() , argv ) ;
G_LOG( "G::Process::spawn: done (" << rc << ")" ) ;
return rc < 0 ? error_return : rc ; return rc < 0 ? error_return : rc ;
} }
bool G::Process::privileged() G::Process::Identity G::Process::beOrdinary( Identity identity , bool )
{
return false ;
}
G::Process::Identity G::Process::beOrdinary( Identity identity )
{ {
// not implemented // not implemented
return identity ; return identity ;
} }
void G::Process::beSpecial( Identity ) void G::Process::beSpecial( Identity , bool )
{ {
// not implemented // not implemented
} }

View File

@ -30,11 +30,12 @@ G::Root * G::Root::m_this = NULL ;
G::Process::Identity G::Root::m_special ; G::Process::Identity G::Root::m_special ;
G::Process::Identity G::Root::m_nobody ; G::Process::Identity G::Root::m_nobody ;
G::Root::Root() G::Root::Root( bool change_group ) :
m_change_group(change_group)
{ {
if( m_this == NULL ) if( m_this == NULL )
{ {
Process::beSpecial( m_special ) ; Process::beSpecial( m_special , m_change_group ) ;
m_this = this ; m_this = this ;
} }
} }
@ -46,7 +47,7 @@ G::Root::~Root()
if( m_this == this ) if( m_this == this )
{ {
m_this = NULL ; m_this = NULL ;
m_special = Process::beOrdinary( m_nobody ) ; Process::beOrdinary( m_nobody , m_change_group ) ;
} }
} }
catch( std::exception & e ) catch( std::exception & e )

View File

@ -40,8 +40,8 @@ namespace G
class G::Root : private noncopyable class G::Root : private noncopyable
{ {
public: public:
Root() ; explicit Root( bool change_group = true ) ;
// Default constructor. Aquires special // Constructor. Aquires special
// privileges if possible. // privileges if possible.
~Root() ; ~Root() ;
@ -58,13 +58,11 @@ public:
// Returns the 'nobody' identity. // Returns the 'nobody' identity.
// Precondition: init() called // Precondition: init() called
private:
void * operator new( size_t ) ;
private: private:
static Root * m_this ; static Root * m_this ;
static Process::Identity m_special ; static Process::Identity m_special ;
static Process::Identity m_nobody ; static Process::Identity m_nobody ;
bool m_change_group ;
} ; } ;
#endif #endif

View File

@ -216,9 +216,8 @@ State StateMachine<T,State,Event,Arg>::apply( T & t , Event event , const Arg &
// look up in the multimap keyed on current-state + event // look up in the multimap keyed on current-state + event
// //
State state = m_state ; State state = m_state ;
bool done = false ;
Map::iterator p = m_map.find(event) ; Map::iterator p = m_map.find(event) ;
for( ; !done && p != m_map.end() && (*p).first == event ; ++p ) for( ; p != m_map.end() && (*p).first == event ; ++p )
{ {
if( (*p).second.from == m_any || (*p).second.from == m_state ) if( (*p).second.from == m_any || (*p).second.from == m_state )
{ {
@ -243,10 +242,10 @@ State StateMachine<T,State,Event,Arg>::apply( T & t , Event event , const Arg &
State alt_state = (*p).second.alt ; State alt_state = (*p).second.alt ;
state = m_state = alt_state == m_same ? old_state : alt_state ; state = m_state = alt_state == m_same ? old_state : alt_state ;
} }
done = true ; return state ;
} }
} }
return done ? state : m_any ; return m_any ;
} }
} ; // namespace } ; // namespace

View File

@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
EXTRA_DIST=gclient_win32.cpp \ EXTRA_DIST=gclient_win32.cpp \
gdescriptor_win32.cpp \ gdescriptor_win32.cpp \

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
SHELL = @SHELL@ SHELL = @SHELL@
@ -81,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -88,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = gclient_win32.cpp gdescriptor_win32.cpp gevent_win32.cpp glocal_win32.cpp grequest.cpp gresolve_win32.cpp gsocket_win32.cpp gwinsock.cpp EXTRA_DIST = gclient_win32.cpp gdescriptor_win32.cpp gevent_win32.cpp glocal_win32.cpp grequest.cpp gresolve_win32.cpp gsocket_win32.cpp gwinsock.cpp
@ -132,7 +139,7 @@ OBJECTS = $(libgnet_a_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .S .c .cpp .o .s .SUFFIXES: .S .c .cpp .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/gnet/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/gnet/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status

View File

@ -335,7 +335,7 @@ std::string GNet::ClientImp::startConnecting( const Address & address , const st
m_s = new StreamSocket ; m_s = new StreamSocket ;
if( !s().valid() ) if( !s().valid() )
{ {
return std::string( "error: cannot open socket" ) ; return std::string( "cannot open socket" ) ;
} }
// specifiy this as a 'write' event handler for the socket // specifiy this as a 'write' event handler for the socket
@ -380,7 +380,7 @@ GNet::ClientImp::Status GNet::ClientImp::connectCore( Address remote_address ,
bool bound = s().bind(local_address) ; bool bound = s().bind(local_address) ;
if( !bound ) if( !bound )
{ {
error = "error: cannot bind socket" ; error = "cannot bind socket" ;
return Retry ; return Retry ;
} }
G_DEBUG( "GNet::ClientImp::connectCore: bound local address " G_DEBUG( "GNet::ClientImp::connectCore: bound local address "
@ -392,7 +392,7 @@ GNet::ClientImp::Status GNet::ClientImp::connectCore( Address remote_address ,
if( !s().connect( remote_address , &immediate ) ) if( !s().connect( remote_address , &immediate ) )
{ {
G_DEBUG( "GNet::ClientImp::connect: immediate failure" ) ; G_DEBUG( "GNet::ClientImp::connect: immediate failure" ) ;
error = "error: cannot connect to " ; error = "cannot connect to " ;
error.append( remote_address.displayString().c_str() ) ; error.append( remote_address.displayString().c_str() ) ;
// we should return Failure here, but Microsoft's stack // we should return Failure here, but Microsoft's stack
@ -433,7 +433,7 @@ void GNet::ClientImp::writeEvent()
} }
else if( m_state == Connecting ) else if( m_state == Connecting )
{ {
std::string message( "error: cannot connect to " ) ; std::string message( "cannot connect to " ) ;
message.append( m_address.displayString().c_str() ) ; message.append( m_address.displayString().c_str() ) ;
setState( Failed ) ; setState( Failed ) ;
close() ; close() ;
@ -492,12 +492,18 @@ void GNet::ClientImp::run()
std::pair<bool,GNet::Address> GNet::ClientImp::localAddress() const std::pair<bool,GNet::Address> GNet::ClientImp::localAddress() const
{ {
return s().getLocalAddress() ; return
m_s != NULL ?
s().getLocalAddress() :
std::make_pair(false,GNet::Address::invalidAddress()) ;
} }
std::pair<bool,GNet::Address> GNet::ClientImp::peerAddress() const std::pair<bool,GNet::Address> GNet::ClientImp::peerAddress() const
{ {
return s().getPeerAddress() ; return
m_s != NULL ?
s().getPeerAddress() :
std::make_pair(false,GNet::Address::invalidAddress()) ;
} }
std::string GNet::ClientImp::peerName() const std::string GNet::ClientImp::peerName() const

View File

@ -106,7 +106,7 @@ void GNet::Monitor::report( std::ostream & s , const std::string & px , const st
s << px << "clients destroyed: " << m_imp->m_client_removes << eol ; s << px << "clients destroyed: " << m_imp->m_client_removes << eol ;
{ {
for( MonitorImp::Clients::const_iterator p = m_imp->m_clients.begin() ; for( MonitorImp::Clients::const_iterator p = m_imp->m_clients.begin() ;
p != m_imp->m_clients.end() ; ++p ) p != m_imp->m_clients.end() ; ++p )
{ {
s << px s << px
<< " client " << (const void *)(*p) << ": " << " client " << (const void *)(*p) << ": "

View File

@ -37,9 +37,9 @@ GNet::ServerPeer::ServerPeer( StreamSocket * s , Address a ) :
{ {
G_ASSERT( m_socket != NULL ) ; G_ASSERT( m_socket != NULL ) ;
G_DEBUG( "GNet::ServerPeer::ctor: fd " << m_socket->asString() << ": " << m_address.displayString() ) ; G_DEBUG( "GNet::ServerPeer::ctor: fd " << m_socket->asString() << ": " << m_address.displayString() ) ;
if( Monitor::instance() ) Monitor::instance()->add(*this) ;
m_socket->addReadHandler( *this ) ; m_socket->addReadHandler( *this ) ;
m_socket->addExceptionHandler( *this ) ; m_socket->addExceptionHandler( *this ) ;
if( Monitor::instance() ) Monitor::instance()->add(*this) ;
} }
GNet::ServerPeer::~ServerPeer() GNet::ServerPeer::~ServerPeer()
@ -117,8 +117,7 @@ std::pair<bool,GNet::Address> GNet::ServerPeer::localAddress() const
std::pair<bool,GNet::Address> GNet::ServerPeer::peerAddress() const std::pair<bool,GNet::Address> GNet::ServerPeer::peerAddress() const
{ {
G_ASSERT( m_socket != NULL ) ; return std::pair<bool,Address>( true , m_address ) ;
return m_socket->getPeerAddress() ;
} }
// === // ===

View File

@ -144,7 +144,6 @@ public:
virtual std::pair<bool,Address> peerAddress() const ; virtual std::pair<bool,Address> peerAddress() const ;
// Returns the peer address. // Returns the peer address.
// Pair.first is false on error.
protected: protected:
virtual ~ServerPeer() ; virtual ~ServerPeer() ;

View File

@ -16,21 +16,17 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
# force symbol stripping on 'make install' # force symbol stripping on 'make install'
AM_INSTALL_PROGRAM_FLAGS=-s AM_INSTALL_PROGRAM_FLAGS=-s
# change the local-state directory from .../var to .../var/spool/emailrelay EXTRA_DIST=commandline_win32.cpp main_win32.cpp gmessagestore_win32.cpp emailrelay.dsw emailrelay.dsp common.dsp submit.dsp passwd.dsp icon-32.ico icon2.ico icon3.ico icon4.ico doxygen.cfg emailrelay.rc resource.h gsasl_cyrus.cpp messages.mc
localstatedir = ${prefix}/var/spool/emailrelay INCLUDES = -I$(top_srcdir)/lib/gcc2.95 -I$(top_srcdir)/src/glib -I$(top_srcdir)/src/gnet -DG_SPOOLDIR=\"$(e_spooldir)\"
EXTRA_DIST=commandline_win32.cpp main_win32.cpp gmessagestore_win32.cpp emailrelay.dsp icon-32.ico icon2.ico icon3.ico icon4.ico empty_file doxygen.cfg emailrelay.rc resource.h gsasl_cyrus.cpp
INCLUDES = -I$(top_srcdir)/lib/gcc2.95 -I$(top_srcdir)/src/glib -I$(top_srcdir)/src/gnet
noinst_LIBRARIES = libgsmtp.a noinst_LIBRARIES = libgsmtp.a
sbin_PROGRAMS = emailrelay e_sbin_PROGRAMS = emailrelay emailrelay-submit emailrelay-passwd
libexec_PROGRAMS = emailrelay-passwd emailrelay-poke emailrelay-submit e_libexec_PROGRAMS = emailrelay-poke
localstate_DATA = empty_file e_spool_DATA =
libgsmtp_a_SOURCES = \ libgsmtp_a_SOURCES = \
gadminserver.cpp \ gadminserver.cpp \
@ -103,3 +99,12 @@ emailrelay_submit_LDADD = \
$(top_builddir)/src/glib/libglib.a \ $(top_builddir)/src/glib/libglib.a \
$(top_builddir)/src/gnet/libgnet.a $(top_builddir)/src/gnet/libgnet.a
install-data-local:
-chgrp daemon $(DESTDIR)$(e_spooldir)
-chmod 775 $(DESTDIR)$(e_spooldir)
-chgrp daemon $(DESTDIR)$(e_sbindir)/emailrelay-submit
-chmod g+s $(DESTDIR)$(e_sbindir)/emailrelay-submit
install-exec-local:

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
# force symbol stripping on 'make install' # force symbol stripping on 'make install'
@ -47,6 +46,7 @@ libexecdir = @libexecdir@
datadir = @datadir@ datadir = @datadir@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@ libdir = @libdir@
infodir = @infodir@ infodir = @infodir@
mandir = @mandir@ mandir = @mandir@
@ -82,6 +82,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -89,19 +90,23 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
AM_INSTALL_PROGRAM_FLAGS = -s AM_INSTALL_PROGRAM_FLAGS = -s
# change the local-state directory from .../var to .../var/spool/emailrelay EXTRA_DIST = commandline_win32.cpp main_win32.cpp gmessagestore_win32.cpp emailrelay.dsw emailrelay.dsp common.dsp submit.dsp passwd.dsp icon-32.ico icon2.ico icon3.ico icon4.ico doxygen.cfg emailrelay.rc resource.h gsasl_cyrus.cpp messages.mc
localstatedir = ${prefix}/var/spool/emailrelay INCLUDES = -I$(top_srcdir)/lib/gcc2.95 -I$(top_srcdir)/src/glib -I$(top_srcdir)/src/gnet -DG_SPOOLDIR=\"$(e_spooldir)\"
EXTRA_DIST = commandline_win32.cpp main_win32.cpp gmessagestore_win32.cpp emailrelay.dsp icon-32.ico icon2.ico icon3.ico icon4.ico empty_file doxygen.cfg emailrelay.rc resource.h gsasl_cyrus.cpp
INCLUDES = -I$(top_srcdir)/lib/gcc2.95 -I$(top_srcdir)/src/glib -I$(top_srcdir)/src/gnet
noinst_LIBRARIES = libgsmtp.a noinst_LIBRARIES = libgsmtp.a
sbin_PROGRAMS = emailrelay e_sbin_PROGRAMS = emailrelay emailrelay-submit emailrelay-passwd
libexec_PROGRAMS = emailrelay-passwd emailrelay-poke emailrelay-submit e_libexec_PROGRAMS = emailrelay-poke
localstate_DATA = empty_file e_spool_DATA =
libgsmtp_a_SOURCES = gadminserver.cpp gadminserver.h gbase64.cpp gbase64.h gclientprotocol.cpp gclientprotocol.h gfilestore.cpp gfilestore.h gmessagestore.cpp gmessagestore.h gmessagestore_unix.cpp gnewfile.cpp gnewfile.h gnewmessage.cpp gnewmessage.h gprotocolmessage.cpp gprotocolmessage.h gprotocolmessageforward.cpp gprotocolmessageforward.h gprotocolmessagestore.cpp gprotocolmessagestore.h gsasl_native.cpp gsasl.h gsecrets.cpp gsecrets.h gserverprotocol.cpp gserverprotocol.h gsmtp.h gsmtpclient.cpp gsmtpclient.h gsmtpserver.cpp gsmtpserver.h gstoredfile.cpp gstoredfile.h gstoredmessage.cpp gstoredmessage.h gverifier.cpp gverifier.h gxtext.cpp gxtext.h libgsmtp_a_SOURCES = gadminserver.cpp gadminserver.h gbase64.cpp gbase64.h gclientprotocol.cpp gclientprotocol.h gfilestore.cpp gfilestore.h gmessagestore.cpp gmessagestore.h gmessagestore_unix.cpp gnewfile.cpp gnewfile.h gnewmessage.cpp gnewmessage.h gprotocolmessage.cpp gprotocolmessage.h gprotocolmessageforward.cpp gprotocolmessageforward.h gprotocolmessagestore.cpp gprotocolmessagestore.h gsasl_native.cpp gsasl.h gsecrets.cpp gsecrets.h gserverprotocol.cpp gserverprotocol.h gsmtp.h gsmtpclient.cpp gsmtpclient.h gsmtpserver.cpp gsmtpserver.h gstoredfile.cpp gstoredfile.h gstoredmessage.cpp gstoredmessage.h gverifier.cpp gverifier.h gxtext.cpp gxtext.h
@ -138,23 +143,23 @@ gnewmessage.o gprotocolmessage.o gprotocolmessageforward.o \
gprotocolmessagestore.o gsasl_native.o gsecrets.o gserverprotocol.o \ gprotocolmessagestore.o gsasl_native.o gsecrets.o gserverprotocol.o \
gsmtpclient.o gsmtpserver.o gstoredfile.o gstoredmessage.o gverifier.o \ gsmtpclient.o gsmtpserver.o gstoredfile.o gstoredmessage.o gverifier.o \
gxtext.o gxtext.o
PROGRAMS = $(libexec_PROGRAMS) $(sbin_PROGRAMS) PROGRAMS = $(e_libexec_PROGRAMS) $(e_sbin_PROGRAMS)
emailrelay_passwd_OBJECTS = passwd.o
emailrelay_passwd_DEPENDENCIES = $(top_builddir)/src/glib/libglib.a
emailrelay_passwd_LDFLAGS =
emailrelay_poke_OBJECTS = poke.o emailrelay_poke_OBJECTS = poke.o
emailrelay_poke_DEPENDENCIES = emailrelay_poke_DEPENDENCIES =
emailrelay_poke_LDFLAGS = emailrelay_poke_LDFLAGS =
emailrelay_submit_OBJECTS = submit.o legal.o
emailrelay_submit_DEPENDENCIES = $(top_builddir)/src/main/libgsmtp.a \
$(top_builddir)/src/glib/libglib.a $(top_builddir)/src/gnet/libgnet.a
emailrelay_submit_LDFLAGS =
emailrelay_OBJECTS = main_unix.o configuration.o legal.o run.o \ emailrelay_OBJECTS = main_unix.o configuration.o legal.o run.o \
commandline.o commandline_unix.o commandline.o commandline_unix.o
emailrelay_DEPENDENCIES = $(top_builddir)/src/main/libgsmtp.a \ emailrelay_DEPENDENCIES = $(top_builddir)/src/main/libgsmtp.a \
$(top_builddir)/src/glib/libglib.a $(top_builddir)/src/gnet/libgnet.a $(top_builddir)/src/glib/libglib.a $(top_builddir)/src/gnet/libgnet.a
emailrelay_LDFLAGS = emailrelay_LDFLAGS =
emailrelay_submit_OBJECTS = submit.o legal.o
emailrelay_submit_DEPENDENCIES = $(top_builddir)/src/main/libgsmtp.a \
$(top_builddir)/src/glib/libglib.a $(top_builddir)/src/gnet/libgnet.a
emailrelay_submit_LDFLAGS =
emailrelay_passwd_OBJECTS = passwd.o
emailrelay_passwd_DEPENDENCIES = $(top_builddir)/src/glib/libglib.a
emailrelay_passwd_LDFLAGS =
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX) CXXLD = $(CXX)
@ -163,7 +168,7 @@ CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DATA = $(localstate_DATA) DATA = $(e_spool_DATA)
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = Makefile.am Makefile.in
@ -172,13 +177,13 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
SOURCES = $(libgsmtp_a_SOURCES) $(emailrelay_passwd_SOURCES) $(emailrelay_poke_SOURCES) $(emailrelay_submit_SOURCES) $(emailrelay_SOURCES) SOURCES = $(libgsmtp_a_SOURCES) $(emailrelay_poke_SOURCES) $(emailrelay_SOURCES) $(emailrelay_submit_SOURCES) $(emailrelay_passwd_SOURCES)
OBJECTS = $(libgsmtp_a_OBJECTS) $(emailrelay_passwd_OBJECTS) $(emailrelay_poke_OBJECTS) $(emailrelay_submit_OBJECTS) $(emailrelay_OBJECTS) OBJECTS = $(libgsmtp_a_OBJECTS) $(emailrelay_poke_OBJECTS) $(emailrelay_OBJECTS) $(emailrelay_submit_OBJECTS) $(emailrelay_passwd_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .S .c .cpp .o .s .SUFFIXES: .S .c .cpp .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/main/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/main/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@ -219,91 +224,91 @@ libgsmtp.a: $(libgsmtp_a_OBJECTS) $(libgsmtp_a_DEPENDENCIES)
$(AR) cru libgsmtp.a $(libgsmtp_a_OBJECTS) $(libgsmtp_a_LIBADD) $(AR) cru libgsmtp.a $(libgsmtp_a_OBJECTS) $(libgsmtp_a_LIBADD)
$(RANLIB) libgsmtp.a $(RANLIB) libgsmtp.a
mostlyclean-libexecPROGRAMS: mostlyclean-e_libexecPROGRAMS:
clean-libexecPROGRAMS: clean-e_libexecPROGRAMS:
-test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS) -test -z "$(e_libexec_PROGRAMS)" || rm -f $(e_libexec_PROGRAMS)
distclean-libexecPROGRAMS: distclean-e_libexecPROGRAMS:
maintainer-clean-libexecPROGRAMS: maintainer-clean-e_libexecPROGRAMS:
install-libexecPROGRAMS: $(libexec_PROGRAMS) install-e_libexecPROGRAMS: $(e_libexec_PROGRAMS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(mkinstalldirs) $(DESTDIR)$(e_libexecdir)
@list='$(libexec_PROGRAMS)'; for p in $$list; do \ @list='$(e_libexec_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \ if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(e_libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(e_libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \ else :; fi; \
done done
uninstall-libexecPROGRAMS: uninstall-e_libexecPROGRAMS:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(libexec_PROGRAMS)'; for p in $$list; do \ list='$(e_libexec_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ rm -f $(DESTDIR)$(e_libexecdir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done done
mostlyclean-sbinPROGRAMS: mostlyclean-e_sbinPROGRAMS:
clean-sbinPROGRAMS: clean-e_sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) -test -z "$(e_sbin_PROGRAMS)" || rm -f $(e_sbin_PROGRAMS)
distclean-sbinPROGRAMS: distclean-e_sbinPROGRAMS:
maintainer-clean-sbinPROGRAMS: maintainer-clean-e_sbinPROGRAMS:
install-sbinPROGRAMS: $(sbin_PROGRAMS) install-e_sbinPROGRAMS: $(e_sbin_PROGRAMS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(sbindir) $(mkinstalldirs) $(DESTDIR)$(e_sbindir)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \ @list='$(e_sbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \ if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(e_sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(e_sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \ else :; fi; \
done done
uninstall-sbinPROGRAMS: uninstall-e_sbinPROGRAMS:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(sbin_PROGRAMS)'; for p in $$list; do \ list='$(e_sbin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ rm -f $(DESTDIR)$(e_sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done done
emailrelay-passwd: $(emailrelay_passwd_OBJECTS) $(emailrelay_passwd_DEPENDENCIES)
@rm -f emailrelay-passwd
$(CXXLINK) $(emailrelay_passwd_LDFLAGS) $(emailrelay_passwd_OBJECTS) $(emailrelay_passwd_LDADD) $(LIBS)
emailrelay-poke: $(emailrelay_poke_OBJECTS) $(emailrelay_poke_DEPENDENCIES) emailrelay-poke: $(emailrelay_poke_OBJECTS) $(emailrelay_poke_DEPENDENCIES)
@rm -f emailrelay-poke @rm -f emailrelay-poke
$(LINK) $(emailrelay_poke_LDFLAGS) $(emailrelay_poke_OBJECTS) $(emailrelay_poke_LDADD) $(LIBS) $(LINK) $(emailrelay_poke_LDFLAGS) $(emailrelay_poke_OBJECTS) $(emailrelay_poke_LDADD) $(LIBS)
emailrelay: $(emailrelay_OBJECTS) $(emailrelay_DEPENDENCIES)
@rm -f emailrelay
$(CXXLINK) $(emailrelay_LDFLAGS) $(emailrelay_OBJECTS) $(emailrelay_LDADD) $(LIBS)
emailrelay-submit: $(emailrelay_submit_OBJECTS) $(emailrelay_submit_DEPENDENCIES) emailrelay-submit: $(emailrelay_submit_OBJECTS) $(emailrelay_submit_DEPENDENCIES)
@rm -f emailrelay-submit @rm -f emailrelay-submit
$(CXXLINK) $(emailrelay_submit_LDFLAGS) $(emailrelay_submit_OBJECTS) $(emailrelay_submit_LDADD) $(LIBS) $(CXXLINK) $(emailrelay_submit_LDFLAGS) $(emailrelay_submit_OBJECTS) $(emailrelay_submit_LDADD) $(LIBS)
emailrelay: $(emailrelay_OBJECTS) $(emailrelay_DEPENDENCIES) emailrelay-passwd: $(emailrelay_passwd_OBJECTS) $(emailrelay_passwd_DEPENDENCIES)
@rm -f emailrelay @rm -f emailrelay-passwd
$(CXXLINK) $(emailrelay_LDFLAGS) $(emailrelay_OBJECTS) $(emailrelay_LDADD) $(LIBS) $(CXXLINK) $(emailrelay_passwd_LDFLAGS) $(emailrelay_passwd_OBJECTS) $(emailrelay_passwd_LDADD) $(LIBS)
.cpp.o: .cpp.o:
$(CXXCOMPILE) -c $< $(CXXCOMPILE) -c $<
install-localstateDATA: $(localstate_DATA) install-e_spoolDATA: $(e_spool_DATA)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(localstatedir) $(mkinstalldirs) $(DESTDIR)$(e_spooldir)
@list='$(localstate_DATA)'; for p in $$list; do \ @list='$(e_spool_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \ if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(localstatedir)/$$p"; \ echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_spooldir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(localstatedir)/$$p; \ $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(e_spooldir)/$$p; \
else if test -f $$p; then \ else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(localstatedir)/$$p"; \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(e_spooldir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(localstatedir)/$$p; \ $(INSTALL_DATA) $$p $(DESTDIR)$(e_spooldir)/$$p; \
fi; fi; \ fi; fi; \
done done
uninstall-localstateDATA: uninstall-e_spoolDATA:
@$(NORMAL_UNINSTALL) @$(NORMAL_UNINSTALL)
list='$(localstate_DATA)'; for p in $$list; do \ list='$(e_spool_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(localstatedir)/$$p; \ rm -f $(DESTDIR)$(e_spooldir)/$$p; \
done done
tags: TAGS tags: TAGS
@ -422,9 +427,9 @@ gfilestore.o: gfilestore.cpp ../../src/glib/gdef.h ../../config.h \
gmessagestore.h gnewmessage.h gstoredmessage.h \ gmessagestore.h gnewmessage.h gstoredmessage.h \
../../src/glib/gstrings.h ../../src/glib/gpath.h \ ../../src/glib/gstrings.h ../../src/glib/gpath.h \
../../src/glib/gexception.h ../../src/glib/gdatetime.h \ ../../src/glib/gexception.h ../../src/glib/gdatetime.h \
gnewfile.h gstoredfile.h ../../src/glib/gprocess.h \ ../../src/glib/gnoncopyable.h ../../src/glib/groot.h \
../../src/glib/gprocess.h gnewfile.h gstoredfile.h \
../../src/glib/gdirectory.h ../../src/glib/gmemory.h \ ../../src/glib/gdirectory.h ../../src/glib/gmemory.h \
../../src/glib/groot.h ../../src/glib/gnoncopyable.h \
../../src/glib/gfile.h ../../src/glib/gstr.h \ ../../src/glib/gfile.h ../../src/glib/gstr.h \
../../src/glib/gassert.h ../../src/glib/glogoutput.h ../../src/glib/gassert.h ../../src/glib/glogoutput.h
gmessagestore.o: gmessagestore.cpp ../../src/glib/gdef.h ../../config.h \ gmessagestore.o: gmessagestore.cpp ../../src/glib/gdef.h ../../config.h \
@ -448,8 +453,8 @@ gnewfile.o: gnewfile.cpp ../../src/glib/gdef.h ../../config.h \
gnewmessage.h gstoredmessage.h ../../src/glib/gstrings.h \ gnewmessage.h gstoredmessage.h ../../src/glib/gstrings.h \
../../src/glib/gpath.h ../../src/glib/gexception.h gnewfile.h \ ../../src/glib/gpath.h ../../src/glib/gexception.h gnewfile.h \
gfilestore.h ../../src/glib/gdatetime.h \ gfilestore.h ../../src/glib/gdatetime.h \
../../src/glib/gmemory.h ../../src/glib/gprocess.h \ ../../src/glib/gnoncopyable.h ../../src/glib/groot.h \
../../src/glib/groot.h ../../src/glib/gnoncopyable.h \ ../../src/glib/gprocess.h ../../src/glib/gmemory.h \
../../src/glib/gfile.h gxtext.h ../../src/glib/gassert.h \ ../../src/glib/gfile.h gxtext.h ../../src/glib/gassert.h \
../../src/glib/glogoutput.h ../../src/glib/glogoutput.h
gnewmessage.o: gnewmessage.cpp ../../src/glib/gdef.h ../../config.h \ gnewmessage.o: gnewmessage.cpp ../../src/glib/gdef.h ../../config.h \
@ -565,10 +570,11 @@ gstoredfile.o: gstoredfile.cpp ../../src/glib/gdef.h ../../config.h \
gmessagestore.h gnewmessage.h gstoredmessage.h \ gmessagestore.h gnewmessage.h gstoredmessage.h \
../../src/glib/gstrings.h ../../src/glib/gpath.h \ ../../src/glib/gstrings.h ../../src/glib/gpath.h \
../../src/glib/gexception.h ../../src/glib/gdatetime.h \ ../../src/glib/gexception.h ../../src/glib/gdatetime.h \
gstoredfile.h ../../src/glib/gmemory.h ../../src/glib/groot.h \ ../../src/glib/gnoncopyable.h ../../src/glib/groot.h \
../../src/glib/gprocess.h ../../src/glib/gnoncopyable.h \ ../../src/glib/gprocess.h gstoredfile.h \
gxtext.h ../../src/glib/gfile.h ../../src/glib/gstr.h \ ../../src/glib/gmemory.h gxtext.h ../../src/glib/gfile.h \
../../src/glib/gassert.h ../../src/glib/glogoutput.h ../../src/glib/gstr.h ../../src/glib/gassert.h \
../../src/glib/glogoutput.h
gstoredmessage.o: gstoredmessage.cpp ../../src/glib/gdef.h \ gstoredmessage.o: gstoredmessage.cpp ../../src/glib/gdef.h \
../../config.h ../../lib/gcc2.95/iostream \ ../../config.h ../../lib/gcc2.95/iostream \
../../lib/gcc2.95/sstream ../../lib/gcc2.95/xlocale \ ../../lib/gcc2.95/sstream ../../lib/gcc2.95/xlocale \
@ -601,13 +607,13 @@ main_unix.o: main_unix.cpp ../../src/glib/gdef.h ../../config.h \
../../src/glib/ggetopt.h ../../src/glib/gexception.h \ ../../src/glib/ggetopt.h ../../src/glib/gexception.h \
../../src/gnet/geventloop.h ../../src/gnet/geventhandler.h \ ../../src/gnet/geventloop.h ../../src/gnet/geventhandler.h \
../../src/glib/gcredentials.h ../../src/glib/gdatetime.h \ ../../src/glib/gcredentials.h ../../src/glib/gdatetime.h \
../../src/gnet/gdescriptor.h ../../src/glib/gdaemon.h \ ../../src/gnet/gdescriptor.h ../../src/glib/glogoutput.h \
gmessagestore.h gnewmessage.h gstoredmessage.h gsmtpclient.h \ ../../src/glib/gdaemon.h gmessagestore.h gnewmessage.h \
gsecrets.h ../../src/gnet/glinebuffer.h \ gstoredmessage.h gsmtpclient.h gsecrets.h \
../../src/gnet/gclient.h ../../src/gnet/gaddress.h \ ../../src/gnet/glinebuffer.h ../../src/gnet/gclient.h \
../../src/gnet/gconnection.h ../../src/gnet/gsocket.h \ ../../src/gnet/gaddress.h ../../src/gnet/gconnection.h \
../../src/gnet/gevent.h gclientprotocol.h gsasl.h \ ../../src/gnet/gsocket.h ../../src/gnet/gevent.h \
../../src/gnet/gtimer.h gclientprotocol.h gsasl.h ../../src/gnet/gtimer.h
passwd.o: passwd.cpp ../../src/glib/gdef.h ../../config.h \ passwd.o: passwd.cpp ../../src/glib/gdef.h ../../config.h \
../../lib/gcc2.95/iostream ../../lib/gcc2.95/sstream \ ../../lib/gcc2.95/iostream ../../lib/gcc2.95/sstream \
../../lib/gcc2.95/xlocale ../../lib/gcc2.95/limits \ ../../lib/gcc2.95/xlocale ../../lib/gcc2.95/limits \
@ -624,30 +630,34 @@ run.o: run.cpp ../../src/glib/gdef.h ../../config.h \
../../src/glib/ggetopt.h ../../src/glib/gexception.h \ ../../src/glib/ggetopt.h ../../src/glib/gexception.h \
../../src/gnet/geventloop.h ../../src/gnet/geventhandler.h \ ../../src/gnet/geventloop.h ../../src/gnet/geventhandler.h \
../../src/glib/gcredentials.h ../../src/glib/gdatetime.h \ ../../src/glib/gcredentials.h ../../src/glib/gdatetime.h \
../../src/gnet/gdescriptor.h ../../src/glib/gdaemon.h \ ../../src/gnet/gdescriptor.h ../../src/glib/glogoutput.h \
gmessagestore.h gnewmessage.h gstoredmessage.h gsmtpclient.h \ ../../src/glib/gdaemon.h gmessagestore.h gnewmessage.h \
gsecrets.h ../../src/gnet/glinebuffer.h \ gstoredmessage.h gsmtpclient.h gsecrets.h \
../../src/gnet/gclient.h ../../src/gnet/gaddress.h \ ../../src/gnet/glinebuffer.h ../../src/gnet/gclient.h \
../../src/gnet/gconnection.h ../../src/gnet/gsocket.h \ ../../src/gnet/gaddress.h ../../src/gnet/gconnection.h \
../../src/gnet/gevent.h gclientprotocol.h gsasl.h \ ../../src/gnet/gsocket.h ../../src/gnet/gevent.h \
../../src/gnet/gtimer.h gsmtpserver.h ../../src/gnet/gserver.h \ gclientprotocol.h gsasl.h ../../src/gnet/gtimer.h gsmtpserver.h \
../../src/gnet/gselect.h gverifier.h gserverprotocol.h \ ../../src/gnet/gserver.h ../../src/gnet/gselect.h gverifier.h \
gprotocolmessage.h ../../src/glib/gstatemachine.h gfilestore.h \ gserverprotocol.h gprotocolmessage.h \
gnewfile.h gadminserver.h ../../src/gnet/gmonitor.h \ ../../src/glib/gstatemachine.h gfilestore.h \
../../src/gnet/glocal.h ../../src/glib/groot.h \ ../../src/glib/gnoncopyable.h ../../src/glib/groot.h \
../../src/glib/gprocess.h ../../src/glib/gnoncopyable.h \ ../../src/glib/gprocess.h gnewfile.h gadminserver.h \
../../src/glib/gmemory.h ../../src/glib/glogoutput.h \ ../../src/gnet/gmonitor.h ../../src/gnet/glocal.h \
../../src/glib/gdebug.h ../../src/glib/gassert.h ../../src/glib/gmemory.h ../../src/glib/gdebug.h \
../../src/glib/gassert.h
submit.o: submit.cpp ../../src/glib/gdef.h ../../config.h \ submit.o: submit.cpp ../../src/glib/gdef.h ../../config.h \
../../lib/gcc2.95/iostream ../../lib/gcc2.95/sstream \ ../../lib/gcc2.95/iostream ../../lib/gcc2.95/sstream \
../../lib/gcc2.95/xlocale ../../lib/gcc2.95/limits \ ../../lib/gcc2.95/xlocale ../../lib/gcc2.95/limits \
../../src/gnet/gnet.h gsmtp.h ../../src/glib/glog.h \ ../../src/gnet/gnet.h gsmtp.h ../../src/glib/glog.h \
../../src/gnet/glocal.h ../../src/gnet/gaddress.h \ ../../src/gnet/glocal.h ../../src/gnet/gaddress.h \
../../src/glib/gexception.h ../../src/glib/garg.h \ ../../src/glib/gexception.h ../../src/gnet/geventloop.h \
../../src/glib/gstrings.h ../../src/glib/gstr.h \ ../../src/gnet/geventhandler.h ../../src/glib/gcredentials.h \
../../src/glib/ggetopt.h ../../src/glib/gpath.h gfilestore.h \ ../../src/glib/gdatetime.h ../../src/gnet/gdescriptor.h \
gmessagestore.h gnewmessage.h gstoredmessage.h \ ../../src/glib/garg.h ../../src/glib/gstrings.h \
../../src/glib/gdatetime.h legal.h ../../src/glib/gstr.h ../../src/glib/ggetopt.h \
../../src/glib/gpath.h gverifier.h gfilestore.h gmessagestore.h \
gnewmessage.h gstoredmessage.h ../../src/glib/gnoncopyable.h \
../../src/glib/groot.h ../../src/glib/gprocess.h legal.h
info-am: info-am:
info: info-am info: info-am
@ -657,26 +667,26 @@ check-am: all-am
check: check-am check: check-am
installcheck-am: installcheck-am:
installcheck: installcheck-am installcheck: installcheck-am
install-exec-am: install-libexecPROGRAMS install-sbinPROGRAMS \ install-exec-am: install-e_libexecPROGRAMS install-exec-local
install-localstateDATA
install-exec: install-exec-am install-exec: install-exec-am
install-data-am: install-data-am: install-e_sbinPROGRAMS install-e_spoolDATA \
install-data-local
install-data: install-data-am install-data: install-data-am
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am install: install-am
uninstall-am: uninstall-libexecPROGRAMS uninstall-sbinPROGRAMS \ uninstall-am: uninstall-e_libexecPROGRAMS uninstall-e_sbinPROGRAMS \
uninstall-localstateDATA uninstall-e_spoolDATA
uninstall: uninstall-am uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA)
all-redirect: all-am all-redirect: all-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(sbindir) \ $(mkinstalldirs) $(DESTDIR)$(e_libexecdir) $(DESTDIR)$(e_sbindir) \
$(DESTDIR)$(localstatedir) $(DESTDIR)$(e_spooldir)
mostlyclean-generic: mostlyclean-generic:
@ -689,27 +699,28 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-libexecPROGRAMS mostlyclean-sbinPROGRAMS \ mostlyclean-e_libexecPROGRAMS \
mostlyclean-tags mostlyclean-generic mostlyclean-e_sbinPROGRAMS mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-libexecPROGRAMS \ clean-am: clean-noinstLIBRARIES clean-compile clean-e_libexecPROGRAMS \
clean-sbinPROGRAMS clean-tags clean-generic \ clean-e_sbinPROGRAMS clean-tags clean-generic \
mostlyclean-am mostlyclean-am
clean: clean-am clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \ distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-libexecPROGRAMS distclean-sbinPROGRAMS \ distclean-e_libexecPROGRAMS distclean-e_sbinPROGRAMS \
distclean-tags distclean-generic clean-am distclean-tags distclean-generic clean-am
distclean: distclean-am distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile \ maintainer-clean-compile \
maintainer-clean-libexecPROGRAMS \ maintainer-clean-e_libexecPROGRAMS \
maintainer-clean-sbinPROGRAMS maintainer-clean-tags \ maintainer-clean-e_sbinPROGRAMS maintainer-clean-tags \
maintainer-clean-generic distclean-am maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;" @echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
@ -719,20 +730,30 @@ maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ .PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \ mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libexecPROGRAMS \ maintainer-clean-compile mostlyclean-e_libexecPROGRAMS \
distclean-libexecPROGRAMS clean-libexecPROGRAMS \ distclean-e_libexecPROGRAMS clean-e_libexecPROGRAMS \
maintainer-clean-libexecPROGRAMS uninstall-libexecPROGRAMS \ maintainer-clean-e_libexecPROGRAMS uninstall-e_libexecPROGRAMS \
install-libexecPROGRAMS mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \ install-e_libexecPROGRAMS mostlyclean-e_sbinPROGRAMS \
clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ distclean-e_sbinPROGRAMS clean-e_sbinPROGRAMS \
install-sbinPROGRAMS uninstall-localstateDATA install-localstateDATA \ maintainer-clean-e_sbinPROGRAMS uninstall-e_sbinPROGRAMS \
tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \ install-e_sbinPROGRAMS uninstall-e_spoolDATA install-e_spoolDATA tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \ distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \ installcheck install-exec-local install-exec-am install-exec \
install-am install uninstall-am uninstall all-redirect all-am all \ install-data-local install-data-am install-data install-am install \
installdirs mostlyclean-generic distclean-generic clean-generic \ uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
install-data-local:
-chgrp daemon $(DESTDIR)$(e_spooldir)
-chmod 775 $(DESTDIR)$(e_spooldir)
-chgrp daemon $(DESTDIR)$(e_sbindir)/emailrelay-submit
-chmod g+s $(DESTDIR)$(e_sbindir)/emailrelay-submit
install-exec-local:
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -55,9 +55,12 @@ std::string Main::CommandLine::switchSpec()
<< "i!pid-file!records the daemon process-id in the given file!1!pid-file|" << "i!pid-file!records the daemon process-id in the given file!1!pid-file|"
<< "p!port!specifies the smtp listening port number!1!port|" << "p!port!specifies the smtp listening port number!1!port|"
<< "r!remote-clients!allows remote clients to connect!0!|" << "r!remote-clients!allows remote clients to connect!0!|"
<< "s!spool-dir!specifies the spool directory " << "(default is \"" << dir << "\")!1!dir|" << "s!spool-dir!specifies the spool directory (default is \"" << dir << "\")!1!dir|"
<< "v!verbose!generates more verbose logging " << "(if compiled-in and logging enabled and stderr open)!0!|" << "v!verbose!generates more verbose logging!0!|"
<< "V!version!displays version information and exits!0!" << "g!debug!generates debug-level logging (if compiled-in)!0!|"
<< "V!version!displays version information and exits!0!|"
<< "q!as-client!equivalent to \"--log --no-syslog --no-daemon --dont-serve --forward --forward-to\"!" << "1!host:port|"
<< "d!as-server!equivalent to \"--log --close-stderr\"!0!"
; ;
return ss.str() ; return ss.str() ;
} }

View File

@ -37,9 +37,7 @@ std::string Main::CommandLine::osSwitchSpec()
<< "l!log!writes log information on standard error (if open) and syslog (if not disabled)!0!|" << "l!log!writes log information on standard error (if open) and syslog (if not disabled)!0!|"
<< "t!no-daemon!does not detach from the terminal!0!|" << "t!no-daemon!does not detach from the terminal!0!|"
<< "u!user!names the effective user to switch to when started as root (default is \"daemon\")!1!username|" << "u!user!names the effective user to switch to when started as root (default is \"daemon\")!1!username|"
<< "n!no-syslog!disables syslog output!0!|" << "n!no-syslog!disables syslog output!0!"
<< "q!as-client!equivalent to \"--log --no-syslog --no-daemon --dont-serve --forward --forward-to\"!" << "1!host:port|"
<< "d!as-server!equivalent to \"--log --close-stderr\"!0!"
; ;
return ss.str() ; return ss.str() ;
} }

View File

@ -38,9 +38,7 @@ std::string Main::CommandLine::osSwitchSpec()
ss ss
<< "l!log!writes log information on standard error (if open)!0!|" << "l!log!writes log information on standard error (if open)!0!|"
<< "t!no-daemon!use an ordinary window, not the system tray!0!|" << "t!no-daemon!use an ordinary window, not the system tray!0!|"
<< "n!no-syslog!has no effect on windows!0!|" << "n!no-syslog!dont use the event log!0!|"
<< "q!as-client!equivalent to \"--log --no-daemon --dont-serve --forward --forward-to\"!" << "1!host:port|"
<< "d!as-server!equivalent to \"--log --close-stderr\" (has little effect on windows)!0!|"
<< "I!icon!selects the application icon!1!0^|1^|2^|3" << "I!icon!selects the application icon!1!0^|1^|2^|3"
; ;

404
src/main/common.dsp Normal file
View File

@ -0,0 +1,404 @@
# Microsoft Developer Studio Project File - Name="common" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=common - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "common.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "common.mak" CFG="common - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "common - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "common - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "common - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "CommonRelease"
# PROP Intermediate_Dir "CommonRelease"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GR /GX /O2 /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "G_WIN32" /YX"gdef.h" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "common - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "CommonDebug"
# PROP Intermediate_Dir "CommonDebug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "G_WIN32" /YX"gdef.h" /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "common - Win32 Release"
# Name "common - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\gnet\gaddress_ipv4.cpp
# End Source File
# Begin Source File
SOURCE=gadminserver.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gappbase.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gappinst.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\garg.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\garg_win32.cpp
# End Source File
# Begin Source File
SOURCE=gbase64.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gclient.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gclient_win32.cpp
# End Source File
# Begin Source File
SOURCE=gclientprotocol.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gconnection.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gcontrol.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gcracker.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdaemon.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdaemon_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdate.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdatetime.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdatetime_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gdescriptor_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gdialog.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdirectory.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdirectory_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gevent_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventhandler.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventloop.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventserver.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gexception.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gfile.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gfile_win32.cpp
# End Source File
# Begin Source File
SOURCE=gfilestore.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gfs_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\ggetopt.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\glinebuffer.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\glocal.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\glocal_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\glog.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\glogoutput.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\glogoutput_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gmd5.cpp
# End Source File
# Begin Source File
SOURCE=gmessagestore.cpp
# End Source File
# Begin Source File
SOURCE=gmessagestore_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gmonitor.cpp
# End Source File
# Begin Source File
SOURCE=gnewfile.cpp
# End Source File
# Begin Source File
SOURCE=gnewmessage.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gpath.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gprocess_win32.cpp
# End Source File
# Begin Source File
SOURCE=gprotocolmessage.cpp
# End Source File
# Begin Source File
SOURCE=gprotocolmessageforward.cpp
# End Source File
# Begin Source File
SOURCE=gprotocolmessagestore.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gpump.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gpump_dialog.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\grequest.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gresolve.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gresolve_ipv4.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gresolve_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\groot.cpp
# End Source File
# Begin Source File
SOURCE=gsasl_native.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gscmap.cpp
# End Source File
# Begin Source File
SOURCE=gsecrets.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gserver.cpp
# End Source File
# Begin Source File
SOURCE=gserverprotocol.cpp
# End Source File
# Begin Source File
SOURCE=gsmtpclient.cpp
# End Source File
# Begin Source File
SOURCE=gsmtpserver.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gsocket.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gsocket_win32.cpp
# End Source File
# Begin Source File
SOURCE=gstoredfile.cpp
# End Source File
# Begin Source File
SOURCE=gstoredmessage.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gstr.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gtime.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gtimer.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gtray.cpp
# End Source File
# Begin Source File
SOURCE=gverifier.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwinbase.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwindow.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwinhid.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gwinsock.cpp
# End Source File
# Begin Source File
SOURCE=gxtext.cpp
# End Source File
# Begin Source File
SOURCE=legal.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# End Target
# End Project

View File

@ -55,6 +55,7 @@ std::string Main::Configuration::str( const std::string & p , const std::string
<< p << "run as daemon? " << yn(daemon()) << eol << p << "run as daemon? " << yn(daemon()) << eol
<< p << "log to stderr/syslog? " << yn(log()) << eol << p << "log to stderr/syslog? " << yn(log()) << eol
<< p << "verbose logging? " << yn(verbose()) << eol << p << "verbose logging? " << yn(verbose()) << eol
<< p << "debug logging? " << yn(debug()) << eol
//<< p << "use syslog? " << yn(syslog()) << eol //<< p << "use syslog? " << yn(syslog()) << eol
<< p << "close stderr? " << yn(closeStderr()) << eol << p << "close stderr? " << yn(closeStderr()) << eol
<< p << "allow remote clients? " << yn(allowRemoteClients()) << eol << p << "allow remote clients? " << yn(allowRemoteClients()) << eol
@ -82,6 +83,11 @@ bool Main::Configuration::verbose() const
return m_cl.contains("verbose") ; return m_cl.contains("verbose") ;
} }
bool Main::Configuration::debug() const
{
return m_cl.contains("debug") ;
}
bool Main::Configuration::syslog() const bool Main::Configuration::syslog() const
{ {
return !m_cl.contains("no-syslog") && !m_cl.contains("as-client") ; return !m_cl.contains("no-syslog") && !m_cl.contains("as-client") ;

View File

@ -69,6 +69,9 @@ public:
// Returns true if doing logging. // Returns true if doing logging.
bool verbose() const ; bool verbose() const ;
// Returns true if doing verbose logging.
bool debug() const ;
// Returns true if doing debug-level logging. // Returns true if doing debug-level logging.
bool syslog() const ; bool syslog() const ;

30
src/main/doxygen.cfg Normal file → Executable file
View File

@ -3,7 +3,7 @@
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
PROJECT_NAME = E-MailRelay PROJECT_NAME = E-MailRelay
PROJECT_NUMBER = 0.9.8 PROJECT_NUMBER = 0.9.9
OUTPUT_DIRECTORY = OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES EXTRACT_ALL = YES
@ -57,17 +57,21 @@ INPUT = __TOP_SRC__/src/glib \
FILE_PATTERNS = *.cpp \ FILE_PATTERNS = *.cpp \
*.h *.h
RECURSIVE = YES RECURSIVE = YES
EXCLUDE = src/glib/gdef.h gdef.h \ EXCLUDE_PATTERNS = \
src/gnet/gnet.h gnet.h \ */win32/* \
src/win32 \ */*_win32.* \
src/gnet/resolverd.cpp resolverd.cpp \ */*_ipv6.cpp \
src/gnet/gwinsock.cpp gwinsock.cpp \ */old/* \
src/gnet/gwinsock.h gwinsock.h \ */resolverd.cpp \
src/gnet/gaddress_ipv6.cpp gaddress_ipv6.cpp \ */gsasl_cyrus.cpp \
src/gnet/gresolve_ipv6.cpp gresolve_ipv6.cpp \ */gsasl_login.cpp \
src/gnet/grequest.cpp grequest.cpp \ */gdef.h \
src/gnet/grequest.h grequest.h */gnet.h \
EXCLUDE_PATTERNS = */*_win32.* */*_ipv6.cpp */old/* */resolverd.cpp */gsasl_cyrus.cpp */resolverd.cpp \
*/gwinsock.* \
*/grequest.* \
*/submit.cpp \
*/passwd.cpp
EXAMPLE_PATH = EXAMPLE_PATH =
EXAMPLE_PATTERNS = EXAMPLE_PATTERNS =
IMAGE_PATH = IMAGE_PATH =
@ -83,7 +87,7 @@ IGNORE_PREFIX =
# configuration options related to the HTML output # configuration options related to the HTML output
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
GENERATE_HTML = GENERATE_HTML =
HTML_OUTPUT = html HTML_OUTPUT = doxygen
HTML_HEADER = __TOP_SRC__/doc/doxygen_header.html HTML_HEADER = __TOP_SRC__/doc/doxygen_header.html
HTML_FOOTER = HTML_FOOTER =
HTML_STYLESHEET = HTML_STYLESHEET =

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /Yu"stdafx.h" /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /W3 /GR /GX /O2 /I "../glib" /I "../gnet" /I "../win32" /I "../../lib/msvc6.0" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "G_WIN32" /D "_CONSOLE" /YX"gdef.h" /FD /c # ADD CPP /nologo /W3 /GR /GX /O2 /I "../win32" /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /D "NDEBUG" /D "G_WIN32" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX"gdef.h" /FD /c
# SUBTRACT CPP /X # SUBTRACT CPP /X
# ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG"
@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "../../src/glib" /I "../../src/gnet" /I "../../lib/msvc6.0" /I "../../src/win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "G_WIN32" /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "../../src/glib" /I "../../src/gnet" /I "../../src/win32" /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "_DEBUG" /D "G_WIN32" /D "WIN32" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG"
@ -103,330 +103,6 @@ SOURCE=.\configuration.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\gnet\gaddress_ipv4.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gadminserver.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gappbase.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gappinst.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\garg.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\garg_win32.cpp
# End Source File
# Begin Source File
SOURCE=.\gbase64.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gclient.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gclient_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gclientprotocol.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gconnection.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gcontrol.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gcracker.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gdaemon.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdaemon_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdate.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdatetime.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdatetime_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gdescriptor_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gdialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdirectory.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gdirectory_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gevent_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventhandler.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventhandler.h
# End Source File
# Begin Source File
SOURCE=..\gnet\geventloop.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\geventloop.h
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\geventserver.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gexception.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gfile.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gfile_win32.cpp
# End Source File
# Begin Source File
SOURCE=.\gfilestore.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gfs_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\ggetopt.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\glinebuffer.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\glocal.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\glocal.h
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\glocal_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\glog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\glogoutput.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\glogoutput_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\gmd5.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gmessagestore.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gmessagestore_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gmonitor.cpp
# End Source File
# Begin Source File
SOURCE=.\gnewfile.cpp
# End Source File
# Begin Source File
SOURCE=.\gnewmessage.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gpath.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gprocess_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gprotocolmessage.cpp
# End Source File
# Begin Source File
SOURCE=.\gprotocolmessageforward.cpp
# End Source File
# Begin Source File
SOURCE=.\gprotocolmessagestore.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gpump.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gpump_dialog.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\grequest.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gresolve.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gresolve_ipv4.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gresolve_win32.cpp
# End Source File
# Begin Source File
SOURCE=..\glib\groot.cpp
# End Source File
# Begin Source File
SOURCE=.\gsasl_native.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gscmap.cpp
# End Source File
# Begin Source File
SOURCE=.\gsecrets.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gserver.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gserverprotocol.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gsmtpclient.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\main\gsmtpserver.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gsocket.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gsocket_win32.cpp
# End Source File
# Begin Source File
SOURCE=.\gstoredfile.cpp
# End Source File
# Begin Source File
SOURCE=.\gstoredmessage.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gstr.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\glib\gtime.cpp
# End Source File
# Begin Source File
SOURCE=..\gnet\gtimer.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gtray.cpp
# End Source File
# Begin Source File
SOURCE=.\gverifier.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwinbase.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwindow.cpp
# End Source File
# Begin Source File
SOURCE=..\win32\gwinhid.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\gnet\gwinsock.cpp
# End Source File
# Begin Source File
SOURCE=.\gxtext.cpp
# End Source File
# Begin Source File
SOURCE=.\legal.cpp
# End Source File
# Begin Source File
SOURCE=.\main_win32.cpp SOURCE=.\main_win32.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@ -448,6 +124,59 @@ SOURCE=.\emailrelay.rc
# Begin Source File # Begin Source File
SOURCE=".\icon-32.ico" SOURCE=".\icon-32.ico"
# End Source File
# Begin Source File
SOURCE=.\icon2.ico
# End Source File
# Begin Source File
SOURCE=.\icon3.ico
# End Source File
# Begin Source File
SOURCE=.\icon4.ico
# End Source File
# Begin Source File
SOURCE=.\messages.mc
!IF "$(CFG)" == "emailrelay - Win32 Release"
# Begin Custom Build
InputPath=.\messages.mc
BuildCmds= \
mc messages.mc
"messages.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"messages.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "emailrelay - Win32 Debug"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
InputPath=.\messages.mc
BuildCmds= \
mc messages.mc
"messages.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"messages.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"msg00001.bin" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File # End Source File
# End Group # End Group
# End Target # End Target

74
src/main/emailrelay.dsw Normal file
View File

@ -0,0 +1,74 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "common"=".\common.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "emailrelay"=".\emailrelay.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
}}}
###############################################################################
Project: "passwd"=".\passwd.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
}}}
###############################################################################
Project: "submit"=".\submit.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -50,7 +50,7 @@ END
3 TEXTINCLUDE DISCARDABLE 3 TEXTINCLUDE DISCARDABLE
BEGIN BEGIN
"\r\n" "#include <messages.rc>\r\n"
"\0" "\0"
END END
@ -106,6 +106,52 @@ BEGIN
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,9,0
PRODUCTVERSION 0,9,9,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x10004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "E-MailRelay Application\0"
VALUE "FileVersion", "0, 9, 9, 0\0"
VALUE "InternalName", "emailrelay\0"
VALUE "LegalCopyright", "Copyright © Graeme Walker, 2002\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "emailrelay.rc\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "E-MailRelay\0"
VALUE "ProductVersion", "0, 9, 9, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // !_MAC
#endif // English (U.K.) resources #endif // English (U.K.) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -116,7 +162,7 @@ END
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
#include <messages.rc>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View File

View File

@ -29,7 +29,6 @@
#include "gprocess.h" #include "gprocess.h"
#include "gdirectory.h" #include "gdirectory.h"
#include "gmemory.h" #include "gmemory.h"
#include "groot.h"
#include "gpath.h" #include "gpath.h"
#include "gfile.h" #include "gfile.h"
#include "gstr.h" #include "gstr.h"
@ -119,14 +118,17 @@ std::string GSmtp::FileStore::format( int n )
//static //static
void GSmtp::FileStore::checkPath( const G::Path & directory_path ) void GSmtp::FileStore::checkPath( const G::Path & directory_path )
{ {
G::Root claim_root ; FileWriter claim_writer ;
// (void) G::File::mkdir( directory_path ) ;
G::Directory dir_test( directory_path ) ; G::Directory dir_test( directory_path ) ;
if( ! dir_test.valid() )
bool test_for_creation = false ;
if( ! dir_test.valid(test_for_creation) )
{ {
throw InvalidDirectory( directory_path.str() ) ; throw InvalidDirectory( directory_path.str() ) ;
} }
if( ! dir_test.valid(true) )
test_for_creation = true ;
if( ! dir_test.valid(test_for_creation) )
{ {
G_WARNING( "GSmtp::MessageStore: " G_WARNING( "GSmtp::MessageStore: "
<< "directory not writable: \"" << "directory not writable: \""
@ -136,7 +138,7 @@ void GSmtp::FileStore::checkPath( const G::Path & directory_path )
std::auto_ptr<std::ostream> GSmtp::FileStore::stream( const G::Path & path ) std::auto_ptr<std::ostream> GSmtp::FileStore::stream( const G::Path & path )
{ {
G::Root claim_root ; FileWriter claim_writer ;
std::auto_ptr<std::ostream> ptr( std::auto_ptr<std::ostream> ptr(
new std::ofstream( path.pathCstr() , new std::ofstream( path.pathCstr() ,
std::ios_base::binary | std::ios_base::out | std::ios_base::trunc ) ) ; std::ios_base::binary | std::ios_base::out | std::ios_base::trunc ) ) ;
@ -196,7 +198,7 @@ bool GSmtp::FileStore::empty() const
bool GSmtp::FileStore::emptyCore() const bool GSmtp::FileStore::emptyCore() const
{ {
G::Root claim_root ; FileReader claim_reader ;
G::Directory dir( m_dir ) ; G::Directory dir( m_dir ) ;
G::DirectoryIterator iter( dir , "*.envelope" ) ; G::DirectoryIterator iter( dir , "*.envelope" ) ;
const bool no_more = iter.error() || !iter.more() ; const bool no_more = iter.error() || !iter.more() ;
@ -205,7 +207,7 @@ bool GSmtp::FileStore::emptyCore() const
GSmtp::MessageStore::Iterator GSmtp::FileStore::iterator() GSmtp::MessageStore::Iterator GSmtp::FileStore::iterator()
{ {
G::Root claim_root ; FileReader claim_reader ;
return MessageStore::Iterator( new FileIterator(G::Directory(m_dir) ) ) ; return MessageStore::Iterator( new FileIterator(G::Directory(m_dir) ) ) ;
} }
@ -236,3 +238,28 @@ std::auto_ptr<GSmtp::NewMessage> GSmtp::FileStore::newMessage( const std::string
return std::auto_ptr<NewMessage>( new NewFile(from,*this) ) ; return std::auto_ptr<NewMessage>( new NewFile(from,*this) ) ;
} }
// ===
GSmtp::FileReader::FileReader() :
m_imp(NULL)
{
}
GSmtp::FileReader::~FileReader()
{
}
// ===
GSmtp::FileWriter::FileWriter() :
m_imp( new G::Root(false) )
{
G::Process::setUmask( false ) ;
}
GSmtp::FileWriter::~FileWriter()
{
delete m_imp ;
G::Process::setUmask( true ) ;
}

View File

@ -29,6 +29,8 @@
#include "gmessagestore.h" #include "gmessagestore.h"
#include "gdatetime.h" #include "gdatetime.h"
#include "gexception.h" #include "gexception.h"
#include "gnoncopyable.h"
#include "groot.h"
#include "gpath.h" #include "gpath.h"
#include <memory> #include <memory>
#include <string> #include <string>
@ -36,6 +38,8 @@
namespace GSmtp namespace GSmtp
{ {
class FileStore ; class FileStore ;
class FileReader ;
class FileWriter ;
} ; } ;
// Class: GSmtp::FileStore // Class: GSmtp::FileStore
@ -115,5 +119,33 @@ private:
unsigned long m_pid_modifier ; unsigned long m_pid_modifier ;
} ; } ;
// Class: GSmtp::FileReader
// Description: Used by GSmtp::FileStore, GSmtp::NewFile and
// GSmtp::StoredFile to claim read permissions.
// See also: G::Root
//
class GSmtp::FileReader : public G::noncopyable
{
public:
FileReader() ;
~FileReader() ;
private:
G::Root * m_imp ;
} ;
// Class: GSmtp::FileWriter
// Description: Used by GSmtp::FileStore, GSmtp::NewFile and
// GSmtp::StoredFile to claim write permissions.
// See also: G::Root
//
class GSmtp::FileWriter : public G::noncopyable
{
public:
FileWriter() ;
~FileWriter() ;
private:
G::Root * m_imp ;
} ;
#endif #endif

View File

@ -26,9 +26,17 @@
#include "gmessagestore.h" #include "gmessagestore.h"
#include "gpath.h" #include "gpath.h"
#ifndef G_SPOOLDIR
#define G_SPOOLDIR ""
#endif
//static //static
G::Path GSmtp::MessageStore::defaultDirectory() G::Path GSmtp::MessageStore::defaultDirectory()
{ {
return G::Path( "/usr/local/var/spool/emailrelay" ) ; std::string spooldir( G_SPOOLDIR ) ;
if( spooldir.empty() )
spooldir = "/var/spool/emailrelay" ;
return G::Path( spooldir ) ;
} }

View File

@ -124,7 +124,7 @@ bool GSmtp::NewFile::store( const std::string & auth_id , const std::string & cl
// commit the envelope, or rollback the content // commit the envelope, or rollback the content
// //
G::Root claim_root ; FileWriter claim_writer ;
if( ! ok || ! G::File::rename(p0,p1,G::File::NoThrow() ) ) if( ! ok || ! G::File::rename(p0,p1,G::File::NoThrow() ) )
{ {
G_ASSERT( m_content_path.str().length() != 0U ) ; G_ASSERT( m_content_path.str().length() != 0U ) ;
@ -176,10 +176,10 @@ void GSmtp::NewFile::deliver( const G::Strings & /*to*/ ,
// could shell out to "procmail" or "deliver" here, but keep it // could shell out to "procmail" or "deliver" here, but keep it
// simple and within the scope of a "message-store" class // simple and within the scope of a "message-store" class
G_LOG( "GSmtp::NewMessage: copying message for local recipient(s): " G_LOG_S( "GSmtp::NewMessage: copying message for local recipient(s): "
<< content_path.basename() << ".local" ) ; << content_path.basename() << ".local" ) ;
G::Root claim_root ; FileWriter claim_writer ;
G::File::copy( content_path.str() , content_path.str()+".local" ) ; G::File::copy( content_path.str() , content_path.str()+".local" ) ;
G::File::copy( envelope_path_now.str() , envelope_path_later.str()+".local" ) ; G::File::copy( envelope_path_now.str() , envelope_path_later.str()+".local" ) ;
} }

View File

@ -70,8 +70,8 @@ bool GSmtp::ProtocolMessageStore::addTo( const std::string & to , Verifier::Stat
G_ASSERT( m_msg.get() != NULL ) ; G_ASSERT( m_msg.get() != NULL ) ;
if( to.length() > 0U && m_msg.get() != NULL ) if( to.length() > 0U && m_msg.get() != NULL )
{ {
const bool is_local = to_status.first ; const bool is_local = to_status.is_local ;
const bool is_valid = is_local && to_status.second.length() != 0U ; const bool is_valid = is_local && to_status.full_name.length() != 0U ;
if( is_local && !is_valid ) if( is_local && !is_valid )
{ {
G_WARNING( "GSmtp::ProtocolMessage: rejecting local recipent (not postmaster): " << to ) ; G_WARNING( "GSmtp::ProtocolMessage: rejecting local recipent (not postmaster): " << to ) ;
@ -79,7 +79,7 @@ bool GSmtp::ProtocolMessageStore::addTo( const std::string & to , Verifier::Stat
} }
else else
{ {
m_msg->addTo( to , is_local ) ; m_msg->addTo( to_status.address , is_local ) ;
return true ; return true ;
} }
} }

View File

@ -45,6 +45,8 @@ namespace GSmtp
// Class: GSmtp::Sasl // Class: GSmtp::Sasl
// Description: A singleton class representing the SASL library. // Description: A singleton class representing the SASL library.
// The SASL challenge/response concept is described in RFC2222.
// See also: GSmtp::SaslClient, GSmtp::SaslServer, RFC2554, RFC2222
// //
class GSmtp::Sasl class GSmtp::Sasl
{ {

View File

@ -94,7 +94,7 @@ bool GSmtp::SaslServerImp::validate( const std::string & secret , const std::str
G_WARNING( "GSmtp::SaslServer: exception: " << e.what() ) ; G_WARNING( "GSmtp::SaslServer: exception: " << e.what() ) ;
return false ; return false ;
} }
catch( ... ) catch(...)
{ {
G_WARNING( "GSmtp::SaslServer: exception" ) ; G_WARNING( "GSmtp::SaslServer: exception" ) ;
return false ; return false ;

View File

@ -146,9 +146,9 @@ void GSmtp::ServerProtocol::doVrfy( const std::string & line , bool & )
{ {
std::string mbox = parseMailbox( line ) ; std::string mbox = parseMailbox( line ) ;
Verifier::Status rc = m_verifier.verify( mbox ) ; Verifier::Status rc = m_verifier.verify( mbox ) ;
bool local = rc.first ; bool local = rc.is_local ;
if( local && rc.second.length() ) if( local && rc.full_name.length() )
sendVerified( rc.second ) ; sendVerified( rc.full_name ) ;
else if( local ) else if( local )
sendNotVerified( mbox ) ; sendNotVerified( mbox ) ;
else else

View File

@ -157,7 +157,7 @@ bool GSmtp::Client::sendNext()
std::auto_ptr<StoredMessage> message( m_iter.next() ) ; std::auto_ptr<StoredMessage> message( m_iter.next() ) ;
if( message.get() == NULL ) if( message.get() == NULL )
{ {
G_LOG( "GSmtp::Client: no more messages to send" ) ; G_LOG_S( "GSmtp::Client: no more messages to send" ) ;
GNet::Socket * s = m_socket ; GNet::Socket * s = m_socket ;
m_socket = NULL ; m_socket = NULL ;
s->close() ; s->close() ;
@ -231,7 +231,7 @@ void GSmtp::Client::onData( const char * data , size_t size )
void GSmtp::Client::onError( const std::string & error ) void GSmtp::Client::onError( const std::string & error )
{ {
G_WARNING( "GSmtp::Client: error: \"" << error << "\"" ) ; G_WARNING( "GSmtp::Client: smtp client error: \"" << error << "\"" ) ;
doCallback( std::string("error on connection to server: ") + error ) ; doCallback( std::string("error on connection to server: ") + error ) ;
} }

View File

@ -41,7 +41,7 @@ GSmtp::ServerPeer::ServerPeer( GNet::StreamSocket * socket , GNet::Address peer_
m_pmessage( pmessage ) , m_pmessage( pmessage ) ,
m_protocol( *this, m_verifier, *m_pmessage.get(), thishost(), peer_address.displayString(false) ) m_protocol( *this, m_verifier, *m_pmessage.get(), thishost(), peer_address.displayString(false) )
{ {
G_LOG( "GSmtp::ServerPeer: new connection from " << peer_address.displayString() ) ; G_LOG_S( "GSmtp::ServerPeer: new connection from " << peer_address.displayString() ) ;
m_protocol.init( ident ) ; m_protocol.init( ident ) ;
} }
@ -103,7 +103,7 @@ void GSmtp::ServerPeer::protocolSend( const std::string & line )
void GSmtp::ServerPeer::protocolDone() void GSmtp::ServerPeer::protocolDone()
{ {
G_LOG( "GSmtp::ServerPeer: disconnecting" ) ; G_LOG_S( "GSmtp::ServerPeer: disconnecting from " << peerAddress().second.displayString() ) ;
doDelete() ; // onDelete() and "delete this" doDelete() ; // onDelete() and "delete this"
} }
@ -135,6 +135,7 @@ GSmtp::Server::Server( unsigned int port , bool allow_remote , const std::string
void GSmtp::Server::bind( GSmtp::ServerImp & gnet_server , GNet::Address address , unsigned int port ) void GSmtp::Server::bind( GSmtp::ServerImp & gnet_server , GNet::Address address , unsigned int port )
{ {
address.setPort(port) ; address.setPort(port) ;
G_LOG_S( "GSmtp::Server::bind: listening on " << address.displayString() ) ;
gnet_server.init( address ) ; gnet_server.init( address ) ;
} }

View File

@ -26,7 +26,6 @@
#include "gfilestore.h" #include "gfilestore.h"
#include "gstoredfile.h" #include "gstoredfile.h"
#include "gmemory.h" #include "gmemory.h"
#include "groot.h"
#include "gxtext.h" #include "gxtext.h"
#include "gfile.h" #include "gfile.h"
#include "gstr.h" #include "gstr.h"
@ -35,7 +34,9 @@
#include <fstream> #include <fstream>
GSmtp::StoredFile::StoredFile( const G::Path & path ) : GSmtp::StoredFile::StoredFile( const G::Path & path ) :
m_envelope_path(path) m_envelope_path(path) ,
m_eight_bit(false) ,
m_errors(0U)
{ {
G_DEBUG( "StoredFile: \"" << path << "\"" ) ; G_DEBUG( "StoredFile: \"" << path << "\"" ) ;
} }
@ -65,7 +66,7 @@ bool GSmtp::StoredFile::readEnvelope( std::string & reason , bool check )
void GSmtp::StoredFile::readEnvelopeCore( bool check ) void GSmtp::StoredFile::readEnvelopeCore( bool check )
{ {
G::Root claim_root ; FileReader claim_reader ;
std::ifstream stream( m_envelope_path.str().c_str() , std::ios_base::binary | std::ios_base::in ) ; std::ifstream stream( m_envelope_path.str().c_str() , std::ios_base::binary | std::ios_base::in ) ;
if( ! stream.good() ) if( ! stream.good() )
throw OpenError() ; throw OpenError() ;
@ -86,6 +87,8 @@ void GSmtp::StoredFile::readEnvelopeCore( bool check )
if( ! stream.good() ) if( ! stream.good() )
throw StreamError() ; throw StreamError() ;
readReasons( stream ) ;
} }
void GSmtp::StoredFile::readFormat( std::istream & stream ) void GSmtp::StoredFile::readFormat( std::istream & stream )
@ -150,11 +153,22 @@ void GSmtp::StoredFile::readEnd( std::istream & stream )
throw NoEnd() ; throw NoEnd() ;
} }
void GSmtp::StoredFile::readReasons( std::istream & stream )
{
m_errors = 0U ;
while( stream.good() )
{
std::string reason = getline(stream) ;
if( reason.find(FileStore::x()+"Reason") == 0U )
m_errors++ ;
}
}
bool GSmtp::StoredFile::openContent( std::string & reason ) bool GSmtp::StoredFile::openContent( std::string & reason )
{ {
try try
{ {
G::Root claim_root ; FileReader claim_reader ;
G::Path content_path = contentPath() ; G::Path content_path = contentPath() ;
G_DEBUG( "GSmtp::FileStore::openContent: \"" << content_path << "\"" ) ; G_DEBUG( "GSmtp::FileStore::openContent: \"" << content_path << "\"" ) ;
std::auto_ptr<std::istream> stream( new std::ifstream( std::auto_ptr<std::istream> stream( new std::ifstream(
@ -207,7 +221,7 @@ std::string GSmtp::StoredFile::crlf() const
bool GSmtp::StoredFile::lock() bool GSmtp::StoredFile::lock()
{ {
G::Root claim_root ; FileWriter claim_writer ;
G::Path & src = m_envelope_path ; G::Path & src = m_envelope_path ;
G::Path dst( src.str() + ".busy" ) ; G::Path dst( src.str() + ".busy" ) ;
bool ok = G::File::rename( src , dst , G::File::NoThrow() ) ; bool ok = G::File::rename( src , dst , G::File::NoThrow() ) ;
@ -223,7 +237,7 @@ void GSmtp::StoredFile::fail( const std::string & reason )
{ {
try try
{ {
G::Root claim_root ; FileWriter claim_writer ;
// write the reason into the file // write the reason into the file
{ {
@ -235,7 +249,7 @@ void GSmtp::StoredFile::fail( const std::string & reason )
G::Path env_temp( m_envelope_path ) ; // "foo.envelope.busy" G::Path env_temp( m_envelope_path ) ; // "foo.envelope.busy"
env_temp.removeExtension() ; // "foo.envelope" env_temp.removeExtension() ; // "foo.envelope"
G::Path bad( env_temp.str() + ".bad" ) ; // "foo.envelope.bad" G::Path bad( env_temp.str() + ".bad" ) ; // "foo.envelope.bad"
G_LOG( "GSmtp::StoredMessage: failing file: " G_LOG_S( "GSmtp::StoredMessage: failing file: "
<< "\"" << m_envelope_path.basename() << "\" -> " << "\"" << m_envelope_path.basename() << "\" -> "
<< "\"" << bad.basename() << "\"" ) ; << "\"" << bad.basename() << "\"" ) ;
@ -250,7 +264,7 @@ void GSmtp::StoredFile::destroy()
{ {
try try
{ {
G::Root claim_root ; FileWriter claim_writer ;
G_LOG( "GSmtp::StoredMessage: deleting file: \"" << m_envelope_path.basename() << "\"" ) ; G_LOG( "GSmtp::StoredMessage: deleting file: \"" << m_envelope_path.basename() << "\"" ) ;
G::File::remove( m_envelope_path , G::File::NoThrow() ) ; G::File::remove( m_envelope_path , G::File::NoThrow() ) ;
@ -293,7 +307,13 @@ size_t GSmtp::StoredFile::remoteRecipientCount() const
return m_to_remote.size() ; return m_to_remote.size() ;
} }
size_t GSmtp::StoredFile::errorCount() const
{
return m_errors ;
}
std::string GSmtp::StoredFile::authentication() const std::string GSmtp::StoredFile::authentication() const
{ {
return m_authentication ; return m_authentication ;
} }

View File

@ -95,6 +95,9 @@ public:
virtual size_t remoteRecipientCount() const ; virtual size_t remoteRecipientCount() const ;
// From StoredMessage. // From StoredMessage.
virtual size_t errorCount() const ;
// From StoredMessage.
private: private:
StoredFile( const StoredFile & ) ; StoredFile( const StoredFile & ) ;
void operator=( const StoredFile & ) ; void operator=( const StoredFile & ) ;
@ -107,6 +110,7 @@ private:
void readFrom( std::istream & stream ) ; void readFrom( std::istream & stream ) ;
void readToList( std::istream & stream ) ; void readToList( std::istream & stream ) ;
void readEnd( std::istream & stream ) ; void readEnd( std::istream & stream ) ;
void readReasons( std::istream & stream ) ;
void readAuthentication( std::istream & stream ) ; void readAuthentication( std::istream & stream ) ;
void readClientIp( std::istream & stream ) ; void readClientIp( std::istream & stream ) ;
void readEnvelopeCore( bool ) ; void readEnvelopeCore( bool ) ;
@ -121,6 +125,7 @@ private:
std::string m_authentication ; std::string m_authentication ;
std::string m_format ; std::string m_format ;
std::string m_client_ip ; std::string m_client_ip ;
size_t m_errors ;
} ; } ;
#endif #endif

View File

@ -69,6 +69,9 @@ public:
virtual size_t remoteRecipientCount() const = 0 ; virtual size_t remoteRecipientCount() const = 0 ;
// Returns the number of non-local recipients. // Returns the number of non-local recipients.
virtual size_t errorCount() const = 0 ;
// Returns the number of accumulated submission errors.
virtual ~StoredMessage() ; virtual ~StoredMessage() ;
// Destructor. // Destructor.

View File

@ -46,21 +46,21 @@ GSmtp::Verifier::Status GSmtp::Verifier::verify( const std::string & address ) c
G::Str::toUpper( host ) ; G::Str::toUpper( host ) ;
G::Str::toUpper( user ) ; G::Str::toUpper( user ) ;
Status status ;
status.is_local = false ;
status.address = address ;
if( user == "POSTMASTER" && ( host.empty() || host == "LOCALHOST" || host == fqdn ) ) if( user == "POSTMASTER" && ( host.empty() || host == "LOCALHOST" || host == fqdn ) )
{ {
// accept 'postmaster' for local delivery // accept 'postmaster' for local delivery
std::string full_name( "Local postmaster <postmaster@localhost>" ) ; status.is_local = true ;
return std::make_pair( true , full_name ) ; status.full_name = "Local postmaster <postmaster@localhost>" ;
status.address = "postmaster" ;
} }
else if( host.empty() || host == "LOCALHOST" ) else if( host.empty() || host == "LOCALHOST" )
{ {
// reject local addressees // reject local addressees
return std::make_pair( true , std::string() ) ; status.is_local = true ;
}
else
{
// forward
return std::make_pair( false , std::string() ) ;
} }
return status ;
} }

View File

@ -42,17 +42,30 @@ namespace GSmtp
class GSmtp::Verifier class GSmtp::Verifier
{ {
public: public:
typedef std::pair<bool,std::string> Status ; struct Status
{
bool is_local ;
std::string full_name ;
std::string address ;
} ;
std::pair<bool,std::string> verify( const std::string & recipient_address ) const ; Status verify( const std::string & recipient_address ) const ;
// Checks a recipient address returning // Checks a recipient address returning
// <is-local>|<local-full-name>. // a structure which indicates whether the
// address is local, what the full name is,
// and the canonical address.
// //
// If syntactically local then 'first' is // If syntactically local then 'is_local' is
// returned true. If local and valid then // set true. If local and valid then
// 'second' is set to the full description. // 'full_name' is set to the full description
// If syntactically remote, then 'first' // and 'address' is set to the
// is returned false and 'second' is empty. // canonical local address (without an
// at sign).
//
// If syntactically remote, then 'is_local'
// is set false, 'full_name' is empty,
// and 'address' is copied from
// 'recipient_address'.
} ; } ;
#endif #endif

View File

@ -41,7 +41,7 @@ int main( int argc , char * argv [] )
{ {
std::cerr << G::Arg::prefix(argv) << ": exception: " << e.what() << std::endl ; std::cerr << G::Arg::prefix(argv) << ": exception: " << e.what() << std::endl ;
} }
catch( ... ) catch(...)
{ {
std::cerr << G::Arg::prefix(argv) << ": unrecognised exception" << std::endl ; std::cerr << G::Arg::prefix(argv) << ": unrecognised exception" << std::endl ;
} }

View File

@ -38,7 +38,6 @@
#include "gexception.h" #include "gexception.h"
#include "gmemory.h" #include "gmemory.h"
#include "glog.h" #include "glog.h"
#include "glogoutput.h"
#include "gassert.h" #include "gassert.h"
namespace namespace
@ -414,7 +413,6 @@ int WINAPI WinMain( HINSTANCE hinstance , HINSTANCE previous ,
try try
{ {
Run run( app , arg ) ; Run run( app , arg ) ;
G::LogOutput log( run.cfg().log() , run.cfg().verbose() ) ;
if( run.prepare() ) if( run.prepare() )
{ {
const bool visible = ! run.cfg().daemon() ; const bool visible = ! run.cfg().daemon() ;

24
src/main/messages.mc Normal file
View File

@ -0,0 +1,24 @@
MessageIdTypedef=DWORD
MessageId=1001
Severity=Informational
Facility=Application
Language=English
%1!s!
.
MessageId=1002
Severity=Warning
Facility=Application
Language=English
%1!s!
.
MessageId=1003
Severity=Error
Facility=Application
Language=English
%1!s!
.

View File

@ -63,7 +63,7 @@ int main( int argc , char * argv [] )
{ {
std::cerr << arg.prefix() << ": exception: " << e.what() << std::endl ; std::cerr << arg.prefix() << ": exception: " << e.what() << std::endl ;
} }
catch( ... ) catch(...)
{ {
std::cerr << arg.prefix() << ": unknown exception" << std::endl ; std::cerr << arg.prefix() << ": unknown exception" << std::endl ;
} }

102
src/main/passwd.dsp Normal file
View File

@ -0,0 +1,102 @@
# Microsoft Developer Studio Project File - Name="passwd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=passwd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "passwd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "passwd.mak" CFG="passwd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "passwd - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "passwd - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "passwd - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "PasswdRelease"
# PROP Intermediate_Dir "PasswdRelease"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GR /GX /O2 /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "NDEBUG" /D "_CONSOLE" /D "G_WIN32" /D "WIN32" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "passwd - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "PasswdDebug"
# PROP Intermediate_Dir "PasswdDebug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\glib" /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "_DEBUG" /D "G_WIN32" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "passwd - Win32 Release"
# Name "passwd - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\passwd.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -29,6 +29,9 @@
#define IDI_ICON3 106 #define IDI_ICON3 106
#define IDI_ICON4 107 #define IDI_ICON4 107
#define IDC_EDIT1 1000 #define IDC_EDIT1 1000
#define IDS_EVENTLOG_INFORMATION 1001
#define IDS_EVENTLOG_WARNING 1002
#define IDS_EVENTLOG_ERROR 1003
#define IDM_OPEN 40001 #define IDM_OPEN 40001
#define IDM_QUIT 40002 #define IDM_QUIT 40002
#define IDM_CLOSE 40005 #define IDM_CLOSE 40005

33
src/main/run.cpp Normal file → Executable file
View File

@ -48,7 +48,7 @@
//static //static
std::string Main::Run::versionNumber() std::string Main::Run::versionNumber()
{ {
return "0.9.8" ; return "0.9.9" ;
} }
Main::Run::Run( const G::Arg & arg ) : Main::Run::Run( const G::Arg & arg ) :
@ -114,18 +114,39 @@ bool Main::Run::prepare()
do_run = true ; do_run = true ;
} }
// (prefix,output,log,verbose-log,debug,level,timestamp,strip-context)
m_log_output <<= new G::LogOutput( m_arg.prefix() , cfg().log() , cfg().log() ,
cfg().verbose() , cfg().debug() , true ,
cfg().logTimestamp() , !cfg().debug() ) ;
return do_run ; return do_run ;
} }
void Main::Run::run() void Main::Run::run()
{ {
// logging try
{
runCore() ;
G_LOG( "Main::Run::run: done" ) ;
}
catch( std::exception & e )
{
G_LOG( "Main::Run::run: exception: " << e.what() ) ;
throw ;
}
catch(...)
{
G_LOG( "Main::Run::run: unknown exception" ) ;
throw ;
}
}
void Main::Run::runCore()
{
// syslog initialisation
// //
G::LogOutput log( cfg().log() , cfg().verbose() ) ;
if( cfg().syslog() ) if( cfg().syslog() )
log.syslog(G::LogOutput::Mail) ; G::LogOutput::instance()->syslog(G::LogOutput::Mail) ;
if( cfg().logTimestamp() )
log.timestamp() ;
// fqdn override option // fqdn override option
// //

View File

@ -29,6 +29,7 @@
#include "configuration.h" #include "configuration.h"
#include "commandline.h" #include "commandline.h"
#include "geventloop.h" #include "geventloop.h"
#include "glogoutput.h"
#include "gdaemon.h" #include "gdaemon.h"
#include "garg.h" #include "garg.h"
#include "gmessagestore.h" #include "gmessagestore.h"
@ -97,6 +98,7 @@ private:
private: private:
std::auto_ptr<CommandLine> m_cl ; std::auto_ptr<CommandLine> m_cl ;
std::auto_ptr<G::LogOutput> m_log_output ;
G::Arg m_arg ; G::Arg m_arg ;
} ; } ;

View File

@ -35,11 +35,13 @@
#include "gsmtp.h" #include "gsmtp.h"
#include "glocal.h" #include "glocal.h"
#include "gaddress.h" #include "gaddress.h"
#include "geventloop.h"
#include "garg.h" #include "garg.h"
#include "gstrings.h" #include "gstrings.h"
#include "gstr.h" #include "gstr.h"
#include "ggetopt.h" #include "ggetopt.h"
#include "gpath.h" #include "gpath.h"
#include "gverifier.h"
#include "gfilestore.h" #include "gfilestore.h"
#include "gnewmessage.h" #include "gnewmessage.h"
#include "gexception.h" #include "gexception.h"
@ -81,12 +83,13 @@ static void process( const G::Path & path , std::istream & stream ,
// add "To:" lines to the envelope // add "To:" lines to the envelope
// //
GSmtp::Verifier verifier ;
for( G::Strings::const_iterator to_p = to_list.begin() ; to_p != to_list.end() ; ++to_p ) for( G::Strings::const_iterator to_p = to_list.begin() ; to_p != to_list.end() ; ++to_p )
{ {
std::string to = *to_p ; std::string to = *to_p ;
G::Str::trim( to , " \t\r\n" ) ; G::Str::trim( to , " \t\r\n" ) ;
const bool is_local = false ; GSmtp::Verifier::Status status = verifier.verify( to ) ;
msg->addTo( to , is_local ) ; msg->addTo( status.address , status.is_local ) ;
} }
// stream out the header // stream out the header
@ -152,6 +155,9 @@ static void run( const G::Arg & arg )
} }
else else
{ {
std::auto_ptr<GNet::EventLoop> event_loop( GNet::EventLoop::create() ) ;
event_loop->init() ;
G::Path path = GSmtp::MessageStore::defaultDirectory() ; G::Path path = GSmtp::MessageStore::defaultDirectory() ;
if( getopt.contains("spool-dir") ) if( getopt.contains("spool-dir") )
path = getopt.value("spool-dir") ; path = getopt.value("spool-dir") ;

102
src/main/submit.dsp Normal file
View File

@ -0,0 +1,102 @@
# Microsoft Developer Studio Project File - Name="submit" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=submit - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "submit.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "submit.mak" CFG="submit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "submit - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "submit - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "submit - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "SubmitRelease"
# PROP Intermediate_Dir "SubmitRelease"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GR /GX /O2 /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "NDEBUG" /D "_CONSOLE" /D "G_WIN32" /D "WIN32" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "submit - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "SubmitDebug"
# PROP Intermediate_Dir "SubmitDebug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\glib" /I "../../lib/msvc6.0" /I "../gnet" /I "../glib" /I "../win32" /D "_DEBUG" /D "G_WIN32" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "submit - Win32 Release"
# Name "submit - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\submit.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -16,7 +16,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
EXTRA_DIST = \ EXTRA_DIST = \
gappinst.cpp \ gappinst.cpp \

View File

@ -28,7 +28,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# #
# ===
SHELL = @SHELL@ SHELL = @SHELL@
@ -81,6 +80,7 @@ AR = @AR@
AWK = @AWK@ AWK = @AWK@
CC = @CC@ CC = @CC@
CXX = @CXX@ CXX = @CXX@
GZIP = @GZIP@
HAVE_DOXYGEN = @HAVE_DOXYGEN@ HAVE_DOXYGEN = @HAVE_DOXYGEN@
HAVE_MAN2HTML = @HAVE_MAN2HTML@ HAVE_MAN2HTML = @HAVE_MAN2HTML@
MAKE = @MAKE@ MAKE = @MAKE@
@ -88,6 +88,13 @@ MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
VERSION = @VERSION@ VERSION = @VERSION@
e_docdir = @e_docdir@
e_examplesdir = @e_examplesdir@
e_initdir = @e_initdir@
e_libexecdir = @e_libexecdir@
e_man1dir = @e_man1dir@
e_sbindir = @e_sbindir@
e_spooldir = @e_spooldir@
EXTRA_DIST = gappinst.cpp gappinst.h gappbase.cpp gappbase.h gcracker.cpp gcracker.h gdialog.cpp gdialog.h gcontrol.cpp gcontrol.h gpump.cpp gpump.h gpump_dialog.cpp gscmap.h gscmap.cpp gsize.h gtray.h gtray.cpp gwinbase.cpp gwinbase.h gwindow.cpp gwindow.h gwinhid.cpp gwinhid.h EXTRA_DIST = gappinst.cpp gappinst.h gappbase.cpp gappbase.h gcracker.cpp gcracker.h gdialog.cpp gdialog.h gcontrol.cpp gcontrol.h gpump.cpp gpump.h gpump_dialog.cpp gscmap.h gscmap.cpp gsize.h gtray.h gtray.cpp gwinbase.cpp gwinbase.h gwindow.cpp gwindow.h gwinhid.cpp gwinhid.h
@ -103,7 +110,7 @@ TAR = tar
GZIP_ENV = --best GZIP_ENV = --best
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/win32/Makefile cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/win32/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status