mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-10-31 10:42:27 +01:00 
			
		
		
		
	improved zip file handling
This commit is contained in:
		| @@ -14,7 +14,7 @@ | ||||
|  | ||||
| #define VERSION "1.1.1" | ||||
|  | ||||
| #define BUILD 901 | ||||
| #define BUILD 902 | ||||
|  | ||||
| #define HOSTID "mailarchiver" | ||||
|  | ||||
|   | ||||
| @@ -52,8 +52,11 @@ int extract_opendocument(struct session_data *sdata, struct _state *state, char | ||||
|    struct zip_stat sb; | ||||
|    struct zip_file *zf; | ||||
|  | ||||
|    z = zip_open(filename, 0, &errorp); | ||||
|    if(!z) return 1; | ||||
|    z = zip_open(filename, ZIP_CHECKCONS, &errorp); | ||||
|    if(!z){ | ||||
|       syslog(LOG_INFO, "error: invalid zip file=%s, error code=%d", filename, errorp); | ||||
|       return 1; | ||||
|    } | ||||
|  | ||||
|    memset(buf, 0, sizeof(buf)); | ||||
|  | ||||
| @@ -100,8 +103,11 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename, | ||||
|  | ||||
|    (*rec)++; | ||||
|  | ||||
|    z = zip_open(filename, 0, &errorp); | ||||
|    if(!z) return 1; | ||||
|    z = zip_open(filename, ZIP_CHECKCONS, &errorp); | ||||
|    if(!z){ | ||||
|       syslog(LOG_INFO, "error: invalid zip file=%s, error code=%d", filename, errorp); | ||||
|       return 1; | ||||
|    } | ||||
|  | ||||
|    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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user