Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Francois PIETTE
> I know many people running tiny, fast applications on their old
> 9x boxes successfully, why throw them away? Some even use them as
> mail servers (i.e. Mercury32) or as NAT routers etc.

Agreed.
--
[EMAIL PROTECTED]
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Arno Garrels
Angus Robertson - Magenta Systems Ltd wrote:
>> OK, but why loading additional libraries when the same can be
>> achieved by using winsock2?
>> WSAIoctl/SIO_GET_INTERFACE_LIST should work even in W95
> 
> Winsock2 is an additional library, just a different additional
> library to IpHlpApi.

Not realy since WSocket.pas already uses winsock2 API. 

> No-one cares about Windows 95, nor really Windows 98 and ME which
> Microsoft has now abandoned, no new updates of any sort.

I know many people running tiny, fast applications on their old
9x boxes successfully, why throw them away? Some even use them as
mail servers (i.e. Mercury32) or as NAT routers etc.

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Angus Robertson - Magenta Systems Ltd
> I believe for common tasks that would require many developers to do
> the same thing, there should be common code in the component set.
> Thinking otherwise is not productive.

Rubbish.  This passive IP NAT stuff is hardly common, otherwise this 
mailing list would be full of requests for it.  

Using existing code is absolutely productive, it's always the fastest 
way to get development done.  Writing new code is always risky, thus all 
the buffering problems in ICS V5 and V6 recently.  

The FTP server component is only bare bones, it needs lots of stuff 
adding to events to make it useful already. 

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Angus Robertson - Magenta Systems Ltd
> OK, but why loading additional libraries when the same can be 
> achieved by using winsock2?  
> WSAIoctl/SIO_GET_INTERFACE_LIST should work even in W95 

It's new development, you wanted a simple solution.  Winsock2 is an 
additional library, just a different additional library to IpHlpApi. 
No-one cares about Windows 95, nor really Windows 98 and ME which 
Microsoft has now abandoned, no new updates of any sort. 

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Arno Garrels
Angus Robertson - Magenta Systems Ltd wrote:
>> Currently I just want a simple and fast check whether a peer
>> address is in the subnet in a FTP server I'm currently working on.
> 
> The simple solution is to create an event with a true/false response,
> and let the application do the hard work.  The application can then
> use either WMI or IpHelpApi in the event to check the subnet, for
> which free components for both can be downloaded from my site:

OK, but why loading additional libraries when the same can be achieved
by using winsock2? And WSAIoctl/SIO_GET_INTERFACE_LIST should work even
in W95 with Winsock2 update. IpHelpApi however is not available in W95,
and WMI seems to be available as an optional download for W9x only.
 
---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
 

 
> http://www.magsys.co.uk/delphi/
> 
> Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Fastream Technologies
I believe for common tasks that would require many developers to do
the same thing, there should be common code in the component set.
Thinking otherwise is not productive.

Regards,

SubZero

On Thu, 26 Oct 2006 16:33 +0100 (BST), Angus Robertson - Magenta
Systems Ltd <[EMAIL PROTECTED]> wrote:
> > Currently I just want a simple and fast check whether a peer
> > address is in the subnet in a FTP server I'm currently working on.
>
> The simple solution is to create an event with a true/false response,
> and let the application do the hard work.  The application can then use
> either WMI or IpHelpApi in the event to check the subnet, for which free
> components for both can be downloaded from my site:
>
> http://www.magsys.co.uk/delphi/
>
> Angus
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>


-- 
Fastream Technologies
Software IQ: Innovation & Quality
www.fastream.com | Email: [EMAIL PROTECTED] | Tel: +90-312-223-2830
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Angus Robertson - Magenta Systems Ltd
> Currently I just want a simple and fast check whether a peer
> address is in the subnet in a FTP server I'm currently working on.  

The simple solution is to create an event with a true/false response, 
and let the application do the hard work.  The application can then use 
either WMI or IpHelpApi in the event to check the subnet, for which free 
components for both can be downloaded from my site: 

http://www.magsys.co.uk/delphi/

Angus
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Arno Garrels
Francois Piette wrote:
> Maybe creating a new OverbyteIcsWinsock2.pas file with all stuff
> specific to winsock2 would be a good idea ?

Yeah, something for the ToDo list. Currently I just want a simple and
fast check whether a peer address is in the subnet in a FTP server I'm
currently working on.  

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Francois Piette
Maybe creating a new OverbyteIcsWinsock2.pas file with all stuff specific to
winsock2 would be a good idea ?

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Thursday, October 26, 2006 3:58 PM
Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr


