void cfg_default_done(__unused struct cmd_q *cmdq) { if (--cfg_references != 0) return; cfg_finished = 1; if (!RB_EMPTY(&sessions)) cfg_show_causes(RB_MIN(sessions, &sessions)); cmdq_free(cfg_cmd_q); cfg_cmd_q = NULL; if (cfg_client != NULL) { /* * The client command queue starts with client_exit set to 1 so * only continue if not empty (that is, we have been delayed * during configuration parsing for long enough that the * MSG_COMMAND has arrived), else the client will exit before * the MSG_COMMAND which might tell it not to. */ if (!TAILQ_EMPTY(&cfg_client->cmdq->queue)) cmdq_continue(cfg_client->cmdq); server_client_unref(cfg_client); cfg_client = NULL; } }
void cmd_load_buffer_callback(struct client *c, int closed, void *data) { const char *bufname = data; char *pdata, *cause; size_t psize; if (!closed) return; c->stdin_callback = NULL; server_client_unref(c); if (c->flags & CLIENT_DEAD) return; psize = EVBUFFER_LENGTH(c->stdin_data); if (psize == 0 || (pdata = malloc(psize + 1)) == NULL) goto out; memcpy(pdata, EVBUFFER_DATA(c->stdin_data), psize); pdata[psize] = '\0'; evbuffer_drain(c->stdin_data, psize); if (paste_set(pdata, psize, bufname, &cause) != 0) { /* No context so can't use server_client_msg_error. */ evbuffer_add_printf(c->stderr_data, "%s", cause); server_push_stderr(c); free(pdata); free(cause); } out: cmdq_continue(c->cmdq); }
static void cmd_confirm_before_free(void *data) { struct cmd_confirm_before_data *cdata = data; struct client *c = cdata->client; server_client_unref(c); free(cdata->cmd); free(cdata); }
static void cmd_if_shell_free(void *data) { struct cmd_if_shell_data *cdata = data; server_client_unref(cdata->client); free(cdata->cmd_else); free(cdata->cmd_if); free(cdata->file); free(cdata); }