]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - unix/uxmisc.c
Note the interaction of jump lists and -cleanup.
[PuTTY.git] / unix / uxmisc.c
index e6ad3906a97acc9c004a3944a9c8458f50d9e809..daa61a0193665909755938231c0d10a84ce703ba 100644 (file)
@@ -95,6 +95,13 @@ Filename *filename_deserialise(void *vdata, int maxsize, int *used)
     return filename_from_str(data);
 }
 
+char filename_char_sanitise(char c)
+{
+    if (c == '/')
+        return '.';
+    return c;
+}
+
 #ifdef DEBUG
 static FILE *debug_fp = NULL;
 
@@ -163,9 +170,11 @@ void pgp_fingerprints(void)
          "one. See the manual for more information.\n"
          "(Note: these fingerprints have nothing to do with SSH!)\n"
          "\n"
-         "PuTTY Master Key (RSA), 1024-bit:\n"
+         "PuTTY Master Key as of 2015 (RSA, 4096-bit):\n"
+         "  " PGP_MASTER_KEY_FP "\n\n"
+         "Original PuTTY Master Key (RSA, 1024-bit):\n"
          "  " PGP_RSA_MASTER_KEY_FP "\n"
-         "PuTTY Master Key (DSA), 1024-bit:\n"
+         "Original PuTTY Master Key (DSA, 1024-bit):\n"
          "  " PGP_DSA_MASTER_KEY_FP "\n", stdout);
 }
 
@@ -313,3 +322,30 @@ char *make_dir_and_check_ours(const char *dirname)
 
     return NULL;
 }
+
+char *make_dir_path(const char *path, mode_t mode)
+{
+    int pos = 0;
+    char *prefix;
+
+    while (1) {
+        pos += strcspn(path + pos, "/");
+
+        if (pos > 0) {
+            prefix = dupprintf("%.*s", pos, path);
+
+            if (mkdir(prefix, mode) < 0 && errno != EEXIST) {
+                char *ret = dupprintf("%s: mkdir: %s",
+                                      prefix, strerror(errno));
+                sfree(prefix);
+                return ret;
+            }
+
+            sfree(prefix);
+        }
+
+        if (!path[pos])
+            return NULL;
+        pos += strspn(path + pos, "/");
+    }
+}