-static int com_tasks(struct command_context *cc,
+/* deprecated, does nothing */
+static int com_tasks(__a_unused struct command_context *cc,
- PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", lls_command_name(lcmd),
- cc->u->name, peername);
+ PARA_NOTICE_LOG("calling com_%s() for user %s\n",
+ lls_command_name(lcmd), cc->u->name);
ret = lls(lls_parse(argc, argv, lcmd, &lpr, &errctx));
if (ret >= 0) {
const struct server_cmd_user_data *ud = lls_user_data(lcmd);
ret = lls(lls_parse(argc, argv, lcmd, &lpr, &errctx));
if (ret >= 0) {
const struct server_cmd_user_data *ud = lls_user_data(lcmd);
* Perform user authentication and execute a command.
*
* \param fd The file descriptor to send output to.
* Perform user authentication and execute a command.
*
* \param fd The file descriptor to send output to.
*
* Whenever para_server accepts an incoming tcp connection on the port it
* listens on, it forks and the resulting child calls this function.
*
* Whenever para_server accepts an incoming tcp connection on the port it
* listens on, it forks and the resulting child calls this function.
* permissions to execute that command, the function calls the corresponding
* command handler which does argument checking and further processing.
*
* permissions to execute that command, the function calls the corresponding
* command handler which does argument checking and further processing.
*
unsigned char challenge_hash[HASH_SIZE];
char *command = NULL, *buf = para_malloc(HANDSHAKE_BUFSIZE) /* must be on the heap */;
size_t numbytes;
unsigned char challenge_hash[HASH_SIZE];
char *command = NULL, *buf = para_malloc(HANDSHAKE_BUFSIZE) /* must be on the heap */;
size_t numbytes;
- ret = pub_encrypt(cc->u->pubkey, rand_buf, sizeof(rand_buf),
+ ret = apc_pub_encrypt(cc->u->pubkey, rand_buf, sizeof(rand_buf),
get_random_bytes_or_die((unsigned char *)buf, numbytes);
}
PARA_DEBUG_LOG("sending %d byte challenge + session key (%zu bytes)\n",
get_random_bytes_or_die((unsigned char *)buf, numbytes);
}
PARA_DEBUG_LOG("sending %d byte challenge + session key (%zu bytes)\n",
ret = send_sb(&cc->scc, buf, numbytes, SBD_CHALLENGE, false);
buf = NULL;
if (ret < 0)
ret = send_sb(&cc->scc, buf, numbytes, SBD_CHALLENGE, false);
buf = NULL;
if (ret < 0)
if (memcmp(challenge_hash, buf, HASH_SIZE))
goto net_err;
/* auth successful */
alarm(0);
PARA_INFO_LOG("good auth for %s\n", cc->u->name);
/* init stream cipher keys with the second part of the random buffer */
if (memcmp(challenge_hash, buf, HASH_SIZE))
goto net_err;
/* auth successful */
alarm(0);
PARA_INFO_LOG("good auth for %s\n", cc->u->name);
/* init stream cipher keys with the second part of the random buffer */
- cc->scc.recv = sc_new(rand_buf + CHALLENGE_SIZE, SESSION_KEY_LEN);
- cc->scc.send = sc_new(rand_buf + CHALLENGE_SIZE + SESSION_KEY_LEN,
+ cc->scc.recv = sc_new(rand_buf + APC_CHALLENGE_SIZE, SESSION_KEY_LEN);
+ cc->scc.send = sc_new(rand_buf + APC_CHALLENGE_SIZE + SESSION_KEY_LEN,
SESSION_KEY_LEN);
ret = send_sb(&cc->scc, NULL, 0, SBD_PROCEED, false);
if (ret < 0)
SESSION_KEY_LEN);
ret = send_sb(&cc->scc, NULL, 0, SBD_PROCEED, false);
if (ret < 0)
ret = recv_sb(&cc->scc, SBD_COMMAND, MAX_COMMAND_LEN, &iov);
if (ret < 0)
goto net_err;
ret = recv_sb(&cc->scc, SBD_COMMAND, MAX_COMMAND_LEN, &iov);
if (ret < 0)
goto net_err;