rpc: Move error messages onto a single line

Error messages are exempt from the 80 columns rule. Move them
onto one line.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Michal Privoznik 2023-08-24 17:03:59 +02:00
parent 6c67e66c83
commit cc6fb6e178
6 changed files with 32 additions and 68 deletions

View File

@ -1011,8 +1011,7 @@ int virNetClientSetTLSSession(virNetClient *client,
} }
if (len != 1 || buf[0] != '\1') { if (len != 1 || buf[0] != '\1') {
virReportError(VIR_ERR_RPC, "%s", virReportError(VIR_ERR_RPC, "%s",
_("server verification (of our certificate or IP " _("server verification (of our certificate or IP address) failed"));
"address) failed"));
goto error; goto error;
} }
@ -2069,15 +2068,13 @@ virNetClientCallNew(virNetMessage *msg,
(msg->bufferLength != 0) && (msg->bufferLength != 0) &&
(msg->header.status == VIR_NET_CONTINUE)) { (msg->header.status == VIR_NET_CONTINUE)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Attempt to send an asynchronous message with" _("Attempt to send an asynchronous message with a synchronous reply"));
" a synchronous reply"));
goto error; goto error;
} }
if (expectReply && nonBlock) { if (expectReply && nonBlock) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Attempt to send a non-blocking message with" _("Attempt to send a non-blocking message with a synchronous reply"));
" a synchronous reply"));
goto error; goto error;
} }

View File

@ -195,8 +195,7 @@ virLibsshServerKeyAsString(virNetLibsshSession *sess)
if (ssh_get_server_publickey(sess->session, &key) != SSH_OK) { if (ssh_get_server_publickey(sess->session, &key) != SSH_OK) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("failed to get the key of the current " _("failed to get the key of the current session"));
"session"));
return NULL; return NULL;
} }
@ -261,8 +260,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess)
/* host key verification failed */ /* host key verification failed */
virReportError(VIR_ERR_AUTH_FAILED, virReportError(VIR_ERR_AUTH_FAILED,
_("!!! SSH HOST KEY VERIFICATION FAILED !!!: Identity of host '%1$s:%2$d' differs from stored identity. " _("!!! SSH HOST KEY VERIFICATION FAILED !!!: Identity of host '%1$s:%2$d' differs from stored identity. Please verify the new host key '%3$s' to avoid possible man in the middle attack. The key is stored in '%4$s'."),
"Please verify the new host key '%3$s' to avoid possible man in the middle attack. The key is stored in '%4$s'."),
sess->hostname, sess->port, sess->hostname, sess->port,
keyhashstr, sess->knownHostsFile); keyhashstr, sess->knownHostsFile);
@ -279,8 +277,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess)
/* ask to add the key */ /* ask to add the key */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("No user interaction callback provided: " _("No user interaction callback provided: Can't verify the session host key"));
"Can't verify the session host key"));
return -1; return -1;
} }
@ -355,8 +352,7 @@ virNetLibsshAuthenticatePrivkeyCb(const char *prompt,
/* request user's key password */ /* request user's key password */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("No user interaction callback provided: " _("No user interaction callback provided: Can't retrieve private key passphrase"));
"Can't retrieve private key passphrase"));
return -1; return -1;
} }
@ -505,8 +501,7 @@ virNetLibsshAuthenticatePassword(virNetLibsshSession *sess)
/* password authentication with interactive password request */ /* password authentication with interactive password request */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("Can't perform authentication: " _("Can't perform authentication: Authentication callback not provided"));
"Authentication callback not provided"));
return SSH_AUTH_ERROR; return SSH_AUTH_ERROR;
} }
@ -567,9 +562,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSession *sess,
/* request user's key password */ /* request user's key password */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("No user interaction callback provided: " _("No user interaction callback provided: Can't get input from keyboard interactive authentication"));
"Can't get input from keyboard interactive "
"authentication"));
return SSH_AUTH_ERROR; return SSH_AUTH_ERROR;
} }
@ -738,12 +731,10 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess)
errmsg); errmsg);
} else if (no_method && !auth_failed) { } else if (no_method && !auth_failed) {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("None of the requested authentication methods " _("None of the requested authentication methods are supported by the server"));
"are supported by the server"));
} else { } else {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("All provided authentication methods with credentials " _("All provided authentication methods with credentials were rejected by the server"));
"were rejected by the server"));
} }
return -1; return -1;
@ -803,8 +794,7 @@ virNetLibsshValidateConfig(virNetLibsshSession *sess)
} }
if (!has_auths) { if (!has_auths) {
virReportError(VIR_ERR_LIBSSH, "%s", virReportError(VIR_ERR_LIBSSH, "%s",
_("No authentication methods and credentials " _("No authentication methods and credentials provided"));
"provided"));
return -1; return -1;
} }

