md_syslog (was Re: [Mimedefang] Woes following an OS upgrade)

Philip Prindeville philipp_subx at redfish-solutions.com
Tue Nov 7 15:05:16 EST 2006


David F. Skoll wrote:

>Philip Prindeville wrote:
>
>  
>
>>Oh...  and in digging around, I saw:
>>sub md_syslog ($$) {
>>    my($facility, $msg) = @_;
>>    
>>
>
>[...]
>
>  
>
>>Hmm...  Klunky.  What about:
>>    
>>
>
>  
>
>>sub md_syslog ($$;@) {
>>    my($facility, $fmt, @args) = @_;
>>    
>>
>
>Except that now all callers of md_syslog have to change.  That's no good.
>Every single caller of md_syslog would have to ensure that its first argument
>didn't contain any printf-sequences, and most calls would devolve to:
>
>	md_syslog($facility, "%s", $msg);
>
>which is why I did it the first way originally.
>
>Regards,
>
>David.
>  
>

Hmm.  syslog() already has printf-style formatting... should the wrapper
occlude that functionality?

And what about callers that have to call sprintf directly if they want to
handle multiple arguments?

How likely is it that there are callers that pass "%" in the message
string?

I just did a quick inspection, and only places like:

            md_syslog("$GraphDefangSyslogFacility|info","MDLOG,$id," .
                      "$event,$value1,$value2,$lcsender," .
                      "$lcrecipient,$subj");

or:

        md_syslog('debug', $msg);

or:

    md_syslog('err', "$MsgID: $errmsg");

or:

            md_syslog('warning', "Message contains more than one Subject: header: $Subject --> $arg");

seem to be issues, and they are easily enough rewritten.

-Philip






More information about the MIMEDefang mailing list