Re: [twsocket] IMAP4 support

2012-01-23 Thread Zvone
What do you mean it limits number of items via POP3? How many new mails you
have?

Gmail AFAIK only disables standard behavior of DELE command and instead of
deleting it acts as set in settings of Gmail account (usually marks message
as read).

Also, once email has been accessed through POP3 it cannot be accessed
anymore even though you didn't delete it. Gmail treats RETR as if you
submitted RETR and DELE afterwards even if you didn't submit DELE. But it
didn't limit me to access all emails so far (once).
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Merry Christmas

2011-12-24 Thread Zvone
Čestit Božić i Sretna Nova Godina! (from Croatia)
(Merry Christmas and Happy New Year)

There, more funny characters for you to test your decoders :)
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

[twsocket] 64 bit NNTP Article IDs

2011-12-24 Thread Zvone
Here is a thing I posted on Indy forums but also concerns Overbyte package
too.

According to RFC-3977 article number is supposed to increase until it
reaches bounds of 31-bit value - 2,147,483,647 (
http://tools.ietf.org/html/rfc3977#page-24) and while servers are not
allowed to send higher value by RFC, the RFC is still open to this
possibility and advises for newsreaders to have internal structures
prepared to hold higher values like unsigned 64 bit or so. In fact for some
high-volume newsgroups this number has been exceeded already (
http://en.wikipedia.org/wiki/Alt.binaries.boneless) and some newsreaders
have issues handling this. Some of the most popular news servers like
GigaNews are already sending high bound number in unsigned 64-bit format
and are recommending for newsreaders to implement this as well -
http://www.giganews.com/news/article/64-bit-Usenet.html - Note that this is
their recommendation but this is not necessary how other servers may handle
this - some may simply wrap counters to 32-bit value ignoring the high bits.

When the number reaches 32-bit limit odd things may happen in newsreaders -
they may stop accepting new articles. Some servers might (not sure) wrap
article numbers to reset the count. But most popular ones have chosen not
to do so but continue increasing the number and this is likely to happen
for others as well. In any case, using 64 bit integer for Article ID's is
better and safer at least until most news servers are either upgraded or
RFC is updated or it is decided what format to use.

OverbyteIcsNntpCli.pas uses 32-bit number and GetInteger function to
convert number to integer rather than StrToInt64. Additionally it uses -1
value as well which further limits the use of 32-bit range. Extending to
even 63-bit value (not even need for 64 bit unsigned) as 63 bit integer is
still a very very very very large number not likely to be reached anytime
soon even in alt.binaries.boneless.

How complicated a change to 64 bit article ID's is?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Restricted ports on the Mac

2011-11-04 Thread Zvone
Maybe a stupid question but have you tried to telnet to localhost, port 21
to see if anything else listens on it? perhaps a hanged process/thread?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] thread safety and async operation

2011-08-17 Thread Zvone
Basically you answered what I needed to know. As long as no ProcessMessages
is called it is safe to use in non-thread safe environment with single
thread. Thanks for the answer.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] [OT] What are possible dangers using ICS-SSL without SSLversion chec

2011-04-03 Thread Zvone
It is definitely possible to have issues with UPX but I would say that's a
bit too sensitive heuristics. With better (read: paid) anti-viri programs I
never had any issues - they recognize UPX and unpack it properly and check
for whatever is inside. Only AVG and similar software (free versions) had
this issues - not to pick on any in particular.

But back on topic - we could really use updated SSL DLL's on Overbyte wiki.
There has been another security fix since 0.98n version and 1.0.x version
should now be relatively stable and IMHO supported too. Someone cares to
update it? ;)
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] [OT] What are possible dangers using ICS-SSL without SSLversion chec

2011-04-03 Thread Zvone
Also, is there a mechanism (in ICS) to check for invalid root certificates
(regarding the recent SSL issue with bad Comodo certificates)?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] How to set in GSSLEAY_DLL_Name under BCB2010?

2011-03-01 Thread Zvone
GSSLEAY_DLL_Name = SSLEAY32.DLL;
doesn't seem to work!

well it should. could be a problem with installation? maybe you're missing
some of the #pragma's in the cpp file?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] SSL send emai using gmail?

2011-02-22 Thread Zvone
A kind of related note - if you are downloading mail from Gmail (using POP3)
Gmail does not behave as usual servers where you issue RETR command and
deletes message only after you issue DELE command but instead it uses
settings from Gmail account and seems to ignore DELE command completely. If
you are not using POP3 but only SMTP then care about this.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Why ICS prefers non-blocking sockets?

