X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=user_list.c;h=f1b4b212e11f3e1d807d9a78d1ac31b6d17cf9ca;hp=0748ef62f1c5030cc6e5de6975e579c7b4c83357;hb=7205bdd68b0ad3c50bbe7b5e01eb62be97aab5c8;hpb=4fee4c30eff9c8c0c1eeef2a60ec22fedfaf3826 diff --git a/user_list.c b/user_list.c index 0748ef62..f1b4b212 100644 --- a/user_list.c +++ b/user_list.c @@ -1,20 +1,24 @@ /* - * Copyright (C) 2006-2008 Andre Noll + * Copyright (C) 2006-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file user_list.c User handling for para_server. */ +#include #include #include +#include #include "para.h" #include "error.h" +#include "crypt.h" #include "fd.h" #include "string.h" #include "list.h" #include "user_list.h" +#include "rc4.h" static struct list_head user_list; @@ -53,6 +57,18 @@ static void populate_user_list(char *user_list_file) para_strerror(-ret)); continue; } + /* + * In order to encrypt len := CHALLENGE_SIZE + 2 * RC4_KEY_LEN + * bytes using RSA_public_encrypt() with EME-OAEP padding mode, + * RSA_size(rsa) must be greater than len + 41. So ignore keys + * which are too short. For details see RSA_public_encrypt(3). + */ + if (ret <= CHALLENGE_SIZE + 2 * RC4_KEY_LEN + 41) { + PARA_WARNING_LOG("rsa key %s too short (%d)\n", + k, ret); + rsa_free(rsa); + continue; + } u = para_malloc(sizeof(*u)); u->name = para_strdup(n); u->rsa = rsa;