2003.03.19 (水) 05:02:32 <u*j*2*6*> shuusei21179+21181と同じです

shuusei24131:指定申告ポートでのログインをブロック(original source by Heracules)

diff --dos -wurN 24130/constants.pas 24131/constants.pas
--- 24130/constants.pas	Fri Mar 14 11:49:58 2003
+++ 24131/constants.pas	Wed Mar 19 04:51:12 2003
@@ -27,8 +27,8 @@
  SLAVANAP_VERSION             = '2.4.1';
  SLAVANAP_BUILD               = '108';
  SLAVANAP_BUILD_DATE          = '24 January 2003';
- SLAVANAP_SHUUSEI             = '30';
- SLAVANAP_SHUUSEI_DATE        = '14 March 2003';
+ SLAVANAP_SHUUSEI             = '31';
+ SLAVANAP_SHUUSEI_DATE        = '19 March 2003';
  SLAVANAP_VERSION_SHORT       = SLAVANAP_TITLE+' '+SLAVANAP_VERSION;
  SLAVANAP_FULL                = SLAVANAP_TITLE+' '+SLAVANAP_VERSION+
                                 ' (build '+SLAVANAP_BUILD+
diff --dos -wurN 24130/handler.pas 24131/handler.pas
--- 24130/handler.pas	Fri Mar 14 12:00:42 2003
+++ 24131/handler.pas	Wed Mar 19 04:47:02 2003
@@ -1065,6 +1065,14 @@
    LoginError(GetLangT(LNG_INVALIDSOFTWARE));
    exit;
  end;
+ if not check_port(StrToIntDef(hlist.Strings[2],-1)) then
+ begin
+   LoginError('当サーバではポート'+hlist.Strings[2]+'の使用は禁止しています。');
+   If (log_login) then
+     Log(slDebugData,'申告ポート'+hlist.Strings[2]+'のため、'
+       +hlist.Strings[0]+'のログインをブロックしました.');
+   exit;
+ end;
  tmp_pos:=12262;
  for i:=0 to MAX_LISTEN_TRAPSOCKET do
  begin
diff --dos -wurN 24130/mainform.pas 24131/mainform.pas
--- 24130/mainform.pas	Wed Mar 12 10:09:08 2003
+++ 24131/mainform.pas	Wed Mar 19 04:19:12 2003
@@ -1446,6 +1446,10 @@
   SplitString(str,list);
   for i:=0 to list.Count-1 do
     trap_port[i]:=StrToIntDef(list.Strings[i],0);
+  block_transferport:=ini.ReadBool('Other2','BlockTransferPort',false);
+  blocked_transferport:=ini.ReadString('Other2','BlockedTransferPort','6699 7743');
+  StrHash_Reset(blocked_transferport_list);
+  SplitString(blocked_transferport,blocked_transferport_list);
   // set up console
   LogStartup('mainform::loadconfig: setting up console user');
   cons_channels:=TMyList.Create;
@@ -1886,6 +1890,8 @@
   ini.WriteBool('Other2','DisableFakeExt',disable_fakeext);
   ini.WriteString('Other2','FakeExt',fakeext);
   ini.WriteBool('Other2','EnableTrapPort',enable_trapport);
+  ini.WriteBool('Other2','BlockTransferPort',block_transferport);
+  ini.WriteString('Other2','BlockedTransferPort',blocked_transferport);
   finally
   ini.Free;
  end;
diff --dos -wurN 24130/settings.dfm 24131/settings.dfm
--- 24130/settings.dfm	Sun Feb 09 16:20:18 2003
+++ 24131/settings.dfm	Wed Mar 19 04:23:54 2003
@@ -1922,7 +1922,7 @@
           Width = 156
           Height = 20
           Style = csDropDownList
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 9
         end
       end
@@ -2435,7 +2435,7 @@
           Width = 111
           Height = 20
           Style = csDropDownList
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 1
         end
         object Edit_cons_autojoin1: TEdit
@@ -5494,7 +5494,7 @@
           Width = 156
           Height = 20
           Style = csDropDownList
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 9
         end
       end
@@ -5961,6 +5961,23 @@
           TabOrder = 9
           Text = '8888 8875 7743'
           Visible = False
