From 061df4c051ea15f650f7071fedfa341da926b9b9 Mon Sep 17 00:00:00 2001 From: pfelt Date: Mon, 21 Jan 2008 22:20:10 +0000 Subject: [PATCH] -- this should fix sending mail remotely which was broken. hopefully soon we can re-work this section of code --- src/agents/queue/queue.c | 19 +++++++++++++++---- src/agents/queue/queued.c | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/agents/queue/queue.c b/src/agents/queue/queue.c index 498a485..5262d8d 100644 --- a/src/agents/queue/queue.c +++ b/src/agents/queue/queue.c @@ -907,6 +907,7 @@ StartOver: /* alias this user */ unsigned char buffer[1024]; /* FIXME: is this too big? */ unsigned char *addrptr; + unsigned char *flags = strchr(ptr2+1,' '); /* the original flags */ int cnt; aliasing(cur+1, &cnt, buffer); @@ -916,14 +917,24 @@ StartOver: addrptr++; switch(atoi(buffer)) { case 1000: - /* this is a local user, change the envelope to reflect that */ - fprintf(newFH, QUEUES_RECIP_LOCAL"%s %s\r\n", addrptr, cur+1); + /* this is a local user, change the envelope to reflect that + * in this case ptr2+1 is the orecip which will also include the flags */ + fprintf(newFH, QUEUES_RECIP_LOCAL"%s %s\r\n", addrptr, ptr2+1); break; case 1002: - fprintf(newFH, QUEUES_RECIP_REMOTE"%s %s\r\n", addrptr, cur+1); + /* in this case ptr2+1 is the orecip which will also contain the flags */ + fprintf(newFH, QUEUES_RECIP_REMOTE"%s %s\r\n", addrptr, ptr2+1); break; default: - fprintf(newFH, "%c%s %s %d\r\n", *cur, addrptr, cur+1, DSN_FAILURE); + /* in this case we need to chop the flags off so that we can replace them + * with DSN_FAILURE */ + if (flags) { + *flags = '\0'; + } + fprintf(newFH, "%c%s %s %d\r\n", *cur, addrptr, ptr2+1, DSN_FAILURE); + if (flags) { + *flags = ' '; + } break; } if (ptr) { diff --git a/src/agents/queue/queued.c b/src/agents/queue/queued.c index dacbc4c..f1c04df 100644 --- a/src/agents/queue/queued.c +++ b/src/agents/queue/queued.c @@ -679,7 +679,7 @@ XplServiceMain(int argc, char *argv[]) /* Initialize the Bongo libraries */ startupOpts = BA_STARTUP_CONNIO | BA_STARTUP_NMAP | BA_STARTUP_MSGLIB | BA_STARTUP_MSGAUTH; - ccode = BongoAgentInit(&Agent.agent, AGENT_NAME, MSGSRV_AGENT_QUEUE, DEFAULT_CONNECTION_TIMEOUT, startupOpts); + ccode = BongoAgentInit(&Agent.agent, AGENT_NAME, DEFAULT_CONNECTION_TIMEOUT, startupOpts); if (ccode == -1) { Log(LOG_ERROR, "Initialization failed exiting."); return -1;