cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Feature request: Fill fields from *multiple* pipes

From: Stefan Klinger <all-lists_at_stefan-klinger.de>
Date: Sat, 12 Jul 2008 12:30:25 +0200

On 11 July 2008, Daniel Stenberg wrote with possible deletions:
> On Fri, 11 Jul 2008, Stefan Klinger wrote:
>
>> But what I want to do is to read the data from stdin, and ask for the
>> passwd via ssh-askpass. As syntax I'd suggest the '=|' characters, in
>> continuation of '=<' and '=@'. Example:
>
>> datasource | curl -F 'data=<-' -F 'pass=|ssh-askpass' ...
>
>> What do you think?
>
> I think it is about time you consider writing a tiny tiny shell script
> that solves this issue for you...

Yes, I am inside a shell script anyway. But putting the password in a variable is dangerous:

  #!/bin/bash
  pass="$(ssh-askpass)";
  datasource | curl -F "pass=${pass}" ...
  
Using this will make the password appear in the process table (*never* use passwords in command line arguments!).

I could write that password to a temporary file:

  #!/bin/bash
  passFile="$(mktemp -t scriptname.XXXXXXXXXX)";
  ssh-askpass > ${passFile};
  datasource | curl -F "pass=<${passFile}" ...
  rm -f ${passFile};

but I don't feel comfortable with having the password stored somewhere. Of course one could use namd pipes instead of a file, but this would also expose information leakage.

IMHO allowing curl to use popen(3) would be the most elegant solutuion. I could probably do this myself, but it might take some time until I can provide a patch. And I've got no experience in writing *portable* code.

Is anyone interested?

Kind regards,
Stefan

-- 
Stefan Klinger                                      o/klettern
                                                    /\/  bis zum
send plaintext only - max size 32kB - no spam         \   Abfallen
http://stefan-klinger.de
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2008-07-12