Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Example/Example/ServerDiscoveryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension ServerDiscoveryViewController: UITableViewDataSource {

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let svr = self.servers[indexPath.row]
let smbServer = SMBServer(hostname: svr.name, ipAddress: svr.ipAddress)
let smbServer = SMBServer(hostname: svr.name, ipAddress: svr.ipAddress, domain: svr.group)

self.tableView.deselectRow(at: indexPath, animated: true)
let vc = UIStoryboard.authViewController(server: smbServer)
Expand Down
2 changes: 1 addition & 1 deletion Sources/NetBIOSNameServiceEntry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct NetBIOSNameServiceEntry {
}

public var smbServer: SMBServer {
return SMBServer(hostname: self.name, ipAddress: self.ipAddress)
return SMBServer(hostname: self.name, ipAddress: self.ipAddress, domain: self.group)
}
}

Expand Down
7 changes: 5 additions & 2 deletions Sources/SMBServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ import Foundation
public struct SMBServer {
public let hostname: String
public let ipAddress: UInt32
public let domain: String

public init(hostname: String, ipAddress: UInt32) {
public init(hostname: String, ipAddress: UInt32, domain: String) {
self.hostname = hostname
self.ipAddress = ipAddress
self.domain = domain
}

// fails initiation if ipAddress lookup fails
public init?(hostname: String) {
public init?(hostname: String, domain: String = "") {
self.hostname = hostname
self.domain = domain
let ns = NetBIOSNameService()
if let addr = ns.resolveIPAddress(forName: self.hostname, ofType: .fileServer) {
self.ipAddress = addr
Expand Down
2 changes: 1 addition & 1 deletion Sources/SMBSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public class SMBSession {
}

smb_session_set_creds(self.rawSession,
self.server.hostname.cString(using: .utf8),
self.server.domain.cString(using: .utf8),
self.credentials.userName.cString(using: .utf8),
self.credentials.password.cString(using: .utf8))
if smb_session_login(self.rawSession) != 0 {
Expand Down