+        end
+        object cb_block_transferport: TCheckBox
+          Left = 8
+          Top = 256
+          Width = 217
+          Height = 17
+          Caption = '指定申告ポートでのログインをブロック'
+          TabOrder = 10
+          OnClick = cb_block_transferportClick
+        end
+        object edit_blocked_transferport: TEdit
+          Left = 248
+          Top = 254
+          Width = 105
+          Height = 20
+          TabOrder = 11
+          Text = '6699 7743'
         end
       end
     end
diff --dos -wurN 24130/settings.pas 24131/settings.pas
--- 24130/settings.pas	Sun Feb 09 14:22:46 2003
+++ 24131/settings.pas	Wed Mar 19 04:25:02 2003
@@ -573,6 +573,8 @@
     edit_fakeext: TEdit;
     cb_enable_trapport: TCheckBox;
     edit_trapport: TEdit;
+    cb_block_transferport: TCheckBox;
+    edit_blocked_transferport: TEdit;
     procedure Panel3Resize(Sender: TObject);
     procedure headerPaint(Sender: TObject);
     procedure SetTopText(str: String);
@@ -650,6 +652,7 @@
     procedure rd_wqfloodblock_leechClick(Sender: TObject);
     procedure cb_disable_fakeextClick(Sender: TObject);
     procedure cb_enable_trapportClick(Sender: TObject);
+    procedure cb_block_transferportClick(Sender: TObject);
   private
     { Private declarations }
     procedure SetBanItems(control: TComboBox);
@@ -1485,6 +1488,9 @@
   finally
    ini.Free;
  end;
+ cb_block_transferport.Checked:=block_transferport;
+ edit_blocked_transferport.Visible:=cb_block_transferport.Checked;
+ edit_blocked_transferport.Text:=blocked_transferport;
 end;
 
 procedure TSlavaNapSettings.sh_reportShow(Sender: TObject);
@@ -2020,6 +2026,8 @@
     finally
      ini.Free;
    end;
+   block_transferport:=cb_block_transferport.Checked;
+   blocked_transferport:=edit_blocked_transferport.Text;
   except
  end;
  btn_restoreClick(nil);
@@ -2442,6 +2450,11 @@
 procedure TSlavaNapSettings.cb_enable_trapportClick(Sender: TObject);
 begin
   edit_trapport.Visible:=cb_enable_trapport.Checked;
+end;
+
+procedure TSlavaNapSettings.cb_block_transferportClick(Sender: TObject);
+begin
+  edit_blocked_transferport.Visible:=cb_block_transferport.Checked;
 end;
 
 end.
diff --dos -wurN 24130/stypes.pas 24131/stypes.pas
--- 24130/stypes.pas	Tue Jan 28 22:48:34 2003
+++ 24131/stypes.pas	Wed Mar 19 04:44:42 2003
@@ -173,6 +173,7 @@
 function  null_pass: String;
 function  check_name(str:String; ignore: Boolean=false):Boolean;
 function  check_software(str: String): Boolean;
+function  check_port(port: Integer): Boolean;
 function  channelname(str: String):String;
 function  GetIndex(list: TMyStringList; str: String; ignore_case: Boolean): Integer;
 procedure check_name_key(var Key: Char);
@@ -1225,6 +1226,25 @@
     exit;
  if lowercase(trim(str))='slavanap console' then exit;
  Result:=true;
+end;
+
+function check_port(port: Integer): Boolean;
+var
+  p: PStringHashItem;
+begin
+  Result:=False;
+  if not block_transferport then
+  begin
+    Result:=True;
+    exit;
+  end;
+  p:=blocked_transferport_list.first;
+  while p^.next<>nil do
+  begin
+    if port=StrToIntDef(p^.data,-1) then exit;
+    p:=p^.next;
+  end;
+  Result:=True;
 end;
 
 function  channelname(str: String):String;
diff --dos -wurN 24130/vars.pas 24131/vars.pas
--- 24130/vars.pas	Wed Mar 12 10:10:40 2003
+++ 24131/vars.pas	Wed Mar 19 04:12:56 2003
@@ -318,6 +318,9 @@
  trap_socket: Array[0..MAX_LISTEN_TRAPSOCKET] of HSocket;
  trap_port: Array[0..MAX_LISTEN_TRAPSOCKET] of Integer;
  cons_browse: TMyList;
+ block_transferport: Boolean;
+ blocked_transferport: String;
+ blocked_transferport_list: TStringHash;
 implementation
 
 procedure CheckWindows;