2011-02-22 Thread Zvone
When I looked at Indy and Ararat Synapse they both prefer blocking sockets
to connect to text-based protocols like HTTP, POP, SMTP, FTP etc.

The reason - because communication is flowed - you send command, you wait
reply, if reply does not match you handle error. It is all nice line-by-line
inline code.

With ICS it uses events to reply to reply codes and non-blocking. But with
this you lose - easy to follow code flow. If you really need to make it
independent you simply put it in separate thread - both Indy and Synapse
have their own way of solving this - Indy has special component for
threading sockets and Synapse some kind of function that gets called every
once in a while.

It is all much better explained here why blocking is better:
http://www.ararat.cz/synapse/doku.php/about

So I am wondering why ICS prefers events when the code is so much simpler
without them?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] SSL send emai using gmail?

2011-02-22 Thread Zvone
See:

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


Re: [twsocket] Season's greetings

2010-12-23 Thread Zvone
Merry Christmas and Happy 2011 from Croatia to all of you guys
especially Francois, Arno and Angus... and big thanks for all the help
and tips provided so far! You have no idea how much it is appreciated!
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] MIME, TMimeDecodeW and IP*Works

2010-10-24 Thread Zvone
I was looking a bit at how IP*Works operates that is included in Delphi/CB XE.

With MIME decoder it has a nice feature of decoding parts on demand.

Basically it scans MIME message for available parts and builds a list
of available parts. They are not decoded at this point. When you
access array elements though, they are being decoded dynamically.

So for larger messages it won't allocate lots of memory before you
actually need a certain large part but you can still get info about
message for previewing purposes and also it won't use a lot of CPU
time (like when you run base64 decoder on a large file).

So I was thinking that would be nice for TMimeDecodeW as well - or
maybe it already operates that way?

Any thoughts on this?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Combining ICS with Indy

2010-10-24 Thread Zvone
Someone before here mentioned compiler errors with CB and ICS. Errors like:

[BCC32 Error] ws2def.h(213): E2238 Multiple declaration for 'sockaddr'
[BCC32 Error] winsock.h(486): E2344 Earlier declaration of 'sockaddr'
[BCC32 Error] ws2def.h(222): E2146 Need an identifier to declare
[BCC32 Error] ws2def.h(391): E2184 Enum syntax error
[BCC32 Error] ws2def.h(444): E2040 Declaration terminated incorrectly

I had the same thing. The problem was when I tried to include in
single cpp/hpp unit ICS and Indy. In particular the issue causing this
was IdMessage in combination with OverbyteIcsMimeDec

These two headers conflict:

#include OverbyteIcsMimeDec.hpp
#include IdMessage.hpp

I wasn't able to place them in single unit to compile successfully.
Only after putting Indy in different unit (on another form) and
changing the include order of form include files it finally compiled.

I'm not sure which of these headers didn't check if ws2def.h or
winsock.h wasn't already included but I would suggest a check when
building these headers in ICS to place a check whether a particular
header is already included so it doesn't get included twice.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS V7 and TLS support

2010-10-15 Thread Zvone
 First off, does ICS V7 support the newest TLS version 1.2 ?

whatever 0.9.8n supports, ICS should support. so take a look what 098n
supports in openssl docs.

 dynamically when a ICS-SSL application starts ?

on first use (first connection), not when app starts but when SSL/TLS
component is used, or you can initialize / load libraries manually
when you init context - which is better because you can detect if
dll's are missing from the folder.

arno's example code:

try
GSSLEAY_DLL_Name := full path and filename;
GLIBEAY_DLL_Name := full path and filename;
MySslContext.InitContext;
except
// Something went wrong with loading OSSL, handle it.
end;


 There has been made bugfixes a.o. in the OpenSSL versions succeeding
 0.9.8e and 0.9.8h.
 Is ICS-SSL limited to 0.9.8e/h or can newer versions be used ?

ICS can use 0.9.8n which is more recent than both versions you
mention. You can find it here:
http://wiki.overbyte.be/wiki/index.php/ICS_Download

More recent is only 0.9.8o.

Occasionally, TeamICS makes new version builds and tests ICS against
them. 098n is not the latest but is stable. better choice only would
be 0.9.8o at the moment.
versions 1.xx are not yet stable so 098x are better for production
purposes but eventually they will replace 098x versions.

the above dlls don't require any external dependencies so are best for
use with your app probably.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] OT: Keyloggers and the way Microsoft treats them

