- if (cc->use_sideband) {
- struct iovec iov;
- ret = recv_sb(&cc->scc, SBD_COMMAND, MAX_COMMAND_LEN, &iov);
- if (ret < 0)
- goto net_err;
- ret = parse_sb_command(cc, &iov);
- if (ret < 0)
- goto err_out;
- cc->argc = ret;
- } else {
- ret = read_command(&cc->scc, &command);
- if (ret == -E_COMMAND_SYNTAX)
- goto err_out;
- if (ret < 0)
- goto net_err;
- ret = -E_BAD_CMD;
- cc->cmd = parse_cmd(command);
- if (!cc->cmd)
- goto err_out;
- /* valid command, check permissions */
- ret = check_perms(cc->u->perms, cc->cmd);
- if (ret < 0)
- goto err_out;
- /* valid command and sufficient perms */
- ret = create_argv(command, "\n", &cc->argv);
- if (ret < 0)
- goto err_out;
- cc->argc = ret;
- }
- PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cc->cmd->name,
- cc->u->name, peername);
- ret = cc->cmd->handler(cc);
- free_argv(cc->argv);
- mutex_lock(mmd_mutex);
- mmd->num_commands++;
- mutex_unlock(mmd_mutex);
+ ret = recv_sb(&cc->scc, SBD_COMMAND, MAX_COMMAND_LEN, &iov);
+ if (ret < 0)
+ goto net_err;
+ ret = run_command(cc, &iov, peername);
+ free(iov.iov_base);
+ if (ret < 0)
+ goto err_out;