Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password

Mac > Mac Programmer Help > Re: CFPreferenc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 3782 of 3849
Post > Topic >>

Re: CFPreferencesAppSynchronize failed

by p2 <pradip.patel@[EMAIL PROTECTED] > Jun 25, 2008 at 11:06 PM

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 -

also one more question ,
Can I change the /Library/Preferences permission ? is it feasible ?
how?

p2
 



 7 Posts in Topic:
CFPreferencesAppSynchronize failed
p2 <pradip.patel@[EMAI  2008-06-24 03:13:06 
Re: CFPreferencesAppSynchronize failed
Gregory Weston <uce@[E  2008-06-24 07:23:10 
Re: CFPreferencesAppSynchronize failed
p2 <pradip.patel@[EMAI  2008-06-24 04:54:32 
Re: CFPreferencesAppSynchronize failed
p2 <pradip.patel@[EMAI  2008-06-25 22:46:12 
Re: CFPreferencesAppSynchronize failed
Gregory Weston <uce@[E  2008-06-26 09:33:21 
Re: CFPreferencesAppSynchronize failed
p2 <pradip.patel@[EMAI  2008-06-25 23:06:02 
Re: CFPreferencesAppSynchronize failed
Gregory Weston <uce@[E  2008-06-26 09:19:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 18:58:05 CDT 2008.