mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
error: mark most string arguments for translation
Also mark some arguments to __virRaiseError. * Makefile.maint (msg_gen_function): Add error. * po/POTFILES.in: Add src/openvz_conf.c and src/openvz_driver.c. * src/openvz_conf.c (openvzParseXML, openvzGetVPSInfo): Mark strings. * src/openvz_driver.c (openvzDomainLookupByID): Likewise. (openvzDomainLookupByUUID, openvzDomainLookupByName): Likewise. (openvzDomainGetInfo, openvzDomainShutdown, openvzDomainReboot) (openvzDomainCreate, openvzDomainUndefine): Likewise. * src/remote_internal.c (check_cert_file): Likewise. (negotiate_gnutls_on_connection, verify_certificate): Likewise. (remoteAuthenticate, addrToString, remoteAuthSASL): Likewise. (remoteAuthPolkit, call, really_read_buf): Likewise.
This commit is contained in:
parent
f1eed04b2d
commit
5bb81e1d87
14
ChangeLog
14
ChangeLog
@ -1,5 +1,19 @@
|
||||
Thu Mar 27 14:36:56 CET 2008 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
error: mark most string arguments for translation
|
||||
Also mark some arguments to __virRaiseError.
|
||||
* Makefile.maint (msg_gen_function): Add error.
|
||||
* po/POTFILES.in: Add src/openvz_conf.c and src/openvz_driver.c.
|
||||
* src/openvz_conf.c (openvzParseXML, openvzGetVPSInfo): Mark strings.
|
||||
* src/openvz_driver.c (openvzDomainLookupByID): Likewise.
|
||||
(openvzDomainLookupByUUID, openvzDomainLookupByName): Likewise.
|
||||
(openvzDomainGetInfo, openvzDomainShutdown, openvzDomainReboot)
|
||||
(openvzDomainCreate, openvzDomainUndefine): Likewise.
|
||||
* src/remote_internal.c (check_cert_file): Likewise.
|
||||
(negotiate_gnutls_on_connection, verify_certificate): Likewise.
|
||||
(remoteAuthenticate, addrToString, remoteAuthSASL): Likewise.
|
||||
(remoteAuthPolkit, call, really_read_buf): Likewise.
|
||||
|
||||
Convert diagnostics like "VAR > MAX_VAR" to translatable messages.
|
||||
* src/remote_internal.c (errorf): New function.
|
||||
(remoteListDomains, remoteDomainPinVcpu, remoteDomainGetVcpus):
|
||||
|
@ -316,10 +316,12 @@ msg_gen_function += xenXMError
|
||||
msg_gen_function += ReportError
|
||||
msg_gen_function += qemudReportError
|
||||
|
||||
# Uncomment this after adjusting remaining diagnostics to be translatable.
|
||||
# msg_gen_function += error
|
||||
|
||||
# msg_gen_function += virXenError
|
||||
# msg_gen_function += testError
|
||||
# msg_gen_function += openvzLog
|
||||
# msg_gen_function += error
|
||||
|
||||
func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
|
||||
func_re := ($(func_or))
|
||||
|
@ -8,6 +8,8 @@ src/iptables.c
|
||||
src/libvirt.c
|
||||
src/lxc_conf.c
|
||||
src/lxc_driver.c
|
||||
src/openvz_conf.c
|
||||
src/openvz_driver.c
|
||||
src/proxy_internal.c
|
||||
src/qemu_conf.c
|
||||
src/qemu_driver.c
|
||||
|
@ -307,7 +307,7 @@ static struct openvz_vm_def
|
||||
|
||||
root = xmlDocGetRootElement(xml);
|
||||
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "incorrect root element");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("incorrect root element"));
|
||||
goto bail_out;
|
||||
}
|
||||
|
||||
@ -319,12 +319,12 @@ static struct openvz_vm_def
|
||||
|
||||
/* Find out what type of OPENVZ virtualization to use */
|
||||
if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "missing domain type attribute");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("missing domain type attribute"));
|
||||
goto bail_out;
|
||||
}
|
||||
|
||||
if (strcmp((char *)prop, "openvz")){
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "invalid domain type attribute");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain type attribute"_));
|
||||
goto bail_out;
|
||||
}
|
||||
free(prop);
|
||||
@ -334,14 +334,14 @@ static struct openvz_vm_def
|
||||
obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
|
||||
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
|
||||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR,"invalid domain name");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("invalid domain name"));
|
||||
goto bail_out;
|
||||
}
|
||||
|
||||
/* rejecting VPS ID <= OPENVZ_RSRV_VM_LIMIT for they are reserved */
|
||||
if (strtoI((const char *) obj->stringval) <= OPENVZ_RSRV_VM_LIMIT) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"VPS ID Error (must be an integer greater than 100");
|
||||
_("VPS ID Error (must be an integer greater than 100"));
|
||||
goto bail_out;
|
||||
}
|
||||
strncpy(def->name, (const char *) obj->stringval, OPENVZ_NAME_MAX);
|
||||
@ -354,11 +354,11 @@ static struct openvz_vm_def
|
||||
int err;
|
||||
|
||||
if ((err = virUUIDGenerate(def->uuid))) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "Failed to generate UUID");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("Failed to generate UUID"));
|
||||
goto bail_out;
|
||||
}
|
||||
} else if (virUUIDParse((const char *)obj->stringval, def->uuid) < 0) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "malformed uuid element");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("malformed uuid element"));
|
||||
goto bail_out;
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
@ -389,7 +389,8 @@ static struct openvz_vm_def
|
||||
if (xmlStrlen(obj->stringval) >= (OPENVZ_IP_MAX)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "ipaddress length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
|
||||
_("ipaddress length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -411,7 +412,8 @@ static struct openvz_vm_def
|
||||
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "netmask length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s",
|
||||
_("netmask length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -427,7 +429,8 @@ static struct openvz_vm_def
|
||||
if (strlen((const char *) obj->stringval) >= (OPENVZ_HOSTNAME_MAX - 1)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "hostname length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
|
||||
"%s", _("hostname length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -444,7 +447,8 @@ static struct openvz_vm_def
|
||||
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "gateway length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
|
||||
"%s", _("gateway length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -461,7 +465,8 @@ static struct openvz_vm_def
|
||||
if (strlen((const char *) obj->stringval) >= (OPENVZ_IP_MAX)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "nameserver length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
|
||||
"%s", _("nameserver length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -483,7 +488,8 @@ static struct openvz_vm_def
|
||||
if (strlen((const char *) obj->stringval) >= (OPENVZ_PROFILE_MAX - 1)) {
|
||||
char errorMessage[OPENVZ_MAX_ERROR_LEN];
|
||||
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1, "%s", "profile length too long");
|
||||
snprintf(errorMessage, OPENVZ_MAX_ERROR_LEN - 1,
|
||||
"%s", _("profile length too long"));
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, errorMessage);
|
||||
goto bail_out;
|
||||
}
|
||||
@ -519,14 +525,14 @@ openvzGetVPSInfo(virConnectPtr conn) {
|
||||
driver->num_inactive = 0;
|
||||
|
||||
if((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "popen failed");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("popen failed"));
|
||||
return NULL;
|
||||
}
|
||||
pnext = &vm;
|
||||
while(!feof(fp)) {
|
||||
*pnext = calloc(1, sizeof(**pnext));
|
||||
if(!*pnext) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -535,7 +541,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
|
||||
|
||||
if (fscanf(fp, "%d %s\n", &veid, status) != 2) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"Failed to parse vzlist output");
|
||||
_("Failed to parse vzlist output"));
|
||||
goto error;
|
||||
}
|
||||
if(strcmp(status, "stopped")) {
|
||||
@ -555,7 +561,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
|
||||
|
||||
vmdef = calloc(1, sizeof(*vmdef));
|
||||
if(!vmdef) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "calloc failed");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("calloc failed"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -565,7 +571,7 @@ openvzGetVPSInfo(virConnectPtr conn) {
|
||||
|
||||
if(ret == -1) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR,
|
||||
"UUID in config file malformed");
|
||||
_("UUID in config file malformed"));
|
||||
free(vmdef);
|
||||
goto error;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn,
|
||||
virDomainPtr dom;
|
||||
|
||||
if (!vm) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching id");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching id"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn,
|
||||
virDomainPtr dom;
|
||||
|
||||
if (!vm) {
|
||||
error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
||||
error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn,
|
||||
virDomainPtr dom;
|
||||
|
||||
if (!vm) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "no domain with matching name");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("no domain with matching name"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -215,7 +215,8 @@ static int openvzDomainGetInfo(virDomainPtr dom,
|
||||
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
|
||||
|
||||
if (!vm) {
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN,
|
||||
_("no domain with matching uuid"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -238,12 +239,14 @@ static int openvzDomainShutdown(virDomainPtr dom) {
|
||||
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
|
||||
|
||||
if (!vm) {
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN,
|
||||
_("no domain with matching id"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vm->status != VIR_DOMAIN_RUNNING) {
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED,
|
||||
_("domain is not in running state"));
|
||||
return -1;
|
||||
}
|
||||
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " stop %d ", dom->id);
|
||||
@ -281,12 +284,14 @@ static int openvzDomainReboot(virDomainPtr dom,
|
||||
struct openvz_vm *vm = openvzFindVMByID(driver, dom->id);
|
||||
|
||||
if (!vm) {
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN,
|
||||
_("no domain with matching id"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vm->status != VIR_DOMAIN_RUNNING) {
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in running state");
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED,
|
||||
_("domain is not in running state"));
|
||||
return -1;
|
||||
}
|
||||
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " restart %d ", dom->id);
|
||||
@ -473,12 +478,14 @@ openvzDomainCreate(virDomainPtr dom)
|
||||
struct openvz_vm_def *vmdef;
|
||||
|
||||
if (!vm) {
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching id");
|
||||
error(dom->conn, VIR_ERR_INVALID_DOMAIN,
|
||||
_("no domain with matching id"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vm->status != VIR_DOMAIN_SHUTOFF) {
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED, "domain is not in shutoff state");
|
||||
error(dom->conn, VIR_ERR_OPERATION_DENIED,
|
||||
_("domain is not in shutoff state"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -518,12 +525,12 @@ openvzDomainUndefine(virDomainPtr dom)
|
||||
struct openvz_vm *vm = openvzFindVMByUUID(driver, dom->uuid);
|
||||
|
||||
if (!vm) {
|
||||
error(conn, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
|
||||
error(conn, VIR_ERR_INVALID_DOMAIN, _("no domain with matching uuid"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (openvzIsActiveVM(vm)) {
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
|
||||
error(conn, VIR_ERR_INTERNAL_ERROR, _("cannot delete active domain"));
|
||||
return -1;
|
||||
}
|
||||
snprintf(cmdbuf, CMDBUF_LEN - 1, VZCTL " destroy %s ", vm->vmdef->name);
|
||||
|
@ -885,7 +885,7 @@ check_cert_file (virConnectPtr conn, const char *type, const char *file)
|
||||
if (stat(file, &sb) < 0) {
|
||||
__virRaiseError (conn, NULL, NULL, VIR_FROM_REMOTE, VIR_ERR_RPC,
|
||||
VIR_ERR_ERROR, LIBVIRT_CACERT, NULL, NULL, 0, 0,
|
||||
"Cannot access %s '%s': %s (%d)",
|
||||
_("Cannot access %s '%s': %s (%d)"),
|
||||
type, file, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
@ -1024,7 +1024,7 @@ negotiate_gnutls_on_connection (virConnectPtr conn,
|
||||
}
|
||||
if (len != 1 || buf[0] != '\1') {
|
||||
error (conn, VIR_ERR_RPC,
|
||||
"server verification (of our certificate or IP address) failed\n");
|
||||
_("server verification (of our certificate or IP address) failed\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1123,7 +1123,7 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
VIR_FROM_REMOTE, VIR_ERR_RPC,
|
||||
VIR_ERR_ERROR, priv->hostname, NULL, NULL,
|
||||
0, 0,
|
||||
"Certificate's owner does not match the hostname (%s)",
|
||||
_("Certificate's owner does not match the hostname (%s)"),
|
||||
priv->hostname);
|
||||
gnutls_x509_crt_deinit (cert);
|
||||
return -1;
|
||||
@ -3479,8 +3479,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
want = REMOTE_AUTH_POLKIT;
|
||||
} else {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown authentication type %s", authtype);
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
_("unknown authentication type %s"), authtype);
|
||||
return -1;
|
||||
}
|
||||
for (i = 0 ; i < ret.types.types_len ; i++) {
|
||||
@ -3490,7 +3491,8 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (type == REMOTE_AUTH_NONE) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"requested authentication type %s rejected", authtype);
|
||||
_("requested authentication type %s rejected"),
|
||||
authtype);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -3528,8 +3530,10 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
|
||||
default:
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unsupported authentication type %d", ret.types.types_val[0]);
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
_("unsupported authentication type %d"),
|
||||
ret.types.types_val[0]);
|
||||
free(ret.types.types_val);
|
||||
return -1;
|
||||
}
|
||||
@ -3556,15 +3560,18 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
|
||||
port, sizeof(port),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
|
||||
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Cannot resolve address %d: %s", err, gai_strerror(err));
|
||||
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
_("Cannot resolve address %d: %s"),
|
||||
err, gai_strerror(err));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
addr = malloc(strlen(host) + 1 + strlen(port) + 1);
|
||||
if (!addr) {
|
||||
__virRaiseError (NULL, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
VIR_ERR_NO_MEMORY, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
"address");
|
||||
return NULL;
|
||||
}
|
||||
@ -3775,7 +3782,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"failed to initialize SASL library: %d (%s)",
|
||||
_("failed to initialize SASL library: %d (%s)"),
|
||||
err, sasl_errstring(err, NULL, NULL));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3785,7 +3792,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"failed to get sock address %d (%s)",
|
||||
_("failed to get sock address %d (%s)"),
|
||||
socket_errno (), strerror(socket_errno ()));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3797,7 +3804,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"failed to get peer address %d (%s)",
|
||||
_("failed to get peer address %d (%s)"),
|
||||
socket_errno (), strerror(socket_errno ()));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3823,7 +3830,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed to create SASL client context: %d (%s)",
|
||||
_("Failed to create SASL client context: %d (%s)"),
|
||||
err, sasl_errstring(err, NULL, NULL));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3836,7 +3843,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"invalid cipher size for TLS session");
|
||||
"%s", _("invalid cipher size for TLS session"));
|
||||
goto cleanup;
|
||||
}
|
||||
ssf *= 8; /* key size is bytes, sasl wants bits */
|
||||
@ -3846,7 +3853,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"cannot set external SSF %d (%s)",
|
||||
_("cannot set external SSF %d (%s)"),
|
||||
err, sasl_errstring(err, NULL, NULL));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3865,7 +3872,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_INTERNAL_ERROR, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"cannot set security props %d (%s)",
|
||||
_("cannot set security props %d (%s)"),
|
||||
err, sasl_errstring(err, NULL, NULL));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3882,8 +3889,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (wantmech) {
|
||||
if (strstr(mechlist, wantmech) == NULL) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"SASL mechanism %s not supported by server", wantmech);
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
_("SASL mechanism %s not supported by server"),
|
||||
wantmech);
|
||||
free(iret.mechlist);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3901,7 +3910,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed to start SASL negotiation: %d (%s)",
|
||||
_("Failed to start SASL negotiation: %d (%s)"),
|
||||
err, sasl_errdetail(saslconn));
|
||||
free(iret.mechlist);
|
||||
goto cleanup;
|
||||
@ -3917,8 +3926,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if ((ncred =
|
||||
remoteAuthMakeCredentials(interact, &cred)) < 0) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed to make auth credentials");
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, 0, 0,
|
||||
"%s", _("Failed to make auth credentials"));
|
||||
free(iret.mechlist);
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3942,7 +3952,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"SASL negotiation data too long: %d bytes", clientoutlen);
|
||||
_("SASL negotiation data too long: %d bytes"),
|
||||
clientoutlen);
|
||||
goto cleanup;
|
||||
}
|
||||
/* NB, distinction of NULL vs "" is *critical* in SASL */
|
||||
@ -3981,7 +3992,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK && err != SASL_CONTINUE && err != SASL_INTERACT) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed SASL step: %d (%s)",
|
||||
_("Failed SASL step: %d (%s)"),
|
||||
err, sasl_errdetail(saslconn));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3995,7 +4006,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if ((ncred = remoteAuthMakeCredentials(interact, &cred)) < 0) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed to make auth credentials");
|
||||
"%s", _("Failed to make auth credentials"));
|
||||
goto cleanup;
|
||||
}
|
||||
/* Run the authentication callback */
|
||||
@ -4059,7 +4070,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (err != SASL_OK) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"cannot query SASL ssf on connection %d (%s)",
|
||||
_("cannot query SASL ssf on connection %d (%s)"),
|
||||
err, sasl_errstring(err, NULL, NULL));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -4068,7 +4079,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if (ssf < 56) { /* 56 == DES level, good for Kerberos */
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"negotiation SSF %d was not strong enough", ssf);
|
||||
_("negotiation SSF %d was not strong enough"), ssf);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -4122,7 +4133,7 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, int in_open,
|
||||
if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) {
|
||||
__virRaiseError (in_open ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_AUTH_FAILED, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"Failed to collect auth credentials");
|
||||
_("Failed to collect auth credentials"));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@ -4189,7 +4200,7 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
xdrmem_create (&xdr, buffer, sizeof buffer, XDR_ENCODE);
|
||||
if (!xdr_remote_message_header (&xdr, &hdr)) {
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
VIR_ERR_RPC, "xdr_remote_message_header");
|
||||
VIR_ERR_RPC, _("xdr_remote_message_header failed"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -4211,7 +4222,8 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
/* Encode the length word. */
|
||||
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_ENCODE);
|
||||
if (!xdr_int (&xdr, &len)) {
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC, _("xdr_int (length word)"));
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, VIR_ERR_RPC,
|
||||
_("xdr_int (length word)"));
|
||||
return -1;
|
||||
}
|
||||
xdr_destroy (&xdr);
|
||||
@ -4228,7 +4240,7 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
xdrmem_create (&xdr, buffer2, sizeof buffer2, XDR_DECODE);
|
||||
if (!xdr_int (&xdr, &len)) {
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
VIR_ERR_RPC, "xdr_int (length word, reply)");
|
||||
VIR_ERR_RPC, _("xdr_int (length word, reply)"));
|
||||
return -1;
|
||||
}
|
||||
xdr_destroy (&xdr);
|
||||
@ -4238,7 +4250,7 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
|
||||
if (len < 0 || len > REMOTE_MESSAGE_MAX) {
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
VIR_ERR_RPC, "packet received from server too large");
|
||||
VIR_ERR_RPC, _("packet received from server too large"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -4250,22 +4262,24 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
xdrmem_create (&xdr, buffer, len, XDR_DECODE);
|
||||
if (!xdr_remote_message_header (&xdr, &hdr)) {
|
||||
error (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
VIR_ERR_RPC, "xdr_remote_message_header (reply)");
|
||||
VIR_ERR_RPC, _("invalid header in reply"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check program, version, etc. are what we expect. */
|
||||
if (hdr.prog != REMOTE_PROGRAM) {
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown program (received %x, expected %x)",
|
||||
_("unknown program (received %x, expected %x)"),
|
||||
hdr.prog, REMOTE_PROGRAM);
|
||||
return -1;
|
||||
}
|
||||
if (hdr.vers != REMOTE_PROTOCOL_VERSION) {
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown protocol version (received %x, expected %x)",
|
||||
_("unknown protocol version (received %x, expected %x)"),
|
||||
hdr.vers, REMOTE_PROTOCOL_VERSION);
|
||||
return -1;
|
||||
}
|
||||
@ -4275,23 +4289,25 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
* message being received at this point.
|
||||
*/
|
||||
if (hdr.proc != proc_nr) {
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown procedure (received %x, expected %x)",
|
||||
_("unknown procedure (received %x, expected %x)"),
|
||||
hdr.proc, proc_nr);
|
||||
return -1;
|
||||
}
|
||||
if (hdr.direction != REMOTE_REPLY) {
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn,
|
||||
NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown direction (received %x, expected %x)",
|
||||
_("unknown direction (received %x, expected %x)"),
|
||||
hdr.direction, REMOTE_REPLY);
|
||||
return -1;
|
||||
}
|
||||
if (hdr.serial != serial) {
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown serial (received %x, expected %x)",
|
||||
_("unknown serial (received %x, expected %x)"),
|
||||
hdr.serial, serial);
|
||||
return -1;
|
||||
}
|
||||
@ -4334,7 +4350,7 @@ call (virConnectPtr conn, struct private_data *priv,
|
||||
default:
|
||||
__virRaiseError (flags & REMOTE_CALL_IN_OPEN ? NULL : conn, NULL, NULL, VIR_FROM_REMOTE,
|
||||
VIR_ERR_RPC, VIR_ERR_ERROR, NULL, NULL, NULL, 0, 0,
|
||||
"unknown status (received %x)",
|
||||
_("unknown status (received %x)"),
|
||||
hdr.status);
|
||||
xdr_destroy (&xdr);
|
||||
return -1;
|
||||
@ -4443,7 +4459,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
|
||||
}
|
||||
if (err == 0) {
|
||||
error (in_open ? NULL : conn,
|
||||
VIR_ERR_RPC, "socket closed unexpectedly");
|
||||
VIR_ERR_RPC, _("socket closed unexpectedly"));
|
||||
return -1;
|
||||
}
|
||||
return err;
|
||||
@ -4460,7 +4476,7 @@ really_read_buf (virConnectPtr conn, struct private_data *priv,
|
||||
}
|
||||
if (err == 0) {
|
||||
error (in_open ? NULL : conn,
|
||||
VIR_ERR_RPC, "socket closed unexpectedly");
|
||||
VIR_ERR_RPC, _("socket closed unexpectedly"));
|
||||
return -1;
|
||||
}
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user