I know that NULL is there to indicate end of a string. But why if I do:

send(SMTPSocket,session->reply,strlen(session->reply));  // session->reply
is where I wrote the response code that ends with \r\n\0

it also sends '\0'?

strlen() shouldn't count \0, but Postfix receives '\0'.

However, I've tried to create session->reply without \0, but in many cases,
obviously, it contains garbage at the end (nevertheless, Postfix also
accepts strings with garbage). Take a look at mail.log:

Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: <
myMailServer.localhost[192.168.1.11]:25: 220 myMailServer.localhost SMTP
Service ready
Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: >
myMailServer.localhost[192.168.1.11]:25: HELO manugal-desktop.localdomain
Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: <
myMailServer.localhost[192.168.1.11]:25: 250 myMailServer.localhost SMTP
Service
Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: server features: 0x1000
size 0
Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: >
myMailServer.localhost[192.168.1.11]:25: MAIL
FROM:<manu...@manugal-desktop.localdomain>
Apr 12 13:53:23 manugal-desktop postfix/smtp[2535]: <
myMailServer.localhost[192.168.1.11]:25: nugal-d-??&L?250 MAIL
FROM:<manu...@manugal-desktop.localdomain> OK  //garbage in response


Il 12/04/2010 16:38, Aaron Wolfe ha scritto:

You are either misunderstanding fundamental programming concepts or
just being silly.  NULL is there to indicate end of string, it is not
part of the string itself.  if you concatenate two strings do you
expect a NULL in the middle of the new string?  of course not.  Your
program is broken, do not send NULL after cr/lf.

Good luck,
-Aaron


On Mon, Apr 12, 2010 at 4:40 AM, Emanuele Gallo <manuga...@gmail.com>
<manuga...@gmail.com> wrote:


 I don't think that it's the problem. My mail server is developed in C
language and replies that I send to Postfix are strings. As I think you
know, all strings in C are NULL terminated and there's no chance for create
string that aren't NULL terminated. Moreover, as previously mentioned, my
server works well with Mozilla Thunderbird. If <CR><LF><NULL> were the
guilty, neither the first string ("220 myMailServer.localhost SMTP service
ready") would arrive.

Il 11/04/2010 22:48, Wietse Venema ha scritto:


 Emanuele:



 Ok, I've attached tcp dump. It contains only 8 packets because after the
HELO message, as you can see from logfile previously posted, there's no
more
communication.



 Your server replies end in

       <CR><LF><NULL>

That is not SMTP compliant.

       Wietse

Reply via email to