View File

@ -372,8 +372,7 @@ virNetServerNew(const char *name,
if (max_clients < max_anonymous_clients) { if (max_clients < max_anonymous_clients) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("The overall maximum number of clients must not be less " _("The overall maximum number of clients must not be less than the number of clients waiting for authentication"));
"than the number of clients waiting for authentication"));
return NULL; return NULL;
} }
@ -458,8 +457,7 @@ virNetServerNewPostExecRestart(virJSONValue *object,
} }
if (max_clients < max_anonymous_clients) { if (max_clients < max_anonymous_clients) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("The overall maximum number of clients must not be less " _("The overall maximum number of clients must not be less than the number of clients waiting for authentication"));
"than the number of clients waiting for authentication"));
return NULL; return NULL;
} }
} else { } else {
@ -1127,8 +1125,7 @@ virNetServerSetClientLimits(virNetServer *srv,
if (max < max_unauth) { if (max < max_unauth) {
virReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("The overall maximum number of clients must not be less " _("The overall maximum number of clients must not be less than the number of clients waiting for authentication"));
"than the number of clients waiting for authentication"));
return -1; return -1;
} }

View File

@ -531,8 +531,7 @@ virNetServerClient *virNetServerClientNewPostExecRestart(virNetServer *srv,
} else { } else {
if (virJSONValueObjectGetNumberLong(object, "conn_time", &timestamp) < 0) { if (virJSONValueObjectGetNumberLong(object, "conn_time", &timestamp) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Malformed conn_time field in JSON " _("Malformed conn_time field in JSON state document"));
"state document"));
return NULL; return NULL;
} }
} }

View File

