Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NetInfo -> Directory Services



On Mar 30, 2005, at 12:07 PM, Ryan McGann wrote:
On Mar 30, 2005, at 5:36 AM, Giuliano Gavazzi wrote:
I'm trying to convert my use of NetInfo APIs to Directory Services APIs, and I'm having problems. I want to access the DHCP information added by Internet Sharing, which is stored in NetINnfo at /config/dhcp/subnets. However, dscl consistently complains that /config/dhcp/subnets is an invalid path. To duplicate:
1. Turn on Internet Sharing in Mac OS X (System Preferences -> Sharing -> Internet)
2. From Terminal, query Directory Services:
dscl localhost -list /NetInfo/config/dhcp/subnets
In the NetInfo Admin Utility you can see that this path exists and has children, so why can't Directory Services see them?

because you should have run the command in interactive mode and found out that you don't need the leading /.


So:

dscl localhost -list NetInfo/Config/dhcp/subnets

Nope, that still doesn't work. Without the leading slash, I still can't see children in NetInfo/config/dhcp. If I use:
dscl localhost -list NetInfo/config/
I can see AppleFileServer, dhcp and ntp listed as children, but if I use
dscl localhost -list NetInfo/config/dhcp
It has no children. Typing
dscl localhost -read NetInfo/config/dhcp
I see several propertis lie dhcp_enabled and detect_other_dhcp_server, but I don't see the subnets child. It still shows up in NetInfo Manager though. Arg!

Directory Services/Open Directory does not support arbitrary nesting in the way that NetInfo does... each node has a flat list of record types and within that is a flat list of records. However, It is possible to do what you want using native record types, but the / delimiter can sometimes be a challenge to pass in to dscl properly due to the shell.


If you are using the DS API, you can use a record type of dsRecTypeNative:config/dhcp/subnets and then just use the appropriate record name for each subnet.

Through dscl you could do something like this:

dscl . -list /dsRecTypeNative:config\\/dhcp\\/subnets

The two backslashes are needed since the shell usually converts those to one backslash before passing to the tool, and slashes that should be part of the record type or the record name need to be escaped.

Hope that helps,
-Jason
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >NetInfo -> Directory Services (From: Ryan McGann <email@hidden>)
 >Re: NetInfo -> Directory Services (From: Giuliano Gavazzi <email@hidden>)
 >Re: NetInfo -> Directory Services (From: Ryan McGann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.