Hi,
my computer is bound to windows LDAP server. the connection is configured to use mobile account so I'd be able to login while the LDAP is unreachable.
I'd like to extract domain name for my user. which is represented by the field dsAttrTypeNative:DomainName as can be shown in the following code :
when LDAP connectivity is online, I can see that this field appears in subnodeDetails and it's equal to the concatenation of 2 string separated by dot (i.e MY-CORP.mycompanyname-dev.com). but when it's offline, this field doesn't appear even though I see that the LDAP user appears by running the following command id username.
is there any way to extract domain name when LDAP is unconnected ?
I could do something really patchy like running odrecord and append the DC fields from dsAttrTypeStandard:AppleMetaRecordName which include the following data :
'dsAttrTypeStandard:AppleMetaRecordName': 'CN=John Smith,CN=Users,DC=my-corp,DC=mycorpname-dev,DC=com'
and this will result : my-corp.mycorpname-dev.com
but perhaps there's an easier builtin alternative ?
my computer is bound to windows LDAP server. the connection is configured to use mobile account so I'd be able to login while the LDAP is unreachable.
I'd like to extract domain name for my user. which is represented by the field dsAttrTypeNative:DomainName as can be shown in the following code :
Code Block ODNode * node = [ODNode nodeWithSession:[ODSession defaultSession] type:kODNodeTypeAuthentication error:&err]; NSArray * subnodeNames = [node subnodeNamesAndReturnError:&err]; for (NSString * subnodeName in subnodeNames) { ODNode * subnodeObject = [ODNode nodeWithSession:[ODSession defaultSession] name:subnodeName error:&err]; id subnodeDetails = [subnodeObject nodeDetailsForKeys:nil error:&err]; NSArray * domainName = subnodeDetails[@"dsAttrTypeNative:DomainName"];
when LDAP connectivity is online, I can see that this field appears in subnodeDetails and it's equal to the concatenation of 2 string separated by dot (i.e MY-CORP.mycompanyname-dev.com). but when it's offline, this field doesn't appear even though I see that the LDAP user appears by running the following command id username.
is there any way to extract domain name when LDAP is unconnected ?
I could do something really patchy like running odrecord and append the DC fields from dsAttrTypeStandard:AppleMetaRecordName which include the following data :
'dsAttrTypeStandard:AppleMetaRecordName': 'CN=John Smith,CN=Users,DC=my-corp,DC=mycorpname-dev,DC=com'
and this will result : my-corp.mycorpname-dev.com
but perhaps there's an easier builtin alternative ?
There’s probably a better way to do this but it’s hard to say without more info. Can you use dscl to dump your account record while in the offline state and post the result here?
Make sure to elide anything stupidly large (like JPEGPhoto) and redact anything private. When you do the redaction, it’d help if you substituted placeholders, like the my-corp.mycorpname-dev.com in your original post.
Also, format the dump as a code block (using triple backticks) so that it’s easier to read.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Code Block % dscl localhost -read /Search/Users/quinn
Make sure to elide anything stupidly large (like JPEGPhoto) and redact anything private. When you do the redaction, it’d help if you substituted placeholders, like the my-corp.mycorpname-dev.com in your original post.
Also, format the dump as a code block (using triple backticks) so that it’s easier to read.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"