diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-09 17:25:38 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-09 17:25:38 +0000 |
commit | 5dcf7a152a31c6fb7ad148a1e6a2978bb920925b (patch) | |
tree | 8dc7f46d9d532ea33b54c79e1df10db46bb8a055 | |
parent | 67774182fec1d740ce0d6342334066affd243e2e (diff) | |
download | gnunet-5dcf7a152a31c6fb7ad148a1e6a2978bb920925b.tar.gz gnunet-5dcf7a152a31c6fb7ad148a1e6a2978bb920925b.zip |
OR
-rw-r--r-- | src/util/crypto_rsa.c | 14 | ||||
-rw-r--r-- | src/util/disk.c | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index c3e0a7833..df4e24e7c 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -566,6 +566,8 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) | |||
566 | unsigned int cnt; | 566 | unsigned int cnt; |
567 | int ec; | 567 | int ec; |
568 | uint64_t fs; | 568 | uint64_t fs; |
569 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | ||
570 | struct GNUNET_PeerIdentity pid; | ||
569 | 571 | ||
570 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) | 572 | if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) |
571 | return NULL; | 573 | return NULL; |
@@ -622,8 +624,12 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) | |||
622 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", | 624 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", |
623 | filename); | 625 | filename); |
624 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); | 626 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); |
627 | GNUNET_CRYPTO_rsa_key_get_public (ret, &pub); | ||
628 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &pid.hashPubKey); | ||
625 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 629 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
626 | _("Stored new private key in `%s'.\n"), filename); | 630 | _("I am host `%s'. Stored new private key in `%s'.\n"), |
631 | GNUNET_i2s (&pid), | ||
632 | filename); | ||
627 | return ret; | 633 | return ret; |
628 | } | 634 | } |
629 | /* hostkey file exists already, read it! */ | 635 | /* hostkey file exists already, read it! */ |
@@ -716,6 +722,12 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) | |||
716 | sizeof (struct RsaPrivateKeyBinaryEncoded))) | 722 | sizeof (struct RsaPrivateKeyBinaryEncoded))) |
717 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); | 723 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); |
718 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); | 724 | GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); |
725 | GNUNET_CRYPTO_rsa_key_get_public (ret, &pub); | ||
726 | GNUNET_CRYPTO_hash (&pub, sizeof (pub), &pid.hashPubKey); | ||
727 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
728 | _("I am host `%s'. Read private key from `%s'.\n"), | ||
729 | GNUNET_i2s (&pid), | ||
730 | filename); | ||
719 | return ret; | 731 | return ret; |
720 | } | 732 | } |
721 | 733 | ||
diff --git a/src/util/disk.c b/src/util/disk.c index c1a988464..fa737843c 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -1208,7 +1208,7 @@ GNUNET_DISK_file_open (const char *fn, | |||
1208 | return NULL; | 1208 | return NULL; |
1209 | } | 1209 | } |
1210 | if (flags & GNUNET_DISK_OPEN_FAILIFEXISTS) | 1210 | if (flags & GNUNET_DISK_OPEN_FAILIFEXISTS) |
1211 | oflags |= (O_CREAT & O_EXCL); | 1211 | oflags |= (O_CREAT | O_EXCL); |
1212 | if (flags & GNUNET_DISK_OPEN_TRUNCATE) | 1212 | if (flags & GNUNET_DISK_OPEN_TRUNCATE) |
1213 | oflags |= O_TRUNC; | 1213 | oflags |= O_TRUNC; |
1214 | if (flags & GNUNET_DISK_OPEN_APPEND) | 1214 | if (flags & GNUNET_DISK_OPEN_APPEND) |