Hello community, here is the log from the commit of package kopano for openSUSE:Factory checked in at 2017-05-06 18:29:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kopano (Old) and /work/SRC/openSUSE:Factory/.kopano.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kopano" Sat May 6 18:29:43 2017 rev:4 rq:491706 version:8.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kopano/kopano.changes 2017-03-17 15:07:12.448250177 +0100 +++ /work/SRC/openSUSE:Factory/.kopano.new/kopano.changes 2017-05-06 18:29:45.158370662 +0200 @@ -1,0 +2,12 @@ +Thu Apr 27 21:03:57 UTC 2017 - [email protected] + +- Update to new upstream release 8.3 + * Enhancements: + * migration-pst: call SaveChanges only once [KC-534] + * Fixes: + * caldav: avoid a nullptr dereference [KC-236] + * cachestat: avoid exception and unpack tuple [KC-402] + * ldapplugin: revert "catch empty ldap_search_base" [KC-602] + * spooler: fix crash on forwarding rules [KC-608] + +------------------------------------------------------------------- Old: ---- kopanocore-8.3.0~1007.tar.xz New: ---- kopanocore-8.3.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kopano.spec ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:46.878127995 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:46.882127431 +0200 @@ -17,19 +17,15 @@ # -%define version_unconverted 8.3.0~1007 - Name: kopano -Version: 8.3.0~1007 +Version: 8.3.0 Release: 0 +%define rversion 8.3.0 +%define revision 1042 Summary: Collaboration software for professionals License: AGPL-3.0 Group: Productivity/Networking/Email/Servers Url: https://kopano.io/ - -%define rversion %(echo "%version" | perl -pe 's{^(\\d+\\D+\\d+\\D+\\d+).*}{$1}') -%define revision %(echo "%version" | perl -pe 's{^\\d+\\D+\\d+\\D+\\d+\\D+(\\d+).*}{$1}') - Source: kopanocore-%version.tar.xz Source2: kopano-bash-completion.sh Source3: %name-rpmlintrc @@ -90,11 +86,6 @@ # Satisfy Requires(pre) for bs_worker's rpmlint run BuildRequires: pwdutils %endif - -%if 0%{?suse_version} > 1320 -BuildRequires: gcc6-c++ -#!BuildIgnore: libgcc_s1 -%endif %if "%_repository" == "RHEL_6" || "%_repository" == "RHEL_6_PHP_56" BuildRequires: devtoolset-4-gcc-c++ %endif @@ -558,7 +549,7 @@ --with-quotatemplate-prefix="%_sysconfdir/kopano/quotamail" \ --with-php-config="%phpconfig" \ --enable-epoll --enable-unicode \ - --disable-static --enable-release --enable-icu + --disable-static --enable-release echo "%rversion" >version #hot override echo "%revision" >revision make V=1 %{?_smp_mflags} @@ -761,7 +752,7 @@ if [ "$1" -eq 2 ]; then # On update from kopano-server-X to kopano-server-Y… # propmap.cfg is now untracked (as desired). - if [ -a ! -e %_sysconfdir/kopano/ldap.propmap.cfg -a \ + if [ ! -e "%_sysconfdir/kopano/ldap.propmap.cfg" -a \ -e "%_sysconfdir/kopano/ldap.propmap.cfg.rpmsave" ]; \ then # A rename occured because of private modifications. @@ -929,7 +920,9 @@ %_mandir/man*/kopano-mr-accept.* %_mandir/man*/kopano-mr-process.* %_mandir/man*/kopano-dagent.* -%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano/ +%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano +%attr(0750,kopano,kopano) %_localstatedir/lib/kopano/dagent +%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano %dir %_docdir/kopano %dir %_docdir/kopano/example-config %_docdir/kopano/example-config/autorespond @@ -1030,8 +1023,9 @@ %config(noreplace) %attr(-,root,kopano) %_sysconfdir/kopano/searchscripts/attachments_parser %config(noreplace) %attr(-,root,kopano) %_sysconfdir/kopano/searchscripts/zmktemp %_mandir/man*/kopano-search.* -%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano/search/ -%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano/ +%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano +%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano/search +%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano %dir %_docdir/kopano %dir %_docdir/kopano/example-config %_docdir/kopano/example-config/search.cfg @@ -1065,8 +1059,8 @@ %_mandir/man*/kopano-server.* %_mandir/man*/kopano-ldap.cfg.* %_mandir/man*/kopano-unix.cfg.* -%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano/ -%attr(0750,kopano,kopano) %dir %_localstatedir/lib/%name/ +%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano +%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano %dir %_datadir/kopano %_datadir/kopano/ldap.active-directory.cfg %_datadir/kopano/ldap.openldap.cfg @@ -1101,7 +1095,9 @@ %_prefix/lib/systemd/system/kopano-spooler.service %_mandir/man*/kopano-spooler.* %_datadir/kopano-spooler -%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano/ +%attr(0750,kopano,kopano) %dir %_localstatedir/lib/kopano +%attr(0750,kopano,kopano) %_localstatedir/lib/kopano/spooler +%attr(0750,kopano,kopano) %dir %_localstatedir/log/kopano %dir %_docdir/kopano %dir %_docdir/kopano/example-config %_docdir/kopano/example-config/spooler.cfg ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:46.938119530 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:46.942118966 +0200 @@ -1,5 +1,5 @@ pkgname=kopano -pkgver=8.3.0~1007 +pkgver=8.3.0 pkgrel=0 pkgdesc='Kopano' arch=('x86_64') ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:46.970115016 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:46.970115016 +0200 @@ -2,10 +2,8 @@ <service name="tar_scm" mode="disabled"> <param name="scm">git</param> <param name="url">https://stash.kopano.io/scm/kc/kopanocore.git</param> - <param name="revision">release</param> - <param name="filename">kopanocore</param> - <param name="parent-tag">bp/8.3.0</param> - <param name="versionformat">8.3.0~@TAG_OFFSET@</param> + <param name="revision">kopanocore-8.3.0</param> + <param name="versionformat">8.3.0</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> ++++++ build.collax ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:46.990112194 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:46.994111630 +0200 @@ -2,7 +2,7 @@ set -x source=kopanocore -version=8.3.0~547 +version=8.3.0 revnum=0 build=0 @@ -21,7 +21,6 @@ --enable-release --enable-tcmalloc --enable-unicode - --enable-icu CPPFLAGS=-DOEM_COLLAX ' ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:47.022107679 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:47.022107679 +0200 @@ -1,4 +1,4 @@ -kopano (8.3.0~1007-0) unstable; urgency=low +kopano (8.3.0-0) unstable; urgency=low * Current release. ++++++ debian.rules ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:47.901983524 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:47.905982960 +0200 @@ -54,7 +54,7 @@ --disable-static --enable-tcmalloc TCMALLOC_CFLAGS=" " \ TCMALLOC_LIBS="-ltcmalloc_minimal" --enable-epoll \ --enable-unicode $(CONFFLAG) \ - --enable-release --enable-icu + --enable-release # first entry point of dpkg-buildpackage clean: ++++++ kopano.dsc ++++++ --- /var/tmp/diff_new_pack.Fu0iLp/_old 2017-05-06 18:29:47.985971673 +0200 +++ /var/tmp/diff_new_pack.Fu0iLp/_new 2017-05-06 18:29:47.985971673 +0200 @@ -1,7 +1,7 @@ Format: 1.0 Source: kopano Architecture: any all -Version: 8.3.0~1007-0 +Version: 8.3.0-0 DEBTRANSFORM-RELEASE: 1 Maintainer: Kopano Development <[email protected]> Homepage: https://kopano.com ++++++ kopanocore-8.3.0~1007.tar.xz -> kopanocore-8.3.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/ECtools/migration-pst/kopano_migration_pst/__init__.py new/kopanocore-8.3.0/ECtools/migration-pst/kopano_migration_pst/__init__.py --- old/kopanocore-8.3.0~1007/ECtools/migration-pst/kopano_migration_pst/__init__.py 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/ECtools/migration-pst/kopano_migration_pst/__init__.py 2017-04-26 17:13:49.000000000 +0200 @@ -41,9 +41,9 @@ if attach_method == ATTACH_EMBEDDED_MSG and subnode_nid is not None: submessage = pst.Message(subnode_nid, self.ltp, self.nbd, parent) submapiobj = mapiobj.OpenProperty(PR_ATTACH_DATA_OBJ, IID_IMessage, 0, MAPI_CREATE | MAPI_MODIFY) - self.import_props(submessage, submapiobj, embedded=True) self.import_attachments(submessage, submapiobj) self.import_recipients(submessage, submapiobj) + self.import_props(submessage, submapiobj, embedded=True) mapiobj.SetProps(props2) mapiobj.SaveChanges(KEEP_OPEN_READWRITE) @@ -86,7 +86,6 @@ props.append(SPropValue(PR_ENTRYID, user.userid.decode('hex'))) recipients.append(props) mapiobj.ModifyRecipients(0, recipients) - mapiobj.SaveChanges(KEEP_OPEN_READWRITE) def import_pst(self, p, user): folders = p.folder_generator() @@ -106,9 +105,9 @@ with log_exc(self.log, self.stats): self.log.debug("importing message '%s'" % (message.Subject or '')) message2 = folder2.create_item() - self.import_props(message, message2.mapiobj) self.import_attachments(message, message2.mapiobj) self.import_recipients(message, message2.mapiobj) + self.import_props(message, message2.mapiobj) self.stats['messages'] += 1 def get_named_property_map(self, p): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/ECtools/migration-pst/kopano_migration_pst/pst.py new/kopanocore-8.3.0/ECtools/migration-pst/kopano_migration_pst/pst.py --- old/kopanocore-8.3.0~1007/ECtools/migration-pst/kopano_migration_pst/pst.py 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/ECtools/migration-pst/kopano_migration_pst/pst.py 2017-04-26 17:13:49.000000000 +0200 @@ -299,20 +299,14 @@ 239, 53, 156, 132, 43, 21, 213, 119, 52, 73, 182, 18, 10, 127, 113, 136, 253, 157, 24, 65, 125, 147, 216, 88, 44, 206, 254, 36, 175, 222, 184, 54, 200, 161, 128, 166, 153, 152, 168, 47, 14, 129, 101, 115, 228, 194, 162, 138, 212, 225, 17, 208, 8, 139, 42, 242, 237, 154, 100, 63, 193, 108, 249, 236) + decrypt_table = string.maketrans(b''.join(map(chr, range(256))), b''.join(map(chr, mpbbCryptFrom512))) + btypeData = 0 btypeXBLOCK = 1 btypeXXBLOCK = 2 btypeSLBLOCK = 3 btypeSIBLOCK = 4 - def decode_permute(self, pv, cb): - """ NDB_CRYPT_PERMUTE: pv is byte array, cb is data length to decode""" - - temp = 0 - for pvIndex in range(cb): - pv[pvIndex] = Block.mpbbCryptFrom512[pv[pvIndex]] # Block.mpbbCrypt[pv[pvIndex] + 512] - return str(pv) - def __init__(self, bytes, offset, data_size, is_ansi, bid_check, bCryptMethod): @@ -344,7 +338,7 @@ self.btype = 0 self.cLevel = 0 if bCryptMethod == 1: #NDB_CRYPT_PERMUTE - self.data = self.decode_permute(bytearray(bytes[:data_size]), data_size) + self.data = bytes[:data_size].translate(Block.decrypt_table) else: # no data encoding self.data = bytes[:data_size] # data block @@ -407,9 +401,9 @@ def fetch_block(self, bid): - if bid.bid in self.bbt_entries.keys(): + try: bbt_entry = self.bbt_entries[bid.bid] - else: + except KeyError: raise PSTException('Invalid BBTEntry: %s' % bid) offset = bbt_entry.BREF.ib data_size = bbt_entry.cb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/Makefile.am new/kopanocore-8.3.0/Makefile.am --- old/kopanocore-8.3.0~1007/Makefile.am 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/Makefile.am 2017-04-26 17:13:49.000000000 +0200 @@ -245,7 +245,7 @@ libkcutil.la libkcmapi.la libkcssl.la \ libkcserver.la libkcsoap.la ${GSOAP_LIBS} \ ${PROG_LIBS} ${CRYPTO_LIBS} ${icu_uc_LIBS} ${icu_i18n_LIBS} ${DL_LIBS} \ - ${MYSQL_LIBS} ${SSL_LIBS} ${PAM_LIBS} ${KRB5_LIBS} -lrt + ${MYSQL_LIBS} ${SSL_LIBS} ${PAM_LIBS} ${KRB5_LIBS} -lpthread -lrt kopano_server_LDFLAGS = ${AM_LDFLAGS} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/RELNOTES.txt new/kopanocore-8.3.0/RELNOTES.txt --- old/kopanocore-8.3.0~1007/RELNOTES.txt 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/RELNOTES.txt 2017-04-26 17:13:49.000000000 +0200 @@ -10,6 +10,7 @@ * gateway: optimize LIST, SELECT, STATUS [KC-490] * dagent: log_raw_message option can now be used selectively on users [KC-370] * icalmapi: VCF conversion [KC-420] +* migration-pst: call SaveChanges only once [KC-534] Fixes: * pyko: do not throw backtraces on log messages [KC-340] * server: Ctrl-C now works in gdb [KC-171] @@ -22,6 +23,10 @@ (showed garbage in logs) [KC-398] * client: add extra checks for EID sizes [KC-500] * gateway: enforce user and password checking on local socket [KC-396,KC-490] +* caldav: avoid a nullptr dereference [KC-236] +* cachestat: avoid exception and unpack tuple [KC-402] +* ldapplugin: revert "catch empty ldap_search_base" [KC-602] +* spooler: fix crash on forwarding rules [KC-608] Changes: * server: compressed attachments now get the same permissions as uncompressed ones [KC-380] @@ -31,7 +36,8 @@ * backup: maintain deleted folders and add --purge N option [KC-376] * migration-pst: filter metadata at start of subject [KC-424] * migration-pst: ignore decode errors [KC-521] -* common: fix empty text bodies when converting U+0000 from HTML [KC-557] +* common: fix empty text bodies when converting U+0000 from + RTF/HTML [KC-557,KC-580] * icalmapi: reworked copying description into mail body [KC-568] Of special mention: * search: python3 support (but requires new python-xapian and, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/caldav/CalDavUtil.cpp new/kopanocore-8.3.0/caldav/CalDavUtil.cpp --- old/kopanocore-8.3.0~1007/caldav/CalDavUtil.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/caldav/CalDavUtil.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -491,6 +491,7 @@ nullptr, MAPI_BEST_ACCESS, &ulObjType, &~local_fld); if(hr != hrSuccess) return hr; + lpFolder = local_fld.get(); } hr = lpFolder->GetHierarchyTable(CONVENIENT_DEPTH,&lpTable); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/ECLogger.cpp new/kopanocore-8.3.0/common/ECLogger.cpp --- old/kopanocore-8.3.0~1007/common/ECLogger.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/ECLogger.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -252,7 +252,19 @@ return; if (log) fnClose(log); + /* + * The fnOpen call cannot be reordered before fnClose in all cases — + * like compressed files, as the data stream may not be + * finalized. + */ log = fnOpen(logname.c_str(), szMode); + if (log == nullptr) { + init_for_stderr(); + fnPrintf(log, "%s%sECLogger reset issued, but cannot (re-)open %s: %s. Logging to stderr.\n", + DoPrefix().c_str(), EmitLevel(EC_LOGLEVEL_ERROR).c_str(), + logname.c_str(), strerror(errno)); + return; + } reinit_buffer(buffer_size); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/UnixUtil.cpp new/kopanocore-8.3.0/common/UnixUtil.cpp --- old/kopanocore-8.3.0~1007/common/UnixUtil.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/UnixUtil.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -14,14 +14,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ - +#include <memory> +#include <new> #include <kopano/platform.h> #include <kopano/ECLogger.h> #include <kopano/UnixUtil.h> - +#include <kopano/stringutil.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> +#include <spawn.h> #include <pwd.h> #include <grp.h> #include <cerrno> @@ -278,62 +280,37 @@ * * @return new process pid, or -1 on failure. */ -static pid_t unix_popen_rw(const char *lpszCommand, int *lpulIn, int *lpulOut, - popen_rlimit_array *lpLimits, const char **env, bool bNonBlocking, - bool bStdErr) +static pid_t unix_popen_rw(const char *const *argv, int *lpulIn, int *lpulOut, + const char **env) { + posix_spawn_file_actions_t fa; int ulIn[2]; int ulOut[2]; - pid_t pid; + pid_t pid = -1; - if (!lpszCommand || !lpulIn || !lpulOut) + if (argv == nullptr || argv[0] == nullptr) return -1; if (pipe(ulIn) || pipe(ulOut)) return -1; - if (bNonBlocking) { - if (fcntl(ulIn[0], F_SETFL, O_NONBLOCK) < 0 || fcntl(ulIn[1], F_SETFL, O_NONBLOCK) < 0 || - fcntl(ulOut[0], F_SETFL, O_NONBLOCK) < 0 || fcntl(ulOut[1], F_SETFL, O_NONBLOCK) < 0) - return -1; - } - - pid = vfork(); - if (pid < 0) - return pid; - - if (pid == 0) { - /* Close pipes we aren't going to use */ - close(ulIn[STDOUT_FILENO]); - dup2(ulIn[STDIN_FILENO], STDIN_FILENO); - close(ulOut[STDIN_FILENO]); - dup2(ulOut[STDOUT_FILENO], STDOUT_FILENO); - if (bStdErr) - dup2(ulOut[STDOUT_FILENO], STDERR_FILENO); - - // give the process a new group id, so we can easely kill all sub processes of this child too when needed. - setsid(); - - /* If provided set rlimit settings */ - if (lpLimits != NULL) - for (unsigned int i = 0; i < lpLimits->cValues; ++i) - if (setrlimit(lpLimits->sLimit[i].resource, &lpLimits->sLimit[i].limit) != 0) - ec_log_err("Unable to set rlimit for popen - resource %d, errno %d", - lpLimits->sLimit[i].resource, errno); - - if (execle("/bin/sh", "sh", "-c", lpszCommand, NULL, env) == 0) - _exit(EXIT_SUCCESS); - else - _exit(EXIT_FAILURE); - return 0; + memset(&fa, 0, sizeof(fa)); + if (posix_spawn_file_actions_init(&fa) < 0) + return -1; + if (posix_spawn_file_actions_addclose(&fa, STDIN_FILENO) == 0 && + posix_spawn_file_actions_addclose(&fa, STDOUT_FILENO) == 0 && + posix_spawn_file_actions_addclose(&fa, STDERR_FILENO) == 0 && + posix_spawn_file_actions_adddup2(&fa, ulIn[STDIN_FILENO], STDIN_FILENO) == 0 && + posix_spawn_file_actions_adddup2(&fa, ulOut[STDOUT_FILENO], STDOUT_FILENO) == 0 && + posix_spawn_file_actions_adddup2(&fa, ulOut[STDOUT_FILENO], STDERR_FILENO) == 0 && + posix_spawn(&pid, argv[0], &fa, nullptr, const_cast<char **>(argv), + const_cast<char **>(env)) == 0) { + *lpulIn = ulIn[STDOUT_FILENO]; + close(ulIn[STDIN_FILENO]); + *lpulOut = ulOut[STDIN_FILENO]; + close(ulOut[STDOUT_FILENO]); } - - *lpulIn = ulIn[STDOUT_FILENO]; - close(ulIn[STDIN_FILENO]); - - *lpulOut = ulOut[STDIN_FILENO]; - close(ulOut[STDOUT_FILENO]); - + posix_spawn_file_actions_destroy(&fa); return pid; } @@ -351,10 +328,22 @@ * * @return Returns TRUE on success, FALSE on failure */ -bool unix_system(const char *lpszLogName, const char *lpszCommand, const char **env) +bool unix_system(const char *lpszLogName, const std::vector<std::string> &cmd, + const char **env) { + int argc = 0; + if (cmd.size() == 0) + return false; + std::unique_ptr<const char *[]> argv(new(std::nothrow) const char *[cmd.size()+1]); + if (argv == nullptr) + return false; + for (const auto &e : cmd) + argv[argc++] = e.c_str(); + argv[argc] = nullptr; + + auto cmdtxt = "\"" + kc_join(cmd, "\" \"") + "\""; int fdin = 0, fdout = 0; - int pid = unix_popen_rw(lpszCommand, &fdin, &fdout, NULL, env, false, true); + int pid = unix_popen_rw(argv.get(), &fdin, &fdout, env); char buffer[1024]; int status = 0; bool rv = true; @@ -377,23 +366,23 @@ #ifdef WEXITSTATUS if (WIFEXITED(status)) { /* Child exited by itself */ if (WEXITSTATUS(status)) { - ec_log_err("Command `%s` exited with non-zero status %d", lpszCommand, WEXITSTATUS(status)); + ec_log_err("Command %s exited with non-zero status %d", cmdtxt.c_str(), WEXITSTATUS(status)); rv = false; } else - ec_log_info("Command `%s` ran successfully", lpszCommand); + ec_log_info("Command %s ran successfully", cmdtxt.c_str()); } else if (WIFSIGNALED(status)) { /* Child was killed by a signal */ - ec_log_err("Command `%s` was killed by signal %d", lpszCommand, WTERMSIG(status)); + ec_log_err("Command %s was killed by signal %d", cmdtxt.c_str(), WTERMSIG(status)); rv = false; } else { /* Something strange happened */ - ec_log_err(string("Command `") + lpszCommand + "` terminated abnormally"); + ec_log_err("Command %s terminated abnormally", cmdtxt.c_str()); rv = false; } #else if (status) - ec_log_err("Command `%s` exited with status %d", lpszCommand, status); + ec_log_err("Command %s exited with status %d", cmdtxt.c_str(), status); else - ec_log_info("Command `%s` ran successfully", lpszCommand); + ec_log_info("Command %s ran successfully", cmdtxt.c_str()); #endif return rv; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/include/kopano/UnixUtil.h new/kopanocore-8.3.0/common/include/kopano/UnixUtil.h --- old/kopanocore-8.3.0~1007/common/include/kopano/UnixUtil.h 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/include/kopano/UnixUtil.h 2017-04-26 17:13:49.000000000 +0200 @@ -18,6 +18,8 @@ #ifndef __UNIXUTIL_H #define __UNIXUTIL_H +#include <string> +#include <vector> #include <kopano/zcdefs.h> #include <dirent.h> #include <sys/resource.h> @@ -56,7 +58,7 @@ extern _kc_export int unix_create_pidfile(const char *argv0, ECConfig *, bool force = true); extern _kc_export int unix_daemonize(ECConfig *); extern _kc_export int unix_fork_function(void *(*)(void *), void *param, int nfds, int *closefds); -extern _kc_export bool unix_system(const char *logname, const char *command, const char **env); +extern _kc_export bool unix_system(const char *logname, const std::vector<std::string> &cmd, const char **env); } /* namespace */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/include/kopano/stringutil.h new/kopanocore-8.3.0/common/include/kopano/stringutil.h --- old/kopanocore-8.3.0~1007/common/include/kopano/stringutil.h 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/include/kopano/stringutil.h 2017-04-26 17:13:49.000000000 +0200 @@ -197,6 +197,8 @@ extern _kc_export std::string base64_encode(const unsigned char *, unsigned int); extern _kc_export std::string base64_decode(const std::string &); extern _kc_export std::string zcp_md5_final_hex(MD5_CTX *); +extern _kc_export std::string string_strip_nuls(const std::string &); +extern _kc_export std::wstring string_strip_nuls(const std::wstring &); } /* namespace */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/libkcmapi.sym.in new/kopanocore-8.3.0/common/libkcmapi.sym.in --- old/kopanocore-8.3.0~1007/common/libkcmapi.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/libkcmapi.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: GUID_NULL; IID_*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/libkcutil.sym.in new/kopanocore-8.3.0/common/libkcutil.sym.in --- old/kopanocore-8.3.0~1007/common/libkcutil.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/libkcutil.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -15,7 +15,7 @@ global: CoCreateGuid; }; -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { KC::*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/rtfutil.cpp new/kopanocore-8.3.0/common/rtfutil.cpp --- old/kopanocore-8.3.0~1007/common/rtfutil.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/rtfutil.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -24,6 +24,7 @@ #include <kopano/CommonUtil.h> #include <kopano/Util.h> #include <kopano/charset/convert.h> +#include <kopano/stringutil.h> #include "HtmlEntity.h" #include "rtfutil.h" @@ -178,10 +179,11 @@ * @param[out] lpStrHTMLOut HTML output in requested ulCodepage * @param[out] ulCodepage codepage for HTML output */ -HRESULT HrExtractHTMLFromRTF(const std::string &lpStrRTFIn, +HRESULT HrExtractHTMLFromRTF(const std::string &rtf_unfilt, std::string &lpStrHTMLOut, ULONG ulCodepage) { HRESULT hr; + auto lpStrRTFIn = string_strip_nuls(rtf_unfilt); const char *szInput = lpStrRTFIn.c_str(); const char *szANSICharset = "us-ascii"; const char *szHTMLCharset; @@ -407,10 +409,11 @@ * @param[out] lpStrHTMLOut HTML output in requested ulCodepage * @param[out] ulCodepage codepage for HTML output */ -HRESULT HrExtractHTMLFromTextRTF(const std::string &lpStrRTFIn, +HRESULT HrExtractHTMLFromTextRTF(const std::string &rtf_unfilt, std::string &lpStrHTMLOut, ULONG ulCodepage) { HRESULT hr; + auto lpStrRTFIn = string_strip_nuls(rtf_unfilt); std::wstring wstrUnicodeTmp; const char *szInput = lpStrRTFIn.c_str(); const char *szANSICharset = "us-ascii"; @@ -705,10 +708,11 @@ * * @todo Export the right HTML tags, now only plain stuff */ -HRESULT HrExtractHTMLFromRealRTF(const std::string &lpStrRTFIn, +HRESULT HrExtractHTMLFromRealRTF(const std::string &rtf_unfilt, std::string &lpStrHTMLOut, ULONG ulCodepage) { HRESULT hr; + auto lpStrRTFIn = string_strip_nuls(rtf_unfilt); std::wstring wstrUnicodeTmp; const char *szInput = lpStrRTFIn.c_str(); const char *szANSICharset = "us-ascii"; @@ -1090,9 +1094,10 @@ * @return mapi error code * @retval MAPI_E_NOT_ENOUGH_MEMORY too many states in rtf, > 256 */ -HRESULT HrExtractBODYFromTextRTF(const std::string &lpStrRTFIn, +HRESULT HrExtractBODYFromTextRTF(const std::string &rtf_unfilt, std::wstring &strBodyOut) { + auto lpStrRTFIn = string_strip_nuls(rtf_unfilt); const char *szInput = lpStrRTFIn.c_str(); const char *szANSICharset = "us-ascii"; int ulState = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/common/stringutil.cpp new/kopanocore-8.3.0/common/stringutil.cpp --- old/kopanocore-8.3.0~1007/common/stringutil.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/common/stringutil.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -691,4 +691,20 @@ return s; } +std::string string_strip_nuls(const std::string &i) +{ + std::string o; + std::copy_if(i.cbegin(), i.cend(), std::back_inserter(o), + [](char c) { return c != '\0'; }); + return o; +} + +std::wstring string_strip_nuls(const std::wstring &i) +{ + std::wstring o; + std::copy_if(i.cbegin(), i.cend(), std::back_inserter(o), + [](wchar_t c) { return c != L'\0'; }); + return o; +} + } /* namespace */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/configure.ac new/kopanocore-8.3.0/configure.ac --- old/kopanocore-8.3.0~1007/configure.ac 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/configure.ac 2017-04-26 17:13:49.000000000 +0200 @@ -18,8 +18,11 @@ AM_PROG_CC_C_O AC_PROG_CXX AC_PROG_INSTALL +AC_PROG_SED PKG_PROG_PKG_CONFIG +PACKAGE_ABI=$($SED 's/\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*/\1/' <version.in) +AC_SUBST([PACKAGE_ABI]) abs_top_srcdir=`cd $srcdir; pwd` abs_top_builddir=`pwd` @@ -310,8 +313,9 @@ # Checks for MySQL 4.1 or better AC_DEFUN([MYSQL_WITH_MYSQL_CONFIG],[ + AC_PATH_PROGS([MYSQL_CONFIG], [mysql_config mariadb_config]) AC_ARG_WITH([mysql-config], AS_HELP_STRING([--with-mysql-config=PATH], [path to the mysql-config script of mysql 4.1]), - [MYSQL_CONFIG=${withval}],[MYSQL_CONFIG=mysql_config]) + [MYSQL_CONFIG="$withval"]) AC_ARG_ENABLE([embedded-mysql], AS_HELP_STRING([--enable-embedded-mysql], [Compile server with the embedded MySQL server]), [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/default.sym.in new/kopanocore-8.3.0/default.sym.in --- old/kopanocore-8.3.0~1007/default.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/default.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { KC::*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/inetmapi/VMIMEToMAPI.cpp new/kopanocore-8.3.0/inetmapi/VMIMEToMAPI.cpp --- old/kopanocore-8.3.0~1007/inetmapi/VMIMEToMAPI.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/inetmapi/VMIMEToMAPI.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -2650,6 +2650,7 @@ {"x-gbk", "gb18030"}, // gb18030 > gbk > gb2312. x-gbk is an alias of gbk, which is not listed in iconv. {"ks_c_5601-1987", "cp949"}, // cp949 is euc-kr with UHC extensions {"iso-8859-8-i", "iso-8859-8"}, // logical vs visual order, does not matter. http://mirror.hamakor.org.il/archives/linux-il/08-2004/11445.html + {"win-1252", "windows-1252"}, /* * This particular "unicode" is different from iconv's * "unicode" character set. It is UTF-8 content with a UTF-16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/installer/linux/kopano-presence.init.debi new/kopanocore-8.3.0/installer/linux/kopano-presence.init.debi --- old/kopanocore-8.3.0~1007/installer/linux/kopano-presence.init.debi 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/installer/linux/kopano-presence.init.debi 2017-04-26 17:13:49.000000000 +0200 @@ -47,7 +47,7 @@ install -dm0775 -o kopano -g kopano /var/run/kopano export LC_ALL=$KOPANO_LOCALE export LANG=$KOPANO_LOCALE - start-stop-daemon --start $QUIETDAEMON --pidfile $PIDFILE --exec /usr/bin/python $PRESENCE -- $PRESENCE_OPTS + start-stop-daemon --start $QUIETDAEMON --pidfile $PIDFILE --exec /usr/bin/python $PRESENCE -- $PRESENCE_OPTS >/dev/null 2>&1 log_end_msg $? unset LC_ALL LANG ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/installer/linux/kopano-presence.init.rhel new/kopanocore-8.3.0/installer/linux/kopano-presence.init.rhel --- old/kopanocore-8.3.0~1007/installer/linux/kopano-presence.init.rhel 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/installer/linux/kopano-presence.init.rhel 2017-04-26 17:13:49.000000000 +0200 @@ -44,7 +44,7 @@ install -dm0775 -o kopano -g kopano /var/run/kopano export LC_ALL=$KOPANO_LOCALE export LANG=$KOPANO_LOCALE - daemon $PRESENCEPROGRAM $PRESENCECONFIG_OPT + daemon $PRESENCEPROGRAM $PRESENCECONFIG_OPT >/dev/null 2>&1 RETVAL=$? unset LC_ALL LANG echo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/installer/linux/kopano-search.init.debi new/kopanocore-8.3.0/installer/linux/kopano-search.init.debi --- old/kopanocore-8.3.0~1007/installer/linux/kopano-search.init.debi 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/installer/linux/kopano-search.init.debi 2017-04-26 17:13:49.000000000 +0200 @@ -46,7 +46,7 @@ install -dm0775 -o kopano -g kopano /var/run/kopano export LC_ALL=$KOPANO_LOCALE export LANG=$KOPANO_LOCALE - start-stop-daemon --start $QUIETDAEMON --pidfile $PIDFILE --exec /usr/bin/python $SEARCH -- $SEARCH_OPTS + start-stop-daemon --start $QUIETDAEMON --pidfile $PIDFILE --exec /usr/bin/python $SEARCH -- $SEARCH_OPTS >/dev/null 2>&1 log_end_msg $? unset LC_ALL LANG ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/installer/linux/kopano-search.init.rhel new/kopanocore-8.3.0/installer/linux/kopano-search.init.rhel --- old/kopanocore-8.3.0~1007/installer/linux/kopano-search.init.rhel 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/installer/linux/kopano-search.init.rhel 2017-04-26 17:13:49.000000000 +0200 @@ -44,7 +44,7 @@ install -dm0775 -o kopano -g kopano /var/run/kopano export LC_ALL=$KOPANO_LOCALE export LANG=$KOPANO_LOCALE - daemon $SEARCHPROGRAM $SEARCHCONFIG_OPT + daemon $SEARCHPROGRAM $SEARCHCONFIG_OPT >/dev/null 2>&1 RETVAL=$? unset LC_ALL LANG echo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/m4lcommon/ECRestriction.cpp new/kopanocore-8.3.0/m4lcommon/ECRestriction.cpp --- old/kopanocore-8.3.0~1007/m4lcommon/ECRestriction.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/m4lcommon/ECRestriction.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -109,7 +109,7 @@ lpPropDst = NULL; exit: - if (lpBase != NULL) + if (lpBase == nullptr) MAPIFreeBuffer(lpPropDst); return hr; @@ -153,7 +153,7 @@ lpPropDst = NULL; exit: - if (lpBase != NULL) + if (lpBase == nullptr) MAPIFreeBuffer(lpPropDst); return hr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/m4lcommon/Util.cpp new/kopanocore-8.3.0/m4lcommon/Util.cpp --- old/kopanocore-8.3.0~1007/m4lcommon/Util.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/m4lcommon/Util.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -17,7 +17,6 @@ #include <kopano/zcdefs.h> #include <kopano/platform.h> -#include <algorithm> #include <exception> #include <cwctype> #include <mapidefs.h> @@ -1868,14 +1867,12 @@ */ HRESULT Util::HrHtmlToText(IStream *html, IStream *text, ULONG ulCodepage) { - std::wstring wstrHTML, filt; + std::wstring wstrHTML; CHtmlToTextParser parser; HRESULT hr = HrConvertStreamToWString(html, ulCodepage, &wstrHTML); if(hr != hrSuccess) return hr; - std::copy_if(wstrHTML.begin(), wstrHTML.end(), std::back_inserter(filt), - [](wchar_t c) { return c != L'\0'; }); - if (!parser.Parse(filt.c_str())) + if (!parser.Parse(string_strip_nuls(wstrHTML).c_str())) return MAPI_E_CORRUPT_DATA; std::wstring &strText = parser.GetText(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/mapi4linux/src/libkchl.sym.in new/kopanocore-8.3.0/mapi4linux/src/libkchl.sym.in --- old/kopanocore-8.3.0~1007/mapi4linux/src/libkchl.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/mapi4linux/src/libkchl.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { *KCHL::*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/mapi4linux/src/libmapi.sym.in new/kopanocore-8.3.0/mapi4linux/src/libmapi.sym.in --- old/kopanocore-8.3.0~1007/mapi4linux/src/libmapi.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/mapi4linux/src/libmapi.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -63,7 +63,7 @@ global: CreateStreamOnHGlobal; }; -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { operator*SBinary*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/client/ECMsgStore.cpp new/kopanocore-8.3.0/provider/client/ECMsgStore.cpp --- old/kopanocore-8.3.0~1007/provider/client/ECMsgStore.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/client/ECMsgStore.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -2268,7 +2268,7 @@ exit: if (lpcbStoreId != NULL && *lpcbStoreId == 0) MAPIFreeBuffer(lpStoreId); - if (lpcbStoreId != NULL && *lpcbStoreId == 0) + if (lpcbRootId != nullptr && *lpcbRootId == 0) MAPIFreeBuffer(lpRootId); return hr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libkcserver.sym.in new/kopanocore-8.3.0/provider/libkcserver.sym.in --- old/kopanocore-8.3.0~1007/provider/libkcserver.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libkcserver.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: /* unlucky gsoap linkage */ namespaces; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libkcsoap.sym.in new/kopanocore-8.3.0/provider/libkcsoap.sym.in --- old/kopanocore-8.3.0~1007/provider/libkcsoap.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libkcsoap.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { ns__*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libserver/ECGenericObjectTable.cpp new/kopanocore-8.3.0/provider/libserver/ECGenericObjectTable.cpp --- old/kopanocore-8.3.0~1007/provider/libserver/ECGenericObjectTable.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libserver/ECGenericObjectTable.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -909,7 +909,7 @@ ++sPropTagArray.__size; // for PR_INSTANCE_KEY ++sPropTagArray.__size; // for PR_MESSAGE_FLAGS - sPropTagArray.__ptr = new unsigned int[sPropTagArray.__size]; + sPropTagArray.__ptr = s_alloc<unsigned int>(nullptr, sPropTagArray.__size); sPropTagArray.__ptr[n++]= PR_INSTANCE_KEY; if(m_ulCategories > 0) sPropTagArray.__ptr[n++]= PR_MESSAGE_FLAGS; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libserver/ECICS.cpp new/kopanocore-8.3.0/provider/libserver/ECICS.cpp --- old/kopanocore-8.3.0~1007/provider/libserver/ECICS.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libserver/ECICS.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -482,6 +482,10 @@ } ECRESULT GetChanges(struct soap *soap, ECSession *lpSession, SOURCEKEY sFolderSourceKey, unsigned int ulSyncId, unsigned int ulChangeId, unsigned int ulChangeType, unsigned int ulFlags, struct restrictTable *lpsRestrict, unsigned int *lpulMaxChangeId, icsChangesArray **lppChanges){ + class sfree_delete { + public: + void operator()(void *x) { s_free(nullptr, x); } + }; unsigned int dummy; ECRESULT er = erSuccess; ECDatabase* lpDatabase = NULL; @@ -499,7 +503,7 @@ list<unsigned int> lstFolderIds; // Contains a list of change IDs list<unsigned int> lstChanges; - std::unique_ptr<ECGetContentChangesHelper> lpHelper; + std::unique_ptr<ECGetContentChangesHelper, sfree_delete> lpHelper; ec_log(EC_LOGLEVEL_ICS, "GetChanges(): sourcekey=%s, syncid=%d, changetype=%d, flags=%d", bin2hex(sFolderSourceKey).c_str(), ulSyncId, ulChangeType, ulFlags); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libserver/ECUserManagement.cpp new/kopanocore-8.3.0/provider/libserver/ECUserManagement.cpp --- old/kopanocore-8.3.0~1007/provider/libserver/ECUserManagement.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libserver/ECUserManagement.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -93,7 +93,7 @@ for (const auto &s : lstEnv) env[n++] = s.c_str(); env[n] = NULL; - return unix_system(scriptname, scriptname, env); + return unix_system(scriptname, {scriptname}, env); } static const char *ObjectClassToName(objectclass_t objclass) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libserver/cmd.cpp new/kopanocore-8.3.0/provider/libserver/cmd.cpp --- old/kopanocore-8.3.0~1007/provider/libserver/cmd.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libserver/cmd.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -9611,19 +9611,10 @@ } SOAP_ENTRY_END() -SOAP_ENTRY_START(getLicenseAuth, lpsResponse->er, struct xsd__base64Binary sAuthData, struct getLicenseAuthResponse *lpsResponse) +SOAP_ENTRY_START(getLicenseAuth, r->er, struct xsd__base64Binary, struct getLicenseAuthResponse *r) { - void *data = NULL; - - er = ECLicenseClient().Auth(sAuthData.__ptr, sAuthData.__size, &data, reinterpret_cast<unsigned int *>(&lpsResponse->sAuthResponse.__size)); - if (er != erSuccess) - goto exit; - - lpsResponse->sAuthResponse.__ptr = s_alloc<unsigned char>(soap, lpsResponse->sAuthResponse.__size); - memcpy(lpsResponse->sAuthResponse.__ptr, data, lpsResponse->sAuthResponse.__size); - -exit: - free(data); + r->sAuthResponse.__ptr = nullptr; + r->sAuthResponse.__size = 0; } SOAP_ENTRY_END() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/libserver/cmdutil.cpp new/kopanocore-8.3.0/provider/libserver/cmdutil.cpp --- old/kopanocore-8.3.0~1007/provider/libserver/cmdutil.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/libserver/cmdutil.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -70,7 +70,7 @@ *lpSourceKey = SOURCEKEY(cbData, (char *)lpData); exit: - delete[] lpData; + s_free(nullptr, lpData); return er; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/plugin.sym.in new/kopanocore-8.3.0/provider/plugin.sym.in --- old/kopanocore-8.3.0~1007/provider/plugin.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/plugin.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: deleteUserPluginInstance; getUserPluginInstance; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/plugins/LDAPUserPlugin.cpp new/kopanocore-8.3.0/provider/plugins/LDAPUserPlugin.cpp --- old/kopanocore-8.3.0~1007/provider/plugins/LDAPUserPlugin.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/plugins/LDAPUserPlugin.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -948,8 +948,9 @@ const char *lpszSearchBase = m_config->GetSetting("ldap_search_base"); string search_base; - if (lpszSearchBase == nullptr || *lpszSearchBase == '\0') - throw runtime_error("Configuration option \"ldap_search_base\" is empty"); + if (lpszSearchBase == nullptr) + /* GetSetting returns "" for all options it knows.. */ + throw logic_error("getSearchBase: unexpected nullptr"); if (m_bHosted && !company.id.empty()) { // find company DN, and use as search_base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/provider/provider.sym.in new/kopanocore-8.3.0/provider/provider.sym.in --- old/kopanocore-8.3.0~1007/provider/provider.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/provider/provider.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -5,7 +5,7 @@ MSProviderInit; XPProviderInit; }; -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: /* unlucky gsoap linkage */ namespaces; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/spooler/DAgent.cpp new/kopanocore-8.3.0/spooler/DAgent.cpp --- old/kopanocore-8.3.0~1007/spooler/DAgent.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/spooler/DAgent.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -412,7 +412,7 @@ object_ptr<IMAPIFolder> lpRootFolder; object_ptr<IMessage> lpMessageCopy; const char *autoresponder = g_lpConfig->GetSetting("mr_autoaccepter"); - std::string strEntryID, strCmdLine; + std::string strEntryID; memory_ptr<SPropValue> lpEntryID; ULONG ulType = 0; ENTRYLIST sEntryList; @@ -456,9 +456,13 @@ // We cannot rely on the 'current locale' to be able to represent the username in wstrUsername. We therefore // force UTF-8 output on the username. This means that the autoaccept script must also interpret the username // in UTF-8, *not* in the current locale. - strCmdLine = (std::string)autoresponder + " \"" + convert_to<string>("UTF-8", lpRecip->wstrUsername, rawsize(lpRecip->wstrUsername), CHARSET_WCHAR) + "\" \"" + g_lpConfig->GetSettingsPath() + "\" \"" + strEntryID + "\""; - ec_log_debug("Starting autoaccept with command line %s", strCmdLine.c_str()); - if (!unix_system(autoresponder, strCmdLine.c_str(), const_cast<const char **>(environ))) { + std::vector<std::string> cmdline = { + autoresponder, + convert_to<std::string>("UTF-8", lpRecip->wstrUsername, rawsize(lpRecip->wstrUsername), CHARSET_WCHAR), + g_lpConfig->GetSettingsPath(), strEntryID + }; + ec_log_debug("Starting autoaccept with command line \"%s\"", kc_join(cmdline, "\" \"").c_str()); + if (!unix_system(autoresponder, cmdline, const_cast<const char **>(environ))) { hr = MAPI_E_CALL_FAILED; ec_log_err("HrAutoAccept(): invoking autoaccept script failed %x", hr); } @@ -529,9 +533,13 @@ // We cannot rely on the 'current locale' to be able to represent the username in wstrUsername. We therefore // force UTF-8 output on the username. This means that the autoaccept script must also interpret the username // in UTF-8, *not* in the current locale. - strCmdLine = (std::string)autoprocessor + " \"" + convert_to<string>("UTF-8", lpRecip->wstrUsername, rawsize(lpRecip->wstrUsername), CHARSET_WCHAR) + "\" \"" + g_lpConfig->GetSettingsPath() + "\" \"" + strEntryID + "\""; - g_lpLogger->Log(EC_LOGLEVEL_DEBUG, "Starting autoaccept with command line %s", strCmdLine.c_str()); - if (!unix_system(autoprocessor, strCmdLine.c_str(), const_cast<const char **>(environ))) + std::vector<std::string> cmdline = { + autoprocessor, + convert_to<std::string>("UTF-8", lpRecip->wstrUsername, rawsize(lpRecip->wstrUsername), CHARSET_WCHAR), + g_lpConfig->GetSettingsPath(), strEntryID + }; + ec_log_debug("Starting autoaccept with command line \"%s\"", kc_join(cmdline, "\" \"").c_str()); + if (!unix_system(autoprocessor, cmdline, const_cast<const char **>(environ))) hr = MAPI_E_CALL_FAILED; // Delete the copy, irrespective of the outcome of the script. @@ -1425,7 +1433,7 @@ int fd = -1; wstring strFromName, strFromType, strFromEmail, strBody; string unquoted, quoted; - string command = strBaseCommand; + std::vector<std::string> cmdline = {strBaseCommand}; // Environment const char *env[5]; std::string strToMe; @@ -1629,8 +1637,11 @@ // Args: From, To, Subject, Username, Msg_Filename // Should run in UTF-8 to get correct strings in UTF-8 from shell_escape(wstring) - command += string(" '") + shell_escape(lpRecip->strSMTP) + string("' '") + - shell_escape(strFromEmail) + string("' '") + shell_escape(szSubject) + string("' '") + shell_escape(lpRecip->wstrUsername) + string("' '") + shell_escape(szTemp) + string("'"); + cmdline.push_back(lpRecip->strSMTP); + cmdline.push_back(convert_to<std::string>(strFromEmail)); + cmdline.push_back(convert_to<std::string>(szSubject)); + cmdline.push_back(convert_to<std::string>(lpRecip->wstrUsername)); + cmdline.push_back(szTemp); // Set MESSAGE_TO_ME and MESSAGE_CC_ME in environment strToMe = (std::string)"MESSAGE_TO_ME=" + (lpMessageProps[1].ulPropTag == PR_MESSAGE_TO_ME && lpMessageProps[1].Value.b ? "1" : "0"); @@ -1644,8 +1655,7 @@ env[4] = NULL; g_lpLogger->Log(EC_LOGLEVEL_INFO, "Starting autoresponder for out-of-office message"); - command += " 2>&1"; - if (!unix_system(strBaseCommand.c_str(), command.c_str(), env)) + if (!unix_system(strBaseCommand.c_str(), cmdline, env)) g_lpLogger->Log(EC_LOGLEVEL_ERROR, "Autoresponder failed"); exit: @@ -3176,7 +3186,6 @@ // if required. So make sure to reset it here so we can safely reuse the LMTP connection delivery_mode ulDeliveryMode = lpArgs->ulDeliveryMode; ProcessDeliveryToList(ptrPyMapiPlugin, lpSession, tmp, &mapRCPT, lpArgs); - SaveRawMessage(tmp, "LMTP"); lpArgs->ulDeliveryMode = ulDeliveryMode; } @@ -3184,11 +3193,15 @@ // wstrDeliveryStatus of each recipient. hr = hrSuccess; - fclose(tmp); - /* Responses need to be sent in the same sequence that we received the recipients in. * Build all responses and find the sequence through the ordered list */ + + auto rawmsg = g_lpConfig->GetSetting("log_raw_message"); + auto save_all = parseBool(rawmsg) && (strcasecmp(rawmsg, "all") == 0 || strcasecmp(rawmsg, "yes") == 0); + if (save_all) + SaveRawMessage(tmp, "LMTP"); + for (const auto &company : mapRCPT) for (const auto &server : company.second) for (const auto &recip : server.second) { @@ -3198,9 +3211,15 @@ mapRecipientResults.insert(make_pair<std::string, std::string>(converter.convert_to<std::string>(i), // rawsize([N]) returns N, not contents len, so cast to fix converter.convert_to<std::string>(CHARSET_CHAR, wbuffer, rawsize(reinterpret_cast<WCHAR *>(wbuffer)), CHARSET_WCHAR))); + if (!save_all) { + auto save_username = converter.convert_to<std::string>(recip->wstrUsername); + SaveRawMessage(tmp, save_username.c_str()); + } } } + fclose(tmp); + // Reply each recipient in the received order for (const auto &i : lOrderedRecipients) { std::map<std::string, std::string>::const_iterator r = mapRecipientResults.find(i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/spooler/rules.cpp new/kopanocore-8.3.0/spooler/rules.cpp --- old/kopanocore-8.3.0~1007/spooler/rules.cpp 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/spooler/rules.cpp 2017-04-26 17:13:49.000000000 +0200 @@ -590,7 +590,7 @@ if (lpRecipients->cEntries != lpRuleRecipients->cEntries) ec_log_info("Loop protection blocked some recipients"); - *lppNewRecipients = lpRecipients; + *lppNewRecipients = lpRecipients.release(); lpRecipients = NULL; return hrSuccess; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/swig/python/python.sym.in new/kopanocore-8.3.0/swig/python/python.sym.in --- old/kopanocore-8.3.0~1007/swig/python/python.sym.in 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/swig/python/python.sym.in 2017-04-26 17:13:49.000000000 +0200 @@ -1,4 +1,4 @@ -KC_@PACKAGE_VERSION@ { +KC_@PACKAGE_ABI@ { global: extern "C++" { List_from_*; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kopanocore-8.3.0~1007/tools/python-scripts/kopano-cachestat new/kopanocore-8.3.0/tools/python-scripts/kopano-cachestat --- old/kopanocore-8.3.0~1007/tools/python-scripts/kopano-cachestat 2017-03-08 14:07:04.000000000 +0100 +++ new/kopanocore-8.3.0/tools/python-scripts/kopano-cachestat 2017-04-26 17:13:49.000000000 +0200 @@ -13,7 +13,7 @@ """ -options = kopano.parser('ksp').parse_args() +options, _ = kopano.parser('ksp').parse_args() server = kopano.Server(options=options, auth_user='SYSTEM', auth_pass='') # XXX: When python-kopano supports sorting, simplify the loop by sorting on display_name in descending order. table = server.table(PR_EC_STATSTABLE_SYSTEM, columns=[PR_DISPLAY_NAME_W, PR_EC_STATS_SYSTEM_VALUE, PR_EC_STATS_SYSTEM_DESCRIPTION])
