My company is currently porting one of our client-side applications to Mac OS X (10.5 or higher), but so far I've hit a road block on some of the information our application gathers, which is two-fold:
First, I need a way to query the name of the AD domain bound to the computer. I have found what appears to be the NT 4 compatible domain name under the Setup:/Network/Service/..*/SMB/Workgroup key in SCDynamicStore, but what I really want is the fully qualified domain name (FQDN). So far the Apple documentation has been less than helpful providing any hint, and google isn't helping much, either, since most search results I get refer to DHCP, DNS, or how-to guides on how to do the binding in the UI. I know the domain name set from DHCP *can* match the AD domain, but it's not guaranteed to match, or even be set by the DHCP server. Considering that the UI knows what it is, I would think it would at least be stored in a plist file somewhere. I also know that I can probably use the Directory Services API to ask the domain controller for it, but somehow doing a round trip on the network for something that *should* already be on the local machine seems a bit, to put it bluntly, hacky imo.
The other piece of information I need is about the console user. I can get the user name without a problem, but determining if (a) the user is actually a domain user, and (b) what domain they were authenticated against seems to be proving as elusive as how to get the AD domain for the machine itself.
Unfortunately, since the decided porting strategy is to use the existing code with a shared code base (the application was originally written for Win32), I do not have the option of using Objective-C or Cocoa (the app is written mostly in C with a little C++), but anything Carbon or POSIX is fair game. That said, if there is anything in Cocoa that can point me in the right direction (or at least give me more search terms for google), I welcome hearing about it.