X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=client_common.c;h=64f6c67612a5c665b87dcdb8d3e051bc7500b455;hb=be5daec66f163725489f42d512659a8af5c3fd59;hp=3beeed1f49effebe1d6f92ceea0fdebb589a7fe6;hpb=e3a7e12639c34fd86d48a072beb48add8c498d09;p=paraslash.git diff --git a/client_common.c b/client_common.c index 3beeed1f..64f6c676 100644 --- a/client_common.c +++ b/client_common.c @@ -245,7 +245,7 @@ static int send_sb_command(struct client_task *ct) 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); @@ -255,9 +255,15 @@ static int send_sb_command(struct client_task *ct) 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; } /* @@ -336,8 +342,7 @@ static int client_post_monitor(struct sched *s, void *context) 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); @@ -582,7 +587,7 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, 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;