FSCopyObjectSync and changing EUID
FSCopyObjectSync and changing EUID
- Subject: FSCopyObjectSync and changing EUID
- From: James Bucanek <email@hidden>
- Date: Sat, 19 Jul 2008 16:51:22 -0700
Greetings,
I'm having a problem with FSCopyObjectSync(). My process is a
setuid helper that *sometimes* needs to run as root and runs as
the regular user the rest of the time. There are a lot of
threads doing various things, and one of those threads is using
FSCopyObjectSync() to duplicate files.
My problem seems to be that if the EUID changes while the
FSCopyObjectSync is in progress (specifically changes from EUID
0 to EUID 501), it returns error -5000 (afpAccessDenied). It
appears that FSCopyObjectSync creates the file as the current
user (root) then can't finish the operation when the EUID
changes back to 501.
I need to use FSCopyObjectSync so please don't blithely suggest
other copy methods. Specifically, FSCopyObjectSync tells AFP
file servers to perform a local copy of the file if the server
supports that. This is critical to the performance of my
application, which is typically writing to networked volumes.
I thought I could easily solve this problem using
pthread_setugid_np(), but I've had no success. When the thread
starts, I've tried setting
pthread_setugid_np(KAUTH_UID_NONE,KAUTH_GID_NONE) and
pthread_setugid_np(501,501). Both return an error -1 and there's
no change in the thread's EUID.
Any suggestions?
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden