X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:date:message-id:subject:from:to
	:content-type:content-transfer-encoding; q=dns; s=default; b=QGV
	0o3Vnvb2j8pkaRnactyMzcEbzblapAiPKc/niSxSGhzHqQesRSprCPu5PAUyh8Cf
	52f2P3zaQa15of1qmjK3+BZr4V9qPEhuWgNdNWtx1Ricnh0hBPoPOxRUF/6U/gF/
	RQABHrD+dj5bxRn3INpRh53FJ+qzgG3ARWA6KI9g=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:date:message-id:subject:from:to
	:content-type:content-transfer-encoding; s=default; bh=Dr7Kf1rCk
	DLRp0J/851apiXLD9A=; b=fDbidgWqvwZCGRAsh9q0gkkCkF4VGA8CJQZZ8SwVN
	B6jWluhJLHMYPm8I0YgwGslgPWjABptiIEaq2nQj/R2x5KlRkIlcybgFPGJ2mwhg
	a8AMGViiH7Ch0rozu8DqdNjoWmjm8tg/0Gw+GHRU0L792D5S5ki1sRDXKuMtkHcs
	K0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: Yes, score=6.3 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2
X-HELO: mail-wg0-f52.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:date:message-id:subject:from:to         :content-type:content-transfer-encoding;        bh=FT3kP0KYoin0FDcg5BsBIrCDhzSm2hTb20hcIunJXM4=;        b=DEdn08H5dR3HuxzU3Ew6kbmKeLH8uQUIrRwd253HVrPCMlZoUkJcF10hp+2JsBFNCL         zAvhNMwjACE/xeFO6If76rbOxuBSRs1qXayOewLGQTRvwTIqvlqlDKUu9U5GPcvzE0oS         Mr02KiHhU/9P8s1np+lL+M1qNL4OCxF+f8CRm7DZ7iSXG/rqzOdUtOOGQLEhFJ/HepXE         dCkI9+6rezVsHSiAwgYpvCJBco7QLBNBNfyIivfKQuQOiPKWrHnEa6fG8n8YNcdrrY9T         kkSuyXW8EANoANOuckZjQalrynHA9sUENkmSHjqlBLczpftnr8oFfdMPDxX2Nl0yYTSu         SHYw==
X-Gm-Message-State: ALoCoQmC4KSPMjZQqRvkLhV8ZgCenpITQE3qgcdtNf8StM0qFmNhH7c5/beEG94RpAeZS0/WEKdF
MIME-Version: 1.0
X-Received: by 10.194.11.67 with SMTP id o3mr32737193wjb.0.1381802484773; Mon, 14 Oct 2013 19:01:24 -0700 (PDT)
Date: Tue, 15 Oct 2013 04:01:24 +0200
Message-ID: <CAKg6iAEcRK6AgNUKgw2ZEGHkmXL=9vKJ-eca-gu3rW4BUWANRA@mail.gmail.com>
Subject: [patch] OpenSSH ssh-agent -x new option, to define variables in Windows user environment variables
From: =?ISO-8859-1?Q?S=E9bastien_Santoro?= <dereckson@espace-win.org>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r9F2229v017839

Hello,

I prepared a patch to add a new option in ssh-agent:

$ ssh-agent -x
setx SSH_AUTH_SOCK /tmp/ssh-kVGrQ1K2lcMW/agent.3664
setx SSH_AGENT_PID 2704
echo Agent pid 2704;

It works the same way than -c or -s flag, but offers to use setx.

setx writes variables to the master environment in the registry, by
default in HCKU.
This is the same than to go the system properties to define user variables.

It's then available to the whole system for the current user,
including GUI applications.

This is an alterantive to complicated scripts or old tricky solutions like:
http://www.cygwin.com/ml/cygwin/2001-01/msg00063.html

I use it without any script, launching a cmd.exe console and writing
ssh-agent | sh, then closing it (ssh-agent offers a shell detection,
the patch help it to detect cmd.exe too, when the SHELL environment
variable isn't defined).

And that's more natural, more in the usual ssh-agent way.
With one drawback: it's not available in the current shell process,
only for future ones.

Patch URL:
http://dereckson.devio.us/patches/OpenSSH-20130830-CygwinSSHAgentSetx.patch

The setx documentation:
http://technet.microsoft.com/en-us/library/cc755104.aspx

A note about setx availability:  it's included in the base system
since Windows Vista and were before available in the resource kit
since Windows 2000.

I use it for 6 weeks and I'm happy with that.

My plan is:
(1) to gather feedback from Cygwin community
(2) if positive, to submit the patch to the Portable OpenSSH development team

Do you have some feedback?

-- 
Sébastien Santoro aka Dereckson
http://www.dereckson.be/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


