tor: added directory port to tor.cgi
authorJan Paul Tuecking <earl@ipfire.org>
Sat, 7 Sep 2013 12:47:28 +0000 (14:47 +0200)
committerJan Paul Tuecking <earl@ipfire.org>
Sat, 7 Sep 2013 12:47:28 +0000 (14:47 +0200)
html/cgi-bin/tor.cgi

index b6526b91cb1ec00d5a1a030cd30232ff710da63d..befd5083442993a57168fa6315ccdeba3b20b568 100755 (executable)
@@ -108,6 +108,7 @@ $settings{'TOR_RELAY_ENABLED'} = 'off';
 $settings{'TOR_RELAY_MODE'} = 'exit';
 $settings{'TOR_RELAY_ADDRESS'} = '';
 $settings{'TOR_RELAY_PORT'} = 9001;
+$settings{'TOR_RELAY_DIRPORT'} = 0;
 $settings{'TOR_RELAY_NICKNAME'} = '';
 $settings{'TOR_RELAY_CONTACT_INFO'} = '';
 $settings{'TOR_RELAY_BANDWIDTH_RATE'} = 0;
@@ -143,6 +144,11 @@ if ($settings{'ACTION'} eq $Lang::tr{'save'}) {
        if (!&General::validport($settings{'TOR_RELAY_PORT'})) {
                $errormessage = "$Lang::tr{'tor errmsg invalid relay port'}: $settings{'TOR_RELAY_PORT'}";
        }
+       if ($settings{'TOR_RELAY_DIRPORT'} ne '0') {
+               if (!&General::validport($settings{'TOR_RELAY_DIRPORT'})) {
+                       $errormessage = "$Lang::tr{'tor errmsg invalid directory port'}: $settings{'TOR_RELAY_DIRPORT'}";
+               }
+       }
 
        if ($settings{'TOR_RELAY_ADDRESS'} ne '') {
                if ((!&General::validfqdn($settings{'TOR_RELAY_ADDRESS'})) && (!&General::validip($settings{'TOR_RELAY_ADDRESS'}))) {
@@ -395,6 +401,14 @@ END
                                        <input type='text' name='TOR_RELAY_PORT' value='$settings{'TOR_RELAY_PORT'}' size='5' />
                                </td>
                        </tr>
+                       <tr>
+                               <td width='25%'>&nbsp;</td>
+                               <td width='30%'>&nbsp;</td>
+                               <td width='25%' class='base'>$Lang::tr{'tor directory port'}:</td>
+                               <td width='20%'>
+                                       <input type='text' name='TOR_RELAY_DIRPORT' value='$settings{'TOR_RELAY_DIRPORT'}' size='5' />&nbsp;$Lang::tr{'tor 0 = disabled'}
+                               </td>
+                       </tr>
                        <tr>
                                <td width='25%' class='base'>$Lang::tr{'tor contact info'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
                                <td width='75%' colspan='3'>
@@ -683,6 +697,10 @@ sub BuildConfiguration() {
 
                print FILE "ORPort $settings{'TOR_RELAY_PORT'}\n";
 
+               if ($settings{'TOR_RELAY_DIRPORT'} ne '0') {
+                       print FILE "DirPort $settings{'TOR_RELAY_DIRPORT'}\n";
+               }
+
                if ($settings{'TOR_RELAY_ADDRESS'} ne '') {
                        print FILE "Address $settings{'TOR_RELAY_ADDRESS'}\n";
                }