Skip to content
Snippets Groups Projects
Commit bc3c7ff7 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

lib-sieve: Added more debug output to binary up-to-date checking.

parent 9420e6de
No related branches found
No related tags found
No related merge requests found
......@@ -315,22 +315,40 @@ bool sieve_binary_up_to_date
struct sieve_binary_block *sblock;
sieve_size_t offset = 0;
unsigned int ext_count, i;
int ret;
i_assert(sbin->file != NULL);
sblock = sieve_binary_block_get(sbin, SBIN_SYSBLOCK_SCRIPT_DATA);
if ( sblock == NULL || sbin->script == NULL ||
sieve_script_binary_read_metadata(sbin->script, sblock, &offset) <= 0 )
if ( sblock == NULL || sbin->script == NULL )
return FALSE;
if ( (ret=sieve_script_binary_read_metadata
(sbin->script, sblock, &offset)) <= 0 ) {
if (ret < 0) {
sieve_sys_debug(sbin->svinst, "binary up-to-date: "
"failed to read script metadata from binary %s",
sbin->path);
} else {
sieve_sys_debug(sbin->svinst, "binary up-to-date: "
"script metadata indicates that binary %s is not up-to-date",
sbin->path);
}
return FALSE;
}
regs = array_get(&sbin->extensions, &ext_count);
for ( i = 0; i < ext_count; i++ ) {
const struct sieve_binary_extension *binext = regs[i]->binext;
if ( binext != NULL && binext->binary_up_to_date != NULL &&
!binext->binary_up_to_date
(regs[i]->extension, sbin, regs[i]->context, cpflags) )
(regs[i]->extension, sbin, regs[i]->context, cpflags) ) {
sieve_sys_debug(sbin->svinst, "binary up-to-date: "
"the %s extension indicates binary %s is not up-to-date",
sieve_extension_name(regs[i]->extension), sbin->path);
return FALSE;
}
}
return TRUE;
......
......@@ -5,6 +5,7 @@
#include "mempool.h"
#include "abspath.h"
#include "istream.h"
#include "time-util.h"
#include "eacces-error.h"
#include "sieve-binary.h"
......@@ -475,12 +476,21 @@ static int sieve_file_script_binary_read_metadata
sieve_size_t *offset ATTR_UNUSED)
{
struct sieve_file_script *fscript = (struct sieve_file_script *)script;
struct sieve_instance *svinst = script->storage->svinst;
struct sieve_binary *sbin = sieve_binary_block_get_binary(sblock);
time_t time = ( fscript->st.st_mtime > fscript->lnk_st.st_mtime ?
time_t bmtime = sieve_binary_mtime(sbin);
time_t smtime = ( fscript->st.st_mtime > fscript->lnk_st.st_mtime ?
fscript->st.st_mtime : fscript->lnk_st.st_mtime );
if ( sieve_binary_mtime(sbin) <= time )
if ( bmtime <= smtime ) {
if (svinst->debug) {
sieve_script_sys_debug(script,
"Sieve binary is not newer than the Sieve script (%s <= %s)",
t_strflocaltime("%Y-%m-%d %H:%M:%S", bmtime),
t_strflocaltime("%Y-%m-%d %H:%M:%S", smtime));
}
return 0;
}
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.