[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Partly fixed: Re: Still no e-mail reports
From: |
Tim Nelson |
Subject: |
Re: Partly fixed: Re: Still no e-mail reports |
Date: |
Fri, 6 Feb 2004 10:52:23 +1100 (EST) |
On Thu, 5 Feb 2004, Tim Nelson wrote:
> On Thu, 5 Feb 2004, Tim Nelson wrote:
>
> > Hi all. I'm still getting no e-mail reports. Anyway, at least
> > one of the problems I'm running in to is that when I run with Verbose on,
> > it's saying that the fully qualified name is
> > test.example.local.example.local when it should be saying
> > test.example.local
> >
> > Any ideas people? Thanks in advance!
>
> Well, I've gotten it to do test.example.local. I changed the
> test.example.local in the /etc/hosts file to have a dot on the end, and
> then rebooted. I'll have to put that in my cfengine config :). It still
> doesn't send, but it's more sensible now :).
I've found another problem with the cfengine e-mailing process.
Basically, it doesn't allow for multiline SMTP responses. Here's what my
mail server does:
------------------------------
$ telnet msa.sunet.com.au 25
Trying 203.166.102.37...
Connected to msa.sunet.com.au.
Escape character is '^]'.
220 msa.sunet.com.au ESMTP
helo test.example.local.
250-jupiter.sunet.com.au Ok.
250-AUTH LOGIN CRAM-MD5
250-AUTH=LOGIN CRAM-MD5 X-NETSCAPE-HAS-BUGS
250-XVERP=Courier
250-XEXDATA
250-XSECURITY=NONE,STARTTLS
250-PIPELINING
250-8BITMIME
250-SIZE
250 DSN
------------------------------
As you can see, it's a multi-line response, as specified in RFC
821 Appendix E. I quote:
------------------------------
The format for multiline replies requires that every line,
except the last, begin with the reply code, followed
immediately by a hyphen, "-" (also known as minus), followed by
text. The last line will begin with the reply code, followed
immediately by <SP>, optionally some text, and <CRLF>.
For example:
123-First line
123-Second line
123-234 text beginning with numbers
123 The last line
------------------------------
Below is my suggestion for modifying the Dialogue function, which
would probably fix this. However, this is the first C I have written in 6
years or so, so it will need to be seriously double-checked.
------------------------------
int Dialogue(sd,s)
int sd;
char *s;
{ int sent,charcount = 0;
char ch,linetype,f = '\0';
if ((s != NULL) && (*s != '\0'))
{
sent=send(sd,s,strlen(s),0);
Debug("SENT(%d)->%s",sent,s);
}
else
{
Debug("Nothing to send .. waiting for opening\n");
}
while (recv(sd,&ch,1,0))
{
if (f == '\0')
{
f = ch;
}
if (charcount == 4)
{
linetype = ch;
}
Debug("%c",ch);
if (ch == '\n' || ch == '\0')
{
charcount = 0;
if (linetype == ' ')
{
break;
}
}
charcount++;
}
return ((f == '2') || (f == '3')); /* return code 200 or 300 from smtp*/
}
------------------------------
--
Tim Nelson
Systems Administrator
Sunet Internet
Tel: +61 3 5241 1155
Fax: +61 3 5241 6187
Web: http://www.sunet.com.au/
Email: sysadmin@sunet.com.au