Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-09 Thread Chris Ridd

On 8 Aug 2011, at 16:02, Kyle Sluder wrote:

 On Aug 8, 2011, at 4:54 AM, Chris Ridd chrisr...@mac.com wrote:
 
 
 Does OS X really support the sticky bit? Lion's sys/stat.h suggests no, 
 though this line could be read a couple of ways:
 
 Yep, it's supported and used on directories. Don't think it's supported on 
 files, though.

I was assuming it was supported too, but the comment makes me less certain.

Chris
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Eli Bach

On Aug 7, 2011, at 10:07 PM, Stephen Blinkhorn wrote:

 It's a validation file containing registration details. My product is an 
 AudioUnit plugin so there's no App Store potential but I'd prefer to keep 
 things clean just in case.
 
 I don't care where I write the file much (previously I wrote it to 
 /Library/Preferences) but even the hard drive root path is off limits. 
 Other suggestions include writing data into the keychain but this is just a 
 Lion compatibility fix and I'm not sure how keychain access from within an AU 
 would work out in practice.
 
 I register the whole machine rather than individual users. Any other 
 suggestions as to where to write it?
 Stephen

Some apps, including iTunes, using /Users/Shared/ for DRM.  It may still be 
world-writable in Lion [which I can't confirm as I haven't switched yet...come 
on 10.7.2...].

Eli

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread vincent habchi
 Some apps, including iTunes, using /Users/Shared/ for DRM.  It may still be 
 world-writable in Lion [which I can't confirm as I haven't switched 
 yet...come on 10.7.2...].

I can confirm /Users/Shared is world writable on 10.7; besides, it has the 
sticky (8) bit set, just like /tmp.

Vincent

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Chris Ridd

On 8 Aug 2011, at 08:13, vincent habchi wrote:

 Some apps, including iTunes, using /Users/Shared/ for DRM.  It may still be 
 world-writable in Lion [which I can't confirm as I haven't switched 
 yet...come on 10.7.2...].
 
 I can confirm /Users/Shared is world writable on 10.7; besides, it has the 
 sticky (8) bit set, just like /tmp.

Does OS X really support the sticky bit? Lion's sys/stat.h suggests no, 
though this line could be read a couple of ways:

#define S_ISTXT S_ISVTX /* sticky bit: not supported */

Chris
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Kyle Sluder
On Aug 8, 2011, at 4:54 AM, Chris Ridd chrisr...@mac.com wrote:

 
 Does OS X really support the sticky bit? Lion's sys/stat.h suggests no, 
 though this line could be read a couple of ways:

Yep, it's supported and used on directories. Don't think it's supported on 
files, though.

--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Sean McBride
On Mon, 8 Aug 2011 01:04:07 -0600, Eli Bach said:

 It's a validation file containing registration details. My product is
an AudioUnit plugin so there's no App Store potential but I'd prefer to
keep things clean just in case.

 I don't care where I write the file much (previously I wrote it to /
Library/Preferences) but even the hard drive root path is off limits.
Other suggestions include writing data into the keychain but this is
just a Lion compatibility fix and I'm not sure how keychain access from
within an AU would work out in practice.

 I register the whole machine rather than individual users. Any other
suggestions as to where to write it?
 Stephen

Some apps, including iTunes, using /Users/Shared/ for DRM.  It may still
be world-writable in Lion [which I can't confirm as I haven't switched
yet...come on 10.7.2...].

It's still writable.

I fear that many apps will now start saving all kinds of stuff willy-nilly into 
this folder, instead of with the nice structure in /Library.

Sometimes one wants to save preferences at the machine domain, and 
kCFPreferencesAnyUser lets you do this, though you'll need to use SMJobBless() 
to do so.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Stephen Blinkhorn


On 8 Aug 2011, at 10:36, Sean McBride wrote:


On Mon, 8 Aug 2011 01:04:07 -0600, Eli Bach said:

It's a validation file containing registration details. My product  
is
an AudioUnit plugin so there's no App Store potential but I'd  
prefer to

keep things clean just in case.


I don't care where I write the file much (previously I wrote it to  
/
Library/Preferences) but even the hard drive root path is off  
limits.

Other suggestions include writing data into the keychain but this is
just a Lion compatibility fix and I'm not sure how keychain access  
from

within an AU would work out in practice.


I register the whole machine rather than individual users. Any other

suggestions as to where to write it?

Stephen


Some apps, including iTunes, using /Users/Shared/ for DRM.  It may  
still
be world-writable in Lion [which I can't confirm as I haven't  
switched

yet...come on 10.7.2...].


It's still writable.

I fear that many apps will now start saving all kinds of stuff willy- 
nilly into this folder, instead of with the nice structure in / 
Library.


I'm afraid your fears have just been confirmed, until I find a better  
solution at least. Maybe I can justify this as a kind of protest  
against AudioUnits not being allowed in the App Store :-)


Thanks to everyone who helped!

Stephen



