- remove old tests
[oweals/gnunet.git] / src / topology / friends.c
index 5c074e941bda6c9182da4f2c60d4178e9ff170ee..348123fe6fdb41df79d74fac5ffa7d83f1ccf5be 100644 (file)
@@ -92,7 +92,7 @@ GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg,
     while ((pos < fsize) && (! isspace ((int) data[pos])))
       pos++;
     if (GNUNET_OK !=
-        GNUNET_CRYPTO_ecc_public_sign_key_from_string (&data[start],
+        GNUNET_CRYPTO_eddsa_public_key_from_string (&data[start],
                                                       pos - start,
                                                       &pid.public_key))
     {
@@ -147,6 +147,14 @@ GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg)
                               "topology", "FRIENDS");
     return NULL;
   }
+  if (GNUNET_OK !=
+      GNUNET_DISK_directory_create_for_file (fn))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _("Directory for file `%s' does not seem to be writable.\n"),
+                fn);
+    return NULL;
+  }
   if (GNUNET_OK == GNUNET_DISK_file_test (fn))
     GNUNET_DISK_file_backup (fn);
   w = GNUNET_new (struct GNUNET_FRIENDS_Writer);
@@ -155,6 +163,7 @@ GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg)
                                   GNUNET_DISK_OPEN_WRITE |
                                   GNUNET_DISK_OPEN_FAILIFEXISTS,
                                   GNUNET_DISK_PERM_USER_READ);
+  GNUNET_free (fn);
   if (NULL == w->fh)
   {
     GNUNET_free (w);
@@ -185,18 +194,18 @@ GNUNET_FRIENDS_write_stop (struct GNUNET_FRIENDS_Writer *w)
  * Add a friend to the friends file.
  *
  * @param w write handle
- * @param friend friend to add
+ * @param friend_id friend to add
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 int
 GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w,
-                      const struct GNUNET_PeerIdentity *friend)
+                      const struct GNUNET_PeerIdentity *friend_id)
 {
   char *buf;
   char *ret;
   size_t slen;
 
-  ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&friend->public_key);
+  ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&friend_id->public_key);
   GNUNET_asprintf (&buf,
                    "%s\n",
                    ret);