Fossil SCM
On unix systems, test to make sure /dev/null and /dev/urandom are available and print warning messages at the top of the /setup screen if they are not.
Commit
c6b233229ddbfaefd0c203091c492696996fea96
Parent
fdfc039bb3bc3a9…
1 file changed
+16
+16
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -50,10 +50,12 @@ | ||
| 50 | 50 | }else{ |
| 51 | 51 | @ %h(zTitle) |
| 52 | 52 | } |
| 53 | 53 | @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr> |
| 54 | 54 | } |
| 55 | + | |
| 56 | + | |
| 55 | 57 | |
| 56 | 58 | /* |
| 57 | 59 | ** WEBPAGE: /setup |
| 58 | 60 | */ |
| 59 | 61 | void setup_page(void){ |
| @@ -69,10 +71,24 @@ | ||
| 69 | 71 | if( !cgi_header_contains("<base href=") ){ |
| 70 | 72 | @ <p class="generalError"><b>Configuration Error:</b> Please add |
| 71 | 73 | @ <tt><base href="$secureurl/$current_page"></tt> after |
| 72 | 74 | @ <tt><head></tt> in the <a href="setup_header">HTML header</a>!</p> |
| 73 | 75 | } |
| 76 | + | |
| 77 | +#if !defined(_WIN32) | |
| 78 | + /* Check for /dev/null and /dev/urandom. We want both devices to be present, | |
| 79 | + ** but they are sometimes omitted (by mistake) from chroot jails. */ | |
| 80 | + if( access("/dev/null", R_OK|W_OK) ){ | |
| 81 | + @ <p class="generalError">WARNING: Device "/dev/null" is not available | |
| 82 | + @ for reading and writing.</p> | |
| 83 | + } | |
| 84 | + if( access("/dev/urandom", R_OK) ){ | |
| 85 | + @ <p class="generalError">WARNING: Device "/dev/urandom" is not available | |
| 86 | + @ for reading. This means that the pseudo-random number generator used | |
| 87 | + @ by SQLite will be poorly seeded.</p> | |
| 88 | + } | |
| 89 | +#endif | |
| 74 | 90 | |
| 75 | 91 | @ <table border="0" cellspacing="3"> |
| 76 | 92 | setup_menu_entry("Users", "setup_ulist", |
| 77 | 93 | "Grant privileges to individual users."); |
| 78 | 94 | setup_menu_entry("Access", "setup_access", |
| 79 | 95 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -50,10 +50,12 @@ | |
| 50 | }else{ |
| 51 | @ %h(zTitle) |
| 52 | } |
| 53 | @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr> |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | ** WEBPAGE: /setup |
| 58 | */ |
| 59 | void setup_page(void){ |
| @@ -69,10 +71,24 @@ | |
| 69 | if( !cgi_header_contains("<base href=") ){ |
| 70 | @ <p class="generalError"><b>Configuration Error:</b> Please add |
| 71 | @ <tt><base href="$secureurl/$current_page"></tt> after |
| 72 | @ <tt><head></tt> in the <a href="setup_header">HTML header</a>!</p> |
| 73 | } |
| 74 | |
| 75 | @ <table border="0" cellspacing="3"> |
| 76 | setup_menu_entry("Users", "setup_ulist", |
| 77 | "Grant privileges to individual users."); |
| 78 | setup_menu_entry("Access", "setup_access", |
| 79 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -50,10 +50,12 @@ | |
| 50 | }else{ |
| 51 | @ %h(zTitle) |
| 52 | } |
| 53 | @ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr> |
| 54 | } |
| 55 | |
| 56 | |
| 57 | |
| 58 | /* |
| 59 | ** WEBPAGE: /setup |
| 60 | */ |
| 61 | void setup_page(void){ |
| @@ -69,10 +71,24 @@ | |
| 71 | if( !cgi_header_contains("<base href=") ){ |
| 72 | @ <p class="generalError"><b>Configuration Error:</b> Please add |
| 73 | @ <tt><base href="$secureurl/$current_page"></tt> after |
| 74 | @ <tt><head></tt> in the <a href="setup_header">HTML header</a>!</p> |
| 75 | } |
| 76 | |
| 77 | #if !defined(_WIN32) |
| 78 | /* Check for /dev/null and /dev/urandom. We want both devices to be present, |
| 79 | ** but they are sometimes omitted (by mistake) from chroot jails. */ |
| 80 | if( access("/dev/null", R_OK|W_OK) ){ |
| 81 | @ <p class="generalError">WARNING: Device "/dev/null" is not available |
| 82 | @ for reading and writing.</p> |
| 83 | } |
| 84 | if( access("/dev/urandom", R_OK) ){ |
| 85 | @ <p class="generalError">WARNING: Device "/dev/urandom" is not available |
| 86 | @ for reading. This means that the pseudo-random number generator used |
| 87 | @ by SQLite will be poorly seeded.</p> |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 | @ <table border="0" cellspacing="3"> |
| 92 | setup_menu_entry("Users", "setup_ulist", |
| 93 | "Grant privileges to individual users."); |
| 94 | setup_menu_entry("Access", "setup_access", |
| 95 |