> Francois PIETTE wrote:
> >>> Searching MSDN for SIO_GET_INTERFACE_LIST report a few hits. But
> >>> WSAIoctl doesn't lit it !
> >>
> >> Thanks I'll investigate more in this, my idea was to incude an
> >> utility function something like IsSameSubnet(IP: TInAddr): Boolean in
> >> WSocket.pas provided that it must not use IpHlpApi, supported by
> >> Winsock/WSocket.pas only.
> >
> > OK. I think it is important that TWSocket doesn't depend on IpHlpApi.
> > Anything needed from this API should be encapsulated in another
> > object which could optionnaly linked to TWSocket if the user need
> > that feature. The component should continue to work without need for
> > additional API.
>
> Concerning SIO_GET_INTERFACE_LIST and WSAIoctl I found this at M$:
> "Note  Support of this command is mandatory for Windows Sockets
> 2-compliant TCP/IP service providers."
> Also some websites claim that it works in Win98/ME/2K and 95 OSR2,
> and NT srv pack #3. So what about having the stuff below included
> in WSocket.pas? As you can see it is a lot due to missing Winsock2
> stuff in both Delphi and ICS.
>
> const
> ..
> { AG block added }
> {$EXTERNALSYM SIO_GET_INTERFACE_LIST}
> SIO_GET_INTERFACE_LIST  = $4004747F;
> {$EXTERNALSYM IFF_UP}
> IFF_UP  = $0001;
> {$EXTERNALSYM IFF_BROADCAST}
> IFF_BROADCAST   = $0002;
> {$EXTERNALSYM IFF_LOOPBACK}
> IFF_LOOPBACK= $0004;
> {$EXTERNALSYM IFF_POINTTOPOINT}
> IFF_POINTTOPOINT= $0008;
> {$EXTERNALSYM IFF_MULTICAST}
> IFF_MULTICAST   = $0010;
> type
> {$EXTERNALSYM sockaddr}
> sockaddr = record
> sa_family   : u_short;// address family
> sa_data : array [0..13] of Char;  // up to 14 bytes of direct
address
> end;
>
> {$EXTERNALSYM in6_addr}
> in6_addr = record
> case Integer of
> 0: (Byte : array [0..15] of u_char);
> 1: (Word : array [0..7]  of u_short);
> 2: (s6_bytes : array [0..15] of u_char);
> 3: (s6_addr  : array [0..15] of u_char);
> 4: (s6_words : array [0..7]  of u_short);
> end;
> TIn6Addr = in6_addr;
> PIn6Addr = ^in6_addr;
>
> {$EXTERNALSYM sockaddr_in6_old}
> sockaddr_in6_old = record
> sin6_family   : short;// AF_INET6
> sin6_port : u_short;  // Transport level port number
> sin6_flowinfo : u_long;   // IPv6 flow information
> sin6_addr : in6_addr; // IPv6 address
> end;
> TSockAddrIn6Old = sockaddr_in6_old;
> PSockAddrIn6Old = ^sockaddr_in6_old;
>
> {$EXTERNALSYM sockaddr_gen}
> sockaddr_gen = record
> case Integer of
> 0: (Address: sockaddr);
> 1: (AddressIn  : sockaddr_in);
> 2: (AddressIn6 : sockaddr_in6_old);
> end;
> TSockAddrGen = sockaddr_gen;
> PSockAddrGen = ^sockaddr_gen;
>
> {$EXTERNALSYM _INTERFACE_INFO}
> _INTERFACE_INFO = record
> iiFlags: u_long;// Interface flags
> iiAddress  : sockaddr_gen;  // Interface address
> iiBroadcastAddress : sockaddr_gen;  // Broadcast address
> iiNetmask  : sockaddr_gen;  // Network mask
> end;
> {$EXTERNALSYM INTERFACE_INFO}
> INTERFACE_INFO = _INTERFACE_INFO;
> TInterfaceInfo = INTERFACE_INFO;
> PInterfaceInfo = ^INTERFACE_INFO;
> { AG block end }
>
>
>
> function WSocketIsAddrInSubNet(saddr : TInAddr) : Boolean;
> var
> NumInterfaces   : Integer;
> BytesReturned   : Cardinal;
> PBuf: PChar;
> P   : PChar;
> I   : Integer;
> Err : Integer;
> BufSize : Cardinal;
> iInfo   : TInterfaceInfo;
> s   : TSocket;
> begin
> Result  := FALSE;
> BufSize := 20 * SizeOf(TInterfaceInfo);
> GetMem(PBuf, BufSize);
> try
> s := WSocket_Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-26 Thread Arno Garrels
Francois PIETTE wrote:
>>> Searching MSDN for SIO_GET_INTERFACE_LIST report a few hits. But
>>> WSAIoctl doesn't lit it !
>> 
>> Thanks I'll investigate more in this, my idea was to incude an
>> utility function something like IsSameSubnet(IP: TInAddr): Boolean in
>> WSocket.pas provided that it must not use IpHlpApi, supported by
>> Winsock/WSocket.pas only.
> 
> OK. I think it is important that TWSocket doesn't depend on IpHlpApi.
> Anything needed from this API should be encapsulated in another
> object which could optionnaly linked to TWSocket if the user need
> that feature. The component should continue to work without need for
> additional API.