2010-10-13 Thread Zvone
be thankful for it and make your own and make money on it.
ms thinks on a corporate level and what their corporate heads think is
good for their users. it is a whole different mindset than regular
users mindset.
by the time they figure it out you'll have tons of money just for that
simple idea. if you really make money on it, you can thank me later :)
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TCP LocalPort...

2010-10-09 Thread Zvone
Do you really need to determine free local port? By what you wrote it
doesn't seem you need that.

You need a free local port if you are making a server type of
application, not a client application.

If you connect to remote server (then you are making a client
application) you connect to whatever port that server has assigned but
that will not generate TCP binding error on your (client) computer.
Usually you connect to specific port then the communication continues
after establishing connection on a random port to free the specific
port on server for additional connections.

If you really need free local port for server app, then assign a port,
start server and if you get an exception, assign another port and so
on until you exhaust all ports required for your application. If you
need one specific port - then report error to the user.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] RFC 2822 date format - Timezone

2010-09-21 Thread Zvone
I think there might be a slight issue with timezone bias calculation.

In this function (haven't checked but similar could be used somewhere else too):

function TimeZoneBias : String;
in OverbyteIcsSmtpProt.pas

if timezone could not be calculated (TIME_ZONE_ID_INVALID) or if it is
GMT (UTC) it returns - as result.

But here is what RFC 2822 says:

---
The form + SHOULD be used to indicate a time zone at
Universal Time. Though - also indicates Universal Time, it is
used to indicate that the time was generated on a system that may be
in a local time zone other than Universal Time and therefore
indicates that the date-time contains no information about the local
time zone.


Notice the capitalized SHOULD in RFC.

So in other words - means that this timezone info is
meaningless. + would mean - this date was generated on a client
that is in UTC timezone e.g. London. But - could be for example
used by server to add or correct invalid timezone but if the server is
in different timezone than sender of the original email it might mean
the above - it fixed the date but the timezone is no longer relevant
to the original sender so cannot be used to determine where the
original message time zone is.

So if this is all correct - my suggestion for modification if this is
all right would be to:

- return - if TIME_ZONE_ID_INVALID
- return + if timezone is UTC or GMT etc - for any use by clients
- return - - for any use by servers

Also a question - is there a function to return TDateTime version of
RFC-formatted date in Mimeparser? I could not find it... or am I
supposed to do my own parser for RFC date from headers because the
result from mime parser is raw RFC formatted date?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] pop3 and lastresponse

2010-09-18 Thread Zvone
I found something that might also be issue with pop3 component.

If you check one pop3 account and end the session usually LastResponse
will be some ending message like +OK sayonara. But if you then
reinitialize pop3 for another account and this account fails to
connect, for example due to timeout you get for example -ERR
Connection refused (Winsock error #10061) but LastResponse is still
+OK sayonara although it should be invalidated and set to empty
string. Or, there should be IMO a method ClearLastResponse as
LastResponse is not a writeable property right now. Checking on both
messages (LastError and LastResponse) is useful for debugging purposes
so they should be a possibility to manually (by calling
ClearLastResponse) or automatically invalidate LastResponse.

Furthermore, although Error code is accessible in for example
OnRequestDone it is not accessible within the pop3 component and the
code may sometimes be 10061 which is Winsock code or 500 which is pop3
component code. Nothing that can't be done with little RegEx on
LastError but why not publishing this as well?

I've done quite a bit of testing for Throttle and Timeout. While
Timeout works rather nice as far as Idle version goes, connect version
is usually preceded by Windows built-in timeout (unless you set
connect timeout to very low time like 1 second) Windows may time-out
the connection much sooner than connect timeout did. Other that that
it works fine. Try connecting to 127.0.0.1, unroutable address like
192.168.255.255, or 10.255.255.255, and existing but firewalled like
www.google.com:81 to test this. I'm not sure if it applies only to
later Windows and haven't tested with older Windows than XP.

As for Throttle, it works but rather strangely. If I set limit to 1
and timer to 1000 it should pass 1 byte every 1000ms and accumulate
the rest in internal buffer right? Well it doesn't work like if you do
something like SendStr(Some large string here) it will send entire
string and then wait for 1000 ms rather than sending just one byte
every 1000 ms. At least this is how throttle should work - send a
maximum of Limit bytes every Timer interval and if more is available,
store in internal buffer for sending later. It may be tricky to
implement as data could accumulate in memory but not sure about that
one.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] pop3 and lastresponse

2010-09-18 Thread Zvone
 IMO the component should clear LastResponse on before connect.

Maybe it should, but what it does is different story :)

The following fails also with non-sync version but sync is easier to copy-paste.

//--

SyncPop3Cli-Host = put-valid-server-here;
SyncPop3Cli-UserName = put-valid-username;
SyncPop3Cli-PassWord = put-valid-password;
SyncPop3Cli-ConnectSync();
SyncPop3Cli-UserSync();
SyncPop3Cli-PassSync();
SyncPop3Cli-StatSync();
SyncPop3Cli-QuitSync();

// Here you should have +OK goodbye or whatever in LastResponse

MessageBox(NULL,(LastResponse:+SyncPop3Cli-LastResponse+\r\nLastError:+
SyncPop3Cli-ErrorMessage).c_str(), Info, MB_OK);

SyncPop3Cli-ClearErrorMessage();
//SyncPop3Cli-LastResponse = ; // What should be done

SyncPop3Cli-Host = www.google.com;   // Simulate bad server
SyncPop3Cli-Port   = 81;   // Behind firewall
SyncPop3Cli-UserName = a;
SyncPop3Cli-PassWord = b;
SyncPop3Cli-ConnectSync();

// +OK goodbye from last connection is still here

MessageBox(NULL,(LastResponse:+SyncPop3Cli-LastResponse+\r\nLastError:+
SyncPop3Cli-ErrorMessage).c_str(), Info, MB_OK);


//--


 So what about a numeric property LastErrorNumber?

There is no such property nowhere in pop3 (or in any ICS file).


 something, worth to be tested anyway:
 [...]

I'll take a look and test this code soon enough. Thanks.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] HTTPcli: source path question

2010-09-08 Thread Zvone
 Well, then I have a question: maybe you have some ideas of how to organize 
 recursive download: for example, if user started to download 
 www.example.com/path/index.html, we should also accept 
 www.example.com/path/logo.jpg and so on, but not www.example.com/index.php. 
 If user started www.example.com/path/foo, we should accept 
 www.example.com/path/foo/index.php but NOT www.example.com/path/bar.jpg.
 Applications like Wget do support this behavior but the question is how they 
 do it.

HTTP reply consists of header and document. In header you can find
useful info about the type of the document being served.
Wget uses this info to determine filename and hint the directory
structure. It parses HTML but not in a way that it creates a folder
structure. Rather it creates a browsable structure that you can open
in your web browser.

Basically for each document you receive you have to scan for a
href=link links (and possibly also CSS-based links) and internally
in your program organize them into folder structure. You also need to
look at base link in html header if it exists.

To create browsable structure sometimes also a href links in
downloaded documents need to be modified as well, to point to
different location.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] HTTPcli: source path question

2010-09-07 Thread Zvone
 Then I noticed that requests to folder without trailing slash (GET
 /somepath/foo/bar)
 are redirected to locations with slash (/somepath/foo/bar/) so it's easy
 to tell it's a directory.

this depends how server is configured to treat trailing slash. In most
cases it will treat it as access to folder and look for default files
there (index.htm, index.html, index.php, default.asp, default.aspx
etc.). But this can be easily changed by simply changing .htaccess
files on Apache for example so even if web server is configured one
way, navigating to a certain folder with different .htaccess
directives can change this behaviour completely.

You will see that for example WordPress has an option how it will
display URL path - as folders as html file but in reality this is
just a choice of format which will be parsed later by index.php or
whatever. This is just a modification of .htaccess

So you cannot really know how folders are structured on the server is
just by looking at the URL. Furthermore a lot of servers are
configured as virtual hosting meaning a single host hosts hundreds or
even thousands of sites that share the same IP address (just have
their own user account directory configured on the server).
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] New DLL hijacking vulnerability KB 2269637

2010-09-06 Thread Zvone
 const GSSLEAY_DLL_Name : String  = 'SSLEAY32.DLL';

 This is not required since writable typed constants is enabled.

That's all fine but I don't see it published as property anywhere. How
do I modify its value during runtime to set full path for SSLEAY32.DLL
and LIBEAY32.DLL?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] New DLL hijacking vulnerability KB 2269637

2010-09-04 Thread Zvone
Forget about my remark about \ or /. The DllPath could be used as
is just DllPath + LibraryName. This avoids the need to process
needlessly slashes or backslashes. If this is used I would suggest a
bold remark in the docs on Wiki to encourage use of this property if
this is to be used.

