RawConnection.php: add workgroup to auth file

This commit is contained in:
Alfred Klomp 2015-08-23 18:27:27 +02:00
commit 98074eff7f
3 changed files with 17 additions and 11 deletions

View file

@ -131,12 +131,18 @@ class RawConnection {
return $this->pipes[5];
}
public function writeAuthentication($user, $password) {
$auth = ($password === false)
? "username=$user"
: "username=$user\npassword=$password";
if (fwrite($this->getAuthStream(), $auth) === false) {
public function writeAuthentication($workgroup, $user, $password) {
$auth = array();
if (is_string($workgroup)) {
$auth[] = "domain=$workgroup";
}
if (is_string($user)) {
$auth[] = "username=$user";
}
if (is_string($password)) {
$auth[] = "password=$password";
}
if (fwrite($this->getAuthStream(), implode("\n", $auth)) === false) {
fclose($this->getAuthStream());
return false;
}