forked from qt-creator/qt-creator
RemoteLinux: Read public key more directly
Change-Id: I38faa3be91e615571f02d51a721ea858b5f70298 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -67,14 +67,14 @@ PublicKeyDeploymentDialog::PublicKeyDeploymentDialog(const DeviceConstRef &devic
|
|||||||
handleDeploymentDone(result);
|
handleDeploymentDone(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
FileReader reader;
|
const Result<QByteArray> publicKey = publicKeyFileName.fileContents();
|
||||||
if (!reader.fetch(publicKeyFileName)) {
|
if (!publicKey) {
|
||||||
handleDeploymentDone(ResultError(Tr::tr("Public key error: %1").arg(reader.errorString())));
|
handleDeploymentDone(ResultError(Tr::tr("Public key error: %1").arg(publicKey.error())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString command = "test -d .ssh || mkdir -p ~/.ssh && chmod 0700 .ssh && echo '"
|
const QString command = "test -d .ssh || mkdir -p ~/.ssh && chmod 0700 .ssh && echo '"
|
||||||
+ QString::fromLocal8Bit(reader.data())
|
+ QString::fromLocal8Bit(publicKey.value())
|
||||||
+ "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
|
+ "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
|
||||||
|
|
||||||
const SshParameters params = device.sshParameters();
|
const SshParameters params = device.sshParameters();
|
||||||
|
Reference in New Issue
Block a user