rationale of calling setsid() in gpg-agent?

Matthias Welwarsky matze@stud.fbi.fh-darmstadt.de
Sat May 18 19:17:02 2002


--------------Boundary-00=_YLK9K4ZKYVY1WRRKLYJH
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

Hi all,

I'm wondering why the startup code in gpg-agent.c calls setsid() to enter a 
new session. How is the gpg-agent supposed to be started? I thought was like 
with the ssh-agent that's started once for each user session. As such, it 
should be of course the member of the users session, and not the leader of a 
new session.

I usually start the gpg-agent from my Xsession script with eval 'gpg-agent', 
however as it's calling setsid() it's not being killed when I end the session 
by logging out. So I have effectively a couple of gpg-agents running if I log 
in and out repeatedly.

I think the gpg-agent should not call setsid() at all, and have a patch 
attached against current Cvs that removes the call to setsid. Please apply.

regards,
	matze

--------------Boundary-00=_YLK9K4ZKYVY1WRRKLYJH
Content-Type: text/x-diff;
  charset="us-ascii";
  name="gpg-agent.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gpg-agent.c.patch"

? Makefile.in
? Makefile
? .deps
? gpg-agent
? protect-tool
? gpg-agent.c.patch
Index: gpg-agent.c
===================================================================
RCS file: /cvs/aegypten/newpg/agent/gpg-agent.c,v
retrieving revision 1.14
diff -u -3 -p -r1.14 gpg-agent.c
--- gpg-agent.c	27 Apr 2002 13:49:40 -0000	1.14
+++ gpg-agent.c	17 May 2002 16:31:31 -0000
@@ -584,12 +584,6 @@ main (int argc, char **argv )
               if ( log_get_fd () != i)
                 close (i);
             }
-          if (setsid() == -1)
-            {
-              log_error ("setsid() failed: %s\n", strerror(errno) );
-              cleanup ();
-              exit (1);
-            }
         }
 
       /* setup signals */

--------------Boundary-00=_YLK9K4ZKYVY1WRRKLYJH--