summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-05-23 15:02:58 +0200
committerErich Eckner <git@eckner.net>2021-01-20 19:19:09 +0100
commit68d36a5747d3452b6a5b7b10082516fd2039488b (patch)
treef30e7ddb64ed0358b051298975034232e8d49bd7
parentd1856db926a2f493b8eabc8b5138d986df068690 (diff)
downloadalpine-68d36a5747d3452b6a5b7b10082516fd2039488b.tar.xz
pith/send.c: Header werden nun angefügt, landen aber irgendwie nicht in der Email
-rw-r--r--pith/send.c144
1 files changed, 109 insertions, 35 deletions
diff --git a/pith/send.c b/pith/send.c
index dfcaf988..399537e4 100644
--- a/pith/send.c
+++ b/pith/send.c
@@ -1711,23 +1711,43 @@ FILE* log_file;
log_file=fopen("/tmp/alpine.log","a");
fprintf(log_file,"a\n"); fflush(log_file);
-
- int header_count=0;
- int addresses_count=0;
+/*
+ for(pf = header->local; pf; pf = pf->next) {
+ fprintf(log_file,"%s %u\n", pf->name, pf->type); fflush(log_file);
+ if (pf->type != Address)
+ continue;
+ fprintf(log_file,"val %u '%s'\n", pf->val, pf->val); fflush(log_file);
+ fprintf(log_file,"addr %u %u '%s'\n", pf->addr, *pf->addr, *pf->addr); fflush(log_file);
+ fprintf(log_file,"scratch %u\n", pf->scratch); fflush(log_file);
+// fprintf(log_file,"*text %u '%s'\n", *(pf->text), *(pf->text)); fflush(log_file);
+// fprintf(log_file,"textbuf %u '%s'\n", pf->textbuf, pf->textbuf); fflush(log_file);
+ fprintf(log_file,"extdata %u\n", pf->extdata); fflush(log_file);
+ }
+assert(0);
+*/
+ PINEFIELD *last_header, *pff;
+ for(last_header = header->local; last_header->next; last_header = last_header->next) ;
+ pff = last_header;
for(pf = header->local; pf; pf = pf->next) {
- header_count++;
if(pf->type == Address && pf->rcptto && pf->addr) {
for (a = *pf->addr; a; a = a -> next) {
FILE *fp;
char cmd[128];
char output[1024];
- snprintf(cmd, 128, "/usr/bin/hashcash -mq -r %s@%s",a->mailbox, a->host);
+ snprintf(cmd, 128, "/usr/bin/hashcash -mq -r %s@%s", a->mailbox, a->host);
fp = popen(cmd, "r");
if (fp != NULL) {
while (!feof(fp)) {
if (fgets(output, 1024, fp) != NULL) {
-// fprintf(log_file,"'%s'\n", output); fflush(log_file);
- addresses_count++;
+ fprintf(log_file,"'%s'\n", output); fflush(log_file);
+ pff->next = fs_get((size_t)sizeof(PINEFIELD));
+ memset(pff->next, 0, (size_t)sizeof(PINEFIELD));
+ pff = pff->next;
+ pff->name = cpystr("X-Hashcash");
+ pff->type = FreeText;
+ pff->writehdr = 1;
+ pff->textbuf = cpystr(output);
+ pff->text = &pff->textbuf;
}
}
pclose(fp);
@@ -1735,48 +1755,48 @@ fprintf(log_file,"a\n"); fflush(log_file);
}
}
}
-fprintf(log_file,"%u %u b\n",header_count,addresses_count); fflush(log_file);
-
+fprintf(log_file,"b\n"); fflush(log_file);
+/*
PINEFIELD* old_local = header->local;
-fprintf(log_file,"%u c\n", header->local); fflush(log_file);
- fs_resize((void**)header->local, (size_t)(header_count+addresses_count)*sizeof(PINEFIELD));
-fprintf(log_file,"%u d\n", header->local); fflush(log_file);
- header->local += header->local - old_local;
+fprintf(log_file,"%u %u c\n", header->local, header->custom); fflush(log_file);
+ header->local = (PINEFIELD*)fs_get((size_t)(header_count+addresses_count)*sizeof(PINEFIELD));
+ memcpy(header->local, old_local, (size_t)(header_count*sizeof(PINEFIELD)));
header->custom += header->local - old_local;
+fprintf(log_file,"%u %u d\n", header->local, header->custom); fflush(log_file);
for(pf = header->local; pf; pf = pf->next) {
if (pf->next)
pf->next += header->local - old_local;
}
- int sending_order_count=0;
- PINEFIELD** pfp;
- for(pfp = header->sending_order; pfp; pfp += 1)
- sending_order_count++;
- fs_resize((void**)header->sending_order, (size_t)(sending_order_count+addresses_count)*sizeof(PINEFIELD*));
- for(int ii=0; ii<sending_order_count; ii++)
- header->sending_order[ii] += header->local - old_local;
for(int ii=0; ii<addresses_count; ii++) {
- header->sending_order[sending_order_count+ii] = header->local + header_count + ii;
header->local[header_count + ii - 1].next = header->local + header_count + ii;
- memset(header->local + header_count + ii, 0, (size_t)sizeof(PINEFIELD));
- header->local[header_count + ii].name = (char*)fs_get((size_t)11*sizeof(char));
- snprintf(header->local[header_count + ii].name, 10, "X-Hashcash");
- header->local[header_count + ii].name[10]='\0';
-/* header->local[header_count + ii].type = FreeText;
+// memset(header->local + header_count + ii, 0, (size_t)sizeof(PINEFIELD));
+ header->local[header_count + ii].name = cpystr("X-Hashcash");
+ header->local[header_count + ii].next = NULL;
+ header->local[header_count + ii].type = FreeText;
header->local[header_count + ii].canedit = 0;
header->local[header_count + ii].writehdr = 1;
header->local[header_count + ii].localcopy = 0;
+ header->local[header_count + ii].rcptto = 0;
header->local[header_count + ii].posterr = 0;
- header->local[header_count + ii].textbuf = (char*)fs_get((size_t)16*sizeof(char));
- header->local[header_count + ii].text = (char*)fs_get((size_t)2*sizeof(char*));
- header->local[header_count + ii].text[0] = header->local[header_count + ii].textbuf;
- header->local[header_count + ii].text[1] = NULL;
- memcpy(header->local[header_count + ii].textbuf, header->local[header_count + ii].name, 10);
- header->local[header_count + ii].textbuf[11]='\0';
-*/
- }
-// memset(header->sending_order + sending_order_count + addresses_count, 0, (size_t)sizeof(PINEFIELD*));
+ header->local[header_count + ii].standard = 0;
+
+ header->local[header_count + ii].textbuf = cpystr("test-Dummy");
+ header->local[header_count + ii].text = &header->local[header_count + ii].textbuf;
+ header->local[header_count + ii].val = NULL;
+ header->local[header_count + ii].addr = NULL;
+ header->local[header_count + ii].extdata = NULL;
+ header->local[header_count + ii].scratch = NULL;
+// header->local[header_count + ii].textbuf = (char*)fs_get((size_t)16*sizeof(char));
+// header->local[header_count + ii].text = (char*)fs_get((size_t)2*sizeof(char*));
+// header->local[header_count + ii].text[0] = header->local[header_count + ii].textbuf;
+// header->local[header_count + ii].text[1] = NULL;
+// memcpy(header->local[header_count + ii].textbuf, header->local[header_count + ii].name, 10);
+// header->local[header_count + ii].textbuf[11]='\0';
+ }
+// memset(header->local + header_count + addresses_count, 0, (size_t)sizeof(PINEFIELD));
+*/
// fs_resize((void**)&header->local, (size_t)header_count*sizeof(PINEFIELD));
/*
PINEFIELD *hashcashs = &header->local[header_count];
@@ -2184,6 +2204,60 @@ fclose(log_file);
done:
+
+log_file=fopen("/tmp/alpine.log","a");
+
+fprintf(log_file,"freeing\n"); fflush(log_file);
+for (pff = last_header->next; pff; ) {
+ fprintf(log_file,"a\n"); fflush(log_file);
+ fs_give((void**)&pff->name);
+ fprintf(log_file,"b\n"); fflush(log_file);
+ fs_give((void**)&pff->textbuf);
+ fprintf(log_file,"c\n"); fflush(log_file);
+ PINEFIELD *pfff = pff->next;
+ fs_give((void**)&pff);
+ fprintf(log_file,"d\n"); fflush(log_file);
+ pff = pfff;
+ fprintf(log_file,"e\n"); fflush(log_file);
+}
+fprintf(log_file,"f\n"); fflush(log_file);
+last_header->next = NULL;
+fprintf(log_file,"done\n"); fflush(log_file);
+fclose(log_file);
+
+/*
+
+log_file=fopen("/tmp/alpine.log","a");
+
+fprintf(log_file,"freeing\n"); fflush(log_file);
+fprintf(log_file,"%u %u b\n",header_count,addresses_count); fflush(log_file);
+
+ for(int ii=0; ii<addresses_count; ii++) {
+ fprintf(log_file,"%u '%s' %u '%s'\n",header->local[header_count + ii].name,header->local[header_count + ii].name,header->local[header_count + ii].textbuf,header->local[header_count + ii].textbuf); fflush(log_file);
+ fs_give((void**)&header->local[header_count + ii].name);
+ fs_give((void**)&header->local[header_count + ii].textbuf);
+ fprintf(log_file,"ok\n"); fflush(log_file);
+ }
+ memcpy(old_local, header->local, (size_t)(header_count*sizeof(PINEFIELD)));
+
+ for(int ii=0; ii<header_count; ii++) {
+ if (ii<header_count-1)
+ old_local[ii].next = old_local[ii+1].next;
+ else
+ old_local[ii].next = NULL;
+ }
+
+ header->custom -= header->local - old_local;
+ fs_give((void**)header->local);
+ header->local = old_local;
+
+fprintf(log_file,"ende\n"); fflush(log_file);
+fclose(log_file);
+
+
+*/
+
+
#ifdef SMIME
/* Free replacement encrypted body */
if(F_OFF(F_DONT_DO_SMIME, ps_global) && body != origBody){