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.

drh 2015-02-08 21:30 trunk
Commit c6b233229ddbfaefd0c203091c492696996fea96
1 file changed +16
+16
--- src/setup.c
+++ src/setup.c
@@ -50,10 +50,12 @@
5050
}else{
5151
@ %h(zTitle)
5252
}
5353
@ </td><td width="5"></td><td valign="top">%h(zDesc)</td></tr>
5454
}
55
+
56
+
5557
5658
/*
5759
** WEBPAGE: /setup
5860
*/
5961
void setup_page(void){
@@ -69,10 +71,24 @@
6971
if( !cgi_header_contains("<base href=") ){
7072
@ <p class="generalError"><b>Configuration Error:</b> Please add
7173
@ <tt>&lt;base href="$secureurl/$current_page"&gt;</tt> after
7274
@ <tt>&lt;head&gt;</tt> in the <a href="setup_header">HTML header</a>!</p>
7375
}
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
7490
7591
@ <table border="0" cellspacing="3">
7692
setup_menu_entry("Users", "setup_ulist",
7793
"Grant privileges to individual users.");
7894
setup_menu_entry("Access", "setup_access",
7995
--- 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>&lt;base href="$secureurl/$current_page"&gt;</tt> after
72 @ <tt>&lt;head&gt;</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>&lt;base href="$secureurl/$current_page"&gt;</tt> after
74 @ <tt>&lt;head&gt;</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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button