Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Permissions woes



Hi again Robert,

>>...
>>> 
>>> for i := 0 to 2 do  with catalogInfo do
>>> permissions[i] := kFullPrivileges;
>>> 
>>> err := FSSetCatalogInfo ( myFileFSRef, kFSCatInfoPermissions,
>>> catalogInfo );
>>> (err always comes back as noErr -- I'll add checking later.)
>>> This code produces this interesting result:
>>> owner:     no access
>>> group:     no access
>>> everyone:  read/write
>>> Entertaining, but not quite what I want!  I've tried some
>>> different combinations of what I do with the permissions
>>> array, but I either get the original permissions or the
>>> second ones.  Never what I want.  Any ideas?
>> 
>> You are using the wrong constant, and that loop isn't necessary. You
>> will get your desired result by setting the low 9 bits of
>> permissions[2] to octal 666 (by whatever Pascal trickery :-)
>
>$1B6      :-)

Yes, as expected, this worked fine.

> 
> Alternatively, call this once at startup of your app
> umask( 0 );

This seems to be a C library thing that isn't available in Pascal.
But the first solution worked anyway.


But the problem I'm now having, is that I also need to set the DIRECTORY
permission for the directory containing the file, and also its parent.

I've tried doing similar calls, making an FSRef for the directories:


    err1 := FSpMakeFSRef ( parentSpec, parentFSRef );
    err1 := FSGetCatalogInfo ( parentFSRef, kFSCatInfoPermissions,
                                @catalogInfo, nil, nil, nil );

    catalogInfo.permissions[2] := $1B6;            { octal 666 }

    err1 := FSSetCatalogInfo ( parentFSRef, kFSCatInfoPermissions,
                                catalogInfo );


But what I'm getting for the directories, is "no access" for
everybody!  Obviously I'm using the wrong constants or something.

Also, where is the right place to look this sort of thing up?
I've searched the File Manager manual but it just gives the bare
bones description of the various API calls with minimal
explanation.


Cheers,  Mike.


----------------------------------------------------------------
            Mike Hore      email@hidden
----------------------------------------------------------------


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Permissions woes (From: Robert Purves <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.