int unix_sock_ro_mask = 0;
int unix_sock_rw_mask = 0;
int unix_sock_adm_mask = 0;
- int ret = -1;
g_autoptr(virSystemdActivation) act = NULL;
virSystemdActivationMap actmap[] = {
{ .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
if (config->unix_sock_group) {
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) {
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) {
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) {
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_rw_perms);
- goto cleanup;
+ return -1;
}
if (virNetServerAddServiceUNIX(srv,
false,
config->max_queued_clients,
config->max_client_requests) < 0)
- goto cleanup;
+ return -1;
if (sock_path_ro &&
virNetServerAddServiceUNIX(srv,
act,
true,
config->max_queued_clients,
config->max_client_requests) < 0)
- goto cleanup;
+ return -1;
if (sock_path_adm &&
virNetServerAddServiceUNIX(srvAdm,
false,
config->admin_max_queued_clients,
config->admin_max_client_requests) < 0)
- goto cleanup;
+ return -1;
#ifdef WITH_IP
if (((ipsock && config->listen_tcp) || act) &&
false,
config->max_queued_clients,
config->max_client_requests) < 0)
- goto cleanup;
+ return -1;
if (((ipsock && config->listen_tls) || (act && virSystemdActivationHasName(act, DAEMON_NAME "-tls.socket")))) {
virNetTLSContextPtr ctxt = NULL;
if (!config->ca_file) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("No CA certificate path set to match server key/cert"));
- goto cleanup;
+ return -1;
}
if (!config->cert_file) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("No server certificate path set to match server key"));
- goto cleanup;
+ return -1;
}
if (!config->key_file) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("No server key path set to match server cert"));
- goto cleanup;
+ return -1;
}
VIR_DEBUG("Using CA='%s' cert='%s' key='%s'",
config->ca_file, config->cert_file, config->key_file);
config->tls_priority,
config->tls_no_sanity_certificate ? false : true,
config->tls_no_verify_certificate ? false : true)))
- goto cleanup;
+ return -1;
} else {
if (!(ctxt = virNetTLSContextNewServerPath(NULL,
!privileged,
config->tls_priority,
config->tls_no_sanity_certificate ? false : true,
config->tls_no_verify_certificate ? false : true)))
- goto cleanup;
+ return -1;
}
VIR_DEBUG("Registering TLS socket %s:%s",
config->max_queued_clients,
config->max_client_requests) < 0) {
virObjectUnref(ctxt);
- goto cleanup;
+ return -1;
}
virObjectUnref(ctxt);
}
if (act &&
virSystemdActivationComplete(act) < 0)
- goto cleanup;
+ return -1;
#if WITH_SASL
if (virNetServerNeedsAuth(srv, REMOTE_AUTH_SASL) &&
!(saslCtxt = virNetSASLContextNewServer(
(const char *const*)config->sasl_allowed_username_list)))
- goto cleanup;
+ return -1;
#endif
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}
struct remoteAuthInteractState *state,
virConnectAuthPtr auth)
{
- int ret = -1;
-
VIR_DEBUG("Starting SASL interaction");
remoteAuthInteractStateClear(state, false);
/* Fills state->interact with any values from the auth config file */
if (remoteAuthFillFromConfig(conn, state) < 0)
- goto cleanup;
+ return -1;
/* Populates state->cred for anything not found in the auth config */
if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) {
virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("Failed to make auth credentials"));
- goto cleanup;
+ return -1;
}
/* If there was anything not in the auth config, we need to
if (!auth || !auth->cb) {
virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("No authentication callback available"));
- goto cleanup;
+ return -1;
}
if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) {
virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("Failed to collect auth credentials"));
- goto cleanup;
+ return -1;
}
/* Copy user's responses from cred into interact */
* of this method, rather than the end.
*/
- ret = 0;
-
- cleanup:
- return ret;
+ return 0;
}