mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:00:13 +01:00
code cleanup #2
This commit is contained in:
parent
dd83ee8fb1
commit
ccb3d72b8e
@ -15,6 +15,7 @@
|
|||||||
#define ERR_SETGID "ERR: setgid()"
|
#define ERR_SETGID "ERR: setgid()"
|
||||||
#define ERR_SELECT "ERR: select()"
|
#define ERR_SELECT "ERR: select()"
|
||||||
#define ERR_CHDIR "ERR: chdir() to working directory failed"
|
#define ERR_CHDIR "ERR: chdir() to working directory failed"
|
||||||
|
#define ERR_DAEMON "ERR: daemon()"
|
||||||
#define ERR_OPEN_TMP_FILE "ERR: opening a tempfile"
|
#define ERR_OPEN_TMP_FILE "ERR: opening a tempfile"
|
||||||
#define ERR_TIMED_OUT "ERR: timed out"
|
#define ERR_TIMED_OUT "ERR: timed out"
|
||||||
#define ERR_FORK_FAILED "ERR: cannot fork()"
|
#define ERR_FORK_FAILED "ERR: cannot fork()"
|
||||||
|
14
src/imap.c
14
src/imap.c
@ -101,7 +101,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
|||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "A%d SELECT %s\r\n", *seq, folder);
|
snprintf(buf, sizeof(buf)-1, "A%d SELECT %s\r\n", *seq, folder);
|
||||||
|
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
if(read_response(sd, buf, sizeof(buf), seq, data, use_ssl) == 0){
|
if(read_response(sd, buf, sizeof(buf), seq, data, use_ssl) == 0){
|
||||||
trimBuffer(buf);
|
trimBuffer(buf);
|
||||||
printf("select cmd error: %s\n", buf);
|
printf("select cmd error: %s\n", buf);
|
||||||
@ -161,7 +161,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
|
|
||||||
readlen = 0;
|
readlen = 0;
|
||||||
nreads = 0;
|
nreads = 0;
|
||||||
@ -264,7 +264,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
|||||||
|
|
||||||
if(data->import->remove_after_import == 1 && dryrun == 0){
|
if(data->import->remove_after_import == 1 && dryrun == 0){
|
||||||
snprintf(buf, sizeof(buf)-1, "A%d STORE %d +FLAGS.SILENT (\\Deleted)\r\n", *seq, i);
|
snprintf(buf, sizeof(buf)-1, "A%d STORE %d +FLAGS.SILENT (\\Deleted)\r\n", *seq, i);
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,12 +275,12 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
|||||||
tagoklen = strlen(tagok);
|
tagoklen = strlen(tagok);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "A%d COPY %d %s\r\n", *seq, i, data->import->move_folder);
|
snprintf(buf, sizeof(buf)-1, "A%d COPY %d %s\r\n", *seq, i, data->import->move_folder);
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
||||||
|
|
||||||
if(strncmp(buf, tagok, tagoklen) == 0){
|
if(strncmp(buf, tagok, tagoklen) == 0){
|
||||||
snprintf(buf, sizeof(buf)-1, "A%d STORE %d +FLAGS.SILENT (\\Deleted)\r\n", *seq, i);
|
snprintf(buf, sizeof(buf)-1, "A%d STORE %d +FLAGS.SILENT (\\Deleted)\r\n", *seq, i);
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ int process_imap_folder(int sd, int *seq, char *folder, struct session_data *sda
|
|||||||
|
|
||||||
if((data->import->remove_after_import == 1 || data->import->move_folder) && dryrun == 0){
|
if((data->import->remove_after_import == 1 || data->import->move_folder) && dryrun == 0){
|
||||||
snprintf(buf, sizeof(buf)-1, "A%d EXPUNGE\r\n", *seq);
|
snprintf(buf, sizeof(buf)-1, "A%d EXPUNGE\r\n", *seq);
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
read_response(sd, buf, sizeof(buf), seq, data, use_ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ int connect_to_imap_server(int sd, int *seq, char *username, char *password, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
|
|
||||||
|
|
||||||
/* imap cmd: LOGIN */
|
/* imap cmd: LOGIN */
|
||||||
|
@ -220,12 +220,14 @@ time_t parse_date_header(char *datestr, struct __config *cfg){
|
|||||||
if((len == 5 && (*s == '+' || *s == '-')) || (len == 8 && (strncmp(s, "GMT+", 4) == 0 || strncmp(s, "GMT-", 4) == 0))){
|
if((len == 5 && (*s == '+' || *s == '-')) || (len == 8 && (strncmp(s, "GMT+", 4) == 0 || strncmp(s, "GMT-", 4) == 0))){
|
||||||
offset = 0;
|
offset = 0;
|
||||||
tz = strpbrk(s, "+-");
|
tz = strpbrk(s, "+-");
|
||||||
memset(tzh, 0, 4);
|
if(tz){
|
||||||
memset(tzm, 0, 3);
|
memset(tzh, 0, 4);
|
||||||
strncpy(tzh, tz, 3);
|
memset(tzm, 0, 3);
|
||||||
strncpy(tzm, tz+3, 2);
|
strncpy(tzh, tz, 3);
|
||||||
offset += atoi(tzh) * 3600;
|
strncpy(tzm, tz+3, 2);
|
||||||
offset += atoi(tzm) * 60;
|
offset += atoi(tzh) * 3600;
|
||||||
|
offset += atoi(tzm) * 60;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +353,7 @@ void fixupEncodedHeaderLine(char *buf, int buflen){
|
|||||||
if(start){
|
if(start){
|
||||||
*start = '\0';
|
*start = '\0';
|
||||||
if(strlen(p) > 0){
|
if(strlen(p) > 0){
|
||||||
strncat(puf, p, sizeof(puf)-1);
|
strncat(puf, p, sizeof(puf)-strlen(puf)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
start++;
|
start++;
|
||||||
@ -386,27 +388,27 @@ void fixupEncodedHeaderLine(char *buf, int buflen){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(need_encoding == 1 && ret == OK)
|
if(need_encoding == 1 && ret == OK)
|
||||||
strncat(puf, tmpbuf, sizeof(puf)-1);
|
strncat(puf, tmpbuf, sizeof(puf)-strlen(puf)-1);
|
||||||
else
|
else
|
||||||
strncat(puf, s+3, sizeof(puf)-1);
|
strncat(puf, s+3, sizeof(puf)-strlen(puf)-1);
|
||||||
|
|
||||||
p = end + 2;
|
p = end + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strncat(puf, start, sizeof(puf)-1);
|
strncat(puf, start, sizeof(puf)-strlen(puf)-1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strncat(puf, p, sizeof(puf)-1);
|
strncat(puf, p, sizeof(puf)-strlen(puf)-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(p);
|
} while(p);
|
||||||
|
|
||||||
if(q) strncat(puf, " ", sizeof(puf)-1);
|
if(q) strncat(puf, " ", sizeof(puf)-strlen(puf)-1);
|
||||||
|
|
||||||
} while(q);
|
} while(q);
|
||||||
|
|
||||||
@ -450,7 +452,7 @@ void fixupBase64EncodedLine(char *buf, struct parser_state *state){
|
|||||||
if(strlen(state->miscbuf) > 0){
|
if(strlen(state->miscbuf) > 0){
|
||||||
memset(puf, 0, sizeof(puf));
|
memset(puf, 0, sizeof(puf));
|
||||||
strncpy(puf, state->miscbuf, sizeof(puf)-1);
|
strncpy(puf, state->miscbuf, sizeof(puf)-1);
|
||||||
strncat(puf, buf, sizeof(puf)-1);
|
strncat(puf, buf, sizeof(puf)-strlen(puf)-1);
|
||||||
|
|
||||||
memset(buf, 0, MAXBUFSIZE);
|
memset(buf, 0, MAXBUFSIZE);
|
||||||
memcpy(buf, puf, MAXBUFSIZE);
|
memcpy(buf, puf, MAXBUFSIZE);
|
||||||
@ -539,7 +541,7 @@ void markHTML(char *buf, struct parser_state *state){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//printf("append last in line:*%s*, html=+%s+, j=%d\n", puf, html, j);
|
//printf("append last in line:*%s*, html=+%s+, j=%d\n", puf, html, j);
|
||||||
if(j > 0){ k += appendHTMLTag(puf, html, pos, state); }
|
if(j > 0){ appendHTMLTag(puf, html, pos, state); }
|
||||||
|
|
||||||
strcpy(buf, puf);
|
strcpy(buf, puf);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ int remove_attachments(char *in, struct session_data *sdata, struct __data *data
|
|||||||
char filename[SMALLBUFSIZE];
|
char filename[SMALLBUFSIZE];
|
||||||
char *a, buf[BIGBUFSIZE-300], update_meta_sql[BIGBUFSIZE], delete_attachment_stmt[BIGBUFSIZE];
|
char *a, buf[BIGBUFSIZE-300], update_meta_sql[BIGBUFSIZE], delete_attachment_stmt[BIGBUFSIZE];
|
||||||
char piler_id[SMALLBUFSIZE], i[BUFLEN];
|
char piler_id[SMALLBUFSIZE], i[BUFLEN];
|
||||||
int n=0, len, attachment_id;
|
int n=0, len, attachment_id=0;
|
||||||
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||||
struct stat st;
|
struct stat st;
|
||||||
#endif
|
#endif
|
||||||
@ -149,6 +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){
|
while(p_fetch_results(data->stmt_select_non_referenced_attachments) == OK){
|
||||||
|
|
||||||
|
if(strlen(piler_id) != RND_STR_LEN || attachment_id <= 0){
|
||||||
|
printf("invalid piler_id: '%s.a%d'\n", piler_id, attachment_id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
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
|
#ifdef HAVE_SUPPORT_FOR_COMPAT_STORAGE_LAYOUT
|
||||||
if(stat(filename, &st)){
|
if(stat(filename, &st)){
|
||||||
|
18
src/pop3.c
18
src/pop3.c
@ -75,19 +75,19 @@ int connect_to_pop3_server(int sd, char *username, char *password, int port, str
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "USER %s\r\n", username);
|
snprintf(buf, sizeof(buf)-1, "USER %s\r\n", username);
|
||||||
|
|
||||||
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "PASS %s\r\n", password);
|
snprintf(buf, sizeof(buf)-1, "PASS %s\r\n", password);
|
||||||
|
|
||||||
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
|
|
||||||
if(strncmp(buf, "+OK", 3) == 0) return OK;
|
if(strncmp(buf, "+OK", 3) == 0) return OK;
|
||||||
|
|
||||||
@ -106,9 +106,9 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
data->import->total_messages = 0;
|
data->import->total_messages = 0;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "STAT\r\n");
|
snprintf(buf, sizeof(buf)-1, "STAT\r\n");
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
|
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
|
|
||||||
if(strncmp(buf, "+OK ", 4) == 0){
|
if(strncmp(buf, "+OK ", 4) == 0){
|
||||||
p = strchr(&buf[4], ' ');
|
p = strchr(&buf[4], ' ');
|
||||||
@ -140,7 +140,7 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
|
|
||||||
readlen = 0;
|
readlen = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
@ -203,8 +203,8 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
|
|
||||||
if(dryrun == 0 && rc == OK && data->import->remove_after_import == 1){
|
if(dryrun == 0 && rc == OK && data->import->remove_after_import == 1){
|
||||||
snprintf(buf, sizeof(buf)-1, "DELE %d\r\n", i);
|
snprintf(buf, sizeof(buf)-1, "DELE %d\r\n", i);
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
n = recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
recvtimeoutssl(sd, buf, sizeof(buf), data->import->timeout, use_ssl, data->ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i % 100 == 0){
|
if(i % 100 == 0){
|
||||||
@ -224,7 +224,7 @@ int process_pop3_emails(int sd, struct session_data *sdata, struct __data *data,
|
|||||||
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf)-1, "QUIT\r\n");
|
snprintf(buf, sizeof(buf)-1, "QUIT\r\n");
|
||||||
n = write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
write1(sd, buf, strlen(buf), use_ssl, data->ssl);
|
||||||
|
|
||||||
if(data->quiet == 0) printf("\n");
|
if(data->quiet == 0) printf("\n");
|
||||||
|
|
||||||
|
@ -121,6 +121,8 @@ struct rule *create_rule_item(struct rule_cond *rule_cond, struct __data *data){
|
|||||||
char empty = '\0';
|
char empty = '\0';
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
if(rule_cond == NULL) return NULL;
|
||||||
|
|
||||||
if((h = malloc(sizeof(struct rule))) == NULL)
|
if((h = malloc(sizeof(struct rule))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
|||||||
if(puf[n-2] != '\r' && puf[n-1] != '\n'){
|
if(puf[n-2] != '\r' && puf[n-1] != '\n'){
|
||||||
memmove(puf, puf+pos, n-pos);
|
memmove(puf, puf+pos, n-pos);
|
||||||
memset(puf+n-pos, 0, MAXBUFSIZE-n+pos);
|
memset(puf+n-pos, 0, MAXBUFSIZE-n+pos);
|
||||||
i = recvtimeout(new_sd, buf, MAXBUFSIZE, TIMEOUT);
|
recvtimeout(new_sd, buf, MAXBUFSIZE, TIMEOUT);
|
||||||
strncat(puf, buf, MAXBUFSIZE-1-n+pos);
|
strncat(puf, buf, MAXBUFSIZE-1-n+pos);
|
||||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: partial read: %s", sdata.ttmpfile, puf);
|
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: partial read: %s", sdata.ttmpfile, puf);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
@ -356,7 +356,7 @@ AFTER_PERIOD:
|
|||||||
|
|
||||||
if(strncasecmp(buf, SMTP_CMD_HELO, strlen(SMTP_CMD_HELO)) == 0){
|
if(strncasecmp(buf, SMTP_CMD_HELO, strlen(SMTP_CMD_HELO)) == 0){
|
||||||
if(protocol_state == SMTP_STATE_INIT) protocol_state = SMTP_STATE_HELO;
|
if(protocol_state == SMTP_STATE_INIT) protocol_state = SMTP_STATE_HELO;
|
||||||
strncat(resp, SMTP_RESP_250_OK, sizeof(resp)-1);
|
strncat(resp, SMTP_RESP_250_OK, sizeof(resp)-strlen(resp)-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ AFTER_PERIOD:
|
|||||||
|
|
||||||
|
|
||||||
if(strncasecmp(buf, SMTP_CMD_NOOP, strlen(SMTP_CMD_NOOP)) == 0){
|
if(strncasecmp(buf, SMTP_CMD_NOOP, strlen(SMTP_CMD_NOOP)) == 0){
|
||||||
strncat(resp, SMTP_RESP_250_OK, sizeof(resp)-1);
|
strncat(resp, SMTP_RESP_250_OK, sizeof(resp)-strlen(resp)-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ AFTER_PERIOD:
|
|||||||
/* by default send 502 command not implemented message */
|
/* by default send 502 command not implemented message */
|
||||||
|
|
||||||
syslog(LOG_PRIORITY, "%s: invalid command: *%s*", sdata.ttmpfile, buf);
|
syslog(LOG_PRIORITY, "%s: invalid command: *%s*", sdata.ttmpfile, buf);
|
||||||
strncat(resp, SMTP_RESP_502_ERR, sizeof(resp)-1);
|
strncat(resp, SMTP_RESP_502_ERR, sizeof(resp)-strlen(resp)-1);
|
||||||
} while(p);
|
} while(p);
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ int store_file(struct session_data *sdata, char *filename, int startpos, int len
|
|||||||
|
|
||||||
EVP_CIPHER_CTX ctx;
|
EVP_CIPHER_CTX ctx;
|
||||||
unsigned char *outbuf=NULL;
|
unsigned char *outbuf=NULL;
|
||||||
int outlen, writelen, tmplen;
|
int outlen=0, writelen, tmplen;
|
||||||
|
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
struct timeval tv1, tv2;
|
struct timeval tv1, tv2;
|
||||||
@ -118,7 +118,7 @@ int store_file(struct session_data *sdata, char *filename, int startpos, int len
|
|||||||
|
|
||||||
if(p){
|
if(p){
|
||||||
*p = '.';
|
*p = '.';
|
||||||
strncat(s, p, sizeof(s)-1);
|
strncat(s, p, sizeof(s)-strlen(s)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,9 +131,9 @@ int store_file(struct session_data *sdata, char *filename, int startpos, int len
|
|||||||
p2 = strrchr(s, '/'); if(!p2) goto ENDE;
|
p2 = strrchr(s, '/'); if(!p2) goto ENDE;
|
||||||
*p2 = '\0';
|
*p2 = '\0';
|
||||||
|
|
||||||
rc = mkdir(s, 0750);
|
mkdir(s, 0750);
|
||||||
*p2 = '/';
|
*p2 = '/';
|
||||||
rc = mkdir(s, 0750);
|
mkdir(s, 0750);
|
||||||
*p1 = '/';
|
*p1 = '/';
|
||||||
rc = mkdir(s, 0770); if(rc == -1) syslog(LOG_PRIORITY, "%s: mkdir %s: error=%s", sdata->ttmpfile, s, strerror(errno));
|
rc = mkdir(s, 0770); if(rc == -1) syslog(LOG_PRIORITY, "%s: mkdir %s: error=%s", sdata->ttmpfile, s, strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ static void test_archiving_rule(struct __config *cfg){
|
|||||||
|
|
||||||
unlink(sdata.tmpframe);
|
unlink(sdata.tmpframe);
|
||||||
|
|
||||||
printf("%s, '%s'\n", rule_test[i].filename, rule);
|
//printf("%s, '%s'\n", rule_test[i].filename, rule);
|
||||||
|
|
||||||
if(rule == NULL && rule == rule_test[i].expected_result) continue;
|
if(rule == NULL && rule == rule_test[i].expected_result) continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user