[prev in list] [next in list] [prev in thread] [next in thread]
List: launchd-dev
Subject: Re: [launchd-dev] Creating a Launch Agent (per user) on demand when client app is open
From: Per Olofsson <per.olofsson () gu ! se>
Date: 2015-01-19 14:19:05
Message-ID: 3DF8D29B-8D06-4E8F-893C-A0789606DB26 () gu ! se
[Download RAW message or body]
16 jan 2015 kl. 13:21 skrev Piotr Panasewicz <piotr.panasewicz@mac.com>:
>
> Seems I will encounter the same issues I am having now with listening on localhost \
> or socket port option.
> In my current implementation the agent sometimes starts as the second logged in \
> user via fast user switching (so both sessions are GUI sessions and active at the \
> time). So if I have an agent (with plist inside /Library/LaunchAgents, so it will \
> work for each user logged in) monitoring localhost or the specific socket port, for \
> which user the agent will run? Because both sessions are active and have GUI. How \
> will I communicate with the one I want if the IPC between my app and the agent is \
> base on one socket port 9977? If I run my app as User A I want the service to run \
> only for the User A, not User B, or both.
A unix domain socket listener can identify the UID of the connecting peer by using \
getpeereid() or LOCAL_PEERCRED. You can use this with a privileged listener which \
forks and executes tasks on behalf of the connecting peer, but I would not recommend \
going down that route unless you're comfortable writing privileged code. \
NSXPCConnection is a lot less work and secure by default.
--
Per Olofsson, IT-service, University of Gothenburg
_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/launchd-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic