X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client_common.c;h=b28e8951ce10ce791db094e186fd18e8a1a2ae09;hp=39eb8b4cce9f6403132329fd0edfbf7b7025caaf;hb=e2167286448ce2ed9a01a548e7e9832563035088;hpb=b59e841036a107b52a0221e48d7e05f86da92979 diff --git a/client_common.c b/client_common.c index 39eb8b4c..b28e8951 100644 --- a/client_common.c +++ b/client_common.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 1997 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 1997 Andre Noll , see file COPYING. */ /** \file client_common.c Common functions of para_client and para_audiod. */ @@ -44,7 +40,6 @@ void client_close(struct client_task *ct) if (!ct) return; free(ct->user); - free(ct->config_file); free(ct->key_file); lls_free_parse_result(ct->lpr, CLIENT_CMD_PTR); free(ct->challenge_hash); @@ -322,15 +317,15 @@ static int client_post_select(struct sched *s, void *context) } n = sbb.iov.iov_len; PARA_INFO_LOG("<-- [challenge] (%zu bytes)\n", n); - ret = priv_decrypt(ct->key_file, crypt_buf, + ret = apc_priv_decrypt(ct->key_file, crypt_buf, sbb.iov.iov_base, n); free(sbb.iov.iov_base); if (ret < 0) goto out; ct->challenge_hash = para_malloc(HASH_SIZE); - hash_function((char *)crypt_buf, CHALLENGE_SIZE, ct->challenge_hash); - ct->scc.send = sc_new(crypt_buf + CHALLENGE_SIZE, SESSION_KEY_LEN); - ct->scc.recv = sc_new(crypt_buf + CHALLENGE_SIZE + SESSION_KEY_LEN, + hash_function((char *)crypt_buf, APC_CHALLENGE_SIZE, ct->challenge_hash); + 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); hash_to_asc(ct->challenge_hash, buf); PARA_INFO_LOG("--> %s\n", buf); @@ -540,7 +535,6 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, ret = lls(lls_parse(argc, argv, cmd, &lpr, &errctx)); if (ret < 0) goto out; - ll = CLIENT_OPT_UINT32_VAL(LOGLEVEL, lpr); version_handle_flag("client", CLIENT_OPT_GIVEN(VERSION, lpr)); handle_help_flag(lpr); @@ -577,6 +571,9 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, lpr = merged_lpr; } /* success */ + ll = CLIENT_OPT_UINT32_VAL(LOGLEVEL, lpr); + if (loglevel) + *loglevel = ll; user = CLIENT_OPT_GIVEN(USER, lpr)? para_strdup(CLIENT_OPT_STRING_VAL(USER, lpr)) : para_logname(); @@ -597,21 +594,17 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, ct->scc.fd = -1; ct->lpr = lpr; ct->key_file = kf; - ct->config_file = cf; ct->user = user; *ct_ptr = ct; - if (loglevel) - *loglevel = ll; ret = lls_num_inputs(lpr); out: free(home); + free(cf); if (ret < 0) { if (errctx) PARA_ERROR_LOG("%s\n", errctx); free(errctx); - PARA_ERROR_LOG("%s\n", para_strerror(-ret)); lls_free_parse_result(lpr, cmd); - free(cf); free(kf); *ct_ptr = NULL; }