Skip to content

Commit

Permalink
Updating ICONV dependancy from personal to PerfectSideRepos.
Browse files Browse the repository at this point in the history
  • Loading branch information
RockfordWei committed Jan 24, 2017
1 parent d195185 commit ce37b7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PackageDescription
let package = Package(
name: "PerfectLDAP",
dependencies:[
.Package(url: "https://github.com/RockfordWei/Perfect-ICONV.git", majorVersion: 1),
.Package(url: "https://github.com/PerfectSideRepos/Perfect-ICONV.git", majorVersion: 1),
.Package(url:"https://github.com/PerfectlySoft/Perfect-Thread.git", majorVersion: 2),
.Package(url:"https://github.com/PerfectlySoft/Perfect-OpenLDAP.git", majorVersion: 1)
]
Expand Down
16 changes: 16 additions & 0 deletions Sources/PerfectLDAP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ public class LDAP {
}//end str
}//end string

public var _supportedControls = [String]()

/// load session control OIDs from server
/// - throws:
/// Exception with messages.
public func checkServerSideControls() throws {
guard let r = try self.search() else {
throw Exception.message("load controls failed")
}//end guard
guard let root = r.dictionary[""] else {
throw Exception.message("control has no expected key")
}//end guard
_supportedControls = root["supportedControl"] as? [String] ?? []

}//end func

/// constructor of LDAP. could be a simple LDAP() to local server or LDAP(url) with / without logon options.
/// if login parameters were input, the process would block until finished.
/// so it is strongly recommanded that call LDAP() without login option and call ldap.login() {} in async mode
Expand Down
3 changes: 3 additions & 0 deletions Tests/PerfectLDAPTests/PerfectLDAPTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class PerfectLDAPTests: XCTestCase {

let succ = ldap.login(username: testUSR, password: testPWD)
XCTAssertTrue(succ)

try ldap.checkServerSideControls()
print(ldap._supportedControls)
}catch(let err) {
XCTFail("testLoginSync error: \(err)")
}
Expand Down

0 comments on commit ce37b7a

Please sign in to comment.