Mercurial > hg > mlmmj
changeset 99:6089f38bb228
Send our hostname in HELO and change the mlmmj-send output from
Connected: ok
HELO: ok
MAIL FROM: ok
RCPT TO: ok
DATA: ok 35x
Mail queued: ok
Closed connection
To:
220 panther.mmj.dk ESMTP
250 panther.mmj.dk
250 Ok
250 Ok
354 End data with <CR><LF>.<CR><LF>
250 Ok: queued as A8DA4F2FA4
221 Bye
author | mmj |
---|---|
date | Fri, 21 May 2004 18:46:00 +1000 |
parents | bf2effa44453 |
children | b08023b8393b |
files | src/checkwait_smtpreply.c src/mlmmj-send.c src/strgen.c |
diffstat | 3 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/checkwait_smtpreply.c Fri May 21 18:43:58 2004 +1000 +++ b/src/checkwait_smtpreply.c Fri May 21 18:46:00 2004 +1000 @@ -29,7 +29,7 @@ } while(smtpreply[len-1] != '\n' && timer < LOOP_WAIT); smtpreply[len] = 0; -#if MLMMJ_DEBUG +#if 0 printf("replytype = [%d], smtpreply = [%s]\n", replytype, smtpreply); #endif if(timer > LOOP_WAIT) { @@ -37,47 +37,40 @@ return -1; } + printf("%s", smtpreply); + switch(replytype) { case MLMMJ_CONNECT: if(smtpreply[0] != '2' && smtpreply[1] != '2') return MLMMJ_CONNECT; - printf("Connected: ok\n"); break; case MLMMJ_HELO: if(smtpreply[0] != '2' && smtpreply[1] != '5') return MLMMJ_HELO; - printf("HELO: ok\n"); break; case MLMMJ_FROM: if(smtpreply[0] != '2' && smtpreply[1] != '5') return MLMMJ_FROM; - printf("MAIL FROM: ok\n"); break; case MLMMJ_RCPTTO: if(smtpreply[0] != '2' && smtpreply[1] != '5') return MLMMJ_RCPTTO; - printf("RCPT TO: ok\n"); - break; case MLMMJ_DATA: if(smtpreply[0] != '3' && smtpreply[1] != '5') return MLMMJ_DATA; - printf("DATA: ok 35x\n"); break; case MLMMJ_DOT: if(smtpreply[0] != '2' && smtpreply[1] != '5') return MLMMJ_DOT; - printf("Mail queued: ok\n"); break; case MLMMJ_QUIT: if(smtpreply[0] != '2' && smtpreply[1] != '2') return MLMMJ_QUIT; - printf("Closed connection\n"); break; case MLMMJ_RSET: if(smtpreply[0] != '2' && smtpreply[1] != '5') return MLMMJ_RSET; - printf("RSET: ok"); break; default: break;
--- a/src/mlmmj-send.c Fri May 21 18:43:58 2004 +1000 +++ b/src/mlmmj-send.c Fri May 21 18:46:00 2004 +1000 @@ -161,6 +161,7 @@ int initsmtp(int *sockfd, const char *relayhost) { int retval = 0; + char *myhostname = hostnamestr(); init_sockfd(sockfd, relayhost); @@ -169,7 +170,8 @@ "We continue and hope for the best\n"); /* FIXME: Queue etc. */ } - write_helo(*sockfd, relayhost); + write_helo(*sockfd, myhostname); + free(myhostname); if((checkwait_smtpreply(*sockfd, MLMMJ_HELO)) != 0) { log_error(LOG_ARGS, "Error with HELO\n" "We continue and hope for the best\n");
--- a/src/strgen.c Fri May 21 18:43:58 2004 +1000 +++ b/src/strgen.c Fri May 21 18:46:00 2004 +1000 @@ -10,6 +10,8 @@ #include <stdlib.h> #include <string.h> #include <stdarg.h> +#include <unistd.h> +#include <netdb.h> #include "strgen.h" #include "wrappers.h" @@ -113,3 +115,14 @@ return retstr; } +char *hostnamestr() +{ + struct hostent *hostlookup; + char hostname[1024]; + + gethostname(hostname, sizeof(hostname) - 1); + hostlookup = gethostbyname(hostname); + + return strdup(hostlookup->h_name); +} +