Skip to content

Merge master2 branch into master branch #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions ADPassMon/ADPassMonAppDelegate.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,20 @@ Enable it now?" with icon 2 buttons {"No", "Yes"} default button 2)
end try
end renewLionKerb_

-- Use scutil to get AD DNS info
-- ad node with scutil fallback to get AD DNS info
on getDNS_(sender)
try
-- "first word of" added for 10.7 compatibility, which may return more than one item
set my myLDAP to first word of (do shell script "/usr/sbin/scutil --dns | /usr/bin/awk '/nameserver\\[0\\]/{print $3}'") as text
-- find source of user node
set originalNodeName to (do shell script "/usr/bin/dscl localhost read /Search/Users/$USER OriginalNodeName | grep -o -e '/.*'") as text
if (count words of originalNodeName) > 0
set my myLDAP to (do shell script "/usr/bin/dscl localhost read '" & originalNodeName & "' ServerConnection | /usr/bin/awk '/ServerConnection/{print $2}'") as text
set my mySearchBase to (do shell script "/usr/bin/dscl localhost read '" & originalNodeName & "' LDAPSearchBaseSuffix | /usr/bin/awk '/LDAPSearchBaseSuffix/{print $2}'") as text
end if

if (count words of myLDAP) = 0
-- "first word of" added for 10.7 compatibility, which may return more than one item
set my myLDAP to first word of (do shell script "/usr/sbin/scutil --dns | /usr/bin/awk '/nameserver\\[0\\]/{print $3}'") as text
end if
on error theError
errorOut_(theError)
end try
Expand All @@ -395,6 +404,10 @@ Enable it now?" with icon 2 buttons {"No", "Yes"} default button 2)

-- Use ldapsearch to get search base
on getSearchBase_(sender)
if (count words of my mySearchBase) > 0
return
end if

try
set my mySearchBase to (do shell script "/usr/bin/ldapsearch -LLL -Q -s base -H ldap://" & myLDAP & " defaultNamingContext | /usr/bin/awk '/defaultNamingContext/{print $2}'") as text
-- awk -F, '/rootDomainNamingContext/{print $(NF-1)","$NF}' to take only last two search base fields
Expand Down