mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 23:51:59 +01:00
added compat storage layout
This commit is contained in:
parent
74bf302126
commit
ad85dd1a2f
23
configure
vendored
23
configure
vendored
@ -695,6 +695,7 @@ ac_subst_files=''
|
||||
ac_user_opts='
|
||||
enable_option_checking
|
||||
enable_static_build
|
||||
enable_compat_layout
|
||||
enable_clamd
|
||||
enable_memcached
|
||||
enable_starttls
|
||||
@ -1320,6 +1321,7 @@ Optional Features:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-static-build build statically linked executables (default: dynamically linked)
|
||||
--enable-compat-layout support for older storage layout (default: no)
|
||||
--enable-clamd build clamd antivirus support
|
||||
--enable-memcached build memcached support
|
||||
--enable-starttls build starttls support
|
||||
@ -3457,6 +3459,7 @@ tnef="no"
|
||||
timeout_binary=""
|
||||
|
||||
have_static_build="no"
|
||||
have_compat_storage_layout="no"
|
||||
|
||||
antispam_libs="-lz -lm -ldl -lcrypto -lssl"
|
||||
defs=""
|
||||
@ -3500,6 +3503,16 @@ fi
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-compat-layout was given.
|
||||
if test "${enable_compat_layout+set}" = set; then :
|
||||
enableval=$enable_compat_layout; have_compat_storage_layout=$enableval
|
||||
else
|
||||
have_compat_storage_layout="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-clamd was given.
|
||||
if test "${enable_clamd+set}" = set; then :
|
||||
@ -4665,6 +4678,16 @@ fi
|
||||
|
||||
echo
|
||||
|
||||
if test "$have_compat_storage_layout" = "yes"; then
|
||||
echo "support for older storage layout: yes"
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "$have_mysql" = "yes"; then
|
||||
echo "database: mysql"
|
||||
fi
|
||||
|
13
configure.in
13
configure.in
@ -56,6 +56,7 @@ tnef="no"
|
||||
timeout_binary=""
|
||||
|
||||
have_static_build="no"
|
||||
have_compat_storage_layout="no"
|
||||
|
||||
antispam_libs="-lz -lm -ldl -lcrypto -lssl"
|
||||
defs=""
|
||||
@ -94,6 +95,12 @@ AC_ARG_ENABLE(static-build,
|
||||
[ --enable-static-build build statically linked executables (default: dynamically linked)], have_static_build=$enableval, have_static_build="no")
|
||||
|
||||
|
||||
dnl
|
||||
|
||||
AC_ARG_ENABLE(compat-layout,
|
||||
[ --enable-compat-layout support for older storage layout (default: no)], have_compat_storage_layout=$enableval, have_compat_storage_layout="no")
|
||||
|
||||
|
||||
dnl clamd
|
||||
|
||||
|
||||
@ -390,6 +397,12 @@ fi
|
||||
|
||||
echo
|
||||
|
||||
if test "$have_compat_storage_layout" = "yes"; then
|
||||
echo "support for older storage layout: yes"
|
||||
AC_DEFINE_UNQUOTED(HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT, 1, [compat storage layout support])
|
||||
fi
|
||||
|
||||
|
||||
if test "$have_mysql" = "yes"; then
|
||||
echo "database: mysql"
|
||||
fi
|
||||
|
@ -24,3 +24,6 @@
|
||||
#undef HAVE_LIBWRAP
|
||||
|
||||
#undef HAVE_TWEAK_SENT_TIME
|
||||
|
||||
#undef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
|
||||
|
@ -305,9 +305,11 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data,
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.m", cfg->queuedir, cfg->server_id, *(sdata->ttmpfile+8), *(sdata->ttmpfile+9), *(sdata->ttmpfile+10), *(sdata->ttmpfile+RND_STR_LEN-4), *(sdata->ttmpfile+RND_STR_LEN-3), *(sdata->ttmpfile+RND_STR_LEN-2), *(sdata->ttmpfile+RND_STR_LEN-1), sdata->ttmpfile);
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
if(stat(filename, &st)){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.m", cfg->queuedir, cfg->server_id, *(sdata->ttmpfile+RND_STR_LEN-6), *(sdata->ttmpfile+RND_STR_LEN-5), *(sdata->ttmpfile+RND_STR_LEN-4), *(sdata->ttmpfile+RND_STR_LEN-3), *(sdata->ttmpfile+RND_STR_LEN-2), *(sdata->ttmpfile+RND_STR_LEN-1), sdata->ttmpfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(attachments == 0){
|
||||
retrieve_file_from_archive(filename, WRITE_TO_STDOUT, &buffer, dest, cfg);
|
||||
@ -330,9 +332,11 @@ int retrieve_email_from_archive(struct session_data *sdata, struct __data *data,
|
||||
if(strlen(ptr_arr[i].piler_id) == RND_STR_LEN){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.a%d", cfg->queuedir, cfg->server_id, ptr_arr[i].piler_id[8], ptr_arr[i].piler_id[9], ptr_arr[i].piler_id[10], ptr_arr[i].piler_id[RND_STR_LEN-4], ptr_arr[i].piler_id[RND_STR_LEN-3], ptr_arr[i].piler_id[RND_STR_LEN-2], ptr_arr[i].piler_id[RND_STR_LEN-1], ptr_arr[i].piler_id, ptr_arr[i].attachment_id);
|
||||
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
if(stat(filename, &st)){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.a%d", cfg->queuedir, cfg->server_id, ptr_arr[i].piler_id[RND_STR_LEN-6], ptr_arr[i].piler_id[RND_STR_LEN-5], ptr_arr[i].piler_id[RND_STR_LEN-4], ptr_arr[i].piler_id[RND_STR_LEN-3], ptr_arr[i].piler_id[RND_STR_LEN-2], ptr_arr[i].piler_id[RND_STR_LEN-1], ptr_arr[i].piler_id, ptr_arr[i].attachment_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
retrieve_file_from_archive(filename, WRITE_TO_STDOUT, NULL, dest, cfg);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ int extract_opendocument(struct session_data *sdata, struct _state *state, char
|
||||
|
||||
z = zip_open(filename, ZIP_CHECKCONS, &errorp);
|
||||
if(!z){
|
||||
syslog(LOG_INFO, "error: corrupt zip file=%s, error code=%d", filename, errorp);
|
||||
syslog(LOG_INFO, "%s: error: corrupt zip file=%s, error code=%d", sdata->ttmpfile, filename, errorp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename,
|
||||
|
||||
z = zip_open(filename, ZIP_CHECKCONS, &errorp);
|
||||
if(!z){
|
||||
syslog(LOG_INFO, "error: corrupt zip file=%s, error code=%d", filename, errorp);
|
||||
syslog(LOG_INFO, "%s: error: corrupt zip file=%s, error code=%d", sdata->ttmpfile, filename, errorp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,11 @@ int main(int argc, char **argv){
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.a%d", cfg.queuedir, cfg.server_id, argv[1][8], argv[1][9], argv[1][10], argv[1][RND_STR_LEN-4], argv[1][RND_STR_LEN-3], argv[1][RND_STR_LEN-2], argv[1][RND_STR_LEN-1], argv[1], atoi(argv[2]));
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
if(stat(filename, &st)){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.a%d", cfg.queuedir, cfg.server_id, argv[1][RND_STR_LEN-6], argv[1][RND_STR_LEN-5], argv[1][RND_STR_LEN-4], argv[1][RND_STR_LEN-3], argv[1][RND_STR_LEN-2], argv[1][RND_STR_LEN-1], argv[1], atoi(argv[2]));
|
||||
}
|
||||
#endif
|
||||
|
||||
retrieve_file_from_archive(filename, WRITE_TO_STDOUT, NULL, stdout, &cfg);
|
||||
|
||||
|
@ -69,9 +69,11 @@ int remove_message_frame_files(char *s, char *update_meta_sql, struct session_da
|
||||
if(strlen(puf) == RND_STR_LEN){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.m", cfg->queuedir, cfg->server_id, puf[8], puf[9], puf[10], puf[RND_STR_LEN-4], puf[RND_STR_LEN-3], puf[RND_STR_LEN-2], puf[RND_STR_LEN-1], puf);
|
||||
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
if(stat(filename, &st)){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.m", cfg->queuedir, cfg->server_id, puf[RND_STR_LEN-6], puf[RND_STR_LEN-5], puf[RND_STR_LEN-4], puf[RND_STR_LEN-3], puf[RND_STR_LEN-2], puf[RND_STR_LEN-1], puf);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(dryrun == 1){
|
||||
n++;
|
||||
@ -147,9 +149,11 @@ int remove_attachments(char *in, struct session_data *sdata, struct __data *data
|
||||
while(p_fetch_results(data->stmt_select_non_referenced_attachments) == OK){
|
||||
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c%c/%c%c/%c%c/%s.a%d", cfg->queuedir, cfg->server_id, piler_id[8], piler_id[9], piler_id[10], piler_id[RND_STR_LEN-4], piler_id[RND_STR_LEN-3], piler_id[RND_STR_LEN-2], piler_id[RND_STR_LEN-1], piler_id, attachment_id);
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
if(stat(filename, &st)){
|
||||
snprintf(filename, sizeof(filename)-1, "%s/%02x/%c%c/%c%c/%c%c/%s.a%d", cfg->queuedir, cfg->server_id, piler_id[RND_STR_LEN-6], piler_id[RND_STR_LEN-5], piler_id[RND_STR_LEN-4], piler_id[RND_STR_LEN-3], piler_id[RND_STR_LEN-2], piler_id[RND_STR_LEN-1], piler_id, attachment_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(dryrun == 1){
|
||||
printf("removing attachment: *%s*\n", filename);
|
||||
|
@ -25,8 +25,10 @@ int stat_file(struct session_data *sdata, char *f, char **buf, int buflen, struc
|
||||
snprintf(*buf, buflen, "%s/%02x/%c%c%c/%c%c/%c%c/%s", cfg->queuedir, cfg->server_id, f[8], f[9], f[10], f[RND_STR_LEN-4], f[RND_STR_LEN-3], f[RND_STR_LEN-2], f[RND_STR_LEN-1], f);
|
||||
if(!stat(*buf, &st)) return st.st_size;
|
||||
|
||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||
snprintf(*buf, TINYBUFSIZE-1, "%s/%02x/%c%c/%c%c/%c%c/%s", cfg->queuedir, cfg->server_id, f[RND_STR_LEN-6], f[RND_STR_LEN-5], f[RND_STR_LEN-4], f[RND_STR_LEN-3], f[RND_STR_LEN-2], f[RND_STR_LEN-1], f);
|
||||
if(!stat(*buf, &st)) return st.st_size;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user