lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1318413367.24907.15.camel@schurl.linbit>
Date:	Wed, 12 Oct 2011 11:56:05 +0200
From:	Andreas Gruenbacher <andreas.gruenbacher@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	quilt-dev <quilt-dev@...gnu.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Greg Kroah-Hartman <gregkh@...e.de>
Subject: Re: [PATCH v3] quilt mail: Add way to sign mail with GPG

On Tue, 2011-10-11 at 20:58 -0400, Steven Rostedt wrote:
> On Wed, 2011-10-12 at 02:32 +0200, Andreas Gruenbacher wrote:
> > Steve,
> > 
> > On Mon, 2011-10-10 at 12:08 -0400, Steven Rostedt wrote:
> > > +my $tmpfile = "/tmp/gpgmail.$$";
> > > +
> > > +open(TMP, ">", $tmpfile) or die "Can't create a temporary file";
> > 
> > That's not an appropriate way to create a temp file ... do we need a
> > temp file in the first place though?
> 
> OK, what's the "appropriate" way?

One that doesn't introduce a temp file vulnerability, for example using
File::Temp.

But ...

> As for removing the temp file, I just found it was the easiest way to
> pipe into gpg. If there's a better way to do that, I'm all ears.

... how about this approach?

    my @lines = <>;
    map { print } @lines;
    print "\n";

    #-----------------------------------------------

    sub crlf($) {
        my $_ = shift;
        #s/\n$/\r\n/;
        s/^/> /;
        return $_;
    }

    my $command = 'tr a-z A-Z';
    open(PIPE, "| $command")
        or die "$command: $!\n";
    foreach my $line (@lines) {
        print PIPE crlf($line);
    }
    close PIPE
        or die "$command: $!\n";

> > What's going on with "\r\n" line endings all over the script?  Can't the
> > "\n" line endings be converted to "\r\n" in a single place instead?
> > 
> > 	foreach my $line (@lines) {
> > 	    $_ = $line; s/\n$/\r\n/; print;
> > 	}
> 
> gpg email sigs requires that the lines it process end with a \r\n even
> when the lines do not. But I also find that this makes the patch ugly.
> We could try to keep it, but the biggest stumbling block I had in
> getting the signatures to work was the stupid \r\n manipulations :-p

I can see why this is needed, I just don't like to have it spread out
over the entire code and converting @lines forth and back :)

Thanks,
Andreas

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