Exemple #1
0
static int32_t
lrmd_ipc_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
{
    crm_trace("Connection %p", c);
    if (crm_client_new(c, uid, gid) == NULL) {
        return -EIO;
    }
    return 0;
}
Exemple #2
0
static int32_t
st_ipc_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
{
    if (stonith_shutdown_flag) {
        crm_info("Ignoring new client [%d] during shutdown", crm_ipcs_client_pid(c));
        return -EPERM;
    }

    if (crm_client_new(c, uid, gid) == NULL) {
        return -EIO;
    }
    return 0;
}
Exemple #3
0
static int32_t
ipc_proxy_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid, const char *ipc_channel)
{
    void *key = NULL;
    void *value = NULL;
    crm_client_t *client;
    crm_client_t *ipc_proxy = NULL;
    GHashTableIter iter;
    xmlNode *msg;

    crm_trace("Connection %p on channel %s", c, ipc_channel);

    if (g_hash_table_size(ipc_providers) == 0) {
        crm_err("No ipc providers available for uid %d gid %d", uid, gid);
        return -EREMOTEIO;
    }

    g_hash_table_iter_init(&iter, ipc_providers);
    if (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) {
        /* grab the first provider available, any provider in this
         * table will work. Usually there will only be one. These are
         * lrmd client connections originating for a cluster node's crmd. */
        ipc_proxy = value;
    } else {
        crm_err("No ipc providers available for uid %d gid %d", uid, gid);
        return -EREMOTEIO;
    }

    /* this new client is a local ipc client on a remote
     * guest wanting to access the ipc on any available cluster nodes */
    client = crm_client_new(c, uid, gid);
    if (client == NULL) {
        return -EREMOTEIO;
    }

    /* This ipc client is bound to a single ipc provider. If the
     * provider goes away, this client is disconnected */
    client->userdata = strdup(ipc_proxy->id);
    client->name = g_strdup_printf("proxy-%s-%d-%.8s", ipc_channel, client->pid, client->id);

    g_hash_table_insert(ipc_clients, client->id, client);

    msg = create_xml_node(NULL, T_LRMD_IPC_PROXY);
    crm_xml_add(msg, F_LRMD_IPC_OP, "new");
    crm_xml_add(msg, F_LRMD_IPC_IPC_SERVER, ipc_channel);
    crm_xml_add(msg, F_LRMD_IPC_SESSION, client->id);
    lrmd_server_send_notify(ipc_proxy, msg);
    free_xml(msg);
    crm_debug("created new ipc proxy with session id %s", client->id);
    return 0;
}
Exemple #4
0
static int32_t
attrd_ipc_accept(qb_ipcs_connection_t * c, uid_t uid, gid_t gid)
{
    crm_trace("Connection %p", c);
    if (shutting_down) {
        crm_info("Ignoring new client [%d] during shutdown", crm_ipcs_client_pid(c));
        return -EPERM;
    }

    if (crm_client_new(c, uid, gid) == NULL) {
        return -EIO;
    }
    return 0;
}