Concerning SIO_GET_INTERFACE_LIST and WSAIoctl I found this at M$:
"Note  Support of this command is mandatory for Windows Sockets 
2-compliant TCP/IP service providers."
Also some websites claim that it works in Win98/ME/2K and 95 OSR2,
and NT srv pack #3. So what about having the stuff below included
in WSocket.pas? As you can see it is a lot due to missing Winsock2
stuff in both Delphi and ICS. 
 
const
..
{ AG block added }
{$EXTERNALSYM SIO_GET_INTERFACE_LIST}
SIO_GET_INTERFACE_LIST  = $4004747F;
{$EXTERNALSYM IFF_UP}
IFF_UP  = $0001;
{$EXTERNALSYM IFF_BROADCAST}
IFF_BROADCAST   = $0002;
{$EXTERNALSYM IFF_LOOPBACK}
IFF_LOOPBACK= $0004;
{$EXTERNALSYM IFF_POINTTOPOINT}
IFF_POINTTOPOINT= $0008;
{$EXTERNALSYM IFF_MULTICAST}
IFF_MULTICAST   = $0010;
type
{$EXTERNALSYM sockaddr}
sockaddr = record
sa_family   : u_short;// address family
sa_data : array [0..13] of Char;  // up to 14 bytes of direct 
address
end;

{$EXTERNALSYM in6_addr}
in6_addr = record
case Integer of
0: (Byte : array [0..15] of u_char);
1: (Word : array [0..7]  of u_short);
2: (s6_bytes : array [0..15] of u_char);
3: (s6_addr  : array [0..15] of u_char);
4: (s6_words : array [0..7]  of u_short);
end;
TIn6Addr = in6_addr;
PIn6Addr = ^in6_addr;

{$EXTERNALSYM sockaddr_in6_old}
sockaddr_in6_old = record
sin6_family   : short;// AF_INET6
sin6_port : u_short;  // Transport level port number
sin6_flowinfo : u_long;   // IPv6 flow information
sin6_addr : in6_addr; // IPv6 address
end;
TSockAddrIn6Old = sockaddr_in6_old;
PSockAddrIn6Old = ^sockaddr_in6_old;

{$EXTERNALSYM sockaddr_gen}
sockaddr_gen = record
case Integer of
0: (Address: sockaddr);
1: (AddressIn  : sockaddr_in);
2: (AddressIn6 : sockaddr_in6_old);
end;
TSockAddrGen = sockaddr_gen;
PSockAddrGen = ^sockaddr_gen;

{$EXTERNALSYM _INTERFACE_INFO}
_INTERFACE_INFO = record
iiFlags: u_long;// Interface flags
iiAddress  : sockaddr_gen;  // Interface address
iiBroadcastAddress : sockaddr_gen;  // Broadcast address
iiNetmask  : sockaddr_gen;  // Network mask
end;
{$EXTERNALSYM INTERFACE_INFO}
INTERFACE_INFO = _INTERFACE_INFO;
TInterfaceInfo = INTERFACE_INFO;
PInterfaceInfo = ^INTERFACE_INFO;
{ AG block end }



