return false;
for (int i = 0; ct->features[i]; i++)
if (strcmp(feature, ct->features[i]) == 0)
- return i;
+ return true;
return false;
}
goto out;
ct->challenge_hash = alloc(HASH2_SIZE);
if (has_feature("sha256", ct)) {
- hash2_function((char *)crypt_buf, APC_CHALLENGE_SIZE, ct->challenge_hash);
+ hash2_function((char *)crypt_buf, APC_CHALLENGE_SIZE,
+ ct->challenge_hash);
hash2_to_asc(ct->challenge_hash, buf);
} else {
- hash_function((char *)crypt_buf, APC_CHALLENGE_SIZE, ct->challenge_hash);
+ hash_function((char *)crypt_buf, APC_CHALLENGE_SIZE,
+ ct->challenge_hash);
hash_to_asc(ct->challenge_hash, buf);
}
- ct->scc.send = sc_new(crypt_buf + APC_CHALLENGE_SIZE, SESSION_KEY_LEN);
- ct->scc.recv = sc_new(crypt_buf + APC_CHALLENGE_SIZE + SESSION_KEY_LEN,
- SESSION_KEY_LEN);
+ ct->scc.send = sc_new(crypt_buf + APC_CHALLENGE_SIZE,
+ SESSION_KEY_LEN);
+ ct->scc.recv = sc_new(crypt_buf + APC_CHALLENGE_SIZE
+ + SESSION_KEY_LEN, SESSION_KEY_LEN);
PARA_INFO_LOG("--> %s\n", buf);
ct->status = CL_RECEIVED_CHALLENGE;
return 0;
char *buf2;
size_t sz;
ret = btr_node_status(ct->btrn[1], 0, BTR_NT_LEAF);
- if (ret == -E_BTR_EOF) {
+ if (ret == -E_EOF) {
/* empty blob data packet indicates EOF */
PARA_INFO_LOG("blob sent\n");
ret = send_sb(ct, 1, NULL, 0, SBD_BLOB_DATA, true);
if (ret >= 0)
- ret = -E_BTR_EOF;
+ ret = -E_EOF;
}
if (ret < 0)
goto close1;
PARA_NOTICE_LOG("connecting %s:%u\n", host, port);
ct->scc.fd = -1;
- ret = para_connect_simple(IPPROTO_TCP, host, port);
+ ret = para_connect(IPPROTO_TCP, host, port);
if (ret < 0)
return ret;
ct->scc.fd = ret;
if (CLIENT_OPT_GIVEN(KEY_FILE, lpr))
kf = para_strdup(CLIENT_OPT_STRING_VAL(KEY_FILE, lpr));
else {
+ struct stat statbuf;
kf = make_message("%s/.paraslash/key.%s", home, user);
- if (!file_exists(kf)) {
+ if (stat(kf, &statbuf) != 0) { /* assume file does not exist */
free(kf);
kf = make_message("%s/.ssh/id_rsa", home);
}