Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/rpc/gendispatch.pl | 10 ++--- src/rpc/virkeepalive.c | 2 +- src/rpc/virnetclient.c | 4 +- src/rpc/virnetclientprogram.c | 26 ++++++------ src/rpc/virnetclientstream.c | 6 +-- src/rpc/virnetdaemon.c | 6 +-- src/rpc/virnetlibsshsession.c | 57 ++++++++++++------------- src/rpc/virnetmessage.c | 21 +++++----- src/rpc/virnetsaslcontext.c | 38 ++++++++--------- src/rpc/virnetserver.c | 2 +- src/rpc/virnetserverclient.c | 4 +- src/rpc/virnetserverprogram.c | 12 +++--- src/rpc/virnetsocket.c | 42 +++++++++---------- src/rpc/virnetsshsession.c | 59 ++++++++++++-------------- src/rpc/virnettlscontext.c | 78 +++++++++++++++++------------------ 15 files changed, 178 insertions(+), 189 deletions(-) diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index b186849606..e791d2c75c 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1178,7 +1178,7 @@ elsif ($mode eq "server") { if ($modern_ret_as_list) { print " if (nresults > $single_ret_list_max_define) {\n"; print " virReportError(VIR_ERR_INTERNAL_ERROR,\n"; - print " _(\"Too many ${single_ret_list_error_msg_type}s '%d' for limit '%d'\"),\n"; + print " _(\"Too many ${single_ret_list_error_msg_type}s '%1\$d' for limit '%2\$d'\"),\n"; print " nresults, $single_ret_list_max_define);\n"; print " goto cleanup;\n"; print " }\n"; @@ -1845,7 +1845,7 @@ elsif ($mode eq "client") { print "\n"; print " if ($args_check->{arg} > $args_check->{limit}) {\n"; print " virReportError(VIR_ERR_RPC,\n"; - print " _(\"%s length greater than maximum: %d > %d\"),\n"; + print " _(\"%1\$s length greater than maximum: %2\$d > %3\$d\"),\n"; print " $args_check->{name}, (int)$args_check->{arg}, $args_check->{limit});\n"; print " goto done;\n"; print " }\n"; @@ -1855,7 +1855,7 @@ elsif ($mode eq "client") { print "\n"; print " if ($single_ret_list_max_var > $single_ret_list_max_define) {\n"; print " virReportError(VIR_ERR_RPC,\n"; - print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d,\"\n"; + print " _(\"too many remote ${single_ret_list_error_msg_type}s: %1\$d > %2\$d,\"\n"; print " \"in parameter '$single_ret_list_name' for 'vir$call->{ProcName}'\"),\n"; print " $single_ret_list_max_var, $single_ret_list_max_define);\n"; print " goto done;\n"; @@ -1917,7 +1917,7 @@ elsif ($mode eq "client") { $modern_ret_as_list) { print " if (ret.$single_ret_list_name.${single_ret_list_name}_len > $single_ret_list_max_var) {\n"; print " virReportError(VIR_ERR_RPC,\n"; - print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d,\"\n"; + print " _(\"too many remote ${single_ret_list_error_msg_type}s: %1\$d > %2\$d,\"\n"; print " \"in parameter '$single_ret_list_name' for 'vir$call->{ProcName}'\"),\n"; print " ret.$single_ret_list_name.${single_ret_list_name}_len, $single_ret_list_max_var);\n"; print " goto cleanup;\n"; @@ -2219,7 +2219,7 @@ elsif ($mode eq "client") { if ($action eq "Ensure") { print " if (rv == 0)\n"; print " virReportError(VIR_ERR_ACCESS_DENIED,\n"; - print" _(\"'%s' denied access\"), conn->driver->name);\n"; + print" _(\"'%1\$s' denied access\"), conn->driver->name);\n"; print " return $fail;\n"; } else { print " virResetLastError();\n"; diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index 434cc2c7c9..d96bd347ad 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -249,7 +249,7 @@ virKeepAliveStart(virKeepAlive *ka, /* Guard against overflow */ if (interval > INT_MAX / 1000) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("keepalive interval %d too large"), interval); + _("keepalive interval %1$d too large"), interval); goto cleanup; } ka->interval = interval; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 1202b0f30c..df2958935b 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1138,7 +1138,7 @@ virNetClientCallDispatchReply(virNetClient *client) if (!thecall) { virReportError(VIR_ERR_RPC, - _("no call waiting for reply with prog %d vers %d serial %d"), + _("no call waiting for reply with prog %1$d vers %2$d serial %3$d"), client->msg.header.prog, client->msg.header.vers, client->msg.header.serial); return -1; } @@ -1327,7 +1327,7 @@ virNetClientCallDispatch(virNetClient *client) case VIR_NET_CALL_WITH_FDS: default: virReportError(VIR_ERR_RPC, - _("got unexpected RPC call prog %d vers %d proc %d type %d"), + _("got unexpected RPC call prog %1$d vers %2$d proc %3$d type %4$d"), client->msg.header.prog, client->msg.header.vers, client->msg.header.proc, client->msg.header.type); return -1; diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index b93c495347..abc8e6798a 100644 --- a/src/rpc/virnetclientprogram.c +++ b/src/rpc/virnetclientprogram.c @@ -216,25 +216,25 @@ int virNetClientProgramDispatch(virNetClientProgram *prog, /* Check version, etc. */ if (msg->header.prog != prog->program) { - VIR_ERROR(_("program mismatch in event (actual 0x%x, expected 0x%x)"), + VIR_ERROR(_("program mismatch in event (actual 0x%1$x, expected 0x%2$x)"), msg->header.prog, prog->program); return -1; } if (msg->header.vers != prog->version) { - VIR_ERROR(_("version mismatch in event (actual 0x%x, expected 0x%x)"), + VIR_ERROR(_("version mismatch in event (actual 0x%1$x, expected 0x%2$x)"), msg->header.vers, prog->version); return -1; } if (msg->header.status != VIR_NET_OK) { - VIR_ERROR(_("status mismatch in event (actual 0x%x, expected 0x%x)"), + VIR_ERROR(_("status mismatch in event (actual 0x%1$x, expected 0x%2$x)"), msg->header.status, VIR_NET_OK); return -1; } if (msg->header.type != VIR_NET_MESSAGE) { - VIR_ERROR(_("type mismatch in event (actual 0x%x, expected 0x%x)"), + VIR_ERROR(_("type mismatch in event (actual 0x%1$x, expected 0x%2$x)"), msg->header.type, VIR_NET_MESSAGE); return -1; } @@ -242,7 +242,7 @@ int virNetClientProgramDispatch(virNetClientProgram *prog, event = virNetClientProgramGetEvent(prog, msg->header.proc); if (!event) { - VIR_ERROR(_("No event expected with procedure 0x%x"), + VIR_ERROR(_("No event expected with procedure 0x%1$x"), msg->header.proc); return -1; } @@ -295,13 +295,13 @@ int virNetClientProgramCall(virNetClientProgram *prog, for (i = 0; i < msg->nfds; i++) { if ((msg->fds[i] = dup(outfds[i])) < 0) { virReportSystemError(errno, - _("Cannot duplicate FD %d"), + _("Cannot duplicate FD %1$d"), outfds[i]); goto error; } if (virSetInherit(msg->fds[i], false) < 0) { virReportSystemError(errno, - _("Cannot set close-on-exec %d"), + _("Cannot set close-on-exec %1$d"), msg->fds[i]); goto error; } @@ -327,18 +327,18 @@ int virNetClientProgramCall(virNetClientProgram *prog, if (msg->header.type != VIR_NET_REPLY && msg->header.type != VIR_NET_REPLY_WITH_FDS) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected message type %d"), msg->header.type); + _("Unexpected message type %1$d"), msg->header.type); goto error; } if (msg->header.proc != proc) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected message proc %d != %d"), + _("Unexpected message proc %1$d != %2$d"), msg->header.proc, proc); goto error; } if (msg->header.serial != serial) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected message serial %d != %d"), + _("Unexpected message serial %1$d != %2$d"), msg->header.serial, serial); goto error; } @@ -354,13 +354,13 @@ int virNetClientProgramCall(virNetClientProgram *prog, for (i = 0; i < *ninfds; i++) { if (((*infds)[i] = dup(msg->fds[i])) < 0) { virReportSystemError(errno, - _("Cannot duplicate FD %d"), + _("Cannot duplicate FD %1$d"), msg->fds[i]); goto error; } if (virSetInherit((*infds)[i], false) < 0) { virReportSystemError(errno, - _("Cannot set close-on-exec %d"), + _("Cannot set close-on-exec %1$d"), (*infds)[i]); goto error; } @@ -378,7 +378,7 @@ int virNetClientProgramCall(virNetClientProgram *prog, case VIR_NET_CONTINUE: default: virReportError(VIR_ERR_RPC, - _("Unexpected message status %d"), msg->header.status); + _("Unexpected message status %1$d"), msg->header.status); goto error; } diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index e0e3178111..21e9332134 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -417,7 +417,7 @@ virNetClientStreamSetHole(virNetClientStream *st, /* Shouldn't happen, But it's better to safe than sorry. */ if (st->holeLength) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unprocessed hole of size %lld already in the queue"), + _("unprocessed hole of size %1$lld already in the queue"), st->holeLength); return -1; } @@ -462,7 +462,7 @@ virNetClientStreamHandleHole(virNetClient *client, if (msg->header.type != VIR_NET_STREAM_HOLE) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid message prog=%d type=%d serial=%u proc=%d"), + _("Invalid message prog=%1$d type=%2$d serial=%3$u proc=%4$d"), msg->header.prog, msg->header.type, msg->header.serial, @@ -851,7 +851,7 @@ int virNetClientStreamInData(virNetClientStream *st, st->holeLength = 0; } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid message prog=%d type=%d serial=%u proc=%d"), + _("Invalid message prog=%1$d type=%2$d serial=%3$u proc=%4$d"), msg->header.prog, msg->header.type, msg->header.serial, diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index c4f5bbdce5..1292faa078 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -194,7 +194,7 @@ virNetDaemonGetServer(virNetDaemon *dmn, if (!srv) { virReportError(VIR_ERR_NO_SERVER, - _("No server named '%s'"), serverName); + _("No server named '%1$s'"), serverName); } return srv; @@ -324,7 +324,7 @@ virNetDaemonNewPostExecRestart(virJSONValue *object, size_t n = virJSONValueArraySize(servers); if (n > nDefServerNames) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Server count %zd greater than default name count %zu"), + _("Server count %1$zd greater than default name count %2$zu"), n, nDefServerNames); goto error; } @@ -646,7 +646,7 @@ virNetDaemonSignalEvent(int watch, } virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected signal received: %d"), siginfo.si_signo); + _("Unexpected signal received: %1$d"), siginfo.si_signo); cleanup: virObjectUnlock(dmn); diff --git a/src/rpc/virnetlibsshsession.c b/src/rpc/virnetlibsshsession.c index bba37210df..e71a79d0fb 100644 --- a/src/rpc/virnetlibsshsession.c +++ b/src/rpc/virnetlibsshsession.c @@ -261,10 +261,8 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess) /* host key verification failed */ virReportError(VIR_ERR_AUTH_FAILED, - _("!!! SSH HOST KEY VERIFICATION FAILED !!!: " - "Identity of host '%s:%d' differs from stored identity. " - "Please verify the new host key '%s' to avoid possible " - "man in the middle attack. The key is stored in '%s'."), + _("!!! 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'."), sess->hostname, sess->port, keyhashstr, sess->knownHostsFile); @@ -290,7 +288,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess) if (!keyhashstr) return -1; - prompt = g_strdup_printf(_("Accept SSH host key with hash '%s' for " "host '%s:%d' (%s/%s)?"), + prompt = g_strdup_printf(_("Accept SSH host key with hash '%1$s' for host '%2$s:%3$d' (%4$s/%5$s)?"), keyhashstr, sess->hostname, sess->port, "y", "n"); if (!(cred = virAuthAskCredential(sess->cred, prompt, true))) { @@ -301,7 +299,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess) if (!cred->result || STRCASENEQ(cred->result, "y")) { virReportError(VIR_ERR_LIBSSH, - _("SSH host key for '%s' (%s) was not accepted"), + _("SSH host key for '%1$s' (%2$s) was not accepted"), sess->hostname, keyhashstr); ssh_string_free_char(keyhashstr); return -1; @@ -314,7 +312,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess) if (ssh_session_update_known_hosts(sess->session) < 0) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to write known_host file '%s': %s"), + _("failed to write known_host file '%1$s': %2$s"), sess->knownHostsFile, errmsg); return -1; @@ -326,7 +324,7 @@ virNetLibsshCheckHostKey(virNetLibsshSession *sess) case SSH_SERVER_ERROR: errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to validate SSH host key: %s"), + _("failed to validate SSH host key: %1$s"), errmsg); return -1; @@ -395,14 +393,13 @@ virNetLibsshImportPrivkey(virNetLibsshSession *sess, sess, &key); if (ret == SSH_EOF) { virReportError(VIR_ERR_AUTH_FAILED, - _("error while reading private key '%s'"), + _("error while reading private key '%1$s'"), priv->filename); return SSH_AUTH_ERROR; } else if (ret == SSH_ERROR) { if (virGetLastErrorCode() == VIR_ERR_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("error while opening private key '%s', wrong " - "passphrase?"), + _("error while opening private key '%1$s', wrong passphrase?"), priv->filename); } return SSH_AUTH_ERROR; @@ -435,7 +432,7 @@ virNetLibsshAuthenticatePrivkey(virNetLibsshSession *sess, ret = ssh_pki_import_pubkey_file(tmp, &public_key); if (ret == SSH_ERROR) { virReportError(VIR_ERR_AUTH_FAILED, - _("error while reading public key '%s'"), + _("error while reading public key '%1$s'"), tmp); err = SSH_AUTH_ERROR; goto error; @@ -449,8 +446,7 @@ virNetLibsshAuthenticatePrivkey(virNetLibsshSession *sess, ret = ssh_pki_export_privkey_to_pubkey(private_key, &public_key); if (ret == SSH_ERROR) { virReportError(VIR_ERR_AUTH_FAILED, - _("cannot export the public key from the " - "private key '%s'"), + _("cannot export the public key from the private key '%1$s'"), priv->filename); err = SSH_AUTH_ERROR; goto error; @@ -535,7 +531,7 @@ virNetLibsshAuthenticatePassword(virNetLibsshSession *sess) g_autoptr(virConnectCredential) cred = NULL; g_autofree char *prompt = NULL; - prompt = g_strdup_printf(_("Enter %s's password for %s"), + prompt = g_strdup_printf(_("Enter %1$s's password for %2$s"), sess->username, sess->hostname); if (!(cred = virAuthAskCredential(sess->cred, prompt, false))) @@ -552,7 +548,7 @@ virNetLibsshAuthenticatePassword(virNetLibsshSession *sess) error: errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication failed: %s"), errmsg); + _("authentication failed: %1$s"), errmsg); return rc; } @@ -632,7 +628,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSession *sess, cred->result) < 0) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication failed: %s"), errmsg); + _("authentication failed: %1$s"), errmsg); return SSH_AUTH_ERROR; } @@ -649,7 +645,7 @@ virNetLibsshAuthenticateKeyboardInteractive(virNetLibsshSession *sess, /* error path */ errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication failed: %s"), errmsg); + _("authentication failed: %1$s"), errmsg); } return ret; @@ -679,7 +675,7 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess) if (ret == SSH_AUTH_ERROR) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("Failed to authenticate as 'none': %s"), + _("Failed to authenticate as 'none': %1$s"), errmsg); return -1; } @@ -708,7 +704,7 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess) if (ret == SSH_AUTH_ERROR) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to authenticate using agent: %s"), + _("failed to authenticate using agent: %1$s"), errmsg); } break; @@ -736,7 +732,7 @@ virNetLibsshAuthenticate(virNetLibsshSession *sess) if (sess->nauths == 1) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to authenticate: %s"), + _("failed to authenticate: %1$s"), errmsg); } else if (no_method && !auth_failed) { virReportError(VIR_ERR_AUTH_FAILED, "%s", @@ -761,7 +757,7 @@ virNetLibsshOpenChannel(virNetLibsshSession *sess) if (!sess->channel) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to create libssh channel: %s"), + _("failed to create libssh channel: %1$s"), errmsg); return -1; } @@ -769,7 +765,7 @@ virNetLibsshOpenChannel(virNetLibsshSession *sess) if (ssh_channel_open_session(sess->channel) != SSH_OK) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to open ssh channel: %s"), + _("failed to open ssh channel: %1$s"), errmsg); return -1; } @@ -777,7 +773,7 @@ virNetLibsshOpenChannel(virNetLibsshSession *sess) if (ssh_channel_request_exec(sess->channel, sess->channelCommand) != SSH_OK) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("failed to execute command '%s': %s"), + _("failed to execute command '%1$s': %2$s"), sess->channelCommand, errmsg); return -1; @@ -1058,7 +1054,7 @@ virNetLibsshSessionConnect(virNetLibsshSession *sess, if (ret < 0) { errmsg = ssh_get_error(sess->session); virReportError(VIR_ERR_NO_CONNECT, - _("SSH session handshake failed: %s"), + _("SSH session handshake failed: %1$s"), errmsg); goto error; } @@ -1103,8 +1099,7 @@ virNetLibsshChannelRead(virNetLibsshSession *sess, if (sess->state != VIR_NET_LIBSSH_STATE_HANDSHAKE_COMPLETE) { if (sess->state == VIR_NET_LIBSSH_STATE_ERROR_REMOTE) virReportError(VIR_ERR_LIBSSH, - _("Remote program terminated " - "with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), sess->channelCommandReturnValue); else virReportError(VIR_ERR_LIBSSH, "%s", @@ -1189,7 +1184,7 @@ virNetLibsshChannelRead(virNetLibsshSession *sess, eof: if (ssh_channel_get_exit_status(sess->channel)) { virReportError(VIR_ERR_LIBSSH, - _("Remote command terminated with non-zero code: %d"), + _("Remote command terminated with non-zero code: %1$d"), ssh_channel_get_exit_status(sess->channel)); sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel); sess->state = VIR_NET_LIBSSH_STATE_ERROR_REMOTE; @@ -1224,7 +1219,7 @@ virNetLibsshChannelWrite(virNetLibsshSession *sess, if (sess->state != VIR_NET_LIBSSH_STATE_HANDSHAKE_COMPLETE) { if (sess->state == VIR_NET_LIBSSH_STATE_ERROR_REMOTE) virReportError(VIR_ERR_LIBSSH, - _("Remote program terminated with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), sess->channelCommandReturnValue); else virReportError(VIR_ERR_LIBSSH, "%s", @@ -1236,7 +1231,7 @@ virNetLibsshChannelWrite(virNetLibsshSession *sess, if (ssh_channel_is_eof(sess->channel)) { if (ssh_channel_get_exit_status(sess->channel)) { virReportError(VIR_ERR_LIBSSH, - _("Remote program terminated with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), ssh_channel_get_exit_status(sess->channel)); sess->state = VIR_NET_LIBSSH_STATE_ERROR_REMOTE; sess->channelCommandReturnValue = ssh_channel_get_exit_status(sess->channel); @@ -1261,7 +1256,7 @@ virNetLibsshChannelWrite(virNetLibsshSession *sess, sess->state = VIR_NET_LIBSSH_STATE_ERROR; msg = ssh_get_error(sess->session); virReportError(VIR_ERR_LIBSSH, - _("write failed: %s"), msg); + _("write failed: %1$s"), msg); } cleanup: diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index c9698fb263..50cc335fd6 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -141,7 +141,7 @@ int virNetMessageDecodeLength(virNetMessage *msg) if (len < VIR_NET_MESSAGE_LEN_MAX) { virReportError(VIR_ERR_RPC, - _("packet %d bytes received from server too small, want %d"), + _("packet %1$d bytes received from server too small, want %2$d"), len, VIR_NET_MESSAGE_LEN_MAX); goto cleanup; } @@ -151,7 +151,7 @@ int virNetMessageDecodeLength(virNetMessage *msg) if (len > VIR_NET_MESSAGE_MAX) { virReportError(VIR_ERR_RPC, - _("packet %d bytes received from server too large, want %d"), + _("packet %1$d bytes received from server too large, want %2$d"), len, VIR_NET_MESSAGE_MAX); goto cleanup; } @@ -287,7 +287,7 @@ int virNetMessageEncodeNumFDs(virNetMessage *msg) if (numFDs > VIR_NET_MESSAGE_NUM_FDS_MAX) { virReportError(VIR_ERR_RPC, - _("Too many FDs to send %d, expected %d maximum"), + _("Too many FDs to send %1$d, expected %2$d maximum"), numFDs, VIR_NET_MESSAGE_NUM_FDS_MAX); goto cleanup; } @@ -325,7 +325,7 @@ int virNetMessageDecodeNumFDs(virNetMessage *msg) if (numFDs > VIR_NET_MESSAGE_NUM_FDS_MAX) { virReportError(VIR_ERR_RPC, - _("Received too many FDs %d, expected %d maximum"), + _("Received too many FDs %1$d, expected %2$d maximum"), numFDs, VIR_NET_MESSAGE_NUM_FDS_MAX); goto cleanup; } @@ -457,8 +457,7 @@ int virNetMessageEncodePayloadRaw(virNetMessage *msg, if ((msg->bufferOffset + len) > (VIR_NET_MESSAGE_MAX + VIR_NET_MESSAGE_LEN_MAX)) { virReportError(VIR_ERR_RPC, - _("Stream data too long to send " - "(%zu bytes needed, %zu bytes available)"), + _("Stream data too long to send (%1$zu bytes needed, %2$zu bytes available)"), len, VIR_NET_MESSAGE_MAX + VIR_NET_MESSAGE_LEN_MAX - @@ -549,20 +548,20 @@ int virNetMessageDupFD(virNetMessage *msg, if (slot >= msg->nfds) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("No FD available at slot %zu"), slot); + _("No FD available at slot %1$zu"), slot); return -1; } if ((fd = dup(msg->fds[slot])) < 0) { virReportSystemError(errno, - _("Unable to duplicate FD %d"), + _("Unable to duplicate FD %1$d"), msg->fds[slot]); return -1; } if (virSetInherit(fd, false) < 0) { VIR_FORCE_CLOSE(fd); virReportSystemError(errno, - _("Cannot set close-on-exec %d"), + _("Cannot set close-on-exec %1$d"), fd); return -1; } @@ -576,14 +575,14 @@ int virNetMessageAddFD(virNetMessage *msg, if ((newfd = dup(fd)) < 0) { virReportSystemError(errno, - _("Unable to duplicate FD %d"), + _("Unable to duplicate FD %1$d"), fd); goto error; } if (virSetInherit(newfd, false) < 0) { virReportSystemError(errno, - _("Cannot set close-on-exec %d"), + _("Cannot set close-on-exec %1$d"), newfd); goto error; } diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c index dbf777cfa3..7151225cc3 100644 --- a/src/rpc/virnetsaslcontext.c +++ b/src/rpc/virnetsaslcontext.c @@ -78,7 +78,7 @@ static int virNetSASLContextClientOnceInit(void) int err = sasl_client_init(NULL); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("failed to initialize SASL library: %d (%s)"), + _("failed to initialize SASL library: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); return -1; } @@ -94,7 +94,7 @@ static int virNetSASLContextServerOnceInit(void) int err = sasl_server_init(NULL, "libvirt"); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("failed to initialize SASL library: %d (%s)"), + _("failed to initialize SASL library: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); return -1; } @@ -162,7 +162,7 @@ int virNetSASLContextCheckIdentity(virNetSASLContext *ctxt, } /* Denied */ - VIR_ERROR(_("SASL client identity '%s' not allowed by ACL"), identity); + VIR_ERROR(_("SASL client identity '%1$s' not allowed by ACL"), identity); /* This is the most common error: make it informative. */ virReportError(VIR_ERR_SYSTEM_ERROR, "%s", @@ -206,7 +206,7 @@ virNetSASLSession *virNetSASLSessionNewClient(virNetSASLContext *ctxt G_GNUC_UNU &sasl->conn); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to create SASL client context: %d (%s)"), + _("Failed to create SASL client context: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } @@ -243,7 +243,7 @@ virNetSASLSession *virNetSASLSessionNewServer(virNetSASLContext *ctxt G_GNUC_UNU &sasl->conn); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to create SASL client context: %d (%s)"), + _("Failed to create SASL client context: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } @@ -265,7 +265,7 @@ int virNetSASLSessionExtKeySize(virNetSASLSession *sasl, err = sasl_setprop(sasl->conn, SASL_SSF_EXTERNAL, &ssf); if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot set external SSF %d (%s)"), + _("cannot set external SSF %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } @@ -286,7 +286,7 @@ const char *virNetSASLSessionGetIdentity(virNetSASLSession *sasl) err = sasl_getprop(sasl->conn, SASL_USERNAME, &val); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("cannot query SASL username on connection %d (%s)"), + _("cannot query SASL username on connection %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); val = NULL; goto cleanup; @@ -314,7 +314,7 @@ int virNetSASLSessionGetKeySize(virNetSASLSession *sasl) err = sasl_getprop(sasl->conn, SASL_SSF, &val); if (err != SASL_OK) { virReportError(VIR_ERR_AUTH_FAILED, - _("cannot query SASL ssf on connection %d (%s)"), + _("cannot query SASL ssf on connection %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); ssf = -1; goto cleanup; @@ -350,7 +350,7 @@ int virNetSASLSessionSecProps(virNetSASLSession *sasl, err = sasl_setprop(sasl->conn, SASL_SEC_PROPS, &secprops); if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot set security props %d (%s)"), + _("cannot set security props %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } @@ -374,7 +374,7 @@ static int virNetSASLSessionUpdateBufSize(virNetSASLSession *sasl) err = sasl_getprop(sasl->conn, SASL_MAXOUTBUF, &u.ptr); if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot get security props %d (%s)"), + _("cannot get security props %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); return -1; } @@ -402,7 +402,7 @@ char *virNetSASLSessionListMechanisms(virNetSASLSession *sasl) NULL); if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot list SASL mechanisms %d (%s)"), + _("cannot list SASL mechanisms %1$d (%2$s)"), err, sasl_errdetail(sasl->conn)); goto cleanup; } @@ -458,7 +458,7 @@ int virNetSASLSessionClientStart(virNetSASLSession *sasl, break; default: virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to start SASL negotiation: %d (%s)"), + _("Failed to start SASL negotiation: %1$d (%2$s)"), err, sasl_errdetail(sasl->conn)); break; } @@ -507,7 +507,7 @@ int virNetSASLSessionClientStep(virNetSASLSession *sasl, break; default: virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to step SASL negotiation: %d (%s)"), + _("Failed to step SASL negotiation: %1$d (%2$s)"), err, sasl_errdetail(sasl->conn)); break; } @@ -553,7 +553,7 @@ int virNetSASLSessionServerStart(virNetSASLSession *sasl, break; default: virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to start SASL negotiation: %d (%s)"), + _("Failed to start SASL negotiation: %1$d (%2$s)"), err, sasl_errdetail(sasl->conn)); break; } @@ -598,7 +598,7 @@ int virNetSASLSessionServerStep(virNetSASLSession *sasl, break; default: virReportError(VIR_ERR_AUTH_FAILED, - _("Failed to start SASL negotiation: %d (%s)"), + _("Failed to start SASL negotiation: %1$d (%2$s)"), err, sasl_errdetail(sasl->conn)); break; } @@ -631,7 +631,7 @@ ssize_t virNetSASLSessionEncode(virNetSASLSession *sasl, virObjectLock(sasl); if (inputLen > sasl->maxbufsize) { virReportSystemError(EINVAL, - _("SASL data length %zu too long, max %zu"), + _("SASL data length %1$zu too long, max %2$zu"), inputLen, sasl->maxbufsize); goto cleanup; } @@ -645,7 +645,7 @@ ssize_t virNetSASLSessionEncode(virNetSASLSession *sasl, if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to encode SASL data: %d (%s)"), + _("failed to encode SASL data: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } @@ -670,7 +670,7 @@ ssize_t virNetSASLSessionDecode(virNetSASLSession *sasl, virObjectLock(sasl); if (inputLen > sasl->maxbufsize) { virReportSystemError(EINVAL, - _("SASL data length %zu too long, max %zu"), + _("SASL data length %1$zu too long, max %2$zu"), inputLen, sasl->maxbufsize); goto cleanup; } @@ -683,7 +683,7 @@ ssize_t virNetSASLSessionDecode(virNetSASLSession *sasl, *outputlen = outlen; if (err != SASL_OK) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to decode SASL data: %d (%s)"), + _("failed to decode SASL data: %1$d (%2$s)"), err, sasl_errstring(err, NULL, NULL)); goto cleanup; } diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index e97dfe8136..7233629f22 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -1110,7 +1110,7 @@ virNetServerGetClient(virNetServer *srv, return virObjectRef(client); } - virReportError(VIR_ERR_NO_CLIENT, _("No client with matching ID '%llu'"), id); + virReportError(VIR_ERR_NO_CLIENT, _("No client with matching ID '%1$llu'"), id); return NULL; } diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index bdb3552c5d..c0c018b6be 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -1116,7 +1116,7 @@ static ssize_t virNetServerClientRead(virNetServerClient *client) if (client->rx->bufferLength <= client->rx->bufferOffset) { virReportError(VIR_ERR_RPC, - _("unexpected zero/negative length request %lld"), + _("unexpected zero/negative length request %1$lld"), (long long int)(client->rx->bufferLength - client->rx->bufferOffset)); client->wantClose = true; return -1; @@ -1289,7 +1289,7 @@ static ssize_t virNetServerClientWrite(virNetServerClient *client) if (client->tx->bufferLength < client->tx->bufferOffset) { virReportError(VIR_ERR_RPC, - _("unexpected zero/negative length request %lld"), + _("unexpected zero/negative length request %1$lld"), (long long int)(client->tx->bufferLength - client->tx->bufferOffset)); client->wantClose = true; return -1; diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c index 58b6a278ca..2cce188a09 100644 --- a/src/rpc/virnetserverprogram.c +++ b/src/rpc/virnetserverprogram.c @@ -232,7 +232,7 @@ int virNetServerProgramUnknownError(virNetServerClient *client, virNetMessageError rerr; virReportError(VIR_ERR_RPC, - _("Cannot find program %d version %d"), req->prog, req->vers); + _("Cannot find program %1$d version %2$d"), req->prog, req->vers); memset(&rerr, 0, sizeof(rerr)); return virNetServerProgramSendError(req->prog, @@ -284,14 +284,14 @@ int virNetServerProgramDispatch(virNetServerProgram *prog, /* Check version, etc. */ if (msg->header.prog != prog->program) { virReportError(VIR_ERR_RPC, - _("program mismatch (actual %x, expected %x)"), + _("program mismatch (actual %1$x, expected %2$x)"), msg->header.prog, prog->program); goto error; } if (msg->header.vers != prog->version) { virReportError(VIR_ERR_RPC, - _("version mismatch (actual %x, expected %x)"), + _("version mismatch (actual %1$x, expected %2$x)"), msg->header.vers, prog->version); goto error; } @@ -323,7 +323,7 @@ int virNetServerProgramDispatch(virNetServerProgram *prog, case VIR_NET_STREAM_HOLE: default: virReportError(VIR_ERR_RPC, - _("Unexpected message type %u"), + _("Unexpected message type %1$u"), msg->header.type); goto error; } @@ -377,7 +377,7 @@ virNetServerProgramDispatchCall(virNetServerProgram *prog, if (msg->header.status != VIR_NET_OK) { virReportError(VIR_ERR_RPC, - _("Unexpected message status %u"), + _("Unexpected message status %1$u"), msg->header.status); goto error; } @@ -386,7 +386,7 @@ virNetServerProgramDispatchCall(virNetServerProgram *prog, if (!dispatcher) { virReportError(VIR_ERR_RPC, - _("unknown procedure: %d"), + _("unknown procedure: %1$d"), msg->header.proc); goto error; } diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index b248ce24dc..910fb8dd67 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -162,7 +162,7 @@ virNetSocketCheckProtocolByLookup(const char *address, gaierr == EAI_NONAME) { } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot resolve %s address: %s"), + _("Cannot resolve %1$s address: %2$s"), address, gai_strerror(gaierr)); return -1; @@ -346,7 +346,7 @@ int virNetSocketNewListenTCP(const char *nodename, e = getaddrinfo(nodename, service, &hints, &ai); if (e != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to resolve address '%s' service '%s': %s"), + _("Unable to resolve address '%1$s' service '%2$s': %3$s"), nodename, service, gai_strerror(e)); return -1; } @@ -495,7 +495,7 @@ int virNetSocketNewListenUNIX(const char *path, addr.data.un.sun_family = AF_UNIX; if (virStrcpyStatic(addr.data.un.sun_path, path) < 0) { virReportSystemError(ENAMETOOLONG, - _("Path %s too long for unix socket"), path); + _("Path %1$s too long for unix socket"), path); goto error; } if (addr.data.un.sun_path[0] == '@') @@ -508,7 +508,7 @@ int virNetSocketNewListenUNIX(const char *path, if (bind(fd, &addr.data.sa, addr.len) < 0) { umask(oldmask); virReportSystemError(errno, - _("Failed to bind socket to '%s'"), + _("Failed to bind socket to '%1$s'"), path); goto error; } @@ -519,7 +519,7 @@ int virNetSocketNewListenUNIX(const char *path, */ if (grp != 0 && chown(path, user, grp)) { virReportSystemError(errno, - _("Failed to change ownership of '%s' to %d:%d"), + _("Failed to change ownership of '%1$s' to %2$d:%3$d"), path, (int)user, (int)grp); goto error; } @@ -598,7 +598,7 @@ int virNetSocketNewConnectTCP(const char *nodename, e = getaddrinfo(nodename, service, &hints, &ai); if (e != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to resolve address '%s' service '%s': %s"), + _("Unable to resolve address '%1$s' service '%2$s': %3$s"), nodename, service, gai_strerror(e)); return -1; } @@ -625,7 +625,7 @@ int virNetSocketNewConnectTCP(const char *nodename, if (fd == -1) { virReportSystemError(savedErrno, - _("unable to connect to server at '%s:%s'"), + _("unable to connect to server at '%1$s:%2$s'"), nodename, service); goto error; } @@ -685,7 +685,7 @@ int virNetSocketNewConnectUNIX(const char *path, if (g_mkdir_with_parents(rundir, 0700) < 0) { virReportSystemError(errno, - _("Cannot create user runtime directory '%s'"), + _("Cannot create user runtime directory '%1$s'"), rundir); goto cleanup; } @@ -694,12 +694,12 @@ int virNetSocketNewConnectUNIX(const char *path, if ((lockfd = open(lockpath, O_RDWR | O_CREAT, 0600)) < 0 || virSetCloseExec(lockfd) < 0) { - virReportSystemError(errno, _("Unable to create lock '%s'"), lockpath); + virReportSystemError(errno, _("Unable to create lock '%1$s'"), lockpath); goto cleanup; } if (virFileLock(lockfd, false, 0, 1, true) < 0) { - virReportSystemError(errno, _("Unable to lock '%s'"), lockpath); + virReportSystemError(errno, _("Unable to lock '%1$s'"), lockpath); goto cleanup; } } @@ -711,7 +711,7 @@ int virNetSocketNewConnectUNIX(const char *path, remoteAddr.data.un.sun_family = AF_UNIX; if (virStrcpyStatic(remoteAddr.data.un.sun_path, path) < 0) { - virReportSystemError(ENOMEM, _("Path %s too long for unix socket"), path); + virReportSystemError(ENOMEM, _("Path %1$s too long for unix socket"), path); goto cleanup; } if (remoteAddr.data.un.sun_path[0] == '@') @@ -728,7 +728,7 @@ int virNetSocketNewConnectUNIX(const char *path, if (!spawnDaemonPath || retries == 0 || (errno != ENOENT && errno != ECONNREFUSED)) { - virReportSystemError(errno, _("Failed to connect socket to '%s'"), + virReportSystemError(errno, _("Failed to connect socket to '%1$s'"), path); goto cleanup; } @@ -924,7 +924,7 @@ virNetSocketNewConnectLibSSH2(const char *host, verify = VIR_NET_SSH_HOSTKEY_VERIFY_NORMAL; } else { virReportError(VIR_ERR_INVALID_ARG, - _("Invalid host key verification method: '%s'"), + _("Invalid host key verification method: '%1$s'"), knownHostsVerify); goto error; } @@ -955,7 +955,7 @@ virNetSocketNewConnectLibSSH2(const char *host, ret = virNetSSHSessionAuthAddAgentAuth(sess); } else { virReportError(VIR_ERR_INVALID_ARG, - _("Invalid authentication method: '%s'"), + _("Invalid authentication method: '%1$s'"), authMethod); ret = -1; goto error; @@ -1050,7 +1050,7 @@ virNetSocketNewConnectLibssh(const char *host, verify = VIR_NET_LIBSSH_HOSTKEY_VERIFY_NORMAL; } else { virReportError(VIR_ERR_INVALID_ARG, - _("Invalid host key verification method: '%s'"), + _("Invalid host key verification method: '%1$s'"), knownHostsVerify); goto error; } @@ -1080,7 +1080,7 @@ virNetSocketNewConnectLibssh(const char *host, ret = virNetLibsshSessionAuthAddAgentAuth(sess); } else { virReportError(VIR_ERR_INVALID_ARG, - _("Invalid authentication method: '%s'"), + _("Invalid authentication method: '%1$s'"), authMethod); ret = -1; goto error; @@ -1259,14 +1259,14 @@ virJSONValue *virNetSocketPreExecRestart(virNetSocket *sock) if (virSetInherit(sock->fd, true) < 0) { virReportSystemError(errno, - _("Cannot disable close-on-exec flag on socket %d"), + _("Cannot disable close-on-exec flag on socket %1$d"), sock->fd); goto error; } if (sock->errfd != -1 && virSetInherit(sock->errfd, true) < 0) { virReportSystemError(errno, - _("Cannot disable close-on-exec flag on pipe %d"), + _("Cannot disable close-on-exec flag on pipe %1$d"), sock->errfd); goto error; } @@ -1764,7 +1764,7 @@ static ssize_t virNetSocketReadWire(virNetSocket *sock, char *buf, size_t len) if (ret < 0) { if (errout) virReportSystemError(errno, - _("Cannot recv data: %s"), errout); + _("Cannot recv data: %1$s"), errout); else virReportSystemError(errno, "%s", _("Cannot recv data")); @@ -1778,7 +1778,7 @@ static ssize_t virNetSocketReadWire(virNetSocket *sock, char *buf, size_t len) } else { if (errout) virReportSystemError(EIO, - _("End of file while reading data: %s"), + _("End of file while reading data: %1$s"), errout); else virReportSystemError(EIO, "%s", @@ -1985,7 +1985,7 @@ int virNetSocketSendFD(virNetSocket *sock, int fd) ret = 0; else virReportSystemError(errno, - _("Failed to send file descriptor %d"), + _("Failed to send file descriptor %1$d"), fd); goto cleanup; } diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c index a3dd60f5a3..7bf27c161a 100644 --- a/src/rpc/virnetsshsession.c +++ b/src/rpc/virnetsshsession.c @@ -286,7 +286,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) if (!key) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("Failed to retrieve ssh host key: %s"), + _("Failed to retrieve ssh host key: %1$s"), errmsg); return -1; } @@ -346,7 +346,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) keyhashstr = virBufferContentAndReset(&buff); askKey.type = VIR_CRED_ECHOPROMPT; - askKey.prompt = g_strdup_printf(_("Accept SSH host key with hash '%s' for " "host '%s:%d' (%s/%s)?"), + askKey.prompt = g_strdup_printf(_("Accept SSH host key with hash '%1$s' for host '%2$s:%3$d' (%4$s/%5$s)?"), keyhashstr, sess->hostname, sess->port, "y", "n"); if (sess->cred->cb(&askKey, 1, sess->cred->cbdata)) { @@ -365,7 +365,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) if (!askKey.result || STRCASENEQ(askKey.result, "y")) { virReportError(VIR_ERR_SSH, - _("SSH host key for '%s' (%s) was not accepted"), + _("SSH host key for '%1$s' (%2$s) was not accepted"), sess->hostname, keyhashstr); VIR_FREE(keyhashstr); VIR_FREE(askKey.result); @@ -427,7 +427,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) NULL) < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("unable to add SSH host key for host '%s': %s"), + _("unable to add SSH host key for host '%1$s': %2$s"), hostnameStr, errmsg); VIR_FREE(hostnameStr); return -1; @@ -442,7 +442,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) LIBSSH2_KNOWNHOST_FILE_OPENSSH) < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("failed to write known_host file '%s': %s"), + _("failed to write known_host file '%1$s': %2$s"), sess->knownHostsFile, errmsg); return -1; @@ -458,10 +458,8 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) case LIBSSH2_KNOWNHOST_CHECK_MISMATCH: /* host key verification failed */ virReportError(VIR_ERR_AUTH_FAILED, - _("!!! SSH HOST KEY VERIFICATION FAILED !!!: " - "Identity of host '%s:%d' differs from stored identity. " - "Please verify the new host key '%s' to avoid possible " - "man in the middle attack. The key is stored in '%s'."), + _("!!! 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'."), sess->hostname, sess->port, knownHostEntry->key, sess->knownHostsFile); return -1; @@ -469,7 +467,7 @@ virNetSSHCheckHostKey(virNetSSHSession *sess) case LIBSSH2_KNOWNHOST_CHECK_FAILURE: libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("failed to validate SSH host key: %s"), + _("failed to validate SSH host key: %1$s"), errmsg); return -1; @@ -525,7 +523,7 @@ virNetSSHAuthenticateAgent(virNetSSHSession *sess) VIR_WARNINGS_RESET libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("failed to authenticate using SSH agent: %s"), + _("failed to authenticate using SSH agent: %1$s"), errmsg); return -1; } @@ -549,7 +547,7 @@ virNetSSHAuthenticateAgent(virNetSSHSession *sess) libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("failed to authenticate using SSH agent: %s"), + _("failed to authenticate using SSH agent: %1$s"), errmsg); return -1; } @@ -586,8 +584,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSession *sess, VIR_WARNINGS_RESET libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication with private key '%s' " - "has failed: %s"), + _("authentication with private key '%1$s' has failed: %2$s"), priv->filename, errmsg); return 1; /* auth failed */ } @@ -617,7 +614,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSession *sess, return -1; } - retr_passphrase.prompt = g_strdup_printf(_("Passphrase for key '%s'"), + retr_passphrase.prompt = g_strdup_printf(_("Passphrase for key '%1$s'"), priv->filename); if (sess->cred->cb(&retr_passphrase, 1, sess->cred->cbdata)) { @@ -643,8 +640,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSession *sess, if (ret < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication with private key '%s' " - "has failed: %s"), + _("authentication with private key '%1$s' has failed: %2$s"), priv->filename, errmsg); VIR_WARNINGS_NO_WLOGICALOP_EQUAL_EXPR @@ -709,7 +705,7 @@ virNetSSHAuthenticatePassword(virNetSSHSession *sess) /* error path */ libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("authentication failed: %s"), errmsg); + _("authentication failed: %1$s"), errmsg); /* determine exist status */ if (rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED) @@ -781,14 +777,14 @@ virNetSSHAuthenticateKeyboardInteractive(virNetSSHSession *sess, if (ret < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("keyboard interactive authentication failed: %s"), + _("keyboard interactive authentication failed: %1$s"), errmsg); return -1; } } libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, - _("keyboard interactive authentication failed: %s"), + _("keyboard interactive authentication failed: %1$s"), errmsg); return 1; } @@ -824,7 +820,7 @@ virNetSSHAuthenticate(virNetSSHSession *sess) libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("couldn't retrieve authentication methods list: %s"), + _("couldn't retrieve authentication methods list: %1$s"), errmsg); return -1; } @@ -895,7 +891,7 @@ virNetSSHOpenChannel(virNetSSHSession *sess) if (!sess->channel) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("failed to open ssh channel: %s"), + _("failed to open ssh channel: %1$s"), errmsg); return -1; } @@ -903,7 +899,7 @@ virNetSSHOpenChannel(virNetSSHSession *sess) if (libssh2_channel_exec(sess->channel, sess->channelCommand) != 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("failed to execute command '%s': %s"), + _("failed to execute command '%1$s': %2$s"), sess->channelCommand, errmsg); return -1; @@ -1080,13 +1076,13 @@ virNetSSHSessionSetHostKeyVerification(virNetSSHSession *sess, LIBSSH2_KNOWNHOST_FILE_OPENSSH) < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_SSH, - _("unable to load knownhosts file '%s': %s"), + _("unable to load knownhosts file '%1$s': %2$s"), hostsfile, errmsg); goto error; } } else if (!(flags & VIR_NET_SSH_HOSTKEY_FILE_CREATE)) { virReportError(VIR_ERR_SSH, - _("known hosts file '%s' does not exist"), + _("known hosts file '%1$s' does not exist"), hostsfile); goto error; } @@ -1186,7 +1182,7 @@ virNetSSHSessionConnect(virNetSSHSession *sess, if (ret < 0) { libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_NO_CONNECT, - _("SSH session handshake failed: %s"), + _("SSH session handshake failed: %1$s"), errmsg); goto error; } @@ -1231,8 +1227,7 @@ virNetSSHChannelRead(virNetSSHSession *sess, if (sess->state != VIR_NET_SSH_STATE_HANDSHAKE_COMPLETE) { if (sess->state == VIR_NET_SSH_STATE_ERROR_REMOTE) virReportError(VIR_ERR_SSH, - _("Remote program terminated " - "with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), sess->channelCommandReturnValue); else virReportError(VIR_ERR_SSH, "%s", @@ -1307,7 +1302,7 @@ virNetSSHChannelRead(virNetSSHSession *sess, if (libssh2_channel_eof(sess->channel)) { if (libssh2_channel_get_exit_status(sess->channel)) { virReportError(VIR_ERR_SSH, - _("Remote command terminated with non-zero code: %d"), + _("Remote command terminated with non-zero code: %1$d"), libssh2_channel_get_exit_status(sess->channel)); sess->channelCommandReturnValue = libssh2_channel_get_exit_status(sess->channel); sess->state = VIR_NET_SSH_STATE_ERROR_REMOTE; @@ -1342,7 +1337,7 @@ virNetSSHChannelWrite(virNetSSHSession *sess, if (sess->state != VIR_NET_SSH_STATE_HANDSHAKE_COMPLETE) { if (sess->state == VIR_NET_SSH_STATE_ERROR_REMOTE) virReportError(VIR_ERR_SSH, - _("Remote program terminated with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), sess->channelCommandReturnValue); else virReportError(VIR_ERR_SSH, "%s", @@ -1354,7 +1349,7 @@ virNetSSHChannelWrite(virNetSSHSession *sess, if (libssh2_channel_eof(sess->channel)) { if (libssh2_channel_get_exit_status(sess->channel)) { virReportError(VIR_ERR_SSH, - _("Remote program terminated with non-zero code: %d"), + _("Remote program terminated with non-zero code: %1$d"), libssh2_channel_get_exit_status(sess->channel)); sess->state = VIR_NET_SSH_STATE_ERROR_REMOTE; sess->channelCommandReturnValue = libssh2_channel_get_exit_status(sess->channel); @@ -1379,7 +1374,7 @@ virNetSSHChannelWrite(virNetSSHSession *sess, sess->state = VIR_NET_SSH_STATE_ERROR; libssh2_session_last_error(sess->session, &msg, NULL, 0); virReportError(VIR_ERR_SSH, - _("write failed: %s"), msg); + _("write failed: %1$s"), msg); } cleanup: diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index cfd26f0701..f72597ee80 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -103,7 +103,7 @@ virNetTLSContextCheckCertFile(const char *type, const char *file, bool allowMiss return 1; virReportSystemError(errno, - _("Cannot read %s '%s'"), + _("Cannot read %1$s '%2$s'"), type, file); return -1; } @@ -134,10 +134,10 @@ static int virNetTLSContextCheckCertTimes(gnutls_x509_crt_t cert, if (gnutls_x509_crt_get_expiration_time(cert) < now) { virReportError(VIR_ERR_SYSTEM_ERROR, (isCA ? - _("The CA certificate %s has expired") : + _("The CA certificate %1$s has expired") : (isServer ? - _("The server certificate %s has expired") : - _("The client certificate %s has expired"))), + _("The server certificate %1$s has expired") : + _("The client certificate %1$s has expired"))), certFile); return -1; } @@ -145,10 +145,10 @@ static int virNetTLSContextCheckCertTimes(gnutls_x509_crt_t cert, if (gnutls_x509_crt_get_activation_time(cert) > now) { virReportError(VIR_ERR_SYSTEM_ERROR, (isCA ? - _("The CA certificate %s is not yet active") : + _("The CA certificate %1$s is not yet active") : (isServer ? - _("The server certificate %s is not yet active") : - _("The client certificate %s is not yet active"))), + _("The server certificate %1$s is not yet active") : + _("The client certificate %1$s is not yet active"))), certFile); return -1; } @@ -170,28 +170,28 @@ static int virNetTLSContextCheckCertBasicConstraints(gnutls_x509_crt_t cert, if (status > 0) { /* It is a CA cert */ if (!isCA) { virReportError(VIR_ERR_SYSTEM_ERROR, isServer ? - _("The certificate %s basic constraints show a CA, but we need one for a server") : - _("The certificate %s basic constraints show a CA, but we need one for a client"), + _("The certificate %1$s basic constraints show a CA, but we need one for a server") : + _("The certificate %1$s basic constraints show a CA, but we need one for a client"), certFile); return -1; } } else if (status == 0) { /* It is not a CA cert */ if (isCA) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("The certificate %s basic constraints do not show a CA"), + _("The certificate %1$s basic constraints do not show a CA"), certFile); return -1; } } else if (status == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { /* Missing basicConstraints */ if (isCA) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("The certificate %s is missing basic constraints for a CA"), + _("The certificate %1$s is missing basic constraints for a CA"), certFile); return -1; } } else { /* General error */ virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to query certificate %s basic constraints %s"), + _("Unable to query certificate %1$s basic constraints %2$s"), certFile, gnutls_strerror(status)); return -1; } @@ -217,7 +217,7 @@ static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, GNUTLS_KEY_DIGITAL_SIGNATURE|GNUTLS_KEY_KEY_ENCIPHERMENT; } else { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to query certificate %s key usage %s"), + _("Unable to query certificate %1$s key usage %2$s"), certFile, gnutls_strerror(status)); return -1; } @@ -227,7 +227,7 @@ static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { if (critical) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %s usage does not permit certificate signing"), + _("Certificate %1$s usage does not permit certificate signing"), certFile); return -1; } else { @@ -239,7 +239,7 @@ static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, if (!(usage & GNUTLS_KEY_DIGITAL_SIGNATURE)) { if (critical) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %s usage does not permit digital signature"), + _("Certificate %1$s usage does not permit digital signature"), certFile); return -1; } else { @@ -250,7 +250,7 @@ static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, if (!(usage & GNUTLS_KEY_KEY_ENCIPHERMENT)) { if (critical) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %s usage does not permit key encipherment"), + _("Certificate %1$s usage does not permit key encipherment"), certFile); return -1; } else { @@ -291,7 +291,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, } if (status != GNUTLS_E_SHORT_MEMORY_BUFFER) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to query certificate %s key purpose %s"), + _("Unable to query certificate %1$s key purpose %2$s"), certFile, gnutls_strerror(status)); return -1; } @@ -301,7 +301,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, if (status < 0) { VIR_FREE(buffer); virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to query certificate %s key purpose %s"), + _("Unable to query certificate %1$s key purpose %2$s"), certFile, gnutls_strerror(status)); return -1; } @@ -324,7 +324,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, if (!allowServer) { if (critical) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %s purpose does not allow use for with a TLS server"), + _("Certificate %1$s purpose does not allow use for with a TLS server"), certFile); return -1; } else { @@ -336,7 +336,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, if (!allowClient) { if (critical) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate %s purpose does not allow use for with a TLS client"), + _("Certificate %1$s purpose does not allow use for with a TLS client"), certFile); return -1; } else { @@ -389,7 +389,7 @@ virNetTLSContextCheckCertDN(gnutls_x509_crt_t cert, if (hostname && !gnutls_x509_crt_check_hostname(cert, hostname)) { virReportError(VIR_ERR_RPC, - _("Certificate %s owner does not match the hostname %s"), + _("Certificate %1$s owner does not match the hostname %2$s"), certFile, hostname); return -1; } @@ -438,8 +438,8 @@ static int virNetTLSContextCheckCertPair(gnutls_x509_crt_t cert, NULL, 0, 0, &status) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, isServer ? - _("Unable to verify server certificate %s against CA certificate %s") : - _("Unable to verify client certificate %s against CA certificate %s"), + _("Unable to verify server certificate %1$s against CA certificate %2$s") : + _("Unable to verify client certificate %1$s against CA certificate %2$s"), certFile, cacertFile); return -1; } @@ -460,7 +460,7 @@ static int virNetTLSContextCheckCertPair(gnutls_x509_crt_t cert, reason = _("The certificate uses an insecure algorithm"); virReportError(VIR_ERR_SYSTEM_ERROR, - _("Our own certificate %s failed validation against %s: %s"), + _("Our own certificate %1$s failed validation against %2$s: %3$s"), certFile, cacertFile, reason); return -1; } @@ -494,8 +494,8 @@ static gnutls_x509_crt_t virNetTLSContextLoadCertFromFile(const char *certFile, if (gnutls_x509_crt_import(cert, &data, GNUTLS_X509_FMT_PEM) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, isServer ? - _("Unable to import server certificate %s") : - _("Unable to import client certificate %s"), + _("Unable to import server certificate %1$s") : + _("Unable to import client certificate %1$s"), certFile); goto cleanup; } @@ -529,7 +529,7 @@ static int virNetTLSContextLoadCACertListFromFile(const char *certFile, if (gnutls_x509_crt_list_import(certs, &certMax, &data, GNUTLS_X509_FMT_PEM, 0) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to import CA certificate list %s"), + _("Unable to import CA certificate list %1$s"), certFile); return -1; } @@ -602,7 +602,7 @@ static int virNetTLSContextLoadCredentials(virNetTLSContext *ctxt, GNUTLS_X509_FMT_PEM); if (err < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to set x509 CA certificate: %s: %s"), + _("Unable to set x509 CA certificate: %1$s: %2$s"), cacert, gnutls_strerror(err)); return -1; } @@ -620,7 +620,7 @@ static int virNetTLSContextLoadCredentials(virNetTLSContext *ctxt, GNUTLS_X509_FMT_PEM); if (err < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to set x509 certificate revocation list: %s: %s"), + _("Unable to set x509 certificate revocation list: %1$s: %2$s"), cacrl, gnutls_strerror(err)); return -1; } @@ -645,7 +645,7 @@ static int virNetTLSContextLoadCredentials(virNetTLSContext *ctxt, GNUTLS_X509_FMT_PEM); if (err < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to set x509 key and certificate: %s, %s: %s"), + _("Unable to set x509 key and certificate: %1$s, %2$s: %3$s"), key, cert, gnutls_strerror(err)); return -1; } @@ -690,7 +690,7 @@ static virNetTLSContext *virNetTLSContextNew(const char *cacert, ctxt->x509cred = NULL; virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to allocate x509 credentials: %s"), + _("Unable to allocate x509 credentials: %1$s"), gnutls_strerror(err)); goto error; } @@ -896,7 +896,7 @@ int virNetTLSContextReloadForServer(virNetTLSContext *ctxt, err = gnutls_certificate_allocate_credentials(&ctxt->x509cred); if (err) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to allocate x509 credentials: %s"), + _("Unable to allocate x509 credentials: %1$s"), gnutls_strerror(err)); goto error; } @@ -946,7 +946,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContext *ctxt, if ((ret = gnutls_certificate_verify_peers2(sess->session, &status)) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Unable to verify TLS peer: %s"), + _("Unable to verify TLS peer: %1$s"), gnutls_strerror(ret)); goto authdeny; } @@ -967,7 +967,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContext *ctxt, reason = _("The certificate uses an insecure algorithm"); virReportError(VIR_ERR_SYSTEM_ERROR, - _("Certificate failed validation: %s"), + _("Certificate failed validation: %1$s"), reason); goto authdeny; } @@ -1016,7 +1016,7 @@ static int virNetTLSContextValidCertificate(virNetTLSContext *ctxt, } if (ret != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Failed to get certificate %s distinguished name: %s"), + _("Failed to get certificate %1$s distinguished name: %2$s"), "[session]", gnutls_strerror(ret)); goto authfail; } @@ -1160,7 +1160,7 @@ virNetTLSSession *virNetTLSSessionNew(virNetTLSContext *ctxt, if ((err = gnutls_init(&sess->session, ctxt->isServer ? GNUTLS_SERVER : GNUTLS_CLIENT)) != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Failed to initialize TLS session: %s"), + _("Failed to initialize TLS session: %1$s"), gnutls_strerror(err)); goto error; } @@ -1174,7 +1174,7 @@ virNetTLSSession *virNetTLSSessionNew(virNetTLSContext *ctxt, priority, NULL)) != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Failed to set TLS session priority to %s: %s"), + _("Failed to set TLS session priority to %1$s: %2$s"), priority, gnutls_strerror(err)); goto error; } @@ -1183,7 +1183,7 @@ virNetTLSSession *virNetTLSSessionNew(virNetTLSContext *ctxt, GNUTLS_CRD_CERTIFICATE, ctxt->x509cred)) != 0) { virReportError(VIR_ERR_SYSTEM_ERROR, - _("Failed set TLS x509 credentials: %s"), + _("Failed set TLS x509 credentials: %1$s"), gnutls_strerror(err)); goto error; } @@ -1313,7 +1313,7 @@ int virNetTLSSessionHandshake(virNetTLSSession *sess) #endif virReportError(VIR_ERR_AUTH_FAILED, - _("TLS handshake failed %s"), + _("TLS handshake failed %1$s"), gnutls_strerror(ret)); ret = -1; -- 2.39.2