On Jun 24, 4:23=A0pm, Gregory Weston <u...@[EMAIL PROTECTED]
> wrote:
> In article
> <a324b77a-303c-4c44-8f7c-41bb459a0...@[EMAIL PROTECTED]
>,
>
>
>
>
>
> =A0p2 <pradip.pa...@[EMAIL PROTECTED]
> wrote:
> > Hi
>
> > I wrote following code. Also, I have created com.p1.myapp.plist from
> > admin user at /Library/Preferences and has 666 permission.
>
> > SInt kColor =3D 5;
> > const CFStringRef kAppName =3D CFSTR("com.p1.myapp");
> > const CFStringRef kPrefColor =3D CFSTR("color");
> > CFNumberRef value =3D CFNumberCreate(NULL, kCFNumberSInt8Type,
&kColor)=
;
>
> > CFPreferencesSetValue( kPrefColor, value, kAppName,
> > kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
>
> > CFPreferencesAppSynchronize(kAppName); // this will fail ,return
> > false =A0in Non- admin
>
> > above code is working in Tiger Non-Admin but failed in Leopard Non-
> > Admin
>
> > Is there any change ?
> > My target is to change preferences for Any user(/Library/Preferences/)
> > from non-admin account , How can i achieve this ?
>
> > p2
>
> I think you're wrong about it working for a non-admin user in Tiger,
> since:
> a) It's do***ented that you can't save such changes: "Note that you can
> only save preferences for =B3Any User=B2 if you have Admin privileges."
> b) I've been using that routine since (at least) 10.2 and it has behaved
> as do***ented.
>
> So I'd say either it's not saving or your 10.4 user *is* an admin
> despite what you think.
>
> Your options are:
> a) Only save this change when running as an admin user; if the synch
> fails, fall back to user-local storage.
> b) Write someplace else, essentially recreating a ****tion of the
> CFPreferences API.
> c) Use some form of privilege escalation like a single-purpose setuid
> tool running as root to save this setting.
>
> I advocate course (a) unless it's critical that this value be identical
> for all users. (b) and (c) both have shortcomings that are beyond the
> scope of this message - the increased complexity in comparison to (a) is
> probably the least of your worries.
>
> --
> "Harry?" Ron's voice was a mere whisper. "Do you smell something ...
burn=
ing?"
> =A0 =A0- Harry Potter and the Odor of the Phoenix- Hide quoted text -
>
> - Show quoted text -
Hi
I cann't get..it's like to save for individual user.
But I want to save from admin as well as from nonadmin..
Can you please tell me which is the common access path for all users
to save and update preferences ?
please look because it work for 10.4 and not for 10.5
p2


|