We are designing a local, non-login service account provisioning process on macOS using the public Open Directory API.
The documentation for ODNodeCreateRecord() states that if setting an initial attribute fails, the record is deleted and an error is returned.
We need to ensure that a failed creation attempt cannot delete or modify a pre-existing record, including during concurrent record creation or replacement.
Questions:
- When attribute initialization fails, is the internal cleanup guaranteed to target only the record instance created by that specific API call, rather than another record with the same name?
- Is this cleanup bound to a unique record identity or UUID, including if another process concurrently creates, removes, or replaces a record with the same name?
- Does the public API provide an atomic create-only guarantee that prevents changes to an existing record?
- If these guarantees are not provided, what supported API or provisioning approach should be used to avoid affecting pre-existing local Directory Services records?
Our current plan uses the local /Local/Default Directory Services node for a dedicated service account, administrative change serialization, pre-creation collision checks, and post-operation identity verification.
We understand that these checks do not themselves prove atomicity or race-free cleanup.
We would appreciate clarification of the supported API guarantees, specifically for macOS 15.
Thank you.
The Open Directory framework doesn’t provide any atomicity guarantees here. Rather, it passes the entire operation off to the underlying OD module. So, any guarantees are going to come from that module.
It seems that you’re primarily concerned with the local node, as run by the PlistFile module. AFAIK that module processes commands atomically, and I expect that lots of folks end up relying on that, but I’m not sure that it’s documented anywhere.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"