mirror of https://gitee.com/openkylin/libvirt.git
remote: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7868643275
commit
c5d86a9834
|
@ -393,7 +393,6 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
int unix_sock_ro_mask = 0;
|
int unix_sock_ro_mask = 0;
|
||||||
int unix_sock_rw_mask = 0;
|
int unix_sock_rw_mask = 0;
|
||||||
int unix_sock_adm_mask = 0;
|
int unix_sock_adm_mask = 0;
|
||||||
int ret = -1;
|
|
||||||
g_autoptr(virSystemdActivation) act = NULL;
|
g_autoptr(virSystemdActivation) act = NULL;
|
||||||
virSystemdActivationMap actmap[] = {
|
virSystemdActivationMap actmap[] = {
|
||||||
{ .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
|
{ .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
|
||||||
|
@ -447,22 +446,22 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
|
|
||||||
if (config->unix_sock_group) {
|
if (config->unix_sock_group) {
|
||||||
if (virGetGroupID(config->unix_sock_group, &unix_sock_gid) < 0)
|
if (virGetGroupID(config->unix_sock_group, &unix_sock_gid) < 0)
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_i(config->unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
|
if (virStrToLong_i(config->unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
|
||||||
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_ro_perms);
|
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_ro_perms);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_i(config->unix_sock_admin_perms, NULL, 8, &unix_sock_adm_mask) != 0) {
|
if (virStrToLong_i(config->unix_sock_admin_perms, NULL, 8, &unix_sock_adm_mask) != 0) {
|
||||||
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_admin_perms);
|
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_admin_perms);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_i(config->unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) {
|
if (virStrToLong_i(config->unix_sock_rw_perms, NULL, 8, &unix_sock_rw_mask) != 0) {
|
||||||
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_rw_perms);
|
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_rw_perms);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetServerAddServiceUNIX(srv,
|
if (virNetServerAddServiceUNIX(srv,
|
||||||
|
@ -476,7 +475,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
false,
|
false,
|
||||||
config->max_queued_clients,
|
config->max_queued_clients,
|
||||||
config->max_client_requests) < 0)
|
config->max_client_requests) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (sock_path_ro &&
|
if (sock_path_ro &&
|
||||||
virNetServerAddServiceUNIX(srv,
|
virNetServerAddServiceUNIX(srv,
|
||||||
act,
|
act,
|
||||||
|
@ -489,7 +488,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
true,
|
true,
|
||||||
config->max_queued_clients,
|
config->max_queued_clients,
|
||||||
config->max_client_requests) < 0)
|
config->max_client_requests) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (sock_path_adm &&
|
if (sock_path_adm &&
|
||||||
virNetServerAddServiceUNIX(srvAdm,
|
virNetServerAddServiceUNIX(srvAdm,
|
||||||
|
@ -503,7 +502,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
false,
|
false,
|
||||||
config->admin_max_queued_clients,
|
config->admin_max_queued_clients,
|
||||||
config->admin_max_client_requests) < 0)
|
config->admin_max_client_requests) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
#ifdef WITH_IP
|
#ifdef WITH_IP
|
||||||
if (((ipsock && config->listen_tcp) || act) &&
|
if (((ipsock && config->listen_tcp) || act) &&
|
||||||
|
@ -518,7 +517,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
false,
|
false,
|
||||||
config->max_queued_clients,
|
config->max_queued_clients,
|
||||||
config->max_client_requests) < 0)
|
config->max_client_requests) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (((ipsock && config->listen_tls) || (act && virSystemdActivationHasName(act, DAEMON_NAME "-tls.socket")))) {
|
if (((ipsock && config->listen_tls) || (act && virSystemdActivationHasName(act, DAEMON_NAME "-tls.socket")))) {
|
||||||
virNetTLSContextPtr ctxt = NULL;
|
virNetTLSContextPtr ctxt = NULL;
|
||||||
|
@ -529,17 +528,17 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
if (!config->ca_file) {
|
if (!config->ca_file) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("No CA certificate path set to match server key/cert"));
|
_("No CA certificate path set to match server key/cert"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!config->cert_file) {
|
if (!config->cert_file) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("No server certificate path set to match server key"));
|
_("No server certificate path set to match server key"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!config->key_file) {
|
if (!config->key_file) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("No server key path set to match server cert"));
|
_("No server key path set to match server cert"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
|
VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
|
||||||
config->ca_file, config->cert_file, config->key_file);
|
config->ca_file, config->cert_file, config->key_file);
|
||||||
|
@ -551,7 +550,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
config->tls_priority,
|
config->tls_priority,
|
||||||
config->tls_no_sanity_certificate ? false : true,
|
config->tls_no_sanity_certificate ? false : true,
|
||||||
config->tls_no_verify_certificate ? false : true)))
|
config->tls_no_verify_certificate ? false : true)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (!(ctxt = virNetTLSContextNewServerPath(NULL,
|
if (!(ctxt = virNetTLSContextNewServerPath(NULL,
|
||||||
!privileged,
|
!privileged,
|
||||||
|
@ -559,7 +558,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
config->tls_priority,
|
config->tls_priority,
|
||||||
config->tls_no_sanity_certificate ? false : true,
|
config->tls_no_sanity_certificate ? false : true,
|
||||||
config->tls_no_verify_certificate ? false : true)))
|
config->tls_no_verify_certificate ? false : true)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_DEBUG("Registering TLS socket %s:%s",
|
VIR_DEBUG("Registering TLS socket %s:%s",
|
||||||
|
@ -576,7 +575,7 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
config->max_queued_clients,
|
config->max_queued_clients,
|
||||||
config->max_client_requests) < 0) {
|
config->max_client_requests) < 0) {
|
||||||
virObjectUnref(ctxt);
|
virObjectUnref(ctxt);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
virObjectUnref(ctxt);
|
virObjectUnref(ctxt);
|
||||||
}
|
}
|
||||||
|
@ -584,19 +583,16 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||||
|
|
||||||
if (act &&
|
if (act &&
|
||||||
virSystemdActivationComplete(act) < 0)
|
virSystemdActivationComplete(act) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
#if WITH_SASL
|
#if WITH_SASL
|
||||||
if (virNetServerNeedsAuth(srv, REMOTE_AUTH_SASL) &&
|
if (virNetServerNeedsAuth(srv, REMOTE_AUTH_SASL) &&
|
||||||
!(saslCtxt = virNetSASLContextNewServer(
|
!(saslCtxt = virNetSASLContextNewServer(
|
||||||
(const char *const*)config->sasl_allowed_username_list)))
|
(const char *const*)config->sasl_allowed_username_list)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4176,20 +4176,18 @@ static int remoteAuthInteract(virConnectPtr conn,
|
||||||
struct remoteAuthInteractState *state,
|
struct remoteAuthInteractState *state,
|
||||||
virConnectAuthPtr auth)
|
virConnectAuthPtr auth)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
VIR_DEBUG("Starting SASL interaction");
|
VIR_DEBUG("Starting SASL interaction");
|
||||||
remoteAuthInteractStateClear(state, false);
|
remoteAuthInteractStateClear(state, false);
|
||||||
|
|
||||||
/* Fills state->interact with any values from the auth config file */
|
/* Fills state->interact with any values from the auth config file */
|
||||||
if (remoteAuthFillFromConfig(conn, state) < 0)
|
if (remoteAuthFillFromConfig(conn, state) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* Populates state->cred for anything not found in the auth config */
|
/* Populates state->cred for anything not found in the auth config */
|
||||||
if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) {
|
if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) {
|
||||||
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
||||||
_("Failed to make auth credentials"));
|
_("Failed to make auth credentials"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there was anything not in the auth config, we need to
|
/* If there was anything not in the auth config, we need to
|
||||||
|
@ -4200,13 +4198,13 @@ static int remoteAuthInteract(virConnectPtr conn,
|
||||||
if (!auth || !auth->cb) {
|
if (!auth || !auth->cb) {
|
||||||
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
||||||
_("No authentication callback available"));
|
_("No authentication callback available"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) {
|
if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) {
|
||||||
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
||||||
_("Failed to collect auth credentials"));
|
_("Failed to collect auth credentials"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy user's responses from cred into interact */
|
/* Copy user's responses from cred into interact */
|
||||||
|
@ -4221,10 +4219,7 @@ static int remoteAuthInteract(virConnectPtr conn,
|
||||||
* of this method, rather than the end.
|
* of this method, rather than the end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue