miner.php disable 'gen' by default
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
diff --git a/API-README b/API-README
index 0701750..2829b95 100644
--- a/API-README
+++ b/API-README
@@ -1248,6 +1248,16 @@ N.B. the accuracy of the timing used to wait for the replies is
---------
Default:
+ $allowgen = false;
+
+Set $allowgen to true to allow customsummarypages to use 'gen'
+false means ignore any 'gen' options
+This is disabled by default due to the possible security risk
+of using it, see the end of this document for an explanation
+
+---------
+
+Default:
$rigipsecurity = true;
Set $rigipsecurity to false to show the IP/Port of the rig
diff --git a/miner.php b/miner.php
index 89b6bef..fb5efbd 100644
--- a/miner.php
+++ b/miner.php
@@ -3,7 +3,7 @@ session_start();
#
global $doctype, $title, $miner, $port, $readonly, $notify, $rigs;
global $mcast, $mcastexpect, $mcastaddr, $mcastport, $mcastcode;
-global $mcastlistport, $mcasttimeout;
+global $mcastlistport, $mcasttimeout, $allowgen;
global $rigipsecurity, $rigtotals, $forcerigtotals;
global $socksndtimeoutsec, $sockrcvtimeoutsec;
global $checklastshare, $poolinputs, $hidefields;
@@ -70,6 +70,10 @@ $mcastlistport = 4027;
# to wait for replies to the Multicast message
$mcasttimeout = 1.5;
#
+# Set $allowgen to true to allow customsummarypages to use 'gen'
+# false means ignore any 'gen' options
+$allowgen = false;
+#
# Set $rigipsecurity to false to show the IP/Port of the rig
# in the socket error messages and also show the full socket message
$rigipsecurity = true;
@@ -145,7 +149,7 @@ $poolspage = array(
'POOL.Has GBT=GBT', 'STATS.Times Sent=TSent',
'STATS.Bytes Sent=BSent', 'STATS.Net Bytes Sent=NSent',
'STATS.Times Recv=TRecv', 'STATS.Bytes Recv=BRecv',
- 'STATS.Net Bytes Recv=NRecv'));
+ 'STATS.Net Bytes Recv=NRecv', 'GEN.AvShr=AvShr'));
#
$poolssum = array(
'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted',
@@ -162,7 +166,9 @@ $poolsext = array(
'calc' => array('POOL.Difficulty Accepted' => 'sum', 'POOL.Difficulty Rejected' => 'sum',
'STATS.Times Sent' => 'sum', 'STATS.Bytes Sent' => 'sum',
'STATS.Net Bytes Sent' => 'sum', 'STATS.Times Recv' => 'sum',
- 'STATS.Bytes Recv' => 'sum', 'STATS.Net Bytes Recv' => 'sum'),
+ 'STATS.Bytes Recv' => 'sum', 'STATS.Net Bytes Recv' => 'sum',
+ 'POOL.Accepted' => 'sum'),
+ 'gen' => array('AvShr' => 'round(POOL.Difficulty Accepted/max(POOL.Accepted,1)*100)/100'),
'having' => array(array('STATS.Bytes Recv', '>', 0)))
);
@@ -2396,6 +2402,8 @@ function dogen($ext, $section, &$res, &$fields)
#
function processext($ext, $section, $res, &$fields)
{
+ global $allowgen;
+
$res = processcompare('where', $ext, $section, $res);
if (isset($ext[$section]['group']))
@@ -2464,7 +2472,7 @@ function processext($ext, $section, $res, &$fields)
}
// Generated fields (functions of other fields)
- if (isset($ext[$section]['gen']))
+ if ($allowgen === true && isset($ext[$section]['gen']))
dogen($ext, $section, $res, $fields);
return processcompare('having', $ext, $section, $res);