mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 19:40:11 +01:00
fixed handling enrypted zip files
This commit is contained in:
parent
a21f5a68e1
commit
b7e61f27ef
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#define VERSION "0.1.25-master-branch"
|
#define VERSION "0.1.25-master-branch"
|
||||||
|
|
||||||
#define BUILD 868
|
#define BUILD 869
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ int extract_opendocument(struct session_data *sdata, struct _state *state, char
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
while(zip_stat_index(z, i, 0, &sb) == 0){
|
while(zip_stat_index(z, i, 0, &sb) == 0){
|
||||||
if(strncmp(sb.name, prefix, strlen(prefix)) == 0 && (int)sb.size > 0){
|
if(ZIP_EM_NONE == sb.encryption_method && strncmp(sb.name, prefix, strlen(prefix)) == 0 && (int)sb.size > 0){
|
||||||
|
|
||||||
zf = zip_fopen_index(z, i, 0);
|
zf = zip_fopen_index(z, i, 0);
|
||||||
if(zf){
|
if(zf){
|
||||||
@ -106,6 +106,8 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename,
|
|||||||
while(zip_stat_index(z, i, 0, &sb) == 0){
|
while(zip_stat_index(z, i, 0, &sb) == 0){
|
||||||
//printf("processing file inside the zip: %s, index: %d, size: %d\n", sb.name, sb.index, (int)sb.size);
|
//printf("processing file inside the zip: %s, index: %d, size: %d\n", sb.name, sb.index, (int)sb.size);
|
||||||
|
|
||||||
|
if(ZIP_EM_NONE == sb.encryption_method) {
|
||||||
|
|
||||||
p = strrchr(sb.name, '.');
|
p = strrchr(sb.name, '.');
|
||||||
|
|
||||||
if((int)sb.size > 0 && p && strcmp(get_attachment_extractor_by_filename((char*)sb.name), "other")){
|
if((int)sb.size > 0 && p && strcmp(get_attachment_extractor_by_filename((char*)sb.name), "other")){
|
||||||
@ -133,8 +135,12 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename,
|
|||||||
else {
|
else {
|
||||||
syslog(LOG_PRIORITY, "%s: cannot open '%s'", sdata->ttmpfile, extracted_filename);
|
syslog(LOG_PRIORITY, "%s: cannot open '%s'", sdata->ttmpfile, extracted_filename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
syslog(LOG_PRIORITY, "ERR: attachment ('%s') is in encrypted zip file", sb.name);
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user