Re: [fossil-users] Help with making a subroutine x-platform to windows

2018-06-28 Thread Thomas Schnurrenberger
On 27.06.2018 21:24, Richard Hipp wrote:
> If anybody can suggest patches that will get this routine
> (https://fossil-scm.org/fossil/info/5e083abf6?ln=47) to compile and
> work on windows, that would really be helpful.  Thanks.
> 

Sample Windows program, needs the dnsapi.lib for linking:

#include   /* Windows */
#include/* DNS API's */
#include   /* Windows sockets */
#include/* For strdup() */
#include /* Standard I/O */

char *smtp_mx_host(const char *zDomain){
  DNS_STATUS status;   /* Return status */
  PDNS_RECORD pDnsRecord, p;   /* Pointer to DNS_RECORD structure */
  int iBestPriority = 999; /* Best priority */
  unsigned char *pBest = 0;/* RDATA for the best answer */

  status = DnsQuery_UTF8(zDomain,/* Domain name */
 DNS_TYPE_MX,/* DNS record type */
 DNS_QUERY_STANDARD, /* Query options */
 NULL,   /* List of DNS servers */
 &pDnsRecord,/* Query results */
 NULL);  /* Reserved */
  if( status ) return NULL;

  p = pDnsRecord;
  while( p ){
if( p->Data.MX.wPreferenceData.MX.wPreference;
  pBest = p->Data.MX.pNameExchange;
}
p = p->pNext;
  }
  if( pBest ){
pBest = strdup(pBest);
  }
  DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep);
  return pBest;
}



