<pre style='margin:0'>
Perry E. Metzger (pmetzger) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/1c03c49d24f25c994ebebfc5085aa44b48ca0242">https://github.com/macports/macports-ports/commit/1c03c49d24f25c994ebebfc5085aa44b48ca0242</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 1c03c49 dovecot2: Apple Push Notification Service (APNS) for iOS Devices
</span>1c03c49 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 1c03c49d24f25c994ebebfc5085aa44b48ca0242
</span>Author: Steven Thomas Smith <s.t.smith@ieee.org>
AuthorDate: Fri Oct 11 17:36:25 2019 -0400
<span style='display:block; white-space:pre;color:#404040;'> dovecot2: Apple Push Notification Service (APNS) for iOS Devices
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * Add dovecot2 apns variant
</span><span style='display:block; white-space:pre;color:#404040;'> * Add dovecot APNS patch that creates a push_notify plugin
</span><span style='display:block; white-space:pre;color:#404040;'> * Add launch daemon for local pushnotify service
</span><span style='display:block; white-space:pre;color:#404040;'> * Add APNS configuration template to port mail-server
</span><span style='display:block; white-space:pre;color:#404040;'> * Submit new perl dependency p5-net-apns-persistent
</span><span style='display:block; white-space:pre;color:#404040;'> * Submit new perl dependency p5-rivileges-drop
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Related:
</span><span style='display:block; white-space:pre;color:#404040;'> * https://github.com/essandess/core/tree/apns
</span><span style='display:block; white-space:pre;color:#404040;'> * https://github.com/matthewpowell/pushnotify/issues/2
</span><span style='display:block; white-space:pre;color:#404040;'> * https://www.c0ffee.net/blog/dovecot-push-notifications/
</span><span style='display:block; white-space:pre;color:#404040;'> * https://github.com/cullum/freebsd-ports/tree/master/mail/
</span><span style='display:block; white-space:pre;color:#404040;'> * https://github.com/st3fan/dovecot-xaps-daemon/issues/46
</span>---
mail/dovecot2/Portfile | 132 ++++-
mail/dovecot2/files/dovecot-core-pushnotify.patch | 551 +++++++++++++++++++++
.../dovecot2/files/org.macports.dovecot-apns.plist | 21 +
mail/dovecot2/files/org.macports.dovecot2.plist | 21 +
mail/dovecot2/files/pushnotify.pl | 198 ++++++++
mail/mail-server/Portfile | 5 +-
.../files/prefix/etc/dovecot/conf.d/15-lda.conf | 4 +-
.../files/prefix/etc/dovecot/conf.d/90-apns.conf | 5 +
perl/p5-net-apns-persistent/Portfile | 26 +
perl/p5-privileges-drop/Portfile | 30 ++
10 files changed, 986 insertions(+), 7 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot2/Portfile b/mail/dovecot2/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 00f6cc7..7c550926 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mail/dovecot2/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot2/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -105,6 +105,89 @@ variant libstemmer description {Use libstemmer for full-text search} {
</span> configure.args-append --with-libstemmer
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+variant apns \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ description "Enable Apple Push Notification Service (APNS)" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # diff -Naur core-2.3.7.1 core-2.3.7.1-pushnotify | sed -E -e 's/core-([[:digit:]]+\.?)+(-pushnotify)?\//.\//g' > dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/src/imap/cmd-x-apple-push-service.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/src/plugins/push-notify/push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set perl5_major_version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 5.28
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:perl${perl5_major_version} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5_major_version}-net-apns-persistent \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5_major_version}-privileges-drop
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pre-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0750 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -o ${default_internal_user} -g ${default_login_user} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/db/${base_name}-apns/devices \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${base_name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.keepdirs-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/db/${base_name}-apns/devices \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${base_name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 ${filespath}/pushnotify.pl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/sbin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach cmd [list \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@PERL5_MAJOR_VERSION@|${perl5_major_version}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "s|@DEFAULT_INTERNAL_USER@|${default_internal_user}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace ${cmd} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/sbin/pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # References:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # * https://github.com/matthewpowell/pushnotify
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # * https://www.c0ffee.net/blog/dovecot-push-notifications/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notes-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "Dovecot is configured with the Apple Push Notification Service (APNS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+plugin. APNS use requires these steps:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1. Acquire APNS Mail certificates from a (virtual) macOS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ High Sierra 10.13 and Server.app version 5.7. Export
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ the certificates from the Keychain into the file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.servermgrd.apns.mail.p12 . *Note*: APNS Mail
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ certificate creation is deprecated on Server.app version 5.8+.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 2. Convert the APNS Mail certificates to PEM files:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl pkcs12 -in com.apple.servermgrd.apns.mail.p12 \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -clcerts -nokeys | sed '/BEGIN CERTIFICATE/,\$!d' \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ > com.apple.mail.cert.pem
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo install -m 0644 -o ${default_internal_user} -g ${default_login_user} \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.mail.cert.pem ${prefix}/etc/dovecot-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl pkcs12 -in com.apple.servermgrd.apns.mail.p12 \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -nodes -nocerts | sed '/BEGIN PRIVATE KEY/,\$!d' \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ > com.apple.mail.key.pem
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo install -m 0640 -o ${default_internal_user} -g ${default_login_user} \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ com.apple.mail.key.pem ${prefix}/etc/dovecot-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 3. Configure dovecot for APNS:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/${base_name}/conf.d/15-lda.conf:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ protocol lda { mail_plugins = \$mail_plugins push_notify }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/${base_name}/conf.d/90-apns.conf:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps_topic = com.apple.mail.XServer.<UUID>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ where the certificate's UUID is obtained from the command:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openssl x509 -text -noout \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -in ${prefix}/etc/dovecot-apns/com.apple.mail.cert.pem \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ | grep -E -o 'com\.apple\.mail\.XServer\.\[0-9a-f-\]+'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 4. Launch the APNS daemon:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo launchctl load -w \\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /Library/LaunchDaemons/org.macports.dovecot-apns.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> variant postgresql96 \
conflicts postgresql82 postgresql83 postgresql84 \
postgresql90 postgresql91 postgresql92 postgresql93 postgresql94 \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -252,9 +335,52 @@ variant mysql5 \
</span> variant no_startupitem description {Do not install a launchd plist} {}
if {![variant_isset "no_startupitem"]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- startupitem.create yes
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- startupitem.executable ${prefix}/sbin/${base_name}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- startupitem.pidfile auto ${prefix}/var/run/${base_name}/master.pid
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![variant_isset "apns"]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.create yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.executable ${prefix}/sbin/${base_name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.pidfile auto ${prefix}/var/run/${base_name}/master.pid
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set daemon_uniquename \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ org.macports.${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set pushnotify_uniquename \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ org.macports.${base_name}-apns
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.type launchd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitem.create no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Inject our own launchd plists to include pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ startupitems \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ name ${name} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ location LaunchDaemons \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uniquename ${daemon_uniquename} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plist ${daemon_uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ name ${base_name}-apns \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ location LaunchDaemons \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uniquename ${pushnotify_uniquename} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ plist ${pushnotify_uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach uniquename "${daemon_uniquename} ${pushnotify_uniquename}" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 644 -W ${filespath} ${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons/${uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons/${uniquename}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ move ${destroot}/Library/LaunchDaemons/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons/${uniquename}/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${startupitem.install} && [geteuid] == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -s \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/LaunchDaemons/${uniquename}/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}/Library/LaunchDaemons/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -s \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/LaunchDaemons/${uniquename}/${uniquename}.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
destroot.keepdirs \
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot2/files/dovecot-core-pushnotify.patch b/mail/dovecot2/files/dovecot-core-pushnotify.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..6d33e9a
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot2/files/dovecot-core-pushnotify.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,551 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./configure.ac ./configure.ac
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./configure.ac 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./configure.ac 2019-10-10 05:40:20.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -911,6 +911,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/notify/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/notify-status/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/push-notification/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++src/plugins/push-notify/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/pop3-migration/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/quota/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/plugins/quota-clone/Makefile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/auth/auth-settings.c ./src/auth/auth-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/auth/auth-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/auth/auth-settings.c 2019-10-08 18:37:33.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -269,6 +269,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEFLIST(passdbs, "passdb", &auth_passdb_setting_parser_info),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEFLIST(userdbs, "userdb", &auth_userdb_setting_parser_info),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF_NOPREFIX(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_STR, base_dir),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_BOOL, verbose_proctitle),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF_NOPREFIX(SET_UINT, first_valid_uid),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -331,6 +333,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .passdbs = ARRAY_INIT,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .userdbs = ARRAY_INIT,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .base_dir = PKG_RUNDIR,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .verbose_proctitle = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .first_valid_uid = 500,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/auth/auth-settings.h ./src/auth/auth-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/auth/auth-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/auth/auth-settings.h 2019-10-08 17:51:20.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -82,6 +82,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ARRAY(struct auth_passdb_settings *) passdbs;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ARRAY(struct auth_userdb_settings *) userdbs;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *base_dir;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *ssl_client_ca_dir;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *ssl_client_ca_file;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/Makefile.am ./src/imap/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/Makefile.am 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/Makefile.am 2019-10-08 20:40:24.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -64,6 +64,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-unselect.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-unsubscribe.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-urlfetch.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ cmd-x-apple-push-service.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-x-cancel.c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cmd-x-state.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/cmd-x-apple-push-service.c ./src/imap/cmd-x-apple-push-service.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/cmd-x-apple-push-service.c 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/cmd-x-apple-push-service.c 2019-10-10 06:22:12.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,173 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Copyright (c) 2010-2011 Apple Inc. All rights reserved.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * modification, are permitted provided that the following conditions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * are met:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 2. Redistributions in binary form must reproduce the above
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * copyright notice, this list of conditions and the following
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * disclaimer in the documentation and/or other materials provided
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * with the distribution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * 3. Neither the name of Apple Inc. ("Apple") nor the names of its
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * contributors may be used to endorse or promote products derived
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * from this software without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * SUCH DAMAGE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-common.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-id.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "str.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "home-expand.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-user.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "imap-quote.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <stdio.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <fcntl.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <stdlib.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <unistd.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/un.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/stat.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/socket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define APS_VERSION "1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef struct msg_data_s {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long msg;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long pid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d1[128];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d2[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d3[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d4[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} msg_data_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ tag1 XAPPLEPUSHSERVICE "aps-version" "1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-account-id" "E8CD34AD-98D3-4489-A6BB-86B1D082FECE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-device-token" "a66216ad1683d48b9933cdcc3b98a833ee1a968143f41ea494187da54715da66"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "aps-subtopic" "com.apple.mobilemail"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++*/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void do_notify(const char *username, const char *aps_acct_id,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_dev_token, const char *aps_sub_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *push_notify_path = "@PREFIX@/var/run/dovecot/push_notify";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data_t msg_data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset(&msg_data, 0, sizeof(struct msg_data_s));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data.msg = 2;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d1, username, sizeof(msg_data.d1));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d2, aps_acct_id, sizeof(msg_data.d2));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d3, aps_dev_token, sizeof(msg_data.d3));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy(msg_data.d4, aps_sub_topic, sizeof(msg_data.d4));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int soc = socket( AF_UNIX, SOCK_DGRAM, 0 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( soc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "open notify socket failed(%d): %m", soc );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct sockaddr_un sock_addr;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset( &sock_addr, 0, sizeof(struct sockaddr_un));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_addr.sun_family = AF_UNIX;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( sock_addr.sun_path, push_notify_path, sizeof(sock_addr.sun_path) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ socklen_t sock_len = sizeof(sock_addr.sun_family) + strlen(sock_addr.sun_path) + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int rc = connect(soc, (struct sockaddr *) &sock_addr, sock_len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning("connect to notify socket %s failed: %m",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notify_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(soc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = send(soc, (void *)&msg_data, sizeof(msg_data), 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning("send to notify socket %s failed: %m",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notify_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(soc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static const char *aps_reply_generate (struct client_command_context *cmd,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const struct imap_arg *args)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic = cmd->client->set->aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_ver=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_acct_id=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_dev_token=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_sub_topic=NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *key, *value;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* must have a topic */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (aps_topic == NULL || *aps_topic == '\0')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* scarf off the aps keys/values */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ while (imap_arg_get_astring(&args[0], &key) &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_arg_get_astring(&args[1], &value)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (strcasecmp(key, "aps-version") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_ver = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-account-id") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_acct_id = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-device-token") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_dev_token = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (strcasecmp(key, "aps-subtopic") == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_sub_topic = t_strdup(value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ args += 2;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* save notification settings */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( aps_ver && aps_acct_id && aps_dev_token && aps_sub_topic ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* subscribe to notification node */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ do_notify(cmd->client->user->username, aps_acct_id,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ aps_dev_token, aps_sub_topic);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* generate aps response */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ string_t *str = t_str_new(256);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, "aps-version" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, APS_VERSION );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, "aps-topic" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append_c(str, ' ');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ imap_append_quoted( str, aps_topic );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return str_c(str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++bool cmd_x_apple_push_service(struct client_command_context *cmd)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const struct imap_arg *args;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!client_read_args(cmd, 0, 0, &args))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return FALSE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *reply = aps_reply_generate(cmd, args);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (reply != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ client_send_line(cmd->client,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ t_strdup_printf("* XAPPLEPUSHSERVICE %s",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ reply));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ client_send_tagline(cmd, "OK XAPPLEPUSHSERVICE completed.");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return TRUE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-client.c ./src/imap/imap-client.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-client.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-client.c 2019-10-08 20:42:59.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -182,6 +182,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ a chance of working */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client_add_capability(client, "SEARCH=FUZZY");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (set->aps_topic != NULL && *set->aps_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append(client->capability_string, " XAPPLEPUSHSERVICE");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_set = mail_user_set_get_storage_set(user);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (mail_set->mailbox_list_index) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-commands.c ./src/imap/imap-commands.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-commands.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-commands.c 2019-10-08 20:15:39.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -76,6 +76,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UID SORT", cmd_sort, COMMAND_FLAG_BREAKS_SEQS },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UID THREAD", cmd_thread, COMMAND_FLAG_BREAKS_SEQS },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "UNSELECT", cmd_unselect, COMMAND_FLAG_BREAKS_MAILBOX },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ { "XAPPLEPUSHSERVICE", cmd_x_apple_push_service, 0},
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "X-CANCEL", cmd_x_cancel, 0 },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "X-STATE", cmd_x_state, COMMAND_FLAG_REQUIRES_SYNC },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ { "XLIST", cmd_list, 0 },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-commands.h ./src/imap/imap-commands.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-commands.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-commands.h 2019-10-08 20:16:48.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -121,6 +121,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_uid_expunge(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_move(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_unselect(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++bool cmd_x_apple_push_service(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_x_cancel(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool cmd_x_state(struct client_command_context *cmd);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-settings.c ./src/imap/imap-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-settings.c 2019-10-08 17:57:36.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -73,6 +73,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_logout_format),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_send),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_log),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_ENUM, imap_fetch_failure),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_metadata),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_literal_minus),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -101,6 +102,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "body_count=%{fetch_body_count} body_bytes=%{fetch_body_bytes}",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_send = "name *",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_log = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_fetch_failure = "disconnect-immediately:disconnect-after:no-after",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_metadata = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_literal_minus = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap/imap-settings.h ./src/imap/imap-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap/imap-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap/imap-settings.h 2019-10-08 17:48:14.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_logout_format;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_send;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_log;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_fetch_failure;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_metadata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_literal_minus;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-client.c ./src/imap-login/imap-login-client.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-client.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-client.c 2019-10-11 08:28:49.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -117,6 +117,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ str_append(cap_str, " STARTTLS");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (is_login_cmd_disabled(client))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ str_append(cap_str, " LOGINDISABLED");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (*imap_client->set->aps_topic)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ str_append(cap_str, " XAPPLEPUSHSERVICE");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ client_authenticate_get_capabilities(client, cap_str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return str_c(cap_str);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-settings.c ./src/imap-login/imap-login-settings.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-settings.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-settings.c 2019-10-08 18:33:32.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -57,6 +57,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_capability),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_send),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_STR, imap_id_log),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ DEF(SET_STR, aps_topic),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_literal_minus),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ DEF(SET_BOOL, imap_id_retain),
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -67,6 +68,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_capability = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_send = "name *",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_log = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ .aps_topic = "",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_literal_minus = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ .imap_id_retain = FALSE,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/imap-login/imap-login-settings.h ./src/imap-login/imap-login-settings.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/imap-login/imap-login-settings.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/imap-login/imap-login-settings.h 2019-10-08 17:49:33.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -5,6 +5,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_capability;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_send;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *imap_id_log;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *aps_topic;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_literal_minus;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool imap_id_retain;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/lib-lda/mail-deliver.c ./src/lib-lda/mail-deliver.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/lib-lda/mail-deliver.c 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/lib-lda/mail-deliver.c 2019-10-11 08:16:28.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deliver_mail_func_t *deliver_mail = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++deliver_hook_func_t *deliver_hook = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct mail_deliver_cache {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ bool filled;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -409,6 +410,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_log(ctx, "saved mail to %s", mailbox_name);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pool_unref(&changes.pool);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (deliver_hook != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_log(ctx, "save failed to %s: %s", mailbox_name,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_storage_get_last_internal_error(*storage_r, &error));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -503,6 +507,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* success. message may or may not have been saved. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!ret && deliver_hook)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook(ctx, ctx->rcpt_default_mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_duplicate_db_deinit(&ctx->dup_db);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (ret < 0 && mail_deliver_is_tempfailed(ctx, *storage_r)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ muser->deliver_ctx = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/lib-lda/mail-deliver.h ./src/lib-lda/mail-deliver.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/lib-lda/mail-deliver.h 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/lib-lda/mail-deliver.h 2019-10-08 20:50:00.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -82,6 +82,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct mail_storage **storage_r);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ extern deliver_mail_func_t *deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef void deliver_hook_func_t(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++extern deliver_hook_func_t *deliver_hook;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const struct var_expand_table *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_deliver_ctx_get_log_var_expand_table(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/Makefile.am ./src/plugins/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/Makefile.am 2019-07-23 03:14:10.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/Makefile.am 2019-10-11 05:56:16.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notify \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notify-status \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push-notification \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail-filter \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail-log \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $(MAIL_LUA) \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/Makefile.am ./src/plugins/push-notify/Makefile.am
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/Makefile.am 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/Makefile.am 2019-10-11 08:48:43.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,25 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++AM_CPPFLAGS = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-lda \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-mail \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-smtp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ -I$(top_srcdir)/src/lib-storage
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++NOPLUGIN_LDFLAGS =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++lib20_push_notify_plugin_la_LDFLAGS = -module -avoid-version
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++module_LTLIBRARIES = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ lib20_push_notify_plugin.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if DOVECOT_PLUGIN_DEPS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++notify_deps = ../notify/lib15_notify_plugin.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++lib20_push_notify_plugin_la_SOURCES = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++headers = \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push-notify-plugin.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++pkginc_libdir = $(pkgincludedir)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++pkginc_lib_HEADERS = $(headers)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/push-notify-plugin.c ./src/plugins/push-notify/push-notify-plugin.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/push-notify-plugin.c 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/push-notify-plugin.c 2019-10-11 09:06:31.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,102 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/* Copyright (c) 2008-2011 Apple, inc. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "lib.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-deliver.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "mail-namespace.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "message-address.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include "push-notify-plugin.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/un.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/stat.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/socket.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <sys/unistd.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++const char *push_notify_plugin_version = DOVECOT_ABI_VERSION;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static deliver_hook_func_t *next_deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct et_list *_et_list = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct message_info {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *from;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *subj;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// -----------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++// push_notification ()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++push_notification(struct mail_deliver_context *ctx, const char *mailbox)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int debug = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int notify_sock = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *sock_path = "@PREFIX@/var/run/dovecot/push_notify";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ssize_t rc = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ socklen_t sock_len = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct sockaddr_un sock_addr;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ struct msg_data_s msg_data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (ctx->rcpt_user->mail_debug) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ debug = 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: push notification enabled" );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( strcasecmp(mailbox, "INBOX") != 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: message saved to mailbox: %s, no notification sent", mailbox );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ notify_sock = socket( AF_UNIX, SOCK_DGRAM, 0 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( notify_sock < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* warn that connect failed but do not fail the plugin or message will not get delivered */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: open socket: \"%s\" failed", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_addr.sun_family = AF_UNIX;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( sock_addr.sun_path, "@PREFIX@/var/run/dovecot/push_notify", sizeof(sock_addr.sun_path) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sock_len = sizeof(sock_addr.sun_family) + strlen(sock_addr.sun_path) + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = connect(notify_sock, (struct sockaddr *) &sock_addr, sock_len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* warn that connect failed but do not fail the plugin or message will not get delivered */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: connect() to socket: \"%s\" failed: %m", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset( &msg_data, 0, sizeof( msg_data ) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ msg_data.msg = 3;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /* set user/account id */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( ctx->rcpt_user->username != NULL ) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ strncpy( msg_data.d1, ctx->rcpt_user->username, sizeof(msg_data.d1) );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (debug)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info( "push-notify: notify: %s", msg_data.d1 );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rc = send(notify_sock, (void *)&msg_data, sizeof(struct msg_data_s), 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ( rc < 0 )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_warning( "push-notify: send() to socket: \"%s\" failed: %m", sock_path );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (debug)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ i_info("push-notify: data sent: %lu", rc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ close(notify_sock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} // push_notification
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void push_notify_deliver(struct mail_deliver_context *ctx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ const char *mailbox)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ push_notification(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (next_deliver_mail != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ next_deliver_mail(ctx, mailbox);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_init (struct module *module ATTR_UNUSED)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ next_deliver_mail = deliver_hook;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook = push_notify_deliver;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_deinit (void)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ deliver_hook = next_deliver_mail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff -Naur ./src/plugins/push-notify/push-notify-plugin.h ./src/plugins/push-notify/push-notify-plugin.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- ./src/plugins/push-notify/push-notify-plugin.h 1969-12-31 19:00:00.000000000 -0500
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ ./src/plugins/push-notify/push-notify-plugin.h 2019-10-08 20:53:46.000000000 -0400
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -0,0 +1,20 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++/* Copyright (c) 2008-2011 Apple, inc. */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifndef __NOTIFY_PLUGIN_H__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#define __NOTIFY_PLUGIN_H__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++struct module;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_init(struct module *module);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void push_notify_plugin_deinit(void);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++typedef struct msg_data_s {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long msg;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned long pid;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d1[128];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d2[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d3[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ char d4[512];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++} msg_data_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot2/files/org.macports.dovecot-apns.plist b/mail/dovecot2/files/org.macports.dovecot-apns.plist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..97743ce
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot2/files/org.macports.dovecot-apns.plist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<?xml version='1.0' encoding='UTF-8'?>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<plist version='1.0'>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Label</key><string>org.macports.dovecot-apns</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>ProgramArguments</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/bin/daemondo</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--label=dovecot-apns</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--start-cmd</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/sbin/pushnotify.pl</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>;</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pid=fileauto</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pidfile</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/var/run/dovecot/pushnotify.pid</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Disabled</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>KeepAlive</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</plist>
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot2/files/org.macports.dovecot2.plist b/mail/dovecot2/files/org.macports.dovecot2.plist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..1a0821b
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot2/files/org.macports.dovecot2.plist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<?xml version='1.0' encoding='UTF-8'?>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<plist version='1.0'>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Label</key><string>org.macports.dovecot2</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>ProgramArguments</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/bin/daemondo</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--label=dovecot2</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--start-cmd</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/sbin/dovecot</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>;</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pid=fileauto</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>--pidfile</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/var/run/dovecot/master.pid</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>Disabled</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<key>KeepAlive</key><true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</plist>
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/dovecot2/files/pushnotify.pl b/mail/dovecot2/files/pushnotify.pl
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..4b72b4d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/dovecot2/files/pushnotify.pl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,198 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!@PREFIX@/bin/perl@PERL5_MAJOR_VERSION@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use strict;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use warnings;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Privileges::Drop;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Getopt::Long;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use IO::Socket::UNIX qw( SOCK_DGRAM SOMAXCONN );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Sys::Syslog qw( openlog syslog LOG_INFO );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Net::APNS::Persistent;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use Net::APNS::Feedback;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Dovecot's push notification socket
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $sockpath = '@PREFIX@/var/run/dovecot/push_notify';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# user to drop privileges to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $user = '@DEFAULT_INTERNAL_USER@';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# A file containing registration information
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $devicepath = '@PREFIX@/var/db/dovecot-apns/devices';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# APNS certificate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns_cert = '@PREFIX@/etc/dovecot-apns/com.apple.mail.cert.pem';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# APNS key (might be the same as $apns_cert)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns_key = '@PREFIX@/etc/dovecot-apns/com.apple.mail.key.pem';
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $help;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub usage {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<<"EOF";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+$0 [arguments]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Arguments:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --user <unprivileged_user> (default $user)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --tokendb <devices_file> (default $devicepath)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --certfile <apns_certificate> (default $apns_cert)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --keyfile <apns_privkey> (default $apns_key)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --help
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+EOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GetOptions('user=s' => \$user,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'tokendb=s' => \$devicepath,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'certfile=s' => \$apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'keyfile=s' => \$apns_key,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'help' => \$help)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+or die usage;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if ($help) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ print usage;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Read in the list of registered devices.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my %devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if (open DEVICES, $devicepath) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+while (<DEVICES>) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ chomp;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($username, $devicedata) = split /:/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @{$devices{$username}}, $devicedata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+close DEVICES;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Open the socket to Dovecot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+unlink $sockpath;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+umask (0111);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $socket = IO::Socket::UNIX->new(
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Type => SOCK_DGRAM,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Local => $sockpath,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Listen => SOMAXCONN,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+or die("Can't create server socket: $!\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+drop_privileges($user);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+openlog ('apns', 'ndelay', 'mail');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# When we last checked the feedback service (right now, never).
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $last_feedback = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# When we last reconnected to APNS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $last_connect = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# We'll defer connecting to APNS until our first notification, but define $apns here
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $apns;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+syslog (LOG_INFO, 'Dovecot APNS service running');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+while(1)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+$socket->recv($data, 2048);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my $pretty = join('|', split(/\0+/, $data));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+my ($junk, $username, $aps_acct_id, $aps_dev_token, $aps_sub_topic) = split /\0+/, $data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if ($aps_acct_id) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token = lc($aps_dev_token);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $devicedata = join ',', $aps_acct_id, $aps_dev_token, $aps_sub_topic, time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog (LOG_INFO, "Register device $aps_dev_token for $username");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Cancel any duplicate registration
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ @{$devices{$username}} = grep {!/$aps_dev_token/} @{$devices{$username}};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Register new device
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @{$devices{$username}}, $devicedata;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (defined $devices{$username}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # User has at least one device registered
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Do the push notification
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($aps_acct_id, $aps_dev_token, $aps_sub_topic, $time) = split /,/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, "Send notification to $aps_dev_token for $username");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ eval {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ die if (time - $last_connect > 600);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->queue_notification (
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps => {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'account-id' => $aps_acct_id
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->send_queue;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } or do {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Failed; connect to APNS and try again
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, 'Connect to APNS push gateway');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $last_connect = time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ eval { $apns->disconnect };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns = Net::APNS::Persistent->new({
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sandbox => 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cert => $apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ key => $apns_key
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->queue_notification (
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $aps_dev_token,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ aps => {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 'account-id' => $aps_acct_id
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ },
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns->send_queue;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Check for devices that don't want notifications any more
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (time - $last_feedback > 3600) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, 'Check APNS feedback service');
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $last_feedback = time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $apns_feedback = Net::APNS::Feedback->new({
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sandbox => 0,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cert => $apns_cert,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ key => $apns_key
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ });
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback = $apns_feedback->retrieve_feedback;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $apns_feedback->disconnect;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (defined $feedback) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Got at least one value
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@$feedback) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback_token = lc($$_{token});
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my $feedback_time = $$_{time_t};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $username (keys %devices) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my @unregister;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ my ($aps_acct_id, $aps_dev_token, $aps_sub_topic, $time) = split /,/;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ($aps_dev_token eq $feedback_token && $time < $feedback_time) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Hasn't registered since the rejection; unregister
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ push @unregister, $feedback_token
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $token (@unregister) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ syslog(LOG_INFO, "Unregister device $token");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ @{$devices{$username}} = grep {!/$token/} @{$devices{$username}};
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ save_devices;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+sub save_devices {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Save our registration data
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ umask (0077);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ open DEVICES, ">$devicepath";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $username (keys %devices) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach my $devicedata (@{$devices{$username}}) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ print DEVICES "$username:$devicedata\n";
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close DEVICES;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/mail-server/Portfile b/mail/mail-server/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 97275e8..83122a9 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mail/mail-server/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/mail-server/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -19,7 +19,8 @@ long_description ${description} \
</span> easily modifiable mail server. The configuration is built using \
postfix for the MTA, dovecot for the MDA, solr for fast search, \
rspamd for a milter, and clamav for email virus scans. The \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- configuration includes a surrogate TLS certificate and DKIM.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configuration includes a surrogate TLS certificate, DKIM, and \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Apple Push Notification Service (APNS) capability for iOS devices.
</span>
homepage https://www.postfix.org/
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -78,7 +79,7 @@ Postfix not installed with required variants. Please install:
</span> append required_variants_message "\
Dovecot not installed with required variants. Please install:
<span style='display:block; white-space:pre;background:#ffe0e0;'>- sudo port -pN install dovecot2 +[join ${dovecot2_required_variants} +]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo port -pN install dovecot2 +[join ${dovecot2_required_variants} +] \[+apns\]
</span>
"
set required_variants_flag false
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/mail-server/files/prefix/etc/dovecot/conf.d/15-lda.conf b/mail/mail-server/files/prefix/etc/dovecot/conf.d/15-lda.conf
</span><span style='display:block; white-space:pre;color:#808080;'>index 0cc8ea3..c16025d 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mail/mail-server/files/prefix/etc/dovecot/conf.d/15-lda.conf
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/mail-server/files/prefix/etc/dovecot/conf.d/15-lda.conf
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -72,6 +72,6 @@ protocol lda {
</span> # use fsync for write-safety - this deals with delivering actual mail
mail_fsync = optimized
# Space separated list of plugins to load (default is global mail_plugins).
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # mail_plugins = $mail_plugins sieve push_notify
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mail_plugins = $mail_plugins sieve
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mail_plugins = $mail_plugins sieve push_notify
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # mail_plugins = $mail_plugins sieve
</span> }
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mail/mail-server/files/prefix/etc/dovecot/conf.d/90-apns.conf b/mail/mail-server/files/prefix/etc/dovecot/conf.d/90-apns.conf
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..7bbf080
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mail/mail-server/files/prefix/etc/dovecot/conf.d/90-apns.conf
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,5 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# openssl x509 -text -noout \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -in @PREFIX@/etc/dovecot-apns/com.apple.mail.cert.pem \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# | grep -E -o 'com.apple.mail.XServer.[0-9a-f-]+'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+aps_topic = com.apple.mail.XServer.<UUID>
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/perl/p5-net-apns-persistent/Portfile b/perl/p5-net-apns-persistent/Portfile
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..bc7ae79
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/perl/p5-net-apns-persistent/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,26 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup perl5 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+perl5.branches 5.26 5.28 5.30
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+perl5.setup Net-APNS-Persistent 0.02 ../by-authors/id/A/AU/AUFFLICK
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+platforms darwin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+maintainers nomaintainer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license {Artistic-1 GPL}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description Send Apple APNS notifications over a persistent connection.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description Class to create a persistent connection to Apple's \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ APNS servers.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 0468bcf46c73739766332767ffc93a939c4cf2a2 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 7984e4eaaa1edcddaa868762efeb36406f5ff5b9f0d2455f8c0b217e5429f397 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 9755
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${perl5.major} != ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-class-accessor \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-common-sense \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-json-xs \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-types-serialiser
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/perl/p5-privileges-drop/Portfile b/perl/p5-privileges-drop/Portfile
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..faa787e
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/perl/p5-privileges-drop/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,30 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup perl5 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+perl5.branches 5.26 5.28 5.30
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+perl5.setup Privileges-Drop 1.03 ../by-authors/id/T/TL/TLBDK
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+platforms darwin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+maintainers nomaintainer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license {Artistic-1 GPL}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description A module to make it simple to drop all privileges, \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ even POSIX groups.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description This module tries to simplify the process of dropping \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ privileges. This can be useful when your Perl program needs to bind \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ to privileged ports, etc. This module is much like Proc::UID, except \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ that it's implemented in pure Perl. Special care has been taken to \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ also drop saved uid on platforms that support this, currently only \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ test on on Linux.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 76b6a0ef066d18948696a74a550ab6731e070f6d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 4047a8c927eb79f2ddf2b19c2e52be1d1c1582e85a6bc2d487db6154a8c9e50c \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 5917
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${perl5.major} != ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-http-date \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-module-build \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:p${perl5.major}-yaml
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span></pre><pre style='margin:0'>
</pre>