On Wednesday 28 September 2005 23:09, Jason Kim wrote: > Ok, I'm going to ramble a bit here, but I've been staring down cfengine > code all day, so please forgive me. I've just gone insane trying to figure > this out, if anyone actually has the patience to read the whole thing and > grok it, please let me know if I'm anywhere near on track (and if you can > help me get my sanity back). > ====== > <snip...>
I know it's bad form to reply to myself, but after much sleep and coffee I feel that I can tackle this in a bit more coherent (and concise) manner... * There appear to be some email addressing issues with cfexecd's mailing function. There was one I sent yesterday about a sscanf function which is supposed to grab the domain from a 'MailTo' variable, and one I found today where an 'if' statement has the same exact 'then' and 'else' clauses. I've attached a patch that I believe corrects the issues. * The email function can (under some circumstances) use differing 'from' addresses, one during the smtp 'MAIL FROM:' section and another in the actual message body. Is this intentional? It doesn't seem so, in which case the patch I've provided does nothing more than fix a fundamentally broken method. In that case I will gladly try to neaten it up some if no one else wants to. * The main part of my previous email was devoted to the matter of extraneous runlog files caused by inconsistent handling of qualified/unqualified hostnames by cfexecd and cfagent (I'm going to ignore cfenvd, it's just not worth it). It appears that cfagent has the most robust method of getting it right, provided that there is a 'domain' variable defined. I propose patching cfexecd to instead query cfagent for the correct names, as its current method of calling GetNameInfo() doesn't work consistently in all cases. This could be as simple as adding 'host' and 'domain' to the list of values that GetCfStuff() grabs from cfagent and doing away with GetNameInfo() altogether. But if the side effects of GetNameInfo() (setting various name based classes) are needed (and I didn't see any sign that they were), I suppose a simple correction to VFQNAME, VUQNAME, and VDOMAIN after every GetNameInfo() would work too. There, I hope that was better... -JayKim
--- cfexecd.c.orig 2005-09-28 16:52:37.000000000 -0400 +++ cfexecd.c 2005-09-29 20:54:48.796583321 -0400 @@ -987,7 +987,7 @@ else { domain[0] = '\0'; - sscanf(to,"[EMAIL PROTECTED]@%.64s",domain); + sscanf(to,"[EMAIL PROTECTED]@%64s",domain); if (strlen(domain) > 0) { @@ -1047,7 +1047,7 @@ } else { - sprintf(VBUFF,"From: [EMAIL PROTECTED]",VFQNAME); + sprintf(VBUFF,"From: %s\r\n",MAILFROM); Debug("%s",VBUFF); }
_______________________________________________ Bug-cfengine mailing list Bug-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/bug-cfengine