@@ -33,7 +33,6 @@ const (
3333type LDAPConn struct {
3434 Conn * ldap.Conn
3535 PagingSize uint32
36- RootDN string
3736 DefaultRootDN string
3837 Flavor LDAPFlavor
3938}
@@ -102,7 +101,6 @@ func NewLDAPConn(ldapServer string, ldapPort int, ldaps bool, tlsConfig *tls.Con
102101 return & LDAPConn {
103102 Conn : conn ,
104103 PagingSize : pagingSize ,
105- RootDN : rootDN ,
106104 DefaultRootDN : rootDN ,
107105 }, nil
108106}
@@ -539,11 +537,6 @@ func (lc *LDAPConn) QueryFirst(filter string) (*ldap.Entry, error) {
539537// User Passwords
540538// Reference: https://gist.github.com/Project0/61c13130563cf7f595e031d54fe55aab
541539const (
542- ldapAttrAccountName = "sAMAccountName"
543- ldapAttrDN = "dn"
544- ldapAttrUAC = "userAccountControl"
545- ldapAttrUPN = "userPrincipalName" // username@logon.domain
546- ldapAttrEmail = "mail"
547540 ldapAttrUnicodePw = "unicodePwd"
548541 controlTypeLdapServerPolicyHints = "1.2.840.113556.1.4.2239"
549542 controlTypeLdapServerPolicyHintsDeprecated = "1.2.840.113556.1.4.2066"
@@ -770,7 +763,7 @@ func (lc *LDAPConn) AddADIDNSZone(objectName string, props []adidns.DNSProperty,
770763 zoneContainer = "ForestDnsZones"
771764 }
772765
773- zoneDN := fmt .Sprintf ("DC=%s,CN=MicrosoftDNS,DC=%s,%s" , objectName , zoneContainer , lc .RootDN )
766+ zoneDN := fmt .Sprintf ("DC=%s,CN=MicrosoftDNS,DC=%s,%s" , objectName , zoneContainer , lc .DefaultRootDN )
774767
775768 addRequest := ldap .NewAddRequest (zoneDN , nil )
776769 addRequest .Attribute ("objectClass" , []string {"top" , "dnsZone" })
@@ -1046,7 +1039,7 @@ func (lc *LDAPConn) GetSecurityDescriptor(object string) (queryResult string, er
10461039 switch {
10471040 case isSamAccountName :
10481041 searchReq = ldap .NewSearchRequest (
1049- lc .RootDN ,
1042+ lc .DefaultRootDN ,
10501043 ldap .ScopeWholeSubtree ,
10511044 ldap .NeverDerefAliases , 0 , 0 , false ,
10521045 samOrDn ,
@@ -1209,14 +1202,14 @@ func (lc *LDAPConn) FindSamForSID(SID string) (resolvedSID string, err error) {
12091202}
12101203
12111204func (lc * LDAPConn ) FindPrimaryGroupForSID (SID string ) (groupSID string , err error ) {
1212- domainSID , err := lc .FindSIDForObject (lc .RootDN )
1205+ domainSID , err := lc .FindSIDForObject (lc .DefaultRootDN )
12131206 if err != nil {
12141207 return "" , err
12151208 }
12161209
12171210 query := fmt .Sprintf ("(objectSID=%s)" , SID )
12181211 searchReq := ldap .NewSearchRequest (
1219- lc .RootDN ,
1212+ lc .DefaultRootDN ,
12201213 ldap .ScopeWholeSubtree , 0 , 0 , 0 , false ,
12211214 query ,
12221215 []string {"primaryGroupID" },
0 commit comments