diff options
author | Guy Harris <guy@alum.mit.edu> | 2020-04-11 14:40:01 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2020-04-11 14:40:01 -0700 |
commit | 028ce6676bcfc813e581f95f4797666043cb5475 (patch) | |
tree | 7ec277f2a64042ed8f288705f646fa7d3dd7c02f /cmakeconfig.h.in | |
parent | 8e8cb61cb313f43faf586b3f824b05eb67430b31 (diff) |
Add support for UTF-8 strings on Windows.
Add a routine pcap_init() that initializes pcap, specifying whether
strings should be treated as being in UTF-8 or a local character
encoding.
On UN*Xes, we don't change our behavior based on that setting; if there
is ever an issue with local character encodings *other* than UTF-8, we
can use it.
On Windows, the local character encoding is the local ANSI code page; if
pcap_init() isn't called, or is called with PCAP_CHAR_ENC_LOCAL, strings
are treated as being in the current ANSI code page, as before, otherwise
they're treated as being in UTF-8. This includes file path names and
error messages.
In addition, if pcap_init() is called, regardless of the options, we
disable pcap_lookupdev(), making it always return NULL, as it retunred
*UTF-16LE* strings (plural!) on Windows NT, and pcap_create() had to
check for UTF-16LE strings to work around that. That workaround is
unsafe (it will read past the end of the input string if the string is
one ASCII character), and is also disabled if pcap_init() is called.
We also make rpcapd send UTF-8 error message strings over the wire;
sending local code page strings is a Bad Idea, as the client has no idea
what the server's code page is. (Do not assume the client and server
are necessarily in the same location.)
Fix the capitalization of "Winsock" while we're at it; Microsoft appears
to spell it "Winsock", rather than "WinSock".
Diffstat (limited to 'cmakeconfig.h.in')
-rw-r--r-- | cmakeconfig.h.in | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 73be7aa4..84fb42ae 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -180,9 +180,6 @@ /* Define to 1 if you have the `strerror' function. */ #cmakedefine HAVE_STRERROR 1 -/* Define to 1 if you have the `strerror_s' function. */ -#cmakedefine HAVE_STRERROR_S 1 - /* Define to 1 if you have the <strings.h> header file. */ #cmakedefine HAVE_STRINGS_H 1 @@ -265,6 +262,9 @@ /* Define to 1 if you have the `vsyslog' function. */ #cmakedefine HAVE_VSYSLOG 1 +/* Define to 1 if you have the `_wcserror_s' function. */ +#cmakedefine HAVE__WCSERROR_S 1 + /* Define to 1 if you have the `PacketIsLoopbackAdapter' function. */ #cmakedefine HAVE_PACKET_IS_LOOPBACK_ADAPTER 1 |