@ -307,8 +307,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess)
/* ask to add the key */ /* ask to add the key */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("No user interaction callback provided: " _("No user interaction callback provided: Can't verify the session host key"));
"Can't verify the session host key"));
return -1; return -1;
} }
@ -320,8 +319,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess)
if (i == sess->cred->ncredtype) { if (i == sess->cred->ncredtype) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("no suitable callback for host key " _("no suitable callback for host key verification"));
"verification"));
return -1; return -1;
} }
@ -348,8 +346,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess)
if (sess->cred->cb(&askKey, 1, sess->cred->cbdata)) { if (sess->cred->cb(&askKey, 1, sess->cred->cbdata)) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("failed to retrieve decision to accept " _("failed to retrieve decision to accept host key"));
"host key"));
tmp = (char*)askKey.prompt; tmp = (char*)askKey.prompt;
VIR_FREE(tmp); VIR_FREE(tmp);
VIR_FREE(keyhashstr); VIR_FREE(keyhashstr);
@ -455,8 +452,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess)
case LIBSSH2_KNOWNHOST_CHECK_MISMATCH: case LIBSSH2_KNOWNHOST_CHECK_MISMATCH:
/* host key verification failed */ /* host key verification failed */
virReportError(VIR_ERR_AUTH_FAILED, virReportError(VIR_ERR_AUTH_FAILED,
_("!!! SSH HOST KEY VERIFICATION FAILED !!!: Identity of host '%1$s:%2$d' differs from stored identity. " _("!!! SSH HOST KEY VERIFICATION FAILED !!!: Identity of host '%1$s:%2$d' differs from stored identity. Please verify the new host key '%3$s' to avoid possible man in the middle attack. The key is stored in '%4$s'."),
"Please verify the new host key '%3$s' to avoid possible man in the middle attack. The key is stored in '%4$s'."),
sess->hostname, sess->port, sess->hostname, sess->port,
knownHostEntry->key, sess->knownHostsFile); knownHostEntry->key, sess->knownHostsFile);
return -1; return -1;
@ -532,12 +528,10 @@ virNetSSHAuthenticateAgent(virNetSSHSession *sess)
if (ret == 1) { if (ret == 1) {
if (no_identity) { if (no_identity) {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("SSH Agent did not provide any " _("SSH Agent did not provide any authentication identity"));
"authentication identity"));
} else { } else {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("All identities provided by the SSH Agent " _("All identities provided by the SSH Agent were rejected"));
"were rejected"));
} }
return 1; return 1;
} }
@ -589,8 +583,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSession *sess,
/* request user's key password */ /* request user's key password */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("No user interaction callback provided: " _("No user interaction callback provided: Can't retrieve private key passphrase"));
"Can't retrieve private key passphrase"));
return -1; return -1;
} }
@ -615,8 +608,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSession *sess,
if (sess->cred->cb(&retr_passphrase, 1, sess->cred->cbdata)) { if (sess->cred->cb(&retr_passphrase, 1, sess->cred->cbdata)) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("failed to retrieve private key passphrase: " _("failed to retrieve private key passphrase: callback has failed"));
"callback has failed"));
tmp = (char *)retr_passphrase.prompt; tmp = (char *)retr_passphrase.prompt;
VIR_FREE(tmp); VIR_FREE(tmp);
return -1; return -1;
@ -671,8 +663,7 @@ virNetSSHAuthenticatePassword(virNetSSHSession *sess)
/* password authentication with interactive password request */ /* password authentication with interactive password request */
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("Can't perform authentication: " _("Can't perform authentication: Authentication callback not provided"));
"Authentication callback not provided"));
goto cleanup; goto cleanup;
} }
@ -732,8 +723,7 @@ virNetSSHAuthenticateKeyboardInteractive(virNetSSHSession *sess,
if (!sess->cred || !sess->cred->cb) { if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("Can't perform keyboard-interactive authentication: " _("Can't perform keyboard-interactive authentication: Authentication callback not provided"));
"Authentication callback not provided"));
return -1; return -1;
} }
@ -748,8 +738,7 @@ virNetSSHAuthenticateKeyboardInteractive(virNetSSHSession *sess,
switch (sess->authCbErr) { switch (sess->authCbErr) {
case VIR_NET_SSH_AUTHCB_NO_METHOD: case VIR_NET_SSH_AUTHCB_NO_METHOD:
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("no suitable method to retrieve " _("no suitable method to retrieve authentication credentials"));
"authentication credentials"));
return -1; return -1;
case VIR_NET_SSH_AUTHCB_OOM: case VIR_NET_SSH_AUTHCB_OOM:
/* OOM error already reported */ /* OOM error already reported */
@ -801,8 +790,7 @@ virNetSSHAuthenticate(virNetSSHSession *sess)
if (!sess->nauths) { if (!sess->nauths) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("No authentication methods and credentials " _("No authentication methods and credentials provided"));
"provided"));
return -1; return -1;
} }
@ -866,12 +854,10 @@ virNetSSHAuthenticate(virNetSSHSession *sess)
/* pass through the error */ /* pass through the error */
} else if (no_method && !auth_failed) { } else if (no_method && !auth_failed) {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("None of the requested authentication methods " _("None of the requested authentication methods are supported by the server"));
"are supported by the server"));
} else { } else {
virReportError(VIR_ERR_AUTH_FAILED, "%s", virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("All provided authentication methods with credentials " _("All provided authentication methods with credentials were rejected by the server"));
"were rejected by the server"));
} }
return -1; return -1;
@ -914,8 +900,7 @@ virNetSSHValidateConfig(virNetSSHSession *sess)
{ {
if (sess->nauths == 0) { if (sess->nauths == 0) {
virReportError(VIR_ERR_SSH, "%s", virReportError(VIR_ERR_SSH, "%s",
_("No authentication methods and credentials " _("No authentication methods and credentials provided"));
"provided"));
return -1; return -1;
} }

View File

@ -366,11 +366,7 @@ virNetTLSContextCheckCertDNACL(const char *dname,
/* This is the most common error: make it informative. */ /* This is the most common error: make it informative. */
virReportError(VIR_ERR_SYSTEM_ERROR, "%s", virReportError(VIR_ERR_SYSTEM_ERROR, "%s",
_("Client's Distinguished Name is not on the list " _("Client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'virt-pki-query-dn clientcert.pem' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
"of allowed clients (tls_allowed_dn_list). Use "
"'virt-pki-query-dn clientcert.pem' to view the "
"Distinguished Name field in the client certificate, "
"or run this daemon with --verbose option."));
return 0; return 0;
} }