mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 06:41:59 +01:00
tnef compile error fix
This commit is contained in:
parent
97044f19e6
commit
e5dd2f06a2
@ -91,47 +91,6 @@ int extract_opendocument(struct session_data *sdata, struct _state *state, char
|
||||
}
|
||||
|
||||
|
||||
int extract_tnef(struct session_data *sdata, struct _state *state, char *filename){
|
||||
int rc=0, n, rec=1;
|
||||
char tmpdir[BUFLEN], buf[SMALLBUFSIZE];
|
||||
struct dirent **namelist;
|
||||
|
||||
memset(tmpdir, 0, sizeof(tmpdir));
|
||||
make_random_string(&tmpdir[0], sizeof(tmpdir)-3);
|
||||
|
||||
memcpy(&tmpdir[sizeof(tmpdir)-3], ".d", 2);
|
||||
|
||||
printf("tmpname: %s, filename: %s\n", tmpdir, filename);
|
||||
|
||||
if(mkdir(tmpdir, 0700)) return rc;
|
||||
|
||||
snprintf(buf, sizeof(buf)-1, "%s -C %s %s", HAVE_TNEF, tmpdir, filename);
|
||||
|
||||
system(buf);
|
||||
|
||||
n = scandir(tmpdir, &namelist, NULL, alphasort);
|
||||
if(n < 0) syslog(LOG_INFO, "error reading %s", tmpdir);
|
||||
else {
|
||||
while(n--){
|
||||
if(strcmp(namelist[n]->d_name, ".") && strcmp(namelist[n]->d_name, "..")){
|
||||
snprintf(buf, sizeof(buf)-1, "%s/%s", tmpdir, namelist[n]->d_name);
|
||||
|
||||
extract_attachment_content(sdata, state, buf, get_attachment_extractor_by_filename(buf), &rec);
|
||||
|
||||
unlink(buf);
|
||||
}
|
||||
|
||||
free(namelist[n]);
|
||||
}
|
||||
free(namelist);
|
||||
}
|
||||
|
||||
rmdir(tmpdir);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int unzip_file(struct session_data *sdata, struct _state *state, char *filename, int *rec){
|
||||
int errorp, i=0, len=0, fd;
|
||||
char *p, extracted_filename[SMALLBUFSIZE], buf[MAXBUFSIZE];
|
||||
@ -188,6 +147,51 @@ int unzip_file(struct session_data *sdata, struct _state *state, char *filename,
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_TNEF
|
||||
|
||||
int extract_tnef(struct session_data *sdata, struct _state *state, char *filename){
|
||||
int rc=0, n, rec=1;
|
||||
char tmpdir[BUFLEN], buf[SMALLBUFSIZE];
|
||||
struct dirent **namelist;
|
||||
|
||||
memset(tmpdir, 0, sizeof(tmpdir));
|
||||
make_random_string(&tmpdir[0], sizeof(tmpdir)-3);
|
||||
|
||||
memcpy(&tmpdir[sizeof(tmpdir)-3], ".d", 2);
|
||||
|
||||
printf("tmpname: %s, filename: %s\n", tmpdir, filename);
|
||||
|
||||
if(mkdir(tmpdir, 0700)) return rc;
|
||||
|
||||
snprintf(buf, sizeof(buf)-1, "%s -C %s %s", HAVE_TNEF, tmpdir, filename);
|
||||
|
||||
system(buf);
|
||||
|
||||
n = scandir(tmpdir, &namelist, NULL, alphasort);
|
||||
if(n < 0) syslog(LOG_INFO, "error reading %s", tmpdir);
|
||||
else {
|
||||
while(n--){
|
||||
if(strcmp(namelist[n]->d_name, ".") && strcmp(namelist[n]->d_name, "..")){
|
||||
snprintf(buf, sizeof(buf)-1, "%s/%s", tmpdir, namelist[n]->d_name);
|
||||
|
||||
extract_attachment_content(sdata, state, buf, get_attachment_extractor_by_filename(buf), &rec);
|
||||
|
||||
unlink(buf);
|
||||
}
|
||||
|
||||
free(namelist[n]);
|
||||
}
|
||||
free(namelist);
|
||||
}
|
||||
|
||||
rmdir(tmpdir);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void read_content_with_popen(struct session_data *sdata, struct _state *state, char *cmd){
|
||||
int len;
|
||||
char buf[MAXBUFSIZE];
|
||||
|
Loading…
Reference in New Issue
Block a user