Sometimes one wants to save preferences at the machine domain, and  
kCFPreferencesAnyUser lets you do this, though you'll need to use  
SMJobBless() to do so.


--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/stephen%40audiospillage.com

This email sent to step...@audiospillage.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Kyle Sluder
On Mon, Aug 8, 2011 at 11:13 AM, Stephen Blinkhorn
step...@audiospillage.com wrote:
 I'm afraid your fears have just been confirmed, until I find a better
 solution at least. Maybe I can justify this as a kind of protest against
 AudioUnits not being allowed in the App Store :-)

Well, writing to /Users/Shared isn't going to pass the MAS guidelines anyway.

And writing anywhere that you haven't been granted access to via
NSSavePanel is going to fail under Sandboxing.

So it might be time to start thinking about whether you really need to
be writing in arbitrary locations on the disk.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Andrew Thompson
But doesn't it seem entirely reasonable that apps signed by the same vendor 
(for example) be able to share files? I mean in a safe location perhaps with a 
limited quota of space?

Cookies and client side storage in HTML 5 allow this (not exactly the same but 
still), but native apps have no options?



On Aug 8, 2011, at 2:21 PM, Kyle Sluder kyle.slu...@gmail.com wrote:

 On Mon, Aug 8, 2011 at 11:13 AM, Stephen Blinkhorn
 step...@audiospillage.com wrote:
 I'm afraid your fears have just been confirmed, until I find a better
 solution at least. Maybe I can justify this as a kind of protest against
 AudioUnits not being allowed in the App Store :-)
 
 Well, writing to /Users/Shared isn't going to pass the MAS guidelines anyway.
 
 And writing anywhere that you haven't been granted access to via
 NSSavePanel is going to fail under Sandboxing.
 
 So it might be time to start thinking about whether you really need to
 be writing in arbitrary locations on the disk.
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/lordpixel%40mac.com
 
 This email sent to lordpi...@mac.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Quincey Morris
On Aug 8, 2011, at 11:39 , Stephen Blinkhorn wrote:

 OK, well /Library/Application Support/CompanyName/ is out I believe as you're 
 not supposed to store user data in there.