Anyway, other ideas are still welcome.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] New DLL hijacking vulnerability KB 2269637

2010-09-03 Thread Zvone
It appears that this new vulnerability requires programs to adopt
secure DLL loading. As Microsoft says they can't fix the issue by
patching Windows as it would mess up a lot of programs so it is up to
programmers to fix it in their own programs.
This applies to all programs that load external libraries (DLL files)
one way or another - so it applies to ICS as well as it loads
SSLEAY32.DLL and other DLL's

The solution is to load DLL files in a secure manner as described here:

Dynamic-Link Library Security - how to load libraries securely:
http://msdn.microsoft.com/en-us/library/ff919712%28VS.85%29.aspx

More info about this vulnerability:

Microsoft Security Advisory (2269637):
http://www.microsoft.com/technet/security/advisory/2269637.mspx
http://www.f-secure.com/weblog/archives/2018.html

Google search on this issue:
http://www.google.com/search?q=KB+2269637
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] OpenSSL 1.0

2010-08-24 Thread Zvone
Open SSL is currently branched into two releases - 0.9.8o and 1.0.0a.

Although 1.0.x is more recent, 0.9.x versions are currently more
stable so I would go with 0.9.x
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS Message handlers

2010-08-13 Thread Zvone
Can I send attachment to this group? If not, how do I send?
Eric

Please don't send attachments even if it is possible. Upload to
hotfile.com or some similar service (there is a bunch of them!) like
that and link in your message... all of such services offer you a
delete link which you can use later to delete your files if you
don't want them present at later time.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] WM_USER vs. WM_APP messages

2010-08-13 Thread Zvone
From what I could see, ICS uses a lot of WM_USER+n messages range but
the use of these custom messages is not recommended. Instead you
should use WM_APP+n.

http://msdn.microsoft.com/en-us/library/ms644930%28VS.85%29.aspx

The reason to use WM_APP is because WM_USER can conflict with system
messages - this is especially true on older Windows so WM_APP range
should be safer.

Any thoughts on that?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Detecting POP3 protocol state and disconnecting

2010-08-09 Thread Zvone
A few POP3 related questions...

1. How am I supposed to detect when POP3 component has disconnected or
what state is it in?

OnSessionClosed appears to trigger BEFORE it disconnects but after
QUIT is sent (not logical for me, should be the last one to trigger)
and what seems to trigger at the disconnection time is OnRequestDone
when TPop3Request is pop3Quit which appears to be the last one to
happen. But if I immediately during this event start new batch of POP3
commands (by setting new server, new port etc.) it may sometimes
trigger pop3 already connected and sometimes won't. So obviously it
is still connected.

Also, is it good to fill pop3 component with new server name while in
event handler or how to implement a small time-delay (to fill it right
after the event is handled)?

Next I tried OnStateChange event. It is supposed to update
SyncPop3Cli1-State or perhaps ProtocolState right? Well... it does
trigger but SyncPop3Cli1-State always returns pop3Ready (defined as
0). Same goes for SyncPop3Cli1-ProtocolState - whenever I read it it
always says pop3Disconnected. So why these are not updated or how to
read them?

Finally, I tried SyncPop3Cli1-Connected - which always returns true.

I could start 2-3 pop3 components for 2-3 servers rather than waiting
for first one to finish, but that is rather dumb idea if protocol
state can be detected.


2. What good is TimeOut property for? It is obviously not for timeout
like for example waiting for server response because you have to use
TTimer for that. I also tried to see if it will be used for DNS lookup
or something like that but it doesn't seem to have any effect...
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] SSH support

2010-07-17 Thread Zvone
 Fredrik Larsson wrote:
 Can't you use something like Putty to tunnel the traffic?

I may also suggest http://www.stunnel.org/ for wrapping any kind of
non-SSL traffic into SSL.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A better Unicode port of the POP3 client

2010-07-05 Thread Zvone
 Hi,

 I uploaded a better Unicode port of TPop3Cli here:
 http://www.duodata.de/misc/delphi/ics/OverbyteIcsPop3Prot.zip

Thanks for making a quick fix, I will surely use it and probably a few
other people here as well. But I'm more for a permanent solution so
I'll keep an eye on this.

