]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - client_common.c
stream cipher: Allow in-place encryption.
[paraslash.git] / client_common.c
index c7ea3b4cb0dde32a36c1a50ebdb72658b9ec47e2..865a1797bd81bbd7e6308278c08249890c1bf241 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <regex.h>
 #include <sys/types.h>
-#include <dirent.h>
 
 #include "para.h"
 #include "error.h"
@@ -22,6 +21,7 @@
 #include "client.cmdline.h"
 #include "client.h"
 #include "buffer_tree.h"
+#include "version.h"
 
 /** The size of the receiving buffer. */
 #define CLIENT_BUFSIZE 4000
@@ -394,9 +394,16 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr,
        ct->user = ct->conf.user_given?
                para_strdup(ct->conf.user_arg) : para_logname();
 
-       ct->key_file = ct->conf.key_file_given?
-               para_strdup(ct->conf.key_file_arg) :
-               make_message("%s/.paraslash/key.%s", home, ct->user);
+       if (ct->conf.key_file_given)
+               ct->key_file = para_strdup(ct->conf.key_file_arg);
+       else {
+               ct->key_file = make_message("%s/.paraslash/key.%s",
+                       home, ct->user);
+               if (!file_exists(ct->key_file)) {
+                       free(ct->key_file);
+                       ct->key_file = make_message("%s/.ssh/id_rsa", home);
+               }
+       }
 
        if (loglevel)
                *loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);