IIRC, the data you're talking about is registration information, which is *not* 
what (I think) is meant by user data. In fact, Application Support seems like 
exactly the right place to put this information (issues of trying to hide 
registration files from users' casual inspection aside).

That's what's wrong with using /Users/Shared -- that location is for users to 
share their data (i.e. documents) with other users, it's not a developer 
infrastructure location.

But I have to admit I haven't tried to parse the documentation's language on 
these matters in new Lion terms, so the above is definitely FWIW.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Jens Alfke

On Aug 8, 2011, at 11:39 AM, Stephen Blinkhorn wrote:

 OK, well /Library/Application Support/CompanyName/ is out I believe as you're 
 not supposed to store user data in there. Which leaves the keychain as the 
 only option I can think of right now.

Keychains are per-user, apart from the system Keychain that I don’t think apps 
have privileges to modify. If you’re setting per-user data, why not just put it 
in ~/Library/Application Support/?

—Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Stephen Blinkhorn


On 8 Aug 2011, at 12:56, Quincey Morris wrote:


On Aug 8, 2011, at 11:39 , Stephen Blinkhorn wrote:

OK, well /Library/Application Support/CompanyName/ is out I believe  
as you're not supposed to store user data in there.


IIRC, the data you're talking about is registration information,  
which is *not* what (I think) is meant by user data. In fact,  
Application Support seems like exactly the right place to put this  
information (issues of trying to hide registration files from  
users' casual inspection aside).


The desire to hide was indeed a consideration but Application  
Support it is.

Thanks again,
Stephen




That's what's wrong with using /Users/Shared -- that location is for  
users to share their data (i.e. documents) with other users, it's  
not a developer infrastructure location.


But I have to admit I haven't tried to parse the documentation's  
language on these matters in new Lion terms, so the above is  
definitely FWIW.





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Sean McBride
On Mon, 8 Aug 2011 14:42:54 -0600, Stephen Blinkhorn said:

 OK, well /Library/Application Support/CompanyName/ is out I believe
 as you're not supposed to store user data in there.

 IIRC, the data you're talking about is registration information,
 which is *not* what (I think) is meant by user data. In fact,
 Application Support seems like exactly the right place to put this
 information (issues of trying to hide registration files from
 users' casual inspection aside).

The desire to hide was indeed a consideration but Application
Support it is.

To be clear, you'd need to use ~/Library/App Support not the one in /Library.

You can use the latter, but you'll need to do so via SMJobBless() since it 
requires root on 10.7 (and admin on 10.6).  Going this root is currently 
forbidden by the App Store, if you care about that, ummm, thing.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Stephen Blinkhorn


On 8 Aug 2011, at 14:56, Sean McBride wrote:


On Mon, 8 Aug 2011 14:42:54 -0600, Stephen Blinkhorn said:


OK, well /Library/Application Support/CompanyName/ is out I believe
as you're not supposed to store user data in there.


IIRC, the data you're talking about is registration information,
which is *not* what (I think) is meant by user data. In fact,
Application Support seems like exactly the right place to put this
information (issues of trying to hide registration files from
users' casual inspection aside).


The desire to hide was indeed a consideration but Application
Support it is.


To be clear, you'd need to use ~/Library/App Support not the one in / 
Library.


OK, no problem in Cocoa with the stringByExpandingTildeInPath: method  
of NSString. More problematic for CFStringRef though. Is there an  
acknowledged way of doing the equivalent with CFStringRefs? I  
appreciate this is nolonger a Cocoa issue.


Stephen




You can use the latter, but you'll need to do so via SMJobBless()  
since it requires root on 10.7 (and admin on 10.6).  Going this root  
is currently forbidden by the App Store, if you care about that,  
ummm, thing.


--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Sean McBride
On Mon, 8 Aug 2011 16:13:50 -0600, Stephen Blinkhorn said:

 To be clear, you'd need to use ~/Library/App Support not the one in /
 Library.

OK, no problem in Cocoa with the stringByExpandingTildeInPath: method
of NSString. More problematic for CFStringRef though. Is there an
acknowledged way of doing the equivalent with CFStringRefs? I
appreciate this is nolonger a Cocoa issue.

Actually, don't use stringByExpandingTildeInPath:.  Paths are deprecated, you 
should use NSURL or CFURL to reference file system objects.  Instead, do 
something like this:

NSFileManager* fileManager = [[NSFileManager alloc] init];
NSError* error = nil;
NSURL* url = [fileManager URLForDirectory:NSApplicationSupportDirectory

 inDomain:NSUserDomainMask

appropriateForURL:nil

   create:YES

error:error];

Not sure about at the CF level... you could use FSFindFolder() I guess.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Stephen Blinkhorn

On 8 Aug 2011, at 16:42, Sean McBride wrote:


On Mon, 8 Aug 2011 16:13:50 -0600, Stephen Blinkhorn said:

To be clear, you'd need to use ~/Library/App Support not the one  
in /

Library.


OK, no problem in Cocoa with the stringByExpandingTildeInPath: method
of NSString. More problematic for CFStringRef though. Is there an
acknowledged way of doing the equivalent with CFStringRefs? I
appreciate this is nolonger a Cocoa issue.


Actually, don't use stringByExpandingTildeInPath:.  Paths are  
deprecated, you should use NSURL or CFURL to reference file system  
objects.  Instead, do something like this:


NSFileManager* fileManager = [[NSFileManager alloc] init];
NSError* error = nil;
	NSURL* url = [fileManager  
URLForDirectory:NSApplicationSupportDirectory


 inDomain:NSUserDomainMask

appropriateForURL:nil

   create:YES

error:error];

Not sure about at the CF level... you could use FSFindFolder() I  
guess.


[fileManager URLForDirectory:..] is 10.6+ only and since I'm  
supporting 10.4 through 10.7 I'm using FSFindFolder() for now and it's  
all working, even on Lion!


Thanks,
Stephen





--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-07 Thread Kyle Sluder
On Sun, Aug 7, 2011 at 8:48 PM, Stephen Blinkhorn
step...@audiospillage.com wrote:
 Hello,

 Under Tiger, Leopard, and Snow Leopard I use
 CFURLWriteDataAndPropertiesToResource to store some data into a file. On
 Lion the default permissions appear to have been upgraded almost everywhere
 and consequently the code below isn't succeeding. Is it possible to run the
 below code as root from Cocoa?

Of course root can write anywhere.

But if you try to authorize as root, you will not be able to sell your
product in the Mac App Store.

What protected location are you trying to write to? Perhaps you should
write elsewhere.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-07 Thread Stephen Blinkhorn
It's a validation file containing registration details. My product is  
an AudioUnit plugin so there's no App Store potential but I'd prefer  
to keep things clean just in case.


I don't care where I write the file much (previously I wrote it to / 
Library/Preferences) but even the hard drive root path is off limits.  
Other suggestions include writing data into the keychain but this is  
just a Lion compatibility fix and I'm not sure how keychain access  
from within an AU would work out in practice.


I register the whole machine rather than individual users. Any other  
suggestions as to where to write it?

Stephen


On 7 Aug 2011, at 21:54, Kyle Sluder wrote:


On Sun, Aug 7, 2011 at 8:48 PM, Stephen Blinkhorn
step...@audiospillage.com wrote:

Hello,

Under Tiger, Leopard, and Snow Leopard I use
CFURLWriteDataAndPropertiesToResource to store some data into a  
file. On
Lion the default permissions appear to have been upgraded almost  
everywhere
and consequently the code below isn't succeeding. Is it possible to  
run the

below code as root from Cocoa?


Of course root can write anywhere.

But if you try to authorize as root, you will not be able to sell your
product in the Mac App Store.

What protected location are you trying to write to? Perhaps you should
write elsewhere.

--Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com