Re: Permissions in an app bundle
Re: Permissions in an app bundle
- Subject: Re: Permissions in an app bundle
- From: Uli Kusterer <email@hidden>
- Date: Thu, 6 Jul 2006 12:40:31 +0200
Am 05.07.2006 um 11:42 schrieb Nir Soffer:
I wonder if this solution is good enough, or I should instead
change the permissions after copying the template, which require
little more code. For example, enumerate the new document
directory and change the permission for all files using absolute
modes (e.g. 0755). It seems really too much work compared to single
chmod o+w call.
The write permission stuff is a potential security risk and will
make it impossible to correctly use your app when it's on a network
server (the permissions won't be right for multiple users). Not a
good idea. And forget about the "too much work" argument. By that,
you could also say that having a front door put in your house is too
much work. Security requires some effort. Better do this work now,
because trying to secure your code afterwards is always a lot harder.
Another solution I considered is packing the template in an
archive, and unpacking the archive instead of the copying. Is there
an easier way to unpack an archive than using tar in a sub process?
You could use zlib (linker option -llibz) to zip your directory and
unpack it again.
Or, since this is Cocoa, have you thought about just opening your
template document, then severing the connection to the file (I think
you just set a couple of file- and path-related instance variables to
NIL -- been a while since I did that). Since in most cases NSDocument
loads the entire document into RAM, severing the connection means it
contains all relevant data and must now be saved to disk in a new
location and you get the "Save where...?" panel.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden