Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-09

INET-Unit: Testing existence of a domain?

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Hantsch

Hi!

I want to test inside my program if a domain does exist. I am not interested in the particular domain entries, only in its existence.

For that I tried the following, but it returns always false:

---------------------------------------------------------------
function TestDomain: boolean;
var
   s        :  shortstring;
   sd       :  PChar;
   pn       :  pNetEnt;
begin
   TestDomain:=false;
   DomainFound:=false;
   if pos('@',MailFrom)=0 then exit;	// There cannot be any domain
   s:=Trim(MailFrom); delete(s,1,pos('@',MailFrom));
   if s='' then exit;			// There's still no domain
   s:=s+#0; ;			// convert to pChar
   pn:=GetNetByName(sd);		// Lookup
   if pnnil then			// if not nil, there was an answer.
   begin
      TestDomain:=True;
      DomainFound:=true;
   end;
end;
---------------------------------------------------------------

What am I doing wrong?

mfg

Ing. Rainer Hantsch

Michael Weinert
to Rainer Hantsch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Mittwoch, 17. September 2003 11:54 schrieb Rainer Hantsch:

Hi Rainer,

I want to test inside my program if a domain does exist. I am not interested in the particular domain entries, only in its existence. For that I tried the following, but it returns always false:

Maybe I have a solution for you.
Just check for an NS-Entry for the domain. This way you know if the domains exists or not.
How I would do it?
I sended a resolv-unit to the units-list. I would then double the function Sys2_GetMXAddr (tz:ShortString):ShortString; to make a getnsaddr and you have a result.

Are you trying to program a spam-blocker or something like that? If yes, I would be interested in helping.

Michael.

- --

SysQuadrat
Michael Weinert Stuttgart Filderstadt-Plattenhardt Tel.: 0711-9970288 Fax: 5360559 Mobil: 0170-4141273 http://www.linux-firewall.de
KeyServer hkp://pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iQGlAwUBP2g8t6vpi4/XslceAQKcqwx+Leknc0FjwqcaOCtqvrTcXb1LJFHAz0r/ NtqENP8fnLkdSAF/pqLsfPKoA1yHR3phfZrwSmkqcBg2qZQDI8iS0nVx4crecAzF LjZpRDOKtDuJtT91KQaCBEqUbGNkBU5ucRD7FaJD9KHiCVK7oaqdZ0wsQJ+xFxBJ QBBKhiShK45Nh7JBGIgZKYOLY1nPLGRkXBE7VkCyCb6F2HGckdeDY5u4aJb35Q9J 7KLphq/hb/jlzAK8/Zt+2o7GnsaZOlU9/yHNLoASfg8gozbiOvuEt2YZ0sb8sFaa IO1l4LNJObPyubpsqQT8Y/o7m/j43WhI3uPR1HxzWaob94hod0/kKm4L9cVe4zgZ B4Y7azrgQs/w/7CL+WqdDcctybJ67Ai8wzC7+9MpbTUoDZ6ZYe0SFDc3hh0ImLKO 537R+Nrs9AS6hPGhWaheeOTf6sJBUQJ66Whxt1rE6Nk7rlCvF/uD9uSKtfBCgKX5 vmn8T14pRxpouOrJ5uNhDqiIzaxpVyRIyk8gmj7/a7AAsIptmBHMkQ== =jo0n
-----END PGP SIGNATURE-----

Rainer Hantsch
to Michael Weinert

Hi, Michael!

On Wed, 17 Sep 2003, Michael Weinert wrote:
| Am Mittwoch, 17. September 2003 11:54 schrieb Rainer Hantsch: | Hi Rainer,
| > I want to test inside my program if a domain does exist. I am not | > interested in the particular domain entries, only in its existence. | > For that I tried the following, but it returns always false: | Maybe I have a solution for you.
| Just check for an NS-Entry for the domain. This way you know if | the domains exists or not.
| How I would do it?
| I sended a resolv-unit to the units-list. I would then double the | function Sys2_GetMXAddr (tz:ShortString):ShortString; | to make a getnsaddr and you have a result.

Please, leave me copy of it by direct mail. This is quicker.

I must leave my office now for a while urgently, but when I am back, I will proceed.

| Are you trying to program a spam-blocker or something like that? | If yes, I would be interested in helping.

Yes, exactly! :-)
Let's see! I am in the very early steps of my development, there is also a lot unclear, but I also know that I will not use assasin (or how this monster is named).

mfg

Ing. Rainer Hantsch

.---------------------------------------------------------------------. | \\|// Ing. Rainer HANTSCH - Hardware + Software | | (o o) Forget Windoze! -- We focus on L-I-N-U-X... | |--oOOo-(_)-oOOo------------------------------------------------------| | Ing. Rainer HANTSCH | mail: | | Khunngasse 21/20 | www: http://www.hantsch.co.at | | A-1030 Vienna | tel: +43-1-79885380 fax: +43-1-798853818 | | ** A u s t r i a ** | handy: +43-664-9194382 UID-Nr: ATU 11134002 | '---------------------------------------------------------------------'
Michael Weinert
to Rainer Hantsch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Mittwoch, 17. September 2003 13:10 schrieb Rainer Hantsch:

Hallo Rainer, oder besser Herr Hantsch,

Please, leave me copy of it by direct mail. This is quicker. I must leave my office now for a while urgently, but when I am back, I will proceed.

Ich bin im Augenblick dran dies zu implementieren. Ist schon eine Weile her, daß ich an meiner resolv geschraubt habe. Ich schicke dennoch mal die mit MX-Only an Sie/Dich.

Show quoted text 6 lines
| Are you trying to program a spam-blocker or something like that? | If yes, I would be interested in helping. Yes, exactly! :-) Let's see! I am in the very early steps of my development, there is also a lot unclear, but I also know that I will not use assasin (or how this monster is named).

Sehr gut. Das hatte ich auch schon vor, und auch schon mal begonnen. Leider hat dies noch nicht so recht funktioniert.

Folgendes war geplant:
Empfang auf Port 25 und gleichzeitig öffnen des Mailservers auf Port X. Sobald ein Hit stattfindet auflegen beider Verbindungen, bzw. Fehlermeldung 5/4XX an den Client.

Gruß Michael.

- --

SysQuadrat
Michael Weinert Stuttgart Filderstadt-Plattenhardt Tel.: 0711-9970288 Fax: 5360559 Mobil: 0170-4141273 http://www.linux-firewall.de
KeyServer hkp://pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iQGlAwUBP2hFX6vpi4/XslceAQItHgyAss3OG7TUlHEzkA6iK8QCdMuBPZfWLmrj FPZgz7TZx5oDxDp5B6sgxGp9rMb7r+Gw0+/gQAKZRJDKNtv2bXLIrRyqDpSXQmQ8 qxlQrwtnwkoiQb6TEV3HuUlPH+8K5Ac5sPxwdOj3hTZbwoBbEy5Led/iiLhXqtf9 J4QncEbHaiS6v36NZQ2BbaSrgwl6vpOP817aTUFhyvMLO2dwN91jjKdLANIGxOnW cEsrOT6j5H1IhAFYPeVTOCY6kLa3+9ao2hNd3YhmjxvEijy5ag2v46mYKjfjvCaL TjRCJi9P84Vhpnv3y7NZPKDsXqlcMCoHBIRrncPsLcufWUT0H5Itgjw2OlfLx22r T0nSd1qFztV7JDztKWgsJDugEpcCyAcg0ppYfDDfcAPkHMMmD01zQdaZk1EzNXMN XJtC3x0dDnotA02niunNou28ag1lF8cu2EQCadQ6IrdW5LNHPe15UUPfFBIzbBwW 7apVAfiCs4wiATMl8RFpMZyDvZmbuEOhmsukWT1fLiPMynjNeU02Nw== =X0oX
-----END PGP SIGNATURE-----

Michael Weinert
to Rainer Hantsch: Hi, Michael! | Am Mittwoch, 17. September 2003 11:54 schrieb Rainer Hantsch: | > I want…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Mittwoch, 17. September 2003 13:10 schrieb Rainer Hantsch:

Sorry, I put in a mail in german, didn't check the receipient. So everybody got the resolv-unit ;-)

Michael.

- --

SysQuadrat
Michael Weinert Stuttgart Filderstadt-Plattenhardt Tel.: 0711-9970288 Fax: 5360559 Mobil: 0170-4141273 http://www.linux-firewall.de
KeyServer hkp://pgp.mit.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iQGlAwUBP2hFoqvpi4/XslceAQK1gQyAsz70r1zCJf+HQ1VV4QI8Jh+rWuaJ994t ZFNGrlDkOVoVfJP4LNG5NilkGLComoyT4WwUOxZTOXTHZ3t/e5+fSjV5q7Klx1Rx qEHM1kK1Y4ySSU5VZYAa1wzQ4+bJ+BwY4o+LJ67J2XmgmLE12MVkSyMVs8d0ia/S zquPxvo2KLgVvLnR0Co/+IRk89GR38BLuu/4kFsOjLBNTJS98AUs3yYGBB7WDyX5 vQBr5FCodmOyBdTx2endP62OCwGae01RsJWMStrY0QGyWH75dJmRqRd114OHnXMm 7iZJKGhKpvz8v8WP9aqpozgYPOjSopH+DXFdQbEb6Ot/ziCzCZS8+4hN0yCc2wts NIj8BS7uIjpbjmA/b84DKipA+VovEcEOcPZ7tsBtlTVWXxXvjVnlhSaQk700LKPV X3NufL8xfqKAy400e6+QOvdtt2SgjAPjM6mKJT46iOh+AdOGfQx2X8tzjyavTkvV PGZW0qLBpwDcXqFIxkYPd2yyaZyxixa1zHzvHl2Tly6vFu5GUh2Vug== =svTC
-----END PGP SIGNATURE-----