Hello community, here is the log from the commit of package imapfilter for openSUSE:Factory checked in at 2014-12-25 23:20:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/imapfilter (Old) and /work/SRC/openSUSE:Factory/.imapfilter.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "imapfilter" Changes: -------- --- /work/SRC/openSUSE:Factory/imapfilter/imapfilter.changes 2013-12-06 09:43:19.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.imapfilter.new/imapfilter.changes 2014-12-25 23:20:18.000000000 +0100 @@ -1,0 +2,22 @@ +Sat Dec 6 03:26:47 UTC 2014 - [email protected] + +- specfile: update copyright year + +- update to version 2.5.7 + * Support for automatic validation of SSL connections, using the + operating system's installed trusted CA certificates (usually from + authorities that are shipped with web browsers). + * A new "wakeonany" option makes it possible to end IDLE mode on any + event, not just on new messages. + * A new "reenter" option controls whether IDLE mode should be + re-entered, after the recovery of the session, which makes it + possible to continue with the execution of the next line in the + configuration file. + * The documentation now mentions that the contain_*() methods do + case-insensitive searching (an IMAP limitation). + * The documentation now has a better explanation of the arrived_*() + and sent_*() methods. + * Bug fix; the value returned by the copy method was incorrect in + some cases. + +------------------------------------------------------------------- Old: ---- imapfilter-2.5.6.tar.gz New: ---- imapfilter-2.5.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ imapfilter.spec ++++++ --- /var/tmp/diff_new_pack.MPi23T/_old 2014-12-25 23:20:19.000000000 +0100 +++ /var/tmp/diff_new_pack.MPi23T/_new 2014-12-25 23:20:19.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package imapfilter # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ License: MIT Group: Productivity/Networking/Email/Utilities Url: https://github.com/lefcha/imapfilter -Version: 2.5.6 +Version: 2.5.7 Release: 0 Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ imapfilter-2.5.6.tar.gz -> imapfilter-2.5.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/.gitignore new/imapfilter-2.5.7/.gitignore --- old/imapfilter-2.5.6/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/imapfilter-2.5.7/.gitignore 2014-11-16 16:36:40.000000000 +0100 @@ -0,0 +1,2 @@ +*.o +imapfilter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/LICENSE new/imapfilter-2.5.7/LICENSE --- old/imapfilter-2.5.6/LICENSE 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/LICENSE 2014-11-16 16:36:40.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2001-2013 Eleftherios Chatzimparmpas +Copyright (c) 2001-2014 Eleftherios Chatzimparmpas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/NEWS new/imapfilter-2.5.7/NEWS --- old/imapfilter-2.5.6/NEWS 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/NEWS 2014-11-16 16:36:40.000000000 +0100 @@ -1,3 +1,18 @@ +IMAPFilter 2.5.7 - 16 Nov 2014 + - Support for automatic validation of SSL connections, using the operating + system's installed trusted CA certificates (usually from authorities that + are shipped with web browsers). + - A new "wakeonany" option makes it possible to end IDLE mode on any event, + not just on new messages. + - A new "reenter" option controls whether IDLE mode should be re-entered, + after the recovery of the session, which makes it possible to continue with + the execution of the next line in the configuration file. + - The documentation now mentions that the contain_*() methods do + case-insensitive searching (an IMAP limitation). + - The documentation now has a better explanation of the arrived_*() and + sent_*() methods. + - Bug fix; the value returned by the copy method was incorrect in some cases. + IMAPFilter 2.5.6 - 27 Oct 2013 - Possible to build again with OpenSSL older than version 1.0.1 (was a requirement for the previous release due to new protocols TLS 1.1/1.2). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/doc/imapfilter.1 new/imapfilter-2.5.7/doc/imapfilter.1 --- old/imapfilter-2.5.6/doc/imapfilter.1 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/doc/imapfilter.1 2014-11-16 16:36:40.000000000 +0100 @@ -1,4 +1,4 @@ -.Dd Oct 15, 2013 +.Dd Nov 9, 2014 .Dt IMAPFILTER 1 .Os .Sh NAME @@ -11,6 +11,7 @@ .Op Fl d Ar debugfile .Op Fl e Ar 'command' .Op Fl l Ar logfile +.Op Fl t Ar truststore .Sh DESCRIPTION .Nm is a mail filtering utility. It connects to remote mail servers using the @@ -42,6 +43,13 @@ Enters interactive mode after executing the configuration file. .It Fl l Ar logfile File that contains logs of error messages produced. +.It Fl t Ar truststore +The path to the system's SSL CA TrustStore directory. SSL connections will be +validated using the CA certificates found in this directory, and when this is +not possible the local +.Pa $HOME/.imapfilter/certificates +file will be used. The default is +.Pa /etc/ssl/certs . .It Fl V Displays version and copyright information. .It Fl v @@ -62,7 +70,7 @@ as user passwords, the recommended permissions are read/write for the user, and not accessible by others. .It Pa $HOME/.imapfilter/certificates -File where the SSL/TLS certificates are stored. +File where the SSL certificates are stored. .El .Sh SEE ALSO .Xr imapfilter_config 5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/doc/imapfilter_config.5 new/imapfilter-2.5.7/doc/imapfilter_config.5 --- old/imapfilter-2.5.6/doc/imapfilter_config.5 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/doc/imapfilter_config.5 2014-11-16 16:36:40.000000000 +0100 @@ -1,4 +1,4 @@ -.Dd May 20, 2013 +.Dd Nov 9, 2014 .Dt IMAPFILTER_CONFIG 5 .Os .Sh NAME @@ -169,6 +169,17 @@ .Dq none the mechanism is completely disabled. Default is .Dq all . +.It Va reenter +When this option is enabled and the connection is recovered after some +unexpected event while in IDLE mode (see also the +.Va recover +option), the client will re-enter IDLE mode. But when this option is disabled, +and after the connection is recovered, the client will not re-enter IDLE mode, +and instead will continue to execute the next line in the configuration file, +ie. the one after +.Fn enter_idle . +Default is +.Dq true . .It Va starttls When this option is enabled and the server supports the IMAP STARTTLS extension, a TLS connection will be negotiated with the mail server in the @@ -190,6 +201,22 @@ as a value. Default is .Dq 60 seconds. +.It Va wakeonany +By enabling this option the IDLE command will return on any event that is +received from the server, and not just on the +.Dq RECENT +and +.Dq EXISTS +events, that normally indicate the arrival of a new message. Examples of other +events are +.Dq FETCH , +which indicates that the details of a message (eg. its flags) have been +modified, or +.Dq EXPUNGE , +which indicates that a message has been deleted. This variable takes a +.Vt boolean +as a value. Default is +.Dq false . .El .Sh ACCOUNTS Accounts are initialized using the @@ -436,21 +463,31 @@ .Fn enter_idle method returns. For the .Fn enter_idle -to work, the IDLE extension has to be supported by the IMAP server. The +to work, the IDLE extension has to be supported by the IMAP server. +.Pp +The .Fn enter_idle -method returns one value of type +method returns a value of type .Vt boolean : .Dq true if the IDLE extension is supported and there was a update in the mailbox, and .Dq false if the IDLE extension is not supported, in which case the method returns -immediately. +immediately. When the aforementioned return value was +.Dq true , +an additional second value of type +.Vt string +is also returned, indicating the event received from the server, which is +useful when the +.Va wakeonany +option has been enabled. .El .Pp Examples: .Bd -literal -offset 4n exist, unread, unseen, uidnext = myaccount.mymailbox:check_status() update = myaccount.mymailbox:enter_idle() +update, event = myaccount.mymailbox:enter_idle() .Ed .Ss SEARCHING .Pp @@ -674,7 +711,7 @@ .Pp .Bl -tag -width Ds -compact .It Fn arrived_before date -messages that have arrived before the +messages that have arrived earlier than the .Fa date .Pq Vt string , where @@ -684,7 +721,7 @@ form. .Pp .It Fn arrived_on date -Messages that have arrived on the +Messages that have arrived within the .Fa date .Pq Vt string , where @@ -694,7 +731,7 @@ form. .Pp .It Fn arrived_since date -Messages that have arrived after the +Messages that have arrived within or later than the .Fa date .Pq Vt string , where @@ -704,7 +741,7 @@ form. .Pp .It Fn sent_before date -Messages that have been sent before the +Messages that have been sent earlier than the .Fa date .Pq Vt string , where @@ -714,7 +751,7 @@ form. .Pp .It Fn sent_on date -Messages that have been sent on the +Messages that have been sent within the .Fa date .Pq Vt string , where @@ -724,7 +761,7 @@ form. .Pp .It Fn sent_since date -Messages that have been sent after the +Messages that have been sent within or later than the .Fa date .Pq Vt string , where @@ -734,8 +771,8 @@ form. .El .Pp -The following methods can be used to search for messages that contain a -specific word or phrase: +The following methods can be used to do case-insensitive searching, for +messages that contain a specific word or phrase: .Pp .Bl -tag -width Ds -compact .It Fn contain_bcc string @@ -800,8 +837,8 @@ in the message. .El .Pp -The following methods can be used to search for messages that match a specific -regular expression pattern. +The following methods can be used to do case-sensitive searching, for messages +that match a specific regular expression pattern. .Pp This way of searching is not supported by the IMAP protocol, and this means that what actually happens under the hood, is that the relevant parts of all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/cert.c new/imapfilter-2.5.7/src/cert.c --- old/imapfilter-2.5.6/src/cert.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/cert.c 2014-11-16 16:36:40.000000000 +0100 @@ -34,32 +34,43 @@ X509 *cert; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; + long verify; mdlen = 0; if (!(cert = SSL_get_peer_certificate(ssn->sslconn))) return -1; - if (!(X509_digest(cert, EVP_md5(), md, &mdlen))) - return -1; + verify = SSL_get_verify_result(ssn->sslconn); + if (!((verify == X509_V_OK) || + (verify == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) || + (verify == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY))) + goto fail; + + if (verify != X509_V_OK) { + if (!(X509_digest(cert, EVP_md5(), md, &mdlen))) + return -1; - switch (check_cert(cert, md, &mdlen)) { - case 0: - if (isatty(STDIN_FILENO) == 0) - fatal(ERROR_CERTIFICATE, "%s\n", - "can't accept certificate in non-interactive mode"); - print_cert(cert, md, &mdlen); - if (write_cert(cert) == -1) - goto fail; - break; - case -1: - if (isatty(STDIN_FILENO) == 0) - fatal(ERROR_CERTIFICATE, "%s\n", - "certificate mismatch in non-interactive mode"); - print_cert(cert, md, &mdlen); - if (mismatch_cert() == -1) - goto fail; - break; + switch (check_cert(cert, md, &mdlen)) { + case 0: + if (isatty(STDIN_FILENO) == 0) + fatal(ERROR_CERTIFICATE, "%s\n", + "can't accept certificate in " + "non-interactive mode"); + print_cert(cert, md, &mdlen); + if (write_cert(cert) == -1) + goto fail; + break; + case -1: + if (isatty(STDIN_FILENO) == 0) + fatal(ERROR_CERTIFICATE, "%s\n", + "certificate mismatch in non-interactive " + "mode"); + print_cert(cert, md, &mdlen); + if (mismatch_cert() == -1) + goto fail; + break; + } } X509_free(cert); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/core.c new/imapfilter-2.5.7/src/core.c --- old/imapfilter-2.5.6/src/core.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/core.c 2014-11-16 16:36:40.000000000 +0100 @@ -975,13 +975,19 @@ ifcore_idle(lua_State *lua) { int r; + char *event; + + event = NULL; if (lua_gettop(lua) != 1) luaL_error(lua, "wrong number of arguments"); luaL_checktype(lua, 1, LUA_TLIGHTUSERDATA); - while ((r = request_idle((session *)(lua_topointer(lua, 1)))) == - STATUS_NONE); + if (get_option_boolean("reenter")) + while ((r = request_idle((session *)(lua_topointer(lua, 1)), + &event)) == STATUS_NONE); + else + r = request_idle((session *)(lua_topointer(lua, 1)), &event); lua_pop(lua, 1); @@ -990,7 +996,14 @@ lua_pushboolean(lua, (r == STATUS_OK)); - return 1; + if (!event) + return 1; + + lua_pushstring(lua, event); + + xfree(event); + + return 2; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/imapfilter.c new/imapfilter-2.5.7/src/imapfilter.c --- old/imapfilter-2.5.6/src/imapfilter.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/imapfilter.c 2014-11-16 16:36:40.000000000 +0100 @@ -51,11 +51,12 @@ opts.config = NULL; opts.oneline = NULL; opts.debug = NULL; + opts.truststore = "/etc/ssl/certs"; env.home = NULL; env.pathmax = -1; - while ((c = getopt(argc, argv, "Vc:d:e:il:v?")) != -1) { + while ((c = getopt(argc, argv, "Vc:d:e:il:t:v?")) != -1) { switch (c) { case 'V': version(); @@ -76,6 +77,9 @@ case 'l': opts.log = optarg; break; + case 't': + opts.truststore = optarg; + break; case 'v': opts.verbose = 1; break; @@ -111,6 +115,15 @@ tls11ctx = SSL_CTX_new(TLSv1_1_client_method()); tls12ctx = SSL_CTX_new(TLSv1_2_client_method()); #endif + if (exists_dir(opts.truststore)) { + SSL_CTX_load_verify_locations(ssl3ctx, NULL, opts.truststore); + SSL_CTX_load_verify_locations(ssl23ctx, NULL, opts.truststore); + SSL_CTX_load_verify_locations(tls1ctx, NULL, opts.truststore); +#if OPENSSL_VERSION_NUMBER >= 0x01000100fL + SSL_CTX_load_verify_locations(tls11ctx, NULL, opts.truststore); + SSL_CTX_load_verify_locations(tls12ctx, NULL, opts.truststore); +#endif + } start_lua(); #if LUA_VERSION_NUM < 502 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/imapfilter.h new/imapfilter-2.5.7/src/imapfilter.h --- old/imapfilter-2.5.6/src/imapfilter.h 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/imapfilter.h 2014-11-16 16:36:40.000000000 +0100 @@ -67,6 +67,7 @@ char *config; /* Configuration file. */ char *oneline; /* One line of program/configuration. */ char *debug; /* Debug file. */ + char *truststore; /* CA TrustStore. */ } options; /* Environment variables. */ @@ -177,7 +178,7 @@ int request_rename(session *ssn, const char *oldmbox, const char *newmbox); int request_subscribe(session *ssn, const char *mbox); int request_unsubscribe(session *ssn, const char *mbox); -int request_idle(session *ssn); +int request_idle(session *ssn, char **event); /* response.c */ int response_generic(session *ssn, int tag); @@ -200,7 +201,7 @@ int response_fetchsize(session *ssn, int tag, char **size); int response_fetchstructure(session *ssn, int tag, char **structure); int response_fetchbody(session *ssn, int tag, char **body, size_t *len); -int response_idle(session *ssn, int tag); +int response_idle(session *ssn, int tag, char **event); /* signal.c */ void catch_signals(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/lua.c new/imapfilter-2.5.7/src/lua.c --- old/imapfilter-2.5.6/src/lua.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/lua.c 2014-11-16 16:36:40.000000000 +0100 @@ -139,9 +139,11 @@ set_table_number("keepalive", 29); set_table_boolean("namespace", 1); set_table_string("recover", "all"); + set_table_boolean("reenter", 1); set_table_boolean("starttls", 1); set_table_boolean("subscribe", 0); set_table_number("timeout", 60); + set_table_boolean("wakeonany", 0); lua_setglobal(lua, "options"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/mailbox.lua new/imapfilter-2.5.7/src/mailbox.lua --- old/imapfilter-2.5.6/src/mailbox.lua 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/mailbox.lua 2014-11-16 16:36:40.000000000 +0100 @@ -150,7 +150,7 @@ if options.close == true then self._cached_close(self) end - return true + return r end @@ -196,7 +196,7 @@ end end - return true + return r end @@ -1041,13 +1041,13 @@ if self._cached_select(self) ~= true then return false end if not self._check_connection(self) then return end - local r = ifcore.idle(self._account._account.session) + local r, event = ifcore.idle(self._account._account.session) self._check_result(self, 'idle', r) if r == false then return false end if options.close == true then self._cached_close(self) end - return true + return true, string.upper(event) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/pcre.c new/imapfilter-2.5.7/src/pcre.c --- old/imapfilter-2.5.6/src/pcre.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/pcre.c 2014-11-16 16:36:40.000000000 +0100 @@ -213,7 +213,7 @@ #endif 0, lua_tonumber(lua, 3), ovector, (ovecsize + 1) * 3); - if (n > 0) + if (n > 0) { for (i = 1; i < n; i++) if (ovector[2 * i] != -1 && ovector[2 * i + 1] != -1) lua_pushlstring(lua, lua_tostring(lua, 2) + @@ -221,6 +221,7 @@ ovector[2 * i]); else lua_pushnil(lua); + } xfree(ovector); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/request.c new/imapfilter-2.5.7/src/request.c --- old/imapfilter-2.5.6/src/request.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/request.c 2014-11-16 16:36:40.000000000 +0100 @@ -757,12 +757,12 @@ int -request_idle(session *ssn) +request_idle(session *ssn, char **event) { int t, r, ri; if (!(ssn->capabilities & CAPABILITY_IDLE)) - return -1; + return STATUS_BAD; do { ri = 0; @@ -770,7 +770,7 @@ TRY(t = send_request(ssn, "IDLE")); TRY(r = response_continuation(ssn, t)); if (r == STATUS_CONTINUE) { - TRY(ri = response_idle(ssn, t)); + TRY(ri = response_idle(ssn, t, event)); TRY(send_continuation(ssn, "DONE", strlen("DONE"))); TRY(r = response_generic(ssn, t)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/response.c new/imapfilter-2.5.7/src/response.c --- old/imapfilter-2.5.6/src/response.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/response.c 2014-11-16 16:36:40.000000000 +0100 @@ -17,6 +17,7 @@ enum { /* Server data responses to be parsed; * regular expressions index. */ RESPONSE_TAGGED, + RESPONSE_UNTAGGED, RESPONSE_CAPABILITY, RESPONSE_AUTHENTICATE, RESPONSE_NAMESPACE, @@ -25,8 +26,8 @@ RESPONSE_STATUS_RECENT, RESPONSE_STATUS_UNSEEN, RESPONSE_STATUS_UIDNEXT, - RESPONSE_EXAMINE_EXISTS, - RESPONSE_EXAMINE_RECENT, + RESPONSE_EXISTS, + RESPONSE_RECENT, RESPONSE_LIST, RESPONSE_SEARCH, RESPONSE_FETCH, @@ -35,11 +36,11 @@ RESPONSE_FETCH_SIZE, RESPONSE_FETCH_STRUCTURE, RESPONSE_FETCH_BODY, - RESPONSE_IDLE, }; regexp responses[] = { /* Server data responses to be parsed; * regular expressions patterns. */ { "([[:xdigit:]]{4,4}) (OK|NO|BAD) [^[:cntrl:]]*\r+\n+", NULL, 0, NULL }, + { "\\* [[:digit:]]+ ([[:graph:]]*)[^[:cntrl:]]*\r+\n+", NULL, 0, NULL }, { "\\* CAPABILITY ([[:print:]]*)\r+\n+", NULL, 0, NULL }, { "\\+ ([[:graph:]]*)\r+\n+", NULL, 0, NULL }, { "\\* NAMESPACE (NIL|\\(\\(\"([[:graph:]]*)\" \"([[:print:]])\"\\)" @@ -63,7 +64,6 @@ { "BODYSTRUCTURE (\\([[:print:]]+\\))", NULL, 0, NULL }, { "\\* [[:digit:]]+ FETCH \\([[:print:]]*BODY\\[[[:print:]]*\\] " "(\\{([[:digit:]]+)\\} *\r+\n+|\"([[:print:]]*)\")", NULL, 0, NULL }, - { "\\* [[:digit:]]+ (RECENT|EXISTS) *\r+\n+", NULL, 0, NULL }, { NULL, NULL, 0, NULL } }; @@ -460,11 +460,11 @@ if (r == -1 || r == STATUS_BYE) return r; - re = &responses[RESPONSE_EXAMINE_EXISTS]; + re = &responses[RESPONSE_EXISTS]; if (!regexec(re->preg, ibuf.data, re->nmatch, re->pmatch, 0)) *exist = strtol(ibuf.data + re->pmatch[1].rm_so, NULL, 10); - re = &responses[RESPONSE_EXAMINE_RECENT]; + re = &responses[RESPONSE_RECENT]; if (!regexec(re->preg, ibuf.data, re->nmatch, re->pmatch, 0)) *recent = strtol(ibuf.data + re->pmatch[1].rm_so, NULL, 10); @@ -518,11 +518,11 @@ a = xstrndup(b + re->pmatch[2].rm_so, re->pmatch[2].rm_eo - re->pmatch[2].rm_so); - if (re->pmatch[5].rm_so != -1 && re->pmatch[5].rm_so != -1) + if (re->pmatch[5].rm_so != -1 && re->pmatch[5].rm_eo != -1) s = xstrndup(b + re->pmatch[5].rm_so, re->pmatch[5].rm_eo - re->pmatch[5].rm_so); else if (re->pmatch[6].rm_so != -1 && - re->pmatch[6].rm_so != -1) + re->pmatch[6].rm_eo != -1) s = xstrndup(b + re->pmatch[6].rm_so, re->pmatch[6].rm_eo - re->pmatch[6].rm_so); else @@ -838,16 +838,16 @@ * Process the data that server sent due to IMAP IDLE client request. */ int -response_idle(session *ssn, int tag) +response_idle(session *ssn, int tag, char **event) { regexp *re; if (tag == -1) return -1; - re = &responses[RESPONSE_IDLE]; + re = &responses[RESPONSE_UNTAGGED]; - do { + for (;;) { buffer_reset(&ibuf); switch (receive_response(ssn, ibuf.data, @@ -865,7 +865,20 @@ if (check_bye(ibuf.data)) return STATUS_BYE; - } while (regexec(re->preg, ibuf.data, re->nmatch, re->pmatch, 0)); + if (regexec(re->preg, ibuf.data, re->nmatch, re->pmatch, 0)) + continue; + if (get_option_boolean("wakeonany")) + break; + if (!strncasecmp(ibuf.data + re->pmatch[1].rm_so, + "RECENT", strlen("RECENT"))) + break; + if (!strncasecmp(ibuf.data + re->pmatch[1].rm_so, + "EXISTS", strlen("EXISTS"))) + break; + } + + *event = xstrndup(ibuf.data + re->pmatch[1].rm_so, + re->pmatch[1].rm_eo - re->pmatch[1].rm_so); return STATUS_UNTAGGED; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/system.c new/imapfilter-2.5.7/src/system.c --- old/imapfilter-2.5.6/src/system.c 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/system.c 2014-11-16 16:36:40.000000000 +0100 @@ -251,6 +251,7 @@ static int ifsys_daemon(lua_State *lua) { + int fd; if (lua_gettop(lua) != 2) luaL_error(lua, "wrong number of arguments"); @@ -277,16 +278,15 @@ } if (lua_toboolean(lua, 1) == 0) - chdir("/"); + if (chdir("/") == -1) + fprintf(stderr, "changing working directory; %s\n", + strerror(errno)); if (lua_toboolean(lua, 2) == 0) { - close(STDIN_FILENO); - close(STDOUT_FILENO); - close(STDERR_FILENO); - - if (open("/dev/null", O_RDWR) == -1 || - dup(STDIN_FILENO) == -1 || - dup(STDIN_FILENO) == -1) + if ((fd = open("/dev/null", O_RDWR)) == -1 || + dup2(fd, STDIN_FILENO) == -1 || + dup2(fd, STDOUT_FILENO) == -1 || + dup2(fd, STDERR_FILENO) == -1) fprintf(stderr, "duplicating file descriptors; %s\n", strerror(errno)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imapfilter-2.5.6/src/version.h new/imapfilter-2.5.7/src/version.h --- old/imapfilter-2.5.6/src/version.h 2013-10-27 23:46:05.000000000 +0100 +++ new/imapfilter-2.5.7/src/version.h 2014-11-16 16:36:40.000000000 +0100 @@ -3,10 +3,10 @@ /* Program's version number. */ -#define VERSION "2.5.6" +#define VERSION "2.5.7" /* Program's copyright. */ -#define COPYRIGHT "Copyright (c) 2001-2013 Eleftherios Chatzimparmpas" +#define COPYRIGHT "Copyright (c) 2001-2014 Eleftherios Chatzimparmpas" #endif /* VERSION_H */ -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
