summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--entropy.c33
2 files changed, 20 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index ed4a40a87..655df5f90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,8 @@
33 - (djm) Update version in Redhat spec file 33 - (djm) Update version in Redhat spec file
34 - (djm) Merge some of Nalin Dahyabhai <nalin@redhat.com> changes from the 34 - (djm) Merge some of Nalin Dahyabhai <nalin@redhat.com> changes from the
35 Redhat 7.0 spec file 35 Redhat 7.0 spec file
36 - (djm) Make inability to read/write PRNG seedfile non-fatal
37
36 38
3720001015 3920001015
38 - (djm) Fix ssh2 hang on background processes at logout. 40 - (djm) Fix ssh2 hang on background processes at logout.
diff --git a/entropy.c b/entropy.c
index e9608d0d3..f4a655e04 100644
--- a/entropy.c
+++ b/entropy.c
@@ -35,7 +35,7 @@
35# include <floatingpoint.h> 35# include <floatingpoint.h>
36#endif /* HAVE_FLOATINGPOINT_H */ 36#endif /* HAVE_FLOATINGPOINT_H */
37 37
38RCSID("$Id: entropy.c,v 1.20 2000/09/29 01:12:36 djm Exp $"); 38RCSID("$Id: entropy.c,v 1.21 2000/10/16 09:13:43 djm Exp $");
39 39
40#ifndef offsetof 40#ifndef offsetof
41# define offsetof(type, member) ((size_t) &((type *)0)->member) 41# define offsetof(type, member) ((size_t) &((type *)0)->member)
@@ -514,10 +514,10 @@ prng_check_seedfile(char *filename) {
514 /* FIXME raceable: eg replace seed between this stat and subsequent open */ 514 /* FIXME raceable: eg replace seed between this stat and subsequent open */
515 /* Not such a problem because we don't trust the seed file anyway */ 515 /* Not such a problem because we don't trust the seed file anyway */
516 if (lstat(filename, &st) == -1) { 516 if (lstat(filename, &st) == -1) {
517 /* Fail on hard errors */ 517 /* Give up on hard errors */
518 if (errno != ENOENT) 518 if (errno != ENOENT)
519 fatal("Couldn't stat random seed file \"%s\": %s", filename, 519 debug("WARNING: Couldn't stat random seed file \"%s\": %s",
520 strerror(errno)); 520 filename, strerror(errno));
521 521
522 return(0); 522 return(0);
523 } 523 }
@@ -527,10 +527,12 @@ prng_check_seedfile(char *filename) {
527 fatal("PRNG seedfile %.100s is not a regular file", filename); 527 fatal("PRNG seedfile %.100s is not a regular file", filename);
528 528
529 /* mode 0600, owned by root or the current user? */ 529 /* mode 0600, owned by root or the current user? */
530 if (((st.st_mode & 0177) != 0) || !(st.st_uid == original_uid)) 530 if (((st.st_mode & 0177) != 0) || !(st.st_uid == original_uid)) {
531 fatal("PRNG seedfile %.100s must be mode 0600, owned by uid %d", 531 debug("WARNING: PRNG seedfile %.100s must be mode 0600, owned by uid %d",
532 filename, getuid()); 532 filename, getuid());
533 533 return(0);
534 }
535
534 return(1); 536 return(1);
535} 537}
536 538
@@ -569,15 +571,16 @@ prng_write_seedfile(void) {
569 /* Don't care if the seed doesn't exist */ 571 /* Don't care if the seed doesn't exist */
570 prng_check_seedfile(filename); 572 prng_check_seedfile(filename);
571 573
572 if ((fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0600)) == -1) 574 if ((fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0600)) == -1) {
573 fatal("couldn't access PRNG seedfile %.100s (%.100s)", filename, 575 debug("WARNING: couldn't access PRNG seedfile %.100s (%.100s)",
574 strerror(errno)); 576 filename, strerror(errno));
575 577 } else {
576 if (atomicio(write, fd, &seed, sizeof(seed)) != sizeof(seed)) 578 if (atomicio(write, fd, &seed, sizeof(seed)) != sizeof(seed))
577 fatal("problem writing PRNG seedfile %.100s (%.100s)", filename, 579 fatal("problem writing PRNG seedfile %.100s (%.100s)", filename,
578 strerror(errno)); 580 strerror(errno));
579 581
580 close(fd); 582 close(fd);
583 }
581} 584}
582 585
583void 586void