I've been researching a bit and seems that using AnsiChar and
AnsiString types to store binary data are safe they only have codepage
associated with them so only conversions may be issue but apart from
that they should behave binary safe as before in earlier versions of
Delphi/C++. As long as you assign one AnsiString with the same
codepage (like system default one, even if it is Japanese locale)
there should be no conversions. I'm not sure though what would happen
if two AnsiStrings were in different codepages, then probably some
conversions may occur but haven't tried that. But of course TBytes is
better for this purpose although it doesn't have so many useful
methods in it for manipulating the data like AnsiString has...
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] pop3, buffer and character encoding

2010-07-02 Thread Zvone
 TBytes was the datatype to be used. However that would break
 backwards compatibility since historically string was used everywhere.
 That all was no problem, however the rule is: DO NOT BREAK BACKWARDS
 COMPATIBILITY and that is where the problems begin.

Well you've already broken this rule by using UnicodeString as return
type so I don't see a big deal here. Also ICS 7 is used by users that
need to recompile their code in D2009/2010 so they do have to adapt
their code anyway as it won't work properly with D2009 not just with
ICS. For compatibility purposes you have ICS 6 and 5.

And it's not a big problem - I have 2 ideas then to satisfy everybody
and improve codepages compatibility:

Idea 1: Why not introduce TPop3Cli.LastResponseTb which would be
identical to LastResponse except different type (TBytes)?

Idea 2 (probably better one): Why not introduce TPop3Cli.ResponseType
enum which you could choose if you want TBytes or String and the
default if you don't use it would be String for backward
compatibility?

Both changes should be relatively easy to implement like a few lines
of code... and you could apply them for other components as well that
may have issues with Unicode.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A bug with Pop3 - followup

2010-07-01 Thread Zvone
 So if you changed some of the wiki pages now you can surround it with
 these tags and make your code look nicer.
 Looks nice with C++, however the Delphi colors should be changed.

I didn't want to go into styling because it is a matter of preference. The
colors as they are now are defaults of GeSHi and are very similar to the
ones used for example on Wikipedia - see:
http://en.wikipedia.org/wiki/Delphi_programming_language and
http://en.wikipedia.org/wiki/C%2B%2B

But styling is easy - providing you have access to the server. I have
MediaWiki installed locally so I can edit help locally and upload when
finished and it is only a matter of modifying GeSHi language .php files for
example in:
extensions\SyntaxHighlight_GeSHi\geshi\geshi\delphi.php

You will find:

'STYLES' = array(
'KEYWORDS' = array(
1 = 'color: #00; font-weight: bold;',
2 = 'color: #00; font-weight: bold;',
3 = 'color: #66;',
4 = 'color: #66; font-weight: bold;'
),
'COMMENTS' = array(
1 = 'color: #808080; font-style: italic;',
2 = 'color: #008000; font-style: italic;',
'MULTI' = 'color: #808080; font-style: italic;'
),
etc...

These are colors of delphi output... so... style to... whatever you want
them to be. Don't introduce CSS errors though.

C++ colors are in: cpp.php also under 'STYLES' array

So change it to whatever you like or think they may be. I'm at home with PHP
and CSS but I'm not going into that issue, I just suggested to Francois -
Delphi and C++ builder default interface colors to look familliar, but he
has no time to change these so if you modify the files send it to him. I can
do the styling that's a piece of cake, but it has to be a popular vote :)
Simply send me 24-bit PNG screenshots of code and I can work with that (they
have to be PNG to avoid JPG messing with colors as it is lossy and PNG is
not).

Whatever you decide - make sure after styling it to save the changed files
because if GeSHi is updated you may overwrite the styling files so to avoid
that.. backup these.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] pop3, buffer and character encoding

2010-07-01 Thread Zvone
OK, I have an issue which I don't entirely understand.

The way to check received pop3 message is to create Pop3CliMessageLine event
and then add Pop3Cli.LastResponse to your own buffer (UnicodeString) and
store that as email.

However, this creates a bit of a problem - LastResponse is UnicodeString.
Normally, that's fine but the sender may send message in some single-byte
encoding.
So in order to handle this properly - I'd have to store message as bytes
(raw buffer received from server) and later when reading it read the
encoding from message header and convert bytes to UnicodeString using the
encoding of the message.

But LastResponse is already encoded in Unicode so I don't get raw bytes
output but some converted output using some built in logic which I don't get
it. if I send for example 0x80, 0x81, 0x82 I may not get the identical
result in LastResponse. In fact all the characters above 0x7f may be messed
up. It's ok for ASCII messages but not for others.

So how is this exactly handled and is there a way to receive raw bytes
from socket to convert them to proper encoding later after storing them?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A bug with Pop3 - followup

2010-06-30 Thread Zvone
 Thanks for your wiki-input!
 Arno Garrels

