├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.md ├── README.rst ├── VERSION ├── aclocal.m4 ├── autogen.sh ├── bin ├── Makefile.am ├── Makefile.in ├── emailrelay-bcc-check.pl ├── emailrelay-check-ipaddress.js ├── emailrelay-check-ipaddress.pl ├── emailrelay-dkim-signer.pl ├── emailrelay-edit-content.js ├── emailrelay-edit-envelope.js ├── emailrelay-ldap-verify.py ├── emailrelay-multicast.sh ├── emailrelay-notify.sh.in ├── emailrelay-resubmit.js ├── emailrelay-resubmit.sh.in ├── emailrelay-rot13.pl ├── emailrelay-sendmail.pl ├── emailrelay-service-install.js ├── emailrelay-set-from.js ├── emailrelay-set-from.pl ├── emailrelay-set-message-id.js ├── emailrelay-submit.sh.in └── emailrelay.sh.in ├── bootstrap ├── bsd ├── Makefile.am ├── Makefile.in └── emailrelay-bsd.sh.in ├── compile ├── configure ├── configure.ac ├── configure.sh ├── debian ├── Makefile.am ├── Makefile.in ├── changelog ├── conffiles ├── control ├── copyright ├── emailrelay.default ├── emailrelay.init ├── emailrelay.pam ├── emailrelay.service ├── postinst ├── postrm ├── preinst ├── prerm └── rules ├── depcomp ├── doc ├── .readthedocs.yaml ├── Makefile.am ├── Makefile.in ├── authentication.png ├── authentication.svg ├── changelog.html ├── changelog.md ├── changelog.rst ├── changelog.txt ├── conf.py ├── developer.html ├── developer.md ├── developer.rst ├── developer.txt ├── download-button.png ├── doxygen-missing.html ├── doxygen.cfg.in ├── emailrelay-doxygen.css ├── emailrelay-man.html ├── emailrelay-passwd.1 ├── emailrelay-submit.1 ├── emailrelay.1 ├── emailrelay.css ├── forwardto.png ├── forwardto.svg ├── index.html ├── index.rst ├── mailserver.png ├── mailserver.svg ├── man2html-missing.html ├── popbyname.png ├── popbyname.svg ├── readme.html ├── readme.md ├── readme.rst ├── readme.txt ├── reference.html ├── reference.md ├── reference.rst ├── reference.txt ├── serverclient.png ├── serverclient.svg ├── userguide.html ├── userguide.md ├── userguide.rst ├── userguide.txt ├── whatisit.png ├── whatisit.svg ├── windows.html ├── windows.md ├── windows.rst └── windows.txt ├── emailrelay.spec ├── etc ├── Makefile.am ├── Makefile.in ├── emailrelay-fail2ban-filter ├── emailrelay-fail2ban-jail ├── emailrelay.auth.in ├── emailrelay.cfg.in ├── emailrelay.conf.in ├── emailrelay.pam └── emailrelay.service.in ├── install-sh ├── libexec ├── AutoMakeParser.pm ├── BuildInfo.pm ├── CompilationDatabase.pm ├── ConfigStatus.pm ├── Functions.pm ├── Makefile.am ├── Makefile.in ├── Reduce.pm ├── doxygen.sh ├── libresslbuild.mak ├── libresslbuild.pl ├── make-format ├── make-manifest.sh ├── make-setup.sh ├── make-website ├── make2cdb ├── make2cmake ├── make2nmake ├── make2qmake ├── make2unity ├── mbedtlsbuild.pl ├── qtbuild.pl ├── reduce ├── reduce.pl ├── winbuild.pm └── winbuildall.bat ├── m4 ├── Makefile.am ├── Makefile.in ├── acinclude.m4 ├── m4_ax_cxx_compile_stdcxx.m4 ├── m4_ax_require_defined.m4 └── pkg.m4 ├── missing ├── po ├── Makefile.am ├── Makefile.in ├── Makevars └── POTFILES.in ├── runperl.bat ├── src ├── .clang-format ├── .clang-tidy ├── Makefile.am ├── Makefile.in ├── gauth │ ├── Makefile.am │ ├── Makefile.in │ ├── gcram.cpp │ ├── gcram.h │ ├── gsaslclient.cpp │ ├── gsaslclient.h │ ├── gsaslclientsecrets.cpp │ ├── gsaslclientsecrets.h │ ├── gsaslserver.cpp │ ├── gsaslserver.h │ ├── gsaslserverbasic.cpp │ ├── gsaslserverbasic.h │ ├── gsaslserverfactory.h │ ├── gsaslserverfactory_basic.cpp │ ├── gsaslserverfactory_pam.cpp │ ├── gsaslserverpam.cpp │ ├── gsaslserverpam.h │ ├── gsaslserversecrets.cpp │ ├── gsaslserversecrets.h │ ├── gsecret.cpp │ ├── gsecret.h │ ├── gsecrets.cpp │ ├── gsecrets.h │ ├── gsecretsfile.cpp │ └── gsecretsfile.h ├── gconfig_defs.h.in ├── gfilters │ ├── Makefile.am │ ├── Makefile.in │ ├── gcopyfilter.cpp │ ├── gcopyfilter.h │ ├── gdeliveryfilter.cpp │ ├── gdeliveryfilter.h │ ├── gexecutablefilter.cpp │ ├── gexecutablefilter.h │ ├── gfilterchain.cpp │ ├── gfilterchain.h │ ├── gfilterfactory.cpp │ ├── gfilterfactory.h │ ├── gmessageidfilter.cpp │ ├── gmessageidfilter.h │ ├── gmxfilter.cpp │ ├── gmxfilter.h │ ├── gmxlookup.cpp │ ├── gmxlookup.h │ ├── gnetworkfilter.cpp │ ├── gnetworkfilter.h │ ├── gnullfilter.cpp │ ├── gnullfilter.h │ ├── gsimplefilterbase.cpp │ ├── gsimplefilterbase.h │ ├── gspamfilter.cpp │ ├── gspamfilter.h │ ├── gsplitfilter.cpp │ └── gsplitfilter.h ├── glib │ ├── Makefile.am │ ├── Makefile.in │ ├── garg.cpp │ ├── garg.h │ ├── gassert.h │ ├── gbase64.cpp │ ├── gbase64.h │ ├── gbasicaddress.h │ ├── gbatchfile.cpp │ ├── gbatchfile.h │ ├── gbuffer.h │ ├── gcall.h │ ├── gcleanup.h │ ├── gcleanup_unix.cpp │ ├── gcleanup_win32.cpp │ ├── gcodepage.cpp │ ├── gcodepage.h │ ├── gconvert.cpp │ ├── gconvert.h │ ├── gdaemon.h │ ├── gdaemon_unix.cpp │ ├── gdaemon_win32.cpp │ ├── gdate.cpp │ ├── gdate.h │ ├── gdatetime.cpp │ ├── gdatetime.h │ ├── gdef.h │ ├── gdirectory.cpp │ ├── gdirectory.h │ ├── gdirectory_unix.cpp │ ├── gdirectory_win32.cpp │ ├── genvironment.cpp │ ├── genvironment.h │ ├── genvironment_unix.cpp │ ├── genvironment_win32.cpp │ ├── gexception.cpp │ ├── gexception.h │ ├── gexecutablecommand.cpp │ ├── gexecutablecommand.h │ ├── gfbuf.h │ ├── gfile.cpp │ ├── gfile.h │ ├── gfile_unix.cpp │ ├── gfile_win32.cpp │ ├── gformat.cpp │ ├── gformat.h │ ├── ggetopt.cpp │ ├── ggetopt.h │ ├── ggettext.h │ ├── ggettext_none.cpp │ ├── ggettext_unix.cpp │ ├── ggettext_win32.cpp │ ├── ghash.cpp │ ├── ghash.h │ ├── ghashstate.h │ ├── ghostname.h │ ├── ghostname_unix.cpp │ ├── ghostname_win32.cpp │ ├── gidentity.h │ ├── gidentity_unix.cpp │ ├── gidentity_win32.cpp │ ├── gidn.cpp │ ├── gidn.h │ ├── gimembuf.h │ ├── glimits.h │ ├── glog.cpp │ ├── glog.h │ ├── glogoutput.cpp │ ├── glogoutput.h │ ├── glogoutput_unix.cpp │ ├── glogoutput_win32.cpp │ ├── glogstream.cpp │ ├── glogstream.h │ ├── gmapfile.cpp │ ├── gmapfile.h │ ├── gmd5.cpp │ ├── gmd5.h │ ├── gmsg.h │ ├── gmsg_mac.cpp │ ├── gmsg_unix.cpp │ ├── gmsg_win32.cpp │ ├── gnewprocess.h │ ├── gnewprocess_unix.cpp │ ├── gnewprocess_win32.cpp │ ├── gnowide.h │ ├── gomembuf.h │ ├── goption.cpp │ ├── goption.h │ ├── goptional.h │ ├── goptionmap.cpp │ ├── goptionmap.h │ ├── goptionparser.cpp │ ├── goptionparser.h │ ├── goptionreader.cpp │ ├── goptionreader.h │ ├── goptions.cpp │ ├── goptions.h │ ├── goptionsusage.cpp │ ├── goptionsusage.h │ ├── goptionvalue.h │ ├── gpam.h │ ├── gpam_linux.cpp │ ├── gpam_none.cpp │ ├── gpath.cpp │ ├── gpath.h │ ├── gpidfile.cpp │ ├── gpidfile.h │ ├── gprocess.h │ ├── gprocess_unix.cpp │ ├── gprocess_win32.cpp │ ├── grandom.cpp │ ├── grandom.h │ ├── grange.h │ ├── greadwrite.cpp │ ├── greadwrite.h │ ├── groot.cpp │ ├── groot.h │ ├── gscope.h │ ├── gsignalsafe.h │ ├── gsleep.h │ ├── gslot.cpp │ ├── gslot.h │ ├── gstatemachine.cpp │ ├── gstatemachine.h │ ├── gstr.cpp │ ├── gstr.h │ ├── gstringarray.h │ ├── gstringfield.h │ ├── gstringlist.cpp │ ├── gstringlist.h │ ├── gstringmap.h │ ├── gstringtoken.h │ ├── gstringview.cpp │ ├── gstringview.h │ ├── gstringwrap.cpp │ ├── gstringwrap.h │ ├── gstrmacros.h │ ├── gtest.cpp │ ├── gtest.h │ ├── gthread.cpp │ ├── gtime.cpp │ ├── gtime.h │ ├── gxtext.cpp │ └── gxtext.h ├── gnet │ ├── Makefile.am │ ├── Makefile.in │ ├── gaddress.cpp │ ├── gaddress.h │ ├── gaddress4.cpp │ ├── gaddress4.h │ ├── gaddress6.cpp │ ├── gaddress6.h │ ├── gaddresslocal.h │ ├── gaddresslocal_none.cpp │ ├── gaddresslocal_unix.cpp │ ├── gclient.cpp │ ├── gclient.h │ ├── gclientptr.cpp │ ├── gclientptr.h │ ├── gconnection.cpp │ ├── gconnection.h │ ├── gdescriptor.h │ ├── gdescriptor_unix.cpp │ ├── gdescriptor_win32.cpp │ ├── gdnsbl.h │ ├── gdnsbl_disabled.cpp │ ├── gdnsbl_enabled.cpp │ ├── gdnsblock.cpp │ ├── gdnsblock.h │ ├── gdnsmessage.cpp │ ├── gdnsmessage.h │ ├── gevent.h │ ├── geventemitter.cpp │ ├── geventemitter.h │ ├── geventhandler.cpp │ ├── geventhandler.h │ ├── geventlogging.cpp │ ├── geventlogging.h │ ├── geventloggingcontext.cpp │ ├── geventloggingcontext.h │ ├── geventloop.cpp │ ├── geventloop.h │ ├── geventloop_epoll.cpp │ ├── geventloop_select.cpp │ ├── geventloop_win32.cpp │ ├── geventloophandles.cpp │ ├── geventloophandles.h │ ├── geventstate.cpp │ ├── geventstate.h │ ├── gexceptionhandler.cpp │ ├── gexceptionhandler.h │ ├── gexceptionsource.cpp │ ├── gexceptionsource.h │ ├── gfutureevent.h │ ├── gfutureevent_unix.cpp │ ├── gfutureevent_win32.cpp │ ├── ggetaddrinfo.h │ ├── ginterfaces.h │ ├── ginterfaces_common.cpp │ ├── ginterfaces_none.cpp │ ├── ginterfaces_unix.cpp │ ├── ginterfaces_win32.cpp │ ├── glinebuffer.cpp │ ├── glinebuffer.h │ ├── glinestore.cpp │ ├── glinestore.h │ ├── glistener.h │ ├── glisteners.cpp │ ├── glisteners.h │ ├── glocal.h │ ├── glocal_unix.cpp │ ├── glocal_win32.cpp │ ├── glocation.cpp │ ├── glocation.h │ ├── gmonitor.cpp │ ├── gmonitor.h │ ├── gmultiserver.cpp │ ├── gmultiserver.h │ ├── gnameservers.h │ ├── gnameservers_unix.cpp │ ├── gnameservers_win32.cpp │ ├── gnetdone.cpp │ ├── gnetdone.h │ ├── gresolver.cpp │ ├── gresolver.h │ ├── gresolverfuture.cpp │ ├── gresolverfuture.h │ ├── gserver.cpp │ ├── gserver.h │ ├── gserverpeer.cpp │ ├── gserverpeer.h │ ├── gsocket.cpp │ ├── gsocket.h │ ├── gsocket_unix.cpp │ ├── gsocket_win32.cpp │ ├── gsocketprotocol.cpp │ ├── gsocketprotocol.h │ ├── gsocks.cpp │ ├── gsocks.h │ ├── gtask.cpp │ ├── gtask.h │ ├── gtimer.cpp │ ├── gtimer.h │ ├── gtimerlist.cpp │ └── gtimerlist.h ├── gpop │ ├── Makefile.am │ ├── Makefile.in │ ├── gpop.h │ ├── gpop_disabled.cpp │ ├── gpop_enabled.cpp │ ├── gpopserver.cpp │ ├── gpopserver.h │ ├── gpopserverprotocol.cpp │ ├── gpopserverprotocol.h │ ├── gpopstore.cpp │ └── gpopstore.h ├── gsmtp │ ├── Makefile.am │ ├── Makefile.in │ ├── gadminserver.h │ ├── gadminserver_disabled.cpp │ ├── gadminserver_enabled.cpp │ ├── gfilter.cpp │ ├── gfilter.h │ ├── gfilterfactorybase.cpp │ ├── gfilterfactorybase.h │ ├── gprotocolmessage.cpp │ ├── gprotocolmessage.h │ ├── gprotocolmessageforward.cpp │ ├── gprotocolmessageforward.h │ ├── gprotocolmessagestore.cpp │ ├── gprotocolmessagestore.h │ ├── grequestclient.cpp │ ├── grequestclient.h │ ├── gsmtpclient.cpp │ ├── gsmtpclient.h │ ├── gsmtpclientprotocol.cpp │ ├── gsmtpclientprotocol.h │ ├── gsmtpclientreply.cpp │ ├── gsmtpclientreply.h │ ├── gsmtpforward.cpp │ ├── gsmtpforward.h │ ├── gsmtpserver.cpp │ ├── gsmtpserver.h │ ├── gsmtpserverbufferin.cpp │ ├── gsmtpserverbufferin.h │ ├── gsmtpserverflowcontrol.h │ ├── gsmtpserverparser.cpp │ ├── gsmtpserverparser.h │ ├── gsmtpserverprotocol.cpp │ ├── gsmtpserverprotocol.h │ ├── gsmtpserversend.cpp │ ├── gsmtpserversend.h │ ├── gsmtpserversender.h │ ├── gsmtpservertext.cpp │ ├── gsmtpservertext.h │ ├── gspamclient.cpp │ ├── gspamclient.h │ ├── gverifier.cpp │ ├── gverifier.h │ ├── gverifierfactorybase.cpp │ ├── gverifierfactorybase.h │ ├── gverifierstatus.cpp │ └── gverifierstatus.h ├── gssl │ ├── Makefile.am │ ├── Makefile.in │ ├── empty.cpp │ ├── gssl.cpp │ ├── gssl.h │ ├── gssl_mbedtls.cpp │ ├── gssl_mbedtls.h │ ├── gssl_mbedtls_headers.h │ ├── gssl_mbedtls_keygen.cpp │ ├── gssl_mbedtls_keygen.h │ ├── gssl_mbedtls_utils.h │ ├── gssl_none.cpp │ ├── gssl_openssl.cpp │ ├── gssl_openssl.h │ ├── gssl_use_both.cpp │ ├── gssl_use_mbedtls.cpp │ ├── gssl_use_openssl.cpp │ ├── mbedtls-vsnprintf-fix-new.p1 │ └── mbedtls-vsnprintf-fix.p1 ├── gstore │ ├── Makefile.am │ ├── Makefile.in │ ├── genvelope.cpp │ ├── genvelope.h │ ├── gfiledelivery.cpp │ ├── gfiledelivery.h │ ├── gfilestore.cpp │ ├── gfilestore.h │ ├── gfilestore_unix.cpp │ ├── gfilestore_win32.cpp │ ├── gmessagedelivery.cpp │ ├── gmessagedelivery.h │ ├── gmessagestore.cpp │ ├── gmessagestore.h │ ├── gnewfile.cpp │ ├── gnewfile.h │ ├── gnewmessage.cpp │ ├── gnewmessage.h │ ├── gstoredfile.cpp │ ├── gstoredfile.h │ ├── gstoredmessage.cpp │ └── gstoredmessage.h ├── gui │ ├── Makefile.am │ ├── Makefile.in │ ├── emailrelay-gui.exe.manifest │ ├── emailrelay-gui.rc │ ├── emailrelay.no.qm │ ├── emailrelay_tr.no_NO.ts │ ├── gcominit.h │ ├── glibsources.cpp │ ├── gqt.h │ ├── guiaccess.h │ ├── guiaccess_mac.cpp │ ├── guiaccess_unix.cpp │ ├── guiaccess_win32.cpp │ ├── guiboot.h │ ├── guiboot_mac.cpp │ ├── guiboot_unix.cpp │ ├── guiboot_win32.cpp │ ├── guidialog.cpp │ ├── guidialog.h │ ├── guidir.cpp │ ├── guidir.h │ ├── guidir_mac.cpp │ ├── guidir_unix.cpp │ ├── guidir_win32.cpp │ ├── guilegal.cpp │ ├── guilegal.h │ ├── guilink.h │ ├── guilink_mac.cpp │ ├── guilink_unix.cpp │ ├── guilink_win32.cpp │ ├── guimain.cpp │ ├── guipage.cpp │ ├── guipage.h │ ├── guipages.cpp │ ├── guipages.h │ ├── installer.cpp │ ├── installer.h │ ├── messages.mc │ ├── serverconfiguration.cpp │ └── serverconfiguration.h ├── gverifiers │ ├── Makefile.am │ ├── Makefile.in │ ├── gexecutableverifier.cpp │ ├── gexecutableverifier.h │ ├── ginternalverifier.cpp │ ├── ginternalverifier.h │ ├── gnetworkverifier.cpp │ ├── gnetworkverifier.h │ ├── guserverifier.cpp │ ├── guserverifier.h │ ├── gverifierfactory.cpp │ └── gverifierfactory.h ├── main │ ├── Makefile.am │ ├── Makefile.in │ ├── commandline.cpp │ ├── commandline.h │ ├── configuration.cpp │ ├── configuration.h │ ├── doxygen.h │ ├── emailrelay-service.exe.manifest │ ├── emailrelay.exe.manifest │ ├── emailrelay.rc │ ├── fakemc.c │ ├── icon │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── emailrelay-icon-small.png │ │ ├── emailrelay-icon.ico │ │ └── emailrelay-icon.png │ ├── keygen.cpp │ ├── legal.cpp │ ├── legal.h │ ├── licence.cpp │ ├── licence.h │ ├── main.cpp │ ├── messages.mc │ ├── news.cpp │ ├── news.h │ ├── options.cpp │ ├── options.h │ ├── output.cpp │ ├── output.h │ ├── passwd.cpp │ ├── resource.h │ ├── run.cpp │ ├── run.h │ ├── servicecontrol.h │ ├── servicecontrol_unix.cpp │ ├── servicecontrol_win32.cpp │ ├── serviceimp.h │ ├── serviceimp_none.cpp │ ├── serviceimp_win32.cpp │ ├── servicewrapper.cpp │ ├── start.cpp │ ├── submission.cpp │ ├── submission.h │ ├── submit.cpp │ ├── submitparser.cpp │ ├── submitparser.h │ ├── unit.cpp │ ├── unit.h │ ├── winapp.cpp │ ├── winapp.h │ ├── winform.cpp │ ├── winform.h │ ├── winmain.cpp │ ├── winmenu.cpp │ └── winmenu.h └── win32 │ ├── Makefile.am │ ├── Makefile.in │ ├── empty.cpp │ ├── gappbase.cpp │ ├── gappbase.h │ ├── gappinst.cpp │ ├── gappinst.h │ ├── gcontrol.cpp │ ├── gcontrol.h │ ├── gcracker.cpp │ ├── gcracker.h │ ├── gdc.cpp │ ├── gdc.h │ ├── gdialog.cpp │ ├── gdialog.h │ ├── gpump.cpp │ ├── gpump.h │ ├── gscmap.cpp │ ├── gscmap.h │ ├── gsize.h │ ├── gstack.cpp │ ├── gstack.h │ ├── gtray.cpp │ ├── gtray.h │ ├── gwinbase.cpp │ ├── gwinbase.h │ ├── gwindow.cpp │ └── gwindow.h ├── test-driver ├── test ├── AdminClient.pm ├── Check.pm ├── DnsServer.pm ├── Filter.pm ├── Helper.pm ├── Makefile.am ├── Makefile.in ├── NetClient.pm ├── Openssl.pm ├── OpensslCast.pm ├── OpensslFileStore.pm ├── OpensslRun.pm ├── PopClient.pm ├── Scanner.pm ├── Server.pm ├── SmtpClient.pm ├── System.pm ├── TestClient.pm ├── TestServer.pm ├── Verifier.pm ├── certificates │ ├── Makefile.am │ ├── Makefile.in │ ├── alice.crt │ ├── alice.key │ ├── bob.crt │ ├── bob.key │ ├── carol.crt │ ├── carol.key │ ├── dave.crt │ ├── dave.key │ ├── malory.crt │ ├── malory.key │ ├── trent.crt │ ├── trent.key │ ├── trudy.crt │ └── trudy.key ├── emailrelay_chain_test.sh ├── emailrelay_test.pl ├── emailrelay_test.sh ├── emailrelay_test_client.cpp ├── emailrelay_test_dnsserver.cpp ├── emailrelay_test_scanner.cpp ├── emailrelay_test_server.cpp └── emailrelay_test_verifier.cpp ├── unity ├── Makefile.am └── Makefile.in ├── winbuild.bat └── winbuild.pl /AUTHORS: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | ======= 3 | 4 | Source files 5 | ------------ 6 | * Graeme Walker 7 | 8 | except where stated otherwise 9 | 10 | Binary distributions 11 | -------------------- 12 | Binary distributions of E-MailRelay might include copyrighted code from: 13 | * OpenSSL Toolkit (http://www.openssl.org) 14 | * mbedTLS (http://tls.mbed.org) 15 | * Qt (http://qt.io) 16 | * Microsoft (http://microsoft.com) 17 | * Free Software Foundation (fsf.org) 18 | 19 | These parts are distributed under license; please refer to their 20 | websites for further details. 21 | 22 | This product includes software developed by the OpenSSL Project 23 | for use in the OpenSSL Toolkit (http://www.openssl.org/). 24 | 25 | Translations 26 | ------------ 27 | Thanks to Per-Arne Christensen for the Norwegian translation of 28 | the GUI. 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Licenses 2 | ======== 3 | The GPLv3 license (GPL-3.0-or-later) is used for E-MailRelay source code 4 | (see COPYING), except for a few files using the GNU All-permissive 5 | license (FSFAP). 6 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 2.6 2 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # autogen.sh 4 | # 5 | # Autogenerates stuff. 6 | # 7 | aclocal -I . 8 | autoconf 9 | autoheader 10 | automake -ac -Woverride -Wportability 11 | -------------------------------------------------------------------------------- /bin/emailrelay-check-ipaddress.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // Copying and distribution of this file, with or without modification, 5 | // are permitted in any medium without royalty provided the copyright 6 | // notice and this notice are preserved. This file is offered as-is, 7 | // without any warranty. 8 | // === 9 | // 10 | // emailrelay-check-ipaddress.js 11 | // 12 | // An example "--filter" script for Windows that verifies the submitting 13 | // client's IP address. The IP address is read from the envelope file. 14 | // Invalid IP addresses are rejected by deleting the two message files and 15 | // exiting with the special exit code of 100. Note that this checks the 16 | // IP address very late in the submission process; a firewall or DNSBL check 17 | // might work better. 18 | // 19 | try 20 | { 21 | var content = WScript.Arguments(0) ; 22 | var envelope = WScript.Arguments(1) ; 23 | var fs = WScript.CreateObject( "Scripting.FileSystemObject" ) ; 24 | var ts = fs.OpenTextFile( envelope , 1 , false ) ; 25 | var txt = ts.ReadAll() ; 26 | ts.Close() ; 27 | var re = new RegExp( "X-MailRelay-Client: (\\S*)" , "m" ) ; 28 | var ip = txt.match(re)[1] ; 29 | var ok = ip === "1.1.1.1" ; /// edit here 30 | if( ok ) 31 | { 32 | WScript.Quit( 0 ) ; 33 | } 34 | else 35 | { 36 | WScript.StdOut.WriteLine( "<>" ) ; 37 | fs.DeleteFile( envelope ) ; 38 | fs.DeleteFile( content ) ; 39 | WScript.Quit( 100 ) ; 40 | } 41 | } 42 | catch( e ) 43 | { 44 | // report errors using the special <<...>> markers 45 | WScript.StdOut.WriteLine( "<>" ) ; 46 | WScript.StdOut.WriteLine( "<<" + e + ">>" ) ; 47 | WScript.Quit( 1 ) ; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /bin/emailrelay-check-ipaddress.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. This file is offered as-is, 8 | # without any warranty. 9 | # === 10 | # 11 | # emailrelay-check-ipaddress.pl 12 | # 13 | # An example "--filter" script that verifies the submitting client's IP 14 | # address. The IP address is read from the envelope file. Invalid IP 15 | # addresses are rejected by deleting the two message files and exiting 16 | # with the special exit code of 100. Note that this checks the IP 17 | # address very late in the submission process; a firewall or DNSBL 18 | # check might work better. 19 | # 20 | 21 | use strict ; 22 | use warnings ; 23 | use FileHandle ; 24 | $SIG{__DIE__} = sub { (my $e = join(" ",@_)) =~ s/\n/ /g ; print "<>\n<>\n" ; exit 99 } ; 25 | 26 | my %allow = ( 27 | "127.0.0.1" => 1 , 28 | "1.1.1.1" => 1 , 29 | # etc 30 | ) ; 31 | 32 | my $content = $ARGV[0] or die "usage error\n" ; 33 | my $envelope = $ARGV[1] or die "usage error\n" ; 34 | my $fh = new FileHandle( $envelope ) or die "cannot open envelope file: $!\n" ; 35 | my $txt ; 36 | { 37 | local $/ = undef ; 38 | $txt = <$fh> ; 39 | } 40 | my ( $ip ) = ( $txt =~ m/X-MailRelay-Client: (\S*)/m ) ; 41 | if( $allow{$ip} ) 42 | { 43 | exit( 0 ) ; 44 | } 45 | else 46 | { 47 | print "<>\n<>\n" ; 48 | unlink( $content ) ; 49 | unlink( $envelope ) ; 50 | exit( 100 ) ; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /bin/emailrelay-edit-content.js: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // Copying and distribution of this file, with or without modification, 5 | // are permitted in any medium without royalty provided the copyright 6 | // notice and this notice are preserved. This file is offered as-is, 7 | // without any warranty. 8 | // === 9 | // 10 | // emailrelay-edit-content.js 11 | // 12 | // An example "--filter" script for Windows that edits the message's content 13 | // file. 14 | // 15 | // In this example every "teh" is changed to "the". 16 | // 17 | try 18 | { 19 | // parse the command-line to get the content filename 20 | var content = WScript.Arguments(0) ; 21 | 22 | // open the content file 23 | var fs = WScript.CreateObject( "Scripting.FileSystemObject" ) ; 24 | var in_ = fs.OpenTextFile( content , 1 , false ) ; 25 | 26 | // create the new content file 27 | var out_ = fs.OpenTextFile( content + ".tmp" , 8 , true ) ; 28 | 29 | // read the headers 30 | while( !in_.AtEndOfStream ) 31 | { 32 | var line = in_.ReadLine() ; 33 | out_.WriteLine( line ) ; 34 | if( line === "" ) 35 | break ; 36 | } 37 | 38 | // read and edit the body 39 | var re = new RegExp( "\\bteh\\b" , "gi" ) ; 40 | while( !in_.AtEndOfStream ) 41 | { 42 | var line = in_.ReadLine() ; 43 | line = line.replace( re , "the" ) ; 44 | out_.WriteLine( line ) ; 45 | } 46 | 47 | // replace the content file 48 | in_.Close() ; 49 | out_.Close() ; 50 | fs.DeleteFile( content ) ; 51 | fs.MoveFile( content + ".tmp" , content ) ; 52 | 53 | // successful exit 54 | WScript.Quit( 0 ) ; 55 | } 56 | catch( e ) 57 | { 58 | // report errors using the special <<...>> markers 59 | WScript.StdOut.WriteLine( "<>" ) ; 60 | WScript.StdOut.WriteLine( "<<" + e + ">>" ) ; 61 | WScript.Quit( 1 ) ; 62 | } 63 | -------------------------------------------------------------------------------- /bin/emailrelay-resubmit.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. This file is offered as-is, 8 | # without any warranty. 9 | # === 10 | # 11 | # emailrelay-resubmit.sh 12 | # 13 | # Looks for all failed e-mails in the E-MailRelay spool directory and resubmits 14 | # them. However, if an e-mail has been retried five times already then it is not 15 | # resubmitted again. 16 | # 17 | # usage: emailrelay-resubmit.sh [] 18 | # 19 | # See also emailrelay-resubmit.js for Windows. 20 | # 21 | 22 | store="__SPOOL_DIR__" 23 | retry_limit="5" 24 | 25 | # parse the command line 26 | # 27 | if test $# -ge 1 28 | then 29 | store="$1" 30 | fi 31 | 32 | # check the spool directory is valid 33 | # 34 | if test \! -d "$store" 35 | then 36 | echo `basename $0`: invalid spool directory >&2 37 | exit 1 38 | fi 39 | 40 | # for each failed e-mail... 41 | # 42 | ls -1 "$store/emailrelay.*.envelope.bad" | while read file 43 | do 44 | if test -f "$file" 45 | then 46 | failures="`fgrep MailRelay-Reason: < \"${file}\" | wc -l`" 47 | if test "$failures" -lt "$retry_limit" 48 | then 49 | good_file="`echo \"${file}\" | sed 's/\.bad$//'`" 50 | mv -f "$file" "$good_file" 51 | fi 52 | fi 53 | done 54 | 55 | -------------------------------------------------------------------------------- /bin/emailrelay-sendmail.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. This file is offered as-is, 8 | # without any warranty. 9 | # === 10 | # 11 | # emailrelay-sendmail.pl 12 | # 13 | # A sendmail/emailrelay shim. Typically installed as /usr/sbin/sendmail or 14 | # /usr/lib/sendmail. 15 | # 16 | 17 | use strict ; 18 | use FileHandle ; 19 | use Getopt::Std ; 20 | 21 | my $exe = "/usr/sbin/emailrelay-submit" ; 22 | my $usage = "usage: emailrelay-sendmail [-intUv] [-ABbCDdFfGhiLNnOopqRrtUVvX ] [-f ] [ ...]" ; 23 | 24 | # parse and mostly ignore sendmail command-line options 25 | my %opt = () ; 26 | $Getopt::Std::STANDARD_HELP_VERSION = 1 ; 27 | sub HELP_MESSAGE() { print "$usage\n" } 28 | sub VERSION_MESSAGE() {} 29 | getopts( 'A:B:b:C:D:d:F:f:Gh:iL:N:nO:o:p:q:R:r:tUV:vX:' , \%opt ) or die "$usage\n" ; 30 | my $from = defined($opt{f}) ? $opt{f} : $ENV{USER} ; 31 | 32 | # run emailrelay-submit 33 | my @cmd = ( $exe ) ; 34 | push @cmd , ("-f",$from) if $from ; 35 | push @cmd , ( "--content-date" , "--content-message-id=local" , "--" ) ; # maybe also "--copy"` 36 | push @cmd , @ARGV ; # 'to' addresses 37 | exec { $exe } @cmd ; 38 | 39 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # bootstrap 4 | # 5 | # Autogenerates stuff. 6 | # 7 | aclocal -I . 8 | autoconf 9 | autoheader 10 | automake -ac -Woverride -Wportability 11 | -------------------------------------------------------------------------------- /bsd/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | if GCONFIG_BSD 19 | EXTRA_DIST = emailrelay-bsd.sh.in 20 | e_bsdinit_SCRIPTS = emailrelay 21 | CLEANFILES = emailrelay 22 | else 23 | EXTRA_DIST = emailrelay-bsd.sh.in 24 | e_bsdinit_SCRIPTS = 25 | CLEANFILES = 26 | endif 27 | 28 | do_sed = sed -e "s%__SBIN_DIR__%${sbindir}%g" -e "s%__INIT_DIR__%${e_initdir}%g" 29 | 30 | emailrelay: emailrelay-bsd.sh.in 31 | $(do_sed) < $(srcdir)/emailrelay-bsd.sh.in > emailrelay 32 | chmod +x emailrelay 33 | 34 | -------------------------------------------------------------------------------- /bsd/emailrelay-bsd.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # === 18 | # 19 | # emailrelay-bsd.sh 20 | # 21 | # Start/stop wrapper for E-MailRelay on FreeBSD, installed as 22 | # "/etc/rc.d/emailrelay" or "/usr/local/etc/rc.d/emailrelay". 23 | # 24 | # Requires the following line to be added to "/etc/rc.conf": 25 | # 26 | # emailrelay_enable="YES" 27 | # 28 | # Delegates to the linux start/stop script, which reads default directories 29 | # from "/etc/rc.conf.d/emailrelay" (if present) and server command-line 30 | # options from "/usr/local/etc/emailrelay.conf". 31 | # 32 | # See also man rc(8), man service(8) 33 | # 34 | # PROVIDE: emailrelay 35 | # REQUIRE: DAEMON 36 | # 37 | 38 | . /etc/rc.subr 39 | emailrelay_enable=${emailrelay_enable:-"NO"} 40 | name=emailrelay 41 | procname=__SBIN_DIR__/emailrelay 42 | rcvar=emailrelay_enable 43 | command=__INIT_DIR__/emailrelay 44 | command_args="$1" 45 | load_rc_config $name 46 | run_rc_command "$1" 47 | 48 | -------------------------------------------------------------------------------- /debian/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | EXTRA_DIST = \ 19 | emailrelay.init \ 20 | emailrelay.default \ 21 | emailrelay.service \ 22 | emailrelay.pam \ 23 | changelog \ 24 | conffiles \ 25 | control \ 26 | copyright \ 27 | preinst \ 28 | postinst \ 29 | prerm \ 30 | postrm \ 31 | rules 32 | 33 | -------------------------------------------------------------------------------- /debian/conffiles: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/debian/conffiles -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: emailrelay 2 | Section: mail 3 | Priority: optional 4 | Maintainer: Graeme Walker 5 | Build-Depends: debhelper-compat (= 13), autotools-dev, libssl-dev, libpam0g-dev 6 | Standards-Version: 4.1.4 7 | Rules-Requires-Root: no 8 | Homepage: https://emailrelay.sourceforge.net 9 | Vcs-Git: https://git.code.sf.net/p/emailrelay/git 10 | Vcs-Browser: https://sourceforge.net/p/emailrelay/git/ 11 | Bugs: https://sourceforge.net/projects/emailrelay/support 12 | 13 | Package: emailrelay 14 | Architecture: any 15 | Depends: ${shlibs:Depends}, ${misc:Depends} 16 | Description: E-mail store-and-forward transfer agent and pop server. 17 | E-MailRelay is a lightweight SMTP store-and-forward mail server with POP access 18 | to spooled messages. It can be used as a personal internet mail server with 19 | SpamAssassin spam filtering and DNSBL connection blocking. Forwarding can be 20 | to a fixed smarthost or using DNS MX routing. External scripts can be used for 21 | address validation and e-mail message processing. 22 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | 3 | Files: * 4 | Copyright: 2001-2024 Graeme Walker 5 | License: GPL-3.0-or-later 6 | -------------------------------------------------------------------------------- /debian/emailrelay.default: -------------------------------------------------------------------------------- 1 | # set EMAILRELAY_ENABLED=0 to disable sysv-init emailrelay start 2 | #EMAILRELAY_ENABLED=0 3 | -------------------------------------------------------------------------------- /debian/emailrelay.pam: -------------------------------------------------------------------------------- 1 | # emailrelay pam configuration 2 | auth requisite pam_unix.so nullok_secure 3 | -------------------------------------------------------------------------------- /debian/emailrelay.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=E-MailRelay mail server 3 | Documentation=man:emailrelay(1) 4 | After=network-online.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=forking 9 | Restart=on-success 10 | KillMode=control-group 11 | ExecStart=/usr/sbin/emailrelay --as-server --syslog --pid-file /run/emailrelay/emailrelay.pid /etc/emailrelay.conf 12 | ExecStop=/bin/kill -15 $MAINPID 13 | PIDFile=/run/emailrelay/emailrelay.pid 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | -------------------------------------------------------------------------------- /debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # postinst 4 | # 5 | 6 | spool="/var/spool/emailrelay" 7 | submit="/usr/sbin/emailrelay-submit" 8 | filtercopy="/usr/lib/emailrelay/emailrelay-filter-copy" 9 | init="/etc/init.d/emailrelay" 10 | rundir="/run/emailrelay" 11 | 12 | emailrelay_setup() 13 | { 14 | # use the init script for some post-install setup 15 | if test -e "$init" -a ! -x "$init" 16 | then 17 | chmod +x "$init" 18 | fi 19 | "$init" setup 20 | } 21 | 22 | emailrelay_fix_html() 23 | { 24 | # index.html refers to changelog.html, not changelog.html.gz 25 | cd /usr/share/doc/emailrelay && gzip -d -c changelog.html.gz > changelog.html 26 | } 27 | 28 | emailrelay_create_config() 29 | { 30 | if test ! -e /etc/emailrelay.conf -a -f /etc/emailrelay.conf.template 31 | then 32 | cp /etc/emailrelay.conf.template /etc/emailrelay.conf 33 | fi 34 | } 35 | 36 | emailrelay_setup 37 | emailrelay_fix_html 38 | emailrelay_create_config 39 | 40 | #DEBHELPER# 41 | 42 | exit 0 43 | 44 | -------------------------------------------------------------------------------- /debian/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # postrm 4 | # 5 | 6 | spool="/var/spool/emailrelay" 7 | rundir="/run/emailrelay" 8 | 9 | emailrelay_unfix_html() 10 | { 11 | # see postinst 12 | rm -f /usr/share/doc/emailrelay/changelog.html 13 | } 14 | 15 | emailrelay_purge() 16 | { 17 | # (purge deliberately fails if spooled messages exist) 18 | #rm -rf "$spool" 2>/dev/null 19 | rmdir "$spool" 2>/dev/null 20 | rmdir "$rundir" 2>/dev/null 21 | rm /etc/emailrelay.conf 2>/dev/null 22 | rm -rf "/usr/share/doc/emailrelay/doxygen" 2>/dev/null 23 | } 24 | 25 | #DEBHELPER# 26 | 27 | emailrelay_unfix_html 28 | if test "$1" = "purge" 29 | then 30 | emailrelay_purge 31 | fi 32 | exit 0 33 | 34 | -------------------------------------------------------------------------------- /debian/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # preinst 4 | # 5 | 6 | #DEBHELPER# 7 | 8 | -------------------------------------------------------------------------------- /debian/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # prerm 4 | # 5 | 6 | #DEBHELPER# 7 | 8 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # 3 | # rules 4 | # 5 | # See dh(1) and debhelper(7) 6 | # 7 | 8 | %: 9 | dh $@ --parallel --no-start 10 | 11 | override_dh_auto_configure: 12 | # (the init script and pam file go to one side under /usr/lib since we have .init and .pam files in debian/) 13 | dh_auto_configure -- e_libdir=/usr/lib/emailrelay e_initdir=/usr/lib/emailrelay/init e_rundir=/run/emailrelay e_pamdir=/usr/lib/emailrelay/pam --without-doxygen --without-man2html --with-openssl --without-mbedtls --with-pam --disable-gui --disable-testing 14 | 15 | -------------------------------------------------------------------------------- /doc/.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html 4 | 5 | # Required 6 | version: 2 7 | 8 | build: 9 | os: ubuntu-22.04 10 | tools: 11 | python: "3.11" 12 | 13 | sphinx: 14 | configuration: doc/conf.py 15 | 16 | -------------------------------------------------------------------------------- /doc/authentication.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/authentication.png -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | 5 | extensions = [] 6 | templates_path = ['_templates'] 7 | source_suffix = '.rst' 8 | master_doc = 'index' 9 | project = u'E-MailRelay' 10 | copyright = u'2024, Graeme Walker' 11 | author = u'Graeme Walker' 12 | version = u'2.6' 13 | release = u'2.6' 14 | language = None 15 | today_fmt = '%Y-%m-%d' 16 | exclude_patterns = [] 17 | pygments_style = 'sphinx' 18 | todo_include_todos = False 19 | html_theme = 'alabaster' 20 | #html_logo = None 21 | #html_favicon = None 22 | html_static_path = ['_static'] 23 | html_last_updated_fmt = '' 24 | html_show_sphinx = True 25 | html_show_copyright = True 26 | htmlhelp_basename = 'emailrelaydoc' 27 | latex_elements = {} 28 | latex_documents = [] 29 | man_pages = [] 30 | texinfo_documents = [] 31 | -------------------------------------------------------------------------------- /doc/download-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/download-button.png -------------------------------------------------------------------------------- /doc/doxygen-missing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | E-MailRelay source code documentation missing 5 | 6 | 7 | 8 |
9 |

E-MailRelay Source Code

10 |

No doxygen documentation available locally, try online.

11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /doc/emailrelay-doxygen.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2001-2024 Graeme Walker 3 | */ 4 | 5 | /* 6 | emailrelay-doxygen.css 7 | */ 8 | 9 | div#titlearea 10 | { 11 | visibility: hidden ; 12 | display: none ; 13 | } 14 | 15 | h1 16 | { 17 | color: #09c ; 18 | } 19 | 20 | h2 21 | { 22 | color: #09c ; 23 | } 24 | 25 | .title 26 | { 27 | color: #09c ; 28 | } 29 | 30 | div#projectname 31 | { 32 | color: #09c ; 33 | } 34 | 35 | pre.fragment 36 | { 37 | } 38 | 39 | pre.fragment a 40 | { 41 | color: black ; 42 | } 43 | 44 | pre.fragment a:visited 45 | { 46 | color: black ; 47 | } 48 | 49 | a.option 50 | { 51 | color: black ; 52 | } 53 | 54 | a.option:visited 55 | { 56 | color: black ; 57 | } 58 | 59 | code 60 | { 61 | /* font-weight: bold ; */ 62 | background-color: #eee ; 63 | } 64 | 65 | p.startli 66 | { 67 | } 68 | 69 | li.footer 70 | { 71 | } 72 | -------------------------------------------------------------------------------- /doc/emailrelay.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2001-2024 Graeme Walker 3 | */ 4 | 5 | /* 6 | emailrelay.css 7 | */ 8 | 9 | body 10 | { 11 | font-family: verdana, arial, helvetica, sans-serif ; 12 | color: #000 ; 13 | background-color: #fff ; 14 | margin: 0px ; 15 | padding: 0px ; 16 | } 17 | 18 | h1 19 | { 20 | text-align: center ; 21 | color: #09c ; 22 | } 23 | 24 | h2 25 | { 26 | color: #09c ; 27 | } 28 | 29 | h3 30 | { 31 | color: #09c ; 32 | } 33 | 34 | div.div-main 35 | { 36 | margin-left: 10% ; 37 | margin-right: 10% ; 38 | } 39 | 40 | div.div-footer 41 | { 42 | margin-top: 60px ; 43 | color: #888 ; 44 | font-size: smaller ; 45 | } 46 | 47 | div.div-pre 48 | { 49 | margin-left: 3% ; 50 | background-color: #eee ; 51 | padding: 0.5em ; 52 | border: none ; 53 | } 54 | 55 | p 56 | { 57 | font-family: verdana, arial, helvetica, sans-serif ; 58 | text-align: justify ; 59 | } 60 | 61 | img 62 | { 63 | border-width: 0px ; 64 | border-style: none ; /* check */ 65 | margin-left: 8% ; 66 | } 67 | 68 | a.a-header 69 | { 70 | text-decoration:none ; 71 | } 72 | 73 | a.a-href 74 | { 75 | text-decoration: none ; 76 | font-weight: bold ; 77 | } 78 | 79 | a.a-href:link 80 | { 81 | color: #09c ; 82 | } 83 | 84 | a.a-href:visited 85 | { 86 | color: #07a ; 87 | } 88 | 89 | a.a-href:hover 90 | { 91 | color: #09c ; 92 | background-color: #ddd ; 93 | } 94 | 95 | em.quote 96 | { 97 | font-weight: bold ; 98 | } 99 | 100 | em.fn 101 | { 102 | font-weight: bold ; 103 | } 104 | 105 | li em.fn 106 | { 107 | font-weight: normal ; 108 | font-style: normal ; 109 | } 110 | 111 | dt 112 | { 113 | font-weight: bold ; 114 | margin-left: 3% ; 115 | } 116 | 117 | dd 118 | { 119 | font-size: smaller ; 120 | margin-left: 6% ; 121 | padding-bottom: 8px ; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /doc/forwardto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/forwardto.png -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | E-MailRelay index 5 | 6 | 7 | 8 |
9 |

E-MailRelay Documentation

10 | 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | E-MailRelay 2 | =========== 3 | 4 | Contents: 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | userguide 10 | windows 11 | reference 12 | developer 13 | 14 | Indices and tables 15 | ================== 16 | 17 | * :ref:`search` 18 | 19 | -------------------------------------------------------------------------------- /doc/mailserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/mailserver.png -------------------------------------------------------------------------------- /doc/man2html-missing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | E-MailRelay man page unavailable 5 | 6 | 7 | 8 |
9 |

E-MailRelay Man Page

10 |

11 | The E-MailRelay man page is not available as HTML because man2html was not installed. 12 |

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/popbyname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/popbyname.png -------------------------------------------------------------------------------- /doc/serverclient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/serverclient.png -------------------------------------------------------------------------------- /doc/whatisit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/doc/whatisit.png -------------------------------------------------------------------------------- /etc/emailrelay-fail2ban-filter: -------------------------------------------------------------------------------- 1 | # Example fail2ban filter definition for emailrelay. 2 | # 3 | # Install this as /etc/fail2ban/filter.d/emailrelay.conf 4 | # and configure emailrelay to use the "--log-address" 5 | # option. 6 | 7 | [Definition] 8 | 9 | failregex = emailrelay: warning: ; failed authentication 10 | emailrelay: warning: ; .* AUTH requested but not advertised 11 | emailrelay: warning: ; empty MAIL-FROM return path 12 | emailrelay: info: ; address verifier: exit code 13 | 14 | ignoreregex = emailrelay: warning: ; dnsbl 15 | emailrelay: info: ; address verifier: exit code 1: 16 | 17 | -------------------------------------------------------------------------------- /etc/emailrelay-fail2ban-jail: -------------------------------------------------------------------------------- 1 | # Example fail2ban jail definition for emailrelay. 2 | # 3 | # Add this to /etc/fail2ban/jail.local. 4 | # 5 | # Configure syslog so that emailrelay warnings get logged to the fail2ban 6 | # 'syslog_mail' file -- typically "/var/log/mail" or "/var/log/mail.log". 7 | # Refer to '/etc/fail2ban/jail.conf', '/etc/fail2ban/paths*' and 8 | # 'man rsyslog.conf' for more details. 9 | # 10 | # When configuring syslog note that emailrelay emits logging using a syslog 11 | # 'facility' of "mail" by default, but you can change this by using the 12 | # emailrelay "--syslog" option, eg. "--syslog=local2". 13 | # 14 | # Test by using 'maxretry=1' and 'bantime = 30' below and then: 15 | # $ fail2ban-client reload 16 | # $ logger -p mail.warn emailrelay: warning: "1.2.3.4;" failed authentication 17 | # 18 | # You should see address 1.2.3.4 being banned by fail2ban for 30 seconds. 19 | # 20 | # Choose action 'action_mwl' below to ban the address using iptables and 21 | # also send notification emails using 'sendmail'. Refer to the '[DEFAULT]' 22 | # section of 'jail.conf' for pre-configured actions and for the mailer 23 | # configuration. 24 | # 25 | # Consider installing the 'emailrelay-sendmail.pl' script if you want 26 | # emails generated by fail2ban to go into the emailrelay spool directory. 27 | # 28 | 29 | [emailrelay] 30 | enabled = true 31 | ignoreip = 127.0.0.0/8 169.254.0.0/16 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 32 | port = smtp,submission 33 | logpath = %(syslog_mail)s 34 | #logpath = %(syslog_mail_warn)s 35 | action = %(action_)s 36 | #action = %(action_mwl)s 37 | #action = %(action_mw)s 38 | #maxretry = 1 39 | #bantime = 30 40 | 41 | -------------------------------------------------------------------------------- /etc/emailrelay.auth.in: -------------------------------------------------------------------------------- 1 | # 2 | # emailrelay.auth 3 | # 4 | # E-MailRelay secrets file. 5 | # 6 | # Point to this file on the emailrelay commandline, like this: 7 | # 8 | # $ emailrelay --as-client=example.com:25 --client-auth=/etc/emailrelay.auth 9 | # $ emailrelay --as-server --server-auth=/etc/emailrelay.auth 10 | # $ emailrelay --pop --no-smtp --pop-auth=/etc/emailrelay.auth 11 | # 12 | # Each line in this file has four or five space-separated fields in one of 13 | # the following forms: 14 | # 15 | # client {plain|plain:b|md5} [] 16 | # client oauth [] 17 | # server {plain|plain:b|md5} 18 | # server none 19 | # 20 | # For example: 21 | # 22 | # client plain alice my+20secret 23 | # server plain bob e+3Dmc2 24 | # server md5 carol Oqng9/H7wAyKgbuqw5VzG1bNO6feqtblyiNEi6QuN5dH 25 | # server plain:b dave UGFzc3cwcmQ= 26 | # server none 192.168.0.0/24 localnet 27 | # 28 | # Normally there should be one "client" line used to connect to a remote SMTP 29 | # server and multiple "server" lines representing accounts used by clients to 30 | # connect to this server (SMTP or POP). Multiple "client" lines can be 31 | # used if each one is given a distinct account selector. 32 | # 33 | # The "plain" passwords can be used for any authentication mechanism 34 | # whereas the "md5" hashed passwords can be only used be used for 35 | # "CRAM-MD5" authentication. Hashed passwords are generated by running 36 | # the "emailrelay-passwd" program. 37 | # 38 | # The "id" and "password" fields should be "xtext" encoded if the second 39 | # field is "plain" or base64 encoded if "plain:b". In xtext encoding 40 | # any unusual characters, including space, "=" and "+", are represented 41 | # as "+XX" hexadecimal ascii ("+20", "+3D", "+2B" etc) (see RFC-1891). 42 | # 43 | # The "none" rows allow trusted IP addresses to bypass authentication. 44 | # 45 | -------------------------------------------------------------------------------- /etc/emailrelay.pam: -------------------------------------------------------------------------------- 1 | # emailrelay pam configuration 2 | auth requisite pam_unix.so nullok_secure 3 | -------------------------------------------------------------------------------- /etc/emailrelay.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=E-MailRelay mail server 3 | Documentation=man:emailrelay(1) 4 | After=network-online.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=forking 9 | Restart=on-success 10 | KillMode=control-group 11 | ExecStart=__SBIN_DIR__/emailrelay --as-server --syslog --pid-file __RUN_DIR__/emailrelay.pid __SYSCONF_DIR__/emailrelay.conf 12 | ExecStop=/bin/kill -15 $MAINPID 13 | PIDFile=__RUN_DIR__/emailrelay.pid 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | -------------------------------------------------------------------------------- /libexec/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | work_scripts = \ 19 | doxygen.sh \ 20 | make-manifest.sh \ 21 | make-setup.sh \ 22 | make-format \ 23 | make-website \ 24 | make2cmake \ 25 | make2cdb \ 26 | make2qmake \ 27 | make2nmake \ 28 | make2unity \ 29 | mbedtlsbuild.pl \ 30 | libresslbuild.pl \ 31 | libresslbuild.mak \ 32 | qtbuild.pl \ 33 | winbuild.pm \ 34 | winbuildall.bat \ 35 | AutoMakeParser.pm \ 36 | BuildInfo.pm \ 37 | CompilationDatabase.pm \ 38 | ConfigStatus.pm \ 39 | reduce \ 40 | reduce.pl \ 41 | Functions.pm \ 42 | Reduce.pm 43 | 44 | EXTRA_DIST = \ 45 | $(work_scripts) 46 | 47 | noinst_SCRIPTS = \ 48 | $(work_scripts) 49 | 50 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | EXTRA_DIST = \ 19 | pkg.m4 \ 20 | m4_ax_cxx_compile_stdcxx.m4 \ 21 | m4_ax_require_defined.m4 22 | 23 | -------------------------------------------------------------------------------- /m4/m4_ax_require_defined.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_REQUIRE_DEFINED(MACRO) 8 | # 9 | # DESCRIPTION 10 | # 11 | # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have 12 | # been defined and thus are available for use. This avoids random issues 13 | # where a macro isn't expanded. Instead the configure script emits a 14 | # non-fatal: 15 | # 16 | # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found 17 | # 18 | # It's like AC_REQUIRE except it doesn't expand the required macro. 19 | # 20 | # Here's an example: 21 | # 22 | # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) 23 | # 24 | # LICENSE 25 | # 26 | # Copyright (c) 2014 Mike Frysinger 27 | # 28 | # Copying and distribution of this file, with or without modification, are 29 | # permitted in any medium without royalty provided the copyright notice 30 | # and this notice are preserved. This file is offered as-is, without any 31 | # warranty. 32 | 33 | #serial 2 34 | 35 | AC_DEFUN([AX_REQUIRE_DEFINED], [dnl 36 | m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) 37 | ])dnl AX_REQUIRE_DEFINED 38 | -------------------------------------------------------------------------------- /src/.clang-format: -------------------------------------------------------------------------------- 1 | # 2 | # clang-format 3 | # 4 | # Configuration for clang-format v10. 5 | # 6 | --- 7 | BasedOnStyle: WebKit 8 | AlignEscapedNewlines: DontAlign 9 | #AlignOperands: DontAlign 10 | AlignOperands: false 11 | AllowShortFunctionsOnASingleLine: None 12 | AllowShortLoopsOnASingleLine: false 13 | AllowAllArgumentsOnNextLine: false 14 | AllowAllConstructorInitializersOnNextLine: true 15 | AllowAllParametersOfDeclarationOnNextLine: false 16 | AllowShortLambdasOnASingleLine: All 17 | AlwaysBreakTemplateDeclarations: true 18 | AlwaysBreakBeforeMultilineStrings: true 19 | BinPackArguments: false 20 | BinPackParameters: false 21 | BreakBeforeBraces: Allman 22 | BreakBeforeTernaryOperators: false 23 | BreakBeforeBinaryOperators: None 24 | BreakConstructorInitializers: AfterColon 25 | BreakInheritanceList: AfterColon 26 | ColumnLimit: 120 27 | ConstructorInitializerAllOnOneLineOrOnePerLine: true 28 | NamespaceIndentation: All 29 | PointerAlignment: Middle 30 | #SortIncludes: false 31 | #SpaceAroundPointerQualifiers: Both 32 | SpaceBeforeCtorInitializerColon: true 33 | SpaceBeforeInheritanceColon: true 34 | SpaceBeforeParens: Never 35 | SpaceBeforeRangeBasedForLoopColon: true 36 | SpacesInConditionalStatement: true 37 | SpaceInEmptyBlock: false 38 | SpaceInEmptyParentheses: false 39 | SpacesInParentheses: true 40 | TabWidth: 4 41 | UseTab: ForContinuationAndIndentation 42 | #WhitespaceSensitiveMacros: ['G_DEBUG', 'G_WARNING', 'G_LOG'] 43 | 44 | ... 45 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | SUBDIRS = glib gssl gnet gauth gstore gsmtp gpop win32 gfilters gverifiers main gui 19 | EXTRA_DIST = .clang-tidy .clang-format 20 | CLEANFILES = compile_commands.json 21 | 22 | TIDY ?= clang-tidy 23 | 24 | .PHONY: cdb 25 | cdb: compile_commands.json 26 | 27 | compile_commands.json: Makefile 28 | @chmod +x $(top_srcdir)/libexec/make2cdb || true 29 | $(top_srcdir)/libexec/make2cdb > $@.tmp && mv $@.tmp $@ 30 | 31 | .PHONY: tidy 32 | tidy: compile_commands.json 33 | @chmod +x $(top_srcdir)/libexec/make2cdb || true 34 | @touch $(top_srcdir)/gconfig_defs.h 35 | $(top_srcdir)/libexec/make2cdb --list | xargs -- "$(TIDY)" -p . || true 36 | 37 | .PHONY: format 38 | format: 39 | @chmod +x $(top_srcdir)/libexec/make-format || true 40 | $(top_srcdir)/libexec/make-format -f "$(FORMAT)" -d $(top_srcdir) 41 | 42 | -------------------------------------------------------------------------------- /src/gauth/gsaslclientsecrets.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslclientsecrets.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gsaslclientsecrets.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/gauth/gsaslserver.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslserver.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gsaslserver.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/gauth/gsaslserverfactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslserverfactory.h 19 | /// 20 | 21 | #ifndef G_SASL_SERVER_FACTORY_H 22 | #define G_SASL_SERVER_FACTORY_H 23 | 24 | #include "gdef.h" 25 | #include "gsaslserver.h" 26 | #include "gsecrets.h" 27 | #include "goptional.h" 28 | #include 29 | #include 30 | 31 | namespace GAuth 32 | { 33 | class SaslServerFactory ; 34 | } 35 | 36 | //| \class GAuth::SaslServerFactory 37 | /// Provides a factory function for SaslServer instances. 38 | /// 39 | class GAuth::SaslServerFactory 40 | { 41 | public: 42 | static std::unique_ptr newSaslServer( const SaslServerSecrets & , 43 | bool allow_pop , const std::string & config , 44 | const std::string & challenge_domain ) ; 45 | ///< A factory function for a SaslServer. 46 | 47 | public: 48 | SaslServerFactory() = delete ; 49 | } ; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/gauth/gsaslserverfactory_basic.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslserverfactory_basic.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gsaslserverfactory.h" 23 | #include "gsaslserver.h" 24 | #include "gsaslserverbasic.h" 25 | 26 | std::unique_ptr GAuth::SaslServerFactory::newSaslServer( const SaslServerSecrets & secrets , 27 | bool allow_pop , const std::string & config , const std::string & challenge_domain ) 28 | { 29 | return std::make_unique( secrets , allow_pop , config , challenge_domain ) ; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/gauth/gsaslserverfactory_pam.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslserverfactory_pam.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gsaslserverfactory.h" 23 | #include "gexception.h" 24 | #include "gsaslserverbasic.h" 25 | #include "gsaslserverpam.h" 26 | 27 | std::unique_ptr GAuth::SaslServerFactory::newSaslServer( const SaslServerSecrets & secrets , 28 | bool allow_pop , const std::string & config , const std::string & challenge_domain ) 29 | { 30 | if( secrets.source() == "/pam" ) // deprecated 31 | return std::make_unique( allow_pop ) ; 32 | else if( secrets.source() == "pam:" ) 33 | return std::make_unique( allow_pop ) ; 34 | else 35 | return std::make_unique( secrets , allow_pop , config , challenge_domain ) ; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/gauth/gsaslserversecrets.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsaslserversecrets.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gsaslserversecrets.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/gfilters/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | noinst_LIBRARIES = libgfilters.a 19 | 20 | AM_CPPFLAGS = \ 21 | -I$(top_srcdir)/src/glib \ 22 | -I$(top_srcdir)/src/gssl \ 23 | -I$(top_srcdir)/src/gnet \ 24 | -I$(top_srcdir)/src/win32 \ 25 | -I$(top_srcdir)/src/gstore \ 26 | -I$(top_srcdir)/src/gsmtp \ 27 | -DG_LIB_SMALL 28 | 29 | libgfilters_a_SOURCES = \ 30 | gcopyfilter.cpp \ 31 | gcopyfilter.h \ 32 | gdeliveryfilter.cpp \ 33 | gdeliveryfilter.h \ 34 | gexecutablefilter.cpp \ 35 | gexecutablefilter.h \ 36 | gfilterchain.cpp \ 37 | gfilterchain.h \ 38 | gfilterfactory.cpp \ 39 | gfilterfactory.h \ 40 | gmessageidfilter.cpp \ 41 | gmessageidfilter.h \ 42 | gmxfilter.cpp \ 43 | gmxfilter.h \ 44 | gmxlookup.cpp \ 45 | gmxlookup.h \ 46 | gnetworkfilter.cpp \ 47 | gnetworkfilter.h \ 48 | gnullfilter.cpp \ 49 | gnullfilter.h \ 50 | gsimplefilterbase.cpp \ 51 | gsimplefilterbase.h \ 52 | gspamfilter.cpp \ 53 | gspamfilter.h \ 54 | gsplitfilter.cpp \ 55 | gsplitfilter.h 56 | 57 | -------------------------------------------------------------------------------- /src/gfilters/gdeliveryfilter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdeliveryfilter.h 19 | /// 20 | 21 | #ifndef G_DELIVERY_FILTER_H 22 | #define G_DELIVERY_FILTER_H 23 | 24 | #include "gdef.h" 25 | #include "gfilter.h" 26 | #include "gsimplefilterbase.h" 27 | #include "gfilestore.h" 28 | #include "geventstate.h" 29 | 30 | namespace GFilters 31 | { 32 | class DeliveryFilter ; 33 | } 34 | 35 | //| \class GFilters::DeliveryFilter 36 | /// A concrete GSmtp::Filter class that copies the message to multiple 37 | /// spool sub-directories according to the envelope recipient list. 38 | /// The implementation delegates to GStore::FileDelivery. 39 | /// 40 | class GFilters::DeliveryFilter : public SimpleFilterBase 41 | { 42 | public: 43 | DeliveryFilter( GNet::EventState es , GStore::FileStore & , 44 | Filter::Type , const Filter::Config & , const std::string & spec ) ; 45 | ///< Constructor. 46 | 47 | private: // overrides 48 | Result run( const GStore::MessageId & , bool & , GStore::FileStore::State ) override ; 49 | 50 | private: 51 | GStore::FileStore & m_store ; 52 | Filter::Type m_filter_type ; 53 | Filter::Config m_filter_config ; 54 | std::string m_spec ; 55 | } ; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/glib/gassert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gassert.h 19 | /// 20 | 21 | #ifndef G_ASSERT_H 22 | #define G_ASSERT_H 23 | 24 | #include "gdef.h" 25 | #include "glogoutput.h" 26 | 27 | #if defined(G_WITH_ASSERT) || ( defined(_DEBUG) && ! defined(G_NO_ASSERT) ) 28 | #define G_ASSERT( test ) G::LogOutput::assertion( G::LogOutput::instance() , __FILE__ , __LINE__ , (test) , #test ) 29 | #else 30 | #define G_ASSERT( test ) 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/glib/gbasicaddress.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gbasicaddress.h 19 | /// 20 | 21 | #ifndef G_BASIC_ADDRESS_H 22 | #define G_BASIC_ADDRESS_H 23 | 24 | #include "gdef.h" 25 | 26 | namespace G 27 | { 28 | class BasicAddress ; 29 | } 30 | 31 | //| \class G::BasicAddress 32 | /// A structure that holds a network address as a string with no 33 | /// dependency on any low-level network library. 34 | /// \see GNet::Address 35 | /// 36 | class G::BasicAddress 37 | { 38 | public: 39 | explicit BasicAddress( const std::string & s = {} ) ; 40 | ///< Constructor. 41 | 42 | std::string displayString() const ; 43 | ///< Returns a printable string that represents the transport 44 | ///< address. 45 | 46 | private: 47 | std::string m_display_string ; 48 | } ; 49 | 50 | inline 51 | G::BasicAddress::BasicAddress( const std::string & s ) : 52 | m_display_string(s) 53 | { 54 | } 55 | 56 | inline 57 | std::string G::BasicAddress::displayString() const 58 | { 59 | return m_display_string ; 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/glib/gcleanup_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gcleanup_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gcleanup.h" 23 | #include // _strdup() 24 | 25 | void G::Cleanup::init() 26 | { 27 | // no-op 28 | } 29 | 30 | void G::Cleanup::add( bool (*)(const Arg &) noexcept , Arg ) 31 | { 32 | // not implemented 33 | } 34 | 35 | void G::Cleanup::atexit( bool ) 36 | { 37 | // not implemented 38 | } 39 | 40 | void G::Cleanup::block() noexcept 41 | { 42 | // not implemented 43 | } 44 | 45 | void G::Cleanup::release() noexcept 46 | { 47 | // not implemented 48 | } 49 | 50 | G::Cleanup::Arg G::Cleanup::arg( const char * ) 51 | { 52 | return {} ; 53 | } 54 | 55 | G::Cleanup::Arg G::Cleanup::arg( const std::string & ) 56 | { 57 | return {} ; 58 | } 59 | 60 | G::Cleanup::Arg G::Cleanup::arg( const Path & ) 61 | { 62 | Arg arg ; 63 | //arg.m_is_path = true ; // fwiw 64 | return arg ; 65 | } 66 | 67 | G::Cleanup::Arg G::Cleanup::arg( std::nullptr_t ) 68 | { 69 | return {} ; 70 | } 71 | 72 | const char * G::Cleanup::Arg::str() const noexcept 73 | { 74 | return m_ptr ; 75 | } 76 | 77 | bool G::Cleanup::Arg::isPath() const noexcept 78 | { 79 | return m_is_path ; 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/glib/gdaemon.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdaemon.h 19 | /// 20 | 21 | #ifndef G_DAEMON_H 22 | #define G_DAEMON_H 23 | 24 | #include "gdef.h" 25 | #include "gexception.h" 26 | #include "gpidfile.h" 27 | #include "gpath.h" 28 | #include 29 | #include 30 | 31 | namespace G 32 | { 33 | class Daemon ; 34 | } 35 | 36 | //| \class G::Daemon 37 | /// A static interface for daemonising the calling process. Daemonisation 38 | /// includes fork()ing, detaching from the controlling terminal, setting 39 | /// the process umask, etc. The windows implementation does nothing. 40 | /// \see G::Process 41 | /// 42 | class G::Daemon 43 | { 44 | public: 45 | static void detach() ; 46 | ///< Detaches from the parent environment. This typically 47 | ///< involves fork()ing, std::_Exit()ing the parent, and calling 48 | ///< setsid() in the child. See also G::PidFile. 49 | 50 | static void detach( const G::Path & pid_file ) ; 51 | ///< Does a detach() but the calling process waits a while 52 | ///< for the pid file to be created before it exits. 53 | 54 | public: 55 | Daemon() = delete ; 56 | 57 | private: 58 | static void setsid() ; 59 | } ; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/glib/gdaemon_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdaemon_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gdaemon.h" 23 | #include "gprocess.h" 24 | 25 | void G::Daemon::detach() 26 | { 27 | // no-op 28 | } 29 | 30 | void G::Daemon::detach( const G::Path & ) 31 | { 32 | detach() ; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/glib/genvironment_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file genvironment_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gnowide.h" 23 | #include "genvironment.h" 24 | 25 | std::string G::Environment::get( const std::string & name , const std::string & default_ ) 26 | { 27 | return nowide::getenv( name , default_ ) ; 28 | } 29 | 30 | G::Path G::Environment::getPath( const std::string & name , const G::Path & default_ ) 31 | { 32 | return G::Path( nowide::getenv( name , default_.str() ) ) ; 33 | } 34 | 35 | G::Environment G::Environment::minimal( bool ) 36 | { 37 | return Environment( {} ) ; 38 | } 39 | 40 | void G::Environment::put( const std::string & name , const std::string & value ) 41 | { 42 | nowide::putenv( name , value ) ; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/glib/ggettext_none.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ggettext_none.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "ggettext.h" 23 | 24 | void G::gettext_init( const std::string & , const std::string & ) 25 | { 26 | } 27 | 28 | const char * G::gettext( const char * p ) noexcept 29 | { 30 | return p ; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/glib/ggettext_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ggettext_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "ggettext.h" 23 | #include 24 | #include 25 | 26 | void G::gettext_init( const std::string & localedir , const std::string & appname ) 27 | { 28 | if( !appname.empty() ) 29 | { 30 | std::setlocale( LC_MESSAGES , "" ) ; 31 | std::setlocale( LC_CTYPE , "" ) ; 32 | if( !localedir.empty() ) 33 | bindtextdomain( appname.c_str() , localedir.c_str() ) ; 34 | textdomain( appname.c_str() ) ; 35 | // see also bind_textdomain_codeset() 36 | } 37 | } 38 | 39 | const char * G::gettext( const char * p ) noexcept 40 | { 41 | return ::gettext( p ) ; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/glib/ggettext_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ggettext_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "ggettext.h" 23 | 24 | void G::gettext_init( const std::string & , const std::string & ) 25 | { 26 | } 27 | 28 | const char * G::gettext( const char * p ) noexcept 29 | { 30 | return p ; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/glib/ghostname.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ghostname.h 19 | /// 20 | 21 | #ifndef G_HOSTNAME_H 22 | #define G_HOSTNAME_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | namespace G 28 | { 29 | std::string hostname() ; 30 | ///< Returns the hostname. This may or may not 31 | ///< relate to the host's name on some network. 32 | ///< Returns the empty string on error. 33 | } 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /src/glib/ghostname_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ghostname_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "ghostname.h" 23 | #include "gstr.h" 24 | #include "genvironment.h" 25 | #include 26 | 27 | std::string G::hostname() 28 | { 29 | struct utsname info {} ; 30 | int rc = ::uname( &info ) ; 31 | if( rc == -1 ) 32 | return {} ; 33 | 34 | info.nodename[sizeof(info.nodename)-1U] = '\0' ; 35 | std::string_view name = G::Str::headView( info.nodename , {".",1U} , false ) ; 36 | 37 | if( name.empty() ) // pathologically "uname -n" can be empty 38 | return Environment::get( "HOSTNAME" , std::string() ) ; 39 | 40 | return Str::printable( name ) ; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/glib/ghostname_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ghostname_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gnowide.h" 23 | #include "ghostname.h" 24 | #include "genvironment.h" 25 | #include "gstr.h" 26 | 27 | std::string G::hostname() 28 | { 29 | std::string name = nowide::getComputerNameEx( ComputerNamePhysicalDnsHostname ) ; 30 | if( name.empty() ) 31 | name = nowide::getComputerNameEx( ComputerNameNetBIOS ) ; 32 | if( name.empty() ) 33 | name = Environment::get( "COMPUTERNAME" , std::string() ) ; 34 | return name ; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/glib/gidn.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gidn.h 19 | /// 20 | 21 | #ifndef G_IDN_H 22 | #define G_IDN_H 23 | 24 | #include "gdef.h" 25 | #include "gstringview.h" 26 | #include "gexception.h" 27 | #include 28 | 29 | namespace G 30 | { 31 | namespace Idn /// Internationalised Domain Name encoding. 32 | { 33 | G_EXCEPTION_CLASS( Error , tx("error encoding idn domain name") ) 34 | 35 | bool valid( std::string_view domain ) ; 36 | ///< Returns true if the given domain is valid with 37 | ///< U-labels and/or A-labels. 38 | 39 | std::string encode( std::string_view domain ) ; 40 | ///< Returns the given domain with A-lables. 41 | ///< Precondition: valid(domain) 42 | } 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/glib/glog.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file glog.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "glog.h" 23 | 24 | // empty 25 | 26 | -------------------------------------------------------------------------------- /src/glib/goptionreader.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file goptionreader.h 19 | /// 20 | 21 | #ifndef G_OPTION_READER_H 22 | #define G_OPTION_READER_H 23 | 24 | #include "gdef.h" 25 | #include "gstringarray.h" 26 | #include "gexception.h" 27 | #include "ggettext.h" 28 | #include "gpath.h" 29 | 30 | namespace G 31 | { 32 | class OptionReader ; 33 | } 34 | 35 | //| \class G::OptionReader 36 | /// Provides a static function to read options from a config file. 37 | /// 38 | class G::OptionReader 39 | { 40 | public: 41 | G_EXCEPTION( FileError , tx("error reading configuration file") ) 42 | 43 | static StringArray read( const G::Path & , std::size_t limit = 1000U ) ; 44 | ///< Reads options from file as a list of strings like "--foo=bar". 45 | ///< Throws on error. 46 | 47 | static std::size_t add( StringArray & out , const G::Path & , std::size_t limit = 1000U ) ; 48 | ///< Adds options read from file to an existing list. 49 | ///< Returns the number of options added. 50 | 51 | public: 52 | OptionReader() = delete ; 53 | } ; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/glib/gpam_none.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gpam_none.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gpam.h" 23 | #include 24 | 25 | class G::PamImp 26 | { 27 | } ; 28 | 29 | G::Pam::Pam( const std::string & , const std::string & , bool ) 30 | { 31 | } 32 | 33 | G::Pam::~Pam() 34 | = default; 35 | 36 | bool G::Pam::authenticate( bool ) 37 | { 38 | throw Error( "authenticate" , 0 ) ; 39 | } 40 | 41 | void G::Pam::checkAccount( bool ) 42 | { 43 | } 44 | 45 | void G::Pam::establishCredentials() 46 | { 47 | } 48 | 49 | void G::Pam::openSession() 50 | { 51 | } 52 | 53 | void G::Pam::closeSession() 54 | { 55 | } 56 | 57 | void G::Pam::deleteCredentials() 58 | { 59 | } 60 | 61 | void G::Pam::reinitialiseCredentials() 62 | { 63 | } 64 | 65 | void G::Pam::refreshCredentials() 66 | { 67 | } 68 | 69 | std::string G::Pam::name() const 70 | { 71 | return std::string() ; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/glib/grandom.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file grandom.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "grandom.h" 23 | #include "gprocess.h" 24 | #include 25 | #include 26 | #include 27 | 28 | unsigned int G::Random::rand( unsigned int start , unsigned int end ) 29 | { 30 | static std::default_random_engine e ; // NOLINT cert-msc32-c 31 | 32 | static bool seeded = false ; 33 | if( !seeded ) 34 | { 35 | #if defined(G_WINDOWS) 36 | std::random_device r ; 37 | #else 38 | std::random_device r( "/dev/urandom" ) ; 39 | #endif 40 | 41 | using seed_t = std::random_device::result_type ; 42 | seed_t seed_1 = 0U ; 43 | try { seed_1 = r() ; } catch( std::exception & ) {} 44 | 45 | auto tp = std::chrono::high_resolution_clock::now() ; 46 | auto seed_2 = static_cast( tp.time_since_epoch().count() ) ; 47 | 48 | seed_t seed_3 = G::Process::Id().seed() ; 49 | 50 | std::seed_seq seq{ seed_1 , seed_2 , seed_3 } ; 51 | e.seed( seq ) ; 52 | seeded = true ; 53 | } 54 | 55 | std::uniform_int_distribution dist( start , end ) ; 56 | return dist( e ) ; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/glib/grandom.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file grandom.h 19 | /// 20 | 21 | #ifndef G_RANDOM_H 22 | #define G_RANDOM_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | namespace G 28 | { 29 | namespace Random /// An enclosing namespace for G::Random::rand(). 30 | { 31 | unsigned int rand( unsigned int start = 0U , unsigned int end = 32767 ) ; 32 | ///< Returns a random value, uniformly distributed over the 33 | ///< given range (including 'start' and 'end'), and automatically 34 | ///< seeded on first use. 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/glib/greadwrite.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file greadwrite.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "greadwrite.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/glib/gsignalsafe.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsignalsafe.h 19 | /// 20 | 21 | #ifndef G_SIGNAL_SAFE_H 22 | #define G_SIGNAL_SAFE_H 23 | 24 | #include "gdef.h" 25 | 26 | namespace G 27 | { 28 | class SignalSafe ; 29 | } 30 | 31 | //| \class G::SignalSafe 32 | /// An empty structure that is used to indicate a signal-safe, reentrant implementation. 33 | /// Any function with SignalSafe in its signature should be kept small and simple, 34 | /// with no exceptions, no logging and no blocking system calls. 35 | /// 36 | class G::SignalSafe 37 | { 38 | } ; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/glib/gsleep.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsleep.h 19 | /// 20 | 21 | #ifndef G_SLEEP_H 22 | #define G_SLEEP_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | /// A sleep() function. 28 | /// 29 | #ifdef G_WINDOWS 30 | inline void sleep( int s ) 31 | { 32 | ::Sleep( s * 1000 ) ; 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/glib/gslot.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gslot.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gslot.h" 23 | 24 | -------------------------------------------------------------------------------- /src/glib/gstatemachine.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gstatemachine.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gstatemachine.h" 23 | #include 24 | 25 | void G::StateMachineImp::throwError() 26 | { 27 | throw Error() ; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/glib/gstringarray.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gstringarray.h 19 | /// 20 | 21 | #ifndef G_STRING_ARRAY_H 22 | #define G_STRING_ARRAY_H 23 | 24 | #include "gdef.h" 25 | #include 26 | #include 27 | 28 | namespace G 29 | { 30 | using StringArray = std::vector ; ///< A std::vector of std::strings. 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/glib/gstringmap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gstringmap.h 19 | /// 20 | 21 | #ifndef G_STRING_MAP_H 22 | #define G_STRING_MAP_H 23 | 24 | #include "gdef.h" 25 | #include 26 | #include 27 | 28 | namespace G 29 | { 30 | using StringMap = std::map ; ///< A std::map of std::strings. 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/glib/gstrmacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2001-2024 Graeme Walker 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | // 19 | // gstrmacros.h 20 | // 21 | 22 | #ifndef G_STR_MACROS_H 23 | #define G_STR_MACROS_H 24 | 25 | #ifdef G_STR_IMP 26 | #undef G_STR_IMP 27 | #endif 28 | #ifdef G_STR 29 | #undef G_STR 30 | #endif 31 | #ifdef G_STR_PASTE_IMP 32 | #undef G_STR_PASTE_IMP 33 | #endif 34 | #ifdef G_STR_PASTE 35 | #undef G_STR_PASTE 36 | #endif 37 | 38 | #define G_STR_IMP(a) #a 39 | #define G_STR(a) G_STR_IMP(a) 40 | #define G_STR_PASTE_IMP(a,b) a##b 41 | #define G_STR_PASTE(a,b) G_STR_PASTE_IMP(a,b) 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/glib/gthread.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gthread.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | 23 | namespace G 24 | { 25 | namespace ThreadImp 26 | { 27 | void test_fn() {} 28 | } 29 | } 30 | 31 | bool G::threading::works() 32 | { 33 | if( using_std_thread ) 34 | { 35 | static bool first = true ; 36 | static bool result = false ; 37 | if( first ) 38 | { 39 | first = false ; 40 | try 41 | { 42 | threading::thread_type t( ThreadImp::test_fn ) ; 43 | t.join() ; 44 | threading::mutex_type mutex ; 45 | threading::lock_type lock( mutex ) ; 46 | result = true ; 47 | } 48 | catch(...) 49 | { 50 | // eg. gcc std::thread builds okay with -std=c++11 but throws 51 | // at run-time if not also built with "-pthread" -- also, linking 52 | // with -lGL suppresses linking with libpthread.so and breaks 53 | // threading at run-time -- also, gcc 4.8 bugs 54 | result = false ; 55 | } 56 | } 57 | return result ; 58 | } 59 | else 60 | { 61 | return false ; 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /src/glib/gxtext.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gxtext.h 19 | /// 20 | 21 | #ifndef G_XTEXT_H 22 | #define G_XTEXT_H 23 | 24 | #include "gdef.h" 25 | #include "gstringview.h" 26 | #include 27 | 28 | namespace G 29 | { 30 | class Xtext ; 31 | } 32 | 33 | //| \class G::Xtext 34 | /// An xtext codec class, encoding space as "+20" etc. 35 | /// \see RFC-1891 section 5 36 | /// 37 | class G::Xtext 38 | { 39 | public: 40 | static std::string encode( std::string_view ) ; 41 | ///< Encodes the given string. 42 | 43 | static std::string decode( std::string_view ) ; 44 | ///< Decodes the given string. Input strings must be 45 | ///< un-strictly valid(), otherwise the result is 46 | ///< undefined. 47 | 48 | static bool valid( std::string_view , bool strict = false ) ; 49 | ///< Returns true if a valid encoding, or empty. If 50 | ///< strict then 'equals' and 'space' are disallowed 51 | ///< and hex characters must be uppercase (eg. "+1A"). 52 | 53 | public: 54 | Xtext() = delete ; 55 | } ; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/gnet/gclientptr.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gclientptr.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gclientptr.h" 23 | 24 | GNet::ClientPtrBase::ClientPtrBase() 25 | = default; 26 | 27 | G::Slot::Signal & GNet::ClientPtrBase::deletedSignal() noexcept 28 | { 29 | return m_deleted_signal ; 30 | } 31 | 32 | G::Slot::Signal & GNet::ClientPtrBase::eventSignal() noexcept 33 | { 34 | return m_event_signal ; 35 | } 36 | 37 | G::Slot::Signal & GNet::ClientPtrBase::deleteSignal() noexcept 38 | { 39 | return m_delete_signal ; 40 | } 41 | 42 | void GNet::ClientPtrBase::eventSlot( const std::string & s1 , const std::string & s2 , const std::string & s3 ) 43 | { 44 | m_event_signal.emit( std::string(s1) , std::string(s2) , std::string(s3) ) ; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/gnet/gconnection.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gconnection.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gconnection.h" 23 | 24 | // empty 25 | 26 | -------------------------------------------------------------------------------- /src/gnet/gdescriptor_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdescriptor_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gdescriptor.h" 23 | 24 | GNet::Descriptor::Descriptor() noexcept : 25 | m_fd(-1) 26 | { 27 | } 28 | 29 | bool GNet::Descriptor::validfd() const noexcept 30 | { 31 | return m_fd >= 0 ; 32 | } 33 | 34 | #ifndef G_LIB_SMALL 35 | HANDLE GNet::Descriptor::h() const noexcept 36 | { 37 | return 0 ; 38 | } 39 | #endif 40 | 41 | void GNet::Descriptor::streamOut( std::ostream & stream ) const 42 | { 43 | stream << m_fd ; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/gnet/gdescriptor_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdescriptor_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gdescriptor.h" 23 | 24 | GNet::Descriptor::Descriptor() noexcept : 25 | m_fd(INVALID_SOCKET) , 26 | m_handle(HNULL) 27 | { 28 | } 29 | 30 | bool GNet::Descriptor::validfd() const noexcept 31 | { 32 | return m_fd != INVALID_SOCKET ; 33 | } 34 | 35 | HANDLE GNet::Descriptor::h() const noexcept 36 | { 37 | return m_handle ; 38 | } 39 | 40 | void GNet::Descriptor::streamOut( std::ostream & stream ) const 41 | { 42 | if( m_fd == INVALID_SOCKET ) 43 | stream << "-1" ; 44 | else 45 | stream << m_fd ; 46 | 47 | stream << "," << m_handle ; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/gnet/gdnsbl_disabled.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gdnsbl_disabled.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gdnsbl.h" 23 | #include "gexception.h" 24 | 25 | class GNet::DnsblImp 26 | { 27 | } ; 28 | 29 | GNet::Dnsbl::Dnsbl( std::function callback , EventState , std::string_view ) : 30 | m_callback(callback) 31 | { 32 | } 33 | 34 | GNet::Dnsbl::~Dnsbl() 35 | = default ; 36 | 37 | void GNet::Dnsbl::start( const Address & ) 38 | { 39 | m_callback( /*allow=*/true ) ; 40 | } 41 | 42 | bool GNet::Dnsbl::busy() const 43 | { 44 | return false ; 45 | } 46 | 47 | void GNet::Dnsbl::checkConfig( const std::string & config ) 48 | { 49 | if( !config.empty() ) 50 | throw G::Exception( "dnsbl has been disabled in this build" ) ; 51 | } 52 | -------------------------------------------------------------------------------- /src/gnet/gevent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gevent.h 19 | /// 20 | 21 | #ifndef G_NET_EVENT_H 22 | #define G_NET_EVENT_H 23 | 24 | #include "gdef.h" 25 | #include "geventloop.h" 26 | #include "geventhandler.h" 27 | #include "geventemitter.h" 28 | #include "geventstate.h" 29 | #include "geventlogging.h" 30 | #include "gexceptionhandler.h" 31 | #include "gexceptionsource.h" 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /src/gnet/geventlogging.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file geventlogging.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "geventlogging.h" 23 | #include "gassert.h" 24 | 25 | GNet::EventLogging::EventLogging( const EventLogging * next ) : 26 | m_next(next) 27 | { 28 | G_ASSERT( next != this ) ; 29 | } 30 | 31 | GNet::EventLogging::~EventLogging() 32 | = default ; 33 | 34 | std::string_view GNet::EventLogging::eventLoggingString() const 35 | { 36 | return {} ; 37 | } 38 | 39 | const GNet::EventLogging * GNet::EventLogging::next() const noexcept 40 | { 41 | return m_next ; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/gnet/geventloop.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file geventloop.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "geventloop.h" 23 | #include "glog.h" 24 | #include "gassert.h" 25 | 26 | GNet::EventLoop * GNet::EventLoop::m_this = nullptr ; 27 | 28 | GNet::EventLoop::EventLoop() 29 | { 30 | if( m_this == nullptr ) 31 | m_this = this ; 32 | } 33 | 34 | GNet::EventLoop::~EventLoop() 35 | { 36 | if( m_this == this ) 37 | m_this = nullptr ; 38 | } 39 | 40 | GNet::EventLoop * GNet::EventLoop::ptr() noexcept 41 | { 42 | return m_this ; 43 | } 44 | 45 | GNet::EventLoop & GNet::EventLoop::instance() 46 | { 47 | if( m_this == nullptr ) 48 | throw NoInstance() ; 49 | return *m_this ; 50 | } 51 | 52 | bool GNet::EventLoop::exists() 53 | { 54 | return m_this != nullptr ; 55 | } 56 | 57 | #ifndef G_LIB_SMALL 58 | void GNet::EventLoop::stop( const G::SignalSafe & signal_safe ) 59 | { 60 | if( m_this != nullptr ) 61 | m_this->quit( signal_safe ) ; 62 | } 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /src/gnet/gexceptionhandler.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gexceptionhandler.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gexceptionhandler.h" 23 | #include "gtimerlist.h" 24 | #include "geventloop.h" 25 | 26 | GNet::ExceptionHandler::~ExceptionHandler() 27 | { 28 | if( EventLoop::ptr() ) 29 | EventLoop::ptr()->disarm( this ) ; 30 | 31 | if( TimerList::ptr() ) 32 | TimerList::ptr()->disarm( this ) ; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/gnet/gexceptionsource.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gexceptionsource.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gexceptionsource.h" 23 | 24 | GNet::ExceptionSource::~ExceptionSource() 25 | = default ; 26 | 27 | -------------------------------------------------------------------------------- /src/gnet/gexceptionsource.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gexceptionsource.h 19 | /// 20 | 21 | #ifndef G_NET_EXCEPTION_SOURCE_H 22 | #define G_NET_EXCEPTION_SOURCE_H 23 | 24 | #include "gdef.h" 25 | 26 | namespace GNet 27 | { 28 | class ExceptionSource ; 29 | } 30 | 31 | //| \class GNet::ExceptionSource 32 | /// A mixin base class that identifies the source of an exception 33 | /// when delivered to GNet::ExceptionHandler. 34 | /// 35 | /// The primary motivation is to allow a Server to manage its 36 | /// ServerPeer list when one of them throws an exception. 37 | /// 38 | class GNet::ExceptionSource 39 | { 40 | public: 41 | virtual ~ExceptionSource() ; 42 | ///< Destructor. 43 | 44 | public: 45 | ExceptionSource() = default ; 46 | ExceptionSource( const ExceptionSource & ) = delete ; 47 | ExceptionSource( ExceptionSource && ) = delete ; 48 | ExceptionSource & operator=( const ExceptionSource & ) = delete ; 49 | ExceptionSource & operator=( ExceptionSource && ) = delete ; 50 | } ; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/gnet/glistener.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file glistener.h 19 | /// 20 | 21 | #ifndef G_NET_LISTENER_H 22 | #define G_NET_LISTENER_H 23 | 24 | #include "gdef.h" 25 | #include "gaddress.h" 26 | 27 | namespace GNet 28 | { 29 | class Listener ; 30 | } 31 | 32 | //| \class GNet::Listener 33 | /// An interface for a network listener. 34 | /// \see GNet::Server, GNet::Monitor 35 | /// 36 | class GNet::Listener 37 | { 38 | public: 39 | virtual ~Listener() = default ; 40 | ///< Destructor. 41 | 42 | virtual Address address() const = 0 ; 43 | ///< Returns the listening address. 44 | } ; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/gnet/glocal_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file glocal_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "glocal.h" 23 | #include "ghostname.h" 24 | #include "gidn.h" 25 | #include "gresolver.h" 26 | 27 | std::string GNet::Local::hostname() 28 | { 29 | std::string name = G::hostname() ; 30 | if( name.empty() ) 31 | return "localhost" ; 32 | return name ; 33 | } 34 | 35 | std::string GNet::Local::canonicalName() 36 | { 37 | static std::string result ; 38 | static bool first = true ; 39 | if( first ) 40 | { 41 | first = false ; 42 | std::string name = G::Idn::encode( hostname() ) ; 43 | Location location( name.append(":0") ) ; 44 | auto pair = Resolver::resolve( location , Resolver::Config().set_with_canonical_name().set_raw() ) ; 45 | bool ok = pair.first.empty() ; 46 | if( ok && !pair.second.empty() ) 47 | result = G::Idn::encode( pair.second ) ; 48 | else 49 | result = name + ".localnet" ; 50 | } 51 | return result ; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/gnet/glocal_win32.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file glocal_win32.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "glocal.h" 23 | #include "ghostname.h" 24 | #include "gidn.h" 25 | #include "gnowide.h" 26 | 27 | std::string GNet::Local::hostname() 28 | { 29 | std::string name = G::hostname() ; // ie. GetComputerNameEx(ComputerNamePhysicalDnsHostname) 30 | if( name.empty() ) 31 | return "localhost" ; 32 | return name ; 33 | } 34 | 35 | std::string GNet::Local::canonicalName() 36 | { 37 | static std::string result ; 38 | static bool first = true ; 39 | if( first ) 40 | { 41 | first = false ; 42 | result = G::Idn::encode( G::nowide::getComputerNameEx( ComputerNameDnsFullyQualified ) ) ; 43 | if( result.empty() ) 44 | result = G::Idn::encode(hostname()) + ".localnet" ; 45 | } 46 | return result ; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/gnet/gnameservers.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gnameservers.h 19 | /// 20 | 21 | #ifndef G_NET_NAMESERVERS_H 22 | #define G_NET_NAMESERVERS_H 23 | 24 | #include "gdef.h" 25 | #include "gaddress.h" 26 | #include 27 | #include 28 | 29 | namespace GNet 30 | { 31 | std::vector
nameservers( unsigned int port = 53U ) ; 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/gnet/gnameservers_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gnameservers_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gnameservers.h" 23 | #include "gstr.h" 24 | #include "gstringview.h" 25 | #include "gstringtoken.h" 26 | #include 27 | 28 | std::vector GNet::nameservers( unsigned int port ) 29 | { 30 | std::vector result ; 31 | std::string line ; 32 | std::ifstream f( "/etc/resolv.conf" ) ; 33 | while( G::Str::readLine( f , line ) ) 34 | { 35 | std::string_view sv( line ) ; 36 | G::StringTokenView t( sv , " \t" ) ; 37 | if( t.valid() && G::Str::imatch(t(),"nameserver") ) 38 | { 39 | ++t ; 40 | if( t.valid() && GNet::Address::validStrings(G::sv_to_string(t()),"0") ) 41 | result.push_back( GNet::Address::parse( G::sv_to_string(t()) , port ) ) ; 42 | } 43 | } 44 | return result ; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/gnet/gnetdone.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gnetdone.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gnetdone.h" 23 | 24 | GNet::Done::Done() : 25 | std::runtime_error("done") 26 | { 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/gnet/gnetdone.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gnetdone.h 19 | /// 20 | 21 | #ifndef G_NET_DONE_H 22 | #define G_NET_DONE_H 23 | 24 | #include "gdef.h" 25 | #include "gexception.h" 26 | #include 27 | 28 | namespace GNet 29 | { 30 | class Done ; 31 | } 32 | 33 | //| \class GNet::Done 34 | /// An exception class that is caught separately by GNet::EventEmitter 35 | /// and GNet::TimerList so that onException() callbacks have their 36 | /// 'done' parameter set. 37 | /// \see GNet::ClientPtr 38 | /// 39 | class GNet::Done : public std::runtime_error 40 | { 41 | public: 42 | Done() ; 43 | ///< Constructor. 44 | } ; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/gnet/gsocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsocks.h 19 | /// 20 | 21 | #ifndef G_NET_SOCKS_H 22 | #define G_NET_SOCKS_H 23 | 24 | #include "gdef.h" 25 | #include "greadwrite.h" 26 | #include "glocation.h" 27 | #include "gexception.h" 28 | #include 29 | 30 | namespace GNet 31 | { 32 | class Socks ; 33 | } 34 | 35 | //| \class GNet::Socks 36 | /// Implements the SOCKS4a proxy connection protocol. 37 | /// 38 | class GNet::Socks 39 | { 40 | public: 41 | G_EXCEPTION( SocksError , tx("socks error") ) 42 | 43 | explicit Socks( const Location & ) ; 44 | ///< Constructor. 45 | 46 | bool send( G::ReadWrite & ) ; 47 | ///< Sends the connect-request pdu using the given 48 | ///< file descriptor. Returns true if fully sent. 49 | 50 | bool read( G::ReadWrite & ) ; 51 | ///< Reads the response using the given file descriptor. 52 | ///< Returns true if fully received and positive. 53 | ///< Throws if the response is negative. 54 | 55 | static std::string buildPdu( const std::string & far_host , unsigned int far_port ) ; 56 | ///< Builds a SOCKS4a connect request pdu. 57 | 58 | private: 59 | std::size_t m_request_offset {0U} ; 60 | std::string m_request ; 61 | std::string m_response ; 62 | } ; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/gpop/gpop.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gpop.h 19 | /// 20 | 21 | #ifndef G_POP_H 22 | #define G_POP_H 23 | 24 | #include "gdef.h" 25 | #include "gpopstore.h" 26 | #include "gpopserver.h" 27 | #include "gsecrets.h" 28 | #include "geventstate.h" 29 | #include "gpath.h" 30 | #include 31 | 32 | namespace GPop 33 | { 34 | bool enabled() noexcept ; 35 | ///< Returns true if pop code is built in. 36 | 37 | std::unique_ptr newStore( const G::Path & spool_dir , const Store::Config & ) ; 38 | ///< Creates a new Pop::Store. 39 | 40 | std::unique_ptr newSecrets( const std::string & path ) ; 41 | ///< Creates a new SaslServerSecrets for newStore(). 42 | 43 | std::unique_ptr newServer( GNet::EventState , Store & , 44 | const GAuth::SaslServerSecrets & , const Server::Config & ) ; 45 | ///< Creates a new server. 46 | 47 | void report( const Server * , const std::string & group = {} ) ; 48 | ///< Calls GPop::Server::report(). 49 | } 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /src/gpop/gpop_disabled.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gpop_disabled.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gpop.h" 23 | #include "gsecrets.h" 24 | 25 | bool GPop::enabled() noexcept 26 | { 27 | return false ; 28 | } 29 | 30 | std::unique_ptr GPop::newStore( const G::Path & , const Store::Config & ) 31 | { 32 | return {} ; 33 | } 34 | 35 | std::unique_ptr GPop::newSecrets( const std::string & ) 36 | { 37 | return {} ; 38 | } 39 | 40 | std::unique_ptr GPop::newServer( GNet::EventState , Store & , 41 | const GAuth::SaslServerSecrets & , const Server::Config & ) 42 | { 43 | return {} ; 44 | } 45 | 46 | void GPop::report( const Server * , const std::string & ) 47 | { 48 | } 49 | -------------------------------------------------------------------------------- /src/gpop/gpop_enabled.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gpop_enabled.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gpop.h" 23 | #include "gsecrets.h" 24 | 25 | bool GPop::enabled() noexcept 26 | { 27 | return true ; 28 | } 29 | 30 | std::unique_ptr GPop::newStore( const G::Path & spool_dir , const Store::Config & config ) 31 | { 32 | return std::make_unique( spool_dir , config ) ; 33 | } 34 | 35 | std::unique_ptr GPop::newSecrets( const std::string & path ) 36 | { 37 | return GAuth::Secrets::newServerSecrets( path , "pop-server" ) ; 38 | } 39 | 40 | std::unique_ptr GPop::newServer( GNet::EventState es , Store & store , 41 | const GAuth::SaslServerSecrets & secrets , const Server::Config & config ) 42 | { 43 | return std::make_unique( es , store , secrets , config ) ; 44 | } 45 | 46 | void GPop::report( const Server * server , const std::string & group ) 47 | { 48 | if( server ) 49 | server->report( group ) ; 50 | } 51 | -------------------------------------------------------------------------------- /src/gsmtp/gfilterfactorybase.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gfilterfactorybase.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gfilterfactorybase.h" 23 | 24 | GSmtp::FilterFactoryBase::Spec::Spec() 25 | = default ; 26 | 27 | GSmtp::FilterFactoryBase::Spec::Spec( std::string_view first_ , std::string_view second_ ) : 28 | first(G::sv_to_string(first_)) , 29 | second(G::sv_to_string(second_)) 30 | { 31 | } 32 | 33 | GSmtp::FilterFactoryBase::Spec & GSmtp::FilterFactoryBase::Spec::operator+=( const Spec & rhs ) 34 | { 35 | if( first.empty() && !second.empty() ) 36 | { 37 | ; // already in error state 38 | } 39 | else if( rhs.first.empty() ) 40 | { 41 | first.clear() ; // error state 42 | second = rhs.second ; 43 | } 44 | else 45 | { 46 | second.append(",",second.empty()?0U:1U).append(rhs.first).append(1U,':').append(rhs.second) ; 47 | } 48 | return *this ; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/gsmtp/gprotocolmessage.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gprotocolmessage.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gprotocolmessage.h" 23 | #include "gmessagestore.h" 24 | 25 | #ifndef G_LIB_SMALL 26 | void GSmtp::ProtocolMessage::addContentLine( const std::string & line ) 27 | { 28 | addContent( line.data() , line.size() ) ; 29 | addContent( "\r\n" , 2U ) ; 30 | } 31 | #endif 32 | 33 | GSmtp::ProtocolMessage::ToInfo::ToInfo( const VerifierStatus & status_in ) : 34 | status(status_in) , 35 | address_style(GStore::MessageStore::addressStyle(status_in.address)) 36 | { 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/gsmtp/gsmtpserverflowcontrol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsmtpserverflowcontrol.h 19 | /// 20 | #error not used 21 | -------------------------------------------------------------------------------- /src/gsmtp/gverifier.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gverifier.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gverifier.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/gsmtp/gverifierfactorybase.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gverifierfactorybase.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gverifierfactorybase.h" 23 | 24 | GSmtp::VerifierFactoryBase::Spec::Spec() 25 | = default ; 26 | 27 | GSmtp::VerifierFactoryBase::Spec::Spec( std::string_view first_in , std::string_view second_in ) : 28 | first(G::sv_to_string(first_in)) , 29 | second(G::sv_to_string(second_in)) 30 | { 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/gssl/empty.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/src/gssl/empty.cpp -------------------------------------------------------------------------------- /src/gssl/gssl_mbedtls_keygen.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gssl_mbedtls_keygen.h 19 | /// 20 | 21 | #ifndef GSSL_MBEDTLS_KEYGEN_H 22 | #define GSSL_MBEDTLS_KEYGEN_H 23 | 24 | #include 25 | #include 26 | 27 | namespace GSsl 28 | { 29 | namespace MbedTls 30 | { 31 | struct Error : std::runtime_error { Error( const std::string & , int ) ; } ; 32 | std::string generateKey( const std::string & issuer_name ) ; 33 | } 34 | } 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /src/gssl/gssl_use_both.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gssl_use_both.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gssl.h" 23 | #include "gssl_openssl.h" 24 | #include "gssl_mbedtls.h" 25 | #include "gtest.h" 26 | 27 | std::unique_ptr GSsl::Library::newLibraryImp( G::StringArray & library_config , Library::LogFn log_fn , bool verbose ) 28 | { 29 | if( LibraryImpBase::consume(library_config,"mbedtls") || G::Test::enabled("ssl-use-mbedtls") ) 30 | { 31 | return std::make_unique( library_config , log_fn , verbose ) ; 32 | } 33 | else 34 | { 35 | LibraryImpBase::consume( library_config , "openssl" ) ; 36 | return std::make_unique( library_config , log_fn , verbose ) ; 37 | } 38 | } 39 | 40 | std::string GSsl::Library::credit( const std::string & prefix , const std::string & eol , const std::string & eot ) 41 | { 42 | return 43 | OpenSSL::LibraryImp::credit( prefix , eol , eol ) + 44 | MbedTls::LibraryImp::credit( prefix , eol , eot ) ; 45 | } 46 | 47 | std::string GSsl::Library::ids() 48 | { 49 | return OpenSSL::LibraryImp::sid() + ", " + MbedTls::LibraryImp::sid() ; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/gssl/gssl_use_mbedtls.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gssl_use_mbedtls.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gssl.h" 23 | #include "gssl_mbedtls.h" 24 | 25 | std::unique_ptr GSsl::Library::newLibraryImp( G::StringArray & library_config , Library::LogFn log_fn , bool verbose ) 26 | { 27 | return std::make_unique( library_config , log_fn , verbose ) ; // up-cast 28 | } 29 | 30 | std::string GSsl::Library::credit( const std::string & prefix , const std::string & eol , const std::string & eot ) 31 | { 32 | return MbedTls::LibraryImp::credit( prefix , eol , eot ) ; 33 | } 34 | 35 | std::string GSsl::Library::ids() 36 | { 37 | return MbedTls::LibraryImp::sid() ; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/gssl/gssl_use_openssl.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gssl_use_openssl.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gssl.h" 23 | #include "gssl_openssl.h" 24 | 25 | std::unique_ptr GSsl::Library::newLibraryImp( G::StringArray & library_config , Library::LogFn log_fn , bool verbose ) 26 | { 27 | return std::make_unique( library_config , log_fn , verbose ) ; // up-cast 28 | } 29 | 30 | std::string GSsl::Library::credit( const std::string & prefix , const std::string & eol , const std::string & eot ) 31 | { 32 | return OpenSSL::LibraryImp::credit( prefix , eol , eot ) ; 33 | } 34 | 35 | std::string GSsl::Library::ids() 36 | { 37 | return OpenSSL::LibraryImp::sid() ; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/gssl/mbedtls-vsnprintf-fix-new.p1: -------------------------------------------------------------------------------- 1 | # 2 | # mbedtls-vsnprintf-fix.p1 3 | # 4 | # A patch for mbedtls so that it does not try to link with vsnprintf_s(). This 5 | # is a workround for building with mingw when targeting old versions of 32-bit 6 | # windows that do not provide vsnprintf_s() in the msvc run-time. A more 7 | # correct approach would be to compile everything, including the mingw run-time 8 | # with the correct value for _WIN32_WINNT, but this patch is more practical. 9 | # Note that setting MINGW_PLATFORM_C and MINGW_PLATFORM_VSNPRINTF_ALT does not 10 | # work because mbedtls_platform_win32_vsnprintf() in library/platform.c is 11 | # compiled unconditionally, even though it is never used. 12 | # 13 | diff -Naur old/platform.c new/platform.c 14 | --- old/platform.c 2022-03-17 19:15:29.904188069 +0000 15 | +++ new/platform.c 2022-03-17 19:15:44.404259786 +0000 16 | @@ -132,7 +132,7 @@ 17 | if(s == NULL || n == 0 || fmt == NULL) { 18 | return -1; 19 | 20 | -#if defined(_TRUNCATE) 21 | +#if 0 22 | ret = vsnprintf_s(s, n, _TRUNCATE, fmt, arg); 23 | #else 24 | ret = vsnprintf(s, n, fmt, arg); 25 | if (ret < 0 || (size_t) ret == n) { 26 | s[n-1] = '\0'; 27 | ret = -1; 28 | } 29 | -------------------------------------------------------------------------------- /src/gssl/mbedtls-vsnprintf-fix.p1: -------------------------------------------------------------------------------- 1 | # 2 | # mbedtls-vsnprintf-fix.p1 3 | # 4 | # A patch for mbedtls so that it does not try to link with vsnprintf_s(). This 5 | # is a workround for building with mingw when targeting old versions of 32-bit 6 | # windows that do not provide vsnprintf_s() in the msvc run-time. A more 7 | # correct approach would be to compile everything, including the mingw run-time 8 | # with the correct value for _WIN32_WINNT, but this patch is more practical. 9 | # Note that setting MINGW_PLATFORM_C and MINGW_PLATFORM_VSNPRINTF_ALT does not 10 | # work because mbedtls_platform_win32_vsnprintf() in library/platform.c is 11 | # compiled unconditionally, even though it is never used. 12 | # 13 | diff -Naur old/platform.c new/platform.c 14 | --- old/platform.c 2024-01-24 17:13:11.381268475 +0000 15 | +++ new/platform.c 2024-01-24 17:13:24.197488034 +0000 16 | @@ -121,7 +121,7 @@ 17 | return -1; 18 | } 19 | 20 | -#if defined(_TRUNCATE) 21 | +#if 0 22 | ret = vsnprintf_s(s, n, _TRUNCATE, fmt, arg); 23 | #else 24 | ret = vsnprintf(s, n, fmt, arg); 25 | -------------------------------------------------------------------------------- /src/gstore/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | if GCONFIG_WINDOWS 19 | OS_SOURCES=gfilestore_win32.cpp 20 | OS_SOURCES_EXTRA_DIST=gfilestore_unix.cpp 21 | else 22 | OS_SOURCES=gfilestore_unix.cpp 23 | OS_SOURCES_EXTRA_DIST=gfilestore_win32.cpp 24 | endif 25 | 26 | EXTRA_DIST=\ 27 | $(OS_SOURCES_EXTRA_DIST) 28 | 29 | AM_CPPFLAGS = \ 30 | -I$(top_srcdir)/src/glib \ 31 | -D "G_SPOOLDIR=$(e_spooldir)" \ 32 | -D G_LIB_SMALL 33 | 34 | noinst_LIBRARIES = libgstore.a 35 | 36 | libgstore_a_SOURCES = \ 37 | $(OS_SOURCES) \ 38 | genvelope.cpp \ 39 | genvelope.h \ 40 | gfiledelivery.cpp \ 41 | gfiledelivery.h \ 42 | gfilestore.cpp \ 43 | gfilestore.h \ 44 | gmessagedelivery.cpp \ 45 | gmessagedelivery.h \ 46 | gmessagestore.cpp \ 47 | gmessagestore.h \ 48 | gnewfile.cpp \ 49 | gnewfile.h \ 50 | gnewmessage.cpp \ 51 | gnewmessage.h \ 52 | gstoredfile.cpp \ 53 | gstoredfile.h \ 54 | gstoredmessage.cpp \ 55 | gstoredmessage.h 56 | 57 | -------------------------------------------------------------------------------- /src/gstore/gfilestore_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gfilestore_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gfilestore.h" 23 | #include "gpath.h" 24 | #include "gstrmacros.h" 25 | 26 | #ifndef G_SPOOLDIR 27 | #define G_SPOOLDIR 28 | #endif 29 | 30 | G::Path GStore::FileStore::defaultDirectory() 31 | { 32 | std::string spooldir = G_STR(G_SPOOLDIR) ; // NOLINT readability-redundant-string-init 33 | if( spooldir.empty() ) 34 | spooldir = "/var/spool/emailrelay" ; 35 | return { spooldir } ; 36 | } 37 | 38 | void GStore::FileStore::osinit() 39 | { 40 | // no-op 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/gstore/gmessagedelivery.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gmessagedelivery.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gmessagedelivery.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/gstore/gnewmessage.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gnewmessage.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gmessagestore.h" 23 | #include "gnewmessage.h" 24 | #include 25 | 26 | void GStore::NewMessage::addContentLine( const std::string & line ) 27 | { 28 | addContent( line.data() , line.size() ) ; 29 | addContent( "\r\n" , 2U ) ; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/gstore/gstoredmessage.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gstoredmessage.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gstoredmessage.h" 23 | 24 | // empty 25 | 26 | -------------------------------------------------------------------------------- /src/gui/emailrelay-gui.rc: -------------------------------------------------------------------------------- 1 | 2 | #include "windows.h" 3 | 4 | /* icon -- IDI_ICON1 is a string here (no resource.h), picked up by Qt */ 5 | IDI_ICON1 ICON DISCARDABLE "emailrelay-icon.ico" 6 | 7 | VS_VERSION_INFO VERSIONINFO 8 | FILEVERSION 2, 6, 0, 0 9 | PRODUCTVERSION 2, 6, 0, 0 10 | FILEFLAGSMASK 0x3fL 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS 0x10004L 17 | FILETYPE 0x1L 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "080904b0" 23 | BEGIN 24 | VALUE "Comments", "GPL v3 license" 25 | VALUE "CompanyName", " " 26 | VALUE "FileDescription", "E-MailRelay GUI Application" 27 | VALUE "FileVersion", "2, 6, 0, 0" 28 | VALUE "InternalName", "emailrelay" 29 | VALUE "LegalCopyright", "Copyright (C) 2001-2024 Graeme Walker " 30 | VALUE "OriginalFilename", "emailrelay-gui.exe" 31 | VALUE "ProductName", "E-MailRelay" 32 | VALUE "ProductVersion", "2, 6, 0, 0" 33 | END 34 | END 35 | BLOCK "VarFileInfo" 36 | BEGIN 37 | VALUE "Translation", 0x809, 1200 38 | END 39 | END 40 | 41 | -------------------------------------------------------------------------------- /src/gui/emailrelay.no.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/src/gui/emailrelay.no.qm -------------------------------------------------------------------------------- /src/gui/gcominit.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gcominit.h 19 | /// 20 | 21 | #ifndef G_MAIN_GUI_COM_INIT_H 22 | #define G_MAIN_GUI_COM_INIT_H 23 | 24 | #include "gdef.h" 25 | #ifdef G_WINDOWS 26 | #include 27 | struct GComInit 28 | { 29 | static void init() { (void) CoInitializeEx(0,0) ; } 30 | GComInit() { init() ; } 31 | ~GComInit() { CoUninitialize() ; } 32 | GComInit( const GComInit & ) = delete ; 33 | GComInit( GComInit && ) = delete ; 34 | GComInit & operator=( const GComInit & ) = delete ; 35 | GComInit & operator=( GComInit && ) = delete ; 36 | } ; 37 | #else 38 | struct GComInit 39 | { 40 | } ; 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/gui/guiaccess.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file guiaccess.h 19 | /// 20 | 21 | #ifndef GUI_INSTALLER_ACCESS_H 22 | #define GUI_INSTALLER_ACCESS_H 23 | 24 | #include "gdef.h" 25 | #include "gpath.h" 26 | #include "gexception.h" 27 | #include "gstringarray.h" 28 | #include 29 | 30 | namespace Gui 31 | { 32 | class Access ; 33 | } 34 | 35 | //| \class Gui::Access 36 | /// A static class for modifying file-system permissions. 37 | /// 38 | class Gui::Access 39 | { 40 | public: 41 | static bool modify( const G::Path & , bool ) ; 42 | ///< Modifies the permissions on the given path in 43 | ///< some undefined way. Returns false on error. 44 | 45 | public: 46 | Access() = delete ; 47 | } ; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/gui/guiaccess_mac.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file guiaccess_mac.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "guiaccess.h" 23 | 24 | bool Gui::Access::modify( const G::Path & , bool ) 25 | { 26 | return true ; 27 | } 28 | -------------------------------------------------------------------------------- /src/gui/guiaccess_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file guiaccess_unix.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "guiaccess.h" 23 | 24 | bool Gui::Access::modify( const G::Path & , bool ) 25 | { 26 | return true ; 27 | } 28 | -------------------------------------------------------------------------------- /src/gui/guidir.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file guidir.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "guidir.h" 23 | 24 | // empty 25 | 26 | -------------------------------------------------------------------------------- /src/gui/guilegal.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file guilegal.h 19 | /// 20 | 21 | #ifndef GUI_LEGAL_H 22 | #define GUI_LEGAL_H 23 | 24 | #include "gdef.h" 25 | #include 26 | #include 27 | 28 | namespace Gui 29 | { 30 | class Legal ; 31 | } 32 | 33 | //| \class Gui::Legal 34 | /// A static class providing warranty and copyright text. 35 | /// 36 | class Gui::Legal 37 | { 38 | public: 39 | static const char * text() ; 40 | ///< Returns the introductory legal text. 41 | 42 | static const char * license() ; 43 | ///< Returns the license text. 44 | 45 | static std::vector credits() ; 46 | ///< Returns the third-party library credits. 47 | 48 | public: 49 | Legal() = delete ; 50 | } ; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/gui/messages.mc: -------------------------------------------------------------------------------- 1 | 2 | SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS 3 | Informational=0x1:STATUS_SEVERITY_INFORMATIONAL 4 | Warning=0x2:STATUS_SEVERITY_WARNING 5 | Error=0x3:STATUS_SEVERITY_ERROR 6 | ) 7 | 8 | FacilityNames=(Application=0x0:FACILITY_APPLICATION 9 | ) 10 | 11 | MessageId=0x1 12 | SymbolicName=CATEGORY_1 13 | Language=English 14 | General 15 | . 16 | 17 | MessageIdTypedef=DWORD 18 | 19 | MessageId=1001 20 | Severity=Informational 21 | Facility=Application 22 | SymbolicName=MSG_INFO 23 | Language=English 24 | %1!S! 25 | . 26 | 27 | MessageId=1002 28 | Severity=Warning 29 | Facility=Application 30 | SymbolicName=MSG_WARNING 31 | Language=English 32 | %1!S! 33 | . 34 | 35 | MessageId=1003 36 | Severity=Error 37 | Facility=Application 38 | SymbolicName=MSG_ERROR 39 | Language=English 40 | %1!S! 41 | . 42 | 43 | MessageId=1011 44 | Severity=Informational 45 | Facility=Application 46 | SymbolicName=MSG_INFO 47 | Language=English 48 | %1 49 | . 50 | 51 | MessageId=1012 52 | Severity=Warning 53 | Facility=Application 54 | SymbolicName=MSG_WARNING 55 | Language=English 56 | %1 57 | . 58 | 59 | MessageId=1013 60 | Severity=Error 61 | Facility=Application 62 | SymbolicName=MSG_ERROR 63 | Language=English 64 | %1 65 | . 66 | 67 | -------------------------------------------------------------------------------- /src/gverifiers/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | noinst_LIBRARIES = libgverifiers.a 19 | 20 | AM_CPPFLAGS = \ 21 | -I$(top_srcdir)/src/glib \ 22 | -I$(top_srcdir)/src/gssl \ 23 | -I$(top_srcdir)/src/gnet \ 24 | -I$(top_srcdir)/src/win32 \ 25 | -I$(top_srcdir)/src/gstore \ 26 | -I$(top_srcdir)/src/gsmtp \ 27 | -DG_LIB_SMALL 28 | 29 | libgverifiers_a_SOURCES = \ 30 | gexecutableverifier.cpp \ 31 | gexecutableverifier.h \ 32 | gnetworkverifier.cpp \ 33 | gnetworkverifier.h \ 34 | ginternalverifier.cpp \ 35 | ginternalverifier.h \ 36 | guserverifier.cpp \ 37 | guserverifier.h \ 38 | gverifierfactory.cpp \ 39 | gverifierfactory.h 40 | 41 | -------------------------------------------------------------------------------- /src/gverifiers/ginternalverifier.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file ginternalverifier.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "ginternalverifier.h" 23 | #include "glog.h" 24 | 25 | GVerifiers::InternalVerifier::InternalVerifier() 26 | = default; 27 | 28 | void GVerifiers::InternalVerifier::verify( const GSmtp::Verifier::Request & request ) 29 | { 30 | // accept all addresses as if remote 31 | auto status = GSmtp::VerifierStatus::remote( request.address ) ; 32 | doneSignal().emit( request.command , status ) ; 33 | } 34 | 35 | G::Slot::Signal & GVerifiers::InternalVerifier::doneSignal() 36 | { 37 | return m_done_signal ; 38 | } 39 | 40 | void GVerifiers::InternalVerifier::cancel() 41 | { 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/emailrelay-service.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/emailrelay.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/main/icon/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | EXTRA_DIST = \ 19 | emailrelay-icon.ico \ 20 | emailrelay-icon.png \ 21 | emailrelay-icon-small.png 22 | 23 | e_icon_DATA = emailrelay-icon.png 24 | 25 | -------------------------------------------------------------------------------- /src/main/icon/emailrelay-icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/src/main/icon/emailrelay-icon-small.png -------------------------------------------------------------------------------- /src/main/icon/emailrelay-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/src/main/icon/emailrelay-icon.ico -------------------------------------------------------------------------------- /src/main/icon/emailrelay-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aclemons/emailrelay/5c5d768908acee486f8cbb95eef2330e8c52ebcf/src/main/icon/emailrelay-icon.png -------------------------------------------------------------------------------- /src/main/legal.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file legal.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "legal.h" 23 | #include 24 | #include 25 | 26 | std::string Main::Legal::copyright() 27 | { 28 | return "Copyright (C) 2001-2024 Graeme Walker" ; 29 | } 30 | 31 | std::string Main::Legal::warranty( const std::string & prefix , const std::string & eol ) 32 | { 33 | std::ostringstream ss ; 34 | ss 35 | << prefix << "This program comes with ABSOLUTELY NO WARRANTY." << eol 36 | << prefix << "This is free software, and you are welcome to " << eol 37 | << prefix << "redistribute it under certain conditions. For " << eol 38 | << prefix << "more information refer to the file named COPYING." << eol ; 39 | return ss.str() ; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/main/legal.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file legal.h 19 | /// 20 | 21 | #ifndef G_MAIN_LEGAL_H 22 | #define G_MAIN_LEGAL_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | namespace Main 28 | { 29 | class Legal ; 30 | } 31 | 32 | //| \class Main::Legal 33 | /// A static class providing warranty and copyright text. 34 | /// 35 | class Main::Legal 36 | { 37 | public: 38 | static std::string warranty( const std::string & prefix , const std::string & eol ) ; 39 | ///< Returns the warranty text. 40 | 41 | static std::string copyright() ; 42 | ///< Returns the copyright text. 43 | 44 | public: 45 | Legal() = delete ; 46 | } ; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/main/licence.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file licence.h 19 | /// 20 | #ifndef G_MAIN_LICENCE_H 21 | #define G_MAIN_LICENCE_H 22 | extern const char * licence[] ; 23 | #endif 24 | -------------------------------------------------------------------------------- /src/main/messages.mc: -------------------------------------------------------------------------------- 1 | 2 | SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS 3 | Informational=0x1:STATUS_SEVERITY_INFORMATIONAL 4 | Warning=0x2:STATUS_SEVERITY_WARNING 5 | Error=0x3:STATUS_SEVERITY_ERROR 6 | ) 7 | 8 | FacilityNames=(Application=0x0:FACILITY_APPLICATION 9 | ) 10 | 11 | MessageId=0x1 12 | SymbolicName=CATEGORY_1 13 | Language=English 14 | General 15 | . 16 | 17 | MessageIdTypedef=DWORD 18 | 19 | MessageId=1001 20 | Severity=Informational 21 | Facility=Application 22 | SymbolicName=MSG_INFO 23 | Language=English 24 | %1!S! 25 | . 26 | 27 | MessageId=1002 28 | Severity=Warning 29 | Facility=Application 30 | SymbolicName=MSG_WARNING 31 | Language=English 32 | %1!S! 33 | . 34 | 35 | MessageId=1003 36 | Severity=Error 37 | Facility=Application 38 | SymbolicName=MSG_ERROR 39 | Language=English 40 | %1!S! 41 | . 42 | 43 | MessageId=1011 44 | Severity=Informational 45 | Facility=Application 46 | SymbolicName=MSG_INFO 47 | Language=English 48 | %1 49 | . 50 | 51 | MessageId=1012 52 | Severity=Warning 53 | Facility=Application 54 | SymbolicName=MSG_WARNING 55 | Language=English 56 | %1 57 | . 58 | 59 | MessageId=1013 60 | Severity=Error 61 | Facility=Application 62 | SymbolicName=MSG_ERROR 63 | Language=English 64 | %1 65 | . 66 | -------------------------------------------------------------------------------- /src/main/news.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file news.cpp 19 | /// 20 | 21 | #include "news.h" 22 | #include "gdatetime.h" 23 | 24 | std::string Main::News::text( const std::string & eol ) 25 | { 26 | return std::string() + 27 | "Free software is a matter of liberty, not price. To understand " + 28 | "the concept, you should think of \"free\" as in \"free speech,\" " + 29 | "not as in \"free beer\". Windows is not free, even if you did not pay for it, " + 30 | "because it limits your freedoms; check out the Free Software Foundation " + 31 | "website http://www.fsf.org for more information about software freedom." + 32 | eol 33 | ; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/news.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file news.h 19 | /// 20 | 21 | #ifndef G_MAIN_NEWS_H 22 | #define G_MAIN_NEWS_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | namespace Main 28 | { 29 | class News ; 30 | } 31 | 32 | //| \class Main::News 33 | /// A static class providing some news text. 34 | /// 35 | class Main::News 36 | { 37 | public: 38 | static std::string text( const std::string & eol ) ; 39 | ///< Returns some 'news' text. 40 | 41 | public: 42 | News() = delete ; 43 | } ; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/main/options.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file options.h 19 | /// 20 | 21 | #ifndef G_MAIN_OPTIONS_H 22 | #define G_MAIN_OPTIONS_H 23 | 24 | #include "gdef.h" 25 | #include "goptions.h" 26 | #include 27 | #include 28 | #include 29 | 30 | namespace Main 31 | { 32 | class Options ; 33 | } 34 | 35 | //| \class Main::Options 36 | /// Provides the emailrelay command-line options specification string. 37 | /// \see G::OptionParser 38 | /// 39 | class Main::Options 40 | { 41 | public: 42 | static G::Options spec() ; 43 | ///< Returns an o/s-specific G::OptionParser specification. 44 | 45 | using Tag = std::pair ; 46 | 47 | static std::vector tags() ; 48 | ///< Returns an ordered list of tags to be matched 49 | ///< against each option's 'main_tag'. 50 | 51 | public: 52 | Options() = delete ; 53 | } ; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/main/output.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file output.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "output.h" 23 | 24 | // empty 25 | -------------------------------------------------------------------------------- /src/main/output.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file output.h 19 | /// 20 | 21 | #ifndef G_MAIN_OUTPUT_H 22 | #define G_MAIN_OUTPUT_H 23 | 24 | #include "gdef.h" 25 | #include "goptionsusage.h" 26 | #include 27 | 28 | namespace Main 29 | { 30 | class Output ; 31 | } 32 | 33 | //| \class Main::Output 34 | /// An abstract interface for generating output on a command-line 35 | /// or a GUI. The appropriate implementation is selected from 36 | /// main() or WinMain(). 37 | /// 38 | class Main::Output 39 | { 40 | public: 41 | virtual void output( const std::string & , bool is_error , bool ) = 0 ; 42 | ///< Outputs the given string. 43 | 44 | virtual G::OptionsUsage::Config outputLayout( bool verbose ) const = 0 ; 45 | ///< Returns a layout definition for G::Options. 46 | 47 | virtual bool outputSimple() const = 0 ; 48 | ///< Returns true if the output is just sent to stdout; 49 | ///< returns false for a fancy gui message box. 50 | 51 | virtual ~Output() = default ; 52 | ///< Destructor. 53 | } ; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/main/resource.h: -------------------------------------------------------------------------------- 1 | 2 | #define IDI_ICON1 101 3 | #define IDD_DIALOG1 101 4 | #define IDR_MENU1 102 5 | #define IDD_DIALOG2 103 6 | #define IDD_PROPPAGE_1 106 7 | #define IDC_EDIT1 1000 8 | #define IDC_LIST1 1000 9 | #define IDS_EVENTLOG_INFORMATION 1001 10 | #define IDS_EVENTLOG_WARNING 1002 11 | #define IDS_EVENTLOG_ERROR 1003 12 | #define IDM_OPEN 40001 13 | #define IDM_QUIT 40002 14 | #define IDM_CLOSE 40005 15 | 16 | -------------------------------------------------------------------------------- /src/main/servicecontrol.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file servicecontrol.h 19 | /// 20 | 21 | #ifndef G_MAIN_SERVICE_CONTROL_H 22 | #define G_MAIN_SERVICE_CONTROL_H 23 | 24 | #include "gdef.h" 25 | #include 26 | #include 27 | 28 | // this interface is used by the GUI installer via Gui::Boot and by the 29 | // service wrapper via ServiceImp (for its "--install" and "--remove" 30 | // options) -- the non-Windows implementations do nothing 31 | 32 | std::pair service_install( const std::string & commandline , const std::string & name , 33 | const std::string & display_name , const std::string & description , 34 | bool autostart = true ) ; 35 | 36 | bool service_installed( const std::string & name ) ; 37 | 38 | std::pair service_remove( const std::string & name ) ; 39 | 40 | std::pair service_start( const std::string & name ) ; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/main/servicecontrol_unix.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file servicecontrol_unix.cpp 19 | /// 20 | 21 | #include "servicecontrol.h" 22 | #include 23 | 24 | std::pair service_install( const std::string & , const std::string & , const std::string & , 25 | const std::string & , bool ) 26 | { 27 | return {{},0} ; 28 | } 29 | 30 | bool service_installed( const std::string & ) 31 | { 32 | return true ; 33 | } 34 | 35 | std::pair service_remove( const std::string & ) 36 | { 37 | return {"not implemented",1} ; 38 | } 39 | 40 | std::pair service_start( const std::string & ) 41 | { 42 | return {"not implemented",1} ; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/main/submission.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file submission.h 19 | /// 20 | 21 | #ifndef G_MAIN_SUBMISSION_H 22 | #define G_MAIN_SUBMISSION_H 23 | 24 | #include "gdef.h" 25 | #include "garg.h" 26 | 27 | namespace Main 28 | { 29 | class Submission ; 30 | } 31 | 32 | //| \class Main::Submission 33 | /// Does simple message submission from the command-line. 34 | /// 35 | class Main::Submission 36 | { 37 | public: 38 | static bool enabled( const G::Arg & ) ; 39 | ///< Returns true if the submit functionality is enabled by 40 | ///< the build and argv[0]. 41 | 42 | static int submit( const G::Arg & ) ; 43 | ///< Does message submission. Returns an exit code. 44 | } ; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/win32/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | AM_CPPFLAGS = -I$(top_srcdir)/src/glib 19 | 20 | noinst_LIBRARIES = libwin32.a 21 | 22 | if GCONFIG_WINDOWS 23 | 24 | EXTRA_DIST = empty.cpp 25 | 26 | libwin32_a_SOURCES = \ 27 | gappinst.cpp \ 28 | gappinst.h \ 29 | gappbase.cpp \ 30 | gappbase.h \ 31 | gcracker.cpp \ 32 | gcracker.h \ 33 | gdc.h \ 34 | gdc.cpp \ 35 | gdialog.cpp \ 36 | gdialog.h \ 37 | gcontrol.cpp \ 38 | gcontrol.h \ 39 | gpump.cpp \ 40 | gpump.h \ 41 | gscmap.h \ 42 | gscmap.cpp \ 43 | gsize.h \ 44 | gstack.cpp \ 45 | gstack.h \ 46 | gtray.h \ 47 | gtray.cpp \ 48 | gwinbase.cpp \ 49 | gwinbase.h \ 50 | gwindow.cpp \ 51 | gwindow.h 52 | 53 | else 54 | 55 | EXTRA_DIST = \ 56 | gappinst.cpp \ 57 | gappinst.h \ 58 | gappbase.cpp \ 59 | gappbase.h \ 60 | gcracker.cpp \ 61 | gcracker.h \ 62 | gdc.h \ 63 | gdc.cpp \ 64 | gdialog.cpp \ 65 | gdialog.h \ 66 | gcontrol.cpp \ 67 | gcontrol.h \ 68 | gpump.cpp \ 69 | gpump.h \ 70 | gscmap.h \ 71 | gscmap.cpp \ 72 | gsize.h \ 73 | gtray.h \ 74 | gtray.cpp \ 75 | gwinbase.cpp \ 76 | gwinbase.h \ 77 | gwindow.cpp \ 78 | gwindow.h 79 | 80 | libwin32_a_SOURCES = empty.cpp 81 | 82 | endif 83 | -------------------------------------------------------------------------------- /src/win32/empty.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file empty.cpp 19 | /// 20 | 21 | void this_is_empty() 22 | { 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/win32/gappinst.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gappinst.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gappinst.h" 23 | 24 | HINSTANCE GGui::ApplicationInstance::m_hinstance = 0 ; 25 | 26 | GGui::ApplicationInstance::ApplicationInstance( HINSTANCE h ) 27 | { 28 | hinstance( h ) ; 29 | } 30 | 31 | GGui::ApplicationInstance::~ApplicationInstance() 32 | = default ; 33 | 34 | void GGui::ApplicationInstance::hinstance( HINSTANCE h ) 35 | { 36 | if( h ) 37 | m_hinstance = h ; 38 | } 39 | 40 | HINSTANCE GGui::ApplicationInstance::hinstance() 41 | { 42 | return m_hinstance ; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/win32/gscmap.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gscmap.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gscmap.h" 23 | #include "glog.h" 24 | #include "gassert.h" 25 | 26 | GGui::SubClassMap::SubClassMap() 27 | { 28 | } 29 | 30 | void GGui::SubClassMap::add( HWND hwnd , SubClassMap::Proc proc , void *context ) 31 | { 32 | for( std::size_t i = 0U ; i < m_list.size() ; i++ ) 33 | { 34 | if( m_list[i].hwnd == 0 || m_list[i].hwnd == hwnd ) 35 | { 36 | m_list[i] = Slot( proc , hwnd , context ) ; 37 | return ; 38 | } 39 | } 40 | m_list.push_back( Slot(proc,hwnd,context) ) ; 41 | } 42 | 43 | GGui::SubClassMap::Proc GGui::SubClassMap::find( HWND hwnd , void **context_p ) 44 | { 45 | if( context_p != nullptr ) 46 | *context_p = nullptr ; 47 | 48 | for( std::size_t i = 0U ; i < m_list.size() ; i++ ) 49 | { 50 | if( m_list[i].hwnd == hwnd ) 51 | { 52 | if( context_p != nullptr ) 53 | *context_p = m_list[i].context ; 54 | return m_list[i].proc ; 55 | } 56 | } 57 | return 0 ; 58 | } 59 | 60 | void GGui::SubClassMap::remove( HWND hwnd ) 61 | { 62 | for( std::size_t i = 0U ; i < m_list.size() ; i++ ) 63 | { 64 | if( m_list[i].hwnd == hwnd ) 65 | m_list[i].hwnd = 0 ; 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/win32/gsize.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gsize.h 19 | /// 20 | 21 | #ifndef G_GUI_SIZE_H 22 | #define G_GUI_SIZE_H 23 | 24 | #include "gdef.h" 25 | #include 26 | 27 | namespace GGui 28 | { 29 | class Size ; 30 | } 31 | 32 | //| \class GGui::Size 33 | /// A structure representing the size of a rectangle (typically 34 | /// a GUI window). 35 | /// 36 | class GGui::Size 37 | { 38 | public: 39 | unsigned long dx ; 40 | unsigned long dy ; 41 | Size() ; 42 | Size( unsigned long dx , unsigned long dy ) ; 43 | void streamOut( std::ostream & ) const ; 44 | } ; 45 | 46 | inline 47 | GGui::Size::Size() : 48 | dx(0) , 49 | dy(0) 50 | { 51 | } 52 | 53 | inline 54 | GGui::Size::Size( unsigned long dx_ , unsigned long dy_ ) : 55 | dx(dx_) , 56 | dy(dy_) 57 | { 58 | } 59 | 60 | inline 61 | void GGui::Size::streamOut( std::ostream & s ) const 62 | { 63 | s << "(" << dx << "," << dy << ")" ; 64 | } 65 | 66 | namespace GGui 67 | { 68 | inline 69 | std::ostream & operator<<( std::ostream & stream , const Size & size ) 70 | { 71 | size.streamOut( stream ) ; 72 | return stream ; 73 | } 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/win32/gtray.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2001-2024 Graeme Walker 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | // === 17 | /// 18 | /// \file gtray.cpp 19 | /// 20 | 21 | #include "gdef.h" 22 | #include "gnowide.h" 23 | #include "gtray.h" 24 | #include "gstr.h" 25 | #include "gappinst.h" 26 | #include "gassert.h" 27 | #include 28 | 29 | GGui::Tray::Tray( unsigned int icon_id , const WindowBase & window , 30 | const std::string & tip , unsigned int message ) 31 | { 32 | m_info = G::nowide::NOTIFYICONDATA_type {} ; 33 | G_ASSERT( m_info.uVersion == 0 ) ; // winxp 34 | 35 | m_info.cbSize = sizeof(m_info) ; 36 | m_info.hWnd = window.handle() ; 37 | m_info.uID = message ; 38 | m_info.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP ; 39 | m_info.uCallbackMessage = message ; 40 | 41 | int rc = G::nowide::shellNotifyIcon( ApplicationInstance::hinstance() , NIM_ADD , &m_info , icon_id , tip ) ; 42 | if( rc == 2 ) 43 | throw IconError() ; 44 | else if( rc == 1 ) 45 | throw Error() ; 46 | } 47 | 48 | GGui::Tray::~Tray() 49 | { 50 | static_assert( noexcept(G::nowide::shellNotifyIcon(NIM_DELETE,&m_info,std::nothrow)) , "" ) ; 51 | m_info.uFlags = 0 ; 52 | m_info.uCallbackMessage = 0 ; 53 | m_info.hIcon = HNULL ; 54 | G::nowide::shellNotifyIcon( NIM_DELETE , &m_info , std::nothrow ) ; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /test/DnsServer.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # === 18 | # 19 | # DnsScanner.pm 20 | # 21 | # A wrapper for running the "emailrelay_test_dnsserver" program. 22 | # 23 | # See also: Helper 24 | # 25 | 26 | use strict ; 27 | use Helper ; 28 | 29 | package DnsServer ; 30 | 31 | sub new 32 | { 33 | my ( $classname , $port , $address ) = @_ ; 34 | return bless { h => new Helper( "emailrelay_test_dnsserver" , $port , ["--address",$address] ) } , $classname ; 35 | } 36 | 37 | sub port { return shift->{h}->port(@_) } 38 | sub logfile { return shift->{h}->logfile(@_) } 39 | sub exe { return shift->{h}->exe(@_) } 40 | sub run { return shift->{h}->run(@_) } 41 | sub pid { return shift->{h}->pid(@_) } 42 | sub kill { return shift->{h}->kill(@_) } 43 | sub cleanup { return shift->{h}->cleanup(@_) } 44 | 45 | 1 ; 46 | -------------------------------------------------------------------------------- /test/Scanner.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # === 18 | # 19 | # Scanner.pm 20 | # 21 | # A wrapper for running the "emailrelay_test_scanner" program. 22 | # 23 | # See also: Helper 24 | # 25 | 26 | use strict ; 27 | use Helper ; 28 | 29 | package Scanner ; 30 | 31 | sub new 32 | { 33 | my ( $classname , $address ) = @_ ; 34 | return bless { h => new Helper( "emailrelay_test_scanner" , $address ) } , $classname ; # "--port
" 35 | } 36 | 37 | sub port { return shift->{h}->port(@_) } 38 | sub logfile { return shift->{h}->logfile(@_) } 39 | sub exe { return shift->{h}->exe(@_) } 40 | sub run { return shift->{h}->run(@_) } 41 | sub pid { return shift->{h}->pid(@_) } 42 | sub kill { return shift->{h}->kill(@_) } 43 | sub cleanup { return shift->{h}->cleanup(@_) } 44 | 45 | 1 ; 46 | -------------------------------------------------------------------------------- /test/Verifier.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Copyright (C) 2001-2024 Graeme Walker 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # === 18 | # 19 | # Verifier.pm 20 | # 21 | # A wrapper for running the "emailrelay_test_verifier" program. 22 | # 23 | # See also: Helper 24 | # 25 | 26 | use strict ; 27 | use Helper ; 28 | 29 | package Verifier ; 30 | 31 | sub new 32 | { 33 | my ( $classname , $port ) = @_ ; 34 | return bless { h => new Helper( "emailrelay_test_verifier" , $port ) } , $classname ; 35 | } 36 | 37 | sub port { return shift->{h}->port(@_) } 38 | sub logfile { return shift->{h}->logfile(@_) } 39 | sub exe { return shift->{h}->exe(@_) } 40 | sub run { return shift->{h}->run(@_) } 41 | sub pid { return shift->{h}->pid(@_) } 42 | sub kill { return shift->{h}->kill(@_) } 43 | sub cleanup { return shift->{h}->cleanup(@_) } 44 | 45 | 1 ; 46 | -------------------------------------------------------------------------------- /test/certificates/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | ## Copyright (C) 2001-2024 Graeme Walker 3 | ## 4 | ## This program is free software: you can redistribute it and/or modify 5 | ## it under the terms of the GNU General Public License as published by 6 | ## the Free Software Foundation, either version 3 of the License, or 7 | ## (at your option) any later version. 8 | ## 9 | ## This program is distributed in the hope that it will be useful, 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ## GNU General Public License for more details. 13 | ## 14 | ## You should have received a copy of the GNU General Public License 15 | ## along with this program. If not, see . 16 | # 17 | 18 | EXTRA_DIST = \ 19 | alice.crt \ 20 | alice.key \ 21 | bob.crt \ 22 | bob.key \ 23 | carol.crt \ 24 | carol.key \ 25 | dave.crt \ 26 | dave.key \ 27 | malory.crt \ 28 | malory.key \ 29 | trent.crt \ 30 | trent.key \ 31 | trudy.crt \ 32 | trudy.key 33 | 34 | -------------------------------------------------------------------------------- /test/certificates/alice.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICnjCCAYYCCQCnfIOqHpVLXDANBgkqhkiG9w0BAQsFADAQMQ4wDAYDVQQDDAVD 3 | YXJvbDAgFw0xODA0MjQwMDA0MzJaGA8yMTAwMDYxMzAwMDQzMlowEDEOMAwGA1UE 4 | AwwFQWxpY2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDUZO27DT69 5 | n3+vbKwGWZNF1bJP5swhhkCPu2rUya8Mf160uxKUkpaUKPCHW4Xy3SiyxIWDicqf 6 | lMRkX7SYj+t1KaRXAC9bHt2iKAnf49Y0uBK5X0FnaI2n/KcKt/0/JoSU4YPDoFVi 7 | YoS80Mkyohw4A+wXJzc1TKr7FRW6jraKWE1u7jkZiBz/PKdqYxkd0aFLdXhQJAmf 8 | jNIXzaDt7+QUrlX4d/EFQESDcbwq5FKucffTqtwDWZJogVwU9UqQGqApBI4RYOMP 9 | XHSNzxlT8jhUwDSwYNoWi+tpYfJULQI8ZQV13PLz2HqohtHZ++4foQa0KvrbNYcy 10 | zM7485+M57dxAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKNPsZOOgiTe60s7wy18 11 | +p7QHY0yl+4NOwUxw29IVGBM8luOURWlXnMSs4jupC/ph8zB9UpYcCkSfXXJ6tnZ 12 | nNEwi1Jaxfua8Ol9yfrNn1Rx549Hsfx4rYu6a2fbOfwZN3VWWODh77IXELr2/AGO 13 | oubxNQplUEZ8XE7ouXQAF0K4uPLENbtVvEn+HpHeValTPFTvNV0mQFxDCAj+S+0t 14 | TBlaiguo7C+pzpGx+UaGQfnXw+4A9WJ7xLGvIE9L/ps0YM3wo8lcfsakGnGjbXZp 15 | 1dUsbt/4FgRq0VYtolWRunGFNAvJ9cn+1MkAQdJYfGQYI1KO0jfr2EWwbXA3BGMW 16 | 17s= 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /test/certificates/alice.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA1GTtuw0+vZ9/r2ysBlmTRdWyT+bMIYZAj7tq1MmvDH9etLsS 3 | lJKWlCjwh1uF8t0ossSFg4nKn5TEZF+0mI/rdSmkVwAvWx7doigJ3+PWNLgSuV9B 4 | Z2iNp/ynCrf9PyaElOGDw6BVYmKEvNDJMqIcOAPsFyc3NUyq+xUVuo62ilhNbu45 5 | GYgc/zynamMZHdGhS3V4UCQJn4zSF82g7e/kFK5V+HfxBUBEg3G8KuRSrnH306rc 6 | A1mSaIFcFPVKkBqgKQSOEWDjD1x0jc8ZU/I4VMA0sGDaFovraWHyVC0CPGUFddzy 7 | 89h6qIbR2fvuH6EGtCr62zWHMszO+POfjOe3cQIDAQABAoIBAQCsJ/buFAlT6DG1 8 | /o7dQsP16gXzb+7sCYbROieYvLVvmtooAi5IUR1OkHSOMqg7N/oiFNrnyMt9WDdr 9 | 6ItY0ecXe55iiprX8AfTxUJjwKhC6ST8LnK0H/IaRNcdAA98nXr/tl94NMCg05wl 10 | 89Hxgab/3GYESlwcjr1UcT3Ajqb1MKzFNkFvVBzV658Cmbp0uUJSJ+j1EbdOHHKE 11 | fUd0GI91G/8fo3mFN9rRAn5ADLsoqqqBGey/ysMKQkcQ89vDPSKnIWp4fgcX+j6m 12 | Q8oM7MRAQhWYrsmOqzg5mJ0+HEJNv8D2AxYCZbfmPMgSMlh3sMzub5Lm3HyCUwGo 13 | 1bIMvTPxAoGBAPv0WBGeR0bB37Eum6cMzGgUdSEDona4ro7p9QsLUv77Y1i4XYSM 14 | 6L4PTIfivNc4Xrgv1Tjj642dBzc6bucD/z2OtOxdyjEzWeFJpWSRpH7ppZxwWLqz 15 | CGrZvkbgJ5mnjDMX059fggowqneMHwQzE2+IKbsXfjJlM5/Oavp9bdE9AoGBANfN 16 | +Qk20rBSeoXoJys2buEOM3Pn2DTgIda+LUS86Y0RfQzCozwdqE8e1ahQy4zrUm/b 17 | aEV0H98h/pQVioP0ssGfE7ANsgWEAVkhRReNvxcJKDldxOJYwiICcVk8AVvAsksz 18 | Ld7J+MC/FcWZP1oiQIJrWcQqLMwRusOwfbD56LpFAoGBAK6SuebTNW24bWbV9XGE 19 | s6i17AZI/2ulQQWy41+YpBQaWNajP+DUxXrTHOLWXqP84dxbADEf8xk3IUXKDgex 20 | REwBsihIQA1hGDi6D4gkRcbN2zsOuNv7qqxmXKm9LJMRfVn1e2LlCTRITgTxKJh/ 21 | T0srHEcO2xjN+DwVCRiwicO9AoGACDtvOI7C0r8StXD5rYhSCnvEMrOxZ7L1F4AB 22 | shGSxzLXllkGaRCojvwaImWSnjmL14CDJcMcRCLD11pLAmWfPAuZcKnVFKjIdGH0 23 | hMV/eJ18z1NoY0oHfcyiDklfs+RR6NR293y05IVlizghVorf8xmtPvJs6wvyF+zv 24 | noSqABECgYAeBHRZwQGme+Tk/RBe28Q43zH+h6+YhXVQyZ6tDbwUStGXJf4u1oKc 25 | Tdyq/zwrwdklEOJPRFThYy1QEgY8NkxNN/uHWcK961LPofiiRR54xJxKv7BPfou9 26 | LmO6RW/uBYbXp0SaQqatOESu3UscIPpnjvTVbJR7wQYBhQ7T8N4fNg== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/certificates/bob.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICmzCCAYMCCQC1zxvk35bOiTANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDDARE 3 | YXZlMCAXDTE4MDQyNDAwMDQzMloYDzIxMDAwNjEzMDAwNDMyWjAOMQwwCgYDVQQD 4 | DANCb2IwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9FbYddMRP0Dvo 5 | bg9krLrUyKUmcAFB6w1m9MYfuqjLA9H8nQOlF2Vq80cC+o6k/Maj6C+v3Xe3TbTc 6 | gjMA3eO5iOFJ/lmsuPsMj1lVQNDvyoxLz4bMz3s9iFSS1q+FRKVyxIKYLWikwVuR 7 | UadZYrm0mIr8SFSyj2SeosSPmBOzhjQaR+MBzqxrCZUBA3hGM3G0TX0YLQ7C8EKo 8 | R5yUid41Zb7jPQl4o85GuRfscnJIQ1HcexzsEIiWd9ncQmcyXoZaPn5vyT3Js2cF 9 | 2L+wBd4XHX5zcf1V5Vj5ip8zA7VcE9EboH4EcdhYD+G798wsaCxnnoM3s4H5zHNb 10 | 5P+hjQzXAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAC7FXQBOsn7DxCj8sg25YT+7 11 | dygUet6Md+hS1UxQNWIear0mb5oOkTjj6SAB+Eg4wFH4D199gYG70KYsus3Qjkwp 12 | DkXtk2v7n32FRGd1hdXGFiVGwgrmZWVgBD4YhzwqC8uByr2eUkGnx9wuqSMibYAP 13 | b96wDjf7y9ohuXRlyHYfNJXf/5NEz0ESaPQqKt/Bvszkcj+VtiHtxEKpbXzbZQp4 14 | tPPV74yWmTUsRdEzno4RX2wPYJYwUyQf1IXWPWg/rzo6bNwa3z2voRULcDIODUj7 15 | xc4DF0Za+6uWP/3/fKOho+xB1W0IlcXepmGZ8FarhUcW42CQn1Unrxum0xJkiTo= 16 | -----END CERTIFICATE----- 17 | -------------------------------------------------------------------------------- /test/certificates/bob.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAvRW2HXTET9A76G4PZKy61MilJnABQesNZvTGH7qoywPR/J0D 3 | pRdlavNHAvqOpPzGo+gvr913t0203IIzAN3juYjhSf5ZrLj7DI9ZVUDQ78qMS8+G 4 | zM97PYhUktavhUSlcsSCmC1opMFbkVGnWWK5tJiK/EhUso9knqLEj5gTs4Y0Gkfj 5 | Ac6sawmVAQN4RjNxtE19GC0OwvBCqEeclIneNWW+4z0JeKPORrkX7HJySENR3Hsc 6 | 7BCIlnfZ3EJnMl6GWj5+b8k9ybNnBdi/sAXeFx1+c3H9VeVY+YqfMwO1XBPRG6B+ 7 | BHHYWA/hu/fMLGgsZ56DN7OB+cxzW+T/oY0M1wIDAQABAoIBAHfS2WzDQWB+ymgZ 8 | zwFygJc1a4r3MaTPStfyx9b1l9/HVPvrmJK3R9rFvjuCAoFFerAGBKpDA4mS4clX 9 | bPDgrF44AuS8HaHaO6WS9f6Tq5Q53Dxyj68c0LGGwmmnSOWAQgR/yW6cYBMAQYHO 10 | p+l6KcrrXDBRufLJ8e6hoUSKD/oUO+5Lc7terJE2nJQ1P4Dz1f+tlIj6fsPj6WzT 11 | lj/KBOtv+q6hnKdysrWBG2YFRQ/3zDYMog1UAX8bDj9nl7H4vRAmCzEtvi6gCWSX 12 | w2/8sp7AJMFXwpAMpElbPXGlUvNjdhIJI3ok8WJyY1hbNjx5Jnucqae44QHFVlUA 13 | AH+BL8kCgYEA39FQiop07kDj2VkeaGHDW4lPyJTwrS+wIsSLczUCVXlkCRuUuNud 14 | PHmlcjXosdxWwxROo1G0jjcO/D4eIkOioxxW+PI8Eyt9eHRq0ZqTT+hhYVJGhdQ5 15 | x1D+ykiaHEoaW0pUrm+gYBHGljM2pzREfTIWCbQ8rBmoJL5gSKwMp00CgYEA2EXj 16 | UX7pT4IImlioHqRHtMEDyBYWpweRiBBhnGeb3wW8Wem7C7YGY8qM9PH5XsAbjS+2 17 | a4yTeWayxU3GiBlUxl64oqt2Ok2lGc4esNIUW8a0jB972/UXVVY4yM9llNl/J/TE 18 | 4eMJpu2ReLAFt05nNko+VOJefTH65W+J3vXvWrMCgYEAyuZicXXbUzIYXK1h15bp 19 | F05/uYLsPNSChMJQ+PwRRZNqkKckSAEvpedRiRw9+x+Yt/js4TnsyRA40Ysunjla 20 | cyv53G0c8PP4Jv7C54mOCl7MCQIhVKl0R7CxiogOzZ6QDjpwUkJ3zR/QO9HpteK4 21 | RBbny5xNdGc9+zFq7/ao8fECgYBOILkkyJ8KDOSEtYBOSXRp9Mwj7O7T+iT1rU1F 22 | zhv97jmDla7vZRtb02EmX3+BXg7V6yWQJqFj2ti79APDSLtaSf+TLDOyjjgVYWOu 23 | 5sVZ/idc80awSBLcziAHUvzUT9nimkbBf14OQoYpvhTiil04vItV6MzPl02Wsrtw 24 | oxGLhwKBgQCBggL6UoMWWD9TnWF28Hx++zg3Ql8z0pHoGaO3EjwnS580mDbiS6BX 25 | ND4b83XFzd57VNDehxzcDtbIPCIwHZzBN3DflZ8L2MMVnHdIkvG+9w+MeYRf6nzh 26 | r+4xM4rf+GTt2rnRH+PkRSr+02nURnC4Zf7zoc6p5kEU/jtQrFIvrg== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/certificates/carol.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICtTCCAZ2gAwIBAgIJAOZMjZkzS81jMA0GCSqGSIb3DQEBCwUAMBAxDjAMBgNV 3 | BAMMBVRyZW50MCAXDTE4MDQyNDAwMDQzMloYDzIxMDAwNjEzMDAwNDMyWjAQMQ4w 4 | DAYDVQQDDAVDYXJvbDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM3T 5 | JH8wmHWSv94WX1uU0T9EMaP4cBu98+2IcsSGi2bLHs3o/R4uLXF5N7FhVQOWFiix 6 | RCwKLoEUg2ME9leQEXgepwet9B3nv2pasQU2U4Kg53Wq91n11lfapR1lInfESyVm 7 | 7it+zs/ldnVlAUAuVpVRSLm3tJN5It6yQrEcyye6OB4UCr8QmmLkBDDDzEzEyF0C 8 | wRheYRBSpdQX/47MRwEcgix5G/1rGzAyAzO8sebZaw0JSwf3hi0f4ByKX0fanHb1 9 | bJmE+1/nvgkQmnMZbEoBpBs6ItXsSTp4+re+XjZRzwItG0U3tPtf37Ftr05jMLGN 10 | /eFIummMs1UhOZPtMQMCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 11 | AQsFAAOCAQEAYgeRud3z7q5v+IZt9+SzPkQob6t07ISuxCzO3Ppq+T8P3XJKgAJU 12 | mLb1u/VGgya7WCSpF9BylLacba+pRuK7mls/0CAPtPQYnE+8Rbr1LQiZZl75V/to 13 | 2r3ALjzKjue5b7sI8vbu1T7wjqeO1gvjaDxP6Yw/OASr5y8sJP+TqQwKdS/hYi0t 14 | XBFhTYx1PXCJaYg6V7d0Ss91N+M9kCih8WHr+r9ug2A0lSPt9wLeMYI+sXOVTwmD 15 | DUHxbXCBmLiBdcdQA9fcHCZ9PuylDFMlBQXkOoTDqS8VOuU4lUcDXG9EUGcYq2F5 16 | u3sM0iPO7Xbu+CqGrHMEbf/m0jJv0rFnBQ== 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /test/certificates/carol.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAzdMkfzCYdZK/3hZfW5TRP0Qxo/hwG73z7YhyxIaLZssezej9 3 | Hi4tcXk3sWFVA5YWKLFELAougRSDYwT2V5AReB6nB630Hee/alqxBTZTgqDndar3 4 | WfXWV9qlHWUid8RLJWbuK37Oz+V2dWUBQC5WlVFIube0k3ki3rJCsRzLJ7o4HhQK 5 | vxCaYuQEMMPMTMTIXQLBGF5hEFKl1Bf/jsxHARyCLHkb/WsbMDIDM7yx5tlrDQlL 6 | B/eGLR/gHIpfR9qcdvVsmYT7X+e+CRCacxlsSgGkGzoi1exJOnj6t75eNlHPAi0b 7 | RTe0+1/fsW2vTmMwsY394Ui6aYyzVSE5k+0xAwIDAQABAoIBAGEkPP52ng4no7ya 8 | zIi5tQRqGA+uiqLdRQofsyMD6Tkrtq8yPnyHCNWcg2eJa4lUxcKQ3371kztCxjvu 9 | tKFhEo2h0e1y8VtH7HSytwehu0pUzMkhVrqzp2UxgWpdOCZUk67kZJZMtCk0wHLp 10 | p+x1slGo2m0kweo0avu2IHndABkQFvlhMtRPIHkD66hlOTJdqhdcq7Ii2ogcMDVv 11 | SVt16Ytn/Ybr5e8ptPlDoVquSiKDtQbhQ0NLgjXpBWFgx2HBrGy08ScSyWj52z2m 12 | 2fAPSH5o/OKeK629bU2AJYTEET0opOD03PnU4+b0XDkCS10cx4E2lAgBJSOxh8d2 13 | GkBnwSECgYEA67lqSmO0QRt67ikED6Y3BKnRHTpTzW36AKU7TUz1lMCO+IPxuNmL 14 | gJc9T7Uu3hcicC9+58WrkbU3jFA0CC8TotwctHop3N94ffF5pa4TkaEsnF6l4KVk 15 | F3f2m/E0oBuiDADHY2qq1YMX0ixHRBoqKsEZBBa+mRZ9fApKjQ3fUfMCgYEA34dZ 16 | MdLEFolDY616cxWVf8qLOWzQfryAlb4EMYS+WMn6wTo1QsluVK2PL1dTj/y5PkOl 17 | K1SD3/9GnFR78TmxP2wStrchcdCU9Mv3dp7CQ4ZuW6N+HdLMyADiqr8Ch5OudkcH 18 | kL/1g8akHFcajBVGmYzsWHHMMSAnS/E2poK+WLECgYEAkqGZA8M3upRciM+MzitH 19 | 6Ce2g+bngE9cB5DA7dnkne6WQPLap3DzvT7XDcEX8WEUtBJnb8dfbVj7v9WYOEsI 20 | fPNNC9s+NT3xlu5iDHTXiWxn8rFRoAdh1tNx3RlS8hGeYLcPUMFmmUBdzghrIGri 21 | Ngw+AnQfhd0em81PCKVLeI8CgYBuy0OmsnWHRhok+gPLr1MeuGIx4IGnj/+cOUcS 22 | 1F0U3WhxBk0IAZeyWSSzrnE42WdoOVdRFt8W1A1Hx4h3lMUKTqMn9bWaGGz8uWy7 23 | Ww2nMqbYvTzxw17Fc8rmHy89zDGZZrOVR9CFtJv7gCEkdhc8XOF5JU60ut8/gRw5 24 | hGycwQKBgHxXXy4OJT5dxIh7NOARRfQ9mhe0qg7wjC5A6NpshGKm0y3wQltmgGZW 25 | P0Gfh+M0mHK+dfE3uc5b5Gna7BMzF4uRe5yho8VroxkmvDVHSGY72x2/ddT1IaYl 26 | Za8dBHoyxqLRjyLnccFxl1H0LtawCSBZ1U4z7Q3pmj2oDLAv30vd 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/certificates/dave.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICtDCCAZygAwIBAgIJAOZMjZkzS81kMA0GCSqGSIb3DQEBCwUAMBAxDjAMBgNV 3 | BAMMBVRyZW50MCAXDTE4MDQyNDAwMDQzMloYDzIxMDAwNjEzMDAwNDMyWjAPMQ0w 4 | CwYDVQQDDAREYXZlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxKH4 5 | bbFXXQCvuHRjzF/RakocXli+yrXCCqTlej2KU/psZIHlpQt3378IipgSrQ9K9aTx 6 | aQnWphwA7GdokfAEjqblHzMkTMY+0NUEbVYEHGWAtVJNtLTFw71S8CPpB60uwdhI 7 | sYoNTd2XqFX+34qSugBaNL6SPo0+UCzuGmYijROs8Zk1mYaf9d8OMKZeIuFzVQCd 8 | 983ZEvZO7O6MJ8r1mYXkUSnfJTTY5dx07aerXHNjStKA06djrUXegIn1u5j/23SA 9 | xbLVJ01E+U9yXaTDprDsOQsFE304YMQzaHU7FDr6vCKB487d/jN8Takh+iUZ0IyJ 10 | HSTmV6bFYCDwnjhlywIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEB 11 | CwUAA4IBAQBqJTw4iQgKLEhFojquoTr//FrpYv0pJjpkySgU5ZhblRUBl/YN9Zxn 12 | 1pQ39iU7ugFbpIKZ9TYqf5XlNF9xNBSuHWbifetxEGA40SZ89LJpv5ZIcpBXo/Xv 13 | uS/zwi53ldIGb6aayHNHuNdR07k2HAf4OuJLmBLvEZSDu1QJH2IQj00NtvVXnbAG 14 | BhOvCmJcf7LhPyYVWy6M+DRcZ2pXCfMW6wcQLykD2+6NHs5I8yAkhcOp0ikHWTs7 15 | jTUq1uH+2WiEDzlZetWfzwPPa0zcV4MKi9j894jYZFhegy1cbCSm3AOXkJOS8md2 16 | 4nj7/iCZWx3JNkWzZQ382lvQwki64Bbw 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /test/certificates/dave.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAxKH4bbFXXQCvuHRjzF/RakocXli+yrXCCqTlej2KU/psZIHl 3 | pQt3378IipgSrQ9K9aTxaQnWphwA7GdokfAEjqblHzMkTMY+0NUEbVYEHGWAtVJN 4 | tLTFw71S8CPpB60uwdhIsYoNTd2XqFX+34qSugBaNL6SPo0+UCzuGmYijROs8Zk1 5 | mYaf9d8OMKZeIuFzVQCd983ZEvZO7O6MJ8r1mYXkUSnfJTTY5dx07aerXHNjStKA 6 | 06djrUXegIn1u5j/23SAxbLVJ01E+U9yXaTDprDsOQsFE304YMQzaHU7FDr6vCKB 7 | 487d/jN8Takh+iUZ0IyJHSTmV6bFYCDwnjhlywIDAQABAoIBAQCEqaKqn1OJ88Sa 8 | diw+3way531sSgOvUCGyfL42Uv7Y2cP3q4v8ZlhiJMjmeONgz0iLotUdQP4I5Cvb 9 | U4lBrOXmOMOs4RxEkBwhWRa7jaUIY5MKwpSarrwe68ThL9kwzK8XKY0h+zoupqqD 10 | cEGdICkORN6XZ1vTyAeaoDWkqfP1qXntVmqqkJNNdfs4Bjyh3T6U1aEF7sVX3WJf 11 | bCr8v9Xdl86ntiYH0BWfa8kYnRWs+QPV5xAarkbQRhKVfvj69j/+JatBU98mia6Y 12 | milUiUtXeaRoQVrcXf+CVp7zWEhxG6lDj4KVnOrqQz1/OsWe+oP3DgpCj7AVuwv9 13 | ZN/o33qBAoGBAOGEhfOjLWH6/TLjLdO+cD4DCJNhxY2OJvCB8aGqFqbghl3bsgTr 14 | HBaLPsLAaK/ze3E3mjt6pwV437fTIDTr/c4c2DTUXjeEyAIVskZ4Ohm94NieYQKz 15 | jJWTo9lMGa/6akkff52CxJ5xl5koljl6URYORb3Rfd22f+I4eVM2X54DAoGBAN81 16 | 9Gjo/X+T6OSfxQf1xwh45eWmYkWk8GFydB/v0NMFnyi2v7RxdS243XkWYBwBjEBb 17 | 4Ecwts5lPH6dYMa6fVkunwVz0EhBtgEmigfqIDs0a948GHW4T1V+lO1YNHmtXGAY 18 | t8rUAR7aevTezsrkVm3pLA+cd1tqM1ZAtTOg0lKZAoGAAgmAbEL9FfV+dAc5UsBV 19 | oznDyhEIB89Q6rtBw4QV0EwW6qIhaYn2Jv37AydZyr0YUF2ANylUeOgunSp7D/9R 20 | u5rnGRMSBs5cQCiSA7DyVWkxrsM/fRbCHlfHEx9s2/oXG7H9JR8ZR5UfGXMUaFCC 21 | iwB2ANDzoh0T6qc38Vh8ZKECgYBdQLlfqxddWXoPKgCzFqeUjo3dp+melw4maB7D 22 | yPlBcDPSWqc0x8Hg3D8K+6IjkTH7IWdN1rhI+lqPu0hXPkpoG+Yr7PqzdWCIkoVQ 23 | USwuD/SQ4CKH6/yZB01I63Tg8OCK9Uiz4GancTe1XfCfK05AlQ3nZ8Ml2fSgsGAD 24 | tcio4QKBgDP7Fkm8g0AL2A7146S4JFxwv8N4xD69unjrBPtxliCOx8qkNqTkJFfq 25 | twbnQO/vThflnbki9vEc1x2pPIkXN0I1Q1SWnNmDYDCsq2qVSmOeJXChfRcsdSYy 26 | 1dTPD3uyH1Nui18x1Tk/LCx2PwgkzLPm0/+PLWJaC5KuMbkEfLjy 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/certificates/malory.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICnjCCAYYCCQDsYVGPcDOTMjANBgkqhkiG9w0BAQsFADAQMQ4wDAYDVQQDDAVU 3 | cnVkeTAgFw0xODA0MjQwMDA0MzJaGA8yMTAwMDYxMzAwMDQzMlowEDEOMAwGA1UE 4 | AwwFQWxpY2UwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDC9VDfqeKy 5 | L7G71Qn5Ue7dknfCfK8Y+XAGDqA0fOr1DyOluR8+tWbSP3d+N1arbmo9iI/HvkEP 6 | QBjj4xLh5lDbsDgKIRrGCrYY4iDGnNebz6anhmoMsSRk+0JJsoyY0CRAtvZPEPl+ 7 | GpLY8N1Krah8CXV9HrqALlX5t9wO4vyu82G8lzKBJdGOpR5udxEGZnoY6nv3ecto 8 | i8ZZMX/9J+xinW+hgAViU2Y1lQ7nxU8TxSyn7JkDrGSmSu/uUmRGnjido9D6gNOj 9 | XUcRkkAYRD+5SBRVL8VE2ZAsQgGcYpQgwwA//RY4b4JoTKsM6MErNijv9A3eYV8u 10 | M2IZZ8qTBpwxAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAJO/RPr3d9Yf6Z1FSI5Q 11 | LL/aAg0yvkOfJOUY6BsoKctHqH5HYSF3Fv0KeUEcG5vHgRfN9sKoJ8KPcCs/MyLr 12 | TDOIOAoBdME0y6MsyFHvKw9P9ui3pObqSiMoefTMSjhYHFThkpuRR0fkCcGeuvtF 13 | WPKHh/CX1f7Qr4oCkH2PbVIm0Wbo11HnS5nEeMRb9uWJtqYSvg7HsQxDsHmjfvFd 14 | 7NxPAjzWY4BccNb/dM/Zq1FL4RgR/MxQljTZPwQoi9EO+kFKHFnOH+hTnEwebE/G 15 | bonuXjjnTKMcZhmmG8XFdbsdtBOiWxmzSwDdR3iH78VZoVvDlZl/3uIVl4ivDb73 16 | Srg= 17 | -----END CERTIFICATE----- 18 | -------------------------------------------------------------------------------- /test/certificates/malory.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAwvVQ36nisi+xu9UJ+VHu3ZJ3wnyvGPlwBg6gNHzq9Q8jpbkf 3 | PrVm0j93fjdWq25qPYiPx75BD0AY4+MS4eZQ27A4CiEaxgq2GOIgxpzXm8+mp4Zq 4 | DLEkZPtCSbKMmNAkQLb2TxD5fhqS2PDdSq2ofAl1fR66gC5V+bfcDuL8rvNhvJcy 5 | gSXRjqUebncRBmZ6GOp793nLaIvGWTF//SfsYp1voYAFYlNmNZUO58VPE8Usp+yZ 6 | A6xkpkrv7lJkRp44naPQ+oDTo11HEZJAGEQ/uUgUVS/FRNmQLEIBnGKUIMMAP/0W 7 | OG+CaEyrDOjBKzYo7/QN3mFfLjNiGWfKkwacMQIDAQABAoIBADGXs6XhkkAfb8fH 8 | Do10cR2952b6zpO8x+lSiSAw8pe57Sh36eHKxUgQSvY5X3umT7Itbd2yoNwfQvWd 9 | Sq1aKBFqRycUeroL+Xxk8U90kEgbT1poD8wAt7BUVe1nVOp+b+piYE+GkuCoI9i5 10 | lKEtgaFjypY0Xd7Daq1mPr0usnZSEy/knirmXaebpSnF6jbifPvtIrzQHYUvQkvc 11 | kVHpjn7MacAbfdZMKZBKwX8mjvj9fkxyu5J2254jmY8//DN8klcY96/tak09zzOE 12 | vJaMncuyhIfvVCHHmDq+4CZsUXqsRQlGY99z0CyJt6wSLe893UIjGejhGXw0VNnd 13 | vDwx6gECgYEA6fsRYwQKIhXlk21mGNoAFcUs/H4cH4JN3weKyw/ehxbK4Y6urFw+ 14 | 9SYwb/JxLDEsj56Z7V1PWRoM4uYoIWSmytvSwJ/7YvTNNU8h/+pCveS2IupGnDny 15 | 2yqb0tB39NGG9g6Q2kh7eWr7Tcz37qnuG28Sc1e+NBUw4fOUmvqWxeECgYEA1U4k 16 | AdVGLq5lwopZCQ2CHIv42qS7yIiijgmKnil0FEHP0CxSBD8YwkF2zkGZ4aEIwQBH 17 | G2xXhAQIAJx3DLrrcDgZaMpbg8ZRGlqWNYiaar7WJqJ0o04yBzOxWSTSEc3VU/R3 18 | 3yijGW4vp5N6y8HbR0m/Z7KlxfVXMCfANE+SAFECgYBsLHoWV/jDV3JDHZHVLXxa 19 | lEU/GqKv4pNT6G2/gb+0ntH/Q/L3ltI4joZYSzMNZlKet4mclsYngIaypAurnJgM 20 | M2MVUSFs15bD7ajfYxOmLUYTkFJCyfvAXcuaxGyhD/mgao2HjXkgYlh62KdLfN6r 21 | akeScd9qvt1RqUZr/CyWoQKBgEuZ0nFD4ggRj8ePuVbYDtGHWsBDurqsktC82QCN 22 | uLKlUL57tuYCZwgSo8UewyeRJ8UgEBPMJoiH1T5CNn+wkFnJyFe3wQ/Hbl9k0/BN 23 | Zk2HLeerlKN8x4Z979Gklz/wMDf9Ya8afBQ7VXCTeOZW4x01Kj3at56eAjTzIdBo 24 | k1rBAoGBAJ9ut2tDnDnsUFAYgoWpgGreXDK5cu8Xber5dIoiqCCt3qsNoFpJdYAC 25 | lmmjuTMTyUk9XkENj+vz1lm8nsH6XKU05Owjh1JaM86ycy1hWYrqKJ7DOTjjYfiI 26 | Re3RXWDyrv5pRAWZU1ahZzmOD8AtXoy4/1k8kLSe7kVIYF+qForl 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /test/certificates/trent.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC9TCCAd2gAwIBAgIJAJSGYYWPWQ68MA0GCSqGSIb3DQEBCwUAMBAxDjAMBgNV 3 | BAMMBVRyZW50MCAXDTE4MDQyNDAwMDQzMVoYDzIxMDAwNjEzMDAwNDMxWjAQMQ4w 4 | DAYDVQQDDAVUcmVudDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALh1 5 | oqol1Z1GbuId3silm6l8Mod431xfY5fLGDqATf2SqeKU9sut4QJahJpkQITKAU98 6 | cMedCidGN3WW/ExnyKnHYttbeQi+BTRKiM6j4KbstfVOID+wRV+QcBrbgXDKwPyT 7 | mgfumpGwEo50n+DVBrGwo07YYguqdK/mp52oehOZlaV6CIPfADNuqUVjIMDXy4Y8 8 | WIg7Bq5J/M2BsN7ppwRyv4NMnPMVWsl4c01NWuqLhnvMaGmtfFKFXTYJKE4hkX3h 9 | sItooPXsB9btihdJlRqpOHUXmW3EUqwVZNRBqqkVG9GeuRxGfaw516h2Uzy2sGuE 10 | 6Q1X2tsTT4Qx8IZWIgcCAwEAAaNQME4wHQYDVR0OBBYEFJUudrHQGM4ZLmyMSCQo 11 | gcNwKbFbMB8GA1UdIwQYMBaAFJUudrHQGM4ZLmyMSCQogcNwKbFbMAwGA1UdEwQF 12 | MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAKw7HeFuOcnjKsdBttj5npStuO/0x+7U 13 | NwNP0SqE/r5vgbfrtc8zovFziIv/+IgWexIkKj8Hlq7ztY/4q4nNbAQ+nwBVrQOI 14 | ZeYLqfINWpd47s04HrX4JmV3Q3ryZyHfC8QHu296X4G0jYqc0X5AoiDXo4R9bn4o 15 | /TpE0jVQPUnBIYL2fonuJBUvqkEyH7lEab8WOfJmzm/Rrax9wW1EqaS8BnaTabxP 16 | 7SI91Lt/3CRlwKCKD2nCee0TjitqPATij14ELOCF6WQ8aITil6/akv0/7v61GhSD 17 | 04826qlzdu1kCvtw4s4MQn8854RrSZBGqo60KSpG0JnRHwnOF8a5m/Y= 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /test/certificates/trent.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC4daKqJdWdRm7i 3 | Hd7IpZupfDKHeN9cX2OXyxg6gE39kqnilPbLreECWoSaZECEygFPfHDHnQonRjd1 4 | lvxMZ8ipx2LbW3kIvgU0SojOo+Cm7LX1TiA/sEVfkHAa24FwysD8k5oH7pqRsBKO 5 | dJ/g1QaxsKNO2GILqnSv5qedqHoTmZWlegiD3wAzbqlFYyDA18uGPFiIOwauSfzN 6 | gbDe6acEcr+DTJzzFVrJeHNNTVrqi4Z7zGhprXxShV02CShOIZF94bCLaKD17AfW 7 | 7YoXSZUaqTh1F5ltxFKsFWTUQaqpFRvRnrkcRn2sOdeodlM8trBrhOkNV9rbE0+E 8 | MfCGViIHAgMBAAECggEACJzVf4RMuQ801jH22P+CiSNXaKPoKfP6PngpJXIgMhrK 9 | +91guJnhy65WSq8rpAeakA+LZIaclsDcjg0Csr6Vy/eXUg6vVA0rSQnB4YQdVS3w 10 | QQfo0ZB1bMTdtyNQo+eTozdxFbW6WdsSwrwHSwQnT9yjg2bvDQRkdmIaqW3YZVnO 11 | Gus25sVVVtAi13Oxr+79HRKw9EFHnN57wd/Z/og1JjNHcvbrQI4W2eMGSX1z0CtD 12 | TwhO/9o1br3Xtc0nmua/kIa62PufINqcgtzP0fBY2NPlHiV8L5RxMy/bnlxV/L8i 13 | kXwUI9QjMRvnCnlSLJzXc2lvH6acLmDAmU6cC+FcIQKBgQDrpSDGf6bhc7Dha5Hy 14 | Pnp5zc88ZTt9TgndXIYnrZ2gP9/fNfnvtwKWC4l+nudKbi5NjA7qVp1SrsZ2elYs 15 | 1HevyJdBKtzfxORjMJwY1xoIl9rV21hXg+4b8FeBXfH1XNg+gzO3ElJcbDO3sbTZ 16 | dJtODlYkTAipKi7WRzRdM4G/+wKBgQDIZKFjUH9jrDVxjE2SmRBDqQyQWFqR5ZjA 17 | CfItTTj6hPTJsYRaSa5tEW/HIIhsYFTmbEIsvkxKWtrOVY+6NzU4cNUHU/UoOJS/ 18 | TDBsVexjQHw8R+CGwqGcKRSpDJGab52iBeoJEvc5PWwtfD8/DsxnXMYmC3RabzmO 19 | 0U1w+17sZQKBgQDTyrN9lQfRhGDLChq/piYASdlkB/yC79vv6BPvn5yXhjFZdjLw 20 | oAUkBLSMaJerDwJw0lwphLWbtdhMbkH7wu7bwCcp/DNOr7Ex8WOq89HDPXEDW0S4 21 | S6x70fVkIaKxi8QT02pstXvu85U8Ge1YsPRRIJONxgTWvkIgdxj6V6vbdwKBgQCL 22 | njkndeVbr5cIxsUhV42SZoy/YR+xOPNlEUjvMTd6q/nVMN5S/bUOfrCPX2ZNhAyD 23 | AnhUrj1/LK/4RHrANkjZSxvRYDiVzl4srkuqn270c/BbG4UevypUH/cqFPy5Sfzc 24 | 7xvxOIqREe91/XQfXhMiDOxtg1uMyqOiksdO6YRoVQKBgQCIMINO4zhIBYEHRka7 25 | J+JE4iaXVgvqvSFETN1IvrzCR4oDVrwEw2OaSyBiOMo0htgTDdyYGgHVEWKtCB7s 26 | OIK1ZAwDlDQPrs+Mvp83tnJ8aW0flZSLjkZ6YNNja8Pzaiase4x9i9nzFfWQwv3y 27 | 8Dw1cQtAToKQZnuFOhw5EGhNbg== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /test/certificates/trudy.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC9TCCAd2gAwIBAgIJAPVxSKZSUopuMA0GCSqGSIb3DQEBCwUAMBAxDjAMBgNV 3 | BAMMBVRydWR5MCAXDTE4MDQyNDAwMDQzMVoYDzIxMDAwNjEzMDAwNDMxWjAQMQ4w 4 | DAYDVQQDDAVUcnVkeTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJaw 5 | IVOJPyLsrkM1aZmewm8jtdN0mRmHWJEfOS9eoptGUvcvCyCLmF3bfq2RR+3SlsJW 6 | ibzZRoIoB4wcQdyda/whv49TPFPuMumHk0x73kQEonWBogC40IjbfIKO6L7aJj6P 7 | wZRdL0KIIUNfYIA72CSG9Rz66eH1Ap1cHnAFHiPd0bJ8MMVn/yIJ02kWKB4m15rk 8 | 6x+mVF7RDqZSZR56uMm0TejLAcfJU3XZGLA+MA0ZCft51//2PlTJovs+E63TRkez 9 | 1SHq5NBay13UUFdkYhTIDwayu3NgvF67ubnlQxDVm898hwyAbo8HKlFRFtgEhESK 10 | rdtDA+NS4192MWuIccsCAwEAAaNQME4wHQYDVR0OBBYEFBimtkGmEv8gpiF5Utxi 11 | mYeGf+IsMB8GA1UdIwQYMBaAFBimtkGmEv8gpiF5UtximYeGf+IsMAwGA1UdEwQF 12 | MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFQtnEoK5NKDzYTter0iPesl10jS8OUi 13 | /YeGQ9qLetHP4LnI6Llf9UXPsVvd0UTsMe0hGXnIMCs1QF8Pl1inE9xBoDthXIcY 14 | BNKtrju1t6XiFWViP5DTis5QpKzcUNtvn3IkfkLDqAv2WN33ms/ido/h84EVCADQ 15 | hRjBzH4BfdwSkMTpAIw81AjCs/6vAHNp6zD8oynvg4a1yO/jBHToHpGhNxvl/Jsw 16 | TA/W2BXuUQ81w0J5mnPEMYU5GB6FYha2uYaZDYUdgKha4sDMq0tF844lDfvMl/pf 17 | svyXQ0iMCxqKrfrD9eLK9d3lFfS9UvKQc+dyzrYFXJGoREKbdpQKfn0= 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /test/certificates/trudy.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCWsCFTiT8i7K5D 3 | NWmZnsJvI7XTdJkZh1iRHzkvXqKbRlL3Lwsgi5hd236tkUft0pbCVom82UaCKAeM 4 | HEHcnWv8Ib+PUzxT7jLph5NMe95EBKJ1gaIAuNCI23yCjui+2iY+j8GUXS9CiCFD 5 | X2CAO9gkhvUc+unh9QKdXB5wBR4j3dGyfDDFZ/8iCdNpFigeJtea5OsfplRe0Q6m 6 | UmUeerjJtE3oywHHyVN12RiwPjANGQn7edf/9j5UyaL7PhOt00ZHs9Uh6uTQWstd 7 | 1FBXZGIUyA8GsrtzYLxeu7m55UMQ1ZvPfIcMgG6PBypRURbYBIREiq3bQwPjUuNf 8 | djFriHHLAgMBAAECggEAKu86P6P+UkQfjtS8JuIeQi5pkztImAaBTLAZyg5rxFQw 9 | NW+4+ufrXOq6WFfpp7B19h9UFXPO7CzdoaU3etV7vBYdj4fGy5818GYJqSQt+zFa 10 | 3KI3936xJB1th4GSfTaI6RBqtowqeAlzeM/HHiJu/lFZq40ucIwv14g0v/QlV1Bf 11 | jPVy7W7aXVr0vnupMtLfkn4lVD6gp+1rB5hwS/DwiBjcqVwp8DERHc6KTAI+xVGr 12 | xUSbkEXP0HdH7BbHsEGSXvJmEpaAKhx29W/4pPbMIGvw75XfReXC2be+pmHJJomf 13 | S1xjxL7infqtWL6UW/E8+AZIRPgAhjSsboUGCwIM6QKBgQDHIXs5AvgjtZyJ8ms9 14 | 77kqkYPUjhSUZ6UhppjVKFm9e0zdajQFQEqZZllvSabrLZMsGC7GmYb/jvjqttI+ 15 | tcEcKil5bArkpti6Y/LIsVM2MLs/9k7b1KPWC/tsDeU3Dj2QF6DpOYNFacH2SAUa 16 | un9Nv1cQUOj3Ec5YLzC91rgV5wKBgQDBuPsoD2flBHZcg5AW4b/cGMdu2nNJ1fA8 17 | D+xYJPGpycyQo/p1nyFfqTO8gSOXFQMI08hOyyPv3rXwhssr+Eln3sRnkciL/fUo 18 | YTmj/MZCwWek28n1F68Ocd0oOqgbJCF8tpZThB9D7B/hlK8FlN5Fn+6VVrCsq3+L 19 | bsRsIvRAfQKBgHZLwJ000167ZBxbJDRuNi1AtvVN1pH3JJViGAcBapZzKk2a6v53 20 | nBmXQOgo8/1gXL7kOt2GlTk6oUsmgq34YZkuvubANZRyPew0tiVdmpZlyseLtntH 21 | znC5O4qMkq/rSM1SDCihHwfcdPqu/EFNq5TvZ3Rs7IjiThf7KNSOO1vfAoGAMAZi 22 | xTikggMMML0w4GtQvAiskE+5mwldiBZOej+WZYgwnX75XWV4yZVRzR6aqx67ZNnT 23 | 46y6mQG2Sw2vmpPv5r80I5ThicsIlt0bhArrP6tgvV77fzZC4Krbr9hyyl+3qYo+ 24 | VDAB7D3CXZMVnKWeQNZ4OC+IlxXhBbkNGt3DfaUCgYApyoXqSnh5QlrVAVblHsBu 25 | kJ94MBzfpcBtSt/TEYX+fAmSWtQdwZeqWFj7bmJ9B+uTflkFbZUmFP0UhnvQQ5QO 26 | L0F1ndRQQVo+BeGCn25fukHd9IaObzd00JOEStfFMNaE8Gdoz/CbSUJd8brFgH0V 27 | QmFl6Wg3omZEAco4U2JtbQ== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /winbuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | runperl winbuild.pl winbuild.ok %1 %2 %3 %4 3 | pause 4 | --------------------------------------------------------------------------------