Don't pass the password in the shell argument

this should prevent some issues with escaping
This commit is contained in:
Robin Appelman 2013-03-03 22:27:29 +01:00
commit 7353a25b99
2 changed files with 16 additions and 1 deletions

View file

@ -45,6 +45,20 @@ class Server {
return $this->user . '%' . $this->password; return $this->user . '%' . $this->password;
} }
/**
* @return string
*/
public function getUser() {
return $this->user;
}
/**
* @return string
*/
public function getPassword(){
return $this->password;
}
/** /**
* return string * return string
*/ */

View file

@ -32,9 +32,10 @@ class Share {
$this->server = $server; $this->server = $server;
$this->name = $name; $this->name = $name;
$command = Server::CLIENT . ' -N -U ' . $this->server->getAuthString() . $command = Server::CLIENT . ' -U ' . escapeshellarg($this->server->getUser()) .
' //' . $this->server->getHost() . '/' . $this->name; ' //' . $this->server->getHost() . '/' . $this->name;
$this->connection = new Connection($command); $this->connection = new Connection($command);
$this->connection->write($this->server->getPassword());
} }
public function getName() { public function getName() {