function WSocketIsAddrInSubNet(saddr : TInAddr) : Boolean;
var
NumInterfaces   : Integer;
BytesReturned   : Cardinal;
PBuf: PChar;
P   : PChar;
I   : Integer;
Err : Integer;
BufSize : Cardinal;
iInfo   : TInterfaceInfo;
s   : TSocket;
begin
Result  := FALSE;
BufSize := 20 * SizeOf(TInterfaceInfo);
GetMem(PBuf, BufSize);
try
s := WSocket_Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s = INVALID_SOCKET) then
raise ESocketException.Create('Socket creation failed');
try
while True do
begin
Err := WSocket_WSAIoCtl(s, SIO_GET_INTERFACE_LIST, nil, 0,
PBuf, BufSize, BytesReturned,
nil, nil);
if Err = SOCKET_ERROR then
Err := WSocket_WSAGetLastError;
case Err of
0 : Break;
WSAEFAULT :
begin
// How many interfaces are allowed ??
// No chance to get correct buffer size w/o probing
if BufSize > 1 * SizeOf(TInterfaceInfo) then
raise ESocketException.Create('Too many 
interfaces');
Inc(BufSize, 100 * SizeOf(TInterfaceInfo));
FreeMem(PBuf);
GetMem(PBuf, BufSize);
end;
else
raise Exception.Create(SysErrorMessage(Err));
end;

Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Francois PIETTE
>> Searching MSDN for SIO_GET_INTERFACE_LIST report a few hits. But
>> WSAIoctl doesn't lit it !
>
> Thanks I'll investigate more in this, my idea was to incude an utility
> function something like IsSameSubnet(IP: TInAddr): Boolean in
> WSocket.pas provided that it must not use IpHlpApi, supported by
> Winsock/WSocket.pas only.

OK. I think it is important that TWSocket doesn't depend on IpHlpApi. 
Anything needed from this API should be encapsulated in another object which 
could optionnaly linked to TWSocket if the user need that feature. The 
component should continue to work without need for additional API.

> Francois, is IPv6 and enhanced winsock2 support on your roadmap yet?

I have been asked for IPv6 only 2 or 3 times in the past few years. It's a 
feature not really needed at this time. Note that it is probably really easy 
to implement. I lloked at it once and the component probably doesn't need 
much changes.

Enhanced winsock2 would make the component more difficult for cross platform 
(I mean Kylix and .NET). Not sure which benefit could really be obtained. 
Probably only a really smal part of the applications would benefit of this.

So, no those topics are not on my roadmap.
There are for sure more interesting ways of enhancing ICS. I listed a few 
possibilities a few months ago. Remember ? Two frequently asked features are 
video and audio streaming.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Arno Garrels
Francois Piette wrote:
> Searching MSDN for SIO_GET_INTERFACE_LIST report a few hits. But
> WSAIoctl doesn't lit it !

Thanks I'll investigate more in this, my idea was to incude an utility
function something like IsSameSubnet(IP: TInAddr): Boolean in
WSocket.pas provided that it must not use IpHlpApi, supported by
Winsock/WSocket.pas only.
Francois, is IPv6 and enhanced winsock2 support on your roadmap yet?

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


 
>> Is IpHlpApi working on Win9x winsock2?
> 
> MSDN say GetInterfaceInfo is included in Windows XP, Windows 2000
> Professional, Windows Me, and Windows 98.
> 
> For GetIfTable, MSDN say it is included in Windows XP, Windows 2000
> Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me,
> and Windows 98.
> 
> So I guess the whole IP Helper API will not work for W95 but W98 and
> up. 
> 
> Contribute to the SSL Effort. Visit
> http://www.overbyte.be/eng/ssl.html --
> [EMAIL PROTECTED]
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
> 
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Wednesday, October 25, 2006 4:27 PM
> Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr
> 
> 
>> Francois Piette wrote:
>>>>> But I wonder if it was not better to trigger just an event
>>>>> before PasvIpAddr will be used that would allow the component
>>>>> user to do his individual checks, what do you think is better?
>>> 
>>> Maybe both ?
>>> Compute a PasvIpAddr and pass it as var parameter to an event which
>>> can then change it at will.
>> 
>> OK, one another question: Is it possible to get the netmask of
>> current IP without using IpHlpApi? I found a sample that calls
>> WSAIoctl with SIO_GET_INTERFACE_LIST but that requires some
>> structures i.e. INTERFACE_INFO or sockaddr_gen not being defined
>> in both Winsock.pas as well as WSocket.pas.
>> I need the network mask to check whether a peer address is in the
>> same subnet, would be nice to have it in WSocket.pas as another
>> utility function.
>> Is IpHlpApi working on Win9x winsock2?
>> 
>> ---
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> 
>>> 
>>> Contribute to the SSL Effort. Visit
>>> http://www.overbyte.be/eng/ssl.html --
>>> [EMAIL PROTECTED]
>>> Author of ICS (Internet Component Suite, freeware)
>>> Author of MidWare (Multi-tier framework, freeware)
>>> http://www.overbyte.be
>>> 
>>> 
>>> - Original Message -
>>> From: "Arno Garrels" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" 
>>> Sent: Wednesday, October 25, 2006 2:10 PM
>>> Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr
>>> 
>>> 
>>>> I need to check for the same subnet instead of
>>>> private IPs, sometimes I'm too slow :)
>>>> 
>>>> Arno Garrels wrote:
>>>>> Arno Garrels wrote:
>>>>>> Or modify the FTP server component in a way that
>>>>>> PasvIpAddr can be set privately for a particular client
>>>>>> depending on it's source IP (just an idea?).
>>>>> 
>>>>> I need such an option as well. So I just changed the code
>>>>> as mentioned above. New option ftpsNoPasvIpAddrInLan and
>>>>> a function that checks whether the peer address is in a
>>>>> private network or not.
>>>>> But I wonder if it was not better to trigger just an event
>>>>> before PasvIpAddr will be used that would allow the component
>>>>> user to do his individual checks, what do you think is better?
>>>>> 
>>>>> Currently I get the raw peer address in
>>>>> 
>>>>> procedure TFtpCtrlSocket.Dup(newHSocket : TSocket);
>>>>> var
>>>>> Len : Integer;
>>>>> begin
>>>>> inherited Dup(newHSocket);
>>>>> {$IFDEF CLR}
>>>>> if DesignMode then begin
>>>>> FPeerAddr := '';
>>>>> Exit;
>>>>> end;
>>>>> {$ENDIF}
>>>>> //FPeerAddr := inherited GetPeerAddr;
>>>>> Len := SizeOf(TSockAddr);
>>>>&

Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Francois Piette
Searching MSDN for SIO_GET_INTERFACE_LIST report a few hits. But WSAIoctl
doesn't lit it !

> Is IpHlpApi working on Win9x winsock2?

MSDN say GetInterfaceInfo is included in Windows XP, Windows 2000
Professional, Windows Me, and Windows 98.

For GetIfTable, MSDN say it is included in Windows XP, Windows 2000
Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me, and
Windows 98.

So I guess the whole IP Helper API will not work for W95 but W98 and up.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, October 25, 2006 4:27 PM
Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr


> Francois Piette wrote:
> >>> But I wonder if it was not better to trigger just an event
> >>> before PasvIpAddr will be used that would allow the component
> >>> user to do his individual checks, what do you think is better?
> >
> > Maybe both ?
> > Compute a PasvIpAddr and pass it as var parameter to an event which
> > can then change it at will.
>
> OK, one another question: Is it possible to get the netmask of
> current IP without using IpHlpApi? I found a sample that calls
> WSAIoctl with SIO_GET_INTERFACE_LIST but that requires some
> structures i.e. INTERFACE_INFO or sockaddr_gen not being defined
> in both Winsock.pas as well as WSocket.pas.
> I need the network mask to check whether a peer address is in the
> same subnet, would be nice to have it in WSocket.pas as another
> utility function.
> Is IpHlpApi working on Win9x winsock2?
>
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
>
>
> >
> > Contribute to the SSL Effort. Visit
> > http://www.overbyte.be/eng/ssl.html --
> > [EMAIL PROTECTED]
> > Author of ICS (Internet Component Suite, freeware)
> > Author of MidWare (Multi-tier framework, freeware)
> > http://www.overbyte.be
> >
> >
> > - Original Message -
> > From: "Arno Garrels" <[EMAIL PROTECTED]>
> > To: "ICS support mailing" 
> > Sent: Wednesday, October 25, 2006 2:10 PM
> > Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr
> >
> >
> >> I need to check for the same subnet instead of
> >> private IPs, sometimes I'm too slow :)
> >>
> >> Arno Garrels wrote:
> >>> Arno Garrels wrote:
> >>>> Or modify the FTP server component in a way that
> >>>> PasvIpAddr can be set privately for a particular client
> >>>> depending on it's source IP (just an idea?).
> >>>
> >>> I need such an option as well. So I just changed the code
> >>> as mentioned above. New option ftpsNoPasvIpAddrInLan and
> >>> a function that checks whether the peer address is in a
> >>> private network or not.
> >>> But I wonder if it was not better to trigger just an event
> >>> before PasvIpAddr will be used that would allow the component
> >>> user to do his individual checks, what do you think is better?
> >>>
> >>> Currently I get the raw peer address in
> >>>
> >>> procedure TFtpCtrlSocket.Dup(newHSocket : TSocket);
> >>> var
> >>> Len : Integer;
> >>> begin
> >>> inherited Dup(newHSocket);
> >>> {$IFDEF CLR}
> >>> if DesignMode then begin
> >>> FPeerAddr := '';
> >>> Exit;
> >>> end;
> >>> {$ENDIF}
> >>> //FPeerAddr := inherited GetPeerAddr;
> >>> Len := SizeOf(TSockAddr);
> >>> if WSocket_GetPeerName(newHSocket, FPeerSAddr, Len) = 0 then
> >>> FPeerAddr := WSocket_inet_ntoa(FPeerSAddr.sin_addr)
> >>> else begin
> >>> SocketError('GetPeerName');
> >>> Exit;
> >>> end;
> >>> end;
> >>>
> >>> PeerSAddr is a new property, we need to get it just once.
> >>>
> >>>
> >>> function IsIpPrivate(saddr : TSockAddrIn): Boolean;
> >>> begin
> >>> Result := (Byte(saddr.sin_addr.S_un_b.s_b1) = 10) or   //
> >>> private class A   (saddr.sin_addr.S_un_w.s_w1   =
> >>> 4268) or // private class B
> >>> (saddr.sin_addr.S_un_w.s_w1  

Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Arno Garrels
Francois Piette wrote:
>>> But I wonder if it was not better to trigger just an event
>>> before PasvIpAddr will be used that would allow the component
>>> user to do his individual checks, what do you think is better?
> 
> Maybe both ?
> Compute a PasvIpAddr and pass it as var parameter to an event which
> can then change it at will.

OK, one another question: Is it possible to get the netmask of
current IP without using IpHlpApi? I found a sample that calls
WSAIoctl with SIO_GET_INTERFACE_LIST but that requires some
structures i.e. INTERFACE_INFO or sockaddr_gen not being defined
in both Winsock.pas as well as WSocket.pas.
I need the network mask to check whether a peer address is in the
same subnet, would be nice to have it in WSocket.pas as another
utility function.
Is IpHlpApi working on Win9x winsock2?  

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> Contribute to the SSL Effort. Visit
> http://www.overbyte.be/eng/ssl.html --
> [EMAIL PROTECTED]
> Author of ICS (Internet Component Suite, freeware)
> Author of MidWare (Multi-tier framework, freeware)
> http://www.overbyte.be
> 
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Wednesday, October 25, 2006 2:10 PM
> Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr
> 
> 
>> I need to check for the same subnet instead of
>> private IPs, sometimes I'm too slow :)
>> 
>> Arno Garrels wrote:
>>> Arno Garrels wrote:
>>>> Or modify the FTP server component in a way that
>>>> PasvIpAddr can be set privately for a particular client
>>>> depending on it's source IP (just an idea?).
>>> 
>>> I need such an option as well. So I just changed the code
>>> as mentioned above. New option ftpsNoPasvIpAddrInLan and
>>> a function that checks whether the peer address is in a
>>> private network or not.
>>> But I wonder if it was not better to trigger just an event
>>> before PasvIpAddr will be used that would allow the component
>>> user to do his individual checks, what do you think is better?
>>> 
>>> Currently I get the raw peer address in
>>> 
>>> procedure TFtpCtrlSocket.Dup(newHSocket : TSocket);
>>> var
>>> Len : Integer;
>>> begin
>>> inherited Dup(newHSocket);
>>> {$IFDEF CLR}
>>> if DesignMode then begin
>>> FPeerAddr := '';
>>> Exit;
>>> end;
>>> {$ENDIF}
>>> //FPeerAddr := inherited GetPeerAddr;
>>> Len := SizeOf(TSockAddr);
>>> if WSocket_GetPeerName(newHSocket, FPeerSAddr, Len) = 0 then
>>> FPeerAddr := WSocket_inet_ntoa(FPeerSAddr.sin_addr)
>>> else begin
>>> SocketError('GetPeerName');
>>> Exit;
>>> end;
>>> end;
>>> 
>>> PeerSAddr is a new property, we need to get it just once.
>>> 
>>> 
>>> function IsIpPrivate(saddr : TSockAddrIn): Boolean;
>>> begin
>>> Result := (Byte(saddr.sin_addr.S_un_b.s_b1) = 10) or   //
>>> private class A   (saddr.sin_addr.S_un_w.s_w1   =
>>> 4268) or // private class B  
>>> (saddr.sin_addr.S_un_w.s_w1   = 43200);  // private class C end;
>>> 
>>> 
>>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>>> * * * * *} procedure TFtpServer.CommandPASV(
>>> ...
>>> else begin
>>> if (FPasvIpAddr = '') or
>>>((ftpsNoPasvIpAddrInLan in FOptions) and
>>>IsIpPrivate(Client.PeerSAddr)) then
>>> Answer := Format(msgPasvRemote,
>>>   [ord(IPAddr.S_un_b.s_b1),
>>>ord(IPAddr.S_un_b.s_b2),
>>>ord(IPAddr.S_un_b.s_b3),
>>>ord(IPAddr.S_un_b.s_b4),
>>>HiByte(DataPort),
>>>LoByte(DataPort)])
>>> else begin
>>> ...
>>> 
>>>> 
>>>> ---
>>>> Arno Garrels [TeamICS]
>>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>>> 
>>>> 
>>>> Arnold FLUTEAUX wrote:
>>>>> Ok, I understand that port 21 is an exception and the router
>>>>> replaces automatically the private IP by the public IP

Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Francois Piette
> > But I wonder if it was not better to trigger just an event
> > before PasvIpAddr will be used that would allow the component
> > user to do his individual checks, what do you think is better?

Maybe both ?
Compute a PasvIpAddr and pass it as var parameter to an event which can then
change it at will.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be


- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Wednesday, October 25, 2006 2:10 PM
Subject: Re: [twsocket] FTP server, problem with property PasvIpAddr


> I need to check for the same subnet instead of
> private IPs, sometimes I'm too slow :)
>
> Arno Garrels wrote:
> > Arno Garrels wrote:
> >> Or modify the FTP server component in a way that
> >> PasvIpAddr can be set privately for a particular client
> >> depending on it's source IP (just an idea?).
> >
> > I need such an option as well. So I just changed the code
> > as mentioned above. New option ftpsNoPasvIpAddrInLan and
> > a function that checks whether the peer address is in a
> > private network or not.
> > But I wonder if it was not better to trigger just an event
> > before PasvIpAddr will be used that would allow the component
> > user to do his individual checks, what do you think is better?
> >
> > Currently I get the raw peer address in
> >
> > procedure TFtpCtrlSocket.Dup(newHSocket : TSocket);
> > var
> > Len : Integer;
> > begin
> > inherited Dup(newHSocket);
> > {$IFDEF CLR}
> > if DesignMode then begin
> > FPeerAddr := '';
> > Exit;
> > end;
> > {$ENDIF}
> > //FPeerAddr := inherited GetPeerAddr;
> > Len := SizeOf(TSockAddr);
> > if WSocket_GetPeerName(newHSocket, FPeerSAddr, Len) = 0 then
> > FPeerAddr := WSocket_inet_ntoa(FPeerSAddr.sin_addr)
> > else begin
> > SocketError('GetPeerName');
> > Exit;
> > end;
> > end;
> >
> > PeerSAddr is a new property, we need to get it just once.
> >
> >
> > function IsIpPrivate(saddr : TSockAddrIn): Boolean;
> > begin
> > Result := (Byte(saddr.sin_addr.S_un_b.s_b1) = 10) or   // private
> > class A   (saddr.sin_addr.S_un_w.s_w1   = 4268) or //
> > private class B   (saddr.sin_addr.S_un_w.s_w1   =
> > 43200);  // private class C end;
> >
> >
> > {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> > * * * * *} procedure TFtpServer.CommandPASV(
> > ...
> > else begin
> > if (FPasvIpAddr = '') or
> >((ftpsNoPasvIpAddrInLan in FOptions) and
> >IsIpPrivate(Client.PeerSAddr)) then
> > Answer := Format(msgPasvRemote,
> >   [ord(IPAddr.S_un_b.s_b1),
> >ord(IPAddr.S_un_b.s_b2),
> >ord(IPAddr.S_un_b.s_b3),
> >ord(IPAddr.S_un_b.s_b4),
> >HiByte(DataPort),
> >LoByte(DataPort)])
> > else begin
> > ...
> >
> >>
> >> ---
> >> Arno Garrels [TeamICS]
> >> http://www.overbyte.be/eng/overbyte/teamics.html
> >>
> >>
> >> Arnold FLUTEAUX wrote:
> >>> Ok, I understand that port 21 is an exception and the router
> >>> replaces automatically the private IP by the public IP.  It's not
> >>> the case for others
> >>> ports. OK.
> >>>
> >>> And for these others cases, we must use PASVIPAdress in which, we
> >>> set public
> >>> IP.
> >>>
> >>> So now, suppose that I've a server behind a router with IP public is
> >>> 194.206.244.150 for example and IP private would be 192.2.1.3.   I
> >>> set PASVIPAdress with 194.206.244.150 on port 1985 and I connect it
> >>> on from
> >>> outside lan. So it's OK.
> >>>
> >>> And now, if I want to connect it from inside LAN. So I connect it
> >>> with 192.2.1.3, always in passiv mode on 1985 port. But in this
> >>> case, it's not
> >>> good because the server response to PASV command the IP public
> >>> 194.206.244.150 and the client can't connect from inside to
> >>> 194.206.244.150.
> >>>
> >>> What can I do for this case ?
> >>>
> >>> Sorry it's difficult to explain that in English; I'm French !
> >>>
> >>>
> >>>
> >>> Arnold
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] FTP server, problem with property PasvIpAddr

2006-10-25 Thread Arno Garrels
I need to check for the same subnet instead of 
private IPs, sometimes I'm too slow :)   

Arno Garrels wrote:
> Arno Garrels wrote:
>> Or modify the FTP server component in a way that
>> PasvIpAddr can be set privately for a particular client
>> depending on it's source IP (just an idea?).
> 
> I need such an option as well. So I just changed the code
> as mentioned above. New option ftpsNoPasvIpAddrInLan and
> a function that checks whether the peer address is in a
> private network or not.
> But I wonder if it was not better to trigger just an event
> before PasvIpAddr will be used that would allow the component
> user to do his individual checks, what do you think is better?
> 
> Currently I get the raw peer address in
> 
> procedure TFtpCtrlSocket.Dup(newHSocket : TSocket);
> var
> Len : Integer;
> begin
> inherited Dup(newHSocket);
> {$IFDEF CLR}
> if DesignMode then begin
> FPeerAddr := '';
> Exit;
> end;
> {$ENDIF}
> //FPeerAddr := inherited GetPeerAddr;
> Len := SizeOf(TSockAddr);
> if WSocket_GetPeerName(newHSocket, FPeerSAddr, Len) = 0 then
> FPeerAddr := WSocket_inet_ntoa(FPeerSAddr.sin_addr)
> else begin
> SocketError('GetPeerName');
> Exit;
> end;
> end;
> 
> PeerSAddr is a new property, we need to get it just once.
> 
> 
> function IsIpPrivate(saddr : TSockAddrIn): Boolean;
> begin
> Result := (Byte(saddr.sin_addr.S_un_b.s_b1) = 10) or   // private
> class A   (saddr.sin_addr.S_un_w.s_w1   = 4268) or //
> private class B   (saddr.sin_addr.S_un_w.s_w1   =
> 43200);  // private class C end;
> 
> 
> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * * * * *} procedure TFtpServer.CommandPASV(
> ...
> else begin
> if (FPasvIpAddr = '') or
>((ftpsNoPasvIpAddrInLan in FOptions) and
>IsIpPrivate(Client.PeerSAddr)) then
> Answer := Format(msgPasvRemote,
>   [ord(IPAddr.S_un_b.s_b1),
>ord(IPAddr.S_un_b.s_b2),
>ord(IPAddr.S_un_b.s_b3),
>ord(IPAddr.S_un_b.s_b4),
>HiByte(DataPort),
>LoByte(DataPort)])
> else begin
> ...
> 
>> 
>> ---
>> Arno Garrels [TeamICS]
>> http://www.overbyte.be/eng/overbyte/teamics.html
>> 
>> 
>> Arnold FLUTEAUX wrote:
>>> Ok, I understand that port 21 is an exception and the router
>>> replaces automatically the private IP by the public IP.  It's not
>>> the case for others
>>> ports. OK.
>>> 
>>> And for these others cases, we must use PASVIPAdress in which, we
>>> set public
>>> IP.
>>> 
>>> So now, suppose that I've a server behind a router with IP public is
>>> 194.206.244.150 for example and IP private would be 192.2.1.3.   I
>>> set PASVIPAdress with 194.206.244.150 on port 1985 and I connect it
>>> on from
>>> outside lan. So it's OK.
>>> 
>>> And now, if I want to connect it from inside LAN. So I connect it
>>> with 192.2.1.3, always in passiv mode on 1985 port. But in this
>>> case, it's not
>>> good because the server response to PASV command the IP public
>>> 194.206.244.150 and the client can't connect from inside to
>>> 194.206.244.150.
>>> 
>>> What can I do for this case ?
>>> 
>>> Sorry it's difficult to explain that in English; I'm French !
>>> 
>>> 
>>> 
>>> Arnold
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be