mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 22:46:05 +03:00
#45: Use IpHelper to get DNS server on win32
This commit is contained in:
parent
844342e1c1
commit
a3cea72400
@ -12,6 +12,7 @@ CHANGES:
|
|||||||
- Added syslog logging for iodined on version and login packets
|
- Added syslog logging for iodined on version and login packets
|
||||||
- Fixed segfault when encoding just one block, fixes #51.
|
- Fixed segfault when encoding just one block, fixes #51.
|
||||||
The normal code was never affected by this.
|
The normal code was never affected by this.
|
||||||
|
- Added win32 code to read DNS server from system, fixes #45.
|
||||||
|
|
||||||
2009-01-23: 0.5.0 "iPassed"
|
2009-01-23: 0.5.0 "iPassed"
|
||||||
- Fixed segfault in server when sending version reject.
|
- Fixed segfault in server when sending version reject.
|
||||||
|
@ -49,7 +49,6 @@ cross-compile.
|
|||||||
== Results of crappy Win32 API:
|
== Results of crappy Win32 API:
|
||||||
The following fixable limitations apply:
|
The following fixable limitations apply:
|
||||||
- The password is shown when entered
|
- The password is shown when entered
|
||||||
- DNS server IP can not be fetched automatically
|
|
||||||
- Exactly one TAP32 interface must be installed
|
- Exactly one TAP32 interface must be installed
|
||||||
- The TAP32 interface must be named "dns" and be version 0801
|
- The TAP32 interface must be named "dns" and be version 0801
|
||||||
- Server cannot read packet destination address
|
- Server cannot read packet destination address
|
||||||
|
22
src/iodine.c
22
src/iodine.c
@ -890,8 +890,9 @@ static char *
|
|||||||
get_resolvconf_addr()
|
get_resolvconf_addr()
|
||||||
{
|
{
|
||||||
static char addr[16];
|
static char addr[16];
|
||||||
char buf[80];
|
|
||||||
char *rv;
|
char *rv;
|
||||||
|
#ifndef WINDOWS32
|
||||||
|
char buf[80];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
rv = NULL;
|
rv = NULL;
|
||||||
@ -909,7 +910,26 @@ get_resolvconf_addr()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
#else /* !WINDOWS32 */
|
||||||
|
FIXED_INFO *fixed_info;
|
||||||
|
ULONG buflen;
|
||||||
|
DWORD ret;
|
||||||
|
|
||||||
|
rv = NULL;
|
||||||
|
fixed_info = malloc(sizeof(FIXED_INFO));
|
||||||
|
buflen = sizeof(FIXED_INFO);
|
||||||
|
|
||||||
|
if (GetNetworkParams(fixed_info, &buflen) == ERROR_BUFFER_OVERFLOW) {
|
||||||
|
/* official ugly api workaround */
|
||||||
|
free(fixed_info);
|
||||||
|
fixed_info = malloc(buflen);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = GetNetworkParams(fixed_info, &buflen);
|
||||||
|
if (ret == NO_ERROR) {
|
||||||
|
rv = fixed_info->DnsServerList.IpAddress.String;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ link)
|
|||||||
echo '-lnetwork';
|
echo '-lnetwork';
|
||||||
;;
|
;;
|
||||||
windows32)
|
windows32)
|
||||||
echo '-lws2_32';
|
echo '-lws2_32 -liphlpapi';
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -22,6 +22,7 @@ typedef unsigned int in_addr_t;
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windns.h>
|
#include <windns.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
|
||||||
#define T_A DNS_TYPE_A
|
#define T_A DNS_TYPE_A
|
||||||
#define T_NS DNS_TYPE_NS
|
#define T_NS DNS_TYPE_NS
|
||||||
|
Loading…
Reference in New Issue
Block a user