X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=client_common.c;h=3beeed1f49effebe1d6f92ceea0fdebb589a7fe6;hb=HEAD;hp=43527ddb71647eee5936760cda40e722085b21f8;hpb=84eff8315955e1a6da8c3d15fa6c18203d55aa4a;p=paraslash.git diff --git a/client_common.c b/client_common.c index 43527ddb..fe8234f9 100644 --- a/client_common.c +++ b/client_common.c @@ -344,15 +344,18 @@ static int client_post_monitor(struct sched *s, void *context) 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; @@ -578,8 +581,9 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, 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); }