diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-10-31 09:32:16 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-10-31 09:32:16 +0100 |
commit | eb77ac831c61c9aa646df7865d7fb7a7e856db0e (patch) | |
tree | 727cf356e1cf7f6a7be7283de1861baed7f126bb /lib/gnutls_global.c | |
parent | 2b64138a70a031b8b6a122ea48ed460da94e45bb (diff) | |
download | gnutls-eb77ac831c61c9aa646df7865d7fb7a7e856db0e.tar.gz |
When gnutls_global_init() is called manually from the application check the urandom fd for validity
That addresses the issue where a server closes all open file descriptors
and then calls gnutls_global_init().
Diffstat (limited to 'lib/gnutls_global.c')
-rw-r--r-- | lib/gnutls_global.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index e4a303fcd6..5f340533d1 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -208,6 +208,14 @@ int gnutls_global_init(void) _gnutls_init++; if (_gnutls_init > 1) { + if (_gnutls_init == 1 && _gnutls_init_ret == 0) { + /* some applications may close the urandom fd + * before calling gnutls_global_init(). in that + * case reopen it */ + ret = _gnutls_rnd_check(); + if (ret < 0) + return gnutls_assert_val(ret); + } ret = _gnutls_init_ret; goto out; } |