Thank you for your answers that helped me. By the way, I suggested to
Francois to install Geshi for code-coloring, if you refresh the page on:
http://wiki.overbyte.be/wiki/index.php/TPop3Cli.List

You'll see how it looks much nicer now. The only important things I
suggested already to him is to modify default tab-width to 4 spaces instead
of 8 and to surround code in light-gray dashed border like on many other
wiki-s so that copy-pasting code is easier...

Now the code coloring is a matter of simply pasting it to the wiki and
surrounding it with the tags:

syntaxhighlight lang=delphi
/syntaxhighlight

for delphi... or...

syntaxhighlight lang=cpp
/syntaxhighlight

for c++ builder.

So if you changed some of the wiki pages now you can surround it with these
tags and make your code look nicer.

Geshi can also add line numbers and a few more things documented here:
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi

Anyway... more pop3 pages updates will follow... this is just the first one
I did.

Also... if someone is into Delphi and has wiki access, I would suggest to
translate my example code to Delphi. I'm not so much into Delphi so I could
make a messy code when translating it but I'll try to keep examples very
simple and not use c++-ish stuff like ?: and similar so it should be fairly
easy to understand even if not translated to Delphi.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A bug with Pop3 - followup

2010-06-29 Thread Zvone
 You have to reset property MsgNum to zero before both List() and Uidl().

Alright, that seems to work, although it is not entirely logical to me. I'll
put it in the wiki documentation when updating it along with one complete
example. Thanks Arno.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] A bug with Pop3 - followup

2010-06-28 Thread Zvone
I tried synchronous calls now and discovered that event trigger is not
necessary related to UIDL after LIST:

SyncPop3Cli1-Host = pop3.host.name;
SyncPop3Cli1-Port = 110;
SyncPop3Cli1-UserName = username;
SyncPop3Cli1-PassWord = password;
SyncPop3Cli1-ConnectSync();
SyncPop3Cli1-UserSync();
SyncPop3Cli1-PassSync();
SyncPop3Cli1-StatSync();
Memo1-Lines-Add(Messages: +IntToStr(SyncPop3Cli1-MsgCount));
SyncPop3Cli1-ListSync();
SyncPop3Cli1-QuitSync();

I put this on some button. The first time I call it List works (or if the
program is restarted). The second time I call it, all works except that List
does not trigger events again. Same goes if I replace it with UidlSync,
again works the first time, no event trigger the second time.

Now, unless I didn't do some necessary cleanup between two calls, this
should work when called twice in a row without restarting a program (which
only destroys and creates Pop3 component). So my guess is that there is an
issue related with UIDL, LIST and repeated calls one after another...

I also tried to set or clear event handlers:

SyncPop3Cli1-OnListLine = NULL;
SyncPop3Cli1-OnUidlLine = NULL;
SyncPop3Cli1-OnListLine = SyncPop3Cli1ListLine;
SyncPop3Cli1-OnUidlLine = SyncPop3Cli1UidlLine;

In various combinations, to see if setting or releasing event handler would
do any change - no change.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Should ICS support IPv6 on W2K?

2010-06-01 Thread Zvone
Arno, don't bother with Win2000 without service packs support.

See this:

OS usage by market share:

Windows XP - 62.53%
Windows Vista - 15.26%
Windows 7 - 12.67%
Mac OS X 10.6 - 2.34%
Mac OS X 10.5 - 1.96%
Linux - 1.13%
Java ME - 0.73%
Mac OS X 10.4 - 0.66%
iPhone - 0.60%
Windows 2000 - 0.50%

It is slowly moving into Win 9x domain so you can safely move on.
Good XP and Win 7 support is much more important than figuring out Win2k
support.
Whoever uses it in the application can put this requirement in the readme
and by the time it is fully tested and IPV4 no longer used, Win2k will have
even less market share if any.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Issue with compiling on CB2010

2010-05-14 Thread Zvone
When compiling current V7 on CB2010 (possibly D2010 as well) - when doing
Install on the design-time package it pops:
Unable to find static library: OverbyteIcsCB2009Run.lib

On a related note - when doing install should I change active configuration
to Release for both Run-time and Design-time packages or should I leave it
on Debug before clicking Make (on run-time package) and Install (on
design-time package)?
I tried with both and they both pop the above message.

Also, if anyone knows the difference between TMimeDecode, TMimeDecodeEx and
TMimeDecodeW and which one should be used under which occasion?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] BTW: Support for OpenSSL 0.9.8n is available (ICS v7)

