mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
ssh token: Make strings in the plugin translatable
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <libcryptsetup.h>
|
||||
#include "ssh-utils.h"
|
||||
#include "../lib/nls.h"
|
||||
|
||||
#define KEYFILE_LENGTH_MAX 8192
|
||||
|
||||
@@ -42,27 +43,27 @@ int sshplugin_download_password(struct crypt_device *cd, ssh_session ssh,
|
||||
|
||||
sftp = sftp_new(ssh);
|
||||
if (!sftp) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Cannot create sftp session: "));
|
||||
r = SSH_FX_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = sftp_init(sftp);
|
||||
if (r != SSH_OK) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Cannot init sftp session: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Cannot init sftp session: "));
|
||||
goto out;
|
||||
}
|
||||
|
||||
file = sftp_open(sftp, path, O_RDONLY, 0);
|
||||
if (!file) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Cannot create sftp session: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Cannot create sftp session: "));
|
||||
r = SSH_FX_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
sftp_attr = sftp_fstat(file);
|
||||
if (!sftp_attr) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Cannot stat sftp file: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Cannot stat sftp file: "));
|
||||
r = SSH_FX_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
@@ -70,14 +71,14 @@ int sshplugin_download_password(struct crypt_device *cd, ssh_session ssh,
|
||||
pass_len = sftp_attr->size > KEYFILE_LENGTH_MAX ? KEYFILE_LENGTH_MAX : sftp_attr->size;
|
||||
pass = malloc(pass_len);
|
||||
if (!pass) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Not enough memory.\n");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Not enough memory.\n"));
|
||||
r = SSH_FX_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = sftp_read(file, pass, pass_len);
|
||||
if (r < 0 || (size_t)r != pass_len) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Cannot read remote key: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Cannot read remote key: "));
|
||||
r = SSH_FX_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
@@ -118,13 +119,13 @@ ssh_session sshplugin_session_init(struct crypt_device *cd, const char *host, co
|
||||
|
||||
r = ssh_connect(ssh);
|
||||
if (r != SSH_OK) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Connection failed: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Connection failed: "));
|
||||
goto out;
|
||||
}
|
||||
|
||||
r = ssh_session_is_known_server(ssh);
|
||||
if (r != SSH_SERVER_KNOWN_OK) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Server not known: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Server not known: "));
|
||||
r = SSH_AUTH_ERROR;
|
||||
goto out;
|
||||
}
|
||||
@@ -152,7 +153,7 @@ int sshplugin_public_key_auth(struct crypt_device *cd, ssh_session ssh, const ss
|
||||
crypt_log(cd, CRYPT_LOG_DEBUG, "Trying public key authentication method.\n");
|
||||
|
||||
if (!(ssh_userauth_list(ssh, NULL) & SSH_AUTH_METHOD_PUBLICKEY)) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Public key auth method not allowed on host.\n");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Public key auth method not allowed on host.\n"));
|
||||
return SSH_AUTH_ERROR;
|
||||
}
|
||||
|
||||
@@ -163,7 +164,7 @@ int sshplugin_public_key_auth(struct crypt_device *cd, ssh_session ssh, const ss
|
||||
}
|
||||
|
||||
if (r != SSH_AUTH_SUCCESS) {
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "Public key authentication error: ");
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, _("Public key authentication error: "));
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, ssh_get_error(ssh));
|
||||
crypt_log(cd, CRYPT_LOG_ERROR, "\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user