for (i = 0; i < num_inputs; i++)
len += strlen(lls_input(i, ct->lpr)) + 1;
- p = command = para_malloc(len);
+ p = command = alloc(len);
for (i = 0; i < num_inputs; i++) {
const char *str = lls_input(i, ct->lpr);
strcpy(p, str);
return send_sb(ct, 0, command, len, SBD_COMMAND, false);
}
+/* Find out if the given string is contained in the features vector. */
static bool has_feature(const char *feature, struct client_task *ct)
{
- return find_arg(feature, ct->features) >= 0? true : false;
+ if (!ct->features)
+ return false;
+ for (int i = 0; ct->features[i]; i++)
+ if (strcmp(feature, ct->features[i]) == 0)
+ return i;
+ return false;
}
/*
free(sbb.iov.iov_base);
if (ret < 0)
goto out;
- ct->challenge_hash = para_malloc(HASH2_SIZE);
-
+ ct->challenge_hash = alloc(HASH2_SIZE);
if (has_feature("sha256", ct)) {
hash2_function((char *)crypt_buf, APC_CHALLENGE_SIZE, ct->challenge_hash);
hash2_to_asc(ct->challenge_hash, buf);
PARA_INFO_LOG("user: %s\n", user);
PARA_INFO_LOG("key file: %s\n", kf);
PARA_INFO_LOG("loglevel: %d\n", ll);
- ct = para_calloc(sizeof(*ct));
+ ct = zalloc(sizeof(*ct));
ct->scc.fd = -1;
ct->lpr = lpr;
ct->key_file = kf;