2010-05-13 Thread Zvone
 Most likely that's wrong, as I recall the vulnerability,
 it's probably only safe to not enable option
 SslOpt_ALLOW_UNSAFE_LEGACY_RENEGOTIATION.

I never even meant to enable this option. If it fails I don't care.
Many servers will be upgraded quickly to fix this issue anyway so I don't
think enabling this option will make a huge difference anyway.

By the way, can anyone approve me so I can write documentation on wiki? I'm
really tired of looking for documentation on like... 20 different places and
many things are undocumented. Even a lousy documentation is better than
nothing.

As I use components I will update wiki (and not for altruistic reasons - for
myself so I have it in one place :) and provide examples in c++ (someone may
later rewrite them in delphi, I don't care about it).

I have a suggestion - why are you so strict about approval of people that
write content? Subscribing to the wiki should be enough, not just another
approval. We have too much of usernames for other web places anyway!

Have in mind that these strict rules and using mailing list instead of
forums discourages a lot of people from using ICS - wikipedia is open for
anyone to edit and if works just fine and if you're afraid of spam - well,
that's unavoidable, live with it, but that's why you can lock out registered
user to wiki and return content to previous wiki version if spam appears.
But I don't think there will be a lot of spam anyway, wiki needs signed up
user anyway that is more than enough and the majority of users are
programmers not spammers, they are not likely to be interested in this.

I am willing to write content but discouraged by these strict rules myself
so I speak from my personal perspective. With current policies, the
documentation will never be updated and it is one of the most boring jobs in
the world so nobody will be motivated unless a few people from here and
there do it.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A problem/bug with current daily snapshot of ICS

2010-05-11 Thread Zvone
 You are welcome! It's fixed and checked in. Should be included
 in the next daily snapshot as well. However declaration of size_t
 moved to OverbyteIcsTypes.pas and there are some other changes too.
 Please give it a trial and let me know how it works for you.

Arno, didn't had time to test that build but I tried that latest version
from 2010-05-08 and it appears to work and compiles just fine. Also works
fine with 0.9.8n libs which is great! So no problems so far, if I find some
will let you know. Good work, thanks.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] BTW: Support for OpenSSL 0.9.8n is available (ICS v7)

2010-05-10 Thread Zvone
well, that's great news i thought it was not fixed already and it was still
disabled in N version as well. good to know!

but what does this mean require the extension as needed?

if i understood correctly - if you have 098n and server supports the
extension, it will be used with no additional programming on the client
side?
if your software or server don't support extension it will fail just like
L version (unless of course you allow unsafe renegotiation option)?
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] A problem/bug with current daily snapshot of ICS

2010-05-06 Thread Zvone
 please try to add the line below to OverbyteIcsLIBEAY.pas and report back,
 thank you!

 type
{$EXTERNALSYM size_t} == this line
size_t = LongWord; // x86

Arno,

This appears to solve the issue. The project I have now compiles without
errors with this version as well.
/me is happy :)

Thank you!

One additional question - from what I could see ICS does not yet support
OpenSSL 0.9.8N which is currently recommended (stable) version.
The latest one I got working is 0.9.8L.
There are already precompiled Windows DLLs on
http://www.slproweb.com/products/Win32OpenSSL.html from a few days ago but
today I also see they made 1.0.0.0 builds as well.

I wouldn't go personally on 1.0.0.0 until it becomes stable but any plans to
support 0.9.8n as well?

By the way, why not including these builds from the site above on the
overbyte wiki? They are better built IMHO (if you look at properties - the
DLLs have web links, version numbers, copyrights etc, while the builds from
wiki have none of these - and you cannot easily check which version you are
using in your program). I would update wiki myself but the access is
restricted for updating it.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] A problem/bug with current daily snapshot of ICS

2010-05-05 Thread Zvone
I have 2 snapshots. The one I downloaded on 2009-11-18, and the one I
downloaded on 2010-05-03 (so it is snapshot from 2010-04-28 in fact which is
the last date I see in the history).

When I compile a project I have, it stops with the following error message:

[BCC32 Error] utilcls.h(511): E2015 Ambiguity between 'size_t' and
'Overbyteicslibeay::size_t'

This is what happens with latest snapshot. With older snapshot the project
compiles just fine.

So, any ideas what's going on here? All the rest of the settings except the
ICS installation are identical so it is an issue related with ICS.

The above applies for C++ Builder 2009 and ICS 7.
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be