Hi,

as I do not have direct access to some of our PKI machines, I tried
to add a simple "Log file download" option that helps me identify
problems that arise in production. It's a quick hack, but it
would save me some time in the future.

I basically copied the behaviour from lib/cmds/send_cert*, where
simply the MIME type is printed and the binary data is sent afterwards.
The idea is to generate a tar.gz on-the-fly and send it to the
browser as application/octet-stream or similar.

Unfortunately for some reason this does not work, when I call this
function via the browser, all I get is a browser window filled with
binary garbage with the first line containing the MIME type.

I suspect there is something "in front" of the script that sends
another MIME header and that leads to this corruption, but I am unable
to find the difference between, say, lib/cmds/send_cert_key_pkcs12
and my script.
Any ideas why it does not work?

My  command lib/cmds/sendlogs looks like this (behaviour is identical
with both Content-Type lines):

---
use strict;

sub cmdSendLogs {
        #print "Content-Disposition: attachment;
filename=\"openca-logs.tar.gz\"\nContent-type:application/octet-stream\n\n";
        print "Content-Type: application/binary\n\n";

        local *HANDLE;
        open HANDLE, "tar czf - /usr/local/openca-0.9.2/var/crypto
/usr/local/openca-0.9.2/var/log/stderr.log 2>/dev/null|";
        print do { local $/; <HANDLE> };
        close HANDLE;
        return 1;
}

1;
---

Thanks,

Martin



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
OpenCA-Devel mailing list
OpenCA-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openca-devel

Reply via email to