int main(int argc, char *argv[]){
  int i;

  for(i=1; ihttp://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Help with making a subroutine x-platform to windows

2018-06-28 Thread Antoine Chavasse
It seems to me it would be simpler and more robust to simply call the
relevant win32 api function:

https://docs.microsoft.com/en-us/windows/desktop/api/windns/nf-windns-dnsquery_a

On Wed, Jun 27, 2018, 23:22 Scott Doctor  wrote:

> A way may be using the system() command to run nslookup. From
> the windows command line help for the command:
>
> Commands:   (identifiers are shown in uppercase, [] means
> optional)NAME- print info about the host/domain NAME
> using default serverNAME1 NAME2 - as above, but use NAME2 as
> serverhelp or ?   - print info on common commandsset
> OPTION  - set an optionall - print
> options, current server and host[no]debug   - print
> debugging information[no]d2  - print exhaustive
> debugging information[no]defname - append domain
> name to each query[no]recurse - ask for recursive
> answer to query[no]search  - use domain search
> list[no]vc  - always use a virtual circuit
> domain=NAME - set default domain name to NAME
> srchlist=N1[/N2/.../N6] - set domain to N1 and search list to
> N1,N2, etc.root=NAME   - set root server to NAME
> retry=X - set number of retries to X
> timeout=X   - set initial time-out interval to X
> secondstype=X  - set query type (ex.
> A,,A+,ANY,CNAME,MX,NS,PTR,SOA,SRV)
> querytype=X - same as typeclass=X - set
> query class (ex. IN (Internet), ANY)[no]msxfr   -
> use MS fast zone transferixfrver=X   - current
> version to use in IXFR transfer requestserver NAME - set
> default server to NAME, using current default serverlserver
> NAME- set default server to NAME, using initial
> serverroot- set current default server to the rootls
> [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional:
> output to FILE)-a  -  list canonical names and
> aliases-d  -  list all records-t TYPE -
> list records of the given RFC record type (ex. A,CNAME,MX,NS,PTR
> etc.)view FILE   - sort an 'ls' output file and view it
> with pgexit- exit the program
>
> -
> Scott Doctor
> [email protected]
> -
>
> On 6/27/2018 12:24, Richard Hipp wrote:
>
> > If anybody can suggest patches that will get this routine
> > (https://fossil-scm.org/fossil/info/5e083abf6?ln=47) to compile and
> > work on windows, that would really be helpful.  Thanks.
> >
> >
> ___
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Help with making a subroutine x-platform to windows

2018-06-27 Thread Scott Doctor


I have an issue with the declarations of the local variables

 unsigned char aDns[5000];   /* Raw DNS reply content */

 char zHostname[5000];   /* Hostname for the MX */

Those two declarations result in using 10k of stack space. I 
suggest making an external struct to hold that information.



-
Scott Doctor
[email protected]
-

On 6/27/2018 12:24, Richard Hipp wrote:

If anybody can suggest patches that will get this routine
(https://fossil-scm.org/fossil/info/5e083abf6?ln=47) to compile and
work on windows, that would really be helpful.  Thanks.



___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Help with making a subroutine x-platform to windows

2018-06-27 Thread Scott Doctor

Well thunderbird sure mucked up that formatting.

Launch windows command prompt

type nslookup

at the ">" prompt, type help

typing exit will exit out of nslookup

-
Scott Doctor
[email protected]
-

On 6/27/2018 14:22, Scott Doctor wrote:
A way may be using the system() command to run nslookup. From 
the windows command line help for the command:


Commands:   (identifiers are shown in uppercase, [] means 
optional)NAME    - print info about the host/domain 
NAME using default serverNAME1 NAME2 - as above, but use 
NAME2 as serverhelp or ?   - print info on common 
commandsset OPTION  - set an option    all 
- print options, current server and host    
[no]debug   - print debugging information    
[no]d2  - print exhaustive debugging 
information    [no]defname - append domain name to 
each query    [no]recurse - ask for recursive answer 
to query    [no]search  - use domain search list 
[no]vc  - always use a virtual circuit 
domain=NAME - set default domain name to NAME 
srchlist=N1[/N2/.../N6] - set domain to N1 and search list to 
N1,N2, etc.    root=NAME   - set root server to NAME 
retry=X - set number of retries to X 
timeout=X   - set initial time-out interval to X 
seconds    type=X  - set query type (ex. 
A,,A+,ANY,CNAME,MX,NS,PTR,SOA,SRV)    querytype=X - 
same as type    class=X - set query class (ex. IN 
(Internet), ANY)    [no]msxfr   - use MS fast zone 
transfer    ixfrver=X   - current version to use in 
IXFR transfer requestserver NAME - set default server to 
NAME, using current default serverlserver NAME    - set 
default server to NAME, using initial serverroot    - 
set current default server to the rootls [opt] DOMAIN [> FILE] 
- list addresses in DOMAIN (optional: output to FILE)    
-a  -  list canonical names and aliases    -d  
-  list all records    -t TYPE -  list records of the 
given RFC record type (ex. A,CNAME,MX,NS,PTR etc.)view 
FILE   - sort an 'ls' output file and view it with 
pgexit    - exit the program


-
Scott Doctor
[email protected]
-

On 6/27/2018 12:24, Richard Hipp wrote:


If anybody can suggest patches that will get this routine
(https://fossil-scm.org/fossil/info/5e083abf6?ln=47) to 
compile and

work on windows, that would really be helpful.  Thanks.



___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users 



___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Help with making a subroutine x-platform to windows

2018-06-27 Thread Scott Doctor
A way may be using the system() command to run nslookup. From 
the windows command line help for the command:


Commands:   (identifiers are shown in uppercase, [] means 
optional)NAME    - print info about the host/domain NAME 
using default serverNAME1 NAME2 - as above, but use NAME2 as 
serverhelp or ?   - print info on common commandsset 
OPTION  - set an option    all - print 
options, current server and host    [no]debug   - print 
debugging information    [no]d2  - print exhaustive 
debugging information    [no]defname - append domain 
name to each query    [no]recurse - ask for recursive 
answer to query    [no]search  - use domain search 
list    [no]vc  - always use a virtual circuit    
domain=NAME - set default domain name to NAME    
srchlist=N1[/N2/.../N6] - set domain to N1 and search list to 
N1,N2, etc.    root=NAME   - set root server to NAME    
retry=X - set number of retries to X    
timeout=X   - set initial time-out interval to X 
seconds    type=X  - set query type (ex. 
A,,A+,ANY,CNAME,MX,NS,PTR,SOA,SRV)    
querytype=X - same as type    class=X - set 
query class (ex. IN (Internet), ANY)    [no]msxfr   - 
use MS fast zone transfer    ixfrver=X   - current 
version to use in IXFR transfer requestserver NAME - set 
default server to NAME, using current default serverlserver 
NAME    - set default server to NAME, using initial 
serverroot    - set current default server to the rootls 
[opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: 
output to FILE)    -a  -  list canonical names and 
aliases    -d  -  list all records    -t TYPE -  
list records of the given RFC record type (ex. A,CNAME,MX,NS,PTR 
etc.)view FILE   - sort an 'ls' output file and view it 
with pgexit    - exit the program


-
Scott Doctor
[email protected]
-

On 6/27/2018 12:24, Richard Hipp wrote:


If anybody can suggest patches that will get this routine
(https://fossil-scm.org/fossil/info/5e083abf6?ln=47) to compile and
work on windows, that would really be helpful.  Thanks.



___
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users