Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Dev
ocf_run: sanitize output before logging?
 

Index | Next | Previous | View Flat


florian at hastexo

Nov 14, 2011, 12:53 PM


Views: 268
Permalink
ocf_run: sanitize output before logging?

Dejan, Lars, and other shell gurus in attendance,

maybe I'm totally off my rocker, and one of you guys can set me
straight. But to me this part of the ocf_run function seems a bit fishy:

output=`"$@" 2>&1`
rc=$?
output=`echo $output`

Am I gravely mistaken, or would any funny control characters produced by
the wrapped command line totally mess up the content of "output" here as
it is mangled by the backticks?

What I'm noticing is the invocation of "ocf_run sipsak -v -s <uri>",
which we put into the asterisk RA as per Russell Bryant's suggestion,
seems to totally garble the output.

Compare this:

$ sipsak -v -s sip:somenotexistantextension [at] ekiga 2>&1
SIP/2.0 200 OK
Via: SIP/2.0/UDP
127.0.0.1:43665;branch=z9hG4bK.539207ad;rport=53485;alias;received=85.127.155.32
From: sip:sipsak [at] 127:43665;tag=6dafacb9
To:
sip:somenotexistantextension [at] ekiga;tag=c64e1f832a41ec1c1f4e5673ac5b80f6.3109
Call-ID: 1840229561 [at] 127
CSeq: 1 OPTIONS
Server: Kamailio (1.5.3-notls (i386/linux))
Content-Length: 0

To this:

$ output=`sipsak -v -s sip:somenotexistantextension [at] ekiga 2>&1`
$ echo $output
Content-Length: 0(1.5.3-notls
(i386/linux))tag=c64e1f832a41ec1c1f4e5673ac5b80f6.8ff585.127.155.32

In this case it appears to be due to carriage-return (0x0d, ^M)
characters that sipsak injects into its output, which is annoying but
relatively benign. But maybe we want to sanitize the ocf_run output
before we hand it off to be written to the logs?

Cheers,
Florian
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Subject User Time
ocf_run: sanitize output before logging? florian at hastexo Nov 14, 2011, 12:53 PM
    Re: ocf_run: sanitize output before logging? dejan at suse Nov 15, 2011, 7:21 AM
        Re: ocf_run: sanitize output before logging? florian at hastexo Nov 15, 2011, 8:50 AM
    Re: ocf_run: sanitize output before logging? lars.ellenberg at linbit Nov 16, 2011, 12:00 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.