From: David Levine Date: Sun, 13 Mar 2016 14:42:39 +0000 (-0400) Subject: Merge branch 'master' into xoauth X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/012d05c2b62332eb400d66b806e48216d39358c6?ds=inline;hp=-c Merge branch 'master' into xoauth --- 012d05c2b62332eb400d66b806e48216d39358c6 diff --combined .gitignore index 27038108,1359f96b..f251aef7 --- a/.gitignore +++ b/.gitignore @@@ -22,6 -22,8 +22,8 @@@ /ylwrap /nmh-*.tar.gz /nmh-*.tar.gz.sig + /sbr/icalendar.c + /sbr/icalparse.[hc] # Removed by maintainer-clean: /autom4te.cache/ @@@ -78,9 -80,9 +80,10 @@@ a.out.dSYM /uip/mark /uip/mhbuild /uip/mhfixmsg + /uip/mhical /uip/mhl /uip/mhlist +/uip/mhlogin /uip/mhn /uip/mhparam /uip/mhpath @@@ -111,7 -113,6 +114,7 @@@ /uip/whatnow /uip/whom /uip/*.exe +/test/fakehttp /test/fakepop /test/fakesmtp /test/getcanon diff --combined MACHINES index e045bdc5,d930dc23..1f8b0c16 --- a/MACHINES +++ b/MACHINES @@@ -22,9 -22,10 +22,10 @@@ the exceptions noted below), using an A On all platforms, the following programs are required to build nmh from a snapshot of the source code repository: - autoconf - automake - flex + autoconf 2.68 or later + automake 1.12 or later + flex 2.5.4 or later + bison 2.3 or later, Berkeley yacc 1.9 or later, or Solaris yacc 4.0 They are not required if building from an nmh distribution (.tar.gz) file. Platform-specific notes follow. @@@ -39,7 -40,6 +40,7 @@@ Run-time package requirements readline (if you want readline support) cyrus-sasl-lib / libsasl2 (if configured with --with-cyrus-sasl) openssl-libs / libssl (if configured with --with-tls) + libcurl (if configured with --with-oauth) Additional build-time package requirements: ncurses-devel / libncurses5-devel @@@ -47,7 -47,6 +48,7 @@@ readline-devel (if you want readline support) cyrus-sasl-devel / libsasl2-dev (if configuring with --with-cyrus-sasl) openssl-devel / libssl-dev (if configuring with --with-tls) + libcurl-devel / libcurl-dev (if configured with --with-oauth) Test suite package requirements: ncurses (tput is needed to run test/format/test-curses) @@@ -76,7 -75,6 +77,7 @@@ or in the shell environment before call Additional build-time package requirements: devel/autotools + ftp/curl (if configured with --with-oauth) ------------------------------------------------------------------------------ Cygwin diff --combined Makefile.am index 59269d51,ec523ec4..cb34b5db --- a/Makefile.am +++ b/Makefile.am @@@ -7,6 -7,8 +7,8 @@@ ## We set this to get our autoconf macros in the m4 directory ACLOCAL_AMFLAGS = -I m4 + AM_YFLAGS = -d + ## ## This is the default set of libraries all programs link against. Some ## programs add extra libraries to this set, so they override this with @@@ -34,12 -36,10 +36,13 @@@ nmhlibexecdir = @libexecdir@/nm ## nmh _does_ have a test suite! ## TESTS_ENVIRONMENT = MH_OBJ_DIR="@abs_builddir@" \ + MH_VERSION="$(VERSION)" \ + OAUTH_SUPPORT='@OAUTH_SUPPORT@' \ + CURL_USER_AGENT='@CURL_USER_AGENT@' \ MH_TEST_DIR="@abs_builddir@/test/testdir" \ nmhlibexecdir="$(nmhlibexecdir)" bindir="$(bindir)" \ mandir="$(mandir)" nmhetcdir="$(nmhetcdir)" \ + nmhetcdirinst="@nmhetcdirinst@$(nmhetcdir)" \ supported_locks="$(supported_locks)" \ default_locking="${default_locking}" \ MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \ @@@ -74,7 -74,7 +77,7 @@@ TESTS = test/ali/test-ali test/anno/tes test/mhbuild/test-ext-params \ test/mhbuild/test-forw test/mhbuild/test-header-encode \ test/mhbuild/test-utf8-body \ - test/mhfixmsg/test-mhfixmsg \ + test/mhfixmsg/test-mhfixmsg test/mhical/test-mhical \ test/mhl/test-mhl-flags \ test/mhlist/test-mhlist test/mhlist/test-ext-params \ test/mhmail/test-mhmail \ @@@ -84,8 -84,6 +87,8 @@@ test/mhshow/test-subpart test/mhshow/test-msg-buffer-boundaries \ test/mhstore/test-mhstore test/mkstemp/test-mkstemp \ test/new/test-basic test/pick/test-pick test/pick/test-stderr \ + test/oauth/test-mhlogin test/oauth/test-send \ + test/oauth/test-inc test/oauth/test-share \ test/post/test-post-aliases test/post/test-post-basic \ test/post/test-post-multiple test/post/test-post-bcc \ test/post/test-post-dcc test/post/test-post-fcc \ @@@ -93,12 -91,13 +96,13 @@@ test/post/test-post-group test/post/test-mts test/post/test-messageid \ test/post/test-sendfiles test/prompter/test-prompter \ test/rcv/test-rcvdist test/rcv/test-rcvpack test/rcv/test-rcvstore \ - test/rcv/test-rcvtty test/refile/test-refile \ + test/rcv/test-rcvtty test/refile/test-refile test/repl/test-convert \ test/repl/test-if-str test/repl/test-trailing-newline \ test/repl/test-multicomp test/repl/test-repl \ test/scan/test-scan test/scan/test-scan-multibyte \ test/sequences/test-flist test/sequences/test-mark \ test/sequences/test-out-of-range \ + test/show/test-show \ test/slocal/test-slocal \ test/whatnow/test-attach-detach test/whatnow/test-cd \ test/whatnow/test-ls test/whom/test-whom \ @@@ -106,15 -105,21 +110,21 @@@ check_SCRIPTS = test/common.sh check_PROGRAMS = test/getfullname test/getcanon test/fakepop test/fakesmtp \ - test/getcwidth + test/getcwidth test/fakehttp - DISTCHECK_CONFIGURE_FLAGS = DISABLE_SETGID_MAIL=1 + + ## The location of installed nmhetcdir is, for all purposes except + ## distcheck, $nmhetcdir. For distcheck, prepend $MH_INST_DIR (from + ## test/common.sh.in), which is based on $MH_TEST_DIR (from + ## $TESTS_ENVIRONMENT). + DISTCHECK_CONFIGURE_FLAGS = DISABLE_SETGID_MAIL=1 \ + NMHETCDIRINST='$${abs_builddir}/test/testdir/inst' ## ## Stuff that should be cleaned via "make clean" ## automake 1.12.6 on FreeBSD 9 needs the sbr/dtimep.c. ## CLEANFILES = config/version.c sbr/sigmsg.h sbr/dtimep.c etc/mts.conf \ - etc/gen-ctype-checked sbr/ctype-checked.h sbr/ctype-checked.c \ + etc/gen-ctype-checked sbr/ctype-checked.[hc] \ etc/mhn.defaults man/man.sed man/mh-chart.man $(man_MANS) \ *.plist clean-local: @@@ -148,11 -153,11 +158,11 @@@ BUILT_SOURCES = sbr/sigmsg.h sbr/ctype- ## bin_PROGRAMS = uip/ali uip/anno uip/burst uip/comp uip/dist uip/flist \ uip/fmttest uip/folder uip/forw uip/inc uip/install-mh \ - uip/mark uip/mhbuild uip/mhfixmsg uip/mhlist uip/mhn \ + uip/mark uip/mhbuild uip/mhfixmsg uip/mhical uip/mhlist uip/mhn \ uip/mhparam uip/mhpath uip/mhshow uip/mhstore uip/msgchk \ uip/new uip/packf uip/pick uip/prompter uip/refile \ uip/repl uip/rmf uip/rmm uip/scan uip/send uip/show uip/sortm \ - uip/whatnow uip/whom + uip/whatnow uip/whom uip/mhlogin bin_SCRIPTS = uip/mhmail etc/sendfiles @@@ -183,26 -188,27 +193,28 @@@ noinst_LIBRARIES = sbr/libmh.a mts/libm ## them, but that might change in the future. ## noinst_HEADERS = h/addrsbr.h h/aliasbr.h h/crawl_folders.h h/dropsbr.h \ - h/fmt_compile.h h/fmt_scan.h h/md5.h h/mf.h \ + h/fmt_compile.h h/fmt_scan.h h/icalendar.h h/md5.h h/mf.h \ h/mh.h h/mhcachesbr.h h/mhparse.h h/mime.h \ h/mts.h h/nmh.h h/picksbr.h h/popsbr.h h/prototypes.h \ h/rcvmail.h h/scansbr.h h/signals.h h/tws.h h/utils.h \ - mts/smtp/smtp.h sbr/ctype-checked.h + mts/smtp/smtp.h sbr/ctype-checked.h h/oauth.h \ + thirdparty/jsmn/jsmn.h ## ## Extra files we need to install in various places ## dist_nmhetc_DATA = etc/MailAliases etc/components etc/digestcomps \ - etc/distcomps etc/forwcomps etc/mhl.body etc/mhl.digest \ - etc/mhl.format etc/mhl.forward etc/mhl.headers \ - etc/mhl.reply etc/mhshow.marker etc/rcvdistcomps \ - etc/rcvdistcomps.outbox etc/replcomps etc/replgroupcomps \ - etc/scan.MMDDYY \ - etc/scan.YYYYMMDD etc/scan.curses etc/scan.default \ - etc/scan.highlighted \ - etc/scan.mailx etc/scan.nomime etc/scan.size etc/scan.time \ - etc/scan.timely etc/scan.unseen + etc/distcomps etc/forwcomps \ + etc/mhical.12hour etc/mhical.24hour \ + etc/mhl.body etc/mhl.digest etc/mhl.format etc/mhl.forward \ + etc/mhl.headers etc/mhl.reply etc/mhl.replywithoutbody \ + etc/mhshow.marker etc/rcvdistcomps etc/rcvdistcomps.outbox \ + etc/replcomps etc/replgroupcomps \ + etc/scan.MMDDYY \ + etc/scan.YYYYMMDD etc/scan.curses etc/scan.default \ + etc/scan.highlighted \ + etc/scan.mailx etc/scan.nomime etc/scan.size etc/scan.time \ + etc/scan.timely etc/scan.unseen ## ## The same as above, but we don't include these in the distribution @@@ -219,7 -225,7 +231,7 @@@ dist_doc_DATA = COPYRIGHT INSTALL NEWS docs/MAIL.FILTERING docs/MAILING-LISTS docs/README-ATTACHMENTS \ docs/README-HOOKS docs/README-components docs/README.about \ docs/README.SASL docs/README.developers docs/README.manpages \ - docs/README-iCalendar docs/TODO + docs/TODO ## ## Contribs that get installed in docdir/contrib/ @@@ -227,6 -233,7 +239,7 @@@ contribdir = $(docdir)/contrib dist_contrib_SCRIPTS = docs/contrib/replyfilter docs/contrib/build_nmh \ docs/contrib/ml docs/contrib/vpick + dist_contrib_DATA = docs/contrib/replaliases ## ## Our man pages @@@ -238,14 -245,14 +251,14 @@@ man_MANS = man/ali.1 man/anno.1 man/ap. man/mh-alias.5 man/mh-chart.7 man/mh-draft.5 man/mh-folders.5 \ man/mh-format.5 man/mh-mail.5 man/mh-mime.7 man/mh-profile.5 \ man/mh_profile.5 man/mh-sequence.5 man/mh-tailor.5 man/mhbuild.1 \ - man/mhfixmsg.1 man/mhl.1 man/mhlist.1 man/mhmail.1 man/mhn.1 \ - man/mhparam.1 man/mhpath.1 man/mhshow.1 man/mhstore.1 \ + man/mhfixmsg.1 man/mhical.1 man/mhl.1 man/mhlist.1 man/mhmail.1 \ + man/mhn.1 man/mhparam.1 man/mhpath.1 man/mhshow.1 man/mhstore.1 \ man/mh-mkstemp.1 man/msgchk.1 man/mts.conf.5 man/new.1 \ man/next.1 man/nmh.7 man/packf.1 man/pick.1 man/post.8 man/prev.1 \ man/prompter.1 man/rcvdist.1 man/rcvpack.1 man/rcvstore.1 \ man/rcvtty.1 man/refile.1 man/repl.1 man/rmf.1 man/rmm.1 \ man/scan.1 man/send.1 man/sendfiles.1 man/show.1 man/slocal.1 \ - man/sortm.1 man/unseen.1 man/whatnow.1 man/whom.1 + man/sortm.1 man/unseen.1 man/whatnow.1 man/whom.1 man/mhlogin.1 ## ## Sources for our man pages @@@ -258,23 -265,24 +271,24 @@@ man_SRCS = man/ali.man man/anno.man man man/mh-chart-gen.sh man/mh-draft.man man/mh-folders.man \ man/mh-format.man man/mh-mail.man man/mh-mime.man \ man/mh-profile.man man/mh_profile.man man/mh-sequence.man \ - man/mh-tailor.man man/mhbuild.man man/mhfixmsg.man man/mhl.man \ - man/mhlist.man man/mhmail.man man/mhn.man man/mhparam.man \ - man/mhpath.man man/mhshow.man man/mhstore.man man/mh-mkstemp.man \ - man/msgchk.man man/mts.conf.man man/new.man \ + man/mh-tailor.man man/mhbuild.man man/mhfixmsg.man man/mhical.man \ + man/mhl.man man/mhlist.man man/mhmail.man man/mhn.man \ + man/mhparam.man man/mhpath.man man/mhshow.man man/mhstore.man \ + man/mh-mkstemp.man man/msgchk.man man/mts.conf.man man/new.man \ man/next.man man/nmh.man man/packf.man man/pick.man man/post.man \ man/prev.man man/prompter.man man/rcvdist.man man/rcvpack.man \ man/rcvstore.man man/rcvtty.man man/refile.man man/repl.man \ man/rmf.man man/rmm.man man/scan.man man/send.man \ man/sendfiles.man man/show.man man/slocal.man man/sortm.man \ - man/unseen.man man/whatnow.man man/whom.man + man/unseen.man man/whatnow.man man/whom.man man/mhlogin.man ## ## Files we need to include in the distribution which aren't found by ## Automake using the automatic rules ## - EXTRA_DIST = autogen.sh config/version.sh sbr/sigmsg.awk etc/mts.conf.in \ - etc/mhn.defaults.sh etc/sendfiles $(MHNSEARCHPROG) DATE MACHINES \ + EXTRA_DIST = autogen.sh config/version.sh sbr/sigmsg.awk sbr/icalparse.h \ + etc/mts.conf.in etc/mhn.defaults.sh etc/sendfiles \ + $(MHNSEARCHPROG) DATE MACHINES \ docs/ChangeLog_MH-3_to_MH-6.6 \ docs/ChangeLog_MH-6.7.0_to_MH-6.8.4.html \ test/README test/fakesendmail $(TESTS) test/inc/deb359167.mbox \ @@@ -284,9 -292,7 +298,9 @@@ test/mhbuild/somebinary \ test/mhbuild/nulls \ test/mhbuild/textplain \ - test/post/test-post-common.sh test/valgrind.supp uip/mhmail \ + test/post/test-post-common.sh test/valgrind.supp \ + test/oauth/common.sh \ + uip/mhmail \ SPECS/nmh.spec SPECS/build-nmh-cygwin $(man_SRCS) ## @@@ -326,7 -332,7 +340,7 @@@ uip_forw_SOURCES = uip/forw.c uip/whatn uip_forw_LDADD = $(LDADD) $(READLINELIB) $(TERMLIB) $(ICONVLIB) $(POSTLINK) uip_inc_SOURCES = uip/inc.c uip/scansbr.c uip/dropsbr.c uip/popsbr.c -uip_inc_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(SASLLIB) $(POSTLINK) +uip_inc_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(SASLLIB) $(POSTLINK) $(CURLLIB) uip_install_mh_SOURCES = uip/install-mh.c uip_install_mh_LDADD = $(LDADD) $(POSTLINK) @@@ -336,7 -342,8 +350,8 @@@ uip_mark_LDADD = $(LDADD) $(POSTLINK uip_mhbuild_SOURCES = uip/mhbuild.c uip/mhbuildsbr.c uip/mhcachesbr.c \ uip/mhlistsbr.c uip/mhoutsbr.c uip/mhmisc.c \ - uip/mhfree.c uip/mhparse.c uip/md5.c + uip/mhfree.c uip/mhparse.c uip/md5.c \ + uip/mhstoresbr.c uip/mhshowsbr.c uip_mhbuild_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) uip_mhfixmsg_SOURCES = uip/mhfixmsg.c uip/mhparse.c uip/mhcachesbr.c \ @@@ -344,6 -351,9 +359,9 @@@ uip/mhshowsbr.c uip/mhlistsbr.c uip/md5.c uip_mhfixmsg_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) + uip_mhical_SOURCES = uip/mhical.c + uip_mhical_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) + uip_mhlist_SOURCES = uip/mhlist.c uip/mhparse.c uip/mhcachesbr.c \ uip/mhlistsbr.c uip/mhmisc.c uip/mhfree.c uip/md5.c uip_mhlist_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) @@@ -370,7 -380,7 +388,7 @@@ uip_mhstore_SOURCES = uip/mhstore.c uip uip_mhstore_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) uip_msgchk_SOURCES = uip/msgchk.c uip/popsbr.c -uip_msgchk_LDADD = $(LDADD) $(SASLLIB) $(POSTLINK) +uip_msgchk_LDADD = $(LDADD) $(SASLLIB) $(POSTLINK) $(CURLLIB) uip_new_SOURCES = uip/new.c uip_new_LDADD = $(LDADD) $(POSTLINK) @@@ -402,7 -412,7 +420,7 @@@ uip_scan_LDADD = $(LDADD) $(TERMLIB) $( uip_send_SOURCES = uip/send.c uip/sendsbr.c uip/annosbr.c \ uip/distsbr.c -uip_send_LDADD = $(LDADD) $(POSTLINK) +uip_send_LDADD = $(LDADD) $(POSTLINK) $(CURLLIB) uip_show_SOURCES = uip/show.c uip/mhlsbr.c uip_show_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) @@@ -436,9 -446,6 +454,9 @@@ uip_fmttest_LDADD = $(LDADD) $(TERMLIB uip_mhl_SOURCES = uip/mhl.c uip/mhlsbr.c uip_mhl_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK) +uip_mhlogin_SOURCES = uip/mhlogin.c +uip_mhlogin_LDADD = mts/libmts.a $(LDADD) $(CURLLIB) $(POSTLINK) + uip_mkstemp_SOURCES = uip/mkstemp.c uip_mkstemp_LDADD = $(LDADD) $(POSTLINK) @@@ -470,15 -477,12 +488,15 @@@ test_getfullname_LDADD = $(LDADD) $(POS test_getcanon_SOURCES = test/getcanon.c test_getcanon_LDADD = $(POSTLINK) -test_fakepop_SOURCES = test/fakepop.c +test_fakepop_SOURCES = test/fakepop.c test/server.c test_fakepop_LDADD = $(POSTLINK) -test_fakesmtp_SOURCES = test/fakesmtp.c +test_fakesmtp_SOURCES = test/fakesmtp.c test/server.c test_fakesmtp_LDADD = $(POSTLINK) +test_fakehttp_SOURCES = test/fakehttp.c test/server.c +test_fakehttp_LDADD = $(POSTLINK) + test_getcwidth_SOURCES = test/getcwidth.c test_getcwidth_LDADD = $(POSTLINK) @@@ -580,7 -584,9 +598,9 @@@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr sbr/getcpy.c sbr/geteditor.c sbr/getfolder.c \ sbr/getpass.c \ sbr/fmt_addr.c sbr/fmt_compile.c sbr/fmt_new.c \ - sbr/fmt_rfc2047.c sbr/fmt_scan.c sbr/lock_file.c \ + sbr/fmt_rfc2047.c sbr/fmt_scan.c \ + sbr/icalparse.y sbr/icalendar.l sbr/datetime.c \ + sbr/lock_file.c \ sbr/m_atoi.c sbr/m_backup.c sbr/m_convert.c \ sbr/m_draft.c sbr/m_getfld.c sbr/m_gmprot.c \ sbr/m_maildir.c sbr/m_name.c sbr/m_popen.c sbr/m_rand.c \ @@@ -601,8 -607,7 +621,8 @@@ sbr/uprf.c sbr/vfgets.c \ sbr/mf.c sbr/utils.c sbr/ctype-checked.c \ sbr/m_mktemp.c sbr/getansreadline.c sbr/vector.c \ - config/config.c config/version.c + config/config.c config/version.c sbr/oauth.c \ + thirdparty/jsmn/jsmn.c ## ## Because these files use the definitions in the libmh rule below, @@@ -611,7 -616,7 +631,7 @@@ config/sbr_libmh_a-config.$(OBJEXT) sbr/sbr_libmh_a-mts.$(OBJEXT): Makefile - sbr_libmh_a_CPPFLAGS = -I./sbr -DNMHETCDIR='"$(nmhetcdir)"' \ + sbr_libmh_a_CPPFLAGS = -I./sbr -DNMHETCDIR='"@nmhetcdirinst@$(nmhetcdir)"' \ -DMAILSPOOL='"$(mailspool)"' \ -DSENDMAILPATH='"$(sendmailpath)"' -DNMHBINDIR='"$(bindir)"' \ -DNMHLIBEXECDIR='"$(nmhlibexecdir)"' diff --combined configure.ac index 507e4eae,4bdf12d6..548a43da --- a/configure.ac +++ b/configure.ac @@@ -40,15 -40,6 +40,15 @@@ AS_IF([test x"$with_cyrus_sasl" != x - AC_MSG_WARN([Please pass the appropriate arguments to CPPFLAGS/LDFLAGS])]) sasl_support=yes], [sasl_support=no]) +dnl Do you want client-side support for using OAuth2 for SMTP authentication? +AC_ARG_WITH([oauth], AS_HELP_STRING([--with-oauth], + [Enable OAuth2 support in SMTP auth])) +AS_IF([test x"$with_oauth" != x -a x"$with_oauth" != x"no"],[ + AC_DEFINE([OAUTH_SUPPORT], [1], + [Support OAuth2 in SMTP auth.])dnl + OAUTH_SUPPORT=1; oauth_support=yes], [OAUTH_SUPPORT=0; oauth_support=no]) +AC_SUBST(OAUTH_SUPPORT) + dnl Do you want client-side support for encryption with TLS? AC_ARG_WITH([tls], AS_HELP_STRING([--with-tls], [Enable TLS support])) AS_IF([test x"$with_tls" != x"no"],[ @@@ -93,9 -84,6 +93,6 @@@ AC_PREFIX_PROGRAM([mhparam] dnl ------------------ dnl CHECK THE COMPILER dnl ------------------ - dnl We want these before the checks, - dnl so the checks can modify their values. - test -z "$CFLAGS" && auto_cflags=1 AC_PROG_CC([cc gcc]) AM_PROG_CC_C_O @@@ -103,51 -91,32 +100,32 @@@ dnl ---------------- dnl CUSTOMIZE CFLAGS dnl ---------------- - if test -n "$auto_cflags"; then - dnl The user didn't specify CFLAGS, so customize them. - if test "$GCC" = yes; then - dnl Can't use -ansi with gcc 4.5.3 on Cygwin, at least through setup - dnl version 2.763, because it disables some features in the system - dnl header files and warns about them with -Wall. Try to test for - dnl that generally, with gcc. - AC_CACHE_CHECK([whether we can use -ansi with gcc], [nmh_cv_has_dash_ansi], - [nmh_saved_cppflags="$CPPFLAGS" - nmh_saved_cflags="$CFLAGS" - CPPFLAGS="-D_GNU_SOURCE" - CFLAGS="-ansi -Wall -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ],[tzset();])], - [nmh_cv_has_dash_ansi=yes], - [nmh_cv_has_dash_ansi=no]) - CPPFLAGS="$nmh_saved_cppflags" - CFLAGS="$nmh_saved_cflags"]) - test "$nmh_cv_has_dash_ansi" = "yes" && \ - CFLAGS="${CFLAGS:+$CFLAGS }-ansi -pedantic" - else - dnl Use -v and some other options with SunStudio cc. lex produces - dnl code that causes unreachable-statement warnings. It might be - dnl better to use an autoconf test, except -v will probably succeed - dnl with many other compilers but have different meaning. - AS_CASE([`${CC} -V 2>&1`], - [cc:\ Sun\ C*], [CFLAGS=\ + dnl The user didn't specify CFLAGS, so customize them. + if test "$GCC" != yes; then + dnl Use -v and some other options with SunStudio cc. lex produces + dnl code that causes unreachable-statement warnings. It might be + dnl better to use an autoconf test, except -v will probably succeed + dnl with many other compilers but have different meaning. + AS_CASE([`${CC} -V 2>&1`], + [cc:\ Sun\ C*], [CFLAGS=\ "${CFLAGS:+$CFLAGS }-v -errtags=yes -erroff=E_STATEMENT_NOT_REACHED"]) - fi - - AC_CACHE_CHECK([whether compiler supports -Wall], [nmh_cv_has_wall], - [nmh_saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wall -Werror" - AC_TRY_COMPILE([],[],nmh_cv_has_wall=yes,nmh_cv_has_wall=no) - CFLAGS="$nmh_saved_cflags"]) - test "$nmh_cv_has_wall" = "yes" && CFLAGS="${CFLAGS:+$CFLAGS }-Wall" - - AC_CACHE_CHECK([whether compiler supports -Wextra], [nmh_cv_has_wextra], - [nmh_saved_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Wextra -Werror" - AC_TRY_COMPILE([],[],nmh_cv_has_wextra=yes, - nmh_cv_has_wextra=no) - CFLAGS="$nmh_saved_cflags"]) - test "$nmh_cv_has_wextra" = "yes" && CFLAGS="${CFLAGS:+$CFLAGS }-Wextra" fi + AC_CACHE_CHECK([whether compiler supports -Wall], [nmh_cv_has_wall], + [nmh_saved_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Wall -Werror" + AC_TRY_COMPILE([],[],nmh_cv_has_wall=yes,nmh_cv_has_wall=no) + CFLAGS="$nmh_saved_cflags"]) + test "$nmh_cv_has_wall" = "yes" && CFLAGS="${CFLAGS:+$CFLAGS }-Wall" + + AC_CACHE_CHECK([whether compiler supports -Wextra], [nmh_cv_has_wextra], + [nmh_saved_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Wextra -Werror" + AC_TRY_COMPILE([],[],nmh_cv_has_wextra=yes, + nmh_cv_has_wextra=no) + CFLAGS="$nmh_saved_cflags"]) + test "$nmh_cv_has_wextra" = "yes" && CFLAGS="${CFLAGS:+$CFLAGS }-Wextra" + if test "$GCC" = yes; then dnl Do this regardless of auto_cflags value. dnl Enable _FORTIFY_SOURCE checking, which is supported by @@@ -215,11 -184,12 +193,12 @@@ AC_HEADER_ASSER dnl ------------------ dnl CHECK FOR PROGRAMS dnl ------------------ - AC_PROG_MAKE_SET dnl Does make define $MAKE - AC_PROG_INSTALL dnl Check for BSD compatible `install' - AC_PROG_RANLIB dnl Check for `ranlib' + AC_PROG_MAKE_SET dnl Does make define $MAKE + AC_PROG_INSTALL dnl Check for BSD compatible `install' + AC_PROG_RANLIB dnl Check for `ranlib' AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk - AC_PROG_SED dnl Check for Posix-compliant sed + AC_PROG_SED dnl Check for Posix-compliant sed + AC_PROG_YACC dnl Check for yacc/bison AM_PROG_LEX dnl Check for lex/flex AM_PROG_AR @@@ -315,7 -285,7 +294,7 @@@ AS_IF([test x"$DISABLE_SETGID_MAIL" != dnl If mailspool is not world-writable and dotlockfile is not setgid, dnl we need to #define MAILGROUP to 1 and make inc setgid. - if test x"$LOCKTYPE" = x"dot" -a x"$nmh_cv_mailspool_world_writable" = x"no" -a x"$nmh_cv_dotlockfile_setgid" != x"yes" ; then + if test x"$with_locking" = x"dot" -a x"$nmh_cv_mailspool_world_writable" = x"no" -a x"$nmh_cv_dotlockfile_setgid" != x"yes" ; then dnl do we really need both of these? AC_DEFINE([MAILGROUP],[1], [Define to 1 if you need to make `inc' set-group-id because your mail spool is not world writable. There are no guarantees as to the safety of doing this, but this #define will add some extra security checks.])dnl @@@ -510,22 -480,6 +489,22 @@@ AS_IF([test x"$tls_support" = x"yes"], [TLSLIB=]) AC_SUBST([TLSLIB]) +dnl ----------------- +dnl CHECK FOR CURL +dnl ----------------- +AS_IF([test x"$OAUTH_SUPPORT" = x"1"],[ + AC_PATH_PROG([curl_config], [curl-config]) + AC_CHECK_HEADER([curl/curl.h], [], [AC_MSG_ERROR([curl/curl.h not found])]) + AC_CHECK_LIB([curl], [curl_easy_init], [CURLLIB="`$curl_config --libs`"], + [AC_MSG_ERROR([curl library not found])],[$CURLLIB]) + CURL_USER_AGENT=`$curl_config --version | sed 's| |/|'` + ], + [CURLLIB= + CURL_USER_AGENT= +]) +AC_SUBST([CURLLIB]) +AC_SUBST([CURL_USER_AGENT]) + dnl ---------------- dnl CHECK FLEX FIXUP dnl ---------------- @@@ -540,6 -494,13 +519,13 @@@ AS_IF([test "$LEX" = flex] '; sed "s/\( \)int i;/\1yy_size_t i;/" $@ >$@.tmp && mv -f $@.tmp $@']) AC_SUBST([LFLAGS])]) + dnl ------------------ + dnl FOR INTERNAL USE by the NMH test suite + dnl ------------------ + AC_ARG_VAR([NMHETCDIRINST], [for internal use by nmh test suite]) + AS_IF([test -n "$NMHETCDIRINST"], [nmhetcdirinst=$NMHETCDIRINST] + AC_SUBST([nmhetcdirinst])) + dnl ---------------- dnl CHECK STRUCTURES dnl ---------------- @@@ -615,7 -576,6 +601,7 @@@ spool default locking type : ${with_loc default smtp servers : ${smtpservers} SASL support : ${sasl_support} TLS support : ${tls_support} +OAuth support : ${oauth_support} ])])dnl dnl --------------- diff --combined h/mh.h index 71315b6e,4b3818c0..8dcad654 --- a/h/mh.h +++ b/h/mh.h @@@ -377,7 -377,6 +377,6 @@@ typedef struct m_getfld_state *m_getfld #define MS_UNKNOWN 1 /* type not known yet */ #define MS_MBOX 2 /* Unix-style "from" lines */ #define MS_MMDF 3 /* string mmdlm2 */ - #define MS_MSH 4 /* whacko msh */ #define NOUSE 0 /* draft being re-used */ @@@ -490,7 -489,6 +489,7 @@@ extern char *sendproc extern char *showmimeproc; extern char *showproc; extern char *usequence; +extern char *user_agent; extern char *version_num; extern char *version_str; extern char *whatnowproc; diff --combined h/prototypes.h index 5c104a7e,3399384e..33ac013d --- a/h/prototypes.h +++ b/h/prototypes.h @@@ -18,9 -18,9 +18,9 @@@ char *etcpath(char *) struct msgs_array; void add_profile_entry (const char *, const char *); -void adios (char *, char *, ...) NORETURN; +void adios (char *, const char *, ...) NORETURN; void admonish (char *, char *, ...); -void advertise (char *, char *, char *, va_list); +void advertise (char *, char *, const char *, va_list); void advise (char *, char *, ...); char **argsplit (char *, char **, int *); void argsplit_msgarg (struct msgs_array *, char *, char **); @@@ -287,7 -287,7 +287,7 @@@ void print_version (char *) void push (void); char *pwd (void); char *r1bindex(char *, int); -void readconfig (struct node **, FILE *, char *, int); +void readconfig (struct node **, FILE *, const char *, int); int refile (char **, char *); void ruserpass (char *, char **, char **); int remdir (char *); @@@ -384,7 -384,7 +384,7 @@@ int unputenv (char *) * */ void unquote_string(const char *input, char *output); - int uprf (char *, char *); + int uprf (const char *, const char *); int vfgets (FILE *, char **); /* diff --combined man/send.man index 29e6e243,1673c5ce..281fe8d5 --- a/man/send.man +++ b/man/send.man @@@ -1,7 -1,7 +1,7 @@@ .\" .\" %nmhwarning% .\" -.TH SEND %manext1% "July 8, 2014" "%nmhversion%" +.TH SEND %manext1% "November 25, 2014" "%nmhversion%" .SH NAME send \- send a message .SH SYNOPSIS @@@ -25,8 -25,6 +25,8 @@@ .RB [ \-msgid " | " \-nomsgid ] .RB [ \-messageid .IR localname " | " random ] +.RB [ \-oauth +.IR service ] .RB [ \-push " | " \-nopush ] .RB [ \-split .IR seconds ] @@@ -34,6 -32,8 +34,8 @@@ .RB [ \-watch " | " \-nowatch ] .RB [ \-mts .IR smtp " | " sendmail/smtp " | " sendmail/pipe ] + .RB [ \-sendmail + .IR program ] .RB [ \-server .IR servername ] .RB [ \-port @@@ -369,6 -369,14 +371,14 @@@ but can be overriiden here with th .B \-mts switch. .PP + If nmh is using as its mail transport system + .BR sendmail/pipe , + the + .B \-sendmail + switch can be used to override the default + .B sendmail + program. + .PP If nmh is using the SMTP MTA, the .B \-server and the @@@ -380,9 -388,7 +390,9 @@@ entry). Th .B \-snoop switch can be used to view the SMTP transaction. (Beware that the SMTP transaction may contain authentication information either in -plaintext or easily decoded base64.) +plaintext or easily decoded base64.) If +.B \-oauth +is used, the HTTP transaction is also shown. .PP If .B nmh @@@ -420,24 -426,6 +430,24 @@@ underlying SASL mechanism. A value of .PP If .B nmh +has been compiled with OAuth support, the +.B \-oauth +switch will enable OAuth authentication. The +.B \-user +switch must be used, and the +.I user-name +must be an email address the user has for that service. Before using this, +the user must authorize nmh by running +.B mhlogin +and grant authorization to that account. Only +.B -oauth +.I gmail +is supported. See the +.B mhlogin +man page for more details. +.PP +If +.B nmh has been compiled with TLS support, the .B \-tls and @@@ -500,7 -488,6 +510,7 @@@ for more information .IR forw (1), .IR mhbuild (1), .IR mhparam (1), +.IR mhlogin (1), .IR repl (1), .IR whatnow (1), .IR mh\-alias (5), diff --combined uip/inc.c index a4aea3e7,7d128420..5f5c5096 --- a/uip/inc.c +++ b/uip/inc.c @@@ -8,7 -8,13 +8,13 @@@ */ #ifdef MAILGROUP - /* Revised: Sat Apr 14 17:08:17 PDT 1990 (marvit@hplabs) + /* + * Thu Feb 12 21:00 CST 2015 Marcin Cieslak + * Replaced setgid() calls with setegid() so that it works with dot + * locking on FreeBSD. setegid() should be supported on modern POSIX + * systems. + * + * Revised: Sat Apr 14 17:08:17 PDT 1990 (marvit@hplabs) * Added hpux hacks to set and reset gid to be "mail" as needed. The reset * is necessary so inc'ed mail is the group of the inc'er, rather than * "mail". We setgid to egid only when [un]locking the mail file. This @@@ -52,7 -58,6 +58,7 @@@ X("form formatfile", 0, FORMSW) \ X("format string", 5, FMTSW) \ X("host hostname", 0, HOSTSW) \ + X("oauth service", 0, OAUTHSW) \ X("user username", 0, USERSW) \ X("pack file", 0, PACKSW) \ X("nopack", 0, NPACKSW) \ @@@ -128,10 -133,16 +134,16 @@@ static FILE *pf = NULL * For setting and returning to "mail" gid */ #ifdef MAILGROUP - static int return_gid; + static gid_t return_gid; #define TRYDROPGROUPPRIVS() DROPGROUPPRIVS() - #define DROPGROUPPRIVS() setgid(getgid()) - #define GETGROUPPRIVS() setgid(return_gid) + #define DROPGROUPPRIVS() \ + if (setegid(getgid()) != 0) { \ + adios ("setegid", "unable to restore group to %ld", (long) getgid()); \ + } + #define GETGROUPPRIVS() \ + if (setegid(return_gid) != 0) { \ + adios ("setegid", "unable to set group to %ld", (long) return_gid); \ + } #define SAVEGROUPPRIVS() return_gid = getegid() #else /* define *GROUPPRIVS() as null; this avoids having lots of "#ifdef MAILGROUP"s */ @@@ -186,10 -197,10 +198,10 @@@ main (int argc, char **argv FILE *aud = NULL; char b[PATH_MAX + 1]; char *maildir_copy = NULL; /* copy of mail directory because the static gets overwritten */ + const char *oauth_svc = NULL; int nmsgs, nbytes; char *MAILHOST_env_variable; - done=inc_done; /* absolutely the first thing we do is save our privileges, @@@ -314,16 -325,6 +326,16 @@@ adios (NULL, "missing argument to %s", argp[-2]); continue; + case OAUTHSW: +#ifdef OAUTH_SUPPORT + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + oauth_svc = cp; +#else + adios (NULL, "not built with OAuth support"); +#endif + continue; + case USERSW: if (!(user = *argp++) || *user == '-') adios (NULL, "missing argument to %s", argp[-2]); @@@ -394,20 -395,12 +406,20 @@@ if (inc_type == INC_POP) { struct nmh_creds creds = { 0, 0, 0 }; + if (oauth_svc == NULL) { + nmh_get_credentials (host, user, sasl, &creds); + } else { + if (user == NULL) { + adios (NULL, "must specify -user with -oauth"); + } + creds.user = user; + } + /* * initialize POP connection */ - nmh_get_credentials (host, user, sasl, &creds); if (pop_init (host, port, creds.user, creds.password, proxy, snoop, - sasl, saslmech) == NOTOK) + sasl, saslmech, oauth_svc) == NOTOK) adios (NULL, "%s", response); /* Check if there are any messages */ @@@ -966,6 -959,7 +978,7 @@@ skip static void inc_done (int status) { + done = exit; if (packfile && pd != NOTOK) mbx_close (packfile, pd); if (locked) diff --combined uip/mhparam.c index a3f4d78c,4fe8c8d3..f6daf9a5 --- a/uip/mhparam.c +++ b/uip/mhparam.c @@@ -29,6 -29,7 +29,7 @@@ DEFINE_SWITCH_ENUM(MHPARAM) DEFINE_SWITCH_ARRAY(MHPARAM, switches); #undef X + extern char *mhbindir; extern char *mhetcdir; extern char *mhlibexecdir; @@@ -75,13 -76,6 +76,13 @@@ static char *iconv ""; #endif +static char *oauth = +#ifdef OAUTH_SUPPORT + "oauth"; +#else + ""; +#endif + struct proc { char *p_name; char **p_field; @@@ -111,6 -105,7 +112,7 @@@ static struct proc procs [] = { "version", &version_num }, { "whatnowproc", &whatnowproc }, { "whomproc", &whomproc }, + { "bindir", &mhbindir }, { "etcdir", &mhetcdir }, { "libdir", &mhlibexecdir }, { "libexecdir", &mhlibexecdir }, @@@ -119,7 -114,6 +121,7 @@@ { "datalocking", &datalocking }, { "spoollocking", &spoollocking }, { "iconv", &iconv }, + { "oauth", &oauth }, { "sasl", &sasl }, { "tls", &tls }, { NULL, NULL }, diff --combined uip/post.c index 0beab55b,65526d23..4391608f --- a/uip/post.c +++ b/uip/post.c @@@ -80,7 -80,6 +80,7 @@@ X("nosasl", SASLminc(-6), NOSASLSW) \ X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \ X("saslmech", SASLminc(-5), SASLMECHSW) \ + X("oauth", -5, OAUTHSW) \ X("user", SASLminc(-4), USERSW) \ X("port server submission port name/number", 4, PORTSW) \ X("tls", TLSminc(-3), TLSSW) \ @@@ -88,6 -87,7 +88,7 @@@ X("notls", TLSminc(-5), NTLSSW) \ X("fileproc", -4, FILEPROCSW) \ X("mhlproc", -3, MHLPROCSW) \ + X("sendmail program", 0, MTSSM) \ X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \ X("credentials legacy|file:filename", 0, CREDENTIALSSW) \ X("messageid localname|random", 2, MESSAGEIDSW) \ @@@ -257,14 -257,14 +258,14 @@@ static void anno (void) static int annoaux (struct mailname *); static void insert_fcc (struct headers *, char *); static void make_bcc_file (int); -static void verify_all_addresses (int, char *); +static void verify_all_addresses (int, char *, const char *); static void chkadr (void); static void sigon (void); static void sigoff (void); static void p_refile (char *); static void fcc (char *, char *); static void die (char *, char *, ...); -static void post (char *, int, int, char *); +static void post (char *, int, int, char *, const char *); static void do_text (char *file, int fd); static void do_an_address (struct mailname *, int); static void do_addresses (int, int); @@@ -279,7 -279,6 +280,7 @@@ main (int argc, char **argv char buf[BUFSIZ], name[NAMESZ]; FILE *in, *out; m_getfld_state_t gstate = 0; + char *xoauth_client_res = NULL; if (nmh_init(argv[0], 0 /* use context_foil() */)) { return 1; } @@@ -440,13 -439,7 +441,13 @@@ if (!(saslmech = *argp++) || *saslmech == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; - + + case OAUTHSW: + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + xoauth_client_res = cp; + continue; + case USERSW: if (!(user = *argp++) || *user == '-') adios (NULL, "missing argument to %s", argp[-2]); @@@ -481,6 -474,12 +482,12 @@@ mhlproc = cp; continue; + case MTSSM: + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + sendmail = cp; + continue; + case MTSSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); @@@ -628,7 -627,7 +635,7 @@@ /* If we are doing a "whom" check */ if (whomsw) { /* This won't work with MTS_SENDMAIL_PIPE. */ - verify_all_addresses (1, envelope); + verify_all_addresses (1, envelope, xoauth_client_res); done (0); } @@@ -640,14 -639,14 +647,14 @@@ verify_all_addresses with MTS_SENDMAIL_PIPE, but that might require running sendmail as root. Note that spost didn't verify addresses. */ - verify_all_addresses (verbose, envelope); + verify_all_addresses (verbose, envelope, xoauth_client_res); } - post (tmpfil, 0, verbose, envelope); + post (tmpfil, 0, verbose, envelope, xoauth_client_res); } - post (bccfil, 1, verbose, envelope); + post (bccfil, 1, verbose, envelope, xoauth_client_res); (void) m_unlink (bccfil); } else { - post (tmpfil, 0, isatty (1), envelope); + post (tmpfil, 0, isatty (1), envelope, xoauth_client_res); } p_refile (tmpfil); @@@ -1494,8 -1493,7 +1501,8 @@@ do_addresses (int bccque, int talk */ static void -post (char *file, int bccque, int talk, char *envelope) +post (char *file, int bccque, int talk, char *envelope, + const char *xoauth_client_res) { int fd; int retval, i; @@@ -1545,8 -1543,8 +1552,8 @@@ } else { if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, verbose, snoop, sasl, saslssf, - saslmech, user, tls)) || - rp_isbad (retval = sm_winit (envelope))) + saslmech, user, xoauth_client_res, tls)) + || rp_isbad (retval = sm_winit (envelope))) die (NULL, "problem initializing server; %s", rp_string (retval)); do_addresses (bccque, talk && verbose); @@@ -1575,7 -1573,7 +1582,7 @@@ /* Address Verification */ static void -verify_all_addresses (int talk, char *envelope) +verify_all_addresses (int talk, char *envelope, const char *xoauth_client_res) { int retval; struct mailname *lp; @@@ -1585,7 -1583,7 +1592,7 @@@ if (!whomsw || checksw) if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, verbose, snoop, sasl, saslssf, - saslmech, user, tls)) + saslmech, user, xoauth_client_res, tls)) || rp_isbad (retval = sm_winit (envelope))) die (NULL, "problem initializing server; %s", rp_string (retval)); diff --combined uip/send.c index 4c022b4c,26ef89a8..22cdb10c --- a/uip/send.c +++ b/uip/send.c @@@ -10,8 -10,6 +10,8 @@@ #include #include +#include +#include #ifndef CYRUS_SASL # define SASLminc(a) (a) @@@ -63,7 -61,6 +63,7 @@@ X("nosasl", SASLminc(-6), NOSASLSW) \ X("saslmaxssf", SASLminc(-10), SASLMXSSFSW) \ X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \ + X("oauth service", 0, OAUTHSW) \ X("user username", SASLminc(-4), USERSW) \ X("attach", -6, ATTACHSW) \ X("noattach", -8, NOATTACHSW) \ @@@ -72,6 -69,7 +72,7 @@@ X("tls", TLSminc(-3), TLSSW) \ X("initialtls", TLSminc(-10), INITTLSSW) \ X("notls", TLSminc(-5), NTLSSW) \ + X("sendmail program", 0, MTSSM) \ X("mts smtp|sendmail/smtp|sendmail/pipe", 2, MTSSW) \ X("messageid localname|random", 2, MESSAGEIDSW) \ @@@ -118,10 -116,8 +119,10 @@@ main (int argc, char **argv char *cp, *dfolder = NULL, *maildir = NULL; char buf[BUFSIZ], **ap, **argp, **arguments, *program; char *msgs[MAXARGS], **vec; + const char *user = NULL, *oauth_svc = NULL; struct msgs *mp; struct stat st; + int snoop = 0; if (nmh_init(argv[0], 1)) { return 1; } @@@ -232,11 -228,6 +233,11 @@@ vec[vecp++] = --cp; continue; + case SNOOPSW: + snoop++; + vec[vecp++] = --cp; + continue; + case DEBUGSW: debugsw++; /* fall */ case NFILTSW: @@@ -248,6 -239,7 +249,6 @@@ case NMSGDSW: case WATCSW: case NWATCSW: - case SNOOPSW: case SASLSW: case NOSASLSW: case TLSSW: @@@ -256,25 -248,6 +257,25 @@@ vec[vecp++] = --cp; continue; + case OAUTHSW: +#ifdef OAUTH_SUPPORT + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + oauth_svc = cp; +#else + NMH_UNUSED (oauth_svc); + adios (NULL, "not built with OAuth support"); +#endif + continue; + + case USERSW: + vec[vecp++] = --cp; + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + vec[vecp++] = cp; + user = cp; + continue; + case ALIASW: case FILTSW: case WIDTHSW: @@@ -282,7 -255,9 +283,8 @@@ case SERVSW: case SASLMECHSW: case SASLMXSSFSW: - case USERSW: case PORTSW: + case MTSSM: case MTSSW: case MESSAGEIDSW: vec[vecp++] = --cp; @@@ -443,18 -418,6 +445,18 @@@ go_to_it distfile = NULL; } +#ifdef OAUTH_SUPPORT + if (oauth_svc != NULL) { + if (user == NULL) { + adios (NULL, "must specify -user with -oauth"); + } + + vec[vecp++] = "-oauth"; + vec[vecp++] = mh_oauth_do_xoauth (user, oauth_svc, + snoop ? stderr : NULL); + } +#endif /* OAUTH_SUPPORT */ + if (altmsg == NULL || stat (altmsg, &st) == NOTOK) { st.st_mtime = 0; st.st_dev = 0;