Browse Source

Merge commit '9f27831' into cg_merges_20131023a

Conflicts:
	miner.php
Luke Dashjr 12 years ago
parent
commit
bcaa3386de
2 changed files with 22 additions and 4 deletions
  1. 10 0
      README.RPC
  2. 12 4
      miner.php

+ 10 - 0
README.RPC

@@ -1279,6 +1279,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:
 Default:
  $rigipsecurity = true;
  $rigipsecurity = true;
 
 

+ 12 - 4
miner.php

@@ -4,7 +4,7 @@ date_default_timezone_set(@date_default_timezone_get());
 #
 #
 global $doctype, $title, $miner, $port, $readonly, $notify, $rigs;
 global $doctype, $title, $miner, $port, $readonly, $notify, $rigs;
 global $mcast, $mcastexpect, $mcastaddr, $mcastport, $mcastcode;
 global $mcast, $mcastexpect, $mcastaddr, $mcastport, $mcastcode;
-global $mcastlistport, $mcasttimeout;
+global $mcastlistport, $mcasttimeout, $allowgen;
 global $rigipsecurity, $rigtotals, $forcerigtotals;
 global $rigipsecurity, $rigtotals, $forcerigtotals;
 global $socksndtimeoutsec, $sockrcvtimeoutsec;
 global $socksndtimeoutsec, $sockrcvtimeoutsec;
 global $checklastshare, $poolinputs, $hidefields;
 global $checklastshare, $poolinputs, $hidefields;
@@ -75,6 +75,10 @@ $mcastlistport = 4027;
 # to wait for replies to the Multicast message
 # to wait for replies to the Multicast message
 $mcasttimeout = 1.5;
 $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
 # Set $rigipsecurity to false to show the IP/Port of the rig
 # in the socket error messages and also show the full socket message
 # in the socket error messages and also show the full socket message
 $rigipsecurity = true;
 $rigipsecurity = true;
@@ -147,7 +151,7 @@ $poolspage = array(
  'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL',
  'POOL+STATS' => array('STATS.ID=ID', 'POOL.URL=URL',
 			'POOL.Has Stratum=Stratum', 'POOL.Stratum Active=StrAct',
 			'POOL.Has Stratum=Stratum', 'POOL.Stratum Active=StrAct',
 			'STATS.Net Bytes Sent=NSent',
 			'STATS.Net Bytes Sent=NSent',
-			'STATS.Net Bytes Recv=NRecv'));
+			'STATS.Net Bytes Recv=NRecv', 'GEN.AvShr=AvShr'));
 #
 #
 $poolssum = array(
 $poolssum = array(
  'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted',
  'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted',
@@ -162,7 +166,9 @@ $poolsext = array(
 	'group' => array('POOL.URL', 'POOL.Has Stratum', 'POOL.Stratum Active'),
 	'group' => array('POOL.URL', 'POOL.Has Stratum', 'POOL.Stratum Active'),
 	'calc' => array(
 	'calc' => array(
 			'STATS.Net Bytes Sent' => 'sum',
 			'STATS.Net Bytes Sent' => 'sum',
-			'STATS.Net 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)))
 	'having' => array(array('STATS.Bytes Recv', '>', 0)))
 );
 );
 
 
@@ -2427,6 +2433,8 @@ function dogen($ext, $section, &$res, &$fields)
 #
 #
 function processext($ext, $section, $res, &$fields)
 function processext($ext, $section, $res, &$fields)
 {
 {
+ global $allowgen;
+
  $res = processcompare('where', $ext, $section, $res);
  $res = processcompare('where', $ext, $section, $res);
 
 
  if (isset($ext[$section]['group']))
  if (isset($ext[$section]['group']))
@@ -2495,7 +2503,7 @@ function processext($ext, $section, $res, &$fields)
  }
  }
 
 
  // Generated fields (functions of other fields)
  // Generated fields (functions of other fields)
- if (isset($ext[$section]['gen']))
+ if ($allowgen === true && isset($ext[$section]['gen']))
 	dogen($ext, $section, $res, $fields);
 	dogen($ext, $section, $res, $fields);
 
 
  return processcompare('having', $ext, $section, $res);
  return processcompare('having', $ext, $section, $res);