<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: System Preferences Pane Lock</title>
	<atom:link href="http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/</link>
	<description>fill the void</description>
	<lastBuildDate>Mon, 30 Jan 2012 09:42:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Francis</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-25736</link>
		<dc:creator>Francis</dc:creator>
		<pubDate>Mon, 26 Dec 2011 18:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-25736</guid>
		<description>Hi bdungagn, this was really helpful to me! One thing I found - I was seeing odd behaviour where sometimes AuthorizationExecuteWithPrivileges was working, but other times it wasn&#039;t. I traced the problem to the &#039;[string UTF8String]&#039; part of the code. I guess this was sometimes getting garbage-collected before AEWP had a chance to run.

I fixed the problem by changing this to strdup([string UTF8tring]). Then, after the call to AEWP, I cycled back through the args again and freed each one like so:

// BEFORE
const char **argv = (const char **)malloc(sizeof(char *) * [args count] + 1);
for (NSString *string in args) {
    argv[argvIndex] = strdup([string UTF8String]);
    argvIndex++;
}
argv[argvIndex] = nil;

// Insert call to AEWP here

// AFTER
for (int i = 0; i &lt; argvIndex; i++) {
    free(argv[i]);
}
free(argv);

Hope this helps someone!</description>
		<content:encoded><![CDATA[<p>Hi bdungagn, this was really helpful to me! One thing I found &#8211; I was seeing odd behaviour where sometimes AuthorizationExecuteWithPrivileges was working, but other times it wasn&#8217;t. I traced the problem to the &#8216;[string UTF8String]&#8216; part of the code. I guess this was sometimes getting garbage-collected before AEWP had a chance to run.</p>
<p>I fixed the problem by changing this to strdup([string UTF8tring]). Then, after the call to AEWP, I cycled back through the args again and freed each one like so:</p>
<p>// BEFORE<br />
const char **argv = (const char **)malloc(sizeof(char *) * [args count] + 1);<br />
for (NSString *string in args) {<br />
    argv[argvIndex] = strdup([string UTF8String]);<br />
    argvIndex++;<br />
}<br />
argv[argvIndex] = nil;</p>
<p>// Insert call to AEWP here</p>
<p>// AFTER<br />
for (int i = 0; i < argvIndex; i++) {<br />
    free(argv[i]);<br />
}<br />
free(argv);</p>
<p>Hope this helps someone!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-15859</link>
		<dc:creator>Sue</dc:creator>
		<pubDate>Thu, 27 Oct 2011 00:17:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-15859</guid>
		<description>@bdunagan, please update it if you can figure out how to use SMJobBless() that can perform the same function as what this example does. That will be tremendously helpful. 
Thanks!</description>
		<content:encoded><![CDATA[<p>@bdunagan, please update it if you can figure out how to use SMJobBless() that can perform the same function as what this example does. That will be tremendously helpful.<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdunagan</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-15854</link>
		<dc:creator>bdunagan</dc:creator>
		<pubDate>Wed, 26 Oct 2011 22:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-15854</guid>
		<description>@Sue Yeah, I saw that too. Searching around, I found a Stackoverflow answer by Graham Lee, who knows what he&#039;s talking about: http://stackoverflow.com/questions/6841937/authorizationexecutewithprivileges-is-deprecated/6842129#6842129. I&#039;ll look into using &lt;tt&gt;SMJobBless()&lt;/tt&gt; in &lt;tt&gt; ServiceManagement.framework&lt;/tt&gt; when I get a chance.</description>
		<content:encoded><![CDATA[<p>@Sue Yeah, I saw that too. Searching around, I found a Stackoverflow answer by Graham Lee, who knows what he&#8217;s talking about: <a href="http://stackoverflow.com/questions/6841937/authorizationexecutewithprivileges-is-deprecated/6842129#6842129" rel="nofollow">http://stackoverflow.com/questions/6841937/authorizationexecutewithprivileges-is-deprecated/6842129#6842129</a>. I&#8217;ll look into using <tt>SMJobBless()</tt> in <tt> ServiceManagement.framework</tt> when I get a chance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-15850</link>
		<dc:creator>Sue</dc:creator>
		<pubDate>Wed, 26 Oct 2011 19:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-15850</guid>
		<description>AuthorizationExecuteWithPrivileges is deprecated from Mac OS X 10.7. Is there a way that I can run this example without AuthorizationExecuteWithPrivileges?</description>
		<content:encoded><![CDATA[<p>AuthorizationExecuteWithPrivileges is deprecated from Mac OS X 10.7. Is there a way that I can run this example without AuthorizationExecuteWithPrivileges?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdunagan</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-10111</link>
		<dc:creator>bdunagan</dc:creator>
		<pubDate>Sun, 03 Apr 2011 15:55:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-10111</guid>
		<description>@Adam Glad it helped!</description>
		<content:encoded><![CDATA[<p>@Adam Glad it helped!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-9400</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 09 Mar 2011 03:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-9400</guid>
		<description>Just what I was looking for. Thank you.</description>
		<content:encoded><![CDATA[<p>Just what I was looking for. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tristan Seifert</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-4482</link>
		<dc:creator>Tristan Seifert</dc:creator>
		<pubDate>Wed, 17 Mar 2010 01:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-4482</guid>
		<description>And I plan in using it on my new App, Post Office, that when you authorize yourself on the goodies panel, the buttons &quot;Install for all Users&quot; will enable.</description>
		<content:encoded><![CDATA[<p>And I plan in using it on my new App, Post Office, that when you authorize yourself on the goodies panel, the buttons &#8220;Install for all Users&#8221; will enable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdunagan</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-4156</link>
		<dc:creator>bdunagan</dc:creator>
		<pubDate>Wed, 24 Feb 2010 04:18:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-4156</guid>
		<description>Absolutely true. I&#039;ve seen it integrated into several apps.</description>
		<content:encoded><![CDATA[<p>Absolutely true. I&#8217;ve seen it integrated into several apps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tristan Seifert</title>
		<link>http://www.bdunagan.com/2009/12/13/system-preferences-pane-lock/comment-page-1/#comment-4146</link>
		<dc:creator>Tristan Seifert</dc:creator>
		<pubDate>Tue, 23 Feb 2010 15:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdunagan.com/?p=500#comment-4146</guid>
		<description>This also works outside of Pereference Panes, like in a normal App if you add the frameworks!</description>
		<content:encoded><![CDATA[<p>This also works outside of Pereference Panes, like in a normal App if you add the frameworks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

