Downgrade 'libcurl' to 7.54.0

The game uses 7.54.0, downgraded to maintain compatibility if we ever hook curl functions.
This commit is contained in:
Kawe Mazidjatari 2023-03-28 23:14:26 +02:00
parent 654d7a97e7
commit 387b24875b
389 changed files with 55332 additions and 87650 deletions

View File

@ -1 +0,0 @@
enable STRERROR

View File

@ -1,38 +1,7 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
set(LIB_NAME libcurl)
set(LIBCURL_OUTPUT_NAME libcurl CACHE STRING "Basename of the curl library")
add_definitions(-DBUILDING_LIBCURL)
if(BUILD_SHARED_LIBS)
set(CURL_STATICLIB NO)
else()
set(CURL_STATICLIB YES)
endif()
# Use:
# * CURL_STATICLIB
configure_file(${CURL_SOURCE_DIR}/include/curl/curlbuild.h.cmake
${CURL_BINARY_DIR}/include/curl/curlbuild.h)
configure_file(curl_config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h)
@ -41,9 +10,10 @@ include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
list(APPEND HHEADERS
${CMAKE_CURRENT_BINARY_DIR}/curl_config.h
${CURL_BINARY_DIR}/include/curl/curlbuild.h
)
if(WIN32 AND NOT CURL_STATICLIB)
if(MSVC)
list(APPEND CSOURCES libcurl.rc)
endif()
@ -54,6 +24,15 @@ endif()
# # strtoofft.c - specify later
# )
# # if we have Kerberos 4, right now this is never on
# #OPTION(CURL_KRB4 "Use Kerberos 4" OFF)
# IF(CURL_KRB4)
# SET(CSOURCES ${CSOURCES}
# krb4.c
# security.c
# )
# ENDIF(CURL_KRB4)
# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
# IF(CURL_MALLOC_DEBUG)
@ -82,52 +61,31 @@ if(USE_ARES)
include_directories(${CARES_INCLUDE_DIR})
endif()
if(CURL_STATICLIB)
# Static lib
set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC STATIC)
else()
# DLL / so dynamic lib
set(CURL_USER_DEFINED_DYNAMIC_OR_STATIC SHARED)
endif()
add_library(
${LIB_NAME}
${CURL_USER_DEFINED_DYNAMIC_OR_STATIC}
${HHEADERS} ${CSOURCES}
)
add_library(
${PROJECT_NAME}::${LIB_NAME}
ALIAS ${LIB_NAME}
)
if(NOT BUILD_SHARED_LIBS)
set_target_properties(${LIB_NAME} PROPERTIES INTERFACE_COMPILE_DEFINITIONS CURL_STATICLIB)
if(MSVC AND CURL_STATICLIB)
set_target_properties(${LIB_NAME} PROPERTIES STATIC_LIBRARY_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
endif()
target_link_libraries(${LIB_NAME} PRIVATE ${CURL_LIBS})
transform_makefile_inc("Makefile.soname" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake")
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.soname.cmake)
set_target_properties(${LIB_NAME} PROPERTIES
COMPILE_DEFINITIONS BUILDING_LIBCURL
OUTPUT_NAME ${LIBCURL_OUTPUT_NAME}
)
if(CMAKE_SYSTEM_NAME STREQUAL "AIX" OR
CMAKE_SYSTEM_NAME STREQUAL "Linux" OR
CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD" OR
# FreeBSD comes with the a.out and elf flavours
# but a.out was supported up to version 3.x and
# elf from 3.x. I cannot imagine someone runnig
# CMake on those ancient systems
CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
CMAKE_SYSTEM_NAME STREQUAL "Haiku")
math(EXPR CMAKESONAME "${VERSIONCHANGE} - ${VERSIONDEL}")
set(CMAKEVERSION "${CMAKESONAME}.${VERSIONDEL}.${VERSIONADD}")
set_target_properties(${LIB_NAME} PROPERTIES
VERSION ${CMAKEVERSION}
SOVERSION ${CMAKESONAME}
)
target_link_libraries(${LIB_NAME} ${CURL_LIBS})
if(WIN32)
add_definitions( -D_USRDLL )
endif()
set_target_properties(${LIB_NAME} PROPERTIES COMPILE_DEFINITIONS BUILDING_LIBCURL)
if(HIDES_CURL_PRIVATE_SYMBOLS)
set_property(TARGET ${LIB_NAME} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_HIDDEN_SYMBOLS")
@ -138,36 +96,14 @@ endif()
set_target_properties(${LIB_NAME} PROPERTIES PREFIX "")
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_PREFIX "")
if(CURL_HAS_LTO)
set_target_properties(${LIB_NAME} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
endif()
if(WIN32)
if(BUILD_SHARED_LIBS)
if(MSVC)
# Add "_imp" as a suffix before the extension to avoid conflicting with
# the statically linked "libcurl.lib"
if(NOT CURL_STATICLIB)
# Add "_imp" as a suffix before the extension to avoid conflicting with the statically linked "libcurl.lib"
set_target_properties(${LIB_NAME} PROPERTIES IMPORT_SUFFIX "_imp.lib")
endif()
endif()
endif()
target_include_directories(${LIB_NAME} INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CURL_SOURCE_DIR}/include>)
if(CURL_ENABLE_EXPORT_TARGET)
install(TARGETS ${LIB_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
export(TARGETS ${LIB_NAME}
FILE ${PROJECT_BINARY_DIR}/libcurl-target.cmake
NAMESPACE ${PROJECT_NAME}::
)
endif()
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

279
r5dev/thirdparty/curl/Makefile.Watcom vendored Normal file
View File

@ -0,0 +1,279 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2005 - 2009, Gisle Vanem <gvanem@yahoo.no>.
# Copyright (C) 2005 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
#
# Watcom / OpenWatcom / Win32 makefile for libcurl.
#
.ERASE
!if $(__VERSION__) < 1280
!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!message ! This Open Watcom version is too old and is no longer supported !
!message ! Please download latest version from www.openwatcom.org !
!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!error Unsupported version of Open Watcom
!endif
!ifndef %watcom
!error WATCOM environment variable not set!
!endif
# In order to process Makefile.inc wmake must be called with -u switch!
!ifndef %MAKEFLAGS
!error You MUST call wmake with the -u switch!
!endif
!ifdef %libname
LIBNAME = $(%libname)
!else
LIBNAME = libcurl
!endif
TARGETS = $(LIBNAME).dll $(LIBNAME).lib
CC = wcc386
LD = wlink
AR = wlib
RC = wrc
!ifdef __LOADDLL__
! loaddll wcc386 wccd386
! loaddll wpp386 wppd386
! loaddll wlib wlibd
! loaddll wlink wlinkd
!endif
!ifdef __LINUX__
CP = cp
MD = mkdir -p
!else
CP = copy 2>NUL
MD = mkdir
!endif
!if $(__VERSION__) > 1290
RD = rm -rf
!else ifdef __UNIX__
RD = rm -rf
!else
RD = rmdir /q /s 2>NUL
!endif
SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
-wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV &
-dBUILDING_LIBCURL -I. -I"../include" $(SYS_INCL)
!ifdef %debug
DEBUG = -dDEBUG=1 -dDEBUGBUILD
CFLAGS += -d3 $(DEBUG)
!else
CFLAGS += -d0
!endif
!ifdef %use_ipv6
CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
!endif
!ifdef %use_sspi
CFLAGS += -dUSE_WINDOWS_SSPI
!endif
!ifdef %use_winssl
CFLAGS += -dUSE_WINDOWS_SSPI
CFLAGS += -DUSE_SCHANNEL
!endif
!ifdef %use_winidn
CFLAGS += -dWINVER=0x0600 -dUSE_WIN32_IDN
! if $(__VERSION__) <= 1290
CFLAGS += -dWANT_IDN_PROTOTYPES
! endif
!endif
#
# Change to suite.
#
!ifdef %zlib_root
ZLIB_ROOT = $(%zlib_root)
!else
ZLIB_ROOT = ../../zlib-1.2.8
!endif
!ifdef %libssh2_root
LIBSSH2_ROOT = $(%libssh2_root)
!else
LIBSSH2_ROOT = ../../libssh2-1.5.0
!endif
!ifdef %librtmp_root
LIBRTMP_ROOT = $(%librtmp_root)
!else
LIBRTMP_ROOT = ../../rtmpdump-2.3
!endif
!ifdef %openssl_root
OPENSSL_ROOT = $(%openssl_root)
!else
OPENSSL_ROOT = ../../openssl-1.0.2a
!endif
!ifdef %ares_root
ARES_ROOT = $(%ares_root)
!else
ARES_ROOT = ../ares
!endif
!ifdef %use_zlib
CFLAGS += -dHAVE_ZLIB_H -dHAVE_LIBZ -I"$(ZLIB_ROOT)"
!endif
!ifdef %use_rtmp
CFLAGS += -dUSE_LIBRTMP -I"$(LIBRTMP_ROOT)"
!endif
!ifdef %use_ssh2
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I"$(LIBSSH2_ROOT)/include" -I"$(LIBSSH2_ROOT)/win32"
!endif
!ifdef %use_ssl
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I"$(OPENSSL_ROOT)/inc32"
!endif
!ifdef %use_ares
CFLAGS += -dUSE_ARES -I"$(ARES_ROOT)"
!endif
!ifdef %use_watt32
CFLAGS += -dUSE_WATT32 -I"$(%watt_root)/inc"
!endif
OBJ_BASE = WC_Win32.obj
!if $(__VERSION__) > 1290
OBJ_STAT = $(OBJ_BASE)/stat
OBJ_DYN = $(OBJ_BASE)/dyn
!else ifdef __UNIX__
OBJ_STAT = $(OBJ_BASE)/stat
OBJ_DYN = $(OBJ_BASE)/dyn
!else
OBJ_STAT = $(OBJ_BASE)\stat
OBJ_DYN = $(OBJ_BASE)\dyn
!endif
LINK_ARG = $(OBJ_DYN)/wlink.arg
LIB_ARG = $(OBJ_STAT)/wlib.arg
!include Makefile.inc
OBJS1 = ./$(CSOURCES:.c=.obj)
OBJS2 = $(OBJS1:vtls/=)
OBJS3 = $(OBJS2:vauth/=)
OBJS4 = $(OBJS3: = ./)
OBJS_STAT = $(OBJS4:./=$(OBJ_STAT)/)
OBJS_DYN = $(OBJS4:./=$(OBJ_DYN)/)
CURLBUILDH = ../include/curl/curlbuild.h
RESOURCE = $(OBJ_DYN)/libcurl.res
DIRS = $(OBJ_BASE) $(OBJ_BASE)/stat $(OBJ_BASE)/dyn
.c : vauth vtls
all: $(CURLBUILDH) $(DIRS) $(TARGETS) .SYMBOLIC
@echo Welcome to libcurl
clean: .SYMBOLIC
-rm -f $(OBJS_STAT)
-rm -f $(OBJS_DYN)
-rm -f $(RESOURCE) $(LINK_ARG) $(LIB_ARG)
vclean distclean: clean .SYMBOLIC
-rm -f $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
-$(RD) $(OBJ_STAT)
-$(RD) $(OBJ_DYN)
-$(RD) $(OBJ_BASE)
$(DIRS):
-$(MD) $^@
$(CURLBUILDH): .EXISTSONLY
$(CP) $^@.dist $^@
$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(__MAKEFILES__)
%create $(LINK_ARG)
@%append $(LINK_ARG) system nt dll
!ifdef %debug
@%append $(LINK_ARG) debug all
@%append $(LINK_ARG) option symfile
!endif
@%append $(LINK_ARG) option quiet, caseexact, eliminate
@%append $(LINK_ARG) option map=$(OBJ_DYN)/$(LIBNAME).map
@%append $(LINK_ARG) option implib=$(LIBNAME)_imp.lib
@%append $(LINK_ARG) option res=$(RESOURCE)
@for %f in ($(OBJS_DYN)) do @%append $(LINK_ARG) file %f
@%append $(LINK_ARG) library wldap32.lib
!ifdef %use_watt32
@%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
!else
@%append $(LINK_ARG) library ws2_32.lib
!endif
!ifdef %use_zlib
@%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
!endif
!ifdef %use_rtmp
@%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
!endif
!ifdef %use_ssh2
@%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
!endif
!ifdef %use_ssl
@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
!endif
!ifdef %use_ares
@%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
!endif
!ifdef %use_winidn
! if $(__VERSION__) > 1290
@%append $(LINK_ARG) library normaliz.lib
! else
@%append $(LINK_ARG) import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
@%append $(LINK_ARG) import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
! endif
!endif
$(LD) name $^@ @$(LINK_ARG)
$(LIBNAME).lib: $(OBJS_STAT)
%create $(LIB_ARG)
@for %f in ($<) do @%append $(LIB_ARG) +- %f
$(AR) -q -b -c -pa $^@ @$(LIB_ARG)
$(RESOURCE): libcurl.rc
$(RC) $(DEBUG) -q -r -zm -bt=nt -I"../include" $(SYS_INCL) $[@ -fo=$^@
.c{$(OBJ_DYN)}.obj:
$(CC) $(CFLAGS) -bd -br $[@ -fo=$^@
.c{$(OBJ_STAT)}.obj:
$(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@

View File

@ -5,11 +5,11 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
@ -18,18 +18,19 @@
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
AUTOMAKE_OPTIONS = foreign nostdinc
CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
EXTRA_DIST = Makefile.mk config-win32.h config-win32ce.h config-plan9.h \
config-riscos.h config-mac.h curl_config.h.in config-dos.h \
libcurl.plist libcurl.rc config-amigaos.h config-win32ce.h \
config-os400.h setup-os400.h $(CMAKE_DIST) setup-win32.h .checksrc \
Makefile.soname
EXTRA_DIST = Makefile.b32 Makefile.m32 config-win32.h \
config-win32ce.h config-riscos.h config-mac.h curl_config.h.in \
makefile.dj config-dos.h libcurl.plist libcurl.rc config-amigaos.h \
makefile.amiga Makefile.netware nwlib.c nwos.c config-win32ce.h \
config-os400.h setup-os400.h config-symbian.h Makefile.Watcom \
config-tpf.h mk-ca-bundle.pl mk-ca-bundle.vbs $(CMAKE_DIST) \
firefox-db2pem.sh config-vxworks.h Makefile.vxworks checksrc.pl \
objnames-test08.sh objnames-test10.sh objnames.inc
lib_LTLIBRARIES = libcurl.la
@ -47,29 +48,60 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h
# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "private" files
# $(top_builddir)/ares is for in-tree c-ares's generated ares_build.h file
# $(top_srcdir)/ares is for in-tree c-ares's external include files
AM_CPPFLAGS = -I$(top_srcdir)/include \
AM_CPPFLAGS = -I$(top_builddir)/include/curl \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib
if USE_EMBEDDED_ARES
AM_CPPFLAGS += -I$(top_builddir)/ares \
-I$(top_srcdir)/ares
endif
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
include Makefile.soname
if SONAME_BUMP
#
# Bumping of SONAME conditionally may seem like a weird thing to do, and yeah
# it is. The problem is that we try to avoid the bump as hard as possible, but
# yet it is still necessary for a few rare situations. The configure script will
# attempt to figure out these situations, and it can be forced to consider this
# to be such a case! See README.curl_off_t for further details.
#
# This conditional soname bump SHOULD be removed at next "proper" bump.
#
VERSIONINFO=-version-info 9:0:4
else
VERSIONINFO=-version-info 8:0:4
endif
# This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1.
#
# Here's the simplified rule guide on how to change -version-info:
# (current version is C:R:A)
#
# 1. if there are only source changes, use C:R+1:A
# 2. if interfaces were added use C+1:0:A+1
# 3. if interfaces were removed, then use C+1:0:0
#
# For the full guide on libcurl ABI rules, see docs/libcurl/ABI
AM_CPPFLAGS += -DBUILDING_LIBCURL
AM_LDFLAGS =
AM_CFLAGS =
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS)
libcurlu_la_SOURCES = $(CSOURCES) $(HHEADERS)
libcurl_la_CPPFLAGS_EXTRA =
libcurl_la_LDFLAGS_EXTRA =
libcurl_la_CFLAGS_EXTRA =
@ -88,20 +120,10 @@ endif
if CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS
libcurl_la_LDFLAGS_EXTRA += -Wl,--version-script=libcurl.vers
else
# if symbol-hiding is enabled, hide them!
if DOING_CURL_SYMBOL_HIDING
libcurl_la_LDFLAGS_EXTRA += -export-symbols-regex '^curl_.*'
endif
endif
if USE_CPPFLAG_CURL_STATICLIB
libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB
else
if HAVE_WINDRES
libcurl_la_SOURCES += $(LIB_RCFILES)
$(LIB_RCFILES): $(top_srcdir)/include/curl/curlver.h
endif
endif
if DOING_CURL_SYMBOL_HIDING
@ -117,33 +139,17 @@ libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
libcurlu_la_LDFLAGS = $(AM_LDFLAGS) -static $(LIBCURL_LIBS)
libcurlu_la_CFLAGS = $(AM_CFLAGS)
CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
CS_1 =
CS_ = $(CS_0)
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS)
libcurlu_la_SOURCES = $(CSOURCES) $(HHEADERS)
checksrc:
$(CHECKSRC)(@PERL@ $(top_srcdir)/scripts/checksrc.pl -D$(srcdir) \
-W$(srcdir)/curl_config.h $(srcdir)/*.[ch] $(srcdir)/vauth/*.[ch] \
$(srcdir)/vtls/*.[ch] $(srcdir)/vquic/*.[ch] $(srcdir)/vssh/*.[ch])
@PERL@ $(srcdir)/checksrc.pl -D$(srcdir) -W$(srcdir)/curl_config.h \
$(srcdir)/*.[ch] $(srcdir)/vauth/*.[ch] $(srcdir)/vtls/*.[ch]
if CURLDEBUG
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
# disable the tests that are mostly causing false positives
TIDYFLAGS=-checks=-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding,-clang-analyzer-valist.Uninitialized,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-core.NullDereference -quiet
TIDY:=clang-tidy
tidy:
$(TIDY) $(CSOURCES) $(TIDYFLAGS) -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
optiontable:
perl optiontable.pl < $(top_srcdir)/include/curl/curl.h > easyoptions.c
if HAVE_WINDRES
.rc.lo:
$(LIBTOOL) --tag=RC --mode=compile $(RC) -I$(top_srcdir)/include $(RCFLAGS) -i $< -o $@
endif

185
r5dev/thirdparty/curl/Makefile.b32 vendored Normal file
View File

@ -0,0 +1,185 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2000, Jaepil Kim, <pit@paradise.net.nz>.
# Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
############################################################
#
# Makefile.b32 - Borland's C++ Compiler 5.X
#
# 'BCCDIR' has to be set up to point to the base directory
# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55
#
############################################################
!if "$(__MAKE__)" == ""
!error __MAKE__ not defined. Use Borlands's MAKE to process this makefile.
!endif
# Borland's $(MAKEDIR) expands to the path where make.exe is located,
# use this feature to define BCCDIR when user has not defined BCCDIR.
!ifndef BCCDIR
BCCDIR = $(MAKEDIR)\..
!endif
# Edit the path below to point to the base of your Zlib sources.
!ifndef ZLIB_PATH
ZLIB_PATH = ..\..\zlib-1.2.8
!endif
# Edit the path below to point to the base of your OpenSSL package.
!ifndef OPENSSL_PATH
OPENSSL_PATH = ..\..\openssl-1.0.2a
!endif
# Set libcurl static lib, dll and import lib
LIBCURL_LIB = libcurl.lib
LIBCURL_DLL = libcurl.dll
LIBCURL_IMPLIB = libcurl_imp.lib
# Setup environment
PP_CMD = cpp32 -q -P-
CC_CMD = bcc32 -q -c
LD = bcc32
RM = del 2>NUL
MKDIR = md
RMDIR = rd /q
LIB = tlib
IMPLIB = implib
CC_FLAGS = -5 -O2 -tWM -w -w-aus -w-ccc -w-dup -w-prc -w-pro -w-rch -w-sig -w-spa -w-inl -w-pia -w-pin -Dinline=__inline
LIBFLAGS = /C /P32
LDFLAGS = -q -lq -laa -tWD
SRCDIR = .;.\vauth;.\vtls
OBJDIR = .\BCC_objs
INCDIRS = -I.;.\lib;..\include
LINKLIB = $(BCCDIR)\lib\cw32mt.lib $(BCCDIR)\lib\ws2_32.lib
DEFINES = -DNDEBUG -DWIN32 -DBUILDING_LIBCURL
# By default SSPI support is enabled for BCC
!ifndef DISABLE_SSPI
DEFINES = $(DEFINES) -DUSE_WINDOWS_SSPI
!endif
# By default LDAP support is disabled for BCC
!ifndef WITH_LDAP
DEFINES = $(DEFINES) -DCURL_DISABLE_LDAP
!endif
# ZLIB support is enabled setting WITH_ZLIB=1
!ifdef WITH_ZLIB
DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H
INCDIRS = $(INCDIRS);$(ZLIB_PATH)
LINKLIB = $(LINKLIB) $(ZLIB_PATH)\zlib.lib
!endif
# SSL support is enabled setting WITH_SSL=1
!ifdef WITH_SSL
DEFINES = $(DEFINES) -DUSE_OPENSSL
INCDIRS = $(INCDIRS);$(OPENSSL_PATH)\inc32;$(OPENSSL_PATH)\inc32\openssl
LINKLIB = $(LINKLIB) $(OPENSSL_PATH)\out32\ssleay32.lib $(OPENSSL_PATH)\out32\libeay32.lib
!endif
.autodepend
.path.c = $(SRCDIR)
.path.obj = $(OBJDIR)
.path.int = $(OBJDIR)
# Makefile.inc provides the CSOURCES and HHEADERS defines
!include Makefile.inc
# Borland's command line librarian program TLIB version 4.5 is not capable
# of building a library when any of its objects contains an hyphen in its
# name, due to a command line parsing bug. In order to workaround this, we
# build source files with hyphens in their name as objects with underscores
# using explicit compilation build rules instead of implicit ones.
NOHYPHEN1 = $(CSOURCES:-=_)
NOHYPHEN2 = $(NOHYPHEN1:vauth/=)
NOHYPHEN3 = $(NOHYPHEN2:vtls/=)
OBJECTS = $(NOHYPHEN3:.c=.obj)
PREPROCESSED = $(NOHYPHEN3:.c=.int)
# Borland's command line compiler (BCC32) version 5.5.1 integrated
# preprocessor has a bug which results in silently generating wrong
# definitions for libcurl macros such as CURL_OFF_T_C, on the other
# hand Borland's command line preprocessor (CPP32) version 5.5.1 does
# not have the bug and achieves proper results. In order to avoid the
# silent bug we first preprocess source files and later compile the
# preprocessed result.
.c.obj:
@-$(RM) $(@R).int
$(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(<)
$(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
all: $(OBJDIR) $(LIBCURL_LIB) $(LIBCURL_DLL)
asyn_ares.obj: asyn-ares.c
@-$(RM) $(@R).int
$(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
$(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
asyn_thread.obj: asyn-thread.c
@-$(RM) $(@R).int
$(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
$(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
non_ascii.obj: non-ascii.c
@-$(RM) $(@R).int
$(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
$(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
clean:
cd $(OBJDIR)
@-$(RM) $(OBJECTS)
@-$(RM) $(PREPROCESSED)
cd ..
@-$(RMDIR) $(OBJDIR)
@-$(RM) $(LIBCURL_LIB)
@-$(RM) $(LIBCURL_IMPLIB)
@-$(RM) libcurl.tds
$(OBJDIR):
@-$(RMDIR) $(OBJDIR)
@-$(MKDIR) $(OBJDIR)
$(LIBCURL_LIB): $(OBJECTS)
@-$(RM) $(LIBCURL_LIB)
$(LIB) $(LIBFLAGS) $@ @&&!
+$(**: = &^
+)
!
$(LIBCURL_DLL) $(LIBCURL_IMPLIB): $(OBJECTS) $(LINKLIB)
@-$(RM) $(LIBCURL_DLL)
@-$(RM) $(LIBCURL_IMPLIB)
$(LD) $(LDFLAGS) -e$(LIBCURL_DLL) @&&!
$(**: = ^
)
!
$(IMPLIB) $(LIBCURL_IMPLIB) $(LIBCURL_DLL)
# End of Makefile.b32

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,11 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
@ -18,340 +18,63 @@
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
LIB_VAUTH_CFILES = \
vauth/cleartext.c \
vauth/cram.c \
vauth/digest.c \
vauth/digest_sspi.c \
vauth/gsasl.c \
vauth/krb5_gssapi.c \
vauth/krb5_sspi.c \
vauth/ntlm.c \
vauth/ntlm_sspi.c \
vauth/oauth2.c \
vauth/spnego_gssapi.c \
vauth/spnego_sspi.c \
vauth/vauth.c
LIB_VAUTH_CFILES = vauth/vauth.c vauth/cleartext.c vauth/cram.c \
vauth/digest.c vauth/digest_sspi.c vauth/krb5_gssapi.c \
vauth/krb5_sspi.c vauth/ntlm.c vauth/ntlm_sspi.c vauth/oauth2.c \
vauth/spnego_gssapi.c vauth/spnego_sspi.c
LIB_VAUTH_HFILES = \
vauth/digest.h \
vauth/ntlm.h \
vauth/vauth.h
LIB_VAUTH_HFILES = vauth/vauth.h vauth/digest.h vauth/ntlm.h
LIB_VTLS_CFILES = \
vtls/bearssl.c \
vtls/gskit.c \
vtls/gtls.c \
vtls/hostcheck.c \
vtls/keylog.c \
vtls/mbedtls.c \
vtls/mbedtls_threadlock.c \
vtls/nss.c \
vtls/openssl.c \
vtls/rustls.c \
vtls/schannel.c \
vtls/schannel_verify.c \
vtls/sectransp.c \
vtls/vtls.c \
vtls/wolfssl.c \
vtls/x509asn1.c
LIB_VTLS_CFILES = vtls/openssl.c vtls/gtls.c vtls/vtls.c vtls/nss.c \
vtls/polarssl.c vtls/polarssl_threadlock.c vtls/axtls.c \
vtls/cyassl.c vtls/schannel.c vtls/darwinssl.c vtls/gskit.c \
vtls/mbedtls.c
LIB_VTLS_HFILES = \
vtls/bearssl.h \
vtls/gskit.h \
vtls/gtls.h \
vtls/hostcheck.h \
vtls/keylog.h \
vtls/mbedtls.h \
vtls/mbedtls_threadlock.h \
vtls/nssg.h \
vtls/openssl.h \
vtls/rustls.h \
vtls/schannel.h \
vtls/sectransp.h \
vtls/vtls.h \
vtls/vtls_int.h \
vtls/wolfssl.h \
vtls/x509asn1.h
LIB_VTLS_HFILES = vtls/openssl.h vtls/vtls.h vtls/gtls.h \
vtls/nssg.h vtls/polarssl.h vtls/polarssl_threadlock.h vtls/axtls.h \
vtls/cyassl.h vtls/schannel.h vtls/darwinssl.h vtls/gskit.h \
vtls/mbedtls.h
LIB_VQUIC_CFILES = \
vquic/msh3.c \
vquic/ngtcp2.c \
vquic/quiche.c \
vquic/vquic.c
LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
ldap.c version.c getenv.c escape.c mprintf.c telnet.c netrc.c \
getinfo.c transfer.c strcase.c easy.c security.c curl_fnmatch.c \
fileinfo.c ftplistparser.c wildcard.c krb5.c memdebug.c http_chunks.c \
strtok.c connect.c llist.c hash.c multi.c content_encoding.c share.c \
http_digest.c md4.c md5.c http_negotiate.c inet_pton.c strtoofft.c \
strerror.c amigaos.c hostasyn.c hostip4.c hostip6.c hostsyn.c \
inet_ntop.c parsedate.c select.c tftp.c splay.c strdup.c socks.c \
ssh.c curl_addrinfo.c socks_gssapi.c socks_sspi.c \
curl_sspi.c slist.c nonblock.c curl_memrchr.c imap.c pop3.c smtp.c \
pingpong.c rtsp.c curl_threads.c warnless.c hmac.c curl_rtmp.c \
openldap.c curl_gethostname.c gopher.c idn_win32.c \
http_proxy.c non-ascii.c asyn-ares.c asyn-thread.c curl_gssapi.c \
http_ntlm.c curl_ntlm_wb.c curl_ntlm_core.c curl_sasl.c rand.c \
curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c \
x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c
LIB_VQUIC_HFILES = \
vquic/msh3.h \
vquic/ngtcp2.h \
vquic/quiche.h \
vquic/vquic.h
LIB_VSSH_CFILES = \
vssh/libssh.c \
vssh/libssh2.c \
vssh/wolfssh.c
LIB_VSSH_HFILES = \
vssh/ssh.h
LIB_CFILES = \
altsvc.c \
amigaos.c \
asyn-ares.c \
asyn-thread.c \
base64.c \
bufref.c \
c-hyper.c \
cfilters.c \
conncache.c \
connect.c \
content_encoding.c \
cookie.c \
curl_addrinfo.c \
curl_des.c \
curl_endian.c \
curl_fnmatch.c \
curl_get_line.c \
curl_gethostname.c \
curl_gssapi.c \
curl_memrchr.c \
curl_multibyte.c \
curl_ntlm_core.c \
curl_ntlm_wb.c \
curl_path.c \
curl_range.c \
curl_rtmp.c \
curl_sasl.c \
curl_sspi.c \
curl_threads.c \
dict.c \
doh.c \
dynbuf.c \
easy.c \
easygetopt.c \
easyoptions.c \
escape.c \
file.c \
fileinfo.c \
fopen.c \
formdata.c \
ftp.c \
ftplistparser.c \
getenv.c \
getinfo.c \
gopher.c \
h2h3.c \
hash.c \
headers.c \
hmac.c \
hostasyn.c \
hostip.c \
hostip4.c \
hostip6.c \
hostsyn.c \
hsts.c \
http.c \
http2.c \
http_chunks.c \
http_digest.c \
http_negotiate.c \
http_ntlm.c \
http_proxy.c \
http_aws_sigv4.c \
idn.c \
if2ip.c \
imap.c \
inet_ntop.c \
inet_pton.c \
krb5.c \
ldap.c \
llist.c \
md4.c \
md5.c \
memdebug.c \
mime.c \
mprintf.c \
mqtt.c \
multi.c \
netrc.c \
nonblock.c \
noproxy.c \
openldap.c \
parsedate.c \
pingpong.c \
pop3.c \
progress.c \
psl.c \
rand.c \
rename.c \
rtsp.c \
select.c \
sendf.c \
setopt.c \
sha256.c \
share.c \
slist.c \
smb.c \
smtp.c \
socketpair.c \
socks.c \
socks_gssapi.c \
socks_sspi.c \
speedcheck.c \
splay.c \
strcase.c \
strdup.c \
strerror.c \
strtok.c \
strtoofft.c \
system_win32.c \
telnet.c \
tftp.c \
timediff.c \
timeval.c \
transfer.c \
url.c \
urlapi.c \
version.c \
version_win32.c \
warnless.c \
wildcard.c \
ws.c
LIB_HFILES = \
altsvc.h \
amigaos.h \
arpa_telnet.h \
asyn.h \
bufref.h \
c-hyper.h \
cfilters.h \
conncache.h \
connect.h \
content_encoding.h \
cookie.h \
curl_addrinfo.h \
curl_base64.h \
curl_ctype.h \
curl_des.h \
curl_endian.h \
curl_fnmatch.h \
curl_get_line.h \
curl_gethostname.h \
curl_gssapi.h \
curl_hmac.h \
curl_krb5.h \
curl_ldap.h \
curl_md4.h \
curl_md5.h \
curl_memory.h \
curl_memrchr.h \
curl_multibyte.h \
curl_ntlm_core.h \
curl_ntlm_wb.h \
curl_path.h \
curl_printf.h \
curl_range.h \
curl_rtmp.h \
curl_sasl.h \
curl_setup.h \
curl_setup_once.h \
curl_sha256.h \
curl_sspi.h \
curl_threads.h \
curlx.h \
dict.h \
doh.h \
dynbuf.h \
easy_lock.h \
easyif.h \
easyoptions.h \
escape.h \
file.h \
fileinfo.h \
fopen.h \
formdata.h \
functypes.h \
ftp.h \
ftplistparser.h \
getinfo.h \
gopher.h \
h2h3.h \
hash.h \
headers.h \
hostip.h \
hsts.h \
http.h \
http2.h \
http_chunks.h \
http_digest.h \
http_negotiate.h \
http_ntlm.h \
http_proxy.h \
http_aws_sigv4.h \
idn.h \
if2ip.h \
imap.h \
inet_ntop.h \
inet_pton.h \
llist.h \
memdebug.h \
mime.h \
mqtt.h \
multihandle.h \
multiif.h \
netrc.h \
nonblock.h \
noproxy.h \
parsedate.h \
pingpong.h \
pop3.h \
progress.h \
psl.h \
quic.h \
rand.h \
rename.h \
rtsp.h \
select.h \
sendf.h \
setopt.h \
setup-vms.h \
share.h \
sigpipe.h \
slist.h \
smb.h \
smtp.h \
sockaddr.h \
socketpair.h \
socks.h \
speedcheck.h \
splay.h \
strcase.h \
strdup.h \
strerror.h \
strtok.h \
strtoofft.h \
system_win32.h \
telnet.h \
tftp.h \
timediff.h \
timeval.h \
transfer.h \
url.h \
urlapi-int.h \
urldata.h \
version_win32.h \
warnless.h \
wildcard.h \
ws.h
LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
speedcheck.h urldata.h curl_ldap.h escape.h telnet.h getinfo.h \
strcase.h curl_sec.h memdebug.h http_chunks.h curl_fnmatch.h \
wildcard.h fileinfo.h ftplistparser.h strtok.h connect.h llist.h \
hash.h content_encoding.h share.h curl_md4.h curl_md5.h http_digest.h \
http_negotiate.h inet_pton.h amigaos.h strtoofft.h strerror.h \
inet_ntop.h curlx.h curl_memory.h curl_setup.h transfer.h select.h \
easyif.h multiif.h parsedate.h tftp.h sockaddr.h splay.h strdup.h \
socks.h ssh.h curl_base64.h curl_addrinfo.h curl_sspi.h \
slist.h nonblock.h curl_memrchr.h imap.h pop3.h smtp.h pingpong.h \
rtsp.h curl_threads.h warnless.h curl_hmac.h curl_rtmp.h \
curl_gethostname.h gopher.h http_proxy.h non-ascii.h asyn.h \
http_ntlm.h curl_gssapi.h curl_ntlm_wb.h curl_ntlm_core.h \
curl_sasl.h curl_multibyte.h hostcheck.h conncache.h \
curl_setup_once.h multihandle.h setup-vms.h pipeline.h dotdot.h \
x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
curl_printf.h system_win32.h rand.h
LIB_RCFILES = libcurl.rc
CSOURCES = $(LIB_CFILES) $(LIB_VAUTH_CFILES) $(LIB_VTLS_CFILES) \
$(LIB_VQUIC_CFILES) $(LIB_VSSH_CFILES)
HHEADERS = $(LIB_HFILES) $(LIB_VAUTH_HFILES) $(LIB_VTLS_HFILES) \
$(LIB_VQUIC_HFILES) $(LIB_VSSH_HFILES)
CSOURCES = $(LIB_CFILES) $(LIB_VAUTH_CFILES) $(LIB_VTLS_CFILES)
HHEADERS = $(LIB_HFILES) $(LIB_VAUTH_HFILES) $(LIB_VTLS_HFILES)

363
r5dev/thirdparty/curl/Makefile.m32 vendored Normal file
View File

@ -0,0 +1,363 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
###########################################################################
#
## Makefile for building libcurl.a with MingW (GCC-3.2 or later)
## and optionally OpenSSL (1.0.2a), libssh2 (1.5), zlib (1.2.8), librtmp (2.4)
##
## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn
##
## Hint: you can also set environment vars to control the build, f.e.:
## set ZLIB_PATH=c:/zlib-1.2.8
## set ZLIB=1
#
###########################################################################
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.5.0
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.4
endif
# Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.32
endif
# Edit the path below to point to the base of your MS IDN package.
# Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
# https://www.microsoft.com/en-us/download/details.aspx?id=734
ifndef WINIDN_PATH
WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
endif
# Edit the path below to point to the base of your Novell LDAP NDK.
ifndef LDAP_SDK
LDAP_SDK = c:/novell/ndk/cldapsdk/win32
endif
# Edit the path below to point to the base of your nghttp2 package.
ifndef NGHTTP2_PATH
NGHTTP2_PATH = ../../nghttp2-1.0.0
endif
PROOT = ..
# Edit the path below to point to the base of your c-ares package.
ifndef LIBCARES_PATH
LIBCARES_PATH = $(PROOT)/ares
endif
CC = $(CROSSPREFIX)gcc
CFLAGS = $(CURL_CFLAG_EXTRAS) -g -O2 -Wall
CFLAGS += -fno-strict-aliasing
# comment LDFLAGS below to keep debug info
LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_DLL) -s
AR = $(CROSSPREFIX)ar
RANLIB = $(CROSSPREFIX)ranlib
RC = $(CROSSPREFIX)windres
RCFLAGS = --include-dir=$(PROOT)/include -DDEBUGBUILD=0 -O COFF
STRIP = $(CROSSPREFIX)strip -g
# Set environment var ARCH to your architecture to override autodetection.
ifndef ARCH
ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
ARCH = w64
else
ARCH = w32
endif
endif
ifeq ($(ARCH),w64)
CFLAGS += -m64 -D_AMD64_
LDFLAGS += -m64
RCFLAGS += -F pe-x86-64
else
CFLAGS += -m32
LDFLAGS += -m32
RCFLAGS += -F pe-i386
endif
# Platform-dependent helper tool macros
ifeq ($(findstring /sh,$(SHELL)),/sh)
DEL = rm -f $1
RMDIR = rm -fr $1
MKDIR = mkdir -p $1
COPY = -cp -afv $1 $2
#COPYR = -cp -afr $1/* $2
COPYR = -rsync -aC $1/* $2
TOUCH = touch $1
CAT = cat
ECHONL = echo ""
DL = '
else
ifeq "$(OS)" "Windows_NT"
DEL = -del 2>NUL /q /f $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
else
DEL = -del 2>NUL $(subst /,\,$1)
RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
endif
MKDIR = -md 2>NUL $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
CAT = type
ECHONL = $(ComSpec) /c echo.
endif
########################################################
## Nothing more to do below this line!
ifeq ($(findstring -dyn,$(CFG)),-dyn)
DYN = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
ARES = 1
endif
ifeq ($(findstring -sync,$(CFG)),-sync)
SYNC = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
RTMP = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
SSH2 = 1
ifneq ($(findstring -winssl,$(CFG)),-winssl)
SSL = 1
endif
ZLIB = 1
endif
ifeq ($(findstring -ssl,$(CFG)),-ssl)
SSL = 1
endif
ifeq ($(findstring -srp,$(CFG)),-srp)
SRP = 1
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
IDN = 1
endif
ifeq ($(findstring -winidn,$(CFG)),-winidn)
WINIDN = 1
endif
ifeq ($(findstring -sspi,$(CFG)),-sspi)
SSPI = 1
endif
ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
LDAPS = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
IPV6 = 1
endif
ifeq ($(findstring -winssl,$(CFG)),-winssl)
WINSSL = 1
SSPI = 1
endif
ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
NGHTTP2 = 1
endif
INCLUDES = -I. -I../include
CFLAGS += -DBUILDING_LIBCURL
ifdef SYNC
CFLAGS += -DUSE_SYNC_DNS
else
ifdef ARES
INCLUDES += -I"$(LIBCARES_PATH)"
CFLAGS += -DUSE_ARES -DCARES_STATICLIB
DLL_LIBS += -L"$(LIBCARES_PATH)" -lcares
libcurl_dll_DEPENDENCIES = $(LIBCARES_PATH)/libcares.a
endif
endif
ifdef RTMP
INCLUDES += -I"$(LIBRTMP_PATH)"
CFLAGS += -DUSE_LIBRTMP
DLL_LIBS += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
endif
ifdef NGHTTP2
INCLUDES += -I"$(NGHTTP2_PATH)/include"
CFLAGS += -DUSE_NGHTTP2
DLL_LIBS += -L"$(NGHTTP2_PATH)/lib" -lnghttp2
endif
ifdef SSH2
INCLUDES += -I"$(LIBSSH2_PATH)/include" -I"$(LIBSSH2_PATH)/win32"
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
DLL_LIBS += -L"$(LIBSSH2_PATH)/win32" -lssh2
ifdef WINSSL
ifndef DYN
DLL_LIBS += -lbcrypt -lcrypt32
endif
endif
endif
ifdef SSL
ifndef OPENSSL_INCLUDE
ifeq "$(wildcard $(OPENSSL_PATH)/outinc)" "$(OPENSSL_PATH)/outinc"
OPENSSL_INCLUDE = $(OPENSSL_PATH)/outinc
endif
ifeq "$(wildcard $(OPENSSL_PATH)/include)" "$(OPENSSL_PATH)/include"
OPENSSL_INCLUDE = $(OPENSSL_PATH)/include
endif
endif
ifneq "$(wildcard $(OPENSSL_INCLUDE)/openssl/opensslv.h)" "$(OPENSSL_INCLUDE)/openssl/opensslv.h"
$(error Invalid path to OpenSSL package: $(OPENSSL_PATH))
endif
ifndef OPENSSL_LIBPATH
ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
OPENSSL_LIBS = -leay32 -lssl32
endif
ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
OPENSSL_LIBS = -lcrypto -lssl
endif
endif
ifndef DYN
OPENSSL_LIBS += -lgdi32 -lcrypt32
endif
INCLUDES += -I"$(OPENSSL_INCLUDE)"
CFLAGS += -DUSE_OPENSSL -DHAVE_OPENSSL_ENGINE_H -DHAVE_OPENSSL_PKCS12_H \
-DHAVE_ENGINE_LOAD_BUILTIN_ENGINES -DOPENSSL_NO_KRB5 \
-DCURL_WANTS_CA_BUNDLE_ENV
DLL_LIBS += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
ifdef SRP
ifeq "$(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h)" "$(OPENSSL_INCLUDE)/openssl/srp.h"
CFLAGS += -DHAVE_OPENSSL_SRP -DUSE_TLS_SRP
endif
endif
else
ifdef WINSSL
DLL_LIBS += -lcrypt32
endif
endif
ifdef ZLIB
INCLUDES += -I"$(ZLIB_PATH)"
CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
DLL_LIBS += -L"$(ZLIB_PATH)" -lz
endif
ifdef IDN
INCLUDES += -I"$(LIBIDN_PATH)/include"
CFLAGS += -DUSE_LIBIDN
DLL_LIBS += -L"$(LIBIDN_PATH)/lib" -lidn
else
ifdef WINIDN
CFLAGS += -DUSE_WIN32_IDN
CFLAGS += -DWANT_IDN_PROTOTYPES
DLL_LIBS += -L"$(WINIDN_PATH)" -lnormaliz
endif
endif
ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI
ifdef WINSSL
CFLAGS += -DUSE_SCHANNEL
endif
endif
ifdef SPNEGO
CFLAGS += -DHAVE_SPNEGO
endif
ifdef IPV6
CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
endif
ifdef LDAPS
CFLAGS += -DHAVE_LDAP_SSL
endif
ifdef USE_LDAP_NOVELL
INCLUDES += -I"$(LDAP_SDK)/inc"
CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
DLL_LIBS += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
endif
ifdef USE_LDAP_OPENLDAP
INCLUDES += -I"$(LDAP_SDK)/include"
CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
DLL_LIBS += -L"$(LDAP_SDK)/lib" -lldap -llber
endif
ifndef USE_LDAP_NOVELL
ifndef USE_LDAP_OPENLDAP
DLL_LIBS += -lwldap32
endif
endif
DLL_LIBS += -lws2_32
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
libcurl_dll_LIBRARY = libcurl.dll
libcurl_dll_a_LIBRARY = libcurldll.a
libcurl_a_LIBRARY = libcurl.a
libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
RESOURCE = libcurl.res
all: $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@$(call DEL, $@)
$(AR) cru $@ $(libcurl_a_OBJECTS)
$(RANLIB) $@
$(STRIP) $@
# remove the last line above to keep debug info
$(libcurl_dll_LIBRARY): $(libcurl_a_OBJECTS) $(RESOURCE) $(libcurl_dll_DEPENDENCIES)
@$(call DEL, $@)
$(CC) $(LDFLAGS) -shared -o $@ \
-Wl,--output-def,$(@:.dll=.def),--out-implib,$(libcurl_dll_a_LIBRARY) \
$(libcurl_a_OBJECTS) $(RESOURCE) $(DLL_LIBS)
%.o: %.c $(PROOT)/include/curl/curlbuild.h
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
%.res: %.rc
$(RC) $(RCFLAGS) -i $< -o $@
clean:
ifeq "$(wildcard $(PROOT)/include/curl/curlbuild.h.dist)" "$(PROOT)/include/curl/curlbuild.h.dist"
@$(call DEL, $(PROOT)/include/curl/curlbuild.h)
endif
@$(call DEL, $(libcurl_a_OBJECTS) $(RESOURCE))
distclean vclean: clean
@$(call DEL, $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY) $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY))
$(PROOT)/include/curl/curlbuild.h:
@echo Creating $@
@$(call COPY, $@.dist, $@)
$(LIBCARES_PATH)/libcares.a:
$(MAKE) -C $(LIBCARES_PATH) -f Makefile.m32

View File

@ -1,419 +0,0 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
#***************************************************************************
# Makefile to build curl parts with GCC-like toolchains and optional features.
#
# Usage: [mingw32-]make -f Makefile.mk CFG=-feat1[-feat2][-feat3][...]
# Example: [mingw32-]make -f Makefile.mk CFG=-zlib-ssl-libssh2-ipv6
#
# Look for ' ?=' to find all accepted customization variables.
# This script is reused by 'src' and 'docs/examples' Makefile.mk scripts.
ifndef PROOT
PROOT := ..
LOCAL := 1
endif
### Common
CFLAGS ?=
CPPFLAGS ?=
RCFLAGS ?=
LDFLAGS ?=
CURL_LDFLAGS_BIN ?=
CURL_LDFLAGS_LIB ?=
LIBS ?=
CROSSPREFIX ?=
ifeq ($(CC),cc)
CC := gcc
endif
CC := $(CROSSPREFIX)$(CC)
AR := $(CROSSPREFIX)$(AR)
RC ?= $(CROSSPREFIX)windres
# For compatibility
ARCH ?=
ifeq ($(ARCH),w64)
TRIPLET := x86_64-w64-mingw32
CFLAGS += -m64
LDFLAGS += -m64
RCFLAGS += --target=pe-x86-64
else ifdef ARCH
TRIPLET := i686-w64-mingw32
CFLAGS += -m32
LDFLAGS += -m32
RCFLAGS += --target=pe-i386
else
TRIPLET ?= $(shell $(CC) -dumpmachine)
endif
BIN_EXT := .exe
ifneq ($(findstring -w,$(TRIPLET)),)
WIN32 := 1
else ifneq ($(findstring msdos,$(TRIPLET)),)
# Cross-tools: https://github.com/andrewwutw/build-djgpp
MSDOS := 1
else ifneq ($(findstring amigaos,$(TRIPLET)),)
# Cross-tools: https://github.com/bebbo/amiga-gcc
AMIGA := 1
endif
CPPFLAGS += -I. -I$(PROOT)/include
RCFLAGS += -I$(PROOT)/include
ifndef WIN32
DYN :=
endif
ifdef AMIGA
BIN_EXT :=
endif
### Deprecated settings. For compatibility.
ifdef WATT_ROOT
WATT_PATH := $(realpath $(WATT_ROOT))
endif
### Optional features
ifneq ($(findstring -debug,$(CFG)),)
CPPFLAGS += -DDEBUGBUILD
LDFLAGS += -g
else
CPPFLAGS += -DNDEBUG
endif
ifneq ($(findstring -trackmem,$(CFG)),)
CPPFLAGS += -DCURLDEBUG
endif
ifneq ($(findstring -map,$(CFG)),)
MAP := 1
endif
ifdef WIN32
ifneq ($(findstring -unicode,$(CFG)),)
CPPFLAGS += -DUNICODE -D_UNICODE
CURL_LDFLAGS_BIN += -municode
endif
endif
# CPPFLAGS below are only necessary when building libcurl via 'lib' (see
# comments below about exceptions). Always include them anyway to match
# behavior of other build systems.
# Linker options to exclude for shared mode executables.
_LDFLAGS :=
_LIBS :=
ifneq ($(findstring -sync,$(CFG)),)
CPPFLAGS += -DUSE_SYNC_DNS
else ifneq ($(findstring -ares,$(CFG)),)
LIBCARES_PATH ?= $(PROOT)/../c-ares
CPPFLAGS += -DUSE_ARES
CPPFLAGS += -I"$(LIBCARES_PATH)/include"
_LDFLAGS += -L"$(LIBCARES_PATH)/lib"
_LIBS += -lcares
endif
ifneq ($(findstring -rtmp,$(CFG)),)
LIBRTMP_PATH ?= $(PROOT)/../librtmp
CPPFLAGS += -DUSE_LIBRTMP
CPPFLAGS += -I"$(LIBRTMP_PATH)"
_LDFLAGS += -L"$(LIBRTMP_PATH)/librtmp"
_LIBS += -lrtmp -lwinmm
ZLIB := 1
endif
ifneq ($(findstring -ssh2,$(CFG)),)
LIBSSH2_PATH ?= $(PROOT)/../libssh2
CPPFLAGS += -DUSE_LIBSSH2
CPPFLAGS += -I"$(LIBSSH2_PATH)/include"
_LDFLAGS += -L"$(LIBSSH2_PATH)/lib"
ifdef WIN32
_LDFLAGS += -L"$(LIBSSH2_PATH)/win32"
endif
_LIBS += -lssh2
else ifneq ($(findstring -libssh,$(CFG)),)
LIBSSH_PATH ?= $(PROOT)/../libssh
CPPFLAGS += -DUSE_LIBSSH
CPPFLAGS += -I"$(LIBSSH_PATH)/include"
_LDFLAGS += -L"$(LIBSSH_PATH)/lib"
_LIBS += -lssh
else ifneq ($(findstring -wolfssh,$(CFG)),)
WOLFSSH_PATH ?= $(PROOT)/../wolfssh
CPPFLAGS += -DUSE_WOLFSSH
CPPFLAGS += -I"$(WOLFSSH_PATH)/include"
_LDFLAGS += -L"$(WOLFSSH_PATH)/lib"
_LIBS += -lwolfssh
endif
ifneq ($(findstring -ssl,$(CFG)),)
OPENSSL_PATH ?= $(PROOT)/../openssl
CPPFLAGS += -DUSE_OPENSSL
CPPFLAGS += -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include
OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib
CPPFLAGS += -I"$(OPENSSL_INCLUDE)"
_LDFLAGS += -L"$(OPENSSL_LIBPATH)"
OPENSSL_LIBS ?= -lssl -lcrypto
_LIBS += $(OPENSSL_LIBS)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/aead.h),)
OPENSSL := boringssl
else
# including libressl
OPENSSL := openssl
endif
ifneq ($(findstring -srp,$(CFG)),)
ifneq ($(wildcard $(OPENSSL_INCLUDE)/openssl/srp.h),)
# OpenSSL 1.0.1 and later.
CPPFLAGS += -DHAVE_OPENSSL_SRP -DUSE_TLS_SRP
endif
endif
SSLLIBS += 1
else ifneq ($(findstring -wolfssl,$(CFG)),)
WOLFSSL_PATH ?= $(PROOT)/../zlib
CPPFLAGS += -DUSE_WOLFSSL
CPPFLAGS += -DSIZEOF_LONG_LONG=8
CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
_LIBS += -lwolfssl
OPENSSL := wolfssl
SSLLIBS += 1
endif
ifneq ($(findstring -mbedtls,$(CFG)),)
MBEDTLS_PATH ?= $(PROOT)/../zlib
CPPFLAGS += -DUSE_MBEDTLS
CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
SSLLIBS += 1
endif
ifneq ($(findstring -schannel,$(CFG)),)
CPPFLAGS += -DUSE_SCHANNEL
SSLLIBS += 1
endif
ifneq ($(findstring -nghttp2,$(CFG)),)
NGHTTP2_PATH ?= $(PROOT)/../nghttp2
CPPFLAGS += -DUSE_NGHTTP2
CPPFLAGS += -I"$(NGHTTP2_PATH)/include"
_LDFLAGS += -L"$(NGHTTP2_PATH)/lib"
_LIBS += -lnghttp2
endif
ifeq ($(findstring -nghttp3,$(CFG))$(findstring -ngtcp2,$(CFG)),-nghttp3-ngtcp2)
NGHTTP3_PATH ?= $(PROOT)/../nghttp3
CPPFLAGS += -DUSE_NGHTTP3
CPPFLAGS += -I"$(NGHTTP3_PATH)/include"
_LDFLAGS += -L"$(NGHTTP3_PATH)/lib"
_LIBS += -lnghttp3
NGTCP2_PATH ?= $(PROOT)/../ngtcp2
CPPFLAGS += -DUSE_NGTCP2
CPPFLAGS += -I"$(NGTCP2_PATH)/include"
_LDFLAGS += -L"$(NGTCP2_PATH)/lib"
ifneq ($(OPENSSL),)
NGTCP2_LIBS ?= -lngtcp2_crypto_$(OPENSSL)
endif
_LIBS += -lngtcp2 $(NGTCP2_LIBS)
endif
ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
ZLIB_PATH ?= $(PROOT)/../zlib
# These CPPFLAGS are also required when compiling the curl tool via 'src'.
CPPFLAGS += -DHAVE_LIBZ
CPPFLAGS += -I"$(ZLIB_PATH)/include"
_LDFLAGS += -L"$(ZLIB_PATH)/lib"
ZLIB_LIBS ?= -lz
_LIBS += $(ZLIB_LIBS)
ZLIB := 1
endif
ifneq ($(findstring -zstd,$(CFG)),)
ZSTD_PATH ?= $(PROOT)/../zstd
CPPFLAGS += -DHAVE_ZSTD
CPPFLAGS += -I"$(ZSTD_PATH)/include"
_LDFLAGS += -L"$(ZSTD_PATH)/lib"
ZSTD_LIBS ?= -lzstd
_LIBS += $(ZSTD_LIBS)
endif
ifneq ($(findstring -brotli,$(CFG)),)
BROTLI_PATH ?= $(PROOT)/../brotli
CPPFLAGS += -DHAVE_BROTLI
CPPFLAGS += -I"$(BROTLI_PATH)/include"
_LDFLAGS += -L"$(BROTLI_PATH)/lib"
BROTLI_LIBS ?= -lbrotlidec -lbrotlicommon
_LIBS += $(BROTLI_LIBS)
endif
ifneq ($(findstring -gsasl,$(CFG)),)
LIBGSASL_PATH ?= $(PROOT)/../gsasl
CPPFLAGS += -DUSE_GSASL
CPPFLAGS += -I"$(LIBGSASL_PATH)/include"
_LDFLAGS += -L"$(LIBGSASL_PATH)/lib"
_LIBS += -lgsasl
endif
ifneq ($(findstring -idn2,$(CFG)),)
LIBIDN2_PATH ?= $(PROOT)/../libidn2
CPPFLAGS += -DUSE_LIBIDN2
CPPFLAGS += -I"$(LIBIDN2_PATH)/include"
_LDFLAGS += -L"$(LIBIDN2_PATH)/lib"
_LIBS += -lidn2
ifneq ($(findstring -psl,$(CFG)),)
LIBPSL_PATH ?= $(PROOT)/../libpsl
CPPFLAGS += -DUSE_LIBPSL
CPPFLAGS += -I"$(LIBPSL_PATH)/include"
_LDFLAGS += -L"$(LIBPSL_PATH)/lib"
_LIBS += -lpsl
endif
else ifneq ($(findstring -winidn,$(CFG)),)
CPPFLAGS += -DUSE_WIN32_IDN
_LIBS += -lnormaliz
endif
ifneq ($(findstring -sspi,$(CFG)),)
ifdef WIN32
CPPFLAGS += -DUSE_WINDOWS_SSPI
endif
endif
ifneq ($(findstring -ipv6,$(CFG)),)
CPPFLAGS += -DENABLE_IPV6
endif
ifneq ($(findstring -ldaps,$(CFG)),)
CPPFLAGS += -DHAVE_LDAP_SSL
endif
ifneq ($(findstring -watt,$(CFG))$(MSDOS),)
WATT_PATH ?= $(PROOT)/../watt
CPPFLAGS += -I"$(WATT_PATH)/inc"
_LDFLAGS += -L"$(WATT_PATH)/lib"
_LIBS += -lwatt
endif
ifdef WIN32
ifeq ($(findstring -lldap,$(LIBS)),)
_LIBS += -lwldap32
endif
_LIBS += -lws2_32 -lcrypt32 -lbcrypt
endif
ifneq ($(findstring 11,$(subst $(subst ,, ),,$(SSLLIBS))),)
CPPFLAGS += -DCURL_WITH_MULTI_SSL
endif
ifndef DYN
LDFLAGS += $(_LDFLAGS)
LIBS += $(_LIBS)
endif
### Common rules
OBJ_DIR := $(TRIPLET)
ifneq ($(findstring /sh,$(SHELL)),)
DEL = rm -f $1
COPY = -cp -afv $1 $2
MKDIR = mkdir -p $1
RMDIR = rm -fr $1
WHICH = $(SHELL) -c "command -v $1"
else
DEL = -del 2>NUL /q /f $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
MKDIR = -md 2>NUL $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
WHICH = where $1
endif
all: $(TARGETS)
$(OBJ_DIR):
-$(call MKDIR, $(OBJ_DIR))
$(OBJ_DIR)/%.o: %.c
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(OBJ_DIR)/%.res: %.rc
$(RC) -O coff $(RCFLAGS) -i $< -o $@
clean:
@$(call DEL, $(TOCLEAN))
@$(RMDIR) $(OBJ_DIR)
distclean vclean: clean
@$(call DEL, $(TARGETS) $(TOVCLEAN))
### Local
ifdef LOCAL
CPPFLAGS += -DBUILDING_LIBCURL
### Sources and targets
# Provides CSOURCES, HHEADERS, LIB_RCFILES
include Makefile.inc
vpath %.c vauth vquic vssh vtls
libcurl_a_LIBRARY := libcurl.a
ifdef WIN32
CURL_DLL_SUFFIX ?=
libcurl_dll_LIBRARY := libcurl$(CURL_DLL_SUFFIX).dll
libcurl_dll_a_LIBRARY := libcurl.dll.a
ifdef MAP
libcurl_map_LIBRARY := libcurl$(CURL_DLL_SUFFIX).map
CURL_LDFLAGS_LIB += -Wl,-Map,$(libcurl_map_LIBRARY)
endif
endif
TARGETS := $(libcurl_a_LIBRARY) $(libcurl_dll_LIBRARY)
libcurl_a_OBJECTS := $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(strip $(CSOURCES))))
libcurl_a_DEPENDENCIES := $(strip $(CSOURCES) $(HHEADERS))
ifdef WIN32
libcurl_dll_OBJECTS := $(libcurl_a_OBJECTS)
libcurl_dll_OBJECTS += $(patsubst %.rc,$(OBJ_DIR)/%.res,$(strip $(LIB_RCFILES)))
endif
TOCLEAN := $(libcurl_dll_OBJECTS)
TOVCLEAN := $(libcurl_dll_LIBRARY:.dll=.def) $(libcurl_dll_a_LIBRARY) $(libcurl_map_LIBRARY)
### Rules
$(libcurl_a_LIBRARY): $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
@$(call DEL, $@)
$(AR) rcs $@ $(libcurl_a_OBJECTS)
$(libcurl_dll_LIBRARY): $(libcurl_dll_OBJECTS)
$(CC) $(LDFLAGS) -shared $(CURL_LDFLAGS_LIB) -o $@ $(libcurl_dll_OBJECTS) $(LIBS) \
-Wl,--output-def,$(@:.dll=.def),--out-implib,$(libcurl_dll_a_LIBRARY)
all: $(OBJ_DIR) $(TARGETS)
endif

799
r5dev/thirdparty/curl/Makefile.netware vendored Normal file
View File

@ -0,0 +1,799 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2004 - 2015, Guenter Knauf, <http://www.gknw.net/phpbb>.
# Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
#################################################################
#
## Makefile for building libcurl.nlm (NetWare version - gnu make)
##
## Use: make -f Makefile.netware
#
#################################################################
# Edit the path below to point to the base of your Novell NDK.
ifndef NDKBASE
NDKBASE = c:/novell
endif
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.5.0
endif
# Edit the path below to point to the base of your axTLS package.
ifndef AXTLS_PATH
AXTLS_PATH = ../../axTLS-1.2.7
endif
# Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.18
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.3
endif
# Edit the path below to point to the base of your nghttp2 package.
ifndef NGHTTP2_PATH
NGHTTP2_PATH = ../../nghttp2-0.6.7
endif
# Edit the path below to point to the base of your fbopenssl package.
ifndef FBOPENSSL_PATH
FBOPENSSL_PATH = ../../fbopenssl-0.4
endif
# Edit the path below to point to the base of your c-ares package.
ifndef LIBCARES_PATH
LIBCARES_PATH = ../ares
endif
ifndef INSTDIR
INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw
endif
# Edit the vars below to change NLM target settings.
TARGET = libcurl
VERSION = $(LIBCURL_VERSION)
COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR)
DESCR = curl libcurl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se
MTSAFE = YES
STACK = 64000
SCREEN = none
EXPORTF = $(TARGET).imp
EXPORTS = @$(EXPORTF)
# Uncomment the next line to enable linking with POSIX semantics.
# POSIXFL = 1
# Edit the var below to point to your lib architecture.
ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
OBJDIR = release
else
OPT = -g
OBJDIR = debug
endif
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
PERL = perl
# Here you can find a native Win32 binary of the original awk:
# http://www.gknw.net/development/prgtools/awk-20100523.zip
AWK = awk
CP = cp -afv
MKDIR = mkdir
# RM = rm -f
# If you want to mark the target as MTSAFE you will need a tool for
# generating the xdc data for the linker; here's a minimal tool:
# http://www.gknw.net/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
ifeq ($(CC),mwccnlm)
LD = mwldnlm
LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $@ -commandfile
AR = mwldnlm
ARFLAGS = -nostdlib -type library -o
LIBEXT = lib
#RANLIB =
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
ifeq ($(LIBARCH),LIBC)
ifeq ($(POSIXFL),1)
PRELUDE = $(NDK_LIBC)/imports/posixpre.o
else
PRELUDE = $(NDK_LIBC)/imports/libcpre.o
endif
CFLAGS += -align 4
else
# PRELUDE = $(NDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
LD = nlmconv
LDFLAGS = -T
AR = ar
ARFLAGS = -cq
LIBEXT = a
RANLIB = ranlib
CFLAGS += -m32
CFLAGS += -fno-builtin -fno-strict-aliasing
ifeq ($(findstring gcc,$(CC)),gcc)
CFLAGS += -fpcc-struct-return
endif
CFLAGS += -Wall # -pedantic
ifeq ($(LIBARCH),LIBC)
ifeq ($(POSIXFL),1)
PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o
else
PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o
endif
else
PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes don't use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
# PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
NDK_ROOT = $(NDKBASE)/ndk
ifndef NDK_CLIB
NDK_CLIB = $(NDK_ROOT)/nwsdk
endif
ifndef NDK_LIBC
NDK_LIBC = $(NDK_ROOT)/libc
endif
ifndef NDK_LDAP
NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
endif
CURL_INC = ../include
CURL_LIB = ../lib
INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
ifeq ($(findstring -static,$(CFG)),-static)
LINK_STATIC = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
WITH_ARES = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
WITH_RTMP = 1
WITH_SSL = 1
WITH_ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
WITH_SSH2 = 1
WITH_SSL = 1
WITH_ZLIB = 1
endif
ifeq ($(findstring -axtls,$(CFG)),-axtls)
WITH_AXTLS = 1
WITH_SSL =
else
ifeq ($(findstring -ssl,$(CFG)),-ssl)
WITH_SSL = 1
ifeq ($(findstring -srp,$(CFG)),-srp)
ifeq "$(wildcard $(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h)" "$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)/openssl/srp.h"
WITH_SRP = 1
endif
endif
endif
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
WITH_ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
WITH_IDN = 1
endif
ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
WITH_NGHTTP2 = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
ENABLE_IPV6 = 1
endif
ifdef WITH_ARES
INCLUDES += -I$(LIBCARES_PATH)
LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT)
endif
ifdef WITH_SSH2
INCLUDES += -I$(LIBSSH2_PATH)/include
ifdef LINK_STATIC
LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT)
else
MODULES += libssh2.nlm
IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp
endif
endif
ifdef WITH_RTMP
INCLUDES += -I$(LIBRTMP_PATH)
LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT)
endif
ifdef WITH_SSL
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
INSTDEP += ca-bundle.crt
else
ifdef WITH_AXTLS
INCLUDES += -I$(AXTLS_PATH)/inc
ifdef LINK_STATIC
LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT)
else
MODULES += libaxtls.nlm
IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp
endif
INSTDEP += ca-bundle.crt
endif
endif
ifdef WITH_ZLIB
INCLUDES += -I$(ZLIB_PATH)
ifdef LINK_STATIC
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
else
MODULES += libz.nlm
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
endif
endif
ifdef WITH_IDN
INCLUDES += -I$(LIBIDN_PATH)/include
LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT)
endif
ifdef WITH_NGHTTP2
INCLUDES += -I$(NGHTTP2_PATH)/include
LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT)
endif
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(NDK_LIBC)/include
# INCLUDES += -I$(NDK_LIBC)/include/nks
# INCLUDES += -I$(NDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE
else
INCLUDES += -I$(NDK_CLIB)/include/nlm
# INCLUDES += -I$(NDK_CLIB)/include/nlm/obsolete
# INCLUDES += -I$(NDK_CLIB)/include
endif
ifndef DISABLE_LDAP
INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc
endif
CFLAGS += $(INCLUDES)
ifeq ($(MTSAFE),YES)
XDCOPT = -n
endif
ifeq ($(MTSAFE),NO)
XDCOPT = -u
endif
ifdef XDCOPT
XDCDATA = $(OBJDIR)/$(TARGET).xdc
endif
ifeq ($(findstring /sh,$(SHELL)),/sh)
DL = '
DS = /
PCT = %
#-include $(NDKBASE)/nlmconv/ncpfs.inc
else
DS = \\
PCT = %%
endif
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(notdir $(CSOURCES)))) $(OBJDIR)/nwos.o
OBJL = $(OBJS) $(OBJDIR)/nwlib.o $(LDLIBS)
vpath %.c . vauth vtls
all: lib nlm
nlm: prebuild $(TARGET).nlm
lib: prebuild $(TARGET).$(LIBEXT)
prebuild: $(OBJDIR) $(CURL_INC)/curl/curlbuild.h $(OBJDIR)/version.inc curl_config.h
$(OBJDIR)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR)
@echo Creating $@
@$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
install: $(INSTDIR) all $(INSTDEP)
@$(CP) $(TARGET).nlm $(INSTDIR)
@$(CP) $(TARGET).$(LIBEXT) $(INSTDIR)
@$(CP) ../CHANGES $(INSTDIR)
@$(CP) ../COPYING $(INSTDIR)
@$(CP) ../README $(INSTDIR)
@$(CP) ../RELEASE-NOTES $(INSTDIR)
ifdef WITH_SSL
@-$(CP) ca-bundle.crt $(INSTDIR)/ca-bundle.crt
endif
clean:
-$(RM) curl_config.h
-$(RM) -r $(OBJDIR)
distclean vclean: clean
-$(RM) $(TARGET).$(LIBEXT) $(TARGET).nlm $(TARGET).imp
-$(RM) certdata.txt ca-bundle.crt
$(OBJDIR) $(INSTDIR):
@$(MKDIR) $@
$(TARGET).$(LIBEXT): $(OBJS)
@echo Creating $@
@-$(RM) $@
@$(AR) $(ARFLAGS) $@ $^
ifdef RANLIB
@$(RANLIB) $@
endif
$(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(EXPORTF) $(XDCDATA)
@echo Linking $@
@-$(RM) $@
@$(LD) $(LDFLAGS) $<
$(OBJDIR)/%.xdc: Makefile.netware
@echo Creating $@
@$(MPKXDC) $(XDCOPT) $@
$(OBJDIR)/%.def: Makefile.netware
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
@echo $(DL)#$(DL) >> $@
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
@echo $(DL)description "$(DESCR)"$(DL) >> $@
@echo $(DL)version $(VERSION)$(DL) >> $@
ifdef NLMTYPE
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
endif
ifdef STACK
@echo $(DL)stack $(STACK)$(DL) >> $@
endif
ifdef SCREEN
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifneq ($(DB),NDEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(TARGET)"$(DL) >> $@
ifdef XDCDATA
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
endif
@echo $(DL)flag_on 64$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)start _Prelude$(DL) >> $@
@echo $(DL)exit _Stop$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@
@echo $(DL)module clib$(DL) >> $@
ifndef DISABLE_LDAP
@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
@echo $(DL)module ldapsdk ldapssl$(DL) >> $@
endif
else
ifeq ($(POSIXFL),1)
@echo $(DL)flag_on 4194304$(DL) >> $@
endif
@echo $(DL)pseudopreemption$(DL) >> $@
ifeq ($(findstring posixpre,$(PRELUDE)),posixpre)
@echo $(DL)start POSIX_Start$(DL) >> $@
@echo $(DL)exit POSIX_Stop$(DL) >> $@
@echo $(DL)check POSIX_CheckUnload$(DL) >> $@
else
@echo $(DL)start _LibCPrelude$(DL) >> $@
@echo $(DL)exit _LibCPostlude$(DL) >> $@
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
endif
@echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@
@echo $(DL)module libc$(DL) >> $@
ifndef DISABLE_LDAP
@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
@echo $(DL)module lldapsdk lldapssl$(DL) >> $@
endif
endif
ifdef MODULES
@echo $(DL)module $(MODULES)$(DL) >> $@
endif
ifdef EXPORTS
@echo $(DL)export $(EXPORTS)$(DL) >> $@
endif
ifdef IMPORTS
@echo $(DL)import $(IMPORTS)$(DL) >> $@
endif
ifeq ($(findstring nlmconv,$(LD)),nlmconv)
@echo $(DL)input $(PRELUDE)$(DL) >> $@
@echo $(DL)input $(OBJL)$(DL) >> $@
#ifdef LDLIBS
# @echo $(DL)input $(LDLIBS)$(DL) >> $@
#endif
@echo $(DL)output $(TARGET).nlm$(DL) >> $@
endif
curl_config.h: Makefile.netware
@echo Creating $@
@echo $(DL)/* $@ for NetWare target.$(DL) > $@
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
@echo $(DL)*/$(DL) >> $@
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => https://curl.haxx.se/mail/"$(DL) >> $@
ifeq ($(LIBARCH),CLIB)
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
@echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@
@echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@
else
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
@echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@
@echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@
@echo $(DL)#define _LARGEFILE 1$(DL) >> $@
ifdef ENABLE_IPV6
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
endif
endif
@echo $(DL)#define USE_MANUAL 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERRNO_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@
@echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LL 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALE_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
@echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
@echo $(DL)#define HAVE_SEND 1$(DL) >> $@
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SETLOCALE 1$(DL) >> $@
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
@echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
@echo $(DL)#define SIZEOF_INT 4$(DL) >> $@
@echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
ifdef DISABLE_LDAP
@echo $(DL)#define CURL_DISABLE_LDAP 1$(DL) >> $@
else
@echo $(DL)#define CURL_HAS_NOVELL_LDAPSDK 1$(DL) >> $@
ifndef DISABLE_LDAPS
@echo $(DL)#define HAVE_LDAP_SSL 1$(DL) >> $@
endif
@echo $(DL)#define HAVE_LDAP_SSL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LDAP_URL_PARSE 1$(DL) >> $@
endif
ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else
@echo $(DL)#define USE_BSD_SOCKETS 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
@echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
endif
ifdef WITH_ARES
@echo $(DL)#define USE_ARES 1$(DL) >> $@
endif
ifdef WITH_ZLIB
@echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
endif
ifdef WITH_SSL
@echo $(DL)#define USE_SSLEAY 1$(DL) >> $@
@echo $(DL)#define USE_OPENSSL 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@
@echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@
@echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@
@echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@
@echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@
ifdef WITH_SRP
@echo $(DL)#define HAVE_SSLEAY_SRP 1$(DL) >> $@
@echo $(DL)#define USE_TLS_SRP 1$(DL) >> $@
endif
ifdef WITH_SPNEGO
@echo $(DL)#define HAVE_SPNEGO 1$(DL) >> $@
endif
else
ifdef WITH_AXTLS
@echo $(DL)#define USE_AXTLS 1$(DL) >> $@
endif
endif
ifdef WITH_SSH2
@echo $(DL)#define USE_LIBSSH2 1$(DL) >> $@
@echo $(DL)#define HAVE_LIBSSH2_H 1$(DL) >> $@
endif
ifdef WITH_IDN
@echo $(DL)#define HAVE_LIBIDN 1$(DL) >> $@
@echo $(DL)#define HAVE_TLD_H 1$(DL) >> $@
endif
ifdef WITH_RTMP
@echo $(DL)#define USE_LIBRTMP 1$(DL) >> $@
endif
ifdef WITH_NGHTTP2
@echo $(DL)#define USE_NGHTTP2 1$(DL) >> $@
endif
@echo $(DL)#ifdef __GNUC__$(DL) >> $@
@echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@
@echo $(DL)#else$(DL) >> $@
@echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
ifdef CABUNDLE
@echo $(DL)#define CURL_CA_BUNDLE "$(CABUNDLE)"$(DL) >> $@
else
@echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@
endif
$(EXPORTF): $(CURL_INC)/curl/curl.h $(CURL_INC)/curl/easy.h $(CURL_INC)/curl/multi.h $(CURL_INC)/curl/mprintf.h
@echo Creating $@
@$(AWK) -f ../packages/NetWare/get_exp.awk $^ > $@
FORCE: ;
info: $(OBJDIR)/version.inc
@echo Configured to build $(TARGET) with these options:
@echo libarchitecture: $(LIBARCH)
@echo curl version: $(LIBCURL_VERSION_STR)
@echo compiler/linker: $(CC) / $(LD)
ifdef CABUNDLE
@echo ca-bundle path: $(CABUNDLE)
endif
ifdef WITH_SSL
@echo SSL support: enabled (OpenSSL)
else
@echo SSL support: no
endif
ifdef WITH_SRP
@echo SRP support: enabled
else
@echo SRP support: no
endif
ifdef WITH_SSH2
@echo SSH2 support: enabled (libssh2)
else
@echo SSH2 support: no
endif
ifdef WITH_ZLIB
@echo zlib support: enabled
else
@echo zlib support: no
endif
ifdef WITH_NGHTTP2
@echo http2 support: enabled
else
@echo http2 support: no
endif
ifdef WITH_ARES
@echo c-ares support: enabled
else
@echo c-ares support: no
endif
ifdef ENABLE_IPV6
@echo IPv6 support: enabled
else
@echo IPv6 support: no
endif
$(CURL_INC)/curl/curlbuild.h: Makefile.netware FORCE
@echo Creating $@
@echo $(DL)/* $@ intended for NetWare target.$(DL) > $@
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
@echo $(DL)*/$(DL) >> $@
@echo $(DL)#ifndef NETWARE$(DL) >> $@
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
@echo $(DL)#endif$(DL) >> $@
@echo $(DL)#ifndef __CURL_CURLBUILD_H$(DL) >> $@
@echo $(DL)#define __CURL_CURLBUILD_H$(DL) >> $@
ifeq ($(LIBARCH),LIBC)
@echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@
@echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int$(DL) >> $@
@echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@
@echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long long$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_CURL_OFF_T "lld"$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "llu"$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)lld"$(DL) >> $@
@echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 8$(DL) >> $@
@echo $(DL)#define CURL_SUFFIX_CURL_OFF_T LL$(DL) >> $@
@echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU ULL$(DL) >> $@
else
@echo $(DL)#define CURL_SIZEOF_LONG 4$(DL) >> $@
@echo $(DL)#define CURL_TYPEOF_CURL_SOCKLEN_T int$(DL) >> $@
@echo $(DL)#define CURL_SIZEOF_CURL_SOCKLEN_T 4$(DL) >> $@
@echo $(DL)#define CURL_TYPEOF_CURL_OFF_T long$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_CURL_OFF_T "ld"$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_CURL_OFF_TU "lu"$(DL) >> $@
@echo $(DL)#define CURL_FORMAT_OFF_T "$(PCT)ld"$(DL) >> $@
@echo $(DL)#define CURL_SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define CURL_SUFFIX_CURL_OFF_T L$(DL) >> $@
@echo $(DL)#define CURL_SUFFIX_CURL_OFF_TU UL$(DL) >> $@
endif
@echo $(DL)typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;$(DL) >> $@
@echo $(DL)typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;$(DL) >> $@
@echo $(DL)#endif /* __CURL_CURLBUILD_H */$(DL) >> $@
$(LIBCARES_PATH)/libcares.$(LIBEXT):
$(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib
ca-bundle.crt: mk-ca-bundle.pl
@echo Creating $@
@-$(PERL) $< -b -n $@

View File

@ -1,42 +0,0 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
###########################################################################
VERSIONCHANGE=12
VERSIONADD=0
VERSIONDEL=8
# libtool version:
VERSIONINFO=-version-info $(VERSIONCHANGE):$(VERSIONADD):$(VERSIONDEL)
# This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1.
#
# Here's the simplified rule guide on how to change -version-info:
# (current version is C:R:A)
#
# 1. if there are only source changes, use C:R+1:A
# 2. if interfaces were added use C+1:0:A+1
# 3. if interfaces were removed, then use C+1:0:0
#
# For the full guide on libcurl ABI rules, see docs/libcurl/ABI

177
r5dev/thirdparty/curl/Makefile.vxworks vendored Normal file
View File

@ -0,0 +1,177 @@
#*****************************************************************************
#
#
#Filename : Makefile.vxworks
#Description: makefile to be used in order to compile libcurl for VxWoorks 6.3.
#
#How to use:
# 1. Adjust environment variables at the file beginning
# 2. Open the Command Prompt window and change directory ('cd')
# into the 'lib' folder
# 3. Add <CYGWIN>/bin folder to the PATH environment variable
# For example type 'set PATH=C:/embedded/cygwin/bin;%PATH%'
# 4. Build the library by typing 'make -f ./Makefile.vxworks'
# As a result the libcurl.a should be created in the 'lib' folder.
# To clean package use 'make -f ./Makefile.vxworks clean'
#Requirements:
# 1. WinXP machine
# 2. Full CYGWIN installation (open source) with GNU make version
# v3.78 or higher
# 3. WindRiver Workbench with vxWorks 6.3 (commercial)
#*****************************************************************************
# ----------------------------------------------------------------------
# Environment
# ----------------------------------------------------------------------
export WIND_HOME := C:/embedded/Workbench2.5.0.1
export WIND_BASE := $(WIND_HOME)/vxworks-6.3
export WIND_HOST_TYPE := x86-win32
# BUILD_TYE:= <debug>|<release> (build with debugging info or optimized)
BUILD_TYPE := debug
USER_CFLAGS:=
# directories where to seek for includes and libraries
OPENSSL_INC := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3/include
OPENSSL_LIB := D:/libraries/openssl/openssl-0.9.8zc-vxWorks6.3
ZLIB_INC := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/zlib-1.2.8
ZLIB_LIB := D:/libraries/zlib/zlib-1.2.8-VxWorks6.3/binaries/vxworks_3.1_gnu/Debug/lib
ARES_INC :=
ARES_LIB :=
# ----------------------------------------------------------------------
# Compiler
# ----------------------------------------------------------------------
CC := ccppc
AR := arppc
LINK := ccppc
CFLAGS := -D__GNUC__ -D__ppc__ -msoft-float -fno-builtin -mcpu=604 -mlongcall -DCPU=PPC604 -D_GNU_TOOL -Wall -W -Winline $(USER_CFLAGS)
LDFLAGS := -nostdlib -Wl,-i -Wl,-X
INCLUDE_FLAG := -I
C_DEBUGFLAG := -g
C_OPTFLAG := -O2
COMPILE_ONLY_FLAG := -c
OBJ_EXTENSION := .o
CC_OBJ_OUTPUT = -o $@
ARFLAGS := -rc
LIBS_FLAG := -l
LIBS_DIRFLAG:= -L
LD_DEBUGFLAG := $(C_DEBUGFLAG)
EXECUTE_EXTENSION := .out
TOOL_CHAIN_BIN := $(WIND_HOME)/gnu/3.4.4-vxworks-6.3/$(WIND_HOST_TYPE)/bin/
# ----------------------------------------------------------------------
# Add -DINET6 if the OS kernel image was built with IPv6 support
# CFLAGS += -DINET6
# Set up compiler and linker flags for debug or optimization
ifeq ($(BUILD_TYPE), debug)
CFLAGS += $(C_DEBUGFLAG)
LDFLAGS += $(LD_DEBUGFLAG)
else
CFLAGS += $(C_OPTFLAG)
endif
# ----------------------------------------------------------------------
# Main Makefile and possible sub-make files
MAKEFILES := Makefile.vxworks
# List of external include directories
#-----
# IMPORTANT: include OPENSSL directories before system
# in order to prevent WindRiver OpenSSL to be used.
#-----
INCLUDE_DIRS := ../include $(OPENSSL_INC) $(ZLIB_INC) $(ARES_INC) $(WIND_BASE)/target/h $(WIND_BASE)/target/h/wrn/coreip
# List of external libraries and their directories
LIBS_LIST := .
LIB_DIRS := .
ifneq ($(OPENSSL_LIB), )
LIBS_LIST += crypto ssl
LIB_DIRS += $(OPENSSL_LIB)
endif
ifneq ($(ZLIB_LIB), )
LIBS_LIST += z
LIB_DIRS += $(ZLIB_LIB)
endif
ifneq ($(ARES_LIB), )
LIBS_LIST += ares
LIB_DIRS += $(ARES_LIB)
endif
# Add include and library directories and libraries
CFLAGS += $(INCLUDE_DIRS:%=$(INCLUDE_FLAG)%)
LDFLAGS += $(LIB_DIRS:%=$(LIBS_DIRFLAG)%)
# List of targets to make for libs target
LIBS_TARGET_LIST := libcurl.a
# List of execuatble applications to make in addition to libs for all target
EXE_TARGET_LIST :=
# Support for echoing rules
# If ECHORULES variable was set (for example, using 'make' command line)
# some shell commands in the rules will be echoed
ifneq ($(strip $(findstring $(ECHORULES), yes YES 1 true TRUE)),)
_@_ :=
else
_@_ := @
endif
# Directory to hold compilation intermediate files
TMP_DIR := tmp
# Get sources and headers to be compiled
include Makefile.inc
# List of headers
INCLUDE_FILES := $(HHEADERS)
INCLUDE_FILES += $(shell find ../include -name \*.h)
# List of sources
OBJLIST := $(CSOURCES:%.c=$(TMP_DIR)/%$(OBJ_EXTENSION))
# ----------------------------------------------------------------------
#### default rule
# It should be first rule in this file
.PHONY: default
default: libcurl.a
#### Compiling C files
$(TMP_DIR)/%$(OBJ_EXTENSION): %.c $(MAKEFILES)
@echo Compiling C file $< $(ECHO_STDOUT)
@[ -d $(@D) ] || mkdir -p $(@D)
$(_@_) $(TOOL_CHAIN_BIN)$(CC) $(COMPILE_ONLY_FLAG) $(CFLAGS) $< $(CC_OBJ_OUTPUT)
#### Creating library
$(LIBS_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(OBJLIST)
@echo Creating library $@ $(ECHO_STDOUT)
$(_@_) [ -d $(@D) ] || mkdir -p $(@D)
$(_@_) rm -f $@
$(_@_) $(TOOL_CHAIN_BIN)$(AR) $(ARFLAGS) $@ $(filter %$(OBJ_EXTENSION), $^)
#### Creating application
$(EXE_TARGET_LIST): $(INCLUDE_FILES) $(MAKEFILES) $(LIBS_TARGET_LIST)
@echo Creating application $@
@[ -d $(@D) ] || mkdir -p $(@D)
$(_@_) $(TOOL_CHAIN_BIN)$(LINK) $(CC_OBJ_OUTPUT) $($(@)_EXE_OBJ_LIST) $(LDFLAGS) $($(@)_EXE_LIBS_NEEDED:%=$(LIBS_FLAG)%) $(LIBS_LIST:%=$(LIBS_FLAG)%) $(USER_LIBS_LIST) $(USER_LIBS_LIST)
#### Master Targets
libs: $(LIBS_TARGET_LIST)
@echo All libs made.
all: $(LIBS_TARGET_LIST) $(EXE_TARGET_LIST) $(INCLUDE_TARGET_LIST)
@echo All targets made.
# Clean up
.PHONY: clean
clean:
$(_@_) rm -rf $(TMP_DIR)
@echo libcurl was cleaned.

View File

@ -1,662 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2019 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
* The Alt-Svc: header is defined in RFC 7838:
* https://datatracker.ietf.org/doc/html/rfc7838
*/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "urldata.h"
#include "altsvc.h"
#include "curl_get_line.h"
#include "strcase.h"
#include "parsedate.h"
#include "sendf.h"
#include "warnless.h"
#include "fopen.h"
#include "rename.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#define MAX_ALTSVC_LINE 4095
#define MAX_ALTSVC_DATELENSTR "64"
#define MAX_ALTSVC_DATELEN 64
#define MAX_ALTSVC_HOSTLENSTR "512"
#define MAX_ALTSVC_HOSTLEN 512
#define MAX_ALTSVC_ALPNLENSTR "10"
#define MAX_ALTSVC_ALPNLEN 10
#define H3VERSION "h3"
static enum alpnid alpn2alpnid(char *name)
{
if(strcasecompare(name, "h1"))
return ALPN_h1;
if(strcasecompare(name, "h2"))
return ALPN_h2;
if(strcasecompare(name, H3VERSION))
return ALPN_h3;
return ALPN_none; /* unknown, probably rubbish input */
}
/* Given the ALPN ID, return the name */
const char *Curl_alpnid2str(enum alpnid id)
{
switch(id) {
case ALPN_h1:
return "h1";
case ALPN_h2:
return "h2";
case ALPN_h3:
return H3VERSION;
default:
return ""; /* bad */
}
}
static void altsvc_free(struct altsvc *as)
{
free(as->src.host);
free(as->dst.host);
free(as);
}
static struct altsvc *altsvc_createid(const char *srchost,
const char *dsthost,
enum alpnid srcalpnid,
enum alpnid dstalpnid,
unsigned int srcport,
unsigned int dstport)
{
struct altsvc *as = calloc(sizeof(struct altsvc), 1);
size_t hlen;
if(!as)
return NULL;
hlen = strlen(srchost);
DEBUGASSERT(hlen);
as->src.host = strdup(srchost);
if(!as->src.host)
goto error;
if(hlen && (srchost[hlen - 1] == '.'))
/* strip off trailing any dot */
as->src.host[--hlen] = 0;
as->dst.host = strdup(dsthost);
if(!as->dst.host)
goto error;
as->src.alpnid = srcalpnid;
as->dst.alpnid = dstalpnid;
as->src.port = curlx_ultous(srcport);
as->dst.port = curlx_ultous(dstport);
return as;
error:
altsvc_free(as);
return NULL;
}
static struct altsvc *altsvc_create(char *srchost,
char *dsthost,
char *srcalpn,
char *dstalpn,
unsigned int srcport,
unsigned int dstport)
{
enum alpnid dstalpnid = alpn2alpnid(dstalpn);
enum alpnid srcalpnid = alpn2alpnid(srcalpn);
if(!srcalpnid || !dstalpnid)
return NULL;
return altsvc_createid(srchost, dsthost, srcalpnid, dstalpnid,
srcport, dstport);
}
/* only returns SERIOUS errors */
static CURLcode altsvc_add(struct altsvcinfo *asi, char *line)
{
/* Example line:
h2 example.com 443 h3 shiny.example.com 8443 "20191231 10:00:00" 1
*/
char srchost[MAX_ALTSVC_HOSTLEN + 1];
char dsthost[MAX_ALTSVC_HOSTLEN + 1];
char srcalpn[MAX_ALTSVC_ALPNLEN + 1];
char dstalpn[MAX_ALTSVC_ALPNLEN + 1];
char date[MAX_ALTSVC_DATELEN + 1];
unsigned int srcport;
unsigned int dstport;
unsigned int prio;
unsigned int persist;
int rc;
rc = sscanf(line,
"%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u "
"%" MAX_ALTSVC_ALPNLENSTR "s %" MAX_ALTSVC_HOSTLENSTR "s %u "
"\"%" MAX_ALTSVC_DATELENSTR "[^\"]\" %u %u",
srcalpn, srchost, &srcport,
dstalpn, dsthost, &dstport,
date, &persist, &prio);
if(9 == rc) {
struct altsvc *as;
time_t expires = Curl_getdate_capped(date);
as = altsvc_create(srchost, dsthost, srcalpn, dstalpn, srcport, dstport);
if(as) {
as->expires = expires;
as->prio = prio;
as->persist = persist ? 1 : 0;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
}
}
return CURLE_OK;
}
/*
* Load alt-svc entries from the given file. The text based line-oriented file
* format is documented here: https://curl.se/docs/alt-svc.html
*
* This function only returns error on major problems that prevent alt-svc
* handling to work completely. It will ignore individual syntactical errors
* etc.
*/
static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
{
CURLcode result = CURLE_OK;
char *line = NULL;
FILE *fp;
/* we need a private copy of the file name so that the altsvc cache file
name survives an easy handle reset */
free(asi->filename);
asi->filename = strdup(file);
if(!asi->filename)
return CURLE_OUT_OF_MEMORY;
fp = fopen(file, FOPEN_READTEXT);
if(fp) {
line = malloc(MAX_ALTSVC_LINE);
if(!line)
goto fail;
while(Curl_get_line(line, MAX_ALTSVC_LINE, fp)) {
char *lineptr = line;
while(*lineptr && ISBLANK(*lineptr))
lineptr++;
if(*lineptr == '#')
/* skip commented lines */
continue;
altsvc_add(asi, lineptr);
}
free(line); /* free the line buffer */
fclose(fp);
}
return result;
fail:
Curl_safefree(asi->filename);
free(line);
fclose(fp);
return CURLE_OUT_OF_MEMORY;
}
/*
* Write this single altsvc entry to a single output line
*/
static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
{
struct tm stamp;
CURLcode result = Curl_gmtime(as->expires, &stamp);
if(result)
return result;
fprintf(fp,
"%s %s %u "
"%s %s %u "
"\"%d%02d%02d "
"%02d:%02d:%02d\" "
"%u %d\n",
Curl_alpnid2str(as->src.alpnid), as->src.host, as->src.port,
Curl_alpnid2str(as->dst.alpnid), as->dst.host, as->dst.port,
stamp.tm_year + 1900, stamp.tm_mon + 1, stamp.tm_mday,
stamp.tm_hour, stamp.tm_min, stamp.tm_sec,
as->persist, as->prio);
return CURLE_OK;
}
/* ---- library-wide functions below ---- */
/*
* Curl_altsvc_init() creates a new altsvc cache.
* It returns the new instance or NULL if something goes wrong.
*/
struct altsvcinfo *Curl_altsvc_init(void)
{
struct altsvcinfo *asi = calloc(sizeof(struct altsvcinfo), 1);
if(!asi)
return NULL;
Curl_llist_init(&asi->list, NULL);
/* set default behavior */
asi->flags = CURLALTSVC_H1
#ifdef USE_HTTP2
| CURLALTSVC_H2
#endif
#ifdef ENABLE_QUIC
| CURLALTSVC_H3
#endif
;
return asi;
}
/*
* Curl_altsvc_load() loads alt-svc from file.
*/
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file)
{
CURLcode result;
DEBUGASSERT(asi);
result = altsvc_load(asi, file);
return result;
}
/*
* Curl_altsvc_ctrl() passes on the external bitmask.
*/
CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl)
{
DEBUGASSERT(asi);
if(!ctrl)
/* unexpected */
return CURLE_BAD_FUNCTION_ARGUMENT;
asi->flags = ctrl;
return CURLE_OK;
}
/*
* Curl_altsvc_cleanup() frees an altsvc cache instance and all associated
* resources.
*/
void Curl_altsvc_cleanup(struct altsvcinfo **altsvcp)
{
struct Curl_llist_element *e;
struct Curl_llist_element *n;
if(*altsvcp) {
struct altsvcinfo *altsvc = *altsvcp;
for(e = altsvc->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
altsvc_free(as);
}
free(altsvc->filename);
free(altsvc);
*altsvcp = NULL; /* clear the pointer */
}
}
/*
* Curl_altsvc_save() writes the altsvc cache to a file.
*/
CURLcode Curl_altsvc_save(struct Curl_easy *data,
struct altsvcinfo *altsvc, const char *file)
{
struct Curl_llist_element *e;
struct Curl_llist_element *n;
CURLcode result = CURLE_OK;
FILE *out;
char *tempstore = NULL;
if(!altsvc)
/* no cache activated */
return CURLE_OK;
/* if not new name is given, use the one we stored from the load */
if(!file && altsvc->filename)
file = altsvc->filename;
if((altsvc->flags & CURLALTSVC_READONLYFILE) || !file || !file[0])
/* marked as read-only, no file or zero length file name */
return CURLE_OK;
result = Curl_fopen(data, file, &out, &tempstore);
if(!result) {
fputs("# Your alt-svc cache. https://curl.se/docs/alt-svc.html\n"
"# This file was generated by libcurl! Edit at your own risk.\n",
out);
for(e = altsvc->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
result = altsvc_out(as, out);
if(result)
break;
}
fclose(out);
if(!result && tempstore && Curl_rename(tempstore, file))
result = CURLE_WRITE_ERROR;
if(result && tempstore)
unlink(tempstore);
}
free(tempstore);
return result;
}
static CURLcode getalnum(const char **ptr, char *alpnbuf, size_t buflen)
{
size_t len;
const char *protop;
const char *p = *ptr;
while(*p && ISBLANK(*p))
p++;
protop = p;
while(*p && !ISBLANK(*p) && (*p != ';') && (*p != '='))
p++;
len = p - protop;
*ptr = p;
if(!len || (len >= buflen))
return CURLE_BAD_FUNCTION_ARGUMENT;
memcpy(alpnbuf, protop, len);
alpnbuf[len] = 0;
return CURLE_OK;
}
/* hostcompare() returns true if 'host' matches 'check'. The first host
* argument may have a trailing dot present that will be ignored.
*/
static bool hostcompare(const char *host, const char *check)
{
size_t hlen = strlen(host);
size_t clen = strlen(check);
if(hlen && (host[hlen - 1] == '.'))
hlen--;
if(hlen != clen)
/* they can't match if they have different lengths */
return FALSE;
return strncasecompare(host, check, hlen);
}
/* altsvc_flush() removes all alternatives for this source origin from the
list */
static void altsvc_flush(struct altsvcinfo *asi, enum alpnid srcalpnid,
const char *srchost, unsigned short srcport)
{
struct Curl_llist_element *e;
struct Curl_llist_element *n;
for(e = asi->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
if((srcalpnid == as->src.alpnid) &&
(srcport == as->src.port) &&
hostcompare(srchost, as->src.host)) {
Curl_llist_remove(&asi->list, e, NULL);
altsvc_free(as);
}
}
}
#ifdef DEBUGBUILD
/* to play well with debug builds, we can *set* a fixed time this will
return */
static time_t debugtime(void *unused)
{
char *timestr = getenv("CURL_TIME");
(void)unused;
if(timestr) {
unsigned long val = strtol(timestr, NULL, 10);
return (time_t)val;
}
return time(NULL);
}
#define time(x) debugtime(x)
#endif
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
/*
* Curl_altsvc_parse() takes an incoming alt-svc response header and stores
* the data correctly in the cache.
*
* 'value' points to the header *value*. That's contents to the right of the
* header name.
*
* Currently this function rejects invalid data without returning an error.
* Invalid host name, port number will result in the specific alternative
* being rejected. Unknown protocols are skipped.
*/
CURLcode Curl_altsvc_parse(struct Curl_easy *data,
struct altsvcinfo *asi, const char *value,
enum alpnid srcalpnid, const char *srchost,
unsigned short srcport)
{
const char *p = value;
size_t len;
char namebuf[MAX_ALTSVC_HOSTLEN] = "";
char alpnbuf[MAX_ALTSVC_ALPNLEN] = "";
struct altsvc *as;
unsigned short dstport = srcport; /* the same by default */
CURLcode result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
size_t entries = 0;
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data;
#endif
if(result) {
infof(data, "Excessive alt-svc header, ignoring.");
return CURLE_OK;
}
DEBUGASSERT(asi);
/* "clear" is a magic keyword */
if(strcasecompare(alpnbuf, "clear")) {
/* Flush cached alternatives for this source origin */
altsvc_flush(asi, srcalpnid, srchost, srcport);
return CURLE_OK;
}
do {
if(*p == '=') {
/* [protocol]="[host][:port]" */
enum alpnid dstalpnid = alpn2alpnid(alpnbuf); /* the same by default */
p++;
if(*p == '\"') {
const char *dsthost = "";
const char *value_ptr;
char option[32];
unsigned long num;
char *end_ptr;
bool quoted = FALSE;
time_t maxage = 24 * 3600; /* default is 24 hours */
bool persist = FALSE;
bool valid = TRUE;
p++;
if(*p != ':') {
/* host name starts here */
const char *hostp = p;
while(*p && (ISALNUM(*p) || (*p == '.') || (*p == '-')))
p++;
len = p - hostp;
if(!len || (len >= MAX_ALTSVC_HOSTLEN)) {
infof(data, "Excessive alt-svc host name, ignoring.");
valid = FALSE;
}
else {
memcpy(namebuf, hostp, len);
namebuf[len] = 0;
dsthost = namebuf;
}
}
else {
/* no destination name, use source host */
dsthost = srchost;
}
if(*p == ':') {
unsigned long port = 0;
p++;
if(ISDIGIT(*p))
/* a port number */
port = strtoul(p, &end_ptr, 10);
else
end_ptr = (char *)p; /* not left uninitialized */
if(!port || port > USHRT_MAX || end_ptr == p || *end_ptr != '\"') {
infof(data, "Unknown alt-svc port number, ignoring.");
valid = FALSE;
}
else {
dstport = curlx_ultous(port);
p = end_ptr;
}
}
if(*p++ != '\"')
break;
/* Handle the optional 'ma' and 'persist' flags. Unknown flags
are skipped. */
for(;;) {
while(ISBLANK(*p))
p++;
if(*p != ';')
break;
p++; /* pass the semicolon */
if(!*p || ISNEWLINE(*p))
break;
result = getalnum(&p, option, sizeof(option));
if(result) {
/* skip option if name is too long */
option[0] = '\0';
}
while(*p && ISBLANK(*p))
p++;
if(*p != '=')
return CURLE_OK;
p++;
while(*p && ISBLANK(*p))
p++;
if(!*p)
return CURLE_OK;
if(*p == '\"') {
/* quoted value */
p++;
quoted = TRUE;
}
value_ptr = p;
if(quoted) {
while(*p && *p != '\"')
p++;
if(!*p++)
return CURLE_OK;
}
else {
while(*p && !ISBLANK(*p) && *p!= ';' && *p != ',')
p++;
}
num = strtoul(value_ptr, &end_ptr, 10);
if((end_ptr != value_ptr) && (num < ULONG_MAX)) {
if(strcasecompare("ma", option))
maxage = num;
else if(strcasecompare("persist", option) && (num == 1))
persist = TRUE;
}
}
if(dstalpnid && valid) {
if(!entries++)
/* Flush cached alternatives for this source origin, if any - when
this is the first entry of the line. */
altsvc_flush(asi, srcalpnid, srchost, srcport);
as = altsvc_createid(srchost, dsthost,
srcalpnid, dstalpnid,
srcport, dstport);
if(as) {
/* The expires time also needs to take the Age: value (if any) into
account. [See RFC 7838 section 3.1] */
as->expires = maxage + time(NULL);
as->persist = persist;
Curl_llist_insert_next(&asi->list, asi->list.tail, as, &as->node);
infof(data, "Added alt-svc: %s:%d over %s", dsthost, dstport,
Curl_alpnid2str(dstalpnid));
}
}
}
else
break;
/* after the double quote there can be a comma if there's another
string or a semicolon if no more */
if(*p == ',') {
/* comma means another alternative is presented */
p++;
result = getalnum(&p, alpnbuf, sizeof(alpnbuf));
if(result)
break;
}
}
else
break;
} while(*p && (*p != ';') && (*p != '\n') && (*p != '\r'));
return CURLE_OK;
}
/*
* Return TRUE on a match
*/
bool Curl_altsvc_lookup(struct altsvcinfo *asi,
enum alpnid srcalpnid, const char *srchost,
int srcport,
struct altsvc **dstentry,
const int versions) /* one or more bits */
{
struct Curl_llist_element *e;
struct Curl_llist_element *n;
time_t now = time(NULL);
DEBUGASSERT(asi);
DEBUGASSERT(srchost);
DEBUGASSERT(dstentry);
for(e = asi->list.head; e; e = n) {
struct altsvc *as = e->ptr;
n = e->next;
if(as->expires < now) {
/* an expired entry, remove */
Curl_llist_remove(&asi->list, e, NULL);
altsvc_free(as);
continue;
}
if((as->src.alpnid == srcalpnid) &&
hostcompare(srchost, as->src.host) &&
(as->src.port == srcport) &&
(versions & as->dst.alpnid)) {
/* match */
*dstentry = as;
return TRUE;
}
}
return FALSE;
}
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */

View File

@ -1,81 +0,0 @@
#ifndef HEADER_CURL_ALTSVC_H
#define HEADER_CURL_ALTSVC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2019 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_ALTSVC)
#include <curl/curl.h>
#include "llist.h"
enum alpnid {
ALPN_none = 0,
ALPN_h1 = CURLALTSVC_H1,
ALPN_h2 = CURLALTSVC_H2,
ALPN_h3 = CURLALTSVC_H3
};
struct althost {
char *host;
unsigned short port;
enum alpnid alpnid;
};
struct altsvc {
struct althost src;
struct althost dst;
time_t expires;
bool persist;
int prio;
struct Curl_llist_element node;
};
struct altsvcinfo {
char *filename;
struct Curl_llist list; /* list of entries */
long flags; /* the publicly set bitmask */
};
const char *Curl_alpnid2str(enum alpnid id);
struct altsvcinfo *Curl_altsvc_init(void);
CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file);
CURLcode Curl_altsvc_save(struct Curl_easy *data,
struct altsvcinfo *asi, const char *file);
CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl);
void Curl_altsvc_cleanup(struct altsvcinfo **altsvc);
CURLcode Curl_altsvc_parse(struct Curl_easy *data,
struct altsvcinfo *altsvc, const char *value,
enum alpnid srcalpn, const char *srchost,
unsigned short srcport);
bool Curl_altsvc_lookup(struct altsvcinfo *asi,
enum alpnid srcalpnid, const char *srchost,
int srcport,
struct altsvc **dstentry,
const int versions); /* CURLALTSVC_H* bits */
#else
/* disabled */
#define Curl_altsvc_save(a,b,c)
#define Curl_altsvc_cleanup(x)
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_ALTSVC */
#endif /* HEADER_CURL_ALTSVC_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,192 +18,27 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#ifdef __AMIGA__
#if defined(__AMIGA__) && !defined(__ixemul__)
#include <curl/curl.h>
#include "hostip.h"
#include "amigaos.h"
#ifdef HAVE_PROTO_BSDSOCKET_H
# if defined(__amigaos4__)
# include <bsdsocket/socketbasetags.h>
# elif !defined(USE_AMISSL)
#include <amitcp/socketbasetags.h>
# endif
# ifdef __libnix__
# include <stabs.h>
# endif
#endif
/* The last #include files should be: */
#include "curl_memory.h"
#include "memdebug.h"
#ifdef HAVE_PROTO_BSDSOCKET_H
#ifdef __amigaos4__
/*
* AmigaOS 4.x specific code
*/
/*
* hostip4.c - Curl_ipv4_resolve_r() replacement code
*
* Logic that needs to be considered are the following build cases:
* - newlib networking
* - clib2 networking
* - direct bsdsocket.library networking (usually AmiSSL builds)
* Each with the threaded resolver enabled or not.
*
* With the threaded resolver enabled, try to use gethostbyname_r() where
* available, otherwise (re)open bsdsocket.library and fallback to
* gethostbyname().
*/
#include <proto/bsdsocket.h>
static struct SocketIFace *__CurlISocket = NULL;
static uint32 SocketFeatures = 0;
#define HAVE_BSDSOCKET_GETHOSTBYNAME_R 0x01
#define HAVE_BSDSOCKET_GETADDRINFO 0x02
CURLcode Curl_amiga_init(void)
{
struct SocketIFace *ISocket;
struct Library *base = OpenLibrary("bsdsocket.library", 4);
if(base) {
ISocket = (struct SocketIFace *)GetInterface(base, "main", 1, NULL);
if(ISocket) {
ULONG enabled = 0;
SocketBaseTags(SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES), TRUE,
SBTM_GETREF(SBTC_HAVE_GETHOSTADDR_R_API), (ULONG)&enabled,
TAG_DONE);
if(enabled) {
SocketFeatures |= HAVE_BSDSOCKET_GETHOSTBYNAME_R;
}
__CurlISocket = ISocket;
atexit(Curl_amiga_cleanup);
return CURLE_OK;
}
CloseLibrary(base);
}
return CURLE_FAILED_INIT;
}
void Curl_amiga_cleanup(void)
{
if(__CurlISocket) {
struct Library *base = __CurlISocket->Data.LibBase;
DropInterface((struct Interface *)__CurlISocket);
CloseLibrary(base);
__CurlISocket = NULL;
}
}
#ifdef CURLRES_AMIGA
/*
* Because we need to handle the different cases in hostip4.c at run-time,
* not at compile-time, based on what was detected in Curl_amiga_init(),
* we replace it completely with our own as to not complicate the baseline
* code. Assumes malloc/calloc/free are thread safe because Curl_he2ai()
* allocates memory also.
*/
struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
int port)
{
struct Curl_addrinfo *ai = NULL;
struct hostent *h;
struct SocketIFace *ISocket = __CurlISocket;
if(SocketFeatures & HAVE_BSDSOCKET_GETHOSTBYNAME_R) {
LONG h_errnop = 0;
struct hostent *buf;
buf = calloc(1, CURL_HOSTENT_SIZE);
if(buf) {
h = gethostbyname_r((STRPTR)hostname, buf,
(char *)buf + sizeof(struct hostent),
CURL_HOSTENT_SIZE - sizeof(struct hostent),
&h_errnop);
if(h) {
ai = Curl_he2ai(h, port);
}
free(buf);
}
}
else {
#ifdef CURLRES_THREADED
/* gethostbyname() is not thread safe, so we need to reopen bsdsocket
* on the thread's context
*/
struct Library *base = OpenLibrary("bsdsocket.library", 4);
if(base) {
ISocket = (struct SocketIFace *)GetInterface(base, "main", 1, NULL);
if(ISocket) {
h = gethostbyname((STRPTR)hostname);
if(h) {
ai = Curl_he2ai(h, port);
}
DropInterface((struct Interface *)ISocket);
}
CloseLibrary(base);
}
#else
/* not using threaded resolver - safe to use this as-is */
h = gethostbyname(hostname);
if(h) {
ai = Curl_he2ai(h, port);
}
#endif
}
return ai;
}
#endif /* CURLRES_AMIGA */
#ifdef USE_AMISSL
int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout)
{
int r = WaitSelect(nfds, readfds, writefds, errorfds, timeout, 0);
/* Ensure Ctrl-C signal is actioned */
if((r == -1) && (SOCKERRNO == EINTR))
raise(SIGINT);
return r;
}
#endif /* USE_AMISSL */
#elif !defined(USE_AMISSL) /* __amigaos4__ */
/*
* Amiga OS3 specific code
*/
#include "amigaos.h"
struct Library *SocketBase = NULL;
extern int errno, h_errno;
#ifdef __libnix__
#include <stabs.h>
void __request(const char *msg);
#else
# define __request(msg) Printf(msg "\n\a")
#endif
void Curl_amiga_cleanup(void)
void Curl_amiga_cleanup()
{
if(SocketBase) {
CloseLibrary(SocketBase);
@ -211,36 +46,32 @@ void Curl_amiga_cleanup(void)
}
}
CURLcode Curl_amiga_init(void)
bool Curl_amiga_init()
{
if(!SocketBase)
SocketBase = OpenLibrary("bsdsocket.library", 4);
if(!SocketBase) {
__request("No TCP/IP Stack running!");
return CURLE_FAILED_INIT;
return FALSE;
}
if(SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))), (ULONG) &errno,
SBTM_SETVAL(SBTC_LOGTAGPTR), (ULONG) "curl",
TAG_DONE)) {
__request("SocketBaseTags ERROR");
return CURLE_FAILED_INIT;
return FALSE;
}
#ifndef __libnix__
atexit(Curl_amiga_cleanup);
#endif
return CURLE_OK;
return TRUE;
}
#ifdef __libnix__
ADD2EXIT(Curl_amiga_cleanup, -50);
#endif
#endif /* !USE_AMISSL */
#endif /* HAVE_PROTO_BSDSOCKET_H */
#endif /* __AMIGA__ */
#endif /* __AMIGA__ && ! __ixemul__ */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,20 +20,17 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(__AMIGA__) && defined(HAVE_PROTO_BSDSOCKET_H) && \
(!defined(USE_AMISSL) || defined(__amigaos4__))
#if defined(__AMIGA__) && !defined(__ixemul__)
CURLcode Curl_amiga_init(void);
void Curl_amiga_cleanup(void);
bool Curl_amiga_init();
void Curl_amiga_cleanup();
#else
#define Curl_amiga_init() CURLE_OK
#define Curl_amiga_init() 1
#define Curl_amiga_cleanup() Curl_nop_stmt
#endif

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_TELNET
/*
@ -39,7 +37,6 @@
#define CURL_NEW_ENV_VAR 0
#define CURL_NEW_ENV_VALUE 1
#ifndef CURL_DISABLE_VERBOSE_STRINGS
/*
* The telnet options represented as strings
*/
@ -56,7 +53,6 @@ static const char * const telnetoptions[]=
"TERM SPEED", "LFLOW", "LINEMODE", "XDISPLOC",
"OLD-ENVIRON", "AUTHENTICATION", "ENCRYPT", "NEW-ENVIRON"
};
#endif
#define CURL_TELOPT_MAXIMUM CURL_TELOPT_NEW_ENVIRON
@ -80,7 +76,6 @@ static const char * const telnetoptions[]=
#define CURL_DONT 254 /* DON'T use this option! */
#define CURL_IAC 255 /* Interpret As Command */
#ifndef CURL_DISABLE_VERBOSE_STRINGS
/*
* Then those numbers represented as strings:
*/
@ -91,7 +86,6 @@ static const char * const telnetcmds[]=
"AYT", "EC", "EL", "GA", "SB",
"WILL", "WONT", "DO", "DONT", "IAC"
};
#endif
#define CURL_TELCMD_MINIMUM CURL_xEOF /* the first one */
#define CURL_TELCMD_MAXIMUM CURL_IAC /* surprise, 255 is the last one! ;-) */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,21 +18,13 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
/***********************************************************************
* Only for ares-enabled builds
* And only for functions that fulfill the asynch resolver backend API
* as defined in asyn.h, nothing else belongs in this file!
**********************************************************************/
#ifdef CURLRES_ARES
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
@ -47,21 +39,38 @@
#include <inet.h>
#endif
#ifdef HAVE_PROCESS_H
#include <process.h>
#endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
/***********************************************************************
* Only for ares-enabled builds
* And only for functions that fulfill the asynch resolver backend API
* as defined in asyn.h, nothing else belongs in this file!
**********************************************************************/
#ifdef CURLRES_ARES
#include "urldata.h"
#include "sendf.h"
#include "hostip.h"
#include "hash.h"
#include "share.h"
#include "strerror.h"
#include "url.h"
#include "multiif.h"
#include "inet_pton.h"
#include "connect.h"
#include "select.h"
#include "progress.h"
#include "timediff.h"
# if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \
defined(WIN32)
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
# define CARES_STATICLIB
# endif
# include <ares.h>
@ -73,53 +82,17 @@
#define HAVE_CARES_CALLBACK_TIMEOUTS 1
#endif
#if ARES_VERSION >= 0x010601
/* IPv6 supported since 1.6.1 */
#define HAVE_CARES_IPV6 1
#endif
#if ARES_VERSION >= 0x010704
#define HAVE_CARES_SERVERS_CSV 1
#define HAVE_CARES_LOCAL_DEV 1
#define HAVE_CARES_SET_LOCAL 1
#endif
#if ARES_VERSION >= 0x010b00
#define HAVE_CARES_PORTS_CSV 1
#endif
#if ARES_VERSION >= 0x011000
/* 1.16.0 or later has ares_getaddrinfo */
#define HAVE_CARES_GETADDRINFO 1
#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
struct thread_data {
int num_pending; /* number of outstanding c-ares requests */
struct Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares
parts */
struct ResolverResults {
int num_pending; /* number of ares_gethostbyname() requests */
Curl_addrinfo *temp_ai; /* intermediary result while fetching c-ares parts */
int last_status;
#ifndef HAVE_CARES_GETADDRINFO
struct curltime happy_eyeballs_dns_time; /* when this timer started, or 0 */
#endif
char hostname[1];
};
/* How long we are willing to wait for additional parallel responses after
obtaining a "definitive" one.
This is intended to equal the c-ares default timeout. cURL always uses that
default value. Unfortunately, c-ares doesn't expose its default timeout in
its API, but it is officially documented as 5 seconds.
See query_completed_cb() for an explanation of how this is used.
*/
#define HAPPY_EYEBALLS_DNS_TIMEOUT 5000
/*
* Curl_resolver_global_init() - the generic low-level asynchronous name
* resolve API. Called from curl_global_init() to initialize global resolver
@ -148,17 +121,6 @@ void Curl_resolver_global_cleanup(void)
#endif
}
static void sock_state_cb(void *data, ares_socket_t socket_fd,
int readable, int writable)
{
struct Curl_easy *easy = data;
if(!readable && !writable) {
DEBUGASSERT(easy);
Curl_multi_closed(easy, socket_fd);
}
}
/*
* Curl_resolver_init()
*
@ -166,14 +128,9 @@ static void sock_state_cb(void *data, ares_socket_t socket_fd,
* URL-state specific environment ('resolver' member of the UrlState
* structure). Fills the passed pointer by the initialized ares_channel.
*/
CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
CURLcode Curl_resolver_init(void **resolver)
{
int status;
struct ares_options options;
int optmask = ARES_OPT_SOCK_STATE_CB;
options.sock_state_cb = sock_state_cb;
options.sock_state_cb_data = easy;
status = ares_init_options((ares_channel*)resolver, &options, optmask);
int status = ares_init((ares_channel*)resolver);
if(status != ARES_SUCCESS) {
if(status == ARES_ENOMEM)
return CURLE_OUT_OF_MEMORY;
@ -204,15 +161,12 @@ void Curl_resolver_cleanup(void *resolver)
* environment ('resolver' member of the UrlState structure). Duplicates the
* 'from' ares channel and passes the resulting channel to the 'to' pointer.
*/
CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to, void *from)
int Curl_resolver_duphandle(void **to, void *from)
{
(void)from;
/*
* it would be better to call ares_dup instead, but right now
* it is not possible to set 'sock_state_cb_data' outside of
* ares_init_options
*/
return Curl_resolver_init(easy, to);
/* Clone the ares channel for the new handle */
if(ARES_SUCCESS != ares_dup((ares_channel*)to, (ares_channel)from))
return CURLE_FAILED_INIT;
return CURLE_OK;
}
static void destroy_async_data(struct Curl_async *async);
@ -220,23 +174,11 @@ static void destroy_async_data(struct Curl_async *async);
/*
* Cancel all possibly still on-going resolves for this connection.
*/
void Curl_resolver_cancel(struct Curl_easy *data)
void Curl_resolver_cancel(struct connectdata *conn)
{
DEBUGASSERT(data);
if(data->state.async.resolver)
ares_cancel((ares_channel)data->state.async.resolver);
destroy_async_data(&data->state.async);
}
/*
* We're equivalent to Curl_resolver_cancel() for the c-ares resolver. We
* never block.
*/
void Curl_resolver_kill(struct Curl_easy *data)
{
/* We don't need to check the resolver state because we can be called safely
at any time and we always do the same thing. */
Curl_resolver_cancel(data);
if(conn->data && conn->data->state.resolver)
ares_cancel((ares_channel)conn->data->state.resolver);
destroy_async_data(&conn->async);
}
/*
@ -244,8 +186,10 @@ void Curl_resolver_kill(struct Curl_easy *data)
*/
static void destroy_async_data(struct Curl_async *async)
{
if(async->tdata) {
struct thread_data *res = async->tdata;
free(async->hostname);
if(async->os_specific) {
struct ResolverResults *res = (struct ResolverResults *)async->os_specific;
if(res) {
if(res->temp_ai) {
Curl_freeaddrinfo(res->temp_ai);
@ -253,8 +197,10 @@ static void destroy_async_data(struct Curl_async *async)
}
free(res);
}
async->tdata = NULL;
async->os_specific = NULL;
}
async->hostname = NULL;
}
/*
@ -266,25 +212,27 @@ static void destroy_async_data(struct Curl_async *async)
* Returns: sockets-in-use-bitmap
*/
int Curl_resolver_getsock(struct Curl_easy *data,
curl_socket_t *socks)
int Curl_resolver_getsock(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
{
struct timeval maxtime;
struct timeval timebuf;
struct timeval *timeout;
long milli;
int max = ares_getsock((ares_channel)data->state.async.resolver,
(ares_socket_t *)socks, MAX_SOCKSPEREASYHANDLE);
int max = ares_getsock((ares_channel)conn->data->state.resolver,
(ares_socket_t *)socks, numsocks);
maxtime.tv_sec = CURL_TIMEOUT_RESOLVE;
maxtime.tv_usec = 0;
timeout = ares_timeout((ares_channel)data->state.async.resolver, &maxtime,
timeout = ares_timeout((ares_channel)conn->data->state.resolver, &maxtime,
&timebuf);
milli = (long)curlx_tvtoms(timeout);
milli = (timeout->tv_sec * 1000) + (timeout->tv_usec/1000);
if(milli == 0)
milli += 10;
Curl_expire(data, milli, EXPIRE_ASYNC_NAME);
Curl_expire_latest(conn->data, milli);
return max;
}
@ -296,11 +244,12 @@ int Curl_resolver_getsock(struct Curl_easy *data,
* 2) wait for the timeout period to check for action on ares' sockets.
* 3) tell ares to act on all the sockets marked as "with action"
*
* return number of sockets it worked on, or -1 on error
* return number of sockets it worked on
*/
static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
static int waitperform(struct connectdata *conn, int timeout_ms)
{
struct Curl_easy *data = conn->data;
int nfds;
int bitmask;
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
@ -308,7 +257,7 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
int i;
int num = 0;
bitmask = ares_getsock((ares_channel)data->state.async.resolver, socks,
bitmask = ares_getsock((ares_channel)data->state.resolver, socks,
ARES_GETSOCK_MAXNUM);
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
@ -322,32 +271,29 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
pfd[i].fd = socks[i];
pfd[i].events |= POLLWRNORM|POLLOUT;
}
if(pfd[i].events)
if(pfd[i].events != 0)
num++;
else
break;
}
if(num) {
if(num)
nfds = Curl_poll(pfd, num, timeout_ms);
if(nfds < 0)
return -1;
}
else
nfds = 0;
if(!nfds)
/* Call ares_process() unconditionally here, even if we simply timed out
/* Call ares_process() unconditonally here, even if we simply timed out
above, as otherwise the ares name resolve won't timeout! */
ares_process_fd((ares_channel)data->state.async.resolver, ARES_SOCKET_BAD,
ares_process_fd((ares_channel)data->state.resolver, ARES_SOCKET_BAD,
ARES_SOCKET_BAD);
else {
/* move through the descriptors and ask for processing on them */
for(i=0; i < num; i++)
ares_process_fd((ares_channel)data->state.async.resolver,
(pfd[i].revents & (POLLRDNORM|POLLIN))?
ares_process_fd((ares_channel)data->state.resolver,
pfd[i].revents & (POLLRDNORM|POLLIN)?
pfd[i].fd:ARES_SOCKET_BAD,
(pfd[i].revents & (POLLWRNORM|POLLOUT))?
pfd[i].revents & (POLLWRNORM|POLLOUT)?
pfd[i].fd:ARES_SOCKET_BAD);
}
return nfds;
@ -360,55 +306,33 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
*
* Returns normal CURLcode errors.
*/
CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dns)
{
struct thread_data *res = data->state.async.tdata;
struct Curl_easy *data = conn->data;
struct ResolverResults *res = (struct ResolverResults *)
conn->async.os_specific;
CURLcode result = CURLE_OK;
DEBUGASSERT(dns);
*dns = NULL;
if(waitperform(data, 0) < 0)
return CURLE_UNRECOVERABLE_POLL;
#ifndef HAVE_CARES_GETADDRINFO
/* Now that we've checked for any last minute results above, see if there are
any responses still pending when the EXPIRE_HAPPY_EYEBALLS_DNS timer
expires. */
if(res
&& res->num_pending
/* This is only set to non-zero if the timer was started. */
&& (res->happy_eyeballs_dns_time.tv_sec
|| res->happy_eyeballs_dns_time.tv_usec)
&& (Curl_timediff(Curl_now(), res->happy_eyeballs_dns_time)
>= HAPPY_EYEBALLS_DNS_TIMEOUT)) {
/* Remember that the EXPIRE_HAPPY_EYEBALLS_DNS timer is no longer
running. */
memset(
&res->happy_eyeballs_dns_time, 0, sizeof(res->happy_eyeballs_dns_time));
/* Cancel the raw c-ares request, which will fire query_completed_cb() with
ARES_ECANCELLED synchronously for all pending responses. This will
leave us with res->num_pending == 0, which is perfect for the next
block. */
ares_cancel((ares_channel)data->state.async.resolver);
DEBUGASSERT(res->num_pending == 0);
}
#endif
waitperform(conn, 0);
if(res && !res->num_pending) {
(void)Curl_addrinfo_callback(data, res->last_status, res->temp_ai);
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
/* temp_ai ownership is moved to the connection, so we need not free-up
them */
res->temp_ai = NULL;
if(!data->state.async.dns)
result = Curl_resolver_error(data);
if(!conn->async.dns) {
failf(data, "Could not resolve: %s (%s)",
conn->async.hostname, ares_strerror(conn->async.status));
result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
else
*dns = data->state.async.dns;
*dns = conn->async.dns;
destroy_async_data(&data->state.async);
destroy_async_data(&conn->async);
}
return result;
@ -417,28 +341,30 @@ CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
/*
* Curl_resolver_wait_resolv()
*
* Waits for a resolve to finish. This function should be avoided since using
* waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
* 'entry' MUST be non-NULL.
* If 'entry' is non-NULL, make it point to the resolved dns entry
*
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and
* CURLE_OPERATION_TIMEDOUT if a time-out occurred.
*/
CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry)
{
CURLcode result = CURLE_OK;
timediff_t timeout;
struct curltime now = Curl_now();
struct Curl_easy *data = conn->data;
long timeout;
struct timeval now = Curl_tvnow();
struct Curl_dns_entry *temp_entry;
DEBUGASSERT(entry);
if(entry)
*entry = NULL; /* clear on entry */
timeout = Curl_timeleft(data, &now, TRUE);
if(timeout < 0) {
/* already expired! */
connclose(data->conn, "Timed out before name resolve started");
connclose(conn, "Timed out before name resolve started");
return CURLE_OPERATION_TIMEDOUT;
}
if(!timeout)
@ -447,46 +373,37 @@ CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
/* Wait for the name resolve query to complete. */
while(!result) {
struct timeval *tvp, tv, store;
long timediff;
int itimeout;
timediff_t timeout_ms;
int timeout_ms;
#if TIMEDIFF_T_MAX > INT_MAX
itimeout = (timeout > INT_MAX) ? INT_MAX : (int)timeout;
#else
itimeout = (int)timeout;
#endif
itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout;
store.tv_sec = itimeout/1000;
store.tv_usec = (itimeout%1000)*1000;
tvp = ares_timeout((ares_channel)data->state.async.resolver, &store, &tv);
tvp = ares_timeout((ares_channel)data->state.resolver, &store, &tv);
/* use the timeout period ares returned to us above if less than one
second is left, otherwise just use 1000ms to make sure the progress
callback gets called frequent enough */
if(!tvp->tv_sec)
timeout_ms = (timediff_t)(tvp->tv_usec/1000);
timeout_ms = (int)(tvp->tv_usec/1000);
else
timeout_ms = 1000;
if(waitperform(data, timeout_ms) < 0)
return CURLE_UNRECOVERABLE_POLL;
result = Curl_resolver_is_resolved(data, entry);
waitperform(conn, timeout_ms);
result = Curl_resolver_is_resolved(conn, &temp_entry);
if(result || data->state.async.done)
if(result || conn->async.done)
break;
if(Curl_pgrsUpdate(data))
if(Curl_pgrsUpdate(conn))
result = CURLE_ABORTED_BY_CALLBACK;
else {
struct curltime now2 = Curl_now();
timediff_t timediff = Curl_timediff(now2, now); /* spent time */
if(timediff <= 0)
timeout -= 1; /* always deduct at least 1 */
else if(timediff > timeout)
timeout = -1;
else
timeout -= timediff;
struct timeval now2 = Curl_tvnow();
timediff = Curl_tvdiff(now2, now); /* spent time */
timeout -= timediff?timediff:1; /* always deduct at least 1 */
now = now2; /* for next loop */
}
if(timeout < 0)
@ -494,53 +411,39 @@ CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
}
if(result)
/* failure, so we cancel the ares operation */
ares_cancel((ares_channel)data->state.async.resolver);
ares_cancel((ares_channel)data->state.resolver);
/* Operation complete, if the lookup was successful we now have the entry
in the cache. */
if(entry)
*entry = data->state.async.dns;
*entry = conn->async.dns;
if(result)
/* close the connection, since we can't return failure here without
cleaning up this connection properly. */
connclose(data->conn, "c-ares resolve failed");
cleaning up this connection properly.
TODO: remove this action from here, it is not a name resolver decision.
*/
connclose(conn, "c-ares resolve failed");
return result;
}
#ifndef HAVE_CARES_GETADDRINFO
/* Connects results to the list */
static void compound_results(struct thread_data *res,
struct Curl_addrinfo *ai)
static void compound_results(struct ResolverResults *res,
Curl_addrinfo *ai)
{
Curl_addrinfo *ai_tail;
if(!ai)
return;
ai_tail = ai;
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
if(res->temp_ai && res->temp_ai->ai_family == PF_INET6) {
/* We have results already, put the new IPv6 entries at the head of the
list. */
struct Curl_addrinfo *temp_ai_tail = res->temp_ai;
while(temp_ai_tail->ai_next)
temp_ai_tail = temp_ai_tail->ai_next;
temp_ai_tail->ai_next = ai;
}
else
#endif /* CURLRES_IPV6 */
{
/* Add the new results to the list of old results. */
struct Curl_addrinfo *ai_tail = ai;
while(ai_tail->ai_next)
ai_tail = ai_tail->ai_next;
/* Add the new results to the list of old results. */
ai_tail->ai_next = res->temp_ai;
res->temp_ai = ai;
}
}
/*
* ares_query_completed_cb() is the callback that ares will call when
@ -554,8 +457,8 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
#endif
struct hostent *hostent)
{
struct Curl_easy *data = (struct Curl_easy *)arg;
struct thread_data *res;
struct connectdata *conn = (struct connectdata *)arg;
struct ResolverResults *res;
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
(void)timeouts; /* ignored */
@ -566,12 +469,11 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
be valid so only defer it when we know the 'status' says its fine! */
return;
res = data->state.async.tdata;
if(res) {
res = (struct ResolverResults *)conn->async.os_specific;
res->num_pending--;
if(CURL_ASYNC_SUCCESS == status) {
struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->state.async.port);
Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);
if(ai) {
compound_results(res, ai);
}
@ -579,237 +481,108 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
/* A successful result overwrites any previous error */
if(res->last_status != ARES_SUCCESS)
res->last_status = status;
/* If there are responses still pending, we presume they must be the
complementary IPv4 or IPv6 lookups that we started in parallel in
Curl_resolver_getaddrinfo() (for Happy Eyeballs). If we've got a
"definitive" response from one of a set of parallel queries, we need to
think about how long we're willing to wait for more responses. */
if(res->num_pending
/* Only these c-ares status values count as "definitive" for these
purposes. For example, ARES_ENODATA is what we expect when there is
no IPv6 entry for a domain name, and that's not a reason to get more
aggressive in our timeouts for the other response. Other errors are
either a result of bad input (which should affect all parallel
requests), local or network conditions, non-definitive server
responses, or us cancelling the request. */
&& (status == ARES_SUCCESS || status == ARES_ENOTFOUND)) {
/* Right now, there can only be up to two parallel queries, so don't
bother handling any other cases. */
DEBUGASSERT(res->num_pending == 1);
/* It's possible that one of these parallel queries could succeed
quickly, but the other could always fail or timeout (when we're
talking to a pool of DNS servers that can only successfully resolve
IPv4 address, for example).
It's also possible that the other request could always just take
longer because it needs more time or only the second DNS server can
fulfill it successfully. But, to align with the philosophy of Happy
Eyeballs, we don't want to wait _too_ long or users will think
requests are slow when IPv6 lookups don't actually work (but IPv4 ones
do).
So, now that we have a usable answer (some IPv4 addresses, some IPv6
addresses, or "no such domain"), we start a timeout for the remaining
pending responses. Even though it is typical that this resolved
request came back quickly, that needn't be the case. It might be that
this completing request didn't get a result from the first DNS server
or even the first round of the whole DNS server pool. So it could
already be quite some time after we issued the DNS queries in the
first place. Without modifying c-ares, we can't know exactly where in
its retry cycle we are. We could guess based on how much time has
gone by, but it doesn't really matter. Happy Eyeballs tells us that,
given usable information in hand, we simply don't want to wait "too
much longer" after we get a result.
We simply wait an additional amount of time equal to the default
c-ares query timeout. That is enough time for a typical parallel
response to arrive without being "too long". Even on a network
where one of the two types of queries is failing or timing out
constantly, this will usually mean we wait a total of the default
c-ares timeout (5 seconds) plus the round trip time for the successful
request, which seems bearable. The downside is that c-ares might race
with us to issue one more retry just before we give up, but it seems
better to "waste" that request instead of trying to guess the perfect
timeout to prevent it. After all, we don't even know where in the
c-ares retry cycle each request is.
*/
res->happy_eyeballs_dns_time = Curl_now();
Curl_expire(data, HAPPY_EYEBALLS_DNS_TIMEOUT,
EXPIRE_HAPPY_EYEBALLS_DNS);
}
}
}
#else
/* c-ares 1.16.0 or later */
/*
* ares2addr() converts an address list provided by c-ares to an internal
* libcurl compatible list
*/
static struct Curl_addrinfo *ares2addr(struct ares_addrinfo_node *node)
{
/* traverse the ares_addrinfo_node list */
struct ares_addrinfo_node *ai;
struct Curl_addrinfo *cafirst = NULL;
struct Curl_addrinfo *calast = NULL;
int error = 0;
for(ai = node; ai != NULL; ai = ai->ai_next) {
size_t ss_size;
struct Curl_addrinfo *ca;
/* ignore elements with unsupported address family, */
/* settle family-specific sockaddr structure size. */
if(ai->ai_family == AF_INET)
ss_size = sizeof(struct sockaddr_in);
#ifdef ENABLE_IPV6
else if(ai->ai_family == AF_INET6)
ss_size = sizeof(struct sockaddr_in6);
#endif
else
continue;
/* ignore elements without required address info */
if(!ai->ai_addr || !(ai->ai_addrlen > 0))
continue;
/* ignore elements with bogus address size */
if((size_t)ai->ai_addrlen < ss_size)
continue;
ca = malloc(sizeof(struct Curl_addrinfo) + ss_size);
if(!ca) {
error = EAI_MEMORY;
break;
}
/* copy each structure member individually, member ordering, */
/* size, or padding might be different for each platform. */
ca->ai_flags = ai->ai_flags;
ca->ai_family = ai->ai_family;
ca->ai_socktype = ai->ai_socktype;
ca->ai_protocol = ai->ai_protocol;
ca->ai_addrlen = (curl_socklen_t)ss_size;
ca->ai_addr = NULL;
ca->ai_canonname = NULL;
ca->ai_next = NULL;
ca->ai_addr = (void *)((char *)ca + sizeof(struct Curl_addrinfo));
memcpy(ca->ai_addr, ai->ai_addr, ss_size);
/* if the return list is empty, this becomes the first element */
if(!cafirst)
cafirst = ca;
/* add this element last in the return list */
if(calast)
calast->ai_next = ca;
calast = ca;
}
/* if we failed, destroy the Curl_addrinfo list */
if(error) {
Curl_freeaddrinfo(cafirst);
cafirst = NULL;
}
return cafirst;
}
static void addrinfo_cb(void *arg, int status, int timeouts,
struct ares_addrinfo *result)
{
struct Curl_easy *data = (struct Curl_easy *)arg;
struct thread_data *res = data->state.async.tdata;
(void)timeouts;
if(ARES_SUCCESS == status) {
res->temp_ai = ares2addr(result->nodes);
res->last_status = CURL_ASYNC_SUCCESS;
ares_freeaddrinfo(result);
}
res->num_pending--;
}
#endif
/*
* Curl_resolver_getaddrinfo() - when using ares
*
* Returns name information about the given hostname and port number. If
* successful, the 'hostent' is returned and the fourth argument will point to
* successful, the 'hostent' is returned and the forth argument will point to
* memory we need to free after use. That memory *MUST* be freed with
* Curl_freeaddrinfo(), nothing else.
*/
struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
const char *hostname,
int port,
int *waitp)
{
struct thread_data *res = NULL;
size_t namelen = strlen(hostname);
char *bufp;
struct Curl_easy *data = conn->data;
struct in_addr in;
int family = PF_INET;
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
struct in6_addr in6;
#endif /* CURLRES_IPV6 */
*waitp = 0; /* default to synchronous response */
res = calloc(sizeof(struct thread_data) + namelen, 1);
if(res) {
strcpy(res->hostname, hostname);
data->state.async.hostname = res->hostname;
data->state.async.port = port;
data->state.async.done = FALSE; /* not done */
data->state.async.status = 0; /* clear */
data->state.async.dns = NULL; /* clear */
data->state.async.tdata = res;
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
}
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
/* Otherwise, check if this is an IPv6 address string */
if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)
/* This must be an IPv6 address literal. */
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
switch(conn->ip_version) {
default:
#if ARES_VERSION >= 0x010601
family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older
c-ares versions this just falls through and defaults
to PF_INET */
break;
#endif
case CURL_IPRESOLVE_V4:
family = PF_INET;
break;
case CURL_IPRESOLVE_V6:
family = PF_INET6;
break;
}
#endif /* CURLRES_IPV6 */
bufp = strdup(hostname);
if(bufp) {
struct ResolverResults *res = NULL;
free(conn->async.hostname);
conn->async.hostname = bufp;
conn->async.port = port;
conn->async.done = FALSE; /* not done */
conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */
res = calloc(sizeof(struct ResolverResults), 1);
if(!res) {
free(conn->async.hostname);
conn->async.hostname = NULL;
return NULL;
}
conn->async.os_specific = res;
/* initial status - failed */
res->last_status = ARES_ENOTFOUND;
#ifdef HAVE_CARES_GETADDRINFO
{
struct ares_addrinfo_hints hints;
char service[12];
int pf = PF_INET;
memset(&hints, 0, sizeof(hints));
#ifdef CURLRES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data))
/* The stack seems to be IPv6-enabled */
pf = PF_UNSPEC;
#endif /* CURLRES_IPV6 */
hints.ai_family = pf;
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP)?
SOCK_STREAM : SOCK_DGRAM;
/* Since the service is a numerical one, set the hint flags
* accordingly to save a call to getservbyname in inside C-Ares
*/
hints.ai_flags = ARES_AI_NUMERICSERV;
msnprintf(service, sizeof(service), "%d", port);
res->num_pending = 1;
ares_getaddrinfo((ares_channel)data->state.async.resolver, hostname,
service, &hints, addrinfo_cb, data);
}
#else
#ifdef HAVE_CARES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
/* The stack seems to be IPv6-enabled */
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
if(family == PF_UNSPEC) {
if(Curl_ipv6works()) {
res->num_pending = 2;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET, query_completed_cb, data);
ares_gethostbyname((ares_channel)data->state.async.resolver, hostname,
PF_INET6, query_completed_cb, data);
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET, query_completed_cb, conn);
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET6, query_completed_cb, conn);
}
else {
res->num_pending = 1;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.resolver, hostname,
PF_INET, query_completed_cb, conn);
}
}
else
#endif
#endif /* CURLRES_IPV6 */
{
res->num_pending = 1;
/* areschannel is already setup in the Curl_open() function */
ares_gethostbyname((ares_channel)data->state.async.resolver,
hostname, PF_INET,
query_completed_cb, data);
ares_gethostbyname((ares_channel)data->state.resolver, hostname, family,
query_completed_cb, conn);
}
#endif
*waitp = 1; /* expect asynchronous response */
}
return NULL; /* no struct yet */
@ -830,13 +603,8 @@ CURLcode Curl_set_dns_servers(struct Curl_easy *data,
if(!(servers && servers[0]))
return CURLE_OK;
#ifdef HAVE_CARES_SERVERS_CSV
#ifdef HAVE_CARES_PORTS_CSV
ares_result = ares_set_servers_ports_csv(data->state.async.resolver,
servers);
#else
ares_result = ares_set_servers_csv(data->state.async.resolver, servers);
#endif
#if (ARES_VERSION >= 0x010704)
ares_result = ares_set_servers_csv(data->state.resolver, servers);
switch(ares_result) {
case ARES_SUCCESS:
result = CURLE_OK;
@ -861,11 +629,11 @@ CURLcode Curl_set_dns_servers(struct Curl_easy *data,
CURLcode Curl_set_dns_interface(struct Curl_easy *data,
const char *interf)
{
#ifdef HAVE_CARES_LOCAL_DEV
#if (ARES_VERSION >= 0x010704)
if(!interf)
interf = "";
ares_set_local_dev((ares_channel)data->state.async.resolver, interf);
ares_set_local_dev((ares_channel)data->state.resolver, interf);
return CURLE_OK;
#else /* c-ares version too old! */
@ -878,7 +646,7 @@ CURLcode Curl_set_dns_interface(struct Curl_easy *data,
CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data,
const char *local_ip4)
{
#ifdef HAVE_CARES_SET_LOCAL
#if (ARES_VERSION >= 0x010704)
struct in_addr a4;
if((!local_ip4) || (local_ip4[0] == 0)) {
@ -890,8 +658,7 @@ CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data,
}
}
ares_set_local_ip4((ares_channel)data->state.async.resolver,
ntohl(a4.s_addr));
ares_set_local_ip4((ares_channel)data->state.resolver, ntohl(a4.s_addr));
return CURLE_OK;
#else /* c-ares version too old! */
@ -904,7 +671,7 @@ CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data,
CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
const char *local_ip6)
{
#if defined(HAVE_CARES_SET_LOCAL) && defined(ENABLE_IPV6)
#if (ARES_VERSION >= 0x010704) && defined(ENABLE_IPV6)
unsigned char a6[INET6_ADDRSTRLEN];
if((!local_ip6) || (local_ip6[0] == 0)) {
@ -917,7 +684,7 @@ CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
}
}
ares_set_local_ip6((ares_channel)data->state.async.resolver, a6);
ares_set_local_ip6((ares_channel)data->state.resolver, a6);
return CURLE_OK;
#else /* c-ares version too old! */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,17 +18,9 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "socketpair.h"
/***********************************************************************
* Only for threaded name resolves builds
**********************************************************************/
#ifdef CURLRES_THREADED
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
@ -44,9 +36,20 @@
#include <inet.h>
#endif
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
#if defined(USE_THREADS_POSIX)
# ifdef HAVE_PTHREAD_H
# include <pthread.h>
# endif
#elif defined(USE_THREADS_WIN32)
# ifdef HAVE_PROCESS_H
# include <process.h>
# endif
#endif
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
#undef in_addr_t
#define in_addr_t unsigned long
#endif
#ifdef HAVE_GETADDRINFO
# define RESOLVER_ENOMEM EAI_MEMORY
@ -59,8 +62,10 @@
#include "hostip.h"
#include "hash.h"
#include "share.h"
#include "strerror.h"
#include "url.h"
#include "multiif.h"
#include "inet_pton.h"
#include "inet_ntop.h"
#include "curl_threads.h"
#include "connect.h"
@ -69,9 +74,10 @@
#include "curl_memory.h"
#include "memdebug.h"
struct resdata {
struct curltime start;
};
/***********************************************************************
* Only for threaded name resolves builds
**********************************************************************/
#ifdef CURLRES_THREADED
/*
* Curl_resolver_global_init()
@ -96,14 +102,11 @@ void Curl_resolver_global_cleanup(void)
* Curl_resolver_init()
* Called from curl_easy_init() -> Curl_open() to initialize resolver
* URL-state specific environment ('resolver' member of the UrlState
* structure).
* structure). Does nothing here.
*/
CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
CURLcode Curl_resolver_init(void **resolver)
{
(void)easy;
*resolver = calloc(1, sizeof(struct resdata));
if(!*resolver)
return CURLE_OUT_OF_MEMORY;
(void)resolver;
return CURLE_OK;
}
@ -111,22 +114,24 @@ CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
* Curl_resolver_cleanup()
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
* URL-state specific environment ('resolver' member of the UrlState
* structure).
* structure). Does nothing here.
*/
void Curl_resolver_cleanup(void *resolver)
{
free(resolver);
(void)resolver;
}
/*
* Curl_resolver_duphandle()
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific
* environment ('resolver' member of the UrlState structure).
* environment ('resolver' member of the UrlState structure). Does nothing
* here.
*/
CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to, void *from)
int Curl_resolver_duphandle(void **to, void *from)
{
(void)to;
(void)from;
return Curl_resolver_init(easy, to);
return CURLE_OK;
}
static void destroy_async_data(struct Curl_async *);
@ -134,13 +139,13 @@ static void destroy_async_data(struct Curl_async *);
/*
* Cancel all possibly still on-going resolves for this connection.
*/
void Curl_resolver_cancel(struct Curl_easy *data)
void Curl_resolver_cancel(struct connectdata *conn)
{
destroy_async_data(&data->state.async);
destroy_async_data(&conn->async);
}
/* This function is used to init a threaded resolve */
static bool init_resolve_thread(struct Curl_easy *data,
static bool init_resolve_thread(struct connectdata *conn,
const char *hostname, int port,
const struct addrinfo *hints);
@ -149,15 +154,12 @@ static bool init_resolve_thread(struct Curl_easy *data,
struct thread_sync_data {
curl_mutex_t * mtx;
int done;
int port;
char *hostname; /* hostname to resolve, Curl_async.hostname
duplicate */
#ifndef CURL_DISABLE_SOCKETPAIR
struct Curl_easy *data;
curl_socket_t sock_pair[2]; /* socket pair */
#endif
int port;
int sock_error;
struct Curl_addrinfo *res;
Curl_addrinfo *res;
#ifdef HAVE_GETADDRINFO
struct addrinfo hints;
#endif
@ -167,15 +169,17 @@ struct thread_sync_data {
struct thread_data {
curl_thread_t thread_hnd;
unsigned int poll_interval;
timediff_t interval_end;
time_t interval_end;
struct thread_sync_data tsd;
};
static struct thread_sync_data *conn_thread_sync_data(struct Curl_easy *data)
static struct thread_sync_data *conn_thread_sync_data(struct connectdata *conn)
{
return &(data->state.async.tdata->tsd);
return &(((struct thread_data *)conn->async.os_specific)->tsd);
}
#define CONN_THREAD_SYNC_DATA(conn) &(((conn)->async.os_specific)->tsd);
/* Destroy resolver thread synchronization data */
static
void destroy_thread_sync_data(struct thread_sync_data * tsd)
@ -190,15 +194,6 @@ void destroy_thread_sync_data(struct thread_sync_data *tsd)
if(tsd->res)
Curl_freeaddrinfo(tsd->res);
#ifndef CURL_DISABLE_SOCKETPAIR
/*
* close one end of the socket pair (may be done in resolver thread);
* the other end (for reading) is always closed in the parent thread.
*/
if(tsd->sock_pair[1] != CURL_SOCKET_BAD) {
sclose(tsd->sock_pair[1]);
}
#endif
memset(tsd, 0, sizeof(*tsd));
}
@ -215,10 +210,6 @@ int init_thread_sync_data(struct thread_data *td,
tsd->td = td;
tsd->port = port;
/* Treat the request as done until the thread actually starts so any early
* cleanup gets done properly.
*/
tsd->done = 1;
#ifdef HAVE_GETADDRINFO
DEBUGASSERT(hints);
tsd->hints = *hints;
@ -227,19 +218,11 @@ int init_thread_sync_data(struct thread_data *td,
#endif
tsd->mtx = malloc(sizeof(curl_mutex_t));
if(!tsd->mtx)
if(tsd->mtx == NULL)
goto err_exit;
Curl_mutex_init(tsd->mtx);
#ifndef CURL_DISABLE_SOCKETPAIR
/* create socket pair, avoid AF_LOCAL since it doesn't build on Solaris */
if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, &tsd->sock_pair[0]) < 0) {
tsd->sock_pair[0] = CURL_SOCKET_BAD;
tsd->sock_pair[1] = CURL_SOCKET_BAD;
goto err_exit;
}
#endif
tsd->sock_error = CURL_ASYNC_SUCCESS;
/* Copying hostname string because original can be destroyed by parent
@ -252,28 +235,23 @@ int init_thread_sync_data(struct thread_data *td,
return 1;
err_exit:
#ifndef CURL_DISABLE_SOCKETPAIR
if(tsd->sock_pair[0] != CURL_SOCKET_BAD) {
sclose(tsd->sock_pair[0]);
tsd->sock_pair[0] = CURL_SOCKET_BAD;
}
#endif
/* Memory allocation failed */
destroy_thread_sync_data(tsd);
return 0;
}
static CURLcode getaddrinfo_complete(struct Curl_easy *data)
static int getaddrinfo_complete(struct connectdata *conn)
{
struct thread_sync_data *tsd = conn_thread_sync_data(data);
CURLcode result;
struct thread_sync_data *tsd = conn_thread_sync_data(conn);
int rc;
result = Curl_addrinfo_callback(data, tsd->sock_error, tsd->res);
rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res);
/* The tsd->res structure has been copied to async.dns and perhaps the DNS
cache. Set our copy to NULL so destroy_thread_sync_data doesn't free it.
*/
tsd->res = NULL;
return result;
return rc;
}
@ -291,15 +269,12 @@ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
struct thread_data *td = tsd->td;
char service[12];
int rc;
#ifndef CURL_DISABLE_SOCKETPAIR
char buf[1];
#endif
msnprintf(service, sizeof(service), "%d", tsd->port);
snprintf(service, sizeof(service), "%d", tsd->port);
rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);
if(rc) {
if(rc != 0) {
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
if(tsd->sock_error == 0)
tsd->sock_error = RESOLVER_ENOMEM;
@ -316,16 +291,6 @@ static unsigned int CURL_STDCALL getaddrinfo_thread(void *arg)
free(td);
}
else {
#ifndef CURL_DISABLE_SOCKETPAIR
if(tsd->sock_pair[1] != CURL_SOCKET_BAD) {
/* DNS has been resolved, signal client task */
buf[0] = 1;
if(swrite(tsd->sock_pair[1], buf, sizeof(buf)) < 0) {
/* update sock_erro to errno */
tsd->sock_error = SOCKERRNO;
}
}
#endif
tsd->done = 1;
Curl_mutex_release(tsd->mtx);
}
@ -373,13 +338,9 @@ static unsigned int CURL_STDCALL gethostbyname_thread(void *arg)
*/
static void destroy_async_data(struct Curl_async *async)
{
if(async->tdata) {
struct thread_data *td = async->tdata;
if(async->os_specific) {
struct thread_data *td = (struct thread_data*) async->os_specific;
int done;
#ifndef CURL_DISABLE_SOCKETPAIR
curl_socket_t sock_rd = td->tsd.sock_pair[0];
struct Curl_easy *data = td->tsd.data;
#endif
/*
* if the thread is still blocking in the resolve syscall, detach it and
@ -399,18 +360,10 @@ static void destroy_async_data(struct Curl_async *async)
destroy_thread_sync_data(&td->tsd);
free(async->tdata);
free(async->os_specific);
}
#ifndef CURL_DISABLE_SOCKETPAIR
/*
* ensure CURLMOPT_SOCKETFUNCTION fires CURL_POLL_REMOVE
* before the FD is invalidated to avoid EBADF on EPOLL_CTL_DEL
*/
Curl_multi_closed(data, sock_rd);
sclose(sock_rd);
#endif
}
async->tdata = NULL;
async->os_specific = NULL;
free(async->hostname);
async->hostname = NULL;
@ -422,37 +375,30 @@ static void destroy_async_data(struct Curl_async *async)
*
* Returns FALSE in case of failure, otherwise TRUE.
*/
static bool init_resolve_thread(struct Curl_easy *data,
static bool init_resolve_thread(struct connectdata *conn,
const char *hostname, int port,
const struct addrinfo *hints)
{
struct thread_data *td = calloc(1, sizeof(struct thread_data));
int err = ENOMEM;
struct Curl_async *asp = &data->state.async;
int err = RESOLVER_ENOMEM;
data->state.async.tdata = td;
conn->async.os_specific = (void *)td;
if(!td)
goto errno_exit;
asp->port = port;
asp->done = FALSE;
asp->status = 0;
asp->dns = NULL;
td->thread_hnd = curl_thread_t_null;
if(!init_thread_sync_data(td, hostname, port, hints)) {
asp->tdata = NULL;
free(td);
goto errno_exit;
}
free(asp->hostname);
asp->hostname = strdup(hostname);
if(!asp->hostname)
goto err_exit;
/* The thread will set this to 1 when complete. */
td->tsd.done = 0;
conn->async.port = port;
conn->async.done = FALSE;
conn->async.status = 0;
conn->async.dns = NULL;
td->thread_hnd = curl_thread_t_null;
if(!init_thread_sync_data(td, hostname, port, hints))
goto err_exit;
free(conn->async.hostname);
conn->async.hostname = strdup(hostname);
if(!conn->async.hostname)
goto err_exit;
#ifdef HAVE_GETADDRINFO
td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd);
@ -461,98 +407,86 @@ static bool init_resolve_thread(struct Curl_easy *data,
#endif
if(!td->thread_hnd) {
/* The thread never started, so mark it as done here for proper cleanup. */
td->tsd.done = 1;
#ifndef _WIN32_WCE
err = errno;
#endif
goto err_exit;
}
return TRUE;
err_exit:
destroy_async_data(asp);
destroy_async_data(&conn->async);
SET_ERRNO(err);
errno_exit:
errno = err;
return FALSE;
}
/*
* 'entry' may be NULL and then no data is returned
* resolver_error() calls failf() with the appropriate message after a resolve
* error
*/
static CURLcode thread_wait_resolv(struct Curl_easy *data,
struct Curl_dns_entry **entry,
bool report)
static CURLcode resolver_error(struct connectdata *conn)
{
struct thread_data *td;
CURLcode result = CURLE_OK;
const char *host_or_proxy;
CURLcode result;
DEBUGASSERT(data);
td = data->state.async.tdata;
DEBUGASSERT(td);
DEBUGASSERT(td->thread_hnd != curl_thread_t_null);
/* wait for the thread to resolve the name */
if(Curl_thread_join(&td->thread_hnd)) {
if(entry)
result = getaddrinfo_complete(data);
if(conn->bits.httpproxy) {
host_or_proxy = "proxy";
result = CURLE_COULDNT_RESOLVE_PROXY;
}
else {
host_or_proxy = "host";
result = CURLE_COULDNT_RESOLVE_HOST;
}
else
DEBUGASSERT(0);
data->state.async.done = TRUE;
if(entry)
*entry = data->state.async.dns;
if(!data->state.async.dns && report)
/* a name was not resolved, report error */
result = Curl_resolver_error(data);
destroy_async_data(&data->state.async);
if(!data->state.async.dns && report)
connclose(data->conn, "asynch resolve failed");
failf(conn->data, "Could not resolve %s: %s", host_or_proxy,
conn->async.hostname);
return result;
}
/*
* Until we gain a way to signal the resolver threads to stop early, we must
* simply wait for them and ignore their results.
*/
void Curl_resolver_kill(struct Curl_easy *data)
{
struct thread_data *td = data->state.async.tdata;
/* If we're still resolving, we must wait for the threads to fully clean up,
unfortunately. Otherwise, we can simply cancel to clean up any resolver
data. */
if(td && td->thread_hnd != curl_thread_t_null
&& (data->set.quick_exit != 1L))
(void)thread_wait_resolv(data, NULL, FALSE);
else
Curl_resolver_cancel(data);
}
/*
* Curl_resolver_wait_resolv()
*
* Waits for a resolve to finish. This function should be avoided since using
* waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
* If 'entry' is non-NULL, make it point to the resolved dns entry
*
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
*
* This is the version for resolves-in-a-thread.
*/
CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry)
{
return thread_wait_resolv(data, entry, TRUE);
struct thread_data *td = (struct thread_data*) conn->async.os_specific;
CURLcode result = CURLE_OK;
DEBUGASSERT(conn && td);
/* wait for the thread to resolve the name */
if(Curl_thread_join(&td->thread_hnd))
result = getaddrinfo_complete(conn);
else
DEBUGASSERT(0);
conn->async.done = TRUE;
if(entry)
*entry = conn->async.dns;
if(!conn->async.dns)
/* a name was not resolved, report error */
result = resolver_error(conn);
destroy_async_data(&conn->async);
if(!conn->async.dns)
connclose(conn, "asynch resolve failed");
return result;
}
/*
@ -560,13 +494,13 @@ CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
* name resolve request has completed. It should also make sure to time-out if
* the operation seems to take too long.
*/
CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **entry)
{
struct thread_data *td = data->state.async.tdata;
struct Curl_easy *data = conn->data;
struct thread_data *td = (struct thread_data*) conn->async.os_specific;
int done = 0;
DEBUGASSERT(entry);
*entry = NULL;
if(!td) {
@ -579,21 +513,19 @@ CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
Curl_mutex_release(td->tsd.mtx);
if(done) {
getaddrinfo_complete(data);
getaddrinfo_complete(conn);
if(!data->state.async.dns) {
CURLcode result = Curl_resolver_error(data);
destroy_async_data(&data->state.async);
if(!conn->async.dns) {
CURLcode result = resolver_error(conn);
destroy_async_data(&conn->async);
return result;
}
destroy_async_data(&data->state.async);
*entry = data->state.async.dns;
destroy_async_data(&conn->async);
*entry = conn->async.dns;
}
else {
/* poll for name lookup done with exponential backoff up to 250ms */
/* should be fine even if this converts to 32 bit */
timediff_t elapsed = Curl_timediff(Curl_now(),
data->progress.t_startsingle);
time_t elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
if(elapsed < 0)
elapsed = 0;
@ -608,75 +540,47 @@ CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
td->poll_interval = 250;
td->interval_end = elapsed + td->poll_interval;
Curl_expire(data, td->poll_interval, EXPIRE_ASYNC_NAME);
Curl_expire(conn->data, td->poll_interval);
}
return CURLE_OK;
}
int Curl_resolver_getsock(struct Curl_easy *data, curl_socket_t *socks)
int Curl_resolver_getsock(struct connectdata *conn,
curl_socket_t *socks,
int numsocks)
{
int ret_val = 0;
timediff_t milli;
timediff_t ms;
struct resdata *reslv = (struct resdata *)data->state.async.resolver;
#ifndef CURL_DISABLE_SOCKETPAIR
struct thread_data *td = data->state.async.tdata;
#else
(void)conn;
(void)socks;
#endif
#ifndef CURL_DISABLE_SOCKETPAIR
if(td) {
/* return read fd to client for polling the DNS resolution status */
socks[0] = td->tsd.sock_pair[0];
td->tsd.data = data;
ret_val = GETSOCK_READSOCK(0);
}
else {
#endif
ms = Curl_timediff(Curl_now(), reslv->start);
if(ms < 3)
milli = 0;
else if(ms <= 50)
milli = ms/3;
else if(ms <= 250)
milli = 50;
else
milli = 200;
Curl_expire(data, milli, EXPIRE_ASYNC_NAME);
#ifndef CURL_DISABLE_SOCKETPAIR
}
#endif
return ret_val;
(void)numsocks;
return 0;
}
#ifndef HAVE_GETADDRINFO
/*
* Curl_getaddrinfo() - for platforms without getaddrinfo
*/
struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
const char *hostname,
int port,
int *waitp)
{
struct resdata *reslv = (struct resdata *)data->state.async.resolver;
struct in_addr in;
*waitp = 0; /* default to synchronous response */
reslv->start = Curl_now();
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
/* fire up a new resolver thread! */
if(init_resolve_thread(data, hostname, port, NULL)) {
if(init_resolve_thread(conn, hostname, port, NULL)) {
*waitp = 1; /* expect asynchronous response */
return NULL;
}
failf(data, "getaddrinfo() thread failed");
return NULL;
/* fall-back to blocking version */
return Curl_ipv4_resolve_r(hostname, port);
}
#else /* !HAVE_GETADDRINFO */
@ -684,38 +588,85 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
/*
* Curl_resolver_getaddrinfo() - for getaddrinfo
*/
struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
const char *hostname,
int port,
int *waitp)
{
struct addrinfo hints;
struct in_addr in;
Curl_addrinfo *res;
int error;
char sbuf[12];
int pf = PF_INET;
struct resdata *reslv = (struct resdata *)data->state.async.resolver;
#ifdef CURLRES_IPV6
struct in6_addr in6;
#endif /* CURLRES_IPV6 */
*waitp = 0; /* default to synchronous response */
#ifndef USE_RESOLVE_ON_IPS
/* First check if this is an IPv4 address string */
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, hostname, port);
#ifdef CURLRES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data))
/* The stack seems to be IPv6-enabled */
/* check if this is an IPv6 address string */
if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
/* This is an IPv6 address literal */
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
#endif /* CURLRES_IPV6 */
#endif /* !USE_RESOLVE_ON_IPS */
#ifdef CURLRES_IPV6
/*
* Check if a limited name resolve has been requested.
*/
switch(conn->ip_version) {
case CURL_IPRESOLVE_V4:
pf = PF_INET;
break;
case CURL_IPRESOLVE_V6:
pf = PF_INET6;
break;
default:
pf = PF_UNSPEC;
break;
}
if((pf != PF_INET) && !Curl_ipv6works())
/* The stack seems to be a non-IPv6 one */
pf = PF_INET;
#endif /* CURLRES_IPV6 */
memset(&hints, 0, sizeof(hints));
hints.ai_family = pf;
hints.ai_socktype = (data->conn->transport == TRNSPRT_TCP)?
SOCK_STREAM : SOCK_DGRAM;
hints.ai_socktype = conn->socktype;
snprintf(sbuf, sizeof(sbuf), "%d", port);
reslv->start = Curl_now();
/* fire up a new resolver thread! */
if(init_resolve_thread(data, hostname, port, &hints)) {
if(init_resolve_thread(conn, hostname, port, &hints)) {
*waitp = 1; /* expect asynchronous response */
return NULL;
}
failf(data, "getaddrinfo() thread failed to start");
return NULL;
/* fall-back to blocking version */
infof(conn->data, "init_resolve_thread() failed for %s; %s\n",
hostname, Curl_strerror(conn, ERRNO));
error = Curl_getaddrinfo_ex(hostname, sbuf, &hints, &res);
if(error) {
infof(conn->data, "getaddrinfo() failed for %s:%d; %s\n",
hostname, port, Curl_strerror(conn, SOCKERRNO));
return NULL;
}
else {
Curl_addrinfo_set_port(res, port);
}
return res;
}
#endif /* !HAVE_GETADDRINFO */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -62,7 +60,7 @@ void Curl_resolver_global_cleanup(void);
* Returning anything else than CURLE_OK fails curl_easy_init() with the
* correspondent code.
*/
CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver);
CURLcode Curl_resolver_init(void **resolver);
/*
* Curl_resolver_cleanup()
@ -81,32 +79,16 @@ void Curl_resolver_cleanup(void *resolver);
* pointer. Returning anything else than CURLE_OK causes failed
* curl_easy_duphandle() call.
*/
CURLcode Curl_resolver_duphandle(struct Curl_easy *easy, void **to,
void *from);
int Curl_resolver_duphandle(void **to, void *from);
/*
* Curl_resolver_cancel().
*
* It is called from inside other functions to cancel currently performing
* resolver request. Should also free any temporary resources allocated to
* perform a request. This never waits for resolver threads to complete.
*
* It is safe to call this when conn is in any state.
* perform a request.
*/
void Curl_resolver_cancel(struct Curl_easy *data);
/*
* Curl_resolver_kill().
*
* This acts like Curl_resolver_cancel() except it will block until any threads
* associated with the resolver are complete. This never blocks for resolvers
* that do not use threads. This is intended to be the "last chance" function
* that cleans up an in-progress resolver completely (before its owner is about
* to die).
*
* It is safe to call this when conn is in any state.
*/
void Curl_resolver_kill(struct Curl_easy *data);
void Curl_resolver_cancel(struct connectdata *conn);
/* Curl_resolver_getsock()
*
@ -116,7 +98,8 @@ void Curl_resolver_kill(struct Curl_easy *data);
* return bitmask indicating what file descriptors (referring to array indexes
* in the 'sock' array) to wait for, read/write.
*/
int Curl_resolver_getsock(struct Curl_easy *data, curl_socket_t *sock);
int Curl_resolver_getsock(struct connectdata *conn, curl_socket_t *sock,
int numsocks);
/*
* Curl_resolver_is_resolved()
@ -127,35 +110,36 @@ int Curl_resolver_getsock(struct Curl_easy *data, curl_socket_t *sock);
*
* Returns normal CURLcode errors.
*/
CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct Curl_dns_entry **dns);
/*
* Curl_resolver_wait_resolv()
*
* Waits for a resolve to finish. This function should be avoided since using
* waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
* If 'entry' is non-NULL, make it point to the resolved dns entry
*
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved, and
* CURLE_OPERATION_TIMEDOUT if a time-out occurred.
*/
CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **dnsentry);
/*
* Curl_resolver_getaddrinfo() - when using this resolver
*
* Returns name information about the given hostname and port number. If
* successful, the 'hostent' is returned and the fourth argument will point to
* successful, the 'hostent' is returned and the forth argument will point to
* memory we need to free after use. That memory *MUST* be freed with
* Curl_freeaddrinfo(), nothing else.
*
* Each resolver backend must of course make sure to return data in the
* correct format to comply with this.
*/
struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
const char *hostname,
int port,
int *waitp);
@ -163,11 +147,11 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
#ifndef CURLRES_ASYNCH
/* convert these functions if an asynch resolver isn't used */
#define Curl_resolver_cancel(x) Curl_nop_stmt
#define Curl_resolver_kill(x) Curl_nop_stmt
#define Curl_resolver_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_wait_resolv(x,y) CURLE_COULDNT_RESOLVE_HOST
#define Curl_resolver_duphandle(x,y,z) CURLE_OK
#define Curl_resolver_init(x,y) CURLE_OK
#define Curl_resolver_getsock(x,y,z) 0
#define Curl_resolver_duphandle(x,y) CURLE_OK
#define Curl_resolver_init(x) CURLE_OK
#define Curl_resolver_global_init() CURLE_OK
#define Curl_resolver_global_cleanup() Curl_nop_stmt
#define Curl_resolver_cleanup(x) Curl_nop_stmt

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,45 +18,71 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* Base64 encoding/decoding */
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP_AUTH) || defined(USE_SSH) || \
!defined(CURL_DISABLE_LDAP) || \
!defined(CURL_DISABLE_SMTP) || \
!defined(CURL_DISABLE_POP3) || \
!defined(CURL_DISABLE_IMAP) || \
!defined(CURL_DISABLE_DOH) || defined(USE_SSL)
#include "urldata.h" /* for the Curl_easy definition */
#include "warnless.h"
#include "curl_base64.h"
#include "non-ascii.h"
/* The last 2 #include files should be in this order */
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
/* ---- Base64 Encoding/Decoding Table --- */
/* Padding character string starts at offset 64. */
static const char base64[]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/* The Base 64 encoding with a URL and filename safe alphabet, RFC 4648
/* The Base 64 encoding with an URL and filename safe alphabet, RFC 4648
section 5 */
static const char base64url[]=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
static const unsigned char decodetable[] =
{ 62, 255, 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255,
255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, 255, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51 };
static size_t decodeQuantum(unsigned char *dest, const char *src)
{
size_t padding = 0;
const char *s, *p;
unsigned long i, x = 0;
for(i = 0, s = src; i < 4; i++, s++) {
unsigned long v = 0;
if(*s == '=') {
x = (x << 6);
padding++;
}
else {
p = base64;
while(*p && (*p != *s)) {
v++;
p++;
}
if(*p == *s)
x = (x << 6) + v;
else
return 0;
}
}
if(padding < 1)
dest[2] = curlx_ultouc(x & 0xFFUL);
x >>= 8;
if(padding < 2)
dest[1] = curlx_ultouc(x & 0xFFUL);
x >>= 8;
dest[0] = curlx_ultouc(x & 0xFFUL);
return 3 - padding;
}
/*
* Curl_base64_decode()
*
@ -75,14 +101,13 @@ CURLcode Curl_base64_decode(const char *src,
unsigned char **outptr, size_t *outlen)
{
size_t srclen = 0;
size_t length = 0;
size_t padding = 0;
size_t i;
size_t numQuantums;
size_t fullQuantums;
size_t rawlen = 0;
unsigned char *pos;
unsigned char *newstr;
unsigned char lookup[256];
*outptr = NULL;
*outlen = 0;
@ -92,82 +117,45 @@ CURLcode Curl_base64_decode(const char *src,
if(!srclen || srclen % 4)
return CURLE_BAD_CONTENT_ENCODING;
/* srclen is at least 4 here */
while(src[srclen - 1 - padding] == '=') {
/* count padding characters */
padding++;
/* Find the position of any = padding characters */
while((src[length] != '=') && src[length])
length++;
/* A maximum of two = padding characters is allowed */
if(padding > 2)
return CURLE_BAD_CONTENT_ENCODING;
if(src[length] == '=') {
padding++;
if(src[length + 1] == '=')
padding++;
}
/* Check the = padding characters weren't part way through the input */
if(length + padding != srclen)
return CURLE_BAD_CONTENT_ENCODING;
/* Calculate the number of quantums */
numQuantums = srclen / 4;
fullQuantums = numQuantums - (padding ? 1 : 0);
/* Calculate the size of the decoded string */
rawlen = (numQuantums * 3) - padding;
/* Allocate our buffer including room for a null-terminator */
/* Allocate our buffer including room for a zero terminator */
newstr = malloc(rawlen + 1);
if(!newstr)
return CURLE_OUT_OF_MEMORY;
pos = newstr;
memset(lookup, 0xff, sizeof(lookup));
memcpy(&lookup['+'], decodetable, sizeof(decodetable));
/* replaces
{
unsigned char c;
const unsigned char *p = (const unsigned char *)base64;
for(c = 0; *p; c++, p++)
lookup[*p] = c;
}
*/
/* Decode the quantums */
for(i = 0; i < numQuantums; i++) {
size_t result = decodeQuantum(pos, src);
if(!result) {
free(newstr);
/* Decode the complete quantums first */
for(i = 0; i < fullQuantums; i++) {
unsigned char val;
unsigned int x = 0;
int j;
return CURLE_BAD_CONTENT_ENCODING;
}
for(j = 0; j < 4; j++) {
val = lookup[(unsigned char)*src++];
if(val == 0xff) /* bad symbol */
goto bad;
x = (x << 6) | val;
}
pos[2] = x & 0xff;
pos[1] = (x >> 8) & 0xff;
pos[0] = (x >> 16) & 0xff;
pos += 3;
}
if(padding) {
/* this means either 8 or 16 bits output */
unsigned char val;
unsigned int x = 0;
int j;
size_t padc = 0;
for(j = 0; j < 4; j++) {
if(*src == '=') {
x <<= 6;
src++;
if(++padc > padding)
/* this is a badly placed '=' symbol! */
goto bad;
}
else {
val = lookup[(unsigned char)*src++];
if(val == 0xff) /* bad symbol */
goto bad;
x = (x << 6) | val;
}
}
if(padding == 1)
pos[1] = (x >> 8) & 0xff;
pos[0] = (x >> 16) & 0xff;
pos += 3 - padding;
pos += result;
src += 4;
}
/* Zero terminate */
@ -178,60 +166,95 @@ CURLcode Curl_base64_decode(const char *src,
*outlen = rawlen;
return CURLE_OK;
bad:
free(newstr);
return CURLE_BAD_CONTENT_ENCODING;
}
static CURLcode base64_encode(const char *table64,
struct Curl_easy *data,
const char *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
CURLcode result;
unsigned char ibuf[3];
unsigned char obuf[4];
int i;
int inputparts;
char *output;
char *base64data;
const unsigned char *in = (unsigned char *)inputbuff;
const char *padstr = &table64[64]; /* Point to padding string. */
char *convbuf = NULL;
const char *indata = inputbuff;
*outptr = NULL;
*outlen = 0;
if(!insize)
insize = strlen(inputbuff);
insize = strlen(indata);
#if SIZEOF_SIZE_T == 4
if(insize > UINT_MAX/4)
return CURLE_OUT_OF_MEMORY;
#endif
base64data = output = malloc((insize + 2) / 3 * 4 + 1);
base64data = output = malloc(insize * 4 / 3 + 4);
if(!output)
return CURLE_OUT_OF_MEMORY;
while(insize >= 3) {
*output++ = table64[ in[0] >> 2 ];
*output++ = table64[ ((in[0] & 0x03) << 4) | (in[1] >> 4) ];
*output++ = table64[ ((in[1] & 0x0F) << 2) | ((in[2] & 0xC0) >> 6) ];
*output++ = table64[ in[2] & 0x3F ];
insize -= 3;
in += 3;
/*
* The base64 data needs to be created using the network encoding
* not the host encoding. And we can't change the actual input
* so we copy it to a buffer, translate it, and use that instead.
*/
result = Curl_convert_clone(data, indata, insize, &convbuf);
if(result) {
free(output);
return result;
}
if(insize) {
/* this is only one or two bytes now */
*output++ = table64[ in[0] >> 2 ];
if(insize == 1) {
*output++ = table64[ ((in[0] & 0x03) << 4) ];
if(*padstr) {
*output++ = *padstr;
*output++ = *padstr;
if(convbuf)
indata = (char *)convbuf;
while(insize > 0) {
for(i = inputparts = 0; i < 3; i++) {
if(insize > 0) {
inputparts++;
ibuf[i] = (unsigned char) *indata;
indata++;
insize--;
}
else
ibuf[i] = 0;
}
else {
/* insize == 2 */
*output++ = table64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xF0) >> 4) ];
*output++ = table64[ ((in[1] & 0x0F) << 2) ];
if(*padstr)
*output++ = *padstr;
obuf[0] = (unsigned char) ((ibuf[0] & 0xFC) >> 2);
obuf[1] = (unsigned char) (((ibuf[0] & 0x03) << 4) | \
((ibuf[1] & 0xF0) >> 4));
obuf[2] = (unsigned char) (((ibuf[1] & 0x0F) << 2) | \
((ibuf[2] & 0xC0) >> 6));
obuf[3] = (unsigned char) (ibuf[2] & 0x3F);
switch(inputparts) {
case 1: /* only one byte read */
snprintf(output, 5, "%c%c==",
table64[obuf[0]],
table64[obuf[1]]);
break;
case 2: /* two bytes read */
snprintf(output, 5, "%c%c%c=",
table64[obuf[0]],
table64[obuf[1]],
table64[obuf[2]]);
break;
default:
snprintf(output, 5, "%c%c%c%c",
table64[obuf[0]],
table64[obuf[1]],
table64[obuf[2]],
table64[obuf[3]]);
break;
}
output += 4;
}
/* Zero terminate */
@ -240,8 +263,10 @@ static CURLcode base64_encode(const char *table64,
/* Return the pointer to the new data (allocated memory) */
*outptr = base64data;
free(convbuf);
/* Return the length of the new data */
*outlen = output - base64data;
*outlen = strlen(base64data);
return CURLE_OK;
}
@ -259,12 +284,15 @@ static CURLcode base64_encode(const char *table64,
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.
*
* When encoded data length is 0, returns NULL in *outptr.
*
* @unittest: 1302
*/
CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
CURLcode Curl_base64_encode(struct Curl_easy *data,
const char *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
return base64_encode(base64, inputbuff, insize, outptr, outlen);
return base64_encode(base64, data, inputbuff, insize, outptr, outlen);
}
/*
@ -280,12 +308,13 @@ CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.
*
* When encoded data length is 0, returns NULL in *outptr.
*
* @unittest: 1302
*/
CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize,
CURLcode Curl_base64url_encode(struct Curl_easy *data,
const char *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
return base64_encode(base64url, inputbuff, insize, outptr, outlen);
return base64_encode(base64url, data, inputbuff, insize, outptr, outlen);
}
#endif /* no users so disabled */

View File

@ -1,129 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2021 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "urldata.h"
#include "bufref.h"
#include "curl_memory.h"
#include "memdebug.h"
#define SIGNATURE 0x5c48e9b2 /* Random pattern. */
/*
* Init a bufref struct.
*/
void Curl_bufref_init(struct bufref *br)
{
DEBUGASSERT(br);
br->dtor = NULL;
br->ptr = NULL;
br->len = 0;
#ifdef DEBUGBUILD
br->signature = SIGNATURE;
#endif
}
/*
* Free the buffer and re-init the necessary fields. It doesn't touch the
* 'signature' field and thus this buffer reference can be reused.
*/
void Curl_bufref_free(struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);
if(br->ptr && br->dtor)
br->dtor((void *) br->ptr);
br->dtor = NULL;
br->ptr = NULL;
br->len = 0;
}
/*
* Set the buffer reference to new values. The previously referenced buffer
* is released before assignment.
*/
void Curl_bufref_set(struct bufref *br, const void *ptr, size_t len,
void (*dtor)(void *))
{
DEBUGASSERT(ptr || !len);
DEBUGASSERT(len <= CURL_MAX_INPUT_LENGTH);
Curl_bufref_free(br);
br->ptr = (const unsigned char *) ptr;
br->len = len;
br->dtor = dtor;
}
/*
* Get a pointer to the referenced buffer.
*/
const unsigned char *Curl_bufref_ptr(const struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);
return br->ptr;
}
/*
* Get the length of the referenced buffer data.
*/
size_t Curl_bufref_len(const struct bufref *br)
{
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);
return br->len;
}
CURLcode Curl_bufref_memdup(struct bufref *br, const void *ptr, size_t len)
{
unsigned char *cpy = NULL;
DEBUGASSERT(br);
DEBUGASSERT(br->signature == SIGNATURE);
DEBUGASSERT(br->ptr || !br->len);
DEBUGASSERT(ptr || !len);
DEBUGASSERT(len <= CURL_MAX_INPUT_LENGTH);
if(ptr) {
cpy = malloc(len + 1);
if(!cpy)
return CURLE_OUT_OF_MEMORY;
if(len)
memcpy(cpy, ptr, len);
cpy[len] = '\0';
}
Curl_bufref_set(br, cpy, len, curl_free);
return CURLE_OK;
}

View File

@ -1,48 +0,0 @@
#ifndef HEADER_CURL_BUFREF_H
#define HEADER_CURL_BUFREF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2021 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
* Generic buffer reference.
*/
struct bufref {
void (*dtor)(void *); /* Associated destructor. */
const unsigned char *ptr; /* Referenced data buffer. */
size_t len; /* The data size in bytes. */
#ifdef DEBUGBUILD
int signature; /* Detect API use mistakes. */
#endif
};
void Curl_bufref_init(struct bufref *br);
void Curl_bufref_set(struct bufref *br, const void *ptr, size_t len,
void (*dtor)(void *));
const unsigned char *Curl_bufref_ptr(const struct bufref *br);
size_t Curl_bufref_len(const struct bufref *br);
CURLcode Curl_bufref_memdup(struct bufref *br, const void *ptr, size_t len);
void Curl_bufref_free(struct bufref *br);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,60 +0,0 @@
#ifndef HEADER_CURL_HYPER_H
#define HEADER_CURL_HYPER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER)
#include <hyper.h>
/* per-transfer data for the Hyper backend */
struct hyptransfer {
hyper_waker *write_waker;
hyper_waker *read_waker;
const hyper_executor *exec;
hyper_task *endtask;
hyper_waker *exp100_waker;
hyper_waker *send_body_waker;
};
size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
uint8_t *buf, size_t buflen);
size_t Curl_hyper_send(void *userp, hyper_context *ctx,
const uint8_t *buf, size_t buflen);
CURLcode Curl_hyper_stream(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
bool *done,
int select_res);
CURLcode Curl_hyper_header(struct Curl_easy *data, hyper_headers *headers,
const char *line);
void Curl_hyper_done(struct Curl_easy *);
#else
#define Curl_hyper_done(x)
#endif /* !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER) */
#endif /* HEADER_CURL_HYPER_H */

View File

@ -1,502 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "urldata.h"
#include "strerror.h"
#include "cfilters.h"
#include "connect.h"
#include "url.h" /* for Curl_safefree() */
#include "sendf.h"
#include "sockaddr.h" /* required for Curl_sockaddr_storage */
#include "multiif.h"
#include "progress.h"
#include "warnless.h"
#include "http_proxy.h"
#include "socks.h"
#include "vtls/vtls.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#ifndef ARRAYSIZE
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif
void Curl_cf_def_destroy_this(struct Curl_cfilter *cf, struct Curl_easy *data)
{
(void)cf;
(void)data;
}
CURLcode Curl_cf_def_setup(struct Curl_cfilter *cf,
struct Curl_easy *data,
const struct Curl_dns_entry *remotehost)
{
DEBUGASSERT(cf->next);
return cf->next->cft->setup(cf->next, data, remotehost);
}
void Curl_cf_def_attach_data(struct Curl_cfilter *cf,
struct Curl_easy *data)
{
(void)cf;
(void)data;
}
void Curl_cf_def_detach_data(struct Curl_cfilter *cf,
struct Curl_easy *data)
{
(void)cf;
(void)data;
}
void Curl_cf_def_close(struct Curl_cfilter *cf, struct Curl_easy *data)
{
DEBUGASSERT(cf->next);
cf->connected = FALSE;
cf->next->cft->close(cf->next, data);
}
CURLcode Curl_cf_def_connect(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool blocking, bool *done)
{
DEBUGASSERT(cf->next);
return cf->next->cft->connect(cf->next, data, blocking, done);
}
void Curl_cf_def_get_host(struct Curl_cfilter *cf, struct Curl_easy *data,
const char **phost, const char **pdisplay_host,
int *pport)
{
DEBUGASSERT(cf->next);
cf->next->cft->get_host(cf->next, data, phost, pdisplay_host, pport);
}
int Curl_cf_def_get_select_socks(struct Curl_cfilter *cf,
struct Curl_easy *data,
curl_socket_t *socks)
{
DEBUGASSERT(cf->next);
return cf->next->cft->get_select_socks(cf->next, data, socks);
}
bool Curl_cf_def_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data)
{
DEBUGASSERT(cf->next);
return cf->next->cft->has_data_pending(cf->next, data);
}
ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
const void *buf, size_t len, CURLcode *err)
{
DEBUGASSERT(cf->next);
return cf->next->cft->do_send(cf->next, data, buf, len, err);
}
ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
char *buf, size_t len, CURLcode *err)
{
DEBUGASSERT(cf->next);
return cf->next->cft->do_recv(cf->next, data, buf, len, err);
}
void Curl_conn_cf_discard_all(struct Curl_easy *data,
struct connectdata *conn, int index)
{
struct Curl_cfilter *cfn, *cf = conn->cfilter[index];
if(cf) {
conn->cfilter[index] = NULL;
while(cf) {
cfn = cf->next;
cf->cft->destroy(cf, data);
free(cf);
cf = cfn;
}
}
}
void Curl_conn_close(struct Curl_easy *data, int index)
{
struct Curl_cfilter *cf;
DEBUGASSERT(data->conn);
/* it is valid to call that without filters being present */
cf = data->conn->cfilter[index];
if(cf) {
cf->cft->close(cf, data);
}
}
ssize_t Curl_conn_recv(struct Curl_easy *data, int num, char *buf,
size_t len, CURLcode *code)
{
struct Curl_cfilter *cf;
ssize_t nread;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
cf = data->conn->cfilter[num];
while(cf && !cf->connected) {
cf = cf->next;
}
if(cf) {
nread = cf->cft->do_recv(cf, data, buf, len, code);
/* DEBUGF(infof(data, "Curl_conn_recv(handle=%p, index=%d)"
"-> %ld, err=%d", data, num, nread, *code));*/
return nread;
}
failf(data, "no filter connected, conn=%ld, sockindex=%d",
data->conn->connection_id, num);
*code = CURLE_FAILED_INIT;
return -1;
}
ssize_t Curl_conn_send(struct Curl_easy *data, int num,
const void *mem, size_t len, CURLcode *code)
{
struct Curl_cfilter *cf;
ssize_t nwritten;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
cf = data->conn->cfilter[num];
while(cf && !cf->connected) {
cf = cf->next;
}
if(cf) {
nwritten = cf->cft->do_send(cf, data, mem, len, code);
/* DEBUGF(infof(data, "Curl_conn_send(handle=%p, index=%d, len=%ld)"
" -> %ld, err=%d", data, num, len, nwritten, *code));*/
return nwritten;
}
failf(data, "no filter connected, conn=%ld, sockindex=%d",
data->conn->connection_id, num);
*code = CURLE_FAILED_INIT;
return -1;
}
CURLcode Curl_cf_create(struct Curl_cfilter **pcf,
const struct Curl_cftype *cft,
void *ctx)
{
struct Curl_cfilter *cf;
CURLcode result = CURLE_OUT_OF_MEMORY;
DEBUGASSERT(cft);
cf = calloc(sizeof(*cf), 1);
if(!cf)
goto out;
cf->cft = cft;
cf->ctx = ctx;
result = CURLE_OK;
out:
*pcf = cf;
return result;
}
void Curl_conn_cf_add(struct Curl_easy *data,
struct connectdata *conn,
int index,
struct Curl_cfilter *cf)
{
(void)data;
DEBUGASSERT(conn);
DEBUGASSERT(!cf->conn);
DEBUGASSERT(!cf->next);
DEBUGF(infof(data, CMSGI(conn, index, "cf_add(filter=%s)"),
cf->cft->name));
cf->next = conn->cfilter[index];
cf->conn = conn;
cf->sockindex = index;
conn->cfilter[index] = cf;
}
void Curl_conn_cf_discard(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct Curl_cfilter **pprev = &cf->conn->cfilter[cf->sockindex];
/* remove from chain if still in there */
DEBUGASSERT(cf);
while (*pprev) {
if (*pprev == cf) {
*pprev = cf->next;
break;
}
pprev = &((*pprev)->next);
}
cf->cft->destroy(cf, data);
free(cf);
}
ssize_t Curl_conn_cf_send(struct Curl_cfilter *cf, struct Curl_easy *data,
const void *buf, size_t len, CURLcode *err)
{
return cf->cft->do_send(cf, data, buf, len, err);
}
ssize_t Curl_conn_cf_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
char *buf, size_t len, CURLcode *err)
{
return cf->cft->do_recv(cf, data, buf, len, err);
}
CURLcode Curl_conn_setup(struct Curl_easy *data,
struct connectdata *conn,
int sockindex,
const struct Curl_dns_entry *remotehost,
int ssl_mode)
{
struct Curl_cfilter *cf;
CURLcode result;
DEBUGASSERT(data);
/* If no filter is set, we have the "default" setup of connection filters.
* The filter chain from botton to top will be:
* - SOCKET socket filter for outgoing connection to remotehost
* if http_proxy tunneling is engaged:
* - SSL if proxytype is CURLPROXY_HTTPS
* - HTTP_PROXY_TUNNEL
* otherwise, if socks_proxy is engaged:
* - SOCKS_PROXY_TUNNEL
* - SSL if conn->handler has PROTOPT_SSL
*/
if(!conn->cfilter[sockindex]) {
DEBUGF(infof(data, DMSGI(data, sockindex, "setup, init filter chain")));
result = Curl_conn_socket_set(data, conn, sockindex);
if(result)
goto out;
#ifndef CURL_DISABLE_PROXY
if(conn->bits.socksproxy) {
result = Curl_conn_socks_proxy_add(data, conn, sockindex);
if(result)
goto out;
}
if(conn->bits.httpproxy) {
#ifdef USE_SSL
if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) {
result = Curl_ssl_cfilter_proxy_add(data, conn, sockindex);
if(result)
goto out;
}
#endif /* USE_SSL */
#if !defined(CURL_DISABLE_HTTP)
if(conn->bits.tunnel_proxy) {
result = Curl_conn_http_proxy_add(data, conn, sockindex);
if(result)
goto out;
}
#endif /* !CURL_DISABLE_HTTP */
}
#endif /* !CURL_DISABLE_PROXY */
#ifdef USE_SSL
if(ssl_mode == CURL_CF_SSL_ENABLE
|| (ssl_mode != CURL_CF_SSL_DISABLE
&& conn->handler->flags & PROTOPT_SSL)) {
result = Curl_ssl_cfilter_add(data, conn, sockindex);
if(result)
goto out;
}
#else
(void)ssl_mode;
#endif /* USE_SSL */
#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP)
if(data->set.haproxyprotocol) {
result = Curl_conn_haproxy_add(data, conn, sockindex);
if(result)
goto out;
}
#endif /* !CURL_DISABLE_PROXY && !CURL_DISABLE_HTTP */
}
DEBUGASSERT(conn->cfilter[sockindex]);
cf = data->conn->cfilter[sockindex];
result = cf->cft->setup(cf, data, remotehost);
out:
return result;
}
CURLcode Curl_conn_connect(struct Curl_easy *data,
int sockindex,
bool blocking,
bool *done)
{
struct Curl_cfilter *cf;
CURLcode result;
DEBUGASSERT(data);
cf = data->conn->cfilter[sockindex];
DEBUGASSERT(cf);
result = cf->cft->connect(cf, data, blocking, done);
DEBUGF(infof(data, DMSGI(data, sockindex, "connect(block=%d)-> %d, done=%d"),
blocking, result, *done));
return result;
}
bool Curl_conn_is_connected(struct connectdata *conn, int sockindex)
{
struct Curl_cfilter *cf;
cf = conn->cfilter[sockindex];
return cf && cf->connected;
}
bool Curl_conn_is_ip_connected(struct Curl_easy *data, int sockindex)
{
struct Curl_cfilter *cf;
cf = data->conn->cfilter[sockindex];
while(cf) {
if(cf->connected)
return TRUE;
if(cf->cft->flags & CF_TYPE_IP_CONNECT)
return FALSE;
cf = cf->next;
}
return FALSE;
}
bool Curl_conn_is_ssl(struct Curl_easy *data, int sockindex)
{
struct Curl_cfilter *cf = data->conn? data->conn->cfilter[sockindex] : NULL;
(void)data;
for(; cf; cf = cf->next) {
if(cf->cft->flags & CF_TYPE_SSL)
return TRUE;
if(cf->cft->flags & CF_TYPE_IP_CONNECT)
return FALSE;
}
return FALSE;
}
bool Curl_conn_data_pending(struct Curl_easy *data, int sockindex)
{
struct Curl_cfilter *cf;
(void)data;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
if(Curl_recv_has_postponed_data(data->conn, sockindex))
return TRUE;
cf = data->conn->cfilter[sockindex];
while(cf && !cf->connected) {
cf = cf->next;
}
if(cf) {
return cf->cft->has_data_pending(cf, data);
}
return FALSE;
}
int Curl_conn_get_select_socks(struct Curl_easy *data, int sockindex,
curl_socket_t *socks)
{
struct Curl_cfilter *cf;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
cf = data->conn->cfilter[sockindex];
if(cf) {
return cf->cft->get_select_socks(cf, data, socks);
}
return GETSOCK_BLANK;
}
void Curl_conn_attach_data(struct connectdata *conn,
struct Curl_easy *data)
{
size_t i;
struct Curl_cfilter *cf;
for(i = 0; i < ARRAYSIZE(conn->cfilter); ++i) {
cf = conn->cfilter[i];
if(cf) {
while(cf) {
cf->cft->attach_data(cf, data);
cf = cf->next;
}
}
}
}
void Curl_conn_detach_data(struct connectdata *conn,
struct Curl_easy *data)
{
size_t i;
struct Curl_cfilter *cf;
for(i = 0; i < ARRAYSIZE(conn->cfilter); ++i) {
cf = conn->cfilter[i];
if(cf) {
while(cf) {
cf->cft->detach_data(cf, data);
cf = cf->next;
}
}
}
}
void Curl_conn_get_host(struct Curl_easy *data, int sockindex,
const char **phost, const char **pdisplay_host,
int *pport)
{
struct Curl_cfilter *cf;
DEBUGASSERT(data->conn);
cf = data->conn->cfilter[sockindex];
if(cf) {
cf->cft->get_host(cf, data, phost, pdisplay_host, pport);
}
else {
/* Some filter ask during shutdown for this, mainly for debugging
* purposes. We hand out the defaults, however this is not always
* accurate, as the connction might be tunneled, etc. But all that
* state is already gone here. */
*phost = data->conn->host.name;
*pdisplay_host = data->conn->host.dispname;
*pport = data->conn->remote_port;
}
}

View File

@ -1,315 +0,0 @@
#ifndef HEADER_CURL_CFILTERS_H
#define HEADER_CURL_CFILTERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
struct Curl_cfilter;
struct Curl_easy;
struct Curl_dns_entry;
struct connectdata;
/* Callback to destroy resources held by this filter instance.
* Implementations MUST NOT chain calls to cf->next.
*/
typedef void Curl_cft_destroy_this(struct Curl_cfilter *cf,
struct Curl_easy *data);
/* Setup the connection for `data`, using destination `remotehost`.
*/
typedef CURLcode Curl_cft_setup(struct Curl_cfilter *cf,
struct Curl_easy *data,
const struct Curl_dns_entry *remotehost);
typedef void Curl_cft_close(struct Curl_cfilter *cf,
struct Curl_easy *data);
typedef CURLcode Curl_cft_connect(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool blocking, bool *done);
/* Return the hostname and port the connection goes to.
* This may change with the connection state of filters when tunneling
* is involved.
* @param cf the filter to ask
* @param data the easy handle currently active
* @param phost on return, points to the relevant, real hostname.
* this is owned by the connection.
* @param pdisplay_host on return, points to the printable hostname.
* this is owned by the connection.
* @param pport on return, contains the port number
*/
typedef void Curl_cft_get_host(struct Curl_cfilter *cf,
struct Curl_easy *data,
const char **phost,
const char **pdisplay_host,
int *pport);
/* Filters may return sockets and fdset flags they are waiting for.
* The passes array has room for up to MAX_SOCKSPEREASYHANDLE sockets.
* @return read/write fdset for index in socks
* or GETSOCK_BLANK when nothing to wait on
*/
typedef int Curl_cft_get_select_socks(struct Curl_cfilter *cf,
struct Curl_easy *data,
curl_socket_t *socks);
typedef bool Curl_cft_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data);
typedef ssize_t Curl_cft_send(struct Curl_cfilter *cf,
struct Curl_easy *data, /* transfer */
const void *buf, /* data to write */
size_t len, /* amount to write */
CURLcode *err); /* error to return */
typedef ssize_t Curl_cft_recv(struct Curl_cfilter *cf,
struct Curl_easy *data, /* transfer */
char *buf, /* store data here */
size_t len, /* amount to read */
CURLcode *err); /* error to return */
typedef void Curl_cft_attach_data(struct Curl_cfilter *cf,
struct Curl_easy *data);
typedef void Curl_cft_detach_data(struct Curl_cfilter *cf,
struct Curl_easy *data);
/**
* The easy handle `data` is being detached (no longer served)
* by connection `conn`. All filters are informed to release any resources
* related to `data`.
* Note: there may be several `data` attached to a connection at the same
* time.
*/
void Curl_conn_detach(struct connectdata *conn, struct Curl_easy *data);
#define CF_TYPE_IP_CONNECT (1 << 0)
#define CF_TYPE_SSL (1 << 1)
/* A connection filter type, e.g. specific implementation. */
struct Curl_cftype {
const char *name; /* name of the filter type */
long flags; /* flags of filter type */
Curl_cft_destroy_this *destroy; /* destroy resources of this cf */
Curl_cft_setup *setup; /* setup for a connection */
Curl_cft_connect *connect; /* establish connection */
Curl_cft_close *close; /* close conn */
Curl_cft_get_host *get_host; /* host filter talks to */
Curl_cft_get_select_socks *get_select_socks;/* sockets to select on */
Curl_cft_data_pending *has_data_pending;/* conn has data pending */
Curl_cft_send *do_send; /* send data */
Curl_cft_recv *do_recv; /* receive data */
Curl_cft_attach_data *attach_data; /* data is being handled here */
Curl_cft_detach_data *detach_data; /* data is no longer handled here */
};
/* A connection filter instance, e.g. registered at a connection */
struct Curl_cfilter {
const struct Curl_cftype *cft; /* the type providing implementation */
struct Curl_cfilter *next; /* next filter in chain */
void *ctx; /* filter type specific settings */
struct connectdata *conn; /* the connection this filter belongs to */
int sockindex; /* TODO: like to get rid off this */
BIT(connected); /* != 0 iff this filter is connected */
};
/* Default implementations for the type functions, implementing nop. */
void Curl_cf_def_destroy_this(struct Curl_cfilter *cf,
struct Curl_easy *data);
/* Default implementations for the type functions, implementing pass-through
* the filter chain. */
CURLcode Curl_cf_def_setup(struct Curl_cfilter *cf,
struct Curl_easy *data,
const struct Curl_dns_entry *remotehost);
void Curl_cf_def_close(struct Curl_cfilter *cf, struct Curl_easy *data);
CURLcode Curl_cf_def_connect(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool blocking, bool *done);
void Curl_cf_def_get_host(struct Curl_cfilter *cf, struct Curl_easy *data,
const char **phost, const char **pdisplay_host,
int *pport);
int Curl_cf_def_get_select_socks(struct Curl_cfilter *cf,
struct Curl_easy *data,
curl_socket_t *socks);
bool Curl_cf_def_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data);
ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
const void *buf, size_t len, CURLcode *err);
ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
char *buf, size_t len, CURLcode *err);
void Curl_cf_def_attach_data(struct Curl_cfilter *cf,
struct Curl_easy *data);
void Curl_cf_def_detach_data(struct Curl_cfilter *cf,
struct Curl_easy *data);
/**
* Create a new filter instance, unattached to the filter chain.
* Use Curl_conn_cf_add() to add it to the chain.
* @param pcf on success holds the created instance
* @parm cft the filter type
* @param ctx the type specific context to use
*/
CURLcode Curl_cf_create(struct Curl_cfilter **pcf,
const struct Curl_cftype *cft,
void *ctx);
/**
* Add a filter instance to the `sockindex` filter chain at connection
* `data->conn`. The filter must not already be attached. It is inserted at
* the start of the chain (top).
*/
void Curl_conn_cf_add(struct Curl_easy *data,
struct connectdata *conn,
int sockindex,
struct Curl_cfilter *cf);
/**
* Remove and destroy all filters at chain `sockindex` on connection `conn`.
*/
void Curl_conn_cf_discard_all(struct Curl_easy *data,
struct connectdata *conn,
int sockindex);
/**
* Discard, e.g. remove and destroy a specific filter instance.
* If the filter is attached to a connection, it will be removed before
* it is destroyed.
*/
void Curl_conn_cf_discard(struct Curl_cfilter *cf, struct Curl_easy *data);
ssize_t Curl_conn_cf_send(struct Curl_cfilter *cf, struct Curl_easy *data,
const void *buf, size_t len, CURLcode *err);
ssize_t Curl_conn_cf_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
char *buf, size_t len, CURLcode *err);
#define CURL_CF_SSL_DEFAULT -1
#define CURL_CF_SSL_DISABLE 0
#define CURL_CF_SSL_ENABLE 1
/**
* Setup the filter chain at `sockindex` in connection `conn`, invoking
* the instance `setup(remotehost)` methods. If no filter chain is
* installed yet, inspects the configuration in `data` to install a
* suitable filter chain.
*/
CURLcode Curl_conn_setup(struct Curl_easy *data,
struct connectdata *conn,
int sockindex,
const struct Curl_dns_entry *remotehost,
int ssl_mode);
/**
* Bring the filter chain at `sockindex` for connection `data->conn` into
* connected state. Which will set `*done` to TRUE.
* This can be called on an already connected chain with no side effects.
* When not `blocking`, calls may return without error and `*done != TRUE`,
* while the individual filters negotiated the connection.
*/
CURLcode Curl_conn_connect(struct Curl_easy *data, int sockindex,
bool blocking, bool *done);
/**
* Check if the filter chain at `sockindex` for connection `conn` is
* completely connected.
*/
bool Curl_conn_is_connected(struct connectdata *conn, int sockindex);
/**
* Determine if we have reached the remote host on IP level, e.g.
* have a TCP connection. This turns TRUE before a possible SSL
* handshake has been started/done.
*/
bool Curl_conn_is_ip_connected(struct Curl_easy *data, int sockindex);
/**
* Determine if the connection is using SSL to the remote host
* (or will be once connected). This will return FALSE, if SSL
* is only used in proxying and not for the tunnel itself.
*/
bool Curl_conn_is_ssl(struct Curl_easy *data, int sockindex);
/**
* Close the filter chain at `sockindex` for connection `data->conn`.
* Filters remain in place and may be connected again afterwards.
*/
void Curl_conn_close(struct Curl_easy *data, int sockindex);
/**
* Return if data is pending in some connection filter at chain
* `sockindex` for connection `data->conn`.
*/
bool Curl_conn_data_pending(struct Curl_easy *data,
int sockindex);
/**
* Get any select fd flags and the socket filters at chain `sockindex`
* at connection `conn` might be waiting for.
*/
int Curl_conn_get_select_socks(struct Curl_easy *data, int sockindex,
curl_socket_t *socks);
/**
* Receive data through the filter chain at `sockindex` for connection
* `data->conn`. Copy at most `len` bytes into `buf`. Return the
* actuel number of bytes copied or a negative value on error.
* The error code is placed into `*code`.
*/
ssize_t Curl_conn_recv(struct Curl_easy *data, int sockindex, char *buf,
size_t len, CURLcode *code);
/**
* Send `len` bytes of data from `buf` through the filter chain `sockindex`
* at connection `data->conn`. Return the actual number of bytes written
* or a negative value on error.
* The error code is placed into `*code`.
*/
ssize_t Curl_conn_send(struct Curl_easy *data, int sockindex,
const void *buf, size_t len, CURLcode *code);
/**
* The easy handle `data` is being attached (served) by connection `conn`.
* All filters are informed to adapt to handling `data`.
* Note: there may be several `data` attached to a connection at the same
* time.
*/
void Curl_conn_attach_data(struct connectdata *conn,
struct Curl_easy *data);
/**
* The easy handle `data` is being detached (no longer served)
* by connection `conn`. All filters are informed to release any resources
* related to `data`.
* Note: there may be several `data` attached to a connection at the same
* time.
*/
void Curl_conn_detach_data(struct connectdata *conn,
struct Curl_easy *data);
void Curl_conn_get_host(struct Curl_easy *data, int sockindex,
const char **phost, const char **pdisplay_host,
int *pport);
#endif /* HEADER_CURL_CFILTERS_H */

552
r5dev/thirdparty/curl/checksrc.pl vendored Normal file
View File

@ -0,0 +1,552 @@
#!/usr/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2011 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
my $max_column = 79;
my $indent = 2;
my $warnings;
my $errors;
my $supressed; # whitelisted problems
my $file;
my $dir=".";
my $wlist;
my $windows_os = $^O eq 'MSWin32' || $^O eq 'msys' || $^O eq 'cygwin';
my $verbose;
my %whitelist;
my %warnings = (
'LONGLINE' => "Line longer than $max_column",
'TABS' => 'TAB characters not allowed',
'TRAILINGSPACE' => 'Trailing white space on the line',
'CPPCOMMENTS' => '// comment detected',
'SPACEBEFOREPAREN' => 'space before an open parenthesis',
'SPACEAFTERPAREN' => 'space after open parenthesis',
'SPACEBEFORECLOSE' => 'space before a close parenthesis',
'SPACEBEFORECOMMA' => 'space before a comma',
'RETURNNOSPACE' => 'return without space',
'COMMANOSPACE' => 'comma without following space',
'BRACEELSE' => '} else on the same line',
'PARENBRACE' => '){ without sufficient space',
'SPACESEMILCOLON' => 'space before semicolon',
'BANNEDFUNC' => 'a banned function was used',
'FOPENMODE' => 'fopen needs a macro for the mode string',
'BRACEPOS' => 'wrong position for an open brace',
'INDENTATION' => 'wrong start column for code',
'COPYRIGHT' => 'file missing a copyright statement',
'BADCOMMAND' => 'bad !checksrc! instruction',
'UNUSEDIGNORE' => 'a warning ignore was not used',
'OPENCOMMENT' => 'file ended with a /* comment still "open"',
'ASTERISKSPACE' => 'pointer declared with space after asterisk',
'ASTERISKNOSPACE' => 'pointer declared without space before asterisk',
'ASSIGNWITHINCONDITION' => 'assignment within conditional expression'
);
sub readwhitelist {
open(W, "<$dir/checksrc.whitelist");
my @all=<W>;
for(@all) {
$windows_os ? $_ =~ s/\r?\n$// : chomp;
$whitelist{$_}=1;
}
close(W);
}
sub checkwarn {
my ($name, $num, $col, $file, $line, $msg, $error) = @_;
my $w=$error?"error":"warning";
my $nowarn=0;
#if(!$warnings{$name}) {
# print STDERR "Dev! there's no description for $name!\n";
#}
# checksrc.whitelist
if($whitelist{$line}) {
$nowarn = 1;
}
# !checksrc! controlled
elsif($ignore{$name}) {
$ignore{$name}--;
$ignore_used{$name}++;
$nowarn = 1;
if(!$ignore{$name}) {
# reached zero, enable again
enable_warn($name, $line, $file, $l);
}
}
if($nowarn) {
$supressed++;
if($w) {
$swarnings++;
}
else {
$serrors++;
}
return;
}
if($w) {
$warnings++;
}
else {
$errors++;
}
$col++;
print "$file:$num:$col: $w: $msg ($name)\n";
print " $line\n";
if($col < 80) {
my $pref = (' ' x $col);
print "${pref}^\n";
}
}
$file = shift @ARGV;
while(1) {
if($file =~ /-D(.*)/) {
$dir = $1;
$file = shift @ARGV;
next;
}
elsif($file =~ /-W(.*)/) {
$wlist .= " $1 ";
$file = shift @ARGV;
next;
}
elsif($file =~ /^(-h|--help)/) {
undef $file;
last;
}
last;
}
if(!$file) {
print "checksrc.pl [option] <file1> [file2] ...\n";
print " Options:\n";
print " -D[DIR] Directory to prepend file names\n";
print " -h Show help output\n";
print " -W[file] Whitelist the given file - ignore all its flaws\n";
print "\nDetects and warns for these problems:\n";
for(sort keys %warnings) {
printf (" %-18s: %s\n", $_, $warnings{$_});
}
exit;
}
readwhitelist();
do {
if("$wlist" !~ / $file /) {
my $fullname = $file;
$fullname = "$dir/$file" if ($fullname !~ '^\.?\.?/');
scanfile($fullname);
}
$file = shift @ARGV;
} while($file);
sub checksrc_clear {
undef %ignore;
undef %ignore_set;
undef @ignore_line;
}
sub checksrc_endoffile {
my ($file) = @_;
for(keys %ignore_set) {
if($ignore_set{$_} && !$ignore_used{$_}) {
checkwarn("UNUSEDIGNORE", $ignore_set{$_},
length($_)+11, $file,
$ignore_line[$ignore_set{$_}],
"Unused ignore: $_");
}
}
}
sub enable_warn {
my ($what, $line, $file, $l) = @_;
# switch it back on, but warn if not triggered!
if(!$ignore_used{$what}) {
checkwarn("UNUSEDIGNORE",
$line, length($what) + 11, $file, $l,
"No warning was inhibited!");
}
$ignore_set{$what}=0;
$ignore_used{$what}=0;
$ignore{$what}=0;
}
sub checksrc {
my ($cmd, $line, $file, $l) = @_;
if($cmd =~ / *([^ ]*) *(.*)/) {
my ($enable, $what) = ($1, $2);
$what =~ s: *\*/$::; # cut off end of C comment
# print "ENABLE $enable WHAT $what\n";
if($enable eq "disable") {
my ($warn, $scope)=($1, $2);
if($what =~ /([^ ]*) +(.*)/) {
($warn, $scope)=($1, $2);
}
else {
$warn = $what;
$scope = 1;
}
# print "IGNORE $warn for SCOPE $scope\n";
if($scope eq "all") {
$scope=999999;
}
if($ignore_set{$warn}) {
checkwarn("BADCOMMAND",
$line, 0, $file, $l,
"$warn already disabled from line $ignore_set{$warn}");
}
else {
$ignore{$warn}=$scope;
$ignore_set{$warn}=$line;
$ignore_line[$line]=$l;
}
}
elsif($enable eq "enable") {
enable_warn($what, $line, $file, $l);
}
else {
checkwarn("BADCOMMAND",
$line, 0, $file, $l,
"Illegal !checksrc! command");
}
}
}
sub nostrings {
my ($str) = @_;
$str =~ s/\".*\"//g;
return $str;
}
sub scanfile {
my ($file) = @_;
my $line = 1;
my $prevl;
my $l;
open(R, "<$file") || die "failed to open $file";
my $incomment=0;
my $copyright=0;
checksrc_clear(); # for file based ignores
while(<R>) {
$windows_os ? $_ =~ s/\r?\n$// : chomp;
my $l = $_;
my $ol = $l; # keep the unmodified line for error reporting
my $column = 0;
# check for !checksrc! commands
if($l =~ /\!checksrc\! (.*)/) {
my $cmd = $1;
checksrc($cmd, $line, $file, $l)
}
# check for a copyright statement
if(!$copyright && ($l =~ /copyright .* \d\d\d\d/i)) {
$copyright=1;
}
# detect long lines
if(length($l) > $max_column) {
checkwarn("LONGLINE", $line, length($l), $file, $l,
"Longer than $max_column columns");
}
# detect TAB characters
if($l =~ /^(.*)\t/) {
checkwarn("TABS",
$line, length($1), $file, $l, "Contains TAB character", 1);
}
# detect trailing white space
if($l =~ /^(.*)[ \t]+\z/) {
checkwarn("TRAILINGSPACE",
$line, length($1), $file, $l, "Trailing whitespace");
}
# ------------------------------------------------------------
# Above this marker, the checks were done on lines *including*
# comments
# ------------------------------------------------------------
# strip off C89 comments
comment:
if(!$incomment) {
if($l =~ s/\/\*.*\*\// /g) {
# full /* comments */ were removed!
}
if($l =~ s/\/\*.*//) {
# start of /* comment was removed
$incomment = 1;
}
}
else {
if($l =~ s/.*\*\///) {
# end of comment */ was removed
$incomment = 0;
goto comment;
}
else {
# still within a comment
$l="";
}
}
# ------------------------------------------------------------
# Below this marker, the checks were done on lines *without*
# comments
# ------------------------------------------------------------
# crude attempt to detect // comments without too many false
# positives
if($l =~ /^([^"\*]*)[^:"]\/\//) {
checkwarn("CPPCOMMENTS",
$line, length($1), $file, $l, "\/\/ comment");
}
my $nostr = nostrings($l);
# check spaces after for/if/while/function call
if($nostr =~ /^(.*)(for|if|while| ([a-zA-Z0-9_]+)) \((.)/) {
if($1 =~ / *\#/) {
# this is a #if, treat it differently
}
elsif($3 eq "return") {
# return must have a space
}
elsif($4 eq "*") {
# (* beginning makes the space OK!
}
elsif($1 =~ / *typedef/) {
# typedefs can use space-paren
}
else {
checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l,
"$2 with space");
}
}
if($nostr =~ /^((.*)(if) *\()(.*)\)/) {
my $pos = length($1);
if($4 =~ / = /) {
checkwarn("ASSIGNWITHINCONDITION",
$line, $pos+1, $file, $l,
"assignment within conditional expression");
}
}
# check spaces after open parentheses
if($l =~ /^(.*[a-z])\( /i) {
checkwarn("SPACEAFTERPAREN",
$line, length($1)+1, $file, $l,
"space after open parenthesis");
}
# check spaces before close parentheses, unless it was a space or a
# close parenthesis!
if($l =~ /(.*[^\) ]) \)/) {
checkwarn("SPACEBEFORECLOSE",
$line, length($1)+1, $file, $l,
"space before close parenthesis");
}
# check spaces before comma!
if($l =~ /(.*[^ ]) ,/) {
checkwarn("SPACEBEFORECOMMA",
$line, length($1)+1, $file, $l,
"space before comma");
}
# check for "return(" without space
if($l =~ /^(.*)return\(/) {
if($1 =~ / *\#/) {
# this is a #if, treat it differently
}
else {
checkwarn("RETURNNOSPACE", $line, length($1)+6, $file, $l,
"return without space before paren");
}
}
# check for comma without space
if($l =~ /^(.*),[^ \n]/) {
my $pref=$1;
my $ign=0;
if($pref =~ / *\#/) {
# this is a #if, treat it differently
$ign=1;
}
elsif($pref =~ /\/\*/) {
# this is a comment
$ign=1;
}
elsif($pref =~ /[\"\']/) {
$ign = 1;
# There is a quote here, figure out whether the comma is
# within a string or '' or not.
if($pref =~ /\"/) {
# withing a string
}
elsif($pref =~ /\'$/) {
# a single letter
}
else {
$ign = 0;
}
}
if(!$ign) {
checkwarn("COMMANOSPACE", $line, length($pref)+1, $file, $l,
"comma without following space");
}
}
# check for "} else"
if($l =~ /^(.*)\} *else/) {
checkwarn("BRACEELSE",
$line, length($1), $file, $l, "else after closing brace on same line");
}
# check for "){"
if($l =~ /^(.*)\)\{/) {
checkwarn("PARENBRACE",
$line, length($1)+1, $file, $l, "missing space after close paren");
}
# check for space before the semicolon last in a line
if($l =~ /^(.*[^ ].*) ;$/) {
checkwarn("SPACESEMILCOLON",
$line, length($1), $file, $ol, "space before last semicolon");
}
# scan for use of banned functions
if($l =~ /^(.*\W)
(gets|
strtok|
v?sprintf|
(str|_mbs|_tcs|_wcs)n?cat|
LoadLibrary(Ex)?(A|W)?)
\s*\(
/x) {
checkwarn("BANNEDFUNC",
$line, length($1), $file, $ol,
"use of $2 is banned");
}
# scan for use of non-binary fopen without the macro
if($l =~ /^(.*\W)fopen\s*\([^,]*, *\"([^"]*)/) {
my $mode = $2;
if($mode !~ /b/) {
checkwarn("FOPENMODE",
$line, length($1), $file, $ol,
"use of non-binary fopen without FOPEN_* macro: $mode");
}
}
# check for open brace first on line but not first column
# only alert if previous line ended with a close paren and wasn't a cpp
# line
if((($prevl =~ /\)\z/) && ($prevl !~ /^ *#/)) && ($l =~ /^( +)\{/)) {
checkwarn("BRACEPOS",
$line, length($1), $file, $ol, "badly placed open brace");
}
# if the previous line starts with if/while/for AND ends with an open
# brace, check that this line is indented $indent more steps, if not
# a cpp line
if($prevl =~ /^( *)(if|while|for)\(.*\{\z/) {
my $first = length($1);
# this line has some character besides spaces
if(($l !~ /^ *#/) && ($l =~ /^( *)[^ ]/)) {
my $second = length($1);
my $expect = $first+$indent;
if($expect != $second) {
my $diff = $second - $first;
checkwarn("INDENTATION", $line, length($1), $file, $ol,
"not indented $indent steps, uses $diff)");
}
}
}
# check for 'char * name'
if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost) *(\*+)) (\w+)/) && ($4 ne "const")) {
checkwarn("ASTERISKNOSPACE",
$line, length($1), $file, $ol,
"no space after declarative asterisk");
}
# check for 'char*'
if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost|sockaddr_in|FILE)\*)/)) {
checkwarn("ASTERISKNOSPACE",
$line, length($1)-1, $file, $ol,
"no space before asterisk");
}
# check for 'void func() {', but avoid false positives by requiring
# both an open and closed parentheses before the open brace
if($l =~ /^((\w).*){\z/) {
my $k = $1;
$k =~ s/const *//;
$k =~ s/static *//;
if($k =~ /\(.*\)/) {
checkwarn("BRACEPOS",
$line, length($l)-1, $file, $ol,
"wrongly placed open brace");
}
}
$line++;
$prevl = $ol;
}
if(!$copyright) {
checkwarn("COPYRIGHT", 1, 0, $file, "", "Missing copyright statement", 1);
}
if($incomment) {
checkwarn("OPENCOMMENT", 1, 0, $file, "", "Missing closing comment", 1);
}
checksrc_endoffile($file);
close(R);
}
if($errors || $warnings || $verbose) {
printf "checksrc: %d errors and %d warnings\n", $errors, $warnings;
if($supressed) {
printf "checksrc: %d errors and %d warnings suppressed\n",
$serrors,
$swarnings;
}
exit 5; # return failure
}

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
@ -32,25 +30,45 @@
#define HAVE_ARPA_INET_H 1
#define HAVE_CLOSESOCKET_CAMEL 1
#define HAVE_ERRNO_H 1
#define HAVE_GETHOSTBYADDR 1
#define HAVE_INET_ADDR 1
#define HAVE_INTTYPES_H 1
#define HAVE_IOCTLSOCKET_CAMEL 1
#define HAVE_IOCTLSOCKET_CAMEL_FIONBIO 1
#define HAVE_LIBCRYPTO 1
#define HAVE_LIBSSL 1
#define HAVE_LIBZ 1
#define HAVE_LONGLONG 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NET_IF_H 1
#define HAVE_OPENSSL_CRYPTO_H 1
#define HAVE_OPENSSL_ERR_H 1
#define HAVE_OPENSSL_PEM_H 1
#define HAVE_OPENSSL_RSA_H 1
#define HAVE_OPENSSL_SSL_H 1
#define HAVE_OPENSSL_X509_H 1
#define HAVE_PERROR 1
#define HAVE_PWD_H 1
#define HAVE_RAND_EGD 1
#define HAVE_RAND_STATUS 1
#define HAVE_SELECT 1
#define HAVE_SETJMP_H 1
#define HAVE_SGTTY_H 1
#define HAVE_SIGNAL 1
#define HAVE_SIGNAL_H 1
#define HAVE_SIG_ATOMIC_T 1
#define HAVE_SOCKET 1
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1
#define HAVE_STRFTIME 1
#define HAVE_STRICMP 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRSTR 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_SOCKET_H 1
@ -59,35 +77,39 @@
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TIME_H 1
#define HAVE_UNAME 1
#define HAVE_UNISTD_H 1
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_WRITABLE_ARGV 1
#define HAVE_ZLIB_H 1
#define HAVE_SYS_IOCTL_H 1
#define NEED_MALLOC_H 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
#define SIZEOF_SIZE_T 4
#ifndef SIZEOF_CURL_OFF_T
#define SIZEOF_CURL_OFF_T 8
#endif
#define USE_MANUAL 1
#define USE_OPENSSL 1
#define CURL_DISABLE_LDAP 1
#ifndef OS
#define OS "AmigaOS"
#endif
#define PACKAGE "curl"
#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.haxx.se/mail/"
#define PACKAGE_NAME "curl"
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
#define CURL_CA_BUNDLE "s:curl-ca-bundle.crt"
#define RETSIGTYPE void
#define SELECT_TYPE_ARG1 int
#define SELECT_TYPE_ARG234 (fd_set *)
#define SELECT_TYPE_ARG5 (struct timeval *)
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
@ -109,6 +131,13 @@
# define LONG_MIN (-0x7fffffffL-1)
#endif
#define HAVE_GETNAMEINFO 1
#define GETNAMEINFO_QUAL_ARG1 const
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
#define GETNAMEINFO_TYPE_ARG2 int
#define GETNAMEINFO_TYPE_ARG46 size_t
#define GETNAMEINFO_TYPE_ARG7 int
#define HAVE_RECV 1
#define RECV_TYPE_ARG1 long
#define RECV_TYPE_ARG2 char *
@ -116,6 +145,15 @@
#define RECV_TYPE_ARG4 long
#define RECV_TYPE_RETV long
#define HAVE_RECVFROM 1
#define RECVFROM_TYPE_ARG1 long
#define RECVFROM_TYPE_ARG2 char
#define RECVFROM_TYPE_ARG3 long
#define RECVFROM_TYPE_ARG4 long
#define RECVFROM_TYPE_ARG5 struct sockaddr
#define RECVFROM_TYPE_ARG6 long
#define RECVFROM_TYPE_RETV long
#define HAVE_SEND 1
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
@ -29,36 +27,41 @@
/* lib/config-dos.h - Hand crafted config file for DOS */
/* ================================================================ */
#ifndef OS
#if defined(DJGPP)
#define OS "MSDOS/djgpp"
#elif defined(__HIGHC__)
#define OS "MSDOS/HighC"
#elif defined(__WATCOMC__)
#define OS "MSDOS/Watcom"
#else
#define OS "MSDOS/?"
#endif
#endif
#define PACKAGE "curl"
#define USE_MANUAL 1
#define HAVE_ARPA_INET_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FREEADDRINFO 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETNAMEINFO 1
#define HAVE_GETPROTOBYNAME 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_IO_H 1
#define HAVE_IOCTL 1
#define HAVE_IOCTL_FIONBIO 1
#define HAVE_IOCTLSOCKET 1
#define HAVE_IOCTLSOCKET_FIONBIO 1
#define HAVE_LIMITS_H 1
#define HAVE_LOCALE_H 1
#define HAVE_LONGLONG 1
#define HAVE_MEMORY_H 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETINET_TCP_H 1
#define HAVE_NET_IF_H 1
#define HAVE_PROCESS_H 1
#define HAVE_RECV 1
#define HAVE_RECVFROM 1
#define HAVE_SELECT 1
#define HAVE_SEND 1
#define HAVE_SETJMP_H 1
@ -70,6 +73,7 @@
#define HAVE_STRICMP 1
#define HAVE_STRTOLL 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_STRUCT_IN6_ADDR 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
@ -79,14 +83,15 @@
#define NEED_MALLOC_H 1
#define RETSIGTYPE void
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_DOUBLE 16
#define SIZEOF_SHORT 2
#define SIZEOF_SIZE_T 4
#define SIZEOF_CURL_OFF_T 4
#define STDC_HEADERS 1
#define TIME_WITH_SYS_TIME 1
/* Qualifiers for send() and recv() */
/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
@ -101,11 +106,39 @@
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV int
#define RECVFROM_TYPE_ARG1 int
#define RECVFROM_TYPE_ARG2 void
#define RECVFROM_TYPE_ARG3 int
#define RECVFROM_TYPE_ARG4 int
#define RECVFROM_TYPE_ARG5 struct sockaddr
#define RECVFROM_TYPE_ARG6 int
#define RECVFROM_TYPE_RETV int
#define RECVFROM_TYPE_ARG2_IS_VOID 1
#define GETNAMEINFO_QUAL_ARG1 const
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
#define GETNAMEINFO_TYPE_ARG2 int
#define GETNAMEINFO_TYPE_ARG46 int
#define GETNAMEINFO_TYPE_ARG7 int
#define BSD
/* CURLDEBUG definition enables memory tracking */
/* #define CURLDEBUG */
/* USE_ZLIB on cmd-line */
#ifdef USE_ZLIB
#define HAVE_ZLIB_H 1
#define HAVE_LIBZ 1
#endif
/* USE_OPENSSL on cmd-line */
#ifdef USE_OPENSSL
#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1
#define HAVE_OPENSSL_ENGINE_H 1
#define OPENSSL_NO_KRB5 1
#endif
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
@ -116,6 +149,8 @@
#define ssize_t int
#endif
#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
/* Target HAVE_x section */
#if defined(DJGPP)
@ -127,6 +162,9 @@
#define HAVE_TERMIOS_H 1
#define HAVE_VARIADIC_MACROS_GCC 1
#elif defined(__WATCOMC__)
#define HAVE_STRCASECMP 1
#elif defined(__HIGHC__)
#define HAVE_SYS_TIME_H 1
#define strerror(e) strerror_s_((e))
@ -140,3 +178,4 @@
#undef byte
#endif /* HEADER_CURL_CONFIG_DOS_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* =================================================================== */
@ -30,20 +28,15 @@
/* On Mac OS X you must run configure to generate curl_config.h file */
/* =================================================================== */
#ifndef OS
#define OS "mac"
#endif
#include <ConditionalMacros.h>
#if TYPE_LONGLONG
#define HAVE_LONGLONG 1
#endif
/* Define if you want the built-in manual */
#define USE_MANUAL 1
#define HAVE_ERRNO_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_UNISTD_H 1
@ -52,24 +45,29 @@
#define HAVE_GETTIMEOFDAY 1
#define HAVE_FCNTL_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_ALLOCA_H 1
#define HAVE_STDLIB_H 1
#define HAVE_TIME_H 1
#define HAVE_UTIME_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_UTIME_H 1
#define HAVE_SYS_IOCTL_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_ALARM 1
#define HAVE_FTRUNCATE 1
#define HAVE_UTIME 1
#define HAVE_SETVBUF 1
#define HAVE_STRFTIME 1
#define HAVE_INET_ADDR 1
#define HAVE_MEMCPY 1
#define HAVE_SELECT 1
#define HAVE_SOCKET 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SIGACTION 1
#define HAVE_SIGNAL_H 1
#define HAVE_SIG_ATOMIC_T 1
#ifdef MACOS_SSL_SUPPORT
# define USE_OPENSSL 1
@ -77,18 +75,24 @@
#define CURL_DISABLE_LDAP 1
#define HAVE_RAND_STATUS 1
#define HAVE_RAND_EGD 1
#define HAVE_IOCTL 1
#define HAVE_IOCTL_FIONBIO 1
#define RETSIGTYPE void
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_SHORT 2
#define SIZEOF_SIZE_T 4
#ifdef HAVE_LONGLONG
#define SIZEOF_CURL_OFF_T 8
#else
#define SIZEOF_CURL_OFF_T 4
#endif
#define HAVE_GETNAMEINFO 1
#define GETNAMEINFO_QUAL_ARG1 const
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
#define GETNAMEINFO_TYPE_ARG2 socklen_t
#define GETNAMEINFO_TYPE_ARG46 size_t
#define GETNAMEINFO_TYPE_ARG7 int
#define HAVE_RECV 1
#define RECV_TYPE_ARG1 int
@ -97,11 +101,21 @@
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV ssize_t
#define HAVE_RECVFROM 1
#define RECVFROM_TYPE_ARG1 int
#define RECVFROM_TYPE_ARG2 void
#define RECVFROM_TYPE_ARG3 size_t
#define RECVFROM_TYPE_ARG4 int
#define RECVFROM_TYPE_ARG5 struct sockaddr
#define RECVFROM_TYPE_ARG6 int
#define RECVFROM_TYPE_RETV ssize_t
#define RECVFROM_TYPE_ARG2_IS_VOID 1
#define HAVE_SEND 1
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
#define SEND_TYPE_ARG2 void *
#define SEND_TYPE_ARG3 size_t
#define SEND_TYPE_ARG3 size_T
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV ssize_t

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
@ -35,10 +33,20 @@
/* Version number of this archive. */
#undef VERSION
/* Define if you have the getpass function. */
#undef HAVE_GETPASS
/* Define cpu-machine-OS */
#ifndef OS
#define OS "OS/400"
#endif
/* Define if you have the gethostbyaddr_r() function with 5 arguments */
#define HAVE_GETHOSTBYADDR_R_5
/* Define if you have the gethostbyaddr_r() function with 7 arguments */
#undef HAVE_GETHOSTBYADDR_R_7
/* Define if you have the gethostbyaddr_r() function with 8 arguments */
#undef HAVE_GETHOSTBYADDR_R_8
/* OS400 supports a 3-argument ASCII version of gethostbyaddr_r(), but its
* prototype is incompatible with the "standard" one (1st argument is not
@ -56,6 +64,9 @@
/* Define if you need the _REENTRANT define for some functions */
#undef NEED_REENTRANT
/* Define if you have the Kerberos4 libraries (including -ldes) */
#undef HAVE_KRB4
/* Define if you want to enable IPv6 support */
#define ENABLE_IPV6
@ -74,32 +85,53 @@
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
/* Define if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H
/* Define if you have the `closesocket' function. */
#undef HAVE_CLOSESOCKET
/* Define if you have the <crypto.h> header file. */
#undef HAVE_CRYPTO_H
/* Define if you have the <des.h> header file. */
#undef HAVE_DES_H
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H
/* Define if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
/* Define if you have the `geteuid' function. */
#define HAVE_GETEUID
/* Define if you have the `gethostbyaddr' function. */
#define HAVE_GETHOSTBYADDR
/* Define if you have the `gethostbyaddr_r' function. */
#define HAVE_GETHOSTBYADDR_R
/* Define if you have the `gethostname' function. */
#define HAVE_GETHOSTNAME
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the `getpass_r' function. */
#undef HAVE_GETPASS_R
/* Define to 1 if you have the getpeername function. */
#define HAVE_GETPEERNAME 1
/* Define if you have the `getpwuid' function. */
#define HAVE_GETPWUID
/* Define to 1 if you have the getsockname function. */
#define HAVE_GETSOCKNAME 1
/* Define if you have the `getservbyname' function. */
#define HAVE_GETSERVBYNAME
/* Define if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY
@ -107,15 +139,39 @@
/* Define if you have the `timeval' struct. */
#define HAVE_STRUCT_TIMEVAL
/* Define if you have the `inet_addr' function. */
#define HAVE_INET_ADDR
/* Define if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define if you have the `krb_get_our_ip_for_realm' function. */
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
/* Define if you have the <krb.h> header file. */
#undef HAVE_KRB_H
/* Define if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the `resolve' library (-lresolve). */
#undef HAVE_LIBRESOLVE
/* Define if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL
/* Define if you have GSS API. */
#define HAVE_GSSAPI
@ -128,27 +184,81 @@
/* Define if you have the MIT gssapi libraries */
#undef HAVE_GSSMIT
/* Define if you have the `ucb' library (-lucb). */
#undef HAVE_LIBUCB
/* Define if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R
/* Define if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H
/* Define if you need the malloc.h header file even with stdlib.h */
/* #define NEED_MALLOC_H 1 */
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <netdb.h> header file. */
#define HAVE_NETDB_H
/* Define if you have the <netinet/if_ether.h> header file. */
#undef HAVE_NETINET_IF_ETHER_H
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H
/* Define if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H
/* Define if you have the <openssl/crypto.h> header file. */
#undef HAVE_OPENSSL_CRYPTO_H
/* Define if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define if you have the <openssl/pem.h> header file. */
#undef HAVE_OPENSSL_PEM_H
/* Define if you have the <openssl/rsa.h> header file. */
#undef HAVE_OPENSSL_RSA_H
/* Define if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define if you have the <openssl/x509.h> header file. */
#undef HAVE_OPENSSL_X509_H
/* Define if you have the <pem.h> header file. */
#undef HAVE_PEM_H
/* Define if you have the `perror' function. */
#define HAVE_PERROR
/* Define if you have the <pwd.h> header file. */
#define HAVE_PWD_H
/* Define if you have the `RAND_egd' function. */
#undef HAVE_RAND_EGD
/* Define if you have the `RAND_screen' function. */
#undef HAVE_RAND_SCREEN
/* Define if you have the `RAND_status' function. */
#undef HAVE_RAND_STATUS
/* Define if you have the <rsa.h> header file. */
#undef HAVE_RSA_H
/* Define if you have the `select' function. */
#define HAVE_SELECT
/* Define if you have the `setvbuf' function. */
#define HAVE_SETVBUF
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the `sigaction' function. */
#define HAVE_SIGACTION
@ -158,6 +268,12 @@
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H
/* Define if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T
/* Define if sig_atomic_t is already defined as volatile. */
#undef HAVE_SIG_ATOMIC_T_VOLATILE
/* Define if you have the `socket' function. */
#define HAVE_SOCKET
@ -187,15 +303,25 @@
/* Define if you have the `strdup' function. */
#define HAVE_STRDUP
/* Define if you have the `strftime' function. */
#define HAVE_STRFTIME
/* Define if you have the <strings.h> header file. */
#define HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H
/* Define if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
/* Define if you have the `strstr' function. */
#define HAVE_STRSTR
/* Define if you have the `strtok_r' function. */
#define HAVE_STRTOK_R
@ -229,6 +355,12 @@
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H
/* Define if you have the `tcgetattr' function. */
#undef HAVE_TCGETATTR
/* Define if you have the `tcsetattr' function. */
#undef HAVE_TCSETATTR
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
@ -238,29 +370,45 @@
/* Define if you have the <time.h> header file. */
#define HAVE_TIME_H
/* Define if you have the `uname' function. */
#undef HAVE_UNAME
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
/* Define if you have the <winsock.h> header file. */
#undef HAVE_WINSOCK_H
/* Define if you have the <x509.h> header file. */
#undef HAVE_X509_H
/* Name of package */
#undef PACKAGE
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 8
/* Define if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG
/* The size of a `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
#define SIZEOF_SIZE_T 8
/* The size of `curl_off_t', as computed by sizeof. */
#define SIZEOF_CURL_OFF_T 8
/* Whether long long constants must be suffixed by LL. */
#define HAVE_LL
/* Define this if you have struct sockaddr_storage */
#define HAVE_STRUCT_SOCKADDR_STORAGE
@ -271,10 +419,6 @@
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME
/* Define to enable HTTP3 support (experimental, requires NGTCP2, QUICHE or
MSH3) */
#undef ENABLE_QUIC
/* Version number of package */
#undef VERSION
@ -293,6 +437,9 @@
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define if you have the ioctl function. */
#define HAVE_IOCTL
/* Define if you have a working ioctl FIONBIO function. */
#define HAVE_IOCTL_FIONBIO
@ -308,6 +455,25 @@
/* Define if you have the ldap_url_parse procedure. */
/* #define HAVE_LDAP_URL_PARSE */ /* Disabled because of an IBM bug. */
/* Define if you have the getnameinfo function. */
/* OS400 has no ASCII version of this procedure: wrapped in setup-os400.h. */
#define HAVE_GETNAMEINFO
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 socklen_t
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Define if you have the recv function. */
#define HAVE_RECV
@ -326,6 +492,30 @@
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV int
/* Define if you have the recvfrom function. */
#define HAVE_RECVFROM
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 int
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 char
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 int
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 int
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV int
/* Define if you have the send function. */
#define HAVE_SEND

View File

@ -1,156 +0,0 @@
#ifndef HEADER_CURL_CONFIG_PLAN9_H
#define HEADER_CURL_CONFIG_PLAN9_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#define BUILDING_LIBCURL 1
#define CURL_CA_BUNDLE "/sys/lib/tls/ca.pem"
#define CURL_CA_PATH "/sys/lib/tls"
#define CURL_STATICLIB 1
#define ENABLE_IPV6 1
#define CURL_DISABLE_LDAP 1
#define NEED_REENTRANT 1
#ifndef OS
#define OS "plan9"
#endif
#define PACKAGE "curl"
#define PACKAGE_NAME "curl"
#define PACKAGE_BUGREPORT "a suitable mailing list: https://curl.se/mail/"
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
#define RANDOM_FILE "/dev/random"
#define VERSION "0.0.0" /* TODO */
#define STDC_HEADERS 1
#ifdef _BITS64
#error not implement
#else
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_OFF_T 8
#define SIZEOF_CURL_OFF_T 4 /* curl_off_t = timediff_t = int */
#define SIZEOF_SIZE_T 4
#define SIZEOF_TIME_T 4
#endif
#define HAVE_RECV 1
#define RECV_TYPE_ARG1 int
#define RECV_TYPE_ARG2 void *
#define RECV_TYPE_ARG3 int
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV int
#define HAVE_SELECT 1
#define HAVE_SEND 1
#define SEND_TYPE_ARG1 int
#define SEND_TYPE_ARG2 void *
#define SEND_QUAL_ARG2
#define SEND_TYPE_ARG3 int
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV int
#define HAVE_ALARM 1
#define HAVE_ARPA_INET_H 1
#define HAVE_BASENAME 1
#define HAVE_BOOL_T 1
#define HAVE_FCNTL 1
#define HAVE_FCNTL_H 1
#define HAVE_FREEADDRINFO 1
#define HAVE_FTRUNCATE 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETEUID 1
#define HAVE_GETHOSTNAME 1
#define HAVE_GETPPID 1
#define HAVE_GETPWUID 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GMTIME_R 1
#define HAVE_INET_NTOP 1
#define HAVE_INET_PTON 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIBGEN_H 1
#define HAVE_LIBZ 1
#define HAVE_LOCALE_H 1
#define HAVE_LONGLONG 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETINET_TCP_H 1
#define HAVE_PWD_H 1
#define HAVE_SYS_SELECT_H 1
#define USE_OPENSSL 1
#define HAVE_PIPE 1
#define HAVE_POLL_FINE 1
#define HAVE_POLL_H 1
#define HAVE_PTHREAD_H 1
#define HAVE_SETJMP_H 1
#define HAVE_SETLOCALE 1
#define HAVE_SIGACTION 1
#define HAVE_SIGNAL 1
#define HAVE_SIGNAL_H 1
#define HAVE_SIGSETJMP 1
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#define HAVE_SOCKET 1
#define HAVE_SSL_GET_SHUTDOWN 1
#define HAVE_STDBOOL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1
#define HAVE_STRING_H 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOLL 1
#define HAVE_STRUCT_TIMEVAL 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_UN_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_TIME_H 1
#define HAVE_UNISTD_H 1
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_POSIX_STRERROR_R 1
#define HAVE_STRERROR_R 1
#define TIME_WITH_SYS_TIME 1
#define USE_MANUAL 1
#define __attribute__(x)
#ifndef __cplusplus
#undef inline
#endif
#endif /* HEADER_CURL_CONFIG_PLAN9_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
@ -34,14 +32,24 @@
/* Version number of this archive. */
#undef VERSION
/* Define if you have the getpass function. */
#undef HAVE_GETPASS
/* Define cpu-machine-OS */
#ifndef OS
#define OS "ARM-RISC OS"
#endif
/* Define if you want the built-in manual */
#define USE_MANUAL
/* Define if you have the gethostbyaddr_r() function with 5 arguments */
#undef HAVE_GETHOSTBYADDR_R_5
/* Define if you have the gethostbyaddr_r() function with 7 arguments */
#undef HAVE_GETHOSTBYADDR_R_7
/* Define if you have the gethostbyaddr_r() function with 8 arguments */
#undef HAVE_GETHOSTBYADDR_R_8
/* Define if you have the gethostbyname_r() function with 3 arguments */
#undef HAVE_GETHOSTBYNAME_R_3
@ -54,6 +62,9 @@
/* Define if you need the _REENTRANT define for some functions */
#undef NEED_REENTRANT
/* Define if you have the Kerberos4 libraries (including -ldes) */
#undef HAVE_KRB4
/* Define if you want to enable IPv6 support */
#undef ENABLE_IPV6
@ -75,12 +86,27 @@
/* Define if you have the alarm function. */
#define HAVE_ALARM
/* Define if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H
/* Define if you have the `closesocket' function. */
#undef HAVE_CLOSESOCKET
/* Define if you have the <crypto.h> header file. */
#undef HAVE_CRYPTO_H
/* Define if you have the <des.h> header file. */
#undef HAVE_DES_H
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H
/* Define if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H
@ -93,54 +119,144 @@
/* Define if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define if you have the `gethostbyaddr' function. */
#define HAVE_GETHOSTBYADDR
/* Define if you have the `gethostbyaddr_r' function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the `gethostbyname_r' function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the `gethostname' function. */
#define HAVE_GETHOSTNAME
/* Define if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H
/* Define if you have the `getpass_r' function. */
#undef HAVE_GETPASS_R
/* Define if you have the `getpwuid' function. */
#undef HAVE_GETPWUID
/* Define if you have the `getservbyname' function. */
#undef HAVE_GETSERVBYNAME
/* Define if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY
/* Define if you have the `timeval' struct. */
#define HAVE_STRUCT_TIMEVAL
/* Define if you have the `inet_addr' function. */
#undef HAVE_INET_ADDR
/* Define if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define if you have the `krb_get_our_ip_for_realm' function. */
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
/* Define if you have the <krb.h> header file. */
#undef HAVE_KRB_H
/* Define if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the `resolve' library (-lresolve). */
#undef HAVE_LIBRESOLVE
/* Define if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL
/* Define if you have the `ucb' library (-lucb). */
#undef HAVE_LIBUCB
/* Define if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H
/* Define if you need the malloc.h header file even with stdlib.h */
/* #define NEED_MALLOC_H 1 */
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <netdb.h> header file. */
#define HAVE_NETDB_H
/* Define if you have the <netinet/if_ether.h> header file. */
#undef HAVE_NETINET_IF_ETHER_H
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H
/* Define if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H
/* Define if you have the <openssl/crypto.h> header file. */
#undef HAVE_OPENSSL_CRYPTO_H
/* Define if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define if you have the <openssl/pem.h> header file. */
#undef HAVE_OPENSSL_PEM_H
/* Define if you have the <openssl/rsa.h> header file. */
#undef HAVE_OPENSSL_RSA_H
/* Define if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define if you have the <openssl/x509.h> header file. */
#undef HAVE_OPENSSL_X509_H
/* Define if you have the <pem.h> header file. */
#undef HAVE_PEM_H
/* Define if you have the `perror' function. */
#undef HAVE_PERROR
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the `RAND_egd' function. */
#undef HAVE_RAND_EGD
/* Define if you have the `RAND_screen' function. */
#undef HAVE_RAND_SCREEN
/* Define if you have the `RAND_status' function. */
#undef HAVE_RAND_STATUS
/* Define if you have the <rsa.h> header file. */
#undef HAVE_RSA_H
/* Define if you have the `select' function. */
#define HAVE_SELECT
/* Define if you have the `setvbuf' function. */
#undef HAVE_SETVBUF
/* Define if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H
/* Define if you have the `sigaction' function. */
#undef HAVE_SIGACTION
@ -150,6 +266,12 @@
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H
/* Define if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T
/* Define if sig_atomic_t is already defined as volatile. */
#undef HAVE_SIG_ATOMIC_T_VOLATILE
/* Define if you have the `socket' function. */
#define HAVE_SOCKET
@ -171,6 +293,9 @@
/* Define if you have the `strdup' function. */
#define HAVE_STRDUP
/* Define if you have the `strftime' function. */
#define HAVE_STRFTIME
/* Define if you have the `stricmp' function. */
#define HAVE_STRICMP
@ -180,6 +305,12 @@
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H
/* Define if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define if you have the `strstr' function. */
#define HAVE_STRSTR
/* Define if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
@ -207,6 +338,12 @@
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H
/* Define if you have the `tcgetattr' function. */
#define HAVE_TCGETATTR
/* Define if you have the `tcsetattr' function. */
#define HAVE_TCSETATTR
/* Define if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H
@ -216,18 +353,36 @@
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the `uname' function. */
#define HAVE_UNAME
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
/* Define if you have the <winsock.h> header file. */
#undef HAVE_WINSOCK_H
/* Define if you have the <x509.h> header file. */
#undef HAVE_X509_H
/* Name of package */
#undef PACKAGE
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long double', as computed by sizeof. */
#undef SIZEOF_LONG_DOUBLE
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
@ -262,12 +417,33 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define if you have the ioctl function. */
#define HAVE_IOCTL
/* Define if you have a working ioctl FIONBIO function. */
#define HAVE_IOCTL_FIONBIO
/* to disable LDAP */
#define CURL_DISABLE_LDAP
/* Define if you have the getnameinfo function. */
#define HAVE_GETNAMEINFO 1
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 size_t
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Define if you have the recv function. */
#define HAVE_RECV 1
@ -286,6 +462,33 @@
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV ssize_t
/* Define 1 if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 int
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 void
/* Define if the type pointed by arg 2 for recvfrom is void. */
#define RECVFROM_TYPE_ARG2_IS_VOID
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 size_t
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 int
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV ssize_t
/* Define if you have the send function. */
#define HAVE_SEND 1

811
r5dev/thirdparty/curl/config-symbian.h vendored Normal file
View File

@ -0,0 +1,811 @@
#ifndef HEADER_CURL_CONFIG_SYMBIAN_H
#define HEADER_CURL_CONFIG_SYMBIAN_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* ================================================================ */
/* Hand crafted config file for Symbian */
/* ================================================================ */
/* Location of default ca bundle */
/* #define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt"*/
/* Location of default ca path */
/* #undef CURL_CA_PATH */
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
/* to disable cryptographic authentication */
/* #undef CURL_DISABLE_CRYPTO_AUTH */
/* to disable DICT */
/* #undef CURL_DISABLE_DICT */
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
/* to disable FTP */
/* #undef CURL_DISABLE_FTP */
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
/* to disable TELNET */
/* #undef CURL_DISABLE_TELNET */
/* to disable TFTP */
/* #undef CURL_DISABLE_TFTP */
/* to disable verbose strings */
/* #define CURL_DISABLE_VERBOSE_STRINGS 1*/
/* Definition to make a library symbol externally visible. */
/* #undef CURL_EXTERN_SYMBOL */
/* Use Windows LDAP implementation */
/* #undef USE_WIN32_LDAP */
/* your Entropy Gathering Daemon socket pathname */
/* #undef EGD_SOCKET */
/* Define if you want to enable IPv6 support */
#define ENABLE_IPV6 1
/* Define if struct sockaddr_in6 has the sin6_scope_id member */
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 size_t
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Define to 1 if you have the <alloca.h> header file. */
/*#define HAVE_ALLOCA_H 1*/
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/*#define HAVE_ARPA_TFTP_H 1*/
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the `basename' function. */
/*#define HAVE_BASENAME 1*/
/* Define to 1 if bool is an available type. */
/*#define HAVE_BOOL_T 1*/
/* Define to 1 if you have the `closesocket' function. */
/* #undef HAVE_CLOSESOCKET */
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
/*#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1*/
/* Define to 1 if you have the <crypto.h> header file. */
/* #undef HAVE_CRYPTO_H */
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
/*#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1*/
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <err.h> header file. */
#define HAVE_ERR_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the fcntl function. */
#define HAVE_FCNTL 1
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#define HAVE_FCNTL_O_NONBLOCK 1
/* Define to 1 if you have the `fork' function. */
/*#define HAVE_FORK 1*/
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define if getaddrinfo exists and works */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
/* Define to 1 if you have the `gethostbyaddr' function. */
#define HAVE_GETHOSTBYADDR 1
/* If you have gethostbyname */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the `gethostbyname_r' function. */
/* #undef HAVE_GETHOSTBYNAME_R */
/* gethostbyname_r() takes 3 args */
/* #undef HAVE_GETHOSTBYNAME_R_3 */
/* gethostbyname_r() takes 5 args */
/* #undef HAVE_GETHOSTBYNAME_R_5 */
/* gethostbyname_r() takes 6 args */
/* #undef HAVE_GETHOSTBYNAME_R_6 */
/* Define to 1 if you have the getnameinfo function. */
#define HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getpass_r' function. */
/* #undef HAVE_GETPASS_R */
/* Define to 1 if you have the `getppid' function. */
#define HAVE_GETPPID 1
/* Define to 1 if you have the `getprotobyname' function. */
#define HAVE_GETPROTOBYNAME 1
/* Define to 1 if you have the `getpwuid' function. */
#define HAVE_GETPWUID 1
/* Define to 1 if you have the `getrlimit' function. */
/*#define HAVE_GETRLIMIT 1*/
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* we have a glibc-style strerror_r() */
/* #undef HAVE_GLIBC_STRERROR_R */
/* Define to 1 if you have the `gmtime_r' function. */
#define HAVE_GMTIME_R 1
/* if you have the gssapi libraries */
/* #undef HAVE_GSSAPI */
/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_H */
/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */
/* if you have the GNU gssapi libraries */
/* #undef HAVE_GSSGNU */
/* if you have the Heimdal gssapi libraries */
/* #undef HAVE_GSSHEIMDAL */
/* if you have the MIT gssapi libraries */
/* #undef HAVE_GSSMIT */
/* Define to 1 if you have the `idna_strerror' function. */
/*#define HAVE_IDNA_STRERROR 1*/
/* Define to 1 if you have the `idn_free' function. */
/*#define HAVE_IDN_FREE 1*/
/* Define to 1 if you have the <idn-free.h> header file. */
/*#define HAVE_IDN_FREE_H 1*/
/* Define to 1 if you have the `inet_addr' function. */
/*#define HAVE_INET_ADDR 1*/
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
/*#define HAVE_INET_NTOP 1*/
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
/*#define HAVE_INET_PTON 1*/
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the ioctl function. */
#define HAVE_IOCTL 1
/* Define to 1 if you have a working ioctl FIONBIO function. */
#define HAVE_IOCTL_FIONBIO 1
/* Define to 1 if you have the ioctlsocket function. */
/* #undef HAVE_IOCTLSOCKET */
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
/* #undef HAVE_IOCTLSOCKET_FIONBIO */
/* Define to 1 if you have the IoctlSocket camel case function. */
/* #undef HAVE_IOCTLSOCKET_CAMEL */
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO
function. */
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* if you have the Kerberos4 libraries (including -ldes) */
/* #undef HAVE_KRB4 */
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */
/* Define to 1 if you have the <krb.h> header file. */
/* #undef HAVE_KRB_H */
/* Define to 1 if you have the lber.h header file. */
/*#define HAVE_LBER_H 1*/
/* Define to 1 if you have the ldapssl.h header file. */
/* #undef HAVE_LDAPSSL_H */
/* Define to 1 if you have the ldap.h header file. */
/*#define HAVE_LDAP_H 1*/
/* Use LDAPS implementation */
/*#define HAVE_LDAP_SSL 1*/
/* Define to 1 if you have the ldap_ssl.h header file. */
/* #undef HAVE_LDAP_SSL_H */
/* Define to 1 if you have the `ldap_url_parse' function. */
/*#define HAVE_LDAP_URL_PARSE 1*/
/* Define to 1 if you have the <libgen.h> header file. */
/*#define HAVE_LIBGEN_H 1*/
/* Define to 1 if you have the `idn' library (-lidn). */
/*#define HAVE_LIBIDN 1*/
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `resolve' library (-lresolve). */
/* #undef HAVE_LIBRESOLVE */
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define to 1 if you have the `ssh2' library (-lssh2). */
/*#define HAVE_LIBSSH2 1*/
/* Define to 1 if you have the <libssh2.h> header file. */
/*#define HAVE_LIBSSH2_H 1*/
/* Define to 1 if you have the `ssl' library (-lssl). */
/*#define HAVE_LIBSSL 1*/
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* if your compiler supports LL */
#define HAVE_LL 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
/* Define to 1 if you have the malloc.h header file. */
/*#define HAVE_MALLOC_H 1*/
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
/*#define HAVE_MSG_NOSIGNAL 1*/
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/*#define HAVE_NETINET_TCP_H 1*/
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if NI_WITHSCOPEID exists and works. */
/*#define HAVE_NI_WITHSCOPEID 1*/
/* we have no strerror_r() proto */
/* #undef HAVE_NO_STRERROR_R_DECL */
/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE
*/
/* #undef HAVE_OLD_GSSMIT */
/* Define to 1 if you have the <openssl/crypto.h> header file. */
/*#define HAVE_OPENSSL_CRYPTO_H 1*/
/* Define to 1 if you have the <openssl/engine.h> header file. */
/*#define HAVE_OPENSSL_ENGINE_H 1*/
/* Define to 1 if you have the <openssl/err.h> header file. */
/*#define HAVE_OPENSSL_ERR_H 1*/
/* Define to 1 if you have the <openssl/pem.h> header file. */
/*#define HAVE_OPENSSL_PEM_H 1*/
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
/*#define HAVE_OPENSSL_PKCS12_H 1*/
/* Define to 1 if you have the <openssl/rsa.h> header file. */
/*#define HAVE_OPENSSL_RSA_H 1*/
/* Define to 1 if you have the <openssl/ssl.h> header file. */
/*#define HAVE_OPENSSL_SSL_H 1*/
/* Define to 1 if you have the <openssl/x509.h> header file. */
/*#define HAVE_OPENSSL_X509_H 1*/
/* Define to 1 if you have the <pem.h> header file. */
/* #undef HAVE_PEM_H */
/* Define to 1 if you have the `perror' function. */
#define HAVE_PERROR 1
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* Define to 1 if you have the `poll' function. */
/*#define HAVE_POLL 1*/
/* If you have a fine poll */
/*#define HAVE_POLL_FINE 1*/
/* Define to 1 if you have the <poll.h> header file. */
/*#define HAVE_POLL_H 1*/
/* we have a POSIX-style strerror_r() */
#define HAVE_POSIX_STRERROR_R 1
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define to 1 if you have the `RAND_egd' function. */
#define HAVE_RAND_EGD 1
/* Define to 1 if you have the `RAND_screen' function. */
/* #undef HAVE_RAND_SCREEN */
/* Define to 1 if you have the `RAND_status' function. */
/*#define HAVE_RAND_STATUS 1*/
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
/* Define to 1 if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to 1 if you have the <rsa.h> header file. */
/* #undef HAVE_RSA_H */
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setmode' function. */
/* #undef HAVE_SETMODE */
/* Define to 1 if you have the `setrlimit' function. */
/*#define HAVE_SETRLIMIT 1*/
/* Define to 1 if you have the setsockopt function. */
/* #undef HAVE_SETSOCKOPT */
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
/* Define to 1 if you have the <sgtty.h> header file. */
/*#define HAVE_SGTTY_H 1*/
/* Define to 1 if you have the `sigaction' function. */
/*#define HAVE_SIGACTION 1*/
/* Define to 1 if you have the `siginterrupt' function. */
/*#define HAVE_SIGINTERRUPT 1*/
/* Define to 1 if you have the `signal' function. */
/*#define HAVE_SIGNAL 1*/
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* If you have sigsetjmp */
/*#define HAVE_SIGSETJMP 1*/
/* Define to 1 if sig_atomic_t is an available typedef. */
/*#define HAVE_SIG_ATOMIC_T 1*/
/* Define to 1 if sig_atomic_t is already defined as volatile. */
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the `SSL_get_shutdown' function. */
/*#define HAVE_SSL_GET_SHUTDOWN 1*/
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strcmpi' function. */
/* #undef HAVE_STRCMPI */
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the `stricmp' function. */
/* #undef HAVE_STRICMP */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the `strtok_r' function. */
#define HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* if struct sockaddr_storage is defined */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/filio.h> header file. */
#define HAVE_SYS_FILIO_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
/*#define HAVE_SYS_POLL_H 1*/
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
#define HAVE_SYS_SOCKIO_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
/* #undef HAVE_SYS_UTIME_H */
/* Define to 1 if you have the <termios.h> header file. */
/*#define HAVE_TERMIOS_H 1*/
/* Define to 1 if you have the <termio.h> header file. */
/*#define HAVE_TERMIO_H 1*/
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <tld.h> header file. */
/*#define HAVE_TLD_H 1*/
/* Define to 1 if you have the `tld_strerror' function. */
/*#define HAVE_TLD_STRERROR 1*/
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if compiler supports C99 variadic macro style. */
#define HAVE_VARIADIC_MACROS_C99 1
/* Define to 1 if compiler supports old gcc variadic macro style. */
/*#define HAVE_VARIADIC_MACROS_GCC 1*/
/* Define to 1 if you have the winber.h header file. */
/* #undef HAVE_WINBER_H */
/* Define to 1 if you have the windows.h header file. */
/* #undef HAVE_WINDOWS_H */
/* Define to 1 if you have the winldap.h header file. */
/* #undef HAVE_WINLDAP_H */
/* Define to 1 if you have the winsock2.h header file. */
/* #undef HAVE_WINSOCK2_H */
/* Define to 1 if you have the winsock.h header file. */
/* #undef HAVE_WINSOCK_H */
/* Define this symbol if your OS supports changing the contents of argv */
/*#define HAVE_WRITABLE_ARGV 1*/
/* Define to 1 if you have the ws2tcpip.h header file. */
/* #undef HAVE_WS2TCPIP_H */
/* Define to 1 if you have the <x509.h> header file. */
/* #undef HAVE_X509_H */
/* Define to 1 if you need the lber.h header file even with ldap.h */
/* #undef NEED_LBER_H */
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
/* #undef NEED_MALLOC_H */
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
/* #undef NEED_REENTRANT */
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
/* #undef NEED_THREAD_SAFE */
/* cpu-machine-OS */
#ifdef __WINS__
#define OS "i386-pc-epoc32"
#elif __MARM__
#define OS "arm-unknown-epoc32"
#else
/* This won't happen on any current Symbian version */
#define OS "unknown-unknown-epoc32"
#endif
/* Name of package */
/*#define PACKAGE "curl"*/
/* Define to the address where bug reports for this package should be sent. */
/*#define PACKAGE_BUGREPORT \
"a suitable curl mailing list => https://curl.haxx.se/mail/"*/
/* Define to the full name of this package. */
/*#define PACKAGE_NAME "curl"*/
/* Define to the full name and version of this package. */
/*#define PACKAGE_STRING "curl -"*/
/* Define to the one symbol short name of this package. */
/*#define PACKAGE_TARNAME "curl"*/
/* Define to the version of this package. */
/*#define PACKAGE_VERSION "-"*/
/* a suitable file to read random data from */
/*#define RANDOM_FILE "/dev/urandom"*/
#define RECV_TYPE_ARG1 int
#define RECV_TYPE_ARG2 void *
#define RECV_TYPE_ARG3 size_t
#define RECV_TYPE_ARG4 int
#define RECV_TYPE_RETV ssize_t
#define RECVFROM_TYPE_ARG1 int
#define RECVFROM_TYPE_ARG2 void
#define RECVFROM_TYPE_ARG3 size_t
#define RECVFROM_TYPE_ARG4 int
#define RECVFROM_TYPE_ARG5 struct sockaddr
#define RECVFROM_TYPE_ARG6 size_t
#define RECVFROM_TYPE_RETV ssize_t
#define RECVFROM_TYPE_ARG2_IS_VOID 1
#define SEND_TYPE_ARG1 int
#define SEND_QUAL_ARG2 const
#define SEND_TYPE_ARG2 void *
#define SEND_TYPE_ARG3 size_t
#define SEND_TYPE_ARG4 int
#define SEND_TYPE_RETV ssize_t
/* Define as the return type of signal handlers (`int' or `void'). */
/*#define RETSIGTYPE void*/
/* Define to the type of arg 1 for `select'. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for `select'. */
#define SELECT_TYPE_ARG234 (fd_set *)
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if you want to enable c-ares support */
/* #undef USE_ARES */
/* Define to disable non-blocking sockets */
/* #undef USE_BLOCKING_SOCKETS */
/* if GnuTLS is enabled */
/* #undef USE_GNUTLS */
/* if libSSH2 is in use */
/*#define USE_LIBSSH2 1*/
/* If you want to build curl with the built-in manual */
/*#define USE_MANUAL 1*/
/* if NSS is enabled */
/* #undef USE_NSS */
/* to enable SSPI support */
/* #undef USE_WINDOWS_SSPI */
/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */
/* #undef USE_YASSLEMUL */
/* Version number of package */
/*#define VERSION "7.18.2-CVS"*/
/* Define to avoid automatic inclusion of winsock.h */
/* #undef WIN32_LEAN_AND_MEAN */
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* type to use in place of in_addr_t if not defined */
/* #undef in_addr_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* the signed version of size_t */
/* #undef ssize_t */
/* Enabling curl debug mode when building in Symbian debug mode would work */
/* except that debug mode introduces new exports that must be frozen. */
#ifdef _DEBUG
/* #define CURLDEBUG */
#endif
/* sys/cdefs.h fails to define this for WINSCW prior to Symbian OS ver. 9.4 */
#ifndef __LONG_LONG_SUPPORTED
#define __LONG_LONG_SUPPORTED
#endif
/* Enable appropriate header only when zlib support is enabled */
#ifdef HAVE_LIBZ
#define HAVE_ZLIB_H 1
#endif
#endif /* HEADER_CURL_CONFIG_SYMBIAN_H */

772
r5dev/thirdparty/curl/config-tpf.h vendored Normal file
View File

@ -0,0 +1,772 @@
#ifndef HEADER_CURL_CONFIG_TPF_H
#define HEADER_CURL_CONFIG_TPF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* ================================================================ */
/* Hand crafted config file for TPF */
/* ================================================================ */
/* ---------------------------------------------------------------- */
/* FEATURES, FUNCTIONS, and DEFINITIONS */
/* ---------------------------------------------------------------- */
/* NOTE: Refer also to the .mak file for some of the flags below */
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
/* to disable cryptographic authentication */
/* #undef CURL_DISABLE_CRYPTO_AUTH */
/* to disable DICT */
/* #undef CURL_DISABLE_DICT */
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
/* to disable FTP */
/* #undef CURL_DISABLE_FTP */
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
/* to disable LDAP */
/* #undef CURL_DISABLE_LDAP */
/* to disable TELNET */
/* #undef CURL_DISABLE_TELNET */
/* to disable TFTP */
/* #undef CURL_DISABLE_TFTP */
/* to disable verbose strings */
/* #undef CURL_DISABLE_VERBOSE_STRINGS */
/* lber dynamic library file */
/* #undef DL_LBER_FILE */
/* ldap dynamic library file */
/* #undef DL_LDAP_FILE */
/* your Entropy Gathering Daemon socket pathname */
/* #undef EGD_SOCKET */
/* Define if you want to enable IPv6 support */
/* #undef ENABLE_IPV6 */
/* Define if struct sockaddr_in6 has the sin6_scope_id member */
/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */
/* Define to the type of arg 1 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG1 */
/* Define to the type of arg 2 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG2 */
/* Define to the type of args 4 and 6 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG46 */
/* Define to the type of arg 7 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG7 */
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* #undef HAVE_ARPA_TFTP_H */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the `basename' function. */
#define HAVE_BASENAME 1
/* Define to 1 if you have the `closesocket' function. */
/* #undef HAVE_CLOSESOCKET */
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
/* #undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA */
#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1
/* Define to 1 if you have the <crypto.h> header file. */
/* #undef HAVE_CRYPTO_H */
#define HAVE_CRYPTO_H 1
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
#define HAVE_DES_H 1
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
/* #undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <err.h> header file. */
/* #undef HAVE_ERR_H */
#define HAVE_ERR_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the fcntl function. */
#define HAVE_FCNTL 1
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#define HAVE_FCNTL_O_NONBLOCK 1
/* Define to 1 if you have the `fork' function. */
/* #undef HAVE_FORK */
#define HAVE_FORK 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define if getaddrinfo exists and works */
/* #undef HAVE_GETADDRINFO */
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 1
/* Define to 1 if you have the `gethostbyaddr' function. */
#define HAVE_GETHOSTBYADDR 1
/* If you have gethostbyname */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the `gethostbyname_r' function. */
/* #undef HAVE_GETHOSTBYNAME_R */
/* gethostbyname_r() takes 3 args */
/* #undef HAVE_GETHOSTBYNAME_R_3 */
/* gethostbyname_r() takes 5 args */
/* #undef HAVE_GETHOSTBYNAME_R_5 */
/* gethostbyname_r() takes 6 args */
/* #undef HAVE_GETHOSTBYNAME_R_6 1 */
/* Define to 1 if you have the getnameinfo function. */
/* #undef HAVE_GETNAMEINFO */
/* Define to 1 if you have the `getpass_r' function. */
/* #undef HAVE_GETPASS_R */
/* Define to 1 if you have the `getprotobyname' function. */
/* #undef HAVE_GETPROTOBYNAME */
/* Define to 1 if you have the `getpwuid' function. */
#define HAVE_GETPWUID 1
/* Define to 1 if you have the `getrlimit' function. */
/* #undef HAVE_GETRLIMIT */
/* Define to 1 if you have the `gettimeofday' function. */
#define HAVE_GETTIMEOFDAY 1
/* we have a glibc-style strerror_r() */
/* #undef HAVE_GLIBC_STRERROR_R */
#define HAVE_GLIBC_STRERROR_R 1
/* Define to 1 if you have the `gmtime_r' function. */
#define HAVE_GMTIME_R 1
/* if you have the gssapi libraries */
/* #undef HAVE_GSSAPI */
/* if you have the GNU gssapi libraries */
/* #undef HAVE_GSSGNU */
/* if you have the Heimdal gssapi libraries */
/* #undef HAVE_GSSHEIMDAL */
/* if you have the MIT gssapi libraries */
/* #undef HAVE_GSSMIT */
/* Define to 1 if you have the `iconv' functions. */
#define HAVE_ICONV 1
/* Define to 1 if you have the `idna_strerror' function. */
/* #undef HAVE_IDNA_STRERROR */
/* Define to 1 if you have the `idn_free' function. */
/* #undef HAVE_IDN_FREE */
/* Define to 1 if you have the <idn-free.h> header file. */
/* #undef HAVE_IDN_FREE_H */
/* Define to 1 if you have the `inet_addr' function. */
#define HAVE_INET_ADDR 1
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
/* #undef HAVE_INET_NTOP */
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
/* #undef HAVE_INET_PTON */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the ioctl function. */
#define HAVE_IOCTL 1
/* Define to 1 if you have a working ioctl FIONBIO function. */
#define HAVE_IOCTL_FIONBIO 1
/* Define to 1 if you have the ioctlsocket function. */
/* #undef HAVE_IOCTLSOCKET */
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
/* #undef HAVE_IOCTLSOCKET_FIONBIO */
/* Define to 1 if you have the IoctlSocket camel case function. */
/* #undef HAVE_IOCTLSOCKET_CAMEL */
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO
function. */
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
/* Define to 1 if you have the <io.h> header file. */
/* #undef HAVE_IO_H */
/* if you have the Kerberos4 libraries (including -ldes) */
/* #undef HAVE_KRB4 */
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */
/* Define to 1 if you have the <krb.h> header file. */
/* #undef HAVE_KRB_H */
/* Define to 1 if you have the <libgen.h> header file. */
/* #undef HAVE_LIBGEN_H 1 */
/* Define to 1 if you have the `idn' library (-lidn). */
/* #undef HAVE_LIBIDN */
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `resolve' library (-lresolve). */
/* #undef HAVE_LIBRESOLVE */
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define to 1 if you have the `ssl' library (-lssl). */
/* #undef HAVE_LIBSSL */
#define HAVE_LIBSSL 1
/* if zlib is available */
/* #undef HAVE_LIBZ */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* if your compiler supports LL */
#define HAVE_LL 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have the `localtime_r' function. */
#define HAVE_LOCALTIME_R 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
/* #undef NEED_MALLOC_H */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
/* undef HAVE_NETINET_TCP_H */
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define if NI_WITHSCOPEID exists and works */
/* #undef HAVE_NI_WITHSCOPEID */
/* we have no strerror_r() proto */
/* #undef HAVE_NO_STRERROR_R_DECL */
/* Define to 1 if you have the <openssl/crypto.h> header file. */
/* #undef HAVE_OPENSSL_CRYPTO_H */
#define HAVE_OPENSSL_CRYPTO_H 1
/* Define to 1 if you have the <openssl/engine.h> header file. */
/* #undef HAVE_OPENSSL_ENGINE_H */
#define HAVE_OPENSSL_ENGINE_H 1
/* Define to 1 if you have the <openssl/err.h> header file. */
/* #undef HAVE_OPENSSL_ERR_H */
#define HAVE_OPENSSL_ERR_H 1
/* Define to 1 if you have the <openssl/pem.h> header file. */
/* #undef HAVE_OPENSSL_PEM_H */
#define HAVE_OPENSSL_PEM_H 1
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
/* #undef HAVE_OPENSSL_PKCS12_H */
#define HAVE_OPENSSL_PKCS12_H 1
/* Define to 1 if you have the <openssl/rsa.h> header file. */
/* #undef HAVE_OPENSSL_RSA_H */
#define HAVE_OPENSSL_RSA_H 1
/* Define to 1 if you have the <openssl/ssl.h> header file. */
/* #undef HAVE_OPENSSL_SSL_H */
#define HAVE_OPENSSL_SSL_H 1
/* Define to 1 if you have the <openssl/x509.h> header file. */
/* #undef HAVE_OPENSSL_X509_H */
#define HAVE_OPENSSL_X509_H 1
/* Define to 1 if you have the <pem.h> header file. */
/* #undef HAVE_PEM_H */
#define HAVE_PEM_H 1
/* Define to 1 if you have the `perror' function. */
#define HAVE_PERROR 1
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* Define to 1 if you have the `poll' function. */
/* #undef HAVE_POLL */
/* If you have a fine poll */
/* #undef HAVE_POLL_FINE */
/* we have a POSIX-style strerror_r() */
/* #undef HAVE_POSIX_STRERROR_R */
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define to 1 if you have the `RAND_egd' function. */
/* #undef HAVE_RAND_EGD */
#define HAVE_RAND_EGD 1
/* Define to 1 if you have the `RAND_screen' function. */
/* #undef HAVE_RAND_SCREEN */
/* Define to 1 if you have the `RAND_status' function. */
/* #undef HAVE_RAND_STATUS */
#define HAVE_RAND_STATUS 1
/* Define to 1 if you have the <rsa.h> header file. */
/* #undef HAVE_RSA_H */
#define HAVE_RSA_H 1
/* Define to 1 if you have the `select' function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* Define to 1 if you have the setsockopt function. */
/* #undef HAVE_SETSOCKOPT */
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
/* Define to 1 if you have the <sgtty.h> header file. */
/* #undef HAVE_SGTTY_H 1 */
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* Define to 1 if you have the `siginterrupt' function. */
/* #undef HAVE_SIGINTERRUPT */
/* Define to 1 if you have the `signal' function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1
/* Define to 1 if sig_atomic_t is already defined as volatile. */
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
/* If you have sigsetjmp */
/* #undef HAVE_SIGSETJMP */
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
#define HAVE_SSL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strcmpi' function. */
/* #undef HAVE_STRCMPI */
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror_r' function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the `stricmp' function. */
/* #undef HAVE_STRICMP */
#define HAVE_STRICMP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the `strtok_r' function. */
#define HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* if struct sockaddr_storage is defined */
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */
/* Define this if you have struct timeval */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/filio.h> header file. */
#define HAVE_SYS_FILIO_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/poll.h> header file. */
/* #undef HAVE_SYS_POLL_H */
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
#define HAVE_SYS_SOCKIO_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
/* #undef HAVE_SYS_UTIME_H */
/* Define to 1 if you have the <termios.h> header file. */
/* #undef HAVE_TERMIOS_H */
/* Define to 1 if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <tld.h> header file. */
/* #undef HAVE_TLD_H */
/* Define to 1 if you have the `tld_strerror' function. */
/* #undef HAVE_TLD_STRERROR */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if you have the <winsock2.h> header file. */
/* #undef HAVE_WINSOCK2_H */
/* Define to 1 if you have the <winsock.h> header file. */
/* #undef HAVE_WINSOCK_H */
/* Define this symbol if your OS supports changing the contents of argv */
/* #undef HAVE_WRITABLE_ARGV */
/* Define to 1 if you have the ws2tcpip.h header file. */
/* #undef HAVE_WS2TCPIP_H */
/* Define to 1 if you have the <x509.h> header file. */
/* #undef HAVE_X509_H */
/* if you have the zlib.h header file */
/* #undef HAVE_ZLIB_H */
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
/* #undef NEED_REENTRANT */
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
/* #undef NEED_THREAD_SAFE */
/* cpu-machine-OS */
#define OS "s390x-ibm-tpf"
/* Name of package */
#define PACKAGE "curl"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT \
"a suitable curl mailing list => https://curl.haxx.se/mail/"
/* Define to the full name of this package. */
#define PACKAGE_NAME "curl"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "curl -"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "curl"
/* Define to the version of this package. */
#define PACKAGE_VERSION "-"
/* a suitable file to read random data from */
/* #undef RANDOM_FILE */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to the type of arg 1 for `select'. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for `select'. */
#define SELECT_TYPE_ARG234 (fd_set *)
/* Define to the type of arg 5 for `select'. */
#define SELECT_TYPE_ARG5 (struct timeval *)
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 8
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 8
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if you want to enable ares support */
/* #undef USE_ARES */
/* Define to disable non-blocking sockets */
/* #undef USE_BLOCKING_SOCKETS */
/* if GnuTLS is enabled */
/* #undef USE_GNUTLS */
/* If you want to build curl with the built-in manual */
/* #undef USE_MANUAL */
/* if OpenSSL is in use */
/* #undef USE_OPENSSL */
/* if SSL is enabled */
/* #undef USE_OPENSSL */
/* to enable SSPI support */
/* #undef USE_WINDOWS_SSPI */
/* Version number of package */
#define VERSION "not-used"
/* Define to avoid automatic inclusion of winsock.h */
/* #undef WIN32_LEAN_AND_MEAN */
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* type to use in place of in_addr_t if not defined */
/* #undef in_addr_t */
/* Define to `unsigned' if <sys/types.h> does not define. */
/* #undef size_t */
/* the signed version of size_t */
/* #undef ssize_t */
/* Define to 1 if you have the getnameinfo function. */
/* #undef HAVE_GETNAMEINFO 1 */
/* Define to the type qualifier of arg 1 for getnameinfo. */
/* #undef GETNAMEINFO_QUAL_ARG1 const */
/* Define to the type of arg 1 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG1 struct sockaddr * */
/* Define to the type of arg 2 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG2 socklen_t */
/* Define to the type of args 4 and 6 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG46 size_t */
/* Define to the type of arg 7 for getnameinfo. */
/* #undef GETNAMEINFO_TYPE_ARG7 int */
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
/* Define to the type of arg 1 for recv. */
#define RECV_TYPE_ARG1 int
/* Define to the type of arg 2 for recv. */
#define RECV_TYPE_ARG2 char *
/* Define to the type of arg 3 for recv. */
#define RECV_TYPE_ARG3 int
/* Define to the type of arg 4 for recv. */
#define RECV_TYPE_ARG4 int
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV int
/* Define to 1 if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 int
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 char
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 int
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 int
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV int
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
/* Define to the type of arg 1 for send. */
#define SEND_TYPE_ARG1 int
/* Define to the type qualifier of arg 2 for send. */
#define SEND_QUAL_ARG2 const
/* Define to the type of arg 2 for send. */
#define SEND_TYPE_ARG2 char *
/* Define to the type of arg 3 for send. */
#define SEND_TYPE_ARG3 int
/* Define to the type of arg 4 for send. */
#define SEND_TYPE_ARG4 int
/* Define to the function return type for send. */
#define SEND_TYPE_RETV int
#define CURL_DOES_CONVERSIONS
#ifndef CURL_ICONV_CODESET_OF_HOST
#define CURL_ICONV_CODESET_OF_HOST "IBM-1047"
#endif
#endif /* HEADER_CURL_CONFIG_TPF_H */

928
r5dev/thirdparty/curl/config-vxworks.h vendored Normal file
View File

@ -0,0 +1,928 @@
#ifndef HEADER_CURL_CONFIG_VXWORKS_H
#define HEADER_CURL_CONFIG_VXWORKS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
/* =============================================================== */
/* Hand crafted config file for VxWorks */
/* =============================================================== */
/* Location of default ca bundle */
/* #undef CURL_CA_BUNDLE */
/* Location of default ca path */
/* #undef CURL_CA_PATH */
/* to disable cookies support */
/* #undef CURL_DISABLE_COOKIES */
/* to disable cryptographic authentication */
/* #undef CURL_DISABLE_CRYPTO_AUTH */
/* to disable DICT */
/* #undef CURL_DISABLE_DICT */
/* to disable FILE */
/* #undef CURL_DISABLE_FILE */
/* to disable FTP */
#define CURL_DISABLE_FTP 1
/* to disable HTTP */
/* #undef CURL_DISABLE_HTTP */
/* to disable LDAP */
#define CURL_DISABLE_LDAP 1
/* to disable LDAPS */
#define CURL_DISABLE_LDAPS 1
/* to disable NTLM authentication */
#define CURL_DISABLE_NTLM 1
/* to disable proxies */
/* #undef CURL_DISABLE_PROXY */
/* to disable TELNET */
#define CURL_DISABLE_TELNET 1
/* to disable TFTP */
#define CURL_DISABLE_TFTP 1
/* to disable verbose strings */
/* #undef CURL_DISABLE_VERBOSE_STRINGS */
/* Definition to make a library symbol externally visible. */
/* #undef CURL_EXTERN_SYMBOL */
/* Use Windows LDAP implementation */
/* #undef USE_WIN32_LDAP */
/* your Entropy Gathering Daemon socket pathname */
/* #undef EGD_SOCKET */
/* Define if you want to enable IPv6 support */
#define ENABLE_IPV6 1
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 size_t
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 unsigned int
/* Specifies the number of arguments to getservbyport_r */
#define GETSERVBYPORT_R_ARGS 6
/* Specifies the size of the buffer to pass to getservbyport_r */
#define GETSERVBYPORT_R_BUFSIZE 4096
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
/* Define to 1 if you have the <alloca.h> header file. */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/tftp.h> header file. */
/* #undef HAVE_ARPA_TFTP_H */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the `basename' function. */
/* #undef HAVE_BASENAME */
/* Define to 1 if bool is an available type. */
#define HAVE_BOOL_T 1
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */
/* Define to 1 if you have the `closesocket' function. */
/* #undef HAVE_CLOSESOCKET */
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1
/* Define to 1 if you have the <crypto.h> header file. */
/* #undef HAVE_CRYPTO_H */
/* Define to 1 if you have the <des.h> header file. */
/* #undef HAVE_DES_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <err.h> header file. */
/* #undef HAVE_ERR_H */
/* Define to 1 if you have the fcntl function. */
#define HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#define HAVE_FCNTL_O_NONBLOCK 1
/* Define to 1 if you have the fdopen function. */
#define HAVE_FDOPEN 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the freeaddrinfo function. */
#define HAVE_FREEADDRINFO 1
/* Define to 1 if you have the freeifaddrs function. */
#define HAVE_FREEIFADDRS 1
/* Define to 1 if you have the ftruncate function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have a working getaddrinfo function. */
#define HAVE_GETADDRINFO 1
/* Define to 1 if you have the `geteuid' function. */
/* #undef HAVE_GETEUID */
/* Define to 1 if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
/* Define to 1 if you have the gethostbyaddr_r function. */
#define HAVE_GETHOSTBYADDR_R 1
/* gethostbyaddr_r() takes 5 args */
/* #undef HAVE_GETHOSTBYADDR_R_5 */
/* gethostbyaddr_r() takes 7 args */
/* #undef HAVE_GETHOSTBYADDR_R_7 */
/* gethostbyaddr_r() takes 8 args */
#define HAVE_GETHOSTBYADDR_R_8 1
/* Define to 1 if you have the gethostbyname function. */
#define HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the gethostbyname_r function. */
/* #undef HAVE_GETHOSTBYNAME_R */
/* gethostbyname_r() takes 3 args */
/* #undef HAVE_GETHOSTBYNAME_R_3 */
/* gethostbyname_r() takes 5 args */
/* #undef HAVE_GETHOSTBYNAME_R_5 */
/* gethostbyname_r() takes 6 args */
/* #undef HAVE_GETHOSTBYNAME_R_6 */
/* Define to 1 if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
/* Define to 1 if you have a working getifaddrs function. */
/* #undef HAVE_GETIFADDRS */
/* Define to 1 if you have the getnameinfo function. */
#define HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getpass_r' function. */
/* #undef HAVE_GETPASS_R */
/* Define to 1 if you have the `getppid' function. */
#define HAVE_GETPPID 1
/* Define to 1 if you have the `getprotobyname' function. */
#define HAVE_GETPROTOBYNAME 1
/* Define to 1 if you have the `getpwuid' function. */
/* #undef HAVE_GETPWUID */
/* Define to 1 if you have the `getrlimit' function. */
#define HAVE_GETRLIMIT 1
/* Define to 1 if you have the getservbyport_r function. */
/* #undef HAVE_GETSERVBYPORT_R */
/* Define to 1 if you have the `gettimeofday' function. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define to 1 if you have a working glibc-style strerror_r function. */
/* #undef HAVE_GLIBC_STRERROR_R */
/* Define to 1 if you have a working gmtime_r function. */
#define HAVE_GMTIME_R 1
/* if you have the gssapi libraries */
/* #undef HAVE_GSSAPI */
/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_GENERIC_H */
/* Define to 1 if you have the <gssapi/gssapi.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_H */
/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */
/* #undef HAVE_GSSAPI_GSSAPI_KRB5_H */
/* if you have the GNU gssapi libraries */
/* #undef HAVE_GSSGNU */
/* if you have the Heimdal gssapi libraries */
/* #undef HAVE_GSSHEIMDAL */
/* if you have the MIT gssapi libraries */
/* #undef HAVE_GSSMIT */
/* Define to 1 if you have the `idna_strerror' function. */
/* #undef HAVE_IDNA_STRERROR */
/* Define to 1 if you have the `idn_free' function. */
/* #undef HAVE_IDN_FREE */
/* Define to 1 if you have the <idn-free.h> header file. */
/* #undef HAVE_IDN_FREE_H */
/* Define to 1 if you have the <ifaddrs.h> header file. */
/* #undef HAVE_IFADDRS_H */
/* Define to 1 if you have the `inet_addr' function. */
#define HAVE_INET_ADDR 1
/* Define to 1 if you have the inet_ntoa_r function. */
/* #undef HAVE_INET_NTOA_R */
/* inet_ntoa_r() takes 2 args */
/* #undef HAVE_INET_NTOA_R_2 */
/* inet_ntoa_r() takes 3 args */
/* #undef HAVE_INET_NTOA_R_3 */
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
/* #undef HAVE_INET_NTOP */
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
/* #undef HAVE_INET_PTON */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the ioctl function. */
#define HAVE_IOCTL 1
/* Define to 1 if you have the ioctlsocket function. */
/* #undef HAVE_IOCTLSOCKET */
/* Define to 1 if you have the IoctlSocket camel case function. */
/* #undef HAVE_IOCTLSOCKET_CAMEL */
/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function.
*/
/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
/* #undef HAVE_IOCTLSOCKET_FIONBIO */
/* Define to 1 if you have a working ioctl FIONBIO function. */
#define HAVE_IOCTL_FIONBIO 1
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */
#define HAVE_IOCTL_SIOCGIFADDR 1
/* Define to 1 if you have the <io.h> header file. */
#define HAVE_IO_H 1
/* if you have the Kerberos4 libraries (including -ldes) */
/* #undef HAVE_KRB4 */
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
/* #undef HAVE_KRB_GET_OUR_IP_FOR_REALM */
/* Define to 1 if you have the <krb.h> header file. */
/* #undef HAVE_KRB_H */
/* Define to 1 if you have the lber.h header file. */
/* #undef HAVE_LBER_H */
/* Define to 1 if you have the ldapssl.h header file. */
/* #undef HAVE_LDAPSSL_H */
/* Define to 1 if you have the ldap.h header file. */
/* #undef HAVE_LDAP_H */
/* Use LDAPS implementation */
/* #undef HAVE_LDAP_SSL */
/* Define to 1 if you have the ldap_ssl.h header file. */
/* #undef HAVE_LDAP_SSL_H */
/* Define to 1 if you have the `ldap_url_parse' function. */
/* #undef HAVE_LDAP_URL_PARSE */
/* Define to 1 if you have the <libgen.h> header file. */
/* #undef HAVE_LIBGEN_H */
/* Define to 1 if you have the `idn' library (-lidn). */
/* #undef HAVE_LIBIDN */
/* Define to 1 if you have the `resolv' library (-lresolv). */
/* #undef HAVE_LIBRESOLV */
/* Define to 1 if you have the `resolve' library (-lresolve). */
/* #undef HAVE_LIBRESOLVE */
/* Define to 1 if you have the `socket' library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define to 1 if you have the `ssh2' library (-lssh2). */
/* #undef HAVE_LIBSSH2 */
/* Define to 1 if you have the <libssh2.h> header file. */
/* #undef HAVE_LIBSSH2_H */
/* Define to 1 if you have the `libssh2_version' function. */
/* #undef HAVE_LIBSSH2_VERSION */
/* Define to 1 if you have the `ssl' library (-lssl). */
#define HAVE_LIBSSL 1
/* if zlib is available */
#define HAVE_LIBZ 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* if your compiler supports LL */
#define HAVE_LL 1
/* Define to 1 if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define to 1 if you have a working localtime_r function. */
#define HAVE_LOCALTIME_R 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#define HAVE_LONGLONG 1
/* Define to 1 if you have the malloc.h header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
/* #undef HAVE_MSG_NOSIGNAL */
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define HAVE_NETINET_TCP_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if NI_WITHSCOPEID exists and works. */
/* #undef HAVE_NI_WITHSCOPEID */
/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE
*/
/* #undef HAVE_OLD_GSSMIT */
/* Define to 1 if you have the <openssl/crypto.h> header file. */
#define HAVE_OPENSSL_CRYPTO_H 1
/* Define to 1 if you have the <openssl/engine.h> header file. */
#define HAVE_OPENSSL_ENGINE_H 1
/* Define to 1 if you have the <openssl/err.h> header file. */
#define HAVE_OPENSSL_ERR_H 1
/* Define to 1 if you have the <openssl/pem.h> header file. */
#define HAVE_OPENSSL_PEM_H 1
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
#define HAVE_OPENSSL_PKCS12_H 1
/* Define to 1 if you have the <openssl/rsa.h> header file. */
#define HAVE_OPENSSL_RSA_H 1
/* Define to 1 if you have the <openssl/ssl.h> header file. */
#define HAVE_OPENSSL_SSL_H 1
/* Define to 1 if you have the <openssl/x509.h> header file. */
#define HAVE_OPENSSL_X509_H 1
/* Define to 1 if you have the <pem.h> header file. */
/* #undef HAVE_PEM_H */
/* Define to 1 if you have the `perror' function. */
#define HAVE_PERROR 1
/* Define to 1 if you have the `pipe' function. */
#define HAVE_PIPE 1
/* Define to 1 if you have a working poll function. */
/* #undef HAVE_POLL */
/* If you have a fine poll */
/* #undef HAVE_POLL_FINE */
/* Define to 1 if you have the <poll.h> header file. */
/* #undef HAVE_POLL_H */
/* Define to 1 if you have a working POSIX-style strerror_r function. */
/* #undef HAVE_POSIX_STRERROR_R */
/* Define to 1 if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H */
/* Define to 1 if you have the `RAND_egd' function. */
#define HAVE_RAND_EGD 1
/* Define to 1 if you have the `RAND_screen' function. */
/* #undef HAVE_RAND_SCREEN */
/* Define to 1 if you have the `RAND_status' function. */
#define HAVE_RAND_STATUS 1
/* Define to 1 if you have the recv function. */
#define HAVE_RECV 1
/* Define to 1 if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to 1 if you have the <rsa.h> header file. */
/* #undef HAVE_RSA_H */
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
/* Define to 1 if you have the send function. */
#define HAVE_SEND 1
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setmode' function. */
#define HAVE_SETMODE 1
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* Define to 1 if you have the setsockopt function. */
#define HAVE_SETSOCKOPT 1
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */
/* Define to 1 if you have the <sgtty.h> header file. */
/* #undef HAVE_SGTTY_H */
/* Define to 1 if you have the sigaction function. */
#define HAVE_SIGACTION 1
/* Define to 1 if you have the siginterrupt function. */
#define HAVE_SIGINTERRUPT 1
/* Define to 1 if you have the signal function. */
#define HAVE_SIGNAL 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the sigsetjmp function or macro. */
/* #undef HAVE_SIGSETJMP */
/* Define to 1 if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1
/* Define to 1 if sig_atomic_t is already defined as volatile. */
/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */
/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
/* Define to 1 if you have the `socket' function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the `SSL_get_shutdown' function. */
#define HAVE_SSL_GET_SHUTDOWN 1
/* Define to 1 if you have the <ssl.h> header file. */
/* #undef HAVE_SSL_H */
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
/* #undef HAVE_STDINT_H */
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the strcmpi function. */
/* #undef HAVE_STRCMPI */
/* Define to 1 if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the strerror_r function. */
#define HAVE_STRERROR_R 1
/* Define to 1 if you have the stricmp function. */
/* #undef HAVE_STRICMP */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define to 1 if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the strncmpi function. */
/* #undef HAVE_STRNCMPI */
/* Define to 1 if you have the strnicmp function. */
/* #undef HAVE_STRNICMP */
/* Define to 1 if you have the <stropts.h> header file. */
/* #undef HAVE_STROPTS_H */
/* Define to 1 if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define to 1 if you have the strtok_r function. */
#define HAVE_STRTOK_R 1
/* Define to 1 if you have the strtoll function. */
/* #undef HAVE_STRTOLL */
/* if struct sockaddr_storage is defined */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if you have the timeval struct. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <sys/filio.h> header file. */
/* #undef HAVE_SYS_FILIO_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
/* #undef HAVE_SYS_PARAM_H */
/* Define to 1 if you have the <sys/poll.h> header file. */
/* #undef HAVE_SYS_POLL_H */
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
/* #undef HAVE_SYS_SELECT_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/utime.h> header file. */
#define HAVE_SYS_UTIME_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
#define HAVE_TERMIO_H 1
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <tld.h> header file. */
/* #undef HAVE_TLD_H */
/* Define to 1 if you have the `tld_strerror' function. */
/* #undef HAVE_TLD_STRERROR */
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if compiler supports C99 variadic macro style. */
#define HAVE_VARIADIC_MACROS_C99 1
/* Define to 1 if compiler supports old gcc variadic macro style. */
#define HAVE_VARIADIC_MACROS_GCC 1
/* Define to 1 if you have a working vxworks-style strerror_r function. */
#define HAVE_VXWORKS_STRERROR_R 1
/* Define to 1 if you have the winber.h header file. */
/* #undef HAVE_WINBER_H */
/* Define to 1 if you have the windows.h header file. */
/* #undef HAVE_WINDOWS_H */
/* Define to 1 if you have the winldap.h header file. */
/* #undef HAVE_WINLDAP_H */
/* Define to 1 if you have the winsock2.h header file. */
/* #undef HAVE_WINSOCK2_H */
/* Define to 1 if you have the winsock.h header file. */
/* #undef HAVE_WINSOCK_H */
/* Define this symbol if your OS supports changing the contents of argv */
#define HAVE_WRITABLE_ARGV 1
/* Define to 1 if you have the writev function. */
#define HAVE_WRITEV 1
/* Define to 1 if you have the ws2tcpip.h header file. */
/* #undef HAVE_WS2TCPIP_H */
/* Define to 1 if you have the <x509.h> header file. */
/* #undef HAVE_X509_H */
/* if you have the zlib.h header file */
#define HAVE_ZLIB_H 1
/* Define to 1 if you need the lber.h header file even with ldap.h */
/* #undef NEED_LBER_H */
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
/* #undef NEED_MALLOC_H */
/* Define to 1 if you need the memory.h header file even with stdlib.h */
/* #undef NEED_MEMORY_H */
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
/* #undef NEED_REENTRANT */
/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */
/* #undef NEED_THREAD_SAFE */
/* Define to 1 if the open function requires three arguments. */
#define OPEN_NEEDS_ARG3 1
/* cpu-machine-OS */
#define OS "unknown-unknown-vxworks"
/* Name of package */
#define PACKAGE "curl"
/* a suitable file to read random data from */
#define RANDOM_FILE "/dev/urandom"
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 int
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 void
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */
#define RECVFROM_TYPE_ARG2_IS_VOID 1
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 size_t
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */
/* #undef RECVFROM_TYPE_ARG5_IS_VOID */
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 socklen_t
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */
/* #undef RECVFROM_TYPE_ARG6_IS_VOID */
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV int
/* Define to the type of arg 1 for recv. */
#define RECV_TYPE_ARG1 int
/* Define to the type of arg 2 for recv. */
#define RECV_TYPE_ARG2 void *
/* Define to the type of arg 3 for recv. */
#define RECV_TYPE_ARG3 size_t
/* Define to the type of arg 4 for recv. */
#define RECV_TYPE_ARG4 int
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV int
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* Define to the type qualifier of arg 5 for select. */
#define SELECT_QUAL_ARG5
/* Define to the type of arg 1 for select. */
#define SELECT_TYPE_ARG1 int
/* Define to the type of args 2, 3 and 4 for select. */
#define SELECT_TYPE_ARG234 fd_set *
/* Define to the type of arg 5 for select. */
#define SELECT_TYPE_ARG5 struct timeval *
/* Define to the function return type for select. */
#define SELECT_TYPE_RETV int
/* Define to the type qualifier of arg 2 for send. */
#define SEND_QUAL_ARG2 const
/* Define to the type of arg 1 for send. */
#define SEND_TYPE_ARG1 int
/* Define to the type of arg 2 for send. */
#define SEND_TYPE_ARG2 void *
/* Define to the type of arg 3 for send. */
#define SEND_TYPE_ARG3 size_t
/* Define to the type of arg 4 for send. */
#define SEND_TYPE_ARG4 int
/* Define to the function return type for send. */
#define SEND_TYPE_RETV int
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 8
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 4
/* The size of `void*', as computed by sizeof. */
#define SIZEOF_VOIDP 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to the type of arg 3 for strerror_r. */
/* #undef STRERROR_R_TYPE_ARG3 */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define if you want to enable c-ares support */
/* #undef USE_ARES */
/* Define to disable non-blocking sockets. */
/* #undef USE_BLOCKING_SOCKETS */
/* if GnuTLS is enabled */
/* #undef USE_GNUTLS */
/* if libSSH2 is in use */
/* #undef USE_LIBSSH2 */
/* If you want to build curl with the built-in manual */
#define USE_MANUAL 1
/* if NSS is enabled */
/* #undef USE_NSS */
/* if OpenSSL is in use */
#define USE_OPENSSL 1
/* Define to 1 if you are building a Windows target without large file
support. */
/* #undef USE_WIN32_LARGE_FILES */
/* to enable SSPI support */
/* #undef USE_WINDOWS_SSPI */
/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */
/* #undef USE_YASSLEMUL */
/* Define to avoid automatic inclusion of winsock.h */
/* #undef WIN32_LEAN_AND_MEAN */
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
/* # undef _ALL_SOURCE */
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Type to use in place of in_addr_t when system does not provide it. */
/* #undef in_addr_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* the signed version of size_t */
/* #undef ssize_t */
#endif /* HEADER_CURL_CONFIG_VXWORKS_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
@ -35,9 +33,26 @@
/* Define if you have the <arpa/inet.h> header file. */
/* #define HAVE_ARPA_INET_H 1 */
/* Define if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define if you have the <crypto.h> header file. */
/* #define HAVE_CRYPTO_H 1 */
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <err.h> header file. */
/* #define HAVE_ERR_H 1 */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <getopt.h> header file. */
#if defined(__MINGW32__) || defined(__POCC__)
#define HAVE_GETOPT_H 1
#endif
/* Define to 1 if you have the <inttypes.h> header file. */
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
#define HAVE_INTTYPES_H 1
@ -46,6 +61,9 @@
/* Define if you have the <io.h> header file. */
#define HAVE_IO_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
@ -60,15 +78,22 @@
/* Define if you have the <netinet/in.h> header file. */
/* #define HAVE_NETINET_IN_H 1 */
/* Define if you have the <process.h> header file. */
#ifndef __SALFORDC__
#define HAVE_PROCESS_H 1
#endif
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define if you have the <sgtty.h> header file. */
/* #define HAVE_SGTTY_H 1 */
/* Define if you have the <ssl.h> header file. */
/* #define HAVE_SSL_H 1 */
/* Define to 1 if you have the <stdbool.h> header file. */
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \
defined(__MINGW64_VERSION_MAJOR)
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
#define HAVE_STDBOOL_H 1
#endif
@ -111,13 +136,17 @@
#define HAVE_TIME_H 1
/* Define if you have the <unistd.h> header file. */
#if defined(__MINGW32__) || defined(__LCC__) || defined(__POCC__)
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__) || \
defined(__POCC__)
#define HAVE_UNISTD_H 1
#endif
/* Define if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
/* Define if you have the <winsock.h> header file. */
#define HAVE_WINSOCK_H 1
/* Define if you have the <winsock2.h> header file. */
#ifndef __SALFORDC__
#define HAVE_WINSOCK2_H 1
@ -128,21 +157,13 @@
#define HAVE_WS2TCPIP_H 1
#endif
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <libgen.h> header file. */
#if defined(__MINGW64_VERSION_MAJOR)
#define HAVE_LIBGEN_H 1
#endif
/* ---------------------------------------------------------------- */
/* OTHER HEADER INFO */
/* ---------------------------------------------------------------- */
/* Define if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
@ -150,8 +171,7 @@
/* #define TIME_WITH_SYS_TIME 1 */
/* Define to 1 if bool is an available type. */
#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \
defined(__MINGW64_VERSION_MAJOR)
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
#define HAVE_BOOL_T 1
#endif
@ -162,29 +182,52 @@
/* Define if you have the closesocket function. */
#define HAVE_CLOSESOCKET 1
/* Define if you don't have vprintf but do have _doprnt. */
/* #define HAVE_DOPRNT 1 */
/* Define if you have the ftruncate function. */
#if defined(__MINGW64_VERSION_MAJOR)
#define HAVE_FTRUNCATE 1
#endif
/* Define to 1 if you have the `getpeername' function. */
#define HAVE_GETPEERNAME 1
/* Define to 1 if you have the getsockname function. */
#define HAVE_GETSOCKNAME 1
/* Define if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
/* Define if you have the getpass function. */
/* #define HAVE_GETPASS 1 */
/* Define if you have the getservbyname function. */
#define HAVE_GETSERVBYNAME 1
/* Define if you have the getprotobyname function. */
#define HAVE_GETPROTOBYNAME
/* Define if you have the gettimeofday function. */
/* #define HAVE_GETTIMEOFDAY 1 */
/* Define if you have the inet_addr function. */
#define HAVE_INET_ADDR 1
/* Define if you have the ioctlsocket function. */
#define HAVE_IOCTLSOCKET 1
/* Define if you have a working ioctlsocket FIONBIO function. */
#define HAVE_IOCTLSOCKET_FIONBIO 1
/* Define if you have the perror function. */
#define HAVE_PERROR 1
/* Define if you have the RAND_screen function when using SSL. */
#define HAVE_RAND_SCREEN 1
/* Define if you have the `RAND_status' function when using SSL. */
#define HAVE_RAND_STATUS 1
/* Define if you have the `CRYPTO_cleanup_all_ex_data' function.
This is present in OpenSSL versions after 0.9.6b */
#define HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1
/* Define if you have the select function. */
#define HAVE_SELECT 1
@ -194,31 +237,65 @@
/* Define if you have the setmode function. */
#define HAVE_SETMODE 1
/* Define if you have the setvbuf function. */
#define HAVE_SETVBUF 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define if you have the strcasecmp function. */
#ifdef __MINGW32__
#define HAVE_STRCASECMP 1
#endif
/* #define HAVE_STRCASECMP 1 */
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strftime function. */
#define HAVE_STRFTIME 1
/* Define if you have the stricmp function. */
#define HAVE_STRICMP 1
/* Define if you have the strncasecmp function. */
/* #define HAVE_STRNCASECMP 1 */
/* Define if you have the strnicmp function. */
#define HAVE_STRNICMP 1
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the strtoll function. */
#if defined(__MINGW32__) || defined(__POCC__) || \
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__POCC__) || \
(defined(_MSC_VER) && (_MSC_VER >= 1800))
#define HAVE_STRTOLL 1
#endif
/* Define if you have the tcgetattr function. */
/* #define HAVE_TCGETATTR 1 */
/* Define if you have the tcsetattr function. */
/* #define HAVE_TCSETATTR 1 */
/* Define if you have the utime function. */
#ifndef __BORLANDC__
#define HAVE_UTIME 1
#endif
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 DWORD
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Define if you have the recv function. */
#define HAVE_RECV 1
@ -237,6 +314,30 @@
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV int
/* Define if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 SOCKET
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 char
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 int
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 int
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV int
/* Define if you have the send function. */
#define HAVE_SEND 1
@ -258,31 +359,6 @@
/* Define to the function return type for send. */
#define SEND_TYPE_RETV int
/* Define to 1 if you have the snprintf function. */
#if defined(_MSC_VER) && (_MSC_VER >= 1900)
#define HAVE_SNPRINTF 1
#endif
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600 /* Vista */
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
#define HAVE_INET_NTOP 1
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
#define HAVE_INET_PTON 1
#endif
/* Define to 1 if you have the `basename' function. */
#if defined(__MINGW64_VERSION_MAJOR)
#define HAVE_BASENAME 1
#endif
/* Define to 1 if you have the strtok_r function. */
#if defined(__MINGW64_VERSION_MAJOR)
#define HAVE_STRTOK_R 1
#endif
/* Define to 1 if you have the signal function. */
#define HAVE_SIGNAL 1
/* ---------------------------------------------------------------- */
/* TYPEDEF REPLACEMENTS */
/* ---------------------------------------------------------------- */
@ -290,9 +366,14 @@
/* Define if in_addr_t is not an available 'typedefed' type. */
#define in_addr_t unsigned long
/* Define to the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if ssize_t is not an available 'typedefed' type. */
#ifndef _SSIZE_T_DEFINED
# if defined(__POCC__) || defined(__MINGW32__)
# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
defined(__POCC__) || \
defined(__MINGW32__)
# elif defined(_WIN64)
# define _SSIZE_T_DEFINED
# define ssize_t __int64
@ -309,11 +390,14 @@
/* Define to the size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* Define to the size of `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 16
/* Define to the size of `long long', as computed by sizeof. */
/* #define SIZEOF_LONG_LONG 8 */
/* Define to the size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* Define to the size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* Define to the size of `size_t', as computed by sizeof. */
#if defined(_WIN64)
@ -322,9 +406,6 @@
# define SIZEOF_SIZE_T 4
#endif
/* Define to the size of `curl_off_t', as computed by sizeof. */
#define SIZEOF_CURL_OFF_T 8
/* ---------------------------------------------------------------- */
/* BSD-style lwIP TCP/IP stack SPECIFIC */
/* ---------------------------------------------------------------- */
@ -334,9 +415,12 @@
#ifdef USE_LWIPSOCK
# undef USE_WINSOCK
# undef HAVE_WINSOCK_H
# undef HAVE_WINSOCK2_H
# undef HAVE_WS2TCPIP_H
# undef HAVE_ERRNO_H
# undef HAVE_GETHOSTNAME
# undef HAVE_GETNAMEINFO
# undef LWIP_POSIX_SOCKETS_IO_NAMES
# undef RECV_TYPE_ARG1
# undef RECV_TYPE_ARG3
@ -344,6 +428,7 @@
# undef SEND_TYPE_ARG3
# define HAVE_FREEADDRINFO
# define HAVE_GETADDRINFO
# define HAVE_GETHOSTBYNAME
# define HAVE_GETHOSTBYNAME_R
# define HAVE_GETHOSTBYNAME_R_6
# define LWIP_POSIX_SOCKETS_IO_NAMES 0
@ -362,9 +447,11 @@
#undef byte
#undef word
#undef USE_WINSOCK
#undef HAVE_WINSOCK_H
#undef HAVE_WINSOCK2_H
#undef HAVE_WS2TCPIP_H
#define HAVE_GETADDRINFO
#define HAVE_GETNAMEINFO
#define HAVE_SYS_IOCTL_H
#define HAVE_SYS_SOCKET_H
#define HAVE_NETINET_IN_H
@ -394,7 +481,7 @@
#endif
/* Define if the compiler supports the 'long long' data type. */
#if defined(__MINGW32__) || \
#if defined(__MINGW32__) || defined(__WATCOMC__) || \
(defined(_MSC_VER) && (_MSC_VER >= 1310)) || \
(defined(__BORLANDC__) && (__BORLANDC__ >= 0x561))
#define HAVE_LONGLONG 1
@ -406,11 +493,9 @@
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
/* mingw-w64, mingw using >= MSVCR80, and visual studio >= 2005 (MSVCR80)
all default to 64-bit time_t unless _USE_32BIT_TIME_T is defined */
#if defined(__MINGW64_VERSION_MAJOR) || \
(defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0800)) || \
(defined(_MSC_VER) && (_MSC_VER >= 1400))
/* VS2005 and later default size for time_t is 64-bit, unless
_USE_32BIT_TIME_T has been defined to get a 32-bit time_t. */
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
# ifndef _USE_32BIT_TIME_T
# define SIZEOF_TIME_T 8
# else
@ -491,22 +576,24 @@ Vista
# endif
#endif
/* Availability of freeaddrinfo, getaddrinfo, and if_nametoindex
functions is quite convoluted, compiler dependent and even build target
dependent. */
/* Availability of freeaddrinfo, getaddrinfo and getnameinfo functions is
quite convoluted, compiler dependent and even build target dependent. */
#if defined(HAVE_WS2TCPIP_H)
# if defined(__POCC__)
# define HAVE_FREEADDRINFO 1
# define HAVE_GETADDRINFO 1
# define HAVE_GETADDRINFO_THREADSAFE 1
# define HAVE_GETNAMEINFO 1
# elif defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
# define HAVE_FREEADDRINFO 1
# define HAVE_GETADDRINFO 1
# define HAVE_GETADDRINFO_THREADSAFE 1
# define HAVE_GETNAMEINFO 1
# elif defined(_MSC_VER) && (_MSC_VER >= 1200)
# define HAVE_FREEADDRINFO 1
# define HAVE_GETADDRINFO 1
# define HAVE_GETADDRINFO_THREADSAFE 1
# define HAVE_GETNAMEINFO 1
# endif
#endif
@ -534,6 +621,11 @@ Vista
/* Define if struct sockaddr_in6 has the sin6_scope_id member. */
#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
#if defined(HAVE_WINSOCK2_H) && defined(_WIN32_WINNT) && \
(_WIN32_WINNT >= 0x0600)
#define HAVE_STRUCT_POLLFD 1
#endif
/* ---------------------------------------------------------------- */
/* LARGE FILE SUPPORT */
/* ---------------------------------------------------------------- */
@ -550,6 +642,10 @@ Vista
# define USE_WIN32_LARGE_FILES
#endif
#if defined(__WATCOMC__) && !defined(USE_WIN32_LARGE_FILES)
# define USE_WIN32_LARGE_FILES
#endif
#if defined(__POCC__)
# undef USE_WIN32_LARGE_FILES
#endif
@ -558,21 +654,6 @@ Vista
# define USE_WIN32_SMALL_FILES
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#if defined(USE_WIN32_LARGE_FILES) && defined(__MINGW64_VERSION_MAJOR)
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
#endif
/* Define to the size of `off_t', as computed by sizeof. */
#if defined(__MINGW64_VERSION_MAJOR) && \
defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
# define SIZEOF_OFF_T 8
#else
# define SIZEOF_OFF_T 4
#endif
/* ---------------------------------------------------------------- */
/* DNS RESOLVER SPECIALTY */
/* ---------------------------------------------------------------- */
@ -598,7 +679,7 @@ Vista
/* LDAP SUPPORT */
/* ---------------------------------------------------------------- */
#if defined(CURL_HAS_NOVELL_LDAPSDK)
#if defined(CURL_HAS_NOVELL_LDAPSDK) || defined(CURL_HAS_MOZILLA_LDAPSDK)
#undef USE_WIN32_LDAP
#define HAVE_LDAP_SSL_H 1
#define HAVE_LDAP_URL_PARSE 1
@ -607,42 +688,40 @@ Vista
#define HAVE_LDAP_URL_PARSE 1
#else
#undef HAVE_LDAP_URL_PARSE
#define HAVE_LDAP_SSL 1
#define USE_WIN32_LDAP 1
#endif
#if defined(__WATCOMC__) && defined(USE_WIN32_LDAP)
#if __WATCOMC__ < 1280
#define WINBERAPI __declspec(cdecl)
#define WINLDAPAPI __declspec(cdecl)
#endif
#endif
#if defined(__POCC__) && defined(USE_WIN32_LDAP)
# define CURL_DISABLE_LDAP 1
#endif
/* Define to use the Windows crypto library. */
#if !defined(CURL_WINDOWS_APP)
#if !defined(USE_OPENSSL) && !defined(USE_NSS)
#define USE_WIN32_CRYPTO
#endif
/* Define to use Unix sockets. */
#define USE_UNIX_SOCKETS
/* ---------------------------------------------------------------- */
/* ADDITIONAL DEFINITIONS */
/* ---------------------------------------------------------------- */
/* Define cpu-machine-OS */
#ifndef OS
#undef OS
#if defined(_M_IX86) || defined(__i386__) /* x86 (MSVC or gcc) */
#define OS "i386-pc-win32"
#elif defined(_M_X64) || defined(__x86_64__) /* x86_64 (MSVC >=2005 or gcc) */
#define OS "x86_64-pc-win32"
#elif defined(_M_IA64) || defined(__ia64__) /* Itanium */
#elif defined(_M_IA64) /* Itanium */
#define OS "ia64-pc-win32"
#elif defined(_M_ARM_NT) || defined(__arm__) /* ARMv7-Thumb2 (Windows RT) */
#define OS "thumbv7a-pc-win32"
#elif defined(_M_ARM64) || defined(__aarch64__) /* ARM64 (Windows 10) */
#define OS "aarch64-pc-win32"
#else
#define OS "unknown-pc-win32"
#endif
#endif
/* Name of package */
#define PACKAGE "curl"

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* ================================================================ */
@ -35,13 +33,31 @@
/* Define if you have the <arpa/inet.h> header file. */
/* #define HAVE_ARPA_INET_H 1 */
/* Define if you have the <assert.h> header file. */
/* #define HAVE_ASSERT_H 1 */
/* Define if you have the <crypto.h> header file. */
/* #define HAVE_CRYPTO_H 1 */
/* Define if you have the <errno.h> header file. */
/* #define HAVE_ERRNO_H 1 */
/* Define if you have the <err.h> header file. */
/* #define HAVE_ERR_H 1 */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <getopt.h> header file. */
/* #define HAVE_GETOPT_H 1 */
/* Define if you have the <io.h> header file. */
#define HAVE_IO_H 1
/* Define if you need the malloc.h header file even with stdlib.h */
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you need the malloc.h header header file even with stdlib.h */
#define NEED_MALLOC_H 1
/* Define if you have the <netdb.h> header file. */
@ -53,12 +69,18 @@
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define if you have the <sgtty.h> header file. */
/* #define HAVE_SGTTY_H 1 */
/* Define if you have the <ssl.h> header file. */
/* #define HAVE_SSL_H 1 */
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <process.h> header file. */
/* #define HAVE_PROCESS_H 1 */
/* Define if you have the <sys/param.h> header file. */
/* #define HAVE_SYS_PARAM_H 1 */
@ -93,23 +115,29 @@
#define HAVE_TIME_H 1
/* Define if you have the <unistd.h> header file. */
#if defined(__MINGW32__) || defined(__LCC__)
#if defined(__MINGW32__) || defined(__WATCOMC__) || defined(__LCC__)
#define HAVE_UNISTD_H 1
#endif
/* Define if you have the <windows.h> header file. */
#define HAVE_WINDOWS_H 1
/* Define if you have the <winsock.h> header file. */
#define HAVE_WINSOCK_H 1
/* Define if you have the <winsock2.h> header file. */
#define HAVE_WINSOCK2_H 1
/* #define HAVE_WINSOCK2_H 1 */
/* Define if you have the <ws2tcpip.h> header file. */
#define HAVE_WS2TCPIP_H 1
/* #define HAVE_WS2TCPIP_H 1 */
/* ---------------------------------------------------------------- */
/* OTHER HEADER INFO */
/* ---------------------------------------------------------------- */
/* Define if sig_atomic_t is an available typedef. */
#define HAVE_SIG_ATOMIC_T 1
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
@ -123,21 +151,48 @@
/* Define if you have the closesocket function. */
#define HAVE_CLOSESOCKET 1
/* Define if you don't have vprintf but do have _doprnt. */
/* #define HAVE_DOPRNT 1 */
/* Define if you have the gethostbyaddr function. */
#define HAVE_GETHOSTBYADDR 1
/* Define if you have the gethostname function. */
#define HAVE_GETHOSTNAME 1
/* Define if you have the getpass function. */
/* #define HAVE_GETPASS 1 */
/* Define if you have the getservbyname function. */
#define HAVE_GETSERVBYNAME 1
/* Define if you have the gettimeofday function. */
/* #define HAVE_GETTIMEOFDAY 1 */
/* Define if you have the inet_addr function. */
#define HAVE_INET_ADDR 1
/* Define if you have the ioctlsocket function. */
#define HAVE_IOCTLSOCKET 1
/* Define if you have a working ioctlsocket FIONBIO function. */
#define HAVE_IOCTLSOCKET_FIONBIO 1
/* Define if you have the perror function. */
#define HAVE_PERROR 1
/* Define if you have the RAND_screen function when using SSL */
#define HAVE_RAND_SCREEN 1
/* Define if you have the `RAND_status' function when using SSL. */
#define HAVE_RAND_STATUS 1
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the setvbuf function. */
#define HAVE_SETVBUF 1
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
@ -147,17 +202,53 @@
/* Define if you have the strdup function. */
/* #define HAVE_STRDUP 1 */
/* Define if you have the strftime function. */
/* #define HAVE_STRFTIME 1 */
/* Define if you have the stricmp function. */
/* #define HAVE_STRICMP 1 */
/* Define if you have the strncasecmp function. */
/* #define HAVE_STRNCASECMP 1 */
/* Define if you have the strnicmp function. */
/* #define HAVE_STRNICMP 1 */
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the strtoll function. */
#if defined(__MINGW32__)
#if defined(__MINGW32__) || defined(__WATCOMC__)
#define HAVE_STRTOLL 1
#endif
/* Define if you have the tcgetattr function. */
/* #define HAVE_TCGETATTR 1 */
/* Define if you have the tcsetattr function. */
/* #define HAVE_TCSETATTR 1 */
/* Define if you have the utime function */
#define HAVE_UTIME 1
/* Define if you have the getnameinfo function. */
#define HAVE_GETNAMEINFO 1
/* Define to the type qualifier of arg 1 for getnameinfo. */
#define GETNAMEINFO_QUAL_ARG1 const
/* Define to the type of arg 1 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG1 struct sockaddr *
/* Define to the type of arg 2 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG2 socklen_t
/* Define to the type of args 4 and 6 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG46 DWORD
/* Define to the type of arg 7 for getnameinfo. */
#define GETNAMEINFO_TYPE_ARG7 int
/* Define if you have the recv function. */
#define HAVE_RECV 1
@ -176,6 +267,30 @@
/* Define to the function return type for recv. */
#define RECV_TYPE_RETV int
/* Define if you have the recvfrom function. */
#define HAVE_RECVFROM 1
/* Define to the type of arg 1 for recvfrom. */
#define RECVFROM_TYPE_ARG1 SOCKET
/* Define to the type pointed by arg 2 for recvfrom. */
#define RECVFROM_TYPE_ARG2 char
/* Define to the type of arg 3 for recvfrom. */
#define RECVFROM_TYPE_ARG3 int
/* Define to the type of arg 4 for recvfrom. */
#define RECVFROM_TYPE_ARG4 int
/* Define to the type pointed by arg 5 for recvfrom. */
#define RECVFROM_TYPE_ARG5 struct sockaddr
/* Define to the type pointed by arg 6 for recvfrom. */
#define RECVFROM_TYPE_ARG6 int
/* Define to the function return type for recvfrom. */
#define RECVFROM_TYPE_RETV int
/* Define if you have the send function. */
#define HAVE_SEND 1
@ -204,8 +319,11 @@
/* Define this if in_addr_t is not an available 'typedefed' type */
#define in_addr_t unsigned long
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define ssize_t if it is not an available 'typedefed' type */
#if defined(__POCC__)
#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || defined(__POCC__)
#elif defined(_WIN64)
#define ssize_t __int64
#else
@ -219,11 +337,14 @@
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `long double', as computed by sizeof. */
#define SIZEOF_LONG_DOUBLE 16
/* The size of `long long', as computed by sizeof. */
/* #define SIZEOF_LONG_LONG 8 */
/* Define to the size of `long', as computed by sizeof. */
#define SIZEOF_LONG 4
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#if defined(_WIN64)
@ -296,9 +417,8 @@
/* ---------------------------------------------------------------- */
/* Define cpu-machine-OS */
#ifndef OS
#undef OS
#define OS "i386-pc-win32ce"
#endif
/* Name of package */
#define PACKAGE "curl"

View File

@ -6,11 +6,11 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <linus@haxx.se>
* Copyright (C) 2012 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -19,8 +19,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -33,76 +31,74 @@
#include "multiif.h"
#include "sendf.h"
#include "conncache.h"
#include "share.h"
#include "sigpipe.h"
#include "connect.h"
#include "strcase.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#define HASHKEY_SIZE 128
static void conn_llist_dtor(void *user, void *element)
{
struct connectdata *conn = element;
struct connectdata *data = element;
(void)user;
conn->bundle = NULL;
data->bundle = NULL;
}
static CURLcode bundle_create(struct connectbundle **bundlep)
static CURLcode bundle_create(struct Curl_easy *data,
struct connectbundle **cb_ptr)
{
DEBUGASSERT(*bundlep == NULL);
*bundlep = malloc(sizeof(struct connectbundle));
if(!*bundlep)
(void)data;
DEBUGASSERT(*cb_ptr == NULL);
*cb_ptr = malloc(sizeof(struct connectbundle));
if(!*cb_ptr)
return CURLE_OUT_OF_MEMORY;
(*bundlep)->num_connections = 0;
(*bundlep)->multiuse = BUNDLE_UNKNOWN;
(*cb_ptr)->num_connections = 0;
(*cb_ptr)->multiuse = BUNDLE_UNKNOWN;
Curl_llist_init(&(*bundlep)->conn_list, (Curl_llist_dtor) conn_llist_dtor);
Curl_llist_init(&(*cb_ptr)->conn_list, (curl_llist_dtor) conn_llist_dtor);
return CURLE_OK;
}
static void bundle_destroy(struct connectbundle *bundle)
static void bundle_destroy(struct connectbundle *cb_ptr)
{
if(!bundle)
if(!cb_ptr)
return;
Curl_llist_destroy(&bundle->conn_list, NULL);
Curl_llist_destroy(&cb_ptr->conn_list, NULL);
free(bundle);
free(cb_ptr);
}
/* Add a connection to a bundle */
static void bundle_add_conn(struct connectbundle *bundle,
static CURLcode bundle_add_conn(struct connectbundle *cb_ptr,
struct connectdata *conn)
{
Curl_llist_insert_next(&bundle->conn_list, bundle->conn_list.tail, conn,
&conn->bundle_node);
conn->bundle = bundle;
bundle->num_connections++;
if(!Curl_llist_insert_next(&cb_ptr->conn_list, cb_ptr->conn_list.tail, conn))
return CURLE_OUT_OF_MEMORY;
conn->bundle = cb_ptr;
cb_ptr->num_connections++;
return CURLE_OK;
}
/* Remove a connection from a bundle */
static int bundle_remove_conn(struct connectbundle *bundle,
static int bundle_remove_conn(struct connectbundle *cb_ptr,
struct connectdata *conn)
{
struct Curl_llist_element *curr;
struct curl_llist_element *curr;
curr = bundle->conn_list.head;
curr = cb_ptr->conn_list.head;
while(curr) {
if(curr->ptr == conn) {
Curl_llist_remove(&bundle->conn_list, curr, NULL);
bundle->num_connections--;
Curl_llist_remove(&cb_ptr->conn_list, curr, NULL);
cb_ptr->num_connections--;
conn->bundle = NULL;
return 1; /* we removed a handle */
}
curr = curr->next;
}
DEBUGASSERT(0);
return 0;
}
@ -115,16 +111,8 @@ static void free_bundle_hash_entry(void *freethis)
int Curl_conncache_init(struct conncache *connc, int size)
{
/* allocate a new easy handle to use when closing cached connections */
connc->closure_handle = curl_easy_init();
if(!connc->closure_handle)
return 1; /* bad */
Curl_hash_init(&connc->hash, size, Curl_hash_str,
return Curl_hash_init(&connc->hash, size, Curl_hash_str,
Curl_str_key_compare, free_bundle_hash_entry);
connc->closure_handle->state.conn_cache = connc;
return 0; /* good */
}
void Curl_conncache_destroy(struct conncache *connc)
@ -134,57 +122,34 @@ void Curl_conncache_destroy(struct conncache *connc)
}
/* creates a key to find a bundle for this connection */
static void hashkey(struct connectdata *conn, char *buf, size_t len)
static void hashkey(struct connectdata *conn, char *buf,
size_t len) /* something like 128 is fine */
{
const char *hostname;
long port = conn->remote_port;
DEBUGASSERT(len >= HASHKEY_SIZE);
#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
if(conn->bits.socksproxy)
hostname = conn->socks_proxy.host.name;
else if(conn->bits.httpproxy)
hostname = conn->http_proxy.host.name;
port = conn->port;
}
else
#endif
if(conn->bits.conn_to_host)
else if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
else
hostname = conn->host.name;
/* put the numbers first so that the hostname gets cut off if too long */
#ifdef ENABLE_IPV6
msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
#else
msnprintf(buf, len, "%ld/%s", port, hostname);
#endif
Curl_strntolower(buf, buf, len);
}
DEBUGASSERT(len > 32);
/* Returns number of connections currently held in the connection cache.
Locks/unlocks the cache itself!
*/
size_t Curl_conncache_size(struct Curl_easy *data)
{
size_t num;
CONNCACHE_LOCK(data);
num = data->state.conn_cache->num_conn;
CONNCACHE_UNLOCK(data);
return num;
/* put the number first so that the hostname gets cut off if too long */
snprintf(buf, len, "%ld%s", conn->port, hostname);
}
/* Look up the bundle with all the connections to the same host this
connectdata struct is setup to use.
**NOTE**: When it returns, it holds the connection cache lock! */
struct connectbundle *
Curl_conncache_find_bundle(struct Curl_easy *data,
struct connectdata *conn,
connectdata struct is setup to use. */
struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn,
struct conncache *connc)
{
struct connectbundle *bundle = NULL;
CONNCACHE_LOCK(data);
if(connc) {
char key[HASHKEY_SIZE];
char key[128];
hashkey(conn, key, sizeof(key));
bundle = Curl_hash_pick(&connc->hash, key, strlen(key));
}
@ -192,18 +157,20 @@ Curl_conncache_find_bundle(struct Curl_easy *data,
return bundle;
}
static void *conncache_add_bundle(struct conncache *connc,
static bool conncache_add_bundle(struct conncache *connc,
char *key,
struct connectbundle *bundle)
{
return Curl_hash_add(&connc->hash, key, strlen(key), bundle);
void *p = Curl_hash_add(&connc->hash, key, strlen(key), bundle);
return p?TRUE:FALSE;
}
static void conncache_remove_bundle(struct conncache *connc,
struct connectbundle *bundle)
{
struct Curl_hash_iterator iter;
struct Curl_hash_element *he;
struct curl_hash_iterator iter;
struct curl_hash_element *he;
if(!connc)
return;
@ -223,107 +190,90 @@ static void conncache_remove_bundle(struct conncache *connc,
}
}
CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
CURLcode Curl_conncache_add_conn(struct conncache *connc,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct connectbundle *bundle = NULL;
struct connectdata *conn = data->conn;
struct conncache *connc = data->state.conn_cache;
DEBUGASSERT(conn);
CURLcode result;
struct connectbundle *bundle;
struct connectbundle *new_bundle = NULL;
struct Curl_easy *data = conn->data;
/* *find_bundle() locks the connection cache */
bundle = Curl_conncache_find_bundle(data, conn, data->state.conn_cache);
bundle = Curl_conncache_find_bundle(conn, data->state.conn_cache);
if(!bundle) {
char key[HASHKEY_SIZE];
int rc;
char key[128];
result = bundle_create(&bundle);
if(result) {
goto unlock;
}
result = bundle_create(data, &new_bundle);
if(result)
return result;
hashkey(conn, key, sizeof(key));
rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle);
if(!conncache_add_bundle(data->state.conn_cache, key, bundle)) {
bundle_destroy(bundle);
result = CURLE_OUT_OF_MEMORY;
goto unlock;
if(!rc) {
bundle_destroy(new_bundle);
return CURLE_OUT_OF_MEMORY;
}
bundle = new_bundle;
}
bundle_add_conn(bundle, conn);
conn->connection_id = connc->next_connection_id++;
connc->num_conn++;
DEBUGF(infof(data, "Added connection %ld. "
"The cache now contains %zu members",
conn->connection_id, connc->num_conn));
unlock:
CONNCACHE_UNLOCK(data);
result = bundle_add_conn(bundle, conn);
if(result) {
if(new_bundle)
conncache_remove_bundle(data->state.conn_cache, new_bundle);
return result;
}
/*
* Removes the connectdata object from the connection cache, but the transfer
* still owns this connection.
*
* Pass TRUE/FALSE in the 'lock' argument depending on if the parent function
* already holds the lock or not.
*/
void Curl_conncache_remove_conn(struct Curl_easy *data,
struct connectdata *conn, bool lock)
conn->connection_id = connc->next_connection_id++;
connc->num_connections++;
DEBUGF(infof(conn->data, "Added connection %ld. "
"The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n",
conn->connection_id, (curl_off_t) connc->num_connections));
return CURLE_OK;
}
void Curl_conncache_remove_conn(struct conncache *connc,
struct connectdata *conn)
{
struct connectbundle *bundle = conn->bundle;
struct conncache *connc = data->state.conn_cache;
/* The bundle pointer can be NULL, since this function can be called
due to a failed connection attempt, before being added to a bundle */
if(bundle) {
if(lock) {
CONNCACHE_LOCK(data);
}
bundle_remove_conn(bundle, conn);
if(bundle->num_connections == 0)
if(bundle->num_connections == 0) {
conncache_remove_bundle(connc, bundle);
conn->bundle = NULL; /* removed from it */
}
if(connc) {
connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn));
}
if(lock) {
CONNCACHE_UNLOCK(data);
connc->num_connections--;
DEBUGF(infof(conn->data, "The cache now contains %"
CURL_FORMAT_CURL_OFF_TU " members\n",
(curl_off_t) connc->num_connections));
}
}
}
/* This function iterates the entire connection cache and calls the function
func() with the connection pointer as the first argument and the supplied
'param' argument as the other.
The conncache lock is still held when the callback is called. It needs it,
so that it can safely continue traversing the lists once the callback
returns.
Returns 1 if the loop was aborted due to the callback's return code.
/* This function iterates the entire connection cache and calls the
function func() with the connection pointer as the first argument
and the supplied 'param' argument as the other,
Return 0 from func() to continue the loop, return 1 to abort it.
*/
bool Curl_conncache_foreach(struct Curl_easy *data,
struct conncache *connc,
void Curl_conncache_foreach(struct conncache *connc,
void *param,
int (*func)(struct Curl_easy *data,
struct connectdata *conn, void *param))
int (*func)(struct connectdata *conn, void *param))
{
struct Curl_hash_iterator iter;
struct Curl_llist_element *curr;
struct Curl_hash_element *he;
struct curl_hash_iterator iter;
struct curl_llist_element *curr;
struct curl_hash_element *he;
if(!connc)
return FALSE;
return;
CONNCACHE_LOCK(data);
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
@ -340,34 +290,26 @@ bool Curl_conncache_foreach(struct Curl_easy *data,
struct connectdata *conn = curr->ptr;
curr = curr->next;
if(1 == func(data, conn, param)) {
CONNCACHE_UNLOCK(data);
return TRUE;
if(1 == func(conn, param))
return;
}
}
}
CONNCACHE_UNLOCK(data);
return FALSE;
}
/* Return the first connection found in the cache. Used when closing all
connections.
NOTE: no locking is done here as this is presumably only done when cleaning
up a cache!
*/
static struct connectdata *
conncache_find_first_connection(struct conncache *connc)
connections */
struct connectdata *
Curl_conncache_find_first_connection(struct conncache *connc)
{
struct Curl_hash_iterator iter;
struct Curl_hash_element *he;
struct curl_hash_iterator iter;
struct curl_hash_element *he;
struct connectbundle *bundle;
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
while(he) {
struct Curl_llist_element *curr;
struct curl_llist_element *curr;
bundle = he->ptr;
curr = bundle->conn_list.head;
@ -381,188 +323,14 @@ conncache_find_first_connection(struct conncache *connc)
return NULL;
}
/*
* Give ownership of a connection back to the connection cache. Might
* disconnect the oldest existing in there to make space.
*
* Return TRUE if stored, FALSE if closed.
*/
bool Curl_conncache_return_conn(struct Curl_easy *data,
struct connectdata *conn)
{
/* data->multi->maxconnects can be negative, deal with it. */
size_t maxconnects =
(data->multi->maxconnects < 0) ? data->multi->num_easy * 4:
data->multi->maxconnects;
struct connectdata *conn_candidate = NULL;
conn->lastused = Curl_now(); /* it was used up until now */
if(maxconnects > 0 &&
Curl_conncache_size(data) > maxconnects) {
infof(data, "Connection cache is full, closing the oldest one");
conn_candidate = Curl_conncache_extract_oldest(data);
if(conn_candidate) {
/* the winner gets the honour of being disconnected */
Curl_disconnect(data, conn_candidate, /* dead_connection */ FALSE);
}
}
return (conn_candidate == conn) ? FALSE : TRUE;
}
/*
* This function finds the connection in the connection bundle that has been
* unused for the longest time.
*
* Does not lock the connection cache!
*
* Returns the pointer to the oldest idle connection, or NULL if none was
* found.
*/
struct connectdata *
Curl_conncache_extract_bundle(struct Curl_easy *data,
struct connectbundle *bundle)
{
struct Curl_llist_element *curr;
timediff_t highscore = -1;
timediff_t score;
struct curltime now;
struct connectdata *conn_candidate = NULL;
struct connectdata *conn;
(void)data;
now = Curl_now();
curr = bundle->conn_list.head;
while(curr) {
conn = curr->ptr;
if(!CONN_INUSE(conn)) {
/* Set higher score for the age passed since the connection was used */
score = Curl_timediff(now, conn->lastused);
if(score > highscore) {
highscore = score;
conn_candidate = conn;
}
}
curr = curr->next;
}
if(conn_candidate) {
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle, conn_candidate);
data->state.conn_cache->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members",
data->state.conn_cache->num_conn));
}
return conn_candidate;
}
/*
* This function finds the connection in the connection cache that has been
* unused for the longest time and extracts that from the bundle.
*
* Returns the pointer to the connection, or NULL if none was found.
*/
struct connectdata *
Curl_conncache_extract_oldest(struct Curl_easy *data)
{
struct conncache *connc = data->state.conn_cache;
struct Curl_hash_iterator iter;
struct Curl_llist_element *curr;
struct Curl_hash_element *he;
timediff_t highscore =- 1;
timediff_t score;
struct curltime now;
struct connectdata *conn_candidate = NULL;
struct connectbundle *bundle;
struct connectbundle *bundle_candidate = NULL;
now = Curl_now();
CONNCACHE_LOCK(data);
Curl_hash_start_iterate(&connc->hash, &iter);
he = Curl_hash_next_element(&iter);
while(he) {
struct connectdata *conn;
bundle = he->ptr;
curr = bundle->conn_list.head;
while(curr) {
conn = curr->ptr;
if(!CONN_INUSE(conn) && !conn->bits.close &&
!conn->connect_only) {
/* Set higher score for the age passed since the connection was used */
score = Curl_timediff(now, conn->lastused);
if(score > highscore) {
highscore = score;
conn_candidate = conn;
bundle_candidate = bundle;
}
}
curr = curr->next;
}
he = Curl_hash_next_element(&iter);
}
if(conn_candidate) {
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle_candidate, conn_candidate);
connc->num_conn--;
DEBUGF(infof(data, "The cache now contains %zu members",
connc->num_conn));
}
CONNCACHE_UNLOCK(data);
return conn_candidate;
}
void Curl_conncache_close_all_connections(struct conncache *connc)
{
struct connectdata *conn;
char buffer[READBUFFER_MIN + 1];
SIGPIPE_VARIABLE(pipe_st);
if(!connc->closure_handle)
return;
connc->closure_handle->state.buffer = buffer;
connc->closure_handle->set.buffer_size = READBUFFER_MIN;
conn = conncache_find_first_connection(connc);
while(conn) {
sigpipe_ignore(connc->closure_handle, &pipe_st);
/* This will remove the connection from the cache */
connclose(conn, "kill all");
Curl_conncache_remove_conn(connc->closure_handle, conn, TRUE);
Curl_disconnect(connc->closure_handle, conn, FALSE);
sigpipe_restore(&pipe_st);
conn = conncache_find_first_connection(connc);
}
connc->closure_handle->state.buffer = NULL;
sigpipe_ignore(connc->closure_handle, &pipe_st);
Curl_hostcache_clean(connc->closure_handle,
connc->closure_handle->dns.hostcache);
Curl_close(&connc->closure_handle);
sigpipe_restore(&pipe_st);
}
#if 0
/* Useful for debugging the connection cache */
void Curl_conncache_print(struct conncache *connc)
{
struct Curl_hash_iterator iter;
struct Curl_llist_element *curr;
struct Curl_hash_element *he;
struct curl_hash_iterator iter;
struct curl_llist_element *curr;
struct curl_hash_element *he;
if(!connc)
return;

View File

@ -7,12 +7,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2015 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2015 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <linus@haxx.se>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -21,101 +21,48 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
* All accesses to struct fields and changing of data in the connection cache
* and connectbundles must be done with the conncache LOCKED. The cache might
* be shared.
*/
#include <curl/curl.h>
#include "timeval.h"
struct connectdata;
struct conncache {
struct Curl_hash hash;
size_t num_conn;
struct curl_hash hash;
size_t num_connections;
long next_connection_id;
struct curltime last_cleanup;
/* handle used for closing cached connections */
struct Curl_easy *closure_handle;
struct timeval last_cleanup;
};
#define BUNDLE_NO_MULTIUSE -1
#define BUNDLE_UNKNOWN 0 /* initial value */
#define BUNDLE_PIPELINING 1
#define BUNDLE_MULTIPLEX 2
#ifdef CURLDEBUG
/* the debug versions of these macros make extra certain that the lock is
never doubly locked or unlocked */
#define CONNCACHE_LOCK(x) \
do { \
if((x)->share) { \
Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, \
CURL_LOCK_ACCESS_SINGLE); \
DEBUGASSERT(!(x)->state.conncache_lock); \
(x)->state.conncache_lock = TRUE; \
} \
} while(0)
#define CONNCACHE_UNLOCK(x) \
do { \
if((x)->share) { \
DEBUGASSERT((x)->state.conncache_lock); \
(x)->state.conncache_lock = FALSE; \
Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT); \
} \
} while(0)
#else
#define CONNCACHE_LOCK(x) if((x)->share) \
Curl_share_lock((x), CURL_LOCK_DATA_CONNECT, CURL_LOCK_ACCESS_SINGLE)
#define CONNCACHE_UNLOCK(x) if((x)->share) \
Curl_share_unlock((x), CURL_LOCK_DATA_CONNECT)
#endif
struct connectbundle {
int multiuse; /* supports multi-use */
size_t num_connections; /* Number of connections in the bundle */
struct Curl_llist conn_list; /* The connectdata members of the bundle */
struct curl_llist conn_list; /* The connectdata members of the bundle */
};
/* returns 1 on error, 0 is fine */
int Curl_conncache_init(struct conncache *, int size);
void Curl_conncache_destroy(struct conncache *connc);
/* return the correct bundle, to a host or a proxy */
struct connectbundle *Curl_conncache_find_bundle(struct Curl_easy *data,
struct connectdata *conn,
struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn,
struct conncache *connc);
/* returns number of connections currently held in the connection cache */
size_t Curl_conncache_size(struct Curl_easy *data);
bool Curl_conncache_return_conn(struct Curl_easy *data,
CURLcode Curl_conncache_add_conn(struct conncache *connc,
struct connectdata *conn);
CURLcode Curl_conncache_add_conn(struct Curl_easy *data) WARN_UNUSED_RESULT;
void Curl_conncache_remove_conn(struct Curl_easy *data,
struct connectdata *conn,
bool lock);
bool Curl_conncache_foreach(struct Curl_easy *data,
struct conncache *connc,
void Curl_conncache_remove_conn(struct conncache *connc,
struct connectdata *conn);
void Curl_conncache_foreach(struct conncache *connc,
void *param,
int (*func)(struct Curl_easy *data,
struct connectdata *conn,
int (*func)(struct connectdata *conn,
void *param));
struct connectdata *
Curl_conncache_find_first_connection(struct conncache *connc);
struct connectdata *
Curl_conncache_extract_bundle(struct Curl_easy *data,
struct connectbundle *bundle);
struct connectdata *
Curl_conncache_extract_oldest(struct Curl_easy *data);
void Curl_conncache_close_all_connections(struct conncache *connc);
void Curl_conncache_print(struct conncache *connc);
#endif /* HEADER_CURL_CONNCACHE_H */

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,26 +20,28 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "nonblock.h" /* for curlx_nonblock(), formerly Curl_nonblock() */
#include "sockaddr.h"
#include "timeval.h"
CURLcode Curl_connecthost(struct Curl_easy *data,
struct connectdata *conn,
CURLcode Curl_is_connected(struct connectdata *conn,
int sockindex,
bool *connected);
CURLcode Curl_connecthost(struct connectdata *conn,
const struct Curl_dns_entry *host);
/* generic function that returns how much time there's left to run, according
to the timeouts set */
timediff_t Curl_timeleft(struct Curl_easy *data,
struct curltime *nowp,
time_t Curl_timeleft(struct Curl_easy *data,
struct timeval *nowp,
bool duringconnect);
#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
#define HAPPY_EYEBALLS_TIMEOUT 200 /* milliseconds to wait between
IPv4/IPv6 connection attempts */
/*
* Used to extract socket and connectdata struct for the most recent
@ -50,13 +52,10 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
curl_socket_t Curl_getconnectinfo(struct Curl_easy *data,
struct connectdata **connp);
bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
char *addr, int *port);
/*
* Check if a connection seems to be alive.
*/
bool Curl_connalive(struct Curl_easy *data, struct connectdata *conn);
bool Curl_connalive(struct connectdata *conn);
#ifdef USE_WINSOCK
/* When you run a program that uses the Windows Sockets API, you may
@ -73,16 +72,9 @@ void Curl_sndbufset(curl_socket_t sockfd);
#define Curl_sndbufset(y) Curl_nop_stmt
#endif
void Curl_updateconninfo(struct Curl_easy *data, struct connectdata *conn,
curl_socket_t sockfd);
void Curl_conninfo_remote(struct Curl_easy *data, struct connectdata *conn,
curl_socket_t sockfd);
void Curl_conninfo_local(struct Curl_easy *data, curl_socket_t sockfd,
char *local_ip, int *local_port);
void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
char *local_ip, int local_port);
int Curl_closesocket(struct Curl_easy *data, struct connectdata *conn,
curl_socket_t sock);
void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd);
void Curl_persistconninfo(struct connectdata *conn);
int Curl_closesocket(struct connectdata *conn, curl_socket_t sock);
/*
* The Curl_sockaddr_ex structure is basically libcurl's external API
@ -110,11 +102,13 @@ struct Curl_sockaddr_ex {
* socket callback is set, used that!
*
*/
CURLcode Curl_socket(struct Curl_easy *data,
const struct Curl_addrinfo *ai,
CURLcode Curl_socket(struct connectdata *conn,
const Curl_addrinfo *ai,
struct Curl_sockaddr_ex *addr,
curl_socket_t *sockfd);
void Curl_tcpnodelay(struct connectdata *conn, curl_socket_t sockfd);
/*
* Curl_conncontrol() marks the end of a connection/stream. The 'closeit'
* argument specifies if it is the end of a connection or a stream.
@ -148,13 +142,6 @@ void Curl_conncontrol(struct connectdata *conn,
#define connkeep(x,y) Curl_conncontrol(x, CONNCTRL_KEEP)
#endif
CURLcode Curl_conn_socket_set(struct Curl_easy *data,
struct connectdata *conn,
int sockindex);
CURLcode Curl_conn_socket_accepted_set(struct Curl_easy *data,
struct connectdata *conn,
int sockindex,
curl_socket_t *s);
bool Curl_conn_data_pending(struct connectdata *conn, int sockindex);
#endif /* HEADER_CURL_CONNECT_H */

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,37 +20,29 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
struct contenc_writer {
const struct content_encoding *handler; /* Encoding handler. */
struct contenc_writer *downstream; /* Downstream writer. */
};
/*
* Comma-separated list all supported Content-Encodings ('identity' is implied)
*/
#ifdef HAVE_LIBZ
#define ALL_CONTENT_ENCODINGS "deflate, gzip"
/* force a cleanup */
void Curl_unencode_cleanup(struct connectdata *conn);
#else
#define ALL_CONTENT_ENCODINGS "identity"
#define Curl_unencode_cleanup(x) Curl_nop_stmt
#endif
/* Content encoding writer. */
struct content_encoding {
const char *name; /* Encoding name. */
const char *alias; /* Encoding name alias. */
CURLcode (*init_writer)(struct Curl_easy *data,
struct contenc_writer *writer);
CURLcode (*unencode_write)(struct Curl_easy *data,
struct contenc_writer *writer,
const char *buf, size_t nbytes);
void (*close_writer)(struct Curl_easy *data,
struct contenc_writer *writer);
size_t writersize;
};
CURLcode Curl_unencode_deflate_write(struct connectdata *conn,
struct SingleRequest *req,
ssize_t nread);
CURLcode
Curl_unencode_gzip_write(struct connectdata *conn,
struct SingleRequest *k,
ssize_t nread);
CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
const char *enclist, int maybechunked);
CURLcode Curl_unencode_write(struct Curl_easy *data,
struct contenc_writer *writer,
const char *buf, size_t nbytes);
void Curl_unencode_cleanup(struct Curl_easy *data);
char *Curl_all_content_encodings(void);
#endif /* HEADER_CURL_CONTENT_ENCODING_H */

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -36,38 +34,25 @@ struct Cookie {
char *domain; /* domain = <this> */
curl_off_t expires; /* expires = <this> */
char *expirestr; /* the plain text version */
bool tailmatch; /* weather we do tail-matchning of the domain name */
/* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
char *version; /* Version = <value> */
char *maxage; /* Max-Age = <value> */
bool tailmatch; /* whether we do tail-matching of the domain name */
bool secure; /* whether the 'secure' keyword was used */
bool livecookie; /* updated from a server, not a stored file */
bool httponly; /* true if the httponly directive is present */
int creationtime; /* time when the cookie was written */
unsigned char prefix; /* bitmap fields indicating which prefix are set */
};
/*
* Available cookie prefixes, as defined in
* draft-ietf-httpbis-rfc6265bis-02
*/
#define COOKIE_PREFIX__SECURE (1<<0)
#define COOKIE_PREFIX__HOST (1<<1)
#define COOKIE_HASH_SIZE 256
struct CookieInfo {
/* linked list of cookies we know of */
struct Cookie *cookies[COOKIE_HASH_SIZE];
struct Cookie *cookies;
char *filename; /* file we read from/write to */
long numcookies; /* number of cookies in the "jar" */
bool running; /* state info, for cookie adding information */
long numcookies; /* number of cookies in the "jar" */
bool newsession; /* new session, discard session cookies on load */
int lastct; /* last creation-time used in the jar */
curl_off_t next_expiration; /* the next time at which expiration happens */
};
/* This is the maximum line length we accept for a cookie line. RFC 2109
@ -77,31 +62,13 @@ struct CookieInfo {
that comprise the cookie non-terminal in the syntax description of the
Set-Cookie header)"
We allow max 5000 bytes cookie header. Max 4095 bytes length per cookie
name and value. Name + value may not exceed 4096 bytes.
*/
#define MAX_COOKIE_LINE 5000
#define MAX_COOKIE_LINE_TXT "4999"
/* Maximum length of an incoming cookie name or content we deal with. Longer
cookies are ignored. */
#define MAX_NAME 4096
#define MAX_NAME_TXT "4095"
/* Maximum size for an outgoing cookie line libcurl will use in an http
request. This is the default maximum length used in some versions of Apache
httpd. */
#define MAX_COOKIE_HEADER_LEN 8190
/* Maximum number of cookies libcurl will send in a single request, even if
there might be more cookies that match. One reason to cap the number is to
keep the maximum HTTP request within the maximum allowed size. */
#define MAX_COOKIE_SEND_AMOUNT 150
/* Maximum number of Set-Cookie: lines accepted in a single response. If more
such header lines are received, they are ignored. This value must be less
than 256 since an unsigned char is used to count. */
#define MAX_SET_COOKIE_AMOUNT 50
/* This is the maximum length of a cookie name we deal with: */
#define MAX_NAME 1024
#define MAX_NAME_TXT "1023"
struct Curl_easy;
/*
@ -110,14 +77,11 @@ struct Curl_easy;
*/
struct Cookie *Curl_cookie_add(struct Curl_easy *data,
struct CookieInfo *c, bool header,
bool noexpiry, char *lineptr,
const char *domain, const char *path,
bool secure);
struct CookieInfo *, bool header, char *lineptr,
const char *domain, const char *path);
struct Cookie *Curl_cookie_getlist(struct Curl_easy *data,
struct CookieInfo *c, const char *host,
const char *path, bool secure);
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, const char *,
const char *, bool);
void Curl_cookie_freelist(struct Cookie *cookies);
void Curl_cookie_clearall(struct CookieInfo *cookies);
void Curl_cookie_clearsess(struct CookieInfo *cookies);
@ -129,11 +93,10 @@ void Curl_cookie_clearsess(struct CookieInfo *cookies);
#define Curl_cookie_cleanup(x) Curl_nop_stmt
#define Curl_flush_cookies(x,y) Curl_nop_stmt
#else
void Curl_flush_cookies(struct Curl_easy *data, bool cleanup);
void Curl_cookie_cleanup(struct CookieInfo *c);
void Curl_flush_cookies(struct Curl_easy *data, int cleanup);
void Curl_cookie_cleanup(struct CookieInfo *);
struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
const char *file, struct CookieInfo *inc,
bool newsession);
const char *, struct CookieInfo *, bool);
struct curl_slist *Curl_cookie_list(struct Curl_easy *data);
void Curl_cookie_loadfiles(struct Curl_easy *data);
#endif

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -29,9 +27,6 @@
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN6_H
# include <netinet/in6.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
@ -47,6 +42,11 @@
# include <inet.h>
#endif
#if defined(NETWARE) && defined(__NOVELL_LIBC__)
# undef in_addr_t
# define in_addr_t unsigned long
#endif
#include <stddef.h>
#include "curl_addrinfo.h"
@ -75,13 +75,16 @@
#endif
void
Curl_freeaddrinfo(struct Curl_addrinfo *cahead)
Curl_freeaddrinfo(Curl_addrinfo *cahead)
{
struct Curl_addrinfo *vqualifier canext;
struct Curl_addrinfo *ca;
Curl_addrinfo *vqualifier canext;
Curl_addrinfo *ca;
for(ca = cahead; ca; ca = canext) {
for(ca = cahead; ca != NULL; ca = canext) {
free(ca->ai_addr);
free(ca->ai_canonname);
canext = ca->ai_next;
free(ca);
}
}
@ -106,13 +109,13 @@ int
Curl_getaddrinfo_ex(const char *nodename,
const char *servname,
const struct addrinfo *hints,
struct Curl_addrinfo **result)
Curl_addrinfo **result)
{
const struct addrinfo *ai;
struct addrinfo *aihead;
struct Curl_addrinfo *cafirst = NULL;
struct Curl_addrinfo *calast = NULL;
struct Curl_addrinfo *ca;
Curl_addrinfo *cafirst = NULL;
Curl_addrinfo *calast = NULL;
Curl_addrinfo *ca;
size_t ss_size;
int error;
@ -125,7 +128,7 @@ Curl_getaddrinfo_ex(const char *nodename,
/* traverse the addrinfo list */
for(ai = aihead; ai != NULL; ai = ai->ai_next) {
size_t namelen = ai->ai_canonname ? strlen(ai->ai_canonname) + 1 : 0;
/* ignore elements with unsupported address family, */
/* settle family-specific sockaddr structure size. */
if(ai->ai_family == AF_INET)
@ -138,14 +141,14 @@ Curl_getaddrinfo_ex(const char *nodename,
continue;
/* ignore elements without required address info */
if(!ai->ai_addr || !(ai->ai_addrlen > 0))
if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0))
continue;
/* ignore elements with bogus address size */
if((size_t)ai->ai_addrlen < ss_size)
continue;
ca = malloc(sizeof(struct Curl_addrinfo) + ss_size + namelen);
ca = malloc(sizeof(Curl_addrinfo));
if(!ca) {
error = EAI_MEMORY;
break;
@ -163,12 +166,22 @@ Curl_getaddrinfo_ex(const char *nodename,
ca->ai_canonname = NULL;
ca->ai_next = NULL;
ca->ai_addr = (void *)((char *)ca + sizeof(struct Curl_addrinfo));
ca->ai_addr = malloc(ss_size);
if(!ca->ai_addr) {
error = EAI_MEMORY;
free(ca);
break;
}
memcpy(ca->ai_addr, ai->ai_addr, ss_size);
if(namelen) {
ca->ai_canonname = (void *)((char *)ca->ai_addr + ss_size);
memcpy(ca->ai_canonname, ai->ai_canonname, namelen);
if(ai->ai_canonname != NULL) {
ca->ai_canonname = strdup(ai->ai_canonname);
if(!ca->ai_canonname) {
error = EAI_MEMORY;
free(ca->ai_addr);
free(ca);
break;
}
}
/* if the return list is empty, this becomes the first element */
@ -236,6 +249,7 @@ Curl_getaddrinfo_ex(const char *nodename,
* struct sockaddr *ai_addr;
* struct Curl_addrinfo *ai_next;
* };
* typedef struct Curl_addrinfo Curl_addrinfo;
*
* hostent defined in <netdb.h>
*
@ -252,12 +266,12 @@ Curl_getaddrinfo_ex(const char *nodename,
* #define h_addr h_addr_list[0]
*/
struct Curl_addrinfo *
Curl_addrinfo *
Curl_he2ai(const struct hostent *he, int port)
{
struct Curl_addrinfo *ai;
struct Curl_addrinfo *prevai = NULL;
struct Curl_addrinfo *firstai = NULL;
Curl_addrinfo *ai;
Curl_addrinfo *prevai = NULL;
Curl_addrinfo *firstai = NULL;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;
@ -273,8 +287,8 @@ Curl_he2ai(const struct hostent *he, int port)
DEBUGASSERT((he->h_name != NULL) && (he->h_addr_list != NULL));
for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) {
size_t ss_size;
size_t namelen = strlen(he->h_name) + 1; /* include null-terminatior */
#ifdef ENABLE_IPV6
if(he->h_addrtype == AF_INET6)
ss_size = sizeof(struct sockaddr_in6);
@ -282,17 +296,24 @@ Curl_he2ai(const struct hostent *he, int port)
#endif
ss_size = sizeof(struct sockaddr_in);
/* allocate memory to hold the struct, the address and the name */
ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + namelen);
ai = calloc(1, sizeof(Curl_addrinfo));
if(!ai) {
result = CURLE_OUT_OF_MEMORY;
break;
}
/* put the address after the struct */
ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
/* then put the name after the address */
ai->ai_canonname = (char *)ai->ai_addr + ss_size;
memcpy(ai->ai_canonname, he->h_name, namelen);
ai->ai_canonname = strdup(he->h_name);
if(!ai->ai_canonname) {
result = CURLE_OUT_OF_MEMORY;
free(ai);
break;
}
ai->ai_addr = calloc(1, ss_size);
if(!ai->ai_addr) {
result = CURLE_OUT_OF_MEMORY;
free(ai->ai_canonname);
free(ai);
break;
}
if(!firstai)
/* store the pointer we want to return from this function */
@ -317,7 +338,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr->sin_addr, curr, sizeof(struct in_addr));
addr->sin_family = (CURL_SA_FAMILY_T)(he->h_addrtype);
addr->sin_family = (unsigned short)(he->h_addrtype);
addr->sin_port = htons((unsigned short)port);
break;
@ -326,7 +347,7 @@ Curl_he2ai(const struct hostent *he, int port)
addr6 = (void *)ai->ai_addr; /* storage area for this info */
memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr));
addr6->sin6_family = (CURL_SA_FAMILY_T)(he->h_addrtype);
addr6->sin6_family = (unsigned short)(he->h_addrtype);
addr6->sin6_port = htons((unsigned short)port);
break;
#endif
@ -365,10 +386,10 @@ struct namebuff {
* given address/host
*/
struct Curl_addrinfo *
Curl_addrinfo *
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
{
struct Curl_addrinfo *ai;
Curl_addrinfo *ai;
#if defined(__VMS) && \
defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
@ -441,7 +462,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
* Given an IPv4 or IPv6 dotted string address, this converts it to a proper
* allocated Curl_addrinfo struct and returns it.
*/
struct Curl_addrinfo *Curl_str2addr(char *address, int port)
Curl_addrinfo *Curl_str2addr(char *address, int port)
{
struct in_addr in;
if(Curl_inet_pton(AF_INET, address, &in) > 0)
@ -464,19 +485,22 @@ struct Curl_addrinfo *Curl_str2addr(char *address, int port)
* struct initialized with this path.
* Set '*longpath' to TRUE if the error is a too long path.
*/
struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
bool abstract)
Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, bool abstract)
{
struct Curl_addrinfo *ai;
Curl_addrinfo *ai;
struct sockaddr_un *sa_un;
size_t path_len;
*longpath = FALSE;
ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_un));
ai = calloc(1, sizeof(Curl_addrinfo));
if(!ai)
return NULL;
ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
ai->ai_addr = calloc(1, sizeof(struct sockaddr_un));
if(!ai->ai_addr) {
free(ai);
return NULL;
}
sa_un = (void *) ai->ai_addr;
sa_un->sun_family = AF_UNIX;
@ -484,6 +508,7 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
/* sun_path must be able to store the NUL-terminated path */
path_len = strlen(path) + 1;
if(path_len > sizeof(sa_un->sun_path)) {
free(ai->ai_addr);
free(ai);
*longpath = TRUE;
return NULL;
@ -504,10 +529,9 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
}
#endif
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
defined(HAVE_FREEADDRINFO)
#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)
/*
* curl_dbg_freeaddrinfo()
* curl_dofreeaddrinfo()
*
* This is strictly for memory tracing and are using the same style as the
* family otherwise present in memdebug.c. I put these ones here since they
@ -515,23 +539,23 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
*/
void
curl_dbg_freeaddrinfo(struct addrinfo *freethis,
curl_dofreeaddrinfo(struct addrinfo *freethis,
int line, const char *source)
{
curl_dbg_log("ADDR %s:%d freeaddrinfo(%p)\n",
source, line, (void *)freethis);
#ifdef USE_LWIPSOCK
lwip_freeaddrinfo(freethis);
#else
(freeaddrinfo)(freethis);
#endif
curl_memlog("ADDR %s:%d freeaddrinfo(%p)\n",
source, line, (void *)freethis);
}
#endif /* defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) */
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
/*
* curl_dbg_getaddrinfo()
* curl_dogetaddrinfo()
*
* This is strictly for memory tracing and are using the same style as the
* family otherwise present in memdebug.c. I put these ones here since they
@ -539,7 +563,7 @@ curl_dbg_freeaddrinfo(struct addrinfo *freethis,
*/
int
curl_dbg_getaddrinfo(const char *hostname,
curl_dogetaddrinfo(const char *hostname,
const char *service,
const struct addrinfo *hints,
struct addrinfo **result,
@ -552,10 +576,10 @@ curl_dbg_getaddrinfo(const char *hostname,
#endif
if(0 == res)
/* success */
curl_dbg_log("ADDR %s:%d getaddrinfo() = %p\n",
curl_memlog("ADDR %s:%d getaddrinfo() = %p\n",
source, line, (void *)*result);
else
curl_dbg_log("ADDR %s:%d getaddrinfo() failed\n",
curl_memlog("ADDR %s:%d getaddrinfo() failed\n",
source, line);
return res;
}
@ -566,9 +590,9 @@ curl_dbg_getaddrinfo(const char *hostname,
* Work-arounds the sin6_port is always zero bug on iOS 9.3.2 and Mac OS X
* 10.11.5.
*/
void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port)
void Curl_addrinfo_set_port(Curl_addrinfo *addrinfo, int port)
{
struct Curl_addrinfo *ca;
Curl_addrinfo *ca;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -42,6 +40,7 @@
# include <stdlib.h>
#endif
/*
* Curl_addrinfo is our internal struct definition that we use to allow
* consistent internal handling of this data. We use this even when the
@ -59,47 +58,50 @@ struct Curl_addrinfo {
struct sockaddr *ai_addr;
struct Curl_addrinfo *ai_next;
};
typedef struct Curl_addrinfo Curl_addrinfo;
void
Curl_freeaddrinfo(struct Curl_addrinfo *cahead);
Curl_freeaddrinfo(Curl_addrinfo *cahead);
#ifdef HAVE_GETADDRINFO
int
Curl_getaddrinfo_ex(const char *nodename,
const char *servname,
const struct addrinfo *hints,
struct Curl_addrinfo **result);
Curl_addrinfo **result);
#endif
struct Curl_addrinfo *
Curl_addrinfo *
Curl_he2ai(const struct hostent *he, int port);
struct Curl_addrinfo *
Curl_addrinfo *
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
struct Curl_addrinfo *Curl_str2addr(char *dotted, int port);
Curl_addrinfo *Curl_str2addr(char *dotted, int port);
#ifdef USE_UNIX_SOCKETS
struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
bool abstract);
Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath, bool abstract);
#endif
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
defined(HAVE_FREEADDRINFO)
void
curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line, const char *source);
curl_dofreeaddrinfo(struct addrinfo *freethis,
int line, const char *source);
#endif
#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
int
curl_dbg_getaddrinfo(const char *hostname, const char *service,
const struct addrinfo *hints, struct addrinfo **result,
curl_dogetaddrinfo(const char *hostname,
const char *service,
const struct addrinfo *hints,
struct addrinfo **result,
int line, const char *source);
#endif
#ifdef HAVE_GETADDRINFO
#ifdef USE_RESOLVE_ON_IPS
void Curl_addrinfo_set_port(struct Curl_addrinfo *addrinfo, int port);
void Curl_addrinfo_set_port(Curl_addrinfo *addrinfo, int port);
#else
#define Curl_addrinfo_set_port(x,y)
#endif

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,14 +20,15 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
CURLcode Curl_base64_encode(const char *inputbuff, size_t insize,
CURLcode Curl_base64_encode(struct Curl_easy *data,
const char *inputbuff, size_t insize,
char **outptr, size_t *outlen);
CURLcode Curl_base64url_encode(const char *inputbuff, size_t insize,
CURLcode Curl_base64url_encode(struct Curl_easy *data,
const char *inputbuff, size_t insize,
char **outptr, size_t *outlen);
CURLcode Curl_base64_decode(const char *src,
unsigned char **outptr, size_t *outlen);

View File

@ -1,122 +1,69 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* lib/curl_config.h.in. Generated somehow by cmake. */
/* Location of default ca bundle */
#cmakedefine CURL_CA_BUNDLE "${CURL_CA_BUNDLE}"
/* when building libcurl itself */
#cmakedefine BUILDING_LIBCURL 1
/* define "1" to use built-in ca store of TLS backend */
#cmakedefine CURL_CA_FALLBACK 1
/* Location of default ca bundle */
#cmakedefine CURL_CA_BUNDLE ${CURL_CA_BUNDLE}
/* Location of default ca path */
#cmakedefine CURL_CA_PATH "${CURL_CA_PATH}"
#cmakedefine CURL_CA_PATH ${CURL_CA_PATH}
/* disables alt-svc */
#cmakedefine CURL_DISABLE_ALTSVC 1
/* disables cookies support */
/* to disable cookies support */
#cmakedefine CURL_DISABLE_COOKIES 1
/* disables cryptographic authentication */
/* to disable cryptographic authentication */
#cmakedefine CURL_DISABLE_CRYPTO_AUTH 1
/* disables DICT */
/* to disable DICT */
#cmakedefine CURL_DISABLE_DICT 1
/* disables DNS-over-HTTPS */
#cmakedefine CURL_DISABLE_DOH 1
/* disables FILE */
/* to disable FILE */
#cmakedefine CURL_DISABLE_FILE 1
/* disables FTP */
/* to disable FTP */
#cmakedefine CURL_DISABLE_FTP 1
/* disables GOPHER */
/* to disable GOPHER */
#cmakedefine CURL_DISABLE_GOPHER 1
/* disables HSTS support */
#cmakedefine CURL_DISABLE_HSTS 1
/* disables HTTP */
#cmakedefine CURL_DISABLE_HTTP 1
/* disables IMAP */
/* to disable IMAP */
#cmakedefine CURL_DISABLE_IMAP 1
/* disables LDAP */
/* to disable HTTP */
#cmakedefine CURL_DISABLE_HTTP 1
/* to disable LDAP */
#cmakedefine CURL_DISABLE_LDAP 1
/* disables LDAPS */
/* to disable LDAPS */
#cmakedefine CURL_DISABLE_LDAPS 1
/* disables --libcurl option from the curl tool */
#cmakedefine CURL_DISABLE_LIBCURL_OPTION 1
/* disables MIME support */
#cmakedefine CURL_DISABLE_MIME 1
/* disables MQTT */
#cmakedefine CURL_DISABLE_MQTT 1
/* disables netrc parser */
#cmakedefine CURL_DISABLE_NETRC 1
/* disables NTLM support */
#cmakedefine CURL_DISABLE_NTLM 1
/* disables date parsing */
#cmakedefine CURL_DISABLE_PARSEDATE 1
/* disables POP3 */
/* to disable POP3 */
#cmakedefine CURL_DISABLE_POP3 1
/* disables built-in progress meter */
#cmakedefine CURL_DISABLE_PROGRESS_METER 1
/* disables proxies */
/* to disable proxies */
#cmakedefine CURL_DISABLE_PROXY 1
/* disables RTSP */
/* to disable RTSP */
#cmakedefine CURL_DISABLE_RTSP 1
/* disables SMB */
/* to disable RTMP */
#cmakedefine CURL_DISABLE_RTMP 1
/* to disable SMB */
#cmakedefine CURL_DISABLE_SMB 1
/* disables SMTP */
/* to disable SMTP */
#cmakedefine CURL_DISABLE_SMTP 1
/* disables use of socketpair for curl_multi_poll */
#cmakedefine CURL_DISABLE_SOCKETPAIR 1
/* disables TELNET */
/* to disable TELNET */
#cmakedefine CURL_DISABLE_TELNET 1
/* disables TFTP */
/* to disable TFTP */
#cmakedefine CURL_DISABLE_TFTP 1
/* disables verbose strings */
/* to disable verbose strings */
#cmakedefine CURL_DISABLE_VERBOSE_STRINGS 1
/* to make a symbol visible */
@ -126,35 +73,56 @@
#define CURL_EXTERN_SYMBOL
#endif
/* Allow SMB to work on Windows */
#cmakedefine USE_WIN32_CRYPTO 1
/* Use Windows LDAP implementation */
#cmakedefine USE_WIN32_LDAP 1
/* when not building a shared library */
#cmakedefine CURL_STATICLIB 1
/* Set to explicitly specify we don't want to use thread-safe functions */
#cmakedefine DISABLED_THREADSAFE 1
/* your Entropy Gathering Daemon socket pathname */
#cmakedefine EGD_SOCKET ${EGD_SOCKET}
/* Define if you want to enable IPv6 support */
#cmakedefine ENABLE_IPV6 1
/* Define to the type qualifier of arg 1 for getnameinfo. */
#cmakedefine GETNAMEINFO_QUAL_ARG1 ${GETNAMEINFO_QUAL_ARG1}
/* Define to the type of arg 1 for getnameinfo. */
#cmakedefine GETNAMEINFO_TYPE_ARG1 ${GETNAMEINFO_TYPE_ARG1}
/* Define to the type of arg 2 for getnameinfo. */
#cmakedefine GETNAMEINFO_TYPE_ARG2 ${GETNAMEINFO_TYPE_ARG2}
/* Define to the type of args 4 and 6 for getnameinfo. */
#cmakedefine GETNAMEINFO_TYPE_ARG46 ${GETNAMEINFO_TYPE_ARG46}
/* Define to the type of arg 7 for getnameinfo. */
#cmakedefine GETNAMEINFO_TYPE_ARG7 ${GETNAMEINFO_TYPE_ARG7}
/* Specifies the number of arguments to getservbyport_r */
#cmakedefine GETSERVBYPORT_R_ARGS ${GETSERVBYPORT_R_ARGS}
/* Specifies the size of the buffer to pass to getservbyport_r */
#cmakedefine GETSERVBYPORT_R_BUFSIZE ${GETSERVBYPORT_R_BUFSIZE}
/* Define to 1 if you have the alarm function. */
#cmakedefine HAVE_ALARM 1
/* Define to 1 if you have the <alloca.h> header file. */
#cmakedefine HAVE_ALLOCA_H 1
/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/tftp.h> header file. */
#cmakedefine HAVE_ARPA_TFTP_H 1
/* Define to 1 if you have _Atomic support. */
#cmakedefine HAVE_ATOMIC 1
/* Define to 1 if you have the `fchmod' function. */
#cmakedefine HAVE_FCHMOD 1
/* Define to 1 if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H 1
/* Define to 1 if you have the `basename' function. */
#cmakedefine HAVE_BASENAME 1
@ -162,15 +130,33 @@
/* Define to 1 if bool is an available type. */
#cmakedefine HAVE_BOOL_T 1
/* Define to 1 if you have the __builtin_available function. */
#cmakedefine HAVE_BUILTIN_AVAILABLE 1
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#cmakedefine HAVE_CLOCK_GETTIME_MONOTONIC 1
/* Define to 1 if you have the `closesocket' function. */
#cmakedefine HAVE_CLOSESOCKET 1
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
#cmakedefine HAVE_CRYPTO_CLEANUP_ALL_EX_DATA 1
/* Define to 1 if you have the <crypto.h> header file. */
#cmakedefine HAVE_CRYPTO_H 1
/* Define to 1 if you have the <des.h> header file. */
#cmakedefine HAVE_DES_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
#cmakedefine HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H 1
/* Define to 1 if you have the <err.h> header file. */
#cmakedefine HAVE_ERR_H 1
/* Define to 1 if you have the fcntl function. */
#cmakedefine HAVE_FCNTL 1
@ -180,23 +166,44 @@
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#cmakedefine HAVE_FCNTL_O_NONBLOCK 1
/* Define to 1 if you have the fdopen function. */
#cmakedefine HAVE_FDOPEN 1
/* Define to 1 if you have the `fork' function. */
#cmakedefine HAVE_FORK 1
/* Define to 1 if you have the freeaddrinfo function. */
#cmakedefine HAVE_FREEADDRINFO 1
/* Define to 1 if you have the freeifaddrs function. */
#cmakedefine HAVE_FREEIFADDRS 1
/* Define to 1 if you have the ftruncate function. */
#cmakedefine HAVE_FTRUNCATE 1
/* Define to 1 if you have a working getaddrinfo function. */
#cmakedefine HAVE_GETADDRINFO 1
/* Define to 1 if the getaddrinfo function is threadsafe. */
#cmakedefine HAVE_GETADDRINFO_THREADSAFE 1
/* Define to 1 if you have the `geteuid' function. */
#cmakedefine HAVE_GETEUID 1
/* Define to 1 if you have the `getppid' function. */
#cmakedefine HAVE_GETPPID 1
/* Define to 1 if you have the gethostbyaddr function. */
#cmakedefine HAVE_GETHOSTBYADDR 1
/* Define to 1 if you have the gethostbyaddr_r function. */
#cmakedefine HAVE_GETHOSTBYADDR_R 1
/* gethostbyaddr_r() takes 5 args */
#cmakedefine HAVE_GETHOSTBYADDR_R_5 1
/* gethostbyaddr_r() takes 7 args */
#cmakedefine HAVE_GETHOSTBYADDR_R_7 1
/* gethostbyaddr_r() takes 8 args */
#cmakedefine HAVE_GETHOSTBYADDR_R_8 1
/* Define to 1 if you have the gethostbyname function. */
#cmakedefine HAVE_GETHOSTBYNAME 1
/* Define to 1 if you have the gethostbyname_r function. */
#cmakedefine HAVE_GETHOSTBYNAME_R 1
@ -216,30 +223,27 @@
/* Define to 1 if you have a working getifaddrs function. */
#cmakedefine HAVE_GETIFADDRS 1
/* Define to 1 if you have the getnameinfo function. */
#cmakedefine HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getpass_r' function. */
#cmakedefine HAVE_GETPASS_R 1
/* Define to 1 if you have the `getppid' function. */
#cmakedefine HAVE_GETPPID 1
/* Define to 1 if you have the `getpeername' function. */
#cmakedefine HAVE_GETPEERNAME 1
/* Define to 1 if you have the `getsockname' function. */
#cmakedefine HAVE_GETSOCKNAME 1
/* Define to 1 if you have the `if_nametoindex' function. */
#cmakedefine HAVE_IF_NAMETOINDEX 1
/* Define to 1 if you have the `getprotobyname' function. */
#cmakedefine HAVE_GETPROTOBYNAME 1
/* Define to 1 if you have the `getpwuid' function. */
#cmakedefine HAVE_GETPWUID 1
/* Define to 1 if you have the `getpwuid_r' function. */
#cmakedefine HAVE_GETPWUID_R 1
/* Define to 1 if you have the `getrlimit' function. */
#cmakedefine HAVE_GETRLIMIT 1
/* Define to 1 if you have the getservbyport_r function. */
#cmakedefine HAVE_GETSERVBYPORT_R 1
/* Define to 1 if you have the `gettimeofday' function. */
#cmakedefine HAVE_GETTIMEOFDAY 1
@ -273,24 +277,39 @@
/* Define to 1 if you have the `idna_strerror' function. */
#cmakedefine HAVE_IDNA_STRERROR 1
/* Define to 1 if you have the `idn_free' function. */
#cmakedefine HAVE_IDN_FREE 1
/* Define to 1 if you have the <idn-free.h> header file. */
#cmakedefine HAVE_IDN_FREE_H 1
/* Define to 1 if you have the <ifaddrs.h> header file. */
#cmakedefine HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_addr' function. */
#cmakedefine HAVE_INET_ADDR 1
/* Define to 1 if you have the inet_ntoa_r function. */
#cmakedefine HAVE_INET_NTOA_R 1
/* inet_ntoa_r() takes 2 args */
#cmakedefine HAVE_INET_NTOA_R_2 1
/* inet_ntoa_r() takes 3 args */
#cmakedefine HAVE_INET_NTOA_R_3 1
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
#cmakedefine HAVE_INET_NTOP 1
/* Define to 1 if you have a IPv6 capable working inet_pton function. */
#cmakedefine HAVE_INET_PTON 1
/* Define to 1 if symbol `sa_family_t' exists */
#cmakedefine HAVE_SA_FAMILY_T 1
/* Define to 1 if symbol `ADDRESS_FAMILY' exists */
#cmakedefine HAVE_ADDRESS_FAMILY 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the ioctl function. */
#cmakedefine HAVE_IOCTL 1
/* Define to 1 if you have the ioctlsocket function. */
#cmakedefine HAVE_IOCTLSOCKET 1
@ -313,9 +332,21 @@
/* Define to 1 if you have the <io.h> header file. */
#cmakedefine HAVE_IO_H 1
/* if you have the Kerberos4 libraries (including -ldes) */
#cmakedefine HAVE_KRB4 1
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
#cmakedefine HAVE_KRB_GET_OUR_IP_FOR_REALM 1
/* Define to 1 if you have the <krb.h> header file. */
#cmakedefine HAVE_KRB_H 1
/* Define to 1 if you have the lber.h header file. */
#cmakedefine HAVE_LBER_H 1
/* Define to 1 if you have the ldapssl.h header file. */
#cmakedefine HAVE_LDAPSSL_H 1
/* Define to 1 if you have the ldap.h header file. */
#cmakedefine HAVE_LDAP_H 1
@ -331,11 +362,14 @@
/* Define to 1 if you have the <libgen.h> header file. */
#cmakedefine HAVE_LIBGEN_H 1
/* Define to 1 if you have the `idn2' library (-lidn2). */
#cmakedefine HAVE_LIBIDN2 1
/* Define to 1 if you have the `idn' library (-lidn). */
#cmakedefine HAVE_LIBIDN 1
/* Define to 1 if you have the idn2.h header file. */
#cmakedefine HAVE_IDN2_H 1
/* Define to 1 if you have the `resolv' library (-lresolv). */
#cmakedefine HAVE_LIBRESOLV 1
/* Define to 1 if you have the `resolve' library (-lresolve). */
#cmakedefine HAVE_LIBRESOLVE 1
/* Define to 1 if you have the `socket' library (-lsocket). */
#cmakedefine HAVE_LIBSOCKET 1
@ -343,21 +377,51 @@
/* Define to 1 if you have the `ssh2' library (-lssh2). */
#cmakedefine HAVE_LIBSSH2 1
/* Define to 1 if libssh2 provides `libssh2_version'. */
#cmakedefine HAVE_LIBSSH2_VERSION 1
/* Define to 1 if libssh2 provides `libssh2_init'. */
#cmakedefine HAVE_LIBSSH2_INIT 1
/* Define to 1 if libssh2 provides `libssh2_exit'. */
#cmakedefine HAVE_LIBSSH2_EXIT 1
/* Define to 1 if libssh2 provides `libssh2_scp_send64'. */
#cmakedefine HAVE_LIBSSH2_SCP_SEND64 1
/* Define to 1 if libssh2 provides `libssh2_session_handshake'. */
#cmakedefine HAVE_LIBSSH2_SESSION_HANDSHAKE 1
/* Define to 1 if you have the <libssh2.h> header file. */
#cmakedefine HAVE_LIBSSH2_H 1
/* Define to 1 if you have the `ssl' library (-lssl). */
#cmakedefine HAVE_LIBSSL 1
/* if zlib is available */
#cmakedefine HAVE_LIBZ 1
/* if brotli is available */
#cmakedefine HAVE_BROTLI 1
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1
/* if zstd is available */
#cmakedefine HAVE_ZSTD 1
/* if your compiler supports LL */
#cmakedefine HAVE_LL 1
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H 1
/* Define to 1 if you have a working localtime_r function. */
#cmakedefine HAVE_LOCALTIME_R 1
/* Define to 1 if the compiler supports the 'long long' data type. */
#cmakedefine HAVE_LONGLONG 1
/* Define to 1 if you have the malloc.h header file. */
#cmakedefine HAVE_MALLOC_H 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
#cmakedefine HAVE_MSG_NOSIGNAL 1
@ -370,18 +434,51 @@
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#cmakedefine HAVE_NETINET_TCP_H 1
/* Define to 1 if you have the <linux/tcp.h> header file. */
#cmakedefine HAVE_LINUX_TCP_H 1
/* Define to 1 if you have the <net/if.h> header file. */
#cmakedefine HAVE_NET_IF_H 1
/* Define to 1 if NI_WITHSCOPEID exists and works. */
#cmakedefine HAVE_NI_WITHSCOPEID 1
/* if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE */
#cmakedefine HAVE_OLD_GSSMIT 1
/* Define to 1 if you have the <openssl/crypto.h> header file. */
#cmakedefine HAVE_OPENSSL_CRYPTO_H 1
/* Define to 1 if you have the <openssl/engine.h> header file. */
#cmakedefine HAVE_OPENSSL_ENGINE_H 1
/* Define to 1 if you have the <openssl/err.h> header file. */
#cmakedefine HAVE_OPENSSL_ERR_H 1
/* Define to 1 if you have the <openssl/pem.h> header file. */
#cmakedefine HAVE_OPENSSL_PEM_H 1
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
#cmakedefine HAVE_OPENSSL_PKCS12_H 1
/* Define to 1 if you have the <openssl/rsa.h> header file. */
#cmakedefine HAVE_OPENSSL_RSA_H 1
/* Define to 1 if you have the <openssl/ssl.h> header file. */
#cmakedefine HAVE_OPENSSL_SSL_H 1
/* Define to 1 if you have the <openssl/x509.h> header file. */
#cmakedefine HAVE_OPENSSL_X509_H 1
/* Define to 1 if you have the <pem.h> header file. */
#cmakedefine HAVE_PEM_H 1
/* Define to 1 if you have the `perror' function. */
#cmakedefine HAVE_PERROR 1
/* Define to 1 if you have the `pipe' function. */
#cmakedefine HAVE_PIPE 1
/* Define to 1 if you have a working poll function. */
#cmakedefine HAVE_POLL 1
/* If you have a fine poll */
#cmakedefine HAVE_POLL_FINE 1
@ -400,9 +497,21 @@
/* Define to 1 if you have the `RAND_egd' function. */
#cmakedefine HAVE_RAND_EGD 1
/* Define to 1 if you have the `RAND_screen' function. */
#cmakedefine HAVE_RAND_SCREEN 1
/* Define to 1 if you have the `RAND_status' function. */
#cmakedefine HAVE_RAND_STATUS 1
/* Define to 1 if you have the recv function. */
#cmakedefine HAVE_RECV 1
/* Define to 1 if you have the recvfrom function. */
#cmakedefine HAVE_RECVFROM 1
/* Define to 1 if you have the <rsa.h> header file. */
#cmakedefine HAVE_RSA_H 1
/* Define to 1 if you have the select function. */
#cmakedefine HAVE_SELECT 1
@ -430,9 +539,15 @@
/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine HAVE_SETRLIMIT 1
/* Define to 1 if you have the setsockopt function. */
#cmakedefine HAVE_SETSOCKOPT 1
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
#cmakedefine HAVE_SETSOCKOPT_SO_NONBLOCK 1
/* Define to 1 if you have the <sgtty.h> header file. */
#cmakedefine HAVE_SGTTY_H 1
/* Define to 1 if you have the sigaction function. */
#cmakedefine HAVE_SIGACTION 1
@ -448,33 +563,42 @@
/* Define to 1 if you have the sigsetjmp function or macro. */
#cmakedefine HAVE_SIGSETJMP 1
/* Define to 1 if sig_atomic_t is an available typedef. */
#cmakedefine HAVE_SIG_ATOMIC_T 1
/* Define to 1 if sig_atomic_t is already defined as volatile. */
#cmakedefine HAVE_SIG_ATOMIC_T_VOLATILE 1
/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
#cmakedefine HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1
/* Define to 1 if you have the `socket' function. */
#cmakedefine HAVE_SOCKET 1
/* Define to 1 if you have the socketpair function. */
#cmakedefine HAVE_SOCKETPAIR 1
/* Define to 1 if you have the `SSL_get_shutdown' function. */
#cmakedefine HAVE_SSL_GET_SHUTDOWN 1
/* Define to 1 if you have the <ssl.h> header file. */
#cmakedefine HAVE_SSL_H 1
/* Define to 1 if you have the <stdatomic.h> header file. */
#cmakedefine HAVE_STDATOMIC_H 1
/* Define to 1 if you have the <stdbool.h> header file. */
#cmakedefine HAVE_STDBOOL_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#cmakedefine HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the strcasecmp function. */
#cmakedefine HAVE_STRCASECMP 1
/* Define to 1 if you have the strcasestr function. */
#cmakedefine HAVE_STRCASESTR 1
/* Define to 1 if you have the strcmpi function. */
#cmakedefine HAVE_STRCMPI 1
@ -493,9 +617,27 @@
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the strlcat function. */
#cmakedefine HAVE_STRLCAT 1
/* Define to 1 if you have the `strlcpy' function. */
#cmakedefine HAVE_STRLCPY 1
/* Define to 1 if you have the strncasecmp function. */
#cmakedefine HAVE_STRNCASECMP 1
/* Define to 1 if you have the strncmpi function. */
#cmakedefine HAVE_STRNCMPI 1
/* Define to 1 if you have the strnicmp function. */
#cmakedefine HAVE_STRNICMP 1
/* Define to 1 if you have the <stropts.h> header file. */
#cmakedefine HAVE_STROPTS_H 1
/* Define to 1 if you have the strstr function. */
#cmakedefine HAVE_STRSTR 1
/* Define to 1 if you have the strtok_r function. */
#cmakedefine HAVE_STRTOK_R 1
@ -541,6 +683,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#cmakedefine HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/un.h> header file. */
#cmakedefine HAVE_SYS_UN_H 1
@ -556,15 +701,21 @@
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1
/* Define to 1 if you have the <tld.h> header file. */
#cmakedefine HAVE_TLD_H 1
/* Define to 1 if you have the `tld_strerror' function. */
#cmakedefine HAVE_TLD_STRERROR 1
/* Define to 1 if you have the `uname' function. */
#cmakedefine HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the `utime' function. */
#cmakedefine HAVE_UTIME 1
/* Define to 1 if you have the `utimes' function. */
#cmakedefine HAVE_UTIMES 1
/* Define to 1 if you have the <utime.h> header file. */
#cmakedefine HAVE_UTIME_H 1
@ -574,6 +725,9 @@
/* Define to 1 if compiler supports old gcc variadic macro style. */
#cmakedefine HAVE_VARIADIC_MACROS_GCC 1
/* Define to 1 if you have the winber.h header file. */
#cmakedefine HAVE_WINBER_H 1
/* Define to 1 if you have the windows.h header file. */
#cmakedefine HAVE_WINDOWS_H 1
@ -583,12 +737,34 @@
/* Define to 1 if you have the winsock2.h header file. */
#cmakedefine HAVE_WINSOCK2_H 1
/* Define to 1 if you have the winsock.h header file. */
#cmakedefine HAVE_WINSOCK_H 1
/* Define this symbol if your OS supports changing the contents of argv */
#cmakedefine HAVE_WRITABLE_ARGV 1
/* Define to 1 if you have the writev function. */
#cmakedefine HAVE_WRITEV 1
/* Define to 1 if you have the ws2tcpip.h header file. */
#cmakedefine HAVE_WS2TCPIP_H 1
/* Define to 1 if you have the <x509.h> header file. */
#cmakedefine HAVE_X509_H 1
/* Define if you have the <process.h> header file. */
#cmakedefine HAVE_PROCESS_H 1
/* if you have the zlib.h header file */
#cmakedefine HAVE_ZLIB_H 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#cmakedefine LT_OBJDIR ${LT_OBJDIR}
/* If you lack a fine basename() prototype */
#cmakedefine NEED_BASENAME_PROTO 1
/* Define to 1 if you need the lber.h header file even with ldap.h */
#cmakedefine NEED_LBER_H 1
@ -622,36 +798,114 @@
/* a suitable file to read random data from */
#cmakedefine RANDOM_FILE "${RANDOM_FILE}"
/*
Note: SIZEOF_* variables are fetched with CMake through check_type_size().
As per CMake documentation on CheckTypeSize, C preprocessor code is
generated by CMake into SIZEOF_*_CODE. This is what we use in the
following statements.
/* Define to the type of arg 1 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG1 ${RECVFROM_TYPE_ARG1}
Reference: https://cmake.org/cmake/help/latest/module/CheckTypeSize.html
*/
/* Define to the type pointed by arg 2 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG2 ${RECVFROM_TYPE_ARG2}
/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */
#cmakedefine RECVFROM_TYPE_ARG2_IS_VOID 1
/* Define to the type of arg 3 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG3 ${RECVFROM_TYPE_ARG3}
/* Define to the type of arg 4 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG4 ${RECVFROM_TYPE_ARG4}
/* Define to the type pointed by arg 5 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG5 ${RECVFROM_TYPE_ARG5}
/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */
#cmakedefine RECVFROM_TYPE_ARG5_IS_VOID 1
/* Define to the type pointed by arg 6 for recvfrom. */
#cmakedefine RECVFROM_TYPE_ARG6 ${RECVFROM_TYPE_ARG6}
/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */
#cmakedefine RECVFROM_TYPE_ARG6_IS_VOID 1
/* Define to the function return type for recvfrom. */
#cmakedefine RECVFROM_TYPE_RETV ${RECVFROM_TYPE_RETV}
/* Define to the type of arg 1 for recv. */
#cmakedefine RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}
/* Define to the type of arg 2 for recv. */
#cmakedefine RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}
/* Define to the type of arg 3 for recv. */
#cmakedefine RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}
/* Define to the type of arg 4 for recv. */
#cmakedefine RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}
/* Define to the function return type for recv. */
#cmakedefine RECV_TYPE_RETV ${RECV_TYPE_RETV}
/* Define as the return type of signal handlers (`int' or `void'). */
#cmakedefine RETSIGTYPE ${RETSIGTYPE}
/* Define to the type qualifier of arg 5 for select. */
#cmakedefine SELECT_QUAL_ARG5 ${SELECT_QUAL_ARG5}
/* Define to the type of arg 1 for select. */
#cmakedefine SELECT_TYPE_ARG1 ${SELECT_TYPE_ARG1}
/* Define to the type of args 2, 3 and 4 for select. */
#cmakedefine SELECT_TYPE_ARG234 ${SELECT_TYPE_ARG234}
/* Define to the type of arg 5 for select. */
#cmakedefine SELECT_TYPE_ARG5 ${SELECT_TYPE_ARG5}
/* Define to the function return type for select. */
#cmakedefine SELECT_TYPE_RETV ${SELECT_TYPE_RETV}
/* Define to the type qualifier of arg 2 for send. */
#cmakedefine SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}
/* Define to the type of arg 1 for send. */
#cmakedefine SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}
/* Define to the type of arg 2 for send. */
#cmakedefine SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}
/* Define to the type of arg 3 for send. */
#cmakedefine SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}
/* Define to the type of arg 4 for send. */
#cmakedefine SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}
/* Define to the function return type for send. */
#cmakedefine SEND_TYPE_RETV ${SEND_TYPE_RETV}
/* The size of `int', as computed by sizeof. */
${SIZEOF_INT_CODE}
#cmakedefine SIZEOF_INT ${SIZEOF_INT}
/* The size of `short', as computed by sizeof. */
#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT}
/* The size of `long', as computed by sizeof. */
${SIZEOF_LONG_CODE}
#cmakedefine SIZEOF_LONG ${SIZEOF_LONG}
/* The size of `off_t', as computed by sizeof. */
${SIZEOF_OFF_T_CODE}
/* The size of `curl_off_t', as computed by sizeof. */
${SIZEOF_CURL_OFF_T_CODE}
#cmakedefine SIZEOF_OFF_T ${SIZEOF_OFF_T}
/* The size of `size_t', as computed by sizeof. */
${SIZEOF_SIZE_T_CODE}
#cmakedefine SIZEOF_SIZE_T ${SIZEOF_SIZE_T}
/* The size of `time_t', as computed by sizeof. */
${SIZEOF_TIME_T_CODE}
#cmakedefine SIZEOF_TIME_T ${SIZEOF_TIME_T}
/* The size of `void*', as computed by sizeof. */
#cmakedefine SIZEOF_VOIDP ${SIZEOF_VOIDP}
/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS 1
/* Define to the type of arg 3 for strerror_r. */
#cmakedefine STRERROR_R_TYPE_ARG3 ${STRERROR_R_TYPE_ARG3}
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine TIME_WITH_SYS_TIME 1
@ -664,67 +918,39 @@ ${SIZEOF_TIME_T_CODE}
/* Define if you want to enable WIN32 threaded DNS lookup */
#cmakedefine USE_THREADS_WIN32 1
/* Define to disable non-blocking sockets. */
#cmakedefine USE_BLOCKING_SOCKETS 1
/* if GnuTLS is enabled */
#cmakedefine USE_GNUTLS 1
/* if Secure Transport is enabled */
#cmakedefine USE_SECTRANSP 1
/* if PolarSSL is enabled */
#cmakedefine USE_POLARSSL 1
/* if DarwinSSL is enabled */
#cmakedefine USE_DARWINSSL 1
/* if mbedTLS is enabled */
#cmakedefine USE_MBEDTLS 1
/* if BearSSL is enabled */
#cmakedefine USE_BEARSSL 1
/* if WolfSSL is enabled */
#cmakedefine USE_WOLFSSL 1
/* if libSSH is in use */
#cmakedefine USE_LIBSSH 1
/* if libSSH2 is in use */
#cmakedefine USE_LIBSSH2 1
/* if libPSL is in use */
#cmakedefine USE_LIBPSL 1
/* If you want to build curl with the built-in manual */
#cmakedefine USE_MANUAL 1
/* if NSS is enabled */
#cmakedefine USE_NSS 1
/* if you have the PK11_CreateManagedGenericObject function */
#cmakedefine HAVE_PK11_CREATEMANAGEDGENERICOBJECT 1
/* if you want to use OpenLDAP code instead of legacy ldap implementation */
#cmakedefine USE_OPENLDAP 1
/* if OpenSSL is in use */
#cmakedefine USE_OPENSSL 1
/* Define to 1 if you don't want the OpenSSL configuration to be loaded
automatically */
#cmakedefine CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG 1
/* to enable NGHTTP2 */
#cmakedefine USE_NGHTTP2 1
/* to enable NGTCP2 */
#cmakedefine USE_NGTCP2 1
/* to enable NGHTTP3 */
#cmakedefine USE_NGHTTP3 1
/* to enable quiche */
#cmakedefine USE_QUICHE 1
/* Define to 1 if you have the quiche_conn_set_qlog_fd function. */
#cmakedefine HAVE_QUICHE_CONN_SET_QLOG_FD 1
/* to enable msh3 */
#cmakedefine USE_MSH3 1
/* if Unix domain sockets are enabled */
#cmakedefine USE_UNIX_SOCKETS
@ -737,12 +963,15 @@ ${SIZEOF_TIME_T_CODE}
/* to enable Windows SSL */
#cmakedefine USE_SCHANNEL 1
/* enable multiple SSL backends */
#cmakedefine CURL_WITH_MULTI_SSL 1
/* Define to 1 if using yaSSL in OpenSSL compatibility mode. */
#cmakedefine USE_YASSLEMUL 1
/* Version number of package */
#cmakedefine VERSION ${VERSION}
/* Define to avoid automatic inclusion of winsock.h */
#cmakedefine WIN32_LEAN_AND_MEAN 1
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
@ -774,12 +1003,3 @@ ${SIZEOF_TIME_T_CODE}
/* the signed version of size_t */
#cmakedefine ssize_t ${ssize_t}
/* Define to 1 if you have the mach_absolute_time function. */
#cmakedefine HAVE_MACH_ABSOLUTE_TIME 1
/* to enable Windows IDN */
#cmakedefine USE_WIN32_IDN 1
/* Define to 1 to enable websocket support. */
#cmakedefine USE_WEBSOCKETS 1

View File

@ -1,8 +1,5 @@
/* lib/curl_config.h.in. Generated from configure.ac by autoheader. */
/* to enable curl debug memory tracking */
#undef CURLDEBUG
/* Location of default ca bundle */
#undef CURL_CA_BUNDLE
@ -12,12 +9,6 @@
/* Location of default ca path */
#undef CURL_CA_PATH
/* Default SSL backend */
#undef CURL_DEFAULT_SSL_BACKEND
/* disable alt-svc */
#undef CURL_DISABLE_ALTSVC
/* to disable cookies support */
#undef CURL_DISABLE_COOKIES
@ -27,33 +18,18 @@
/* to disable DICT */
#undef CURL_DISABLE_DICT
/* disable DoH */
#undef CURL_DISABLE_DOH
/* to disable FILE */
#undef CURL_DISABLE_FILE
/* to disable FTP */
#undef CURL_DISABLE_FTP
/* to disable curl_easy_options */
#undef CURL_DISABLE_GETOPTIONS
/* to disable Gopher */
#undef CURL_DISABLE_GOPHER
/* disable headers-api */
#undef CURL_DISABLE_HEADERS_API
/* disable alt-svc */
#undef CURL_DISABLE_HSTS
/* to disable HTTP */
#undef CURL_DISABLE_HTTP
/* disable HTTP authentication */
#undef CURL_DISABLE_HTTP_AUTH
/* to disable IMAP */
#undef CURL_DISABLE_IMAP
@ -66,69 +42,36 @@
/* to disable --libcurl C code generation option */
#undef CURL_DISABLE_LIBCURL_OPTION
/* disable mime API */
#undef CURL_DISABLE_MIME
/* to disable MQTT */
#undef CURL_DISABLE_MQTT
/* disable netrc parsing */
#undef CURL_DISABLE_NETRC
/* to disable NTLM support */
#undef CURL_DISABLE_NTLM
/* if the OpenSSL configuration won't be loaded automatically */
#undef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
/* disable date parsing */
#undef CURL_DISABLE_PARSEDATE
/* to disable POP3 */
#undef CURL_DISABLE_POP3
/* disable progress-meter */
#undef CURL_DISABLE_PROGRESS_METER
/* to disable proxies */
#undef CURL_DISABLE_PROXY
/* to disable RTSP */
#undef CURL_DISABLE_RTSP
/* disable DNS shuffling */
#undef CURL_DISABLE_SHUFFLE_DNS
/* to disable SMB/CIFS */
#undef CURL_DISABLE_SMB
/* to disable SMTP */
#undef CURL_DISABLE_SMTP
/* to disable socketpair support */
#undef CURL_DISABLE_SOCKETPAIR
/* to disable TELNET */
#undef CURL_DISABLE_TELNET
/* to disable TFTP */
#undef CURL_DISABLE_TFTP
/* to disable TLS-SRP authentication */
#undef CURL_DISABLE_TLS_SRP
/* to disable verbose strings */
#undef CURL_DISABLE_VERBOSE_STRINGS
/* Definition to make a library symbol externally visible. */
#undef CURL_EXTERN_SYMBOL
/* IP address type in sockaddr */
#undef CURL_SA_FAMILY_T
/* built with multiple SSL backends */
#undef CURL_WITH_MULTI_SSL
/* enable debug build options */
#undef DEBUGBUILD
/* your Entropy Gathering Daemon socket pathname */
#undef EGD_SOCKET
@ -138,17 +81,41 @@
/* Define to the type of arg 2 for gethostname. */
#undef GETHOSTNAME_TYPE_ARG2
/* Define to the type qualifier of arg 1 for getnameinfo. */
#undef GETNAMEINFO_QUAL_ARG1
/* Define to the type of arg 1 for getnameinfo. */
#undef GETNAMEINFO_TYPE_ARG1
/* Define to the type of arg 2 for getnameinfo. */
#undef GETNAMEINFO_TYPE_ARG2
/* Define to the type of args 4 and 6 for getnameinfo. */
#undef GETNAMEINFO_TYPE_ARG46
/* Define to the type of arg 7 for getnameinfo. */
#undef GETNAMEINFO_TYPE_ARG7
/* Specifies the number of arguments to getservbyport_r */
#undef GETSERVBYPORT_R_ARGS
/* Specifies the size of the buffer to pass to getservbyport_r */
#undef GETSERVBYPORT_R_BUFSIZE
/* Define to 1 if you have the alarm function. */
#undef HAVE_ALARM
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <arpa/tftp.h> header file. */
#undef HAVE_ARPA_TFTP_H
/* Define to 1 if you have _Atomic support. */
#undef HAVE_ATOMIC
/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
/* Define to 1 if you have the basename function. */
#undef HAVE_BASENAME
@ -159,15 +126,6 @@
/* Define to 1 if using BoringSSL. */
#undef HAVE_BORINGSSL
/* if BROTLI is in use */
#undef HAVE_BROTLI
/* Define to 1 if you have the <brotli/decode.h> header file. */
#undef HAVE_BROTLI_DECODE_H
/* Define to 1 if you have the __builtin_available function. */
#undef HAVE_BUILTIN_AVAILABLE
/* Define to 1 if you have the clock_gettime function and monotonic timer. */
#undef HAVE_CLOCK_GETTIME_MONOTONIC
@ -183,22 +141,33 @@
/* Define to 1 if you have the <crypto.h> header file. */
#undef HAVE_CRYPTO_H
/* Define to 1 if you have the declaration of `getpwuid_r', and to 0 if you
don't. */
#undef HAVE_DECL_GETPWUID_R
/* Define to 1 if you have the `CyaSSL_CTX_UseSupportedCurve' function. */
#undef HAVE_CYASSL_CTX_USESUPPORTEDCURVE
/* "Set if getpwuid_r() declaration is missing" */
#undef HAVE_DECL_GETPWUID_R_MISSING
/* Define to 1 if you have the <cyassl/error-ssl.h> header file. */
#undef HAVE_CYASSL_ERROR_SSL_H
/* Define to 1 if you have the `CyaSSL_get_peer_certificate' function. */
#undef HAVE_CYASSL_GET_PEER_CERTIFICATE
/* Define to 1 if you have the <cyassl/options.h> header file. */
#undef HAVE_CYASSL_OPTIONS_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `ENGINE_cleanup' function. */
#undef HAVE_ENGINE_CLEANUP
/* Define to 1 if you have the `ENGINE_load_builtin_engines' function. */
#undef HAVE_ENGINE_LOAD_BUILTIN_ENGINES
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define to 1 if you have the `fchmod' function. */
#undef HAVE_FCHMOD
/* Define to 1 if you have the fcntl function. */
#undef HAVE_FCNTL
@ -208,8 +177,8 @@
/* Define to 1 if you have a working fcntl O_NONBLOCK function. */
#undef HAVE_FCNTL_O_NONBLOCK
/* Define to 1 if you have the `fnmatch' function. */
#undef HAVE_FNMATCH
/* Define to 1 if you have the fdopen function. */
#undef HAVE_FDOPEN
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
@ -217,6 +186,9 @@
/* Define to 1 if you have the freeaddrinfo function. */
#undef HAVE_FREEADDRINFO
/* Define to 1 if you have the freeifaddrs function. */
#undef HAVE_FREEIFADDRS
/* Define to 1 if you have the fsetxattr function. */
#undef HAVE_FSETXATTR
@ -229,6 +201,9 @@
/* Define to 1 if you have the ftruncate function. */
#undef HAVE_FTRUNCATE
/* Define to 1 if you have the gai_strerror function. */
#undef HAVE_GAI_STRERROR
/* Define to 1 if you have a working getaddrinfo function. */
#undef HAVE_GETADDRINFO
@ -238,6 +213,21 @@
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the gethostbyaddr function. */
#undef HAVE_GETHOSTBYADDR
/* Define to 1 if you have the gethostbyaddr_r function. */
#undef HAVE_GETHOSTBYADDR_R
/* gethostbyaddr_r() takes 5 args */
#undef HAVE_GETHOSTBYADDR_R_5
/* gethostbyaddr_r() takes 7 args */
#undef HAVE_GETHOSTBYADDR_R_7
/* gethostbyaddr_r() takes 8 args */
#undef HAVE_GETHOSTBYADDR_R_8
/* Define to 1 if you have the gethostbyname function. */
#undef HAVE_GETHOSTBYNAME
@ -259,15 +249,18 @@
/* Define to 1 if you have a working getifaddrs function. */
#undef HAVE_GETIFADDRS
/* Define to 1 if you have the getnameinfo function. */
#undef HAVE_GETNAMEINFO
/* Define to 1 if you have the `getpass_r' function. */
#undef HAVE_GETPASS_R
/* Define to 1 if you have the getpeername function. */
#undef HAVE_GETPEERNAME
/* Define to 1 if you have the `getppid' function. */
#undef HAVE_GETPPID
/* Define to 1 if you have the `getprotobyname' function. */
#undef HAVE_GETPROTOBYNAME
/* Define to 1 if you have the `getpwuid' function. */
#undef HAVE_GETPWUID
@ -277,8 +270,8 @@
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
/* Define to 1 if you have the getsockname function. */
#undef HAVE_GETSOCKNAME
/* Define to 1 if you have the getservbyport_r function. */
#undef HAVE_GETSERVBYPORT_R
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
@ -289,6 +282,16 @@
/* Define to 1 if you have a working gmtime_r function. */
#undef HAVE_GMTIME_R
/* Define to 1 if you have the `gnutls_alpn_set_protocols' function. */
#undef HAVE_GNUTLS_ALPN_SET_PROTOCOLS
/* Define to 1 if you have the `gnutls_certificate_set_x509_key_file2'
function. */
#undef HAVE_GNUTLS_CERTIFICATE_SET_X509_KEY_FILE2
/* Define to 1 if you have the `gnutls_ocsp_req_init' function. */
#undef HAVE_GNUTLS_OCSP_REQ_INIT
/* if you have the function gnutls_srp_verifier */
#undef HAVE_GNUTLS_SRP
@ -313,9 +316,6 @@
/* if you have MIT Kerberos */
#undef HAVE_GSSMIT
/* Define to 1 if you have the <hyper.h> header file. */
#undef HAVE_HYPER_H
/* Define to 1 if you have the <idn2.h> header file. */
#undef HAVE_IDN2_H
@ -325,6 +325,18 @@
/* Define to 1 if you have the `if_nametoindex' function. */
#undef HAVE_IF_NAMETOINDEX
/* Define to 1 if you have the `inet_addr' function. */
#undef HAVE_INET_ADDR
/* Define to 1 if you have the inet_ntoa_r function. */
#undef HAVE_INET_NTOA_R
/* inet_ntoa_r() takes 2 args */
#undef HAVE_INET_NTOA_R_2
/* inet_ntoa_r() takes 3 args */
#undef HAVE_INET_NTOA_R_3
/* Define to 1 if you have a IPv6 capable working inet_ntop function. */
#undef HAVE_INET_NTOP
@ -334,6 +346,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the ioctl function. */
#undef HAVE_IOCTL
/* Define to 1 if you have the ioctlsocket function. */
#undef HAVE_IOCTLSOCKET
@ -347,15 +362,27 @@
/* Define to 1 if you have a working ioctlsocket FIONBIO function. */
#undef HAVE_IOCTLSOCKET_FIONBIO
/* Define to 1 if you have a working ioctl FIONBIO function. */
#undef HAVE_IOCTL_FIONBIO
/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */
#undef HAVE_IOCTL_SIOCGIFADDR
/* Define to 1 if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define to 1 if you have the lber.h header file. */
#undef HAVE_LBER_H
/* Define to 1 if you have the ldapssl.h header file. */
#undef HAVE_LDAPSSL_H
/* Define to 1 if you have the ldap.h header file. */
#undef HAVE_LDAP_H
/* Define to 1 if you have the `ldap_init_fd' function. */
#undef HAVE_LDAP_INIT_FD
/* Use LDAPS implementation */
#undef HAVE_LDAP_SSL
@ -365,9 +392,6 @@
/* Define to 1 if you have the `ldap_url_parse' function. */
#undef HAVE_LDAP_URL_PARSE
/* Define to 1 if you have the `brotlidec' library (-lbrotlidec). */
#undef HAVE_LIBBROTLIDEC
/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H
@ -380,35 +404,38 @@
/* Define to 1 if you have the <librtmp/rtmp.h> header file. */
#undef HAVE_LIBRTMP_RTMP_H
/* Define to 1 if you have the `ssh' library (-lssh). */
#undef HAVE_LIBSSH
/* Define to 1 if you have the `ssh2' library (-lssh2). */
#undef HAVE_LIBSSH2
/* Define to 1 if you have the <libssh2.h> header file. */
#undef HAVE_LIBSSH2_H
/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL
/* Define to 1 if you have the `wolfssh' library (-lwolfssh). */
#undef HAVE_LIBWOLFSSH
/* if zlib is available */
#undef HAVE_LIBZ
/* Define to 1 if you have the `zstd' library (-lzstd). */
#undef HAVE_LIBZSTD
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <linux/tcp.h> header file. */
#undef HAVE_LINUX_TCP_H
/* if your compiler supports LL */
#undef HAVE_LL
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have a working localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define to 1 if the compiler supports the 'long long' data type. */
#undef HAVE_LONGLONG
/* Define to 1 if you have the `mach_absolute_time' function. */
#undef HAVE_MACH_ABSOLUTE_TIME
/* Define to 1 if you have the malloc.h header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the memory.h header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the memrchr function or macro. */
#undef HAVE_MEMRCHR
@ -416,60 +443,47 @@
/* Define to 1 if you have the MSG_NOSIGNAL flag. */
#undef HAVE_MSG_NOSIGNAL
/* Define to 1 if you have the <msh3.h> header file. */
#undef HAVE_MSH3_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the <netinet/in6.h> header file. */
#undef HAVE_NETINET_IN6_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define to 1 if you have the <netinet/udp.h> header file. */
#undef HAVE_NETINET_UDP_H
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define to 1 if you have the <nghttp2/nghttp2.h> header file. */
#undef HAVE_NGHTTP2_NGHTTP2_H
/* Define to 1 if you have the <nghttp3/nghttp3.h> header file. */
#undef HAVE_NGHTTP3_NGHTTP3_H
/* Define to 1 if you have the <ngtcp2/ngtcp2_crypto.h> header file. */
#undef HAVE_NGTCP2_NGTCP2_CRYPTO_H
/* Define to 1 if you have the <ngtcp2/ngtcp2.h> header file. */
#undef HAVE_NGTCP2_NGTCP2_H
/* Define to 1 if NI_WITHSCOPEID exists and works. */
#undef HAVE_NI_WITHSCOPEID
/* if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE
*/
#undef HAVE_OLD_GSSMIT
/* Define to 1 if using OpenSSL 3 or later. */
#undef HAVE_OPENSSL3
/* Define to 1 if you have the <openssl/crypto.h> header file. */
#undef HAVE_OPENSSL_CRYPTO_H
/* Define to 1 if you have the <openssl/engine.h> header file. */
#undef HAVE_OPENSSL_ENGINE_H
/* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define to 1 if you have the <openssl/pem.h> header file. */
#undef HAVE_OPENSSL_PEM_H
/* Define to 1 if you have the <openssl/pkcs12.h> header file. */
#undef HAVE_OPENSSL_PKCS12_H
/* Define to 1 if you have the <openssl/rsa.h> header file. */
#undef HAVE_OPENSSL_RSA_H
/* if you have the functions SSL_CTX_set_srp_username and
SSL_CTX_set_srp_password */
/* if you have the function SRP_Calc_client_key */
#undef HAVE_OPENSSL_SRP
/* Define to 1 if you have the <openssl/ssl.h> header file. */
@ -481,11 +495,14 @@
/* Define to 1 if you have the <pem.h> header file. */
#undef HAVE_PEM_H
/* Define to 1 if you have the `perror' function. */
#undef HAVE_PERROR
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
/* if you have the PK11_CreateManagedGenericObject function */
#undef HAVE_PK11_CREATEMANAGEDGENERICOBJECT
/* Define to 1 if you have a working poll function. */
#undef HAVE_POLL
/* If you have a fine poll */
#undef HAVE_POLL_FINE
@ -496,21 +513,12 @@
/* Define to 1 if you have a working POSIX-style strerror_r function. */
#undef HAVE_POSIX_STRERROR_R
/* Define to 1 if you have the <proto/bsdsocket.h> header file. */
#undef HAVE_PROTO_BSDSOCKET_H
/* if you have <pthread.h> */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define to 1 if you have the `quiche_conn_set_qlog_fd' function. */
#undef HAVE_QUICHE_CONN_SET_QLOG_FD
/* Define to 1 if you have the <quiche.h> header file. */
#undef HAVE_QUICHE_H
/* Define to 1 if you have the `RAND_egd' function. */
#undef HAVE_RAND_EGD
@ -520,18 +528,12 @@
/* Define to 1 if you have the <rsa.h> header file. */
#undef HAVE_RSA_H
/* Define to 1 if you have the `sched_yield' function. */
#undef HAVE_SCHED_YIELD
/* Define to 1 if you have the select function. */
#undef HAVE_SELECT
/* Define to 1 if you have the send function. */
#undef HAVE_SEND
/* Define to 1 if you have the `sendmsg' function. */
#undef HAVE_SENDMSG
/* Define to 1 if you have the <setjmp.h> header file. */
#undef HAVE_SETJMP_H
@ -544,6 +546,15 @@
/* Define to 1 if you have the `setrlimit' function. */
#undef HAVE_SETRLIMIT
/* Define to 1 if you have the setsockopt function. */
#undef HAVE_SETSOCKOPT
/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
#undef HAVE_SETSOCKOPT_SO_NONBLOCK
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define to 1 if you have the sigaction function. */
#undef HAVE_SIGACTION
@ -559,8 +570,11 @@
/* Define to 1 if you have the sigsetjmp function or macro. */
#undef HAVE_SIGSETJMP
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if sig_atomic_t is an available typedef. */
#undef HAVE_SIG_ATOMIC_T
/* Define to 1 if sig_atomic_t is already defined as volatile. */
#undef HAVE_SIG_ATOMIC_T_VOLATILE
/* Define to 1 if struct sockaddr_in6 has the sin6_scope_id member */
#undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
@ -574,15 +588,15 @@
/* Define to 1 if you have the <socket.h> header file. */
#undef HAVE_SOCKET_H
/* Define to 1 if you have the `SSL_get_ech_status' function. */
#undef HAVE_SSL_GET_ECH_STATUS
/* Define to 1 if you have the `SSLv2_client_method' function. */
#undef HAVE_SSLV2_CLIENT_METHOD
/* Define to 1 if you have the `SSL_get_shutdown' function. */
#undef HAVE_SSL_GET_SHUTDOWN
/* Define to 1 if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
/* Define to 1 if you have the <stdatomic.h> header file. */
#undef HAVE_STDATOMIC_H
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
@ -616,6 +630,21 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define to 1 if you have the strncmpi function. */
#undef HAVE_STRNCMPI
/* Define to 1 if you have the strnicmp function. */
#undef HAVE_STRNICMP
/* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
/* Define to 1 if you have the strstr function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the strtok_r function. */
#undef HAVE_STRTOK_R
@ -628,9 +657,6 @@
/* Define to 1 if you have the timeval struct. */
#undef HAVE_STRUCT_TIMEVAL
/* Define to 1 if suseconds_t is an available type. */
#undef HAVE_SUSECONDS_T
/* Define to 1 if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H
@ -685,8 +711,11 @@
/* Define to 1 if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define this if time_t is unsigned */
#undef HAVE_TIME_T_UNSIGNED
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the `uname' function. */
#undef HAVE_UNAME
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@ -694,9 +723,6 @@
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
/* Define to 1 if you have the `utimes' function. */
#undef HAVE_UTIMES
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
@ -706,8 +732,8 @@
/* Define to 1 if compiler supports old gcc variadic macro style. */
#undef HAVE_VARIADIC_MACROS_GCC
/* Define to 1 if you have the wincrypt.h header file. */
#undef HAVE_WINCRYPT_H
/* Define to 1 if you have the winber.h header file. */
#undef HAVE_WINBER_H
/* Define to 1 if you have the windows.h header file. */
#undef HAVE_WINDOWS_H
@ -718,14 +744,14 @@
/* Define to 1 if you have the winsock2.h header file. */
#undef HAVE_WINSOCK2_H
/* Define to 1 if you have the <wolfssh/ssh.h> header file. */
#undef HAVE_WOLFSSH_SSH_H
/* Define to 1 if you have the winsock.h header file. */
#undef HAVE_WINSOCK_H
/* if you have wolfSSL_DES_ecb_encrypt */
#undef HAVE_WOLFSSL_DES_ECB_ENCRYPT
/* Define to 1 if you have the `wolfSSLv3_client_method' function. */
#undef HAVE_WOLFSSLV3_CLIENT_METHOD
/* if you have wolfSSL_BIO_set_shutdown */
#undef HAVE_WOLFSSL_FULL_BIO
/* Define to 1 if you have the `wolfSSL_CTX_UseSupportedCurve' function. */
#undef HAVE_WOLFSSL_CTX_USESUPPORTEDCURVE
/* Define to 1 if you have the `wolfSSL_get_peer_certificate' function. */
#undef HAVE_WOLFSSL_GET_PEER_CERTIFICATE
@ -736,17 +762,17 @@
/* Define this symbol if your OS supports changing the contents of argv */
#undef HAVE_WRITABLE_ARGV
/* Define to 1 if you have the writev function. */
#undef HAVE_WRITEV
/* Define to 1 if you have the ws2tcpip.h header file. */
#undef HAVE_WS2TCPIP_H
/* Define to 1 if you have the <x509.h> header file. */
#undef HAVE_X509_H
/* if libzstd is in use */
#undef HAVE_ZSTD
/* Define to 1 if you have the <zstd.h> header file. */
#undef HAVE_ZSTD_H
/* if you have the zlib.h header file */
#undef HAVE_ZLIB_H
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
@ -754,6 +780,12 @@
/* Define to 1 if you need the lber.h header file even with ldap.h */
#undef NEED_LBER_H
/* Define to 1 if you need the malloc.h header file even with stdlib.h */
#undef NEED_MALLOC_H
/* Define to 1 if you need the memory.h header file even with stdlib.h */
#undef NEED_MEMORY_H
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
#undef NEED_REENTRANT
@ -793,52 +825,107 @@
/* a suitable file to read random data from */
#undef RANDOM_FILE
/* Size of curl_off_t in number of bytes */
#undef SIZEOF_CURL_OFF_T
/* Define to the type of arg 1 for recv. */
#undef RECV_TYPE_ARG1
/* Size of int in number of bytes */
/* Define to the type of arg 2 for recv. */
#undef RECV_TYPE_ARG2
/* Define to the type of arg 3 for recv. */
#undef RECV_TYPE_ARG3
/* Define to the type of arg 4 for recv. */
#undef RECV_TYPE_ARG4
/* Define to the function return type for recv. */
#undef RECV_TYPE_RETV
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define to the type qualifier of arg 5 for select. */
#undef SELECT_QUAL_ARG5
/* Define to the type of arg 1 for select. */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for select. */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg 5 for select. */
#undef SELECT_TYPE_ARG5
/* Define to the function return type for select. */
#undef SELECT_TYPE_RETV
/* Define to the type qualifier of arg 2 for send. */
#undef SEND_QUAL_ARG2
/* Define to the type of arg 1 for send. */
#undef SEND_TYPE_ARG1
/* Define to the type of arg 2 for send. */
#undef SEND_TYPE_ARG2
/* Define to the type of arg 3 for send. */
#undef SEND_TYPE_ARG3
/* Define to the type of arg 4 for send. */
#undef SEND_TYPE_ARG4
/* Define to the function return type for send. */
#undef SEND_TYPE_RETV
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* Size of long in number of bytes */
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* Size of long long in number of bytes */
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* Size of off_t in number of bytes */
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* Size of size_t in number of bytes */
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
/* Size of time_t in number of bytes */
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
/* The size of `void*', as computed by sizeof. */
#undef SIZEOF_VOIDP
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* if AmiSSL is in use */
#undef USE_AMISSL
/* Define to the type of arg 3 for strerror_r. */
#undef STRERROR_R_TYPE_ARG3
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to enable c-ares support */
#undef USE_ARES
/* if BearSSL is enabled */
#undef USE_BEARSSL
/* if axTLS is enabled */
#undef USE_AXTLS
/* if ECH support is available */
#undef USE_ECH
/* if CyaSSL/WolfSSL is enabled */
#undef USE_CYASSL
/* to enable Apple OS native SSL/TLS support */
#undef USE_DARWINSSL
/* if GnuTLS is enabled */
#undef USE_GNUTLS
/* GSASL support enabled */
#undef USE_GSASL
/* if hyper is in use */
#undef USE_HYPER
/* if GnuTLS uses nettle as crypto backend */
#undef USE_GNUTLS_NETTLE
/* PSL support enabled */
#undef USE_LIBPSL
@ -846,9 +933,6 @@
/* if librtmp is in use */
#undef USE_LIBRTMP
/* if libSSH is in use */
#undef USE_LIBSSH
/* if libSSH2 is in use */
#undef USE_LIBSSH2
@ -858,27 +942,12 @@
/* if mbedTLS is enabled */
#undef USE_MBEDTLS
/* if msh3 is in use */
#undef USE_MSH3
/* Define to enable metalink support */
#undef USE_METALINK
/* if nghttp2 is in use */
#undef USE_NGHTTP2
/* if nghttp3 is in use */
#undef USE_NGHTTP3
/* if ngtcp2 is in use */
#undef USE_NGTCP2
/* if ngtcp2_crypto_gnutls is in use */
#undef USE_NGTCP2_CRYPTO_GNUTLS
/* if ngtcp2_crypto_openssl is in use */
#undef USE_NGTCP2_CRYPTO_OPENSSL
/* if ngtcp2_crypto_wolfssl is in use */
#undef USE_NGTCP2_CRYPTO_WOLFSSL
/* if NSS is enabled */
#undef USE_NSS
@ -888,18 +957,12 @@
/* if OpenSSL is in use */
#undef USE_OPENSSL
/* if quiche is in use */
#undef USE_QUICHE
/* if rustls is enabled */
#undef USE_RUSTLS
/* if PolarSSL is enabled */
#undef USE_POLARSSL
/* to enable Windows native SSL/TLS support */
#undef USE_SCHANNEL
/* enable Secure Transport */
#undef USE_SECTRANSP
/* if you want POSIX threaded DNS lookup */
#undef USE_THREADS_POSIX
@ -912,13 +975,6 @@
/* Use Unix domain sockets */
#undef USE_UNIX_SOCKETS
/* enable websockets support */
#undef USE_WEBSOCKETS
/* Define to 1 if you are building a Windows target with crypto API support.
*/
#undef USE_WIN32_CRYPTO
/* Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz). */
#undef USE_WIN32_IDN
@ -936,20 +992,25 @@
/* to enable SSPI support */
#undef USE_WINDOWS_SSPI
/* if wolfSSH is in use */
#undef USE_WOLFSSH
/* if wolfSSL is enabled */
#undef USE_WOLFSSL
/* Version number of package */
#undef VERSION
/* Define to 1 to provide own prototypes. */
#undef WANT_IDN_PROTOTYPES
/* Define to avoid automatic inclusion of winsock.h */
#undef WIN32_LEAN_AND_MEAN
/* Define to 1 if OS is AIX. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

View File

@ -1,47 +0,0 @@
#ifndef HEADER_CURL_CTYPE_H
#define HEADER_CURL_CTYPE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#define ISLOWHEXALHA(x) (((x) >= 'a') && ((x) <= 'f'))
#define ISUPHEXALHA(x) (((x) >= 'A') && ((x) <= 'F'))
#define ISLOWCNTRL(x) ((x) >= 0 && ((x) <= 0x1f))
#define IS7F(x) ((x) == 0x7f)
#define ISLOWPRINT(x) (((x) >= 9) && ((x) <= 0x0d))
#define ISPRINT(x) (ISLOWPRINT(x) || (((x) >= ' ') && ((x) <= 0x7e)))
#define ISGRAPH(x) (ISLOWPRINT(x) || (((x) > ' ') && ((x) <= 0x7e)))
#define ISCNTRL(x) (ISLOWCNTRL(x) || IS7F(x))
#define ISALPHA(x) (ISLOWER(x) || ISUPPER(x))
#define ISXDIGIT(x) (ISDIGIT(x) || ISLOWHEXALHA(x) || ISUPHEXALHA(x))
#define ISALNUM(x) (ISDIGIT(x) || ISLOWER(x) || ISUPPER(x))
#define ISUPPER(x) (((x) >= 'A') && ((x) <= 'Z'))
#define ISLOWER(x) (((x) >= 'a') && ((x) <= 'z'))
#define ISDIGIT(x) (((x) >= '0') && ((x) <= '9'))
#define ISBLANK(x) (((x) == ' ') || ((x) == '\t'))
#define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d)))
#endif /* HEADER_CURL_CTYPE_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2015 - 2022, Steve Holme, <steve_holme@hotmail.com>.
* Copyright (C) 2015, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,18 +18,11 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
(defined(USE_GNUTLS) || \
defined(USE_NSS) || \
defined(USE_SECTRANSP) || \
defined(USE_OS400CRYPTO) || \
defined(USE_WIN32_CRYPTO))
#if defined(USE_NTLM) && !defined(USE_OPENSSL)
#include "curl_des.h"
@ -41,7 +34,7 @@
*
* The function is a port of the Java based oddParity() function over at:
*
* https://davenport.sourceforge.net/ntlm.html
* https://davenport.sourceforge.io/ntlm.html
*
* Parameters:
*
@ -67,4 +60,4 @@ void Curl_des_set_odd_parity(unsigned char *bytes, size_t len)
}
}
#endif
#endif /* USE_NTLM && !USE_OPENSSL */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2015 - 2022, Steve Holme, <steve_holme@hotmail.com>.
* Copyright (C) 2015, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,22 +20,15 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(USE_CURL_NTLM_CORE) && !defined(USE_WOLFSSL) && \
(defined(USE_GNUTLS) || \
defined(USE_NSS) || \
defined(USE_SECTRANSP) || \
defined(USE_OS400CRYPTO) || \
defined(USE_WIN32_CRYPTO))
#if defined(USE_NTLM) && !defined(USE_OPENSSL)
/* Applies odd parity to the given byte array */
void Curl_des_set_odd_parity(unsigned char *bytes, size_t length);
#endif
#endif /* USE_NTLM && !USE_OPENSSL */
#endif /* HEADER_CURL_DES_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -64,6 +62,44 @@ unsigned int Curl_read32_le(const unsigned char *buf)
((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24);
}
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/*
* Curl_read64_le()
*
* This function converts a 64-bit integer from the little endian format, as
* used in the incoming package to whatever endian format we're using
* natively.
*
* Parameters:
*
* buf [in] - A pointer to a 8 byte buffer.
*
* Returns the integer.
*/
#if defined(HAVE_LONGLONG)
unsigned long long Curl_read64_le(const unsigned char *buf)
{
return ((unsigned long long)buf[0]) |
((unsigned long long)buf[1] << 8) |
((unsigned long long)buf[2] << 16) |
((unsigned long long)buf[3] << 24) |
((unsigned long long)buf[4] << 32) |
((unsigned long long)buf[5] << 40) |
((unsigned long long)buf[6] << 48) |
((unsigned long long)buf[7] << 56);
}
#else
unsigned __int64 Curl_read64_le(const unsigned char *buf)
{
return ((unsigned __int64)buf[0]) | ((unsigned __int64)buf[1] << 8) |
((unsigned __int64)buf[2] << 16) | ((unsigned __int64)buf[3] << 24) |
((unsigned __int64)buf[4] << 32) | ((unsigned __int64)buf[5] << 40) |
((unsigned __int64)buf[6] << 48) | ((unsigned __int64)buf[7] << 56);
}
#endif
#endif /* CURL_SIZEOF_CURL_OFF_T > 4 */
/*
* Curl_read16_be()
*
@ -82,3 +118,119 @@ unsigned short Curl_read16_be(const unsigned char *buf)
return (unsigned short)(((unsigned short)buf[0] << 8) |
((unsigned short)buf[1]));
}
/*
* Curl_read32_be()
*
* This function converts a 32-bit integer from the big endian format, as
* used in the incoming package to whatever endian format we're using
* natively.
*
* Parameters:
*
* buf [in] - A pointer to a 4 byte buffer.
*
* Returns the integer.
*/
unsigned int Curl_read32_be(const unsigned char *buf)
{
return ((unsigned int)buf[0] << 24) | ((unsigned int)buf[1] << 16) |
((unsigned int)buf[2] << 8) | ((unsigned int)buf[3]);
}
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/*
* Curl_read64_be()
*
* This function converts a 64-bit integer from the big endian format, as
* used in the incoming package to whatever endian format we're using
* natively.
*
* Parameters:
*
* buf [in] - A pointer to a 8 byte buffer.
*
* Returns the integer.
*/
#if defined(HAVE_LONGLONG)
unsigned long long Curl_read64_be(const unsigned char *buf)
{
return ((unsigned long long)buf[0] << 56) |
((unsigned long long)buf[1] << 48) |
((unsigned long long)buf[2] << 40) |
((unsigned long long)buf[3] << 32) |
((unsigned long long)buf[4] << 24) |
((unsigned long long)buf[5] << 16) |
((unsigned long long)buf[6] << 8) |
((unsigned long long)buf[7]);
}
#else
unsigned __int64 Curl_read64_be(const unsigned char *buf)
{
return ((unsigned __int64)buf[0] << 56) | ((unsigned __int64)buf[1] << 48) |
((unsigned __int64)buf[2] << 40) | ((unsigned __int64)buf[3] << 32) |
((unsigned __int64)buf[4] << 24) | ((unsigned __int64)buf[5] << 16) |
((unsigned __int64)buf[6] << 8) | ((unsigned __int64)buf[7]);
}
#endif
#endif /* CURL_SIZEOF_CURL_OFF_T > 4 */
/*
* Curl_write16_le()
*
* This function converts a 16-bit integer from the native endian format,
* to little endian format ready for sending down the wire.
*
* Parameters:
*
* value [in] - The 16-bit integer value.
* buffer [in] - A pointer to the output buffer.
*/
void Curl_write16_le(const short value, unsigned char *buffer)
{
buffer[0] = (char)(value & 0x00FF);
buffer[1] = (char)((value & 0xFF00) >> 8);
}
/*
* Curl_write32_le()
*
* This function converts a 32-bit integer from the native endian format,
* to little endian format ready for sending down the wire.
*
* Parameters:
*
* value [in] - The 32-bit integer value.
* buffer [in] - A pointer to the output buffer.
*/
void Curl_write32_le(const int value, unsigned char *buffer)
{
buffer[0] = (char)(value & 0x000000FF);
buffer[1] = (char)((value & 0x0000FF00) >> 8);
buffer[2] = (char)((value & 0x00FF0000) >> 16);
buffer[3] = (char)((value & 0xFF000000) >> 24);
}
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/*
* Curl_write64_le()
*
* This function converts a 64-bit integer from the native endian format,
* to little endian format ready for sending down the wire.
*
* Parameters:
*
* value [in] - The 64-bit integer value.
* buffer [in] - A pointer to the output buffer.
*/
#if defined(HAVE_LONGLONG)
void Curl_write64_le(const long long value, unsigned char *buffer)
#else
void Curl_write64_le(const __int64 value, unsigned char *buffer)
#endif
{
Curl_write32_le((int)value, buffer);
Curl_write32_le((int)(value >> 32), buffer + 4);
}
#endif /* CURL_SIZEOF_CURL_OFF_T > 4 */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* Converts a 16-bit integer from little endian */
@ -30,7 +28,43 @@ unsigned short Curl_read16_le(const unsigned char *buf);
/* Converts a 32-bit integer from little endian */
unsigned int Curl_read32_le(const unsigned char *buf);
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/* Converts a 64-bit integer from little endian */
#if defined(HAVE_LONGLONG)
unsigned long long Curl_read64_le(const unsigned char *buf);
#else
unsigned __int64 Curl_read64_le(const unsigned char *buf);
#endif
#endif
/* Converts a 16-bit integer from big endian */
unsigned short Curl_read16_be(const unsigned char *buf);
/* Converts a 32-bit integer from big endian */
unsigned int Curl_read32_be(const unsigned char *buf);
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/* Converts a 64-bit integer from big endian */
#if defined(HAVE_LONGLONG)
unsigned long long Curl_read64_be(const unsigned char *buf);
#else
unsigned __int64 Curl_read64_be(const unsigned char *buf);
#endif
#endif
/* Converts a 16-bit integer to little endian */
void Curl_write16_le(const short value, unsigned char *buffer);
/* Converts a 32-bit integer to little endian */
void Curl_write32_le(const int value, unsigned char *buffer);
#if (CURL_SIZEOF_CURL_OFF_T > 4)
/* Converts a 64-bit integer to little endian */
#if defined(HAVE_LONGLONG)
void Curl_write64_le(const long long value, unsigned char *buffer);
#else
void Curl_write64_le(const __int64 value, unsigned char *buffer);
#endif
#endif
#endif /* HEADER_CURL_ENDIAN_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,12 +18,10 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#ifndef CURL_DISABLE_FTP
#include <curl/curl.h>
#include "curl_fnmatch.h"
@ -32,8 +30,6 @@
/* The last #include file should be: */
#include "memdebug.h"
#ifndef HAVE_FNMATCH
#define CURLFNM_CHARSET_LEN (sizeof(char) * 256)
#define CURLFNM_CHSET_SIZE (CURLFNM_CHARSET_LEN + 15)
@ -50,8 +46,15 @@
#define CURLFNM_SPACE (CURLFNM_CHARSET_LEN + 9)
#define CURLFNM_UPPER (CURLFNM_CHARSET_LEN + 10)
typedef enum {
CURLFNM_LOOP_DEFAULT = 0,
CURLFNM_LOOP_BACKSLASH
} loop_state;
typedef enum {
CURLFNM_SCHS_DEFAULT = 0,
CURLFNM_SCHS_MAYRANGE,
CURLFNM_SCHS_MAYRANGE2,
CURLFNM_SCHS_RIGHTBR,
CURLFNM_SCHS_RIGHTBRLEFTBR
} setcharset_state;
@ -61,13 +64,6 @@ typedef enum {
CURLFNM_PKW_DDOT
} parsekey_state;
typedef enum {
CCLASS_OTHER = 0,
CCLASS_DIGIT,
CCLASS_UPPER,
CCLASS_LOWER
} char_class;
#define SETCHARSET_OK 1
#define SETCHARSET_FAIL 0
@ -76,21 +72,21 @@ static int parsekeyword(unsigned char **pattern, unsigned char *charset)
parsekey_state state = CURLFNM_PKW_INIT;
#define KEYLEN 10
char keyword[KEYLEN] = { 0 };
int found = FALSE;
int i;
unsigned char *p = *pattern;
bool found = FALSE;
for(i = 0; !found; i++) {
char c = *p++;
if(i >= KEYLEN)
return SETCHARSET_FAIL;
switch(state) {
case CURLFNM_PKW_INIT:
if(ISLOWER(c))
if(ISALPHA(c) && ISLOWER(c))
keyword[i] = c;
else if(c == ':')
state = CURLFNM_PKW_DDOT;
else
return SETCHARSET_FAIL;
return 0;
break;
case CURLFNM_PKW_DDOT:
if(c == ']')
@ -127,56 +123,26 @@ static int parsekeyword(unsigned char **pattern, unsigned char *charset)
return SETCHARSET_OK;
}
/* Return the character class. */
static char_class charclass(unsigned char c)
{
if(ISUPPER(c))
return CCLASS_UPPER;
if(ISLOWER(c))
return CCLASS_LOWER;
if(ISDIGIT(c))
return CCLASS_DIGIT;
return CCLASS_OTHER;
}
/* Include a character or a range in set. */
static void setcharorrange(unsigned char **pp, unsigned char *charset)
{
unsigned char *p = (*pp)++;
unsigned char c = *p++;
charset[c] = 1;
if(ISALNUM(c) && *p++ == '-') {
char_class cc = charclass(c);
unsigned char endrange = *p++;
if(endrange == '\\')
endrange = *p++;
if(endrange >= c && charclass(endrange) == cc) {
while(c++ != endrange)
if(charclass(c) == cc) /* Chars in class may be not consecutive. */
charset[c] = 1;
*pp = p;
}
}
}
/* returns 1 (true) if pattern is OK, 0 if is bad ("p" is pattern pointer) */
static int setcharset(unsigned char **p, unsigned char *charset)
{
setcharset_state state = CURLFNM_SCHS_DEFAULT;
unsigned char rangestart = 0;
unsigned char lastchar = 0;
bool something_found = FALSE;
unsigned char c;
memset(charset, 0, CURLFNM_CHSET_SIZE);
for(;;) {
c = **p;
if(!c)
return SETCHARSET_FAIL;
switch(state) {
case CURLFNM_SCHS_DEFAULT:
if(c == ']') {
if(ISALNUM(c)) { /* ASCII value */
rangestart = c;
charset[c] = 1;
(*p)++;
state = CURLFNM_SCHS_MAYRANGE;
something_found = TRUE;
}
else if(c == ']') {
if(something_found)
return SETCHARSET_OK;
something_found = TRUE;
@ -185,16 +151,26 @@ static int setcharset(unsigned char **p, unsigned char *charset)
(*p)++;
}
else if(c == '[') {
unsigned char *pp = *p + 1;
if(*pp++ == ':' && parsekeyword(&pp, charset))
*p = pp;
char c2 = *((*p)+1);
if(c2 == ':') { /* there has to be a keyword */
(*p) += 2;
if(parsekeyword(p, charset)) {
state = CURLFNM_SCHS_DEFAULT;
}
else
return SETCHARSET_FAIL;
}
else {
charset[c] = 1;
(*p)++;
}
something_found = TRUE;
}
else if(c == '?' || c == '*') {
something_found = TRUE;
charset[c] = 1;
(*p)++;
}
else if(c == '^' || c == '!') {
if(!something_found) {
if(charset[CURLFNM_NEGATE]) {
@ -210,17 +186,88 @@ static int setcharset(unsigned char **p, unsigned char *charset)
}
else if(c == '\\') {
c = *(++(*p));
if(c)
setcharorrange(p, charset);
else
charset['\\'] = 1;
if(ISPRINT((c))) {
something_found = TRUE;
state = CURLFNM_SCHS_MAYRANGE;
charset[c] = 1;
rangestart = c;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
else if(c == '\0') {
return SETCHARSET_FAIL;
}
else {
setcharorrange(p, charset);
charset[c] = 1;
(*p)++;
something_found = TRUE;
}
break;
case CURLFNM_SCHS_MAYRANGE:
if(c == '-') {
charset[c] = 1;
(*p)++;
lastchar = '-';
state = CURLFNM_SCHS_MAYRANGE2;
}
else if(c == '[') {
state = CURLFNM_SCHS_DEFAULT;
}
else if(ISALNUM(c)) {
charset[c] = 1;
(*p)++;
}
else if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
else if(c == ']') {
return SETCHARSET_OK;
}
else
return SETCHARSET_FAIL;
break;
case CURLFNM_SCHS_MAYRANGE2:
if(c == '\\') {
c = *(++(*p));
if(!ISPRINT(c))
return SETCHARSET_FAIL;
}
if(c == ']') {
return SETCHARSET_OK;
}
if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
state = CURLFNM_SCHS_DEFAULT;
(*p)++;
}
else
return SETCHARSET_FAIL;
}
if(c >= rangestart) {
if((ISLOWER(c) && ISLOWER(rangestart)) ||
(ISDIGIT(c) && ISDIGIT(rangestart)) ||
(ISUPPER(c) && ISUPPER(rangestart))) {
charset[lastchar] = 0;
rangestart++;
while(rangestart++ <= c)
charset[rangestart-1] = 1;
(*p)++;
state = CURLFNM_SCHS_DEFAULT;
}
else
return SETCHARSET_FAIL;
}
break;
case CURLFNM_SCHS_RIGHTBR:
if(c == '[') {
state = CURLFNM_SCHS_RIGHTBRLEFTBR;
@ -230,6 +277,9 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else if(c == ']') {
return SETCHARSET_OK;
}
else if(c == '\0') {
return SETCHARSET_FAIL;
}
else if(ISPRINT(c)) {
charset[c] = 1;
(*p)++;
@ -242,11 +292,14 @@ static int setcharset(unsigned char **p, unsigned char *charset)
goto fail;
break;
case CURLFNM_SCHS_RIGHTBRLEFTBR:
if(c == ']')
if(c == ']') {
return SETCHARSET_OK;
}
else {
state = CURLFNM_SCHS_DEFAULT;
charset[c] = 1;
(*p)++;
}
break;
}
}
@ -254,58 +307,53 @@ fail:
return SETCHARSET_FAIL;
}
static int loop(const unsigned char *pattern, const unsigned char *string,
int maxstars)
static int loop(const unsigned char *pattern, const unsigned char *string)
{
loop_state state = CURLFNM_LOOP_DEFAULT;
unsigned char *p = (unsigned char *)pattern;
unsigned char *s = (unsigned char *)string;
unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };
int rc = 0;
for(;;) {
unsigned char *pp;
switch(*p) {
case '*':
if(!maxstars)
return CURL_FNMATCH_NOMATCH;
/* Regroup consecutive stars and question marks. This can be done because
'*?*?*' can be expressed as '??*'. */
for(;;) {
if(*++p == '\0')
switch(state) {
case CURLFNM_LOOP_DEFAULT:
if(*p == '*') {
while(*(p+1) == '*') /* eliminate multiple stars */
p++;
if(*s == '\0' && *(p+1) == '\0')
return CURL_FNMATCH_MATCH;
if(*p == '?') {
if(!*s++)
return CURL_FNMATCH_NOMATCH;
}
else if(*p != '*')
break;
}
/* Skip string characters until we find a match with pattern suffix. */
for(maxstars--; *s; s++) {
if(loop(p, s, maxstars) == CURL_FNMATCH_MATCH)
rc = loop(p + 1, s); /* *.txt matches .txt <=> .txt matches .txt */
if(rc == CURL_FNMATCH_MATCH)
return CURL_FNMATCH_MATCH;
if(*s) /* let the star eat up one character */
s++;
else
return CURL_FNMATCH_NOMATCH;
}
return CURL_FNMATCH_NOMATCH;
case '?':
if(!*s)
return CURL_FNMATCH_NOMATCH;
else if(*p == '?') {
if(ISPRINT(*s)) {
s++;
p++;
break;
case '\0':
return *s? CURL_FNMATCH_NOMATCH: CURL_FNMATCH_MATCH;
case '\\':
if(p[1])
p++;
if(*s++ != *p++)
}
else if(*s == '\0')
return CURL_FNMATCH_NOMATCH;
break;
case '[':
pp = p + 1; /* Copy in case of syntax error in set. */
else
return CURL_FNMATCH_FAIL; /* cannot deal with other character */
}
else if(*p == '\0') {
if(*s == '\0')
return CURL_FNMATCH_MATCH;
return CURL_FNMATCH_NOMATCH;
}
else if(*p == '\\') {
state = CURLFNM_LOOP_BACKSLASH;
p++;
}
else if(*p == '[') {
unsigned char *pp = p+1; /* cannot handle with pointer to register */
if(setcharset(&pp, charset)) {
int found = FALSE;
if(!*s)
return CURL_FNMATCH_NOMATCH;
if(charset[(unsigned int)*s])
found = TRUE;
else if(charset[CURLFNM_ALNUM])
@ -332,18 +380,31 @@ static int loop(const unsigned char *pattern, const unsigned char *string,
if(charset[CURLFNM_NEGATE])
found = !found;
if(!found)
return CURL_FNMATCH_NOMATCH;
if(found) {
p = pp+1;
s++;
break;
memset(charset, 0, CURLFNM_CHSET_SIZE);
}
/* Syntax error in set; mismatch! */
else
return CURL_FNMATCH_NOMATCH;
default:
}
else
return CURL_FNMATCH_FAIL;
}
else {
if(*p++ != *s++)
return CURL_FNMATCH_NOMATCH;
}
break;
case CURLFNM_LOOP_BACKSLASH:
if(ISPRINT(*p)) {
if(*p++ == *s++)
state = CURLFNM_LOOP_DEFAULT;
else
return CURL_FNMATCH_NOMATCH;
}
else
return CURL_FNMATCH_FAIL;
break;
}
}
@ -359,32 +420,5 @@ int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
return loop((unsigned char *)pattern, (unsigned char *)string, 2);
return loop((unsigned char *)pattern, (unsigned char *)string);
}
#else
#include <fnmatch.h>
/*
* @unittest: 1307
*/
int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
{
(void)ptr; /* the argument is specified by the curl_fnmatch_callback
prototype, but not used by Curl_fnmatch() */
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
switch(fnmatch(pattern, string, 0)) {
case 0:
return CURL_FNMATCH_MATCH;
case FNM_NOMATCH:
return CURL_FNMATCH_NOMATCH;
default:
return CURL_FNMATCH_FAIL;
}
/* not reached */
}
#endif
#endif /* if FTP is disabled */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#define CURL_FNMATCH_MATCH 0

View File

@ -1,86 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
!defined(CURL_DISABLE_HSTS) || !defined(CURL_DISABLE_NETRC)
#include "curl_get_line.h"
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
/*
* Curl_get_line() makes sure to only return complete whole lines that fit in
* 'len' bytes and end with a newline.
*/
char *Curl_get_line(char *buf, int len, FILE *input)
{
bool partial = FALSE;
while(1) {
char *b = fgets(buf, len, input);
if(b) {
size_t rlen = strlen(b);
if(!rlen)
break;
if(b[rlen-1] == '\n') {
/* b is \n terminated */
if(partial) {
partial = FALSE;
continue;
}
return b;
}
else if(feof(input)) {
if(partial)
/* Line is already too large to return, ignore rest */
break;
if(rlen + 1 < (size_t) len) {
/* b is EOF terminated, insert missing \n */
b[rlen] = '\n';
b[rlen + 1] = '\0';
return b;
}
else
/* Maximum buffersize reached + EOF
* This line is impossible to add a \n to so we'll ignore it
*/
break;
}
else
/* Maximum buffersize reached */
partial = TRUE;
}
else
break;
}
return NULL;
}
#endif /* if not disabled */

View File

@ -1,31 +0,0 @@
#ifndef HEADER_CURL_GET_LINE_H
#define HEADER_CURL_GET_LINE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* get_line() makes sure to only return complete whole lines that fit in 'len'
* bytes and end with a newline. */
char *Curl_get_line(char *buf, int len, FILE *input);
#endif /* HEADER_CURL_GET_LINE_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -50,7 +48,7 @@
* For libcurl static library release builds no overriding takes place.
*/
int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen)
int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen)
{
#ifndef HAVE_GETHOSTNAME

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,14 +20,12 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/* Hostname buffer size */
#define HOSTNAME_MAX 1024
/* This returns the local machine's un-qualified hostname */
int Curl_gethostname(char * const name, GETHOSTNAME_TYPE_ARG2 namelen);
int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen);
#endif /* HEADER_CURL_GETHOSTNAME_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2011 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2011 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -29,17 +27,10 @@
#include "curl_gssapi.h"
#include "sendf.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
gss_OID_desc Curl_spnego_mech_oid = {
6, (char *)"\x2b\x06\x01\x05\x05\x02"
};
gss_OID_desc Curl_krb5_mech_oid = {
9, (char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"
};
static char spnego_oid_bytes[] = "\x2b\x06\x01\x05\x05\x02";
gss_OID_desc Curl_spnego_mech_oid = { 6, &spnego_oid_bytes };
static char krb5_oid_bytes[] = "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02";
gss_OID_desc Curl_krb5_mech_oid = { 9, &krb5_oid_bytes };
OM_uint32 Curl_gss_init_sec_context(
struct Curl_easy *data,
@ -62,8 +53,8 @@ OM_uint32 Curl_gss_init_sec_context(
#ifdef GSS_C_DELEG_POLICY_FLAG
req_flags |= GSS_C_DELEG_POLICY_FLAG;
#else
infof(data, "WARNING: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not "
"compiled in");
infof(data, "warning: support for CURLGSSAPI_DELEGATION_POLICY_FLAG not "
"compiled in\n");
#endif
}
@ -91,7 +82,7 @@ static size_t display_gss_error(OM_uint32 status, int type,
OM_uint32 maj_stat;
OM_uint32 min_stat;
OM_uint32 msg_ctx = 0;
gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
gss_buffer_desc status_string;
do {
maj_stat = gss_display_status(&min_stat,
@ -100,15 +91,13 @@ static size_t display_gss_error(OM_uint32 status, int type,
GSS_C_NO_OID,
&msg_ctx,
&status_string);
if(maj_stat == GSS_S_COMPLETE && status_string.length > 0) {
if(GSS_LOG_BUFFER_LEN > len + status_string.length + 3) {
len += msnprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
len += snprintf(buf + len, GSS_LOG_BUFFER_LEN - len,
"%.*s. ", (int)status_string.length,
(char *)status_string.value);
}
}
gss_release_buffer(&min_stat, &status_string);
} while(!GSS_ERROR(maj_stat) && msg_ctx);
} while(!GSS_ERROR(maj_stat) && msg_ctx != 0);
return len;
}
@ -136,11 +125,7 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
display_gss_error(minor, GSS_C_MECH_CODE, buf, len);
infof(data, "%s%s", prefix, buf);
#ifdef CURL_DISABLE_VERBOSE_STRINGS
(void)data;
(void)prefix;
#endif
infof(data, "%s%s\n", prefix, buf);
}
#endif /* HAVE_GSSAPI */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2011 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2011 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,14 +20,25 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "urldata.h"
#ifdef HAVE_GSSAPI
#ifdef HAVE_GSSGNU
# include <gss.h>
#elif defined HAVE_GSSMIT
/* MIT style */
# include <gssapi/gssapi.h>
# include <gssapi/gssapi_generic.h>
# include <gssapi/gssapi_krb5.h>
#else
/* Heimdal-style */
# include <gssapi.h>
#endif
extern gss_OID_desc Curl_spnego_mech_oid;
extern gss_OID_desc Curl_krb5_mech_oid;
@ -60,4 +71,5 @@ void Curl_gss_log_error(struct Curl_easy *data, const char *prefix,
#define GSSAUTH_P_PRIVACY 4
#endif /* HAVE_GSSAPI */
#endif /* HEADER_CURL_GSSAPI_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,17 +20,11 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_CRYPTO_AUTH
#include <curl/curl.h>
#define HMAC_MD5_LENGTH 16
typedef CURLcode (* HMAC_hinit_func)(void *context);
typedef void (* HMAC_hinit_func)(void *context);
typedef void (* HMAC_hupdate_func)(void *context,
const unsigned char *data,
unsigned int len);
@ -38,38 +32,35 @@ typedef void (* HMAC_hfinal_func)(unsigned char *result, void *context);
/* Per-hash function HMAC parameters. */
struct HMAC_params {
HMAC_hinit_func
hmac_hinit; /* Initialize context procedure. */
typedef struct {
HMAC_hinit_func hmac_hinit; /* Initialize context procedure. */
HMAC_hupdate_func hmac_hupdate; /* Update context with data. */
HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */
unsigned int hmac_ctxtsize; /* Context structure size. */
unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */
unsigned int hmac_resultlen; /* Result length (bytes). */
};
} HMAC_params;
/* HMAC computation context. */
struct HMAC_context {
const struct HMAC_params *hmac_hash; /* Hash function definition. */
typedef struct {
const HMAC_params *hmac_hash; /* Hash function definition. */
void *hmac_hashctxt1; /* Hash function context 1. */
void *hmac_hashctxt2; /* Hash function context 2. */
};
} HMAC_context;
/* Prototypes. */
struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
HMAC_context * Curl_HMAC_init(const HMAC_params *hashparams,
const unsigned char *key,
unsigned int keylen);
int Curl_HMAC_update(struct HMAC_context *context,
int Curl_HMAC_update(HMAC_context *context,
const unsigned char *data,
unsigned int len);
int Curl_HMAC_final(struct HMAC_context *context, unsigned char *result);
CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
const unsigned char *key, const size_t keylen,
const unsigned char *data, const size_t datalen,
unsigned char *output);
int Curl_HMAC_final(HMAC_context *context, unsigned char *result);
#endif

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_LDAP
extern const struct Curl_handler Curl_handler_ldap;
@ -34,3 +32,4 @@ extern const struct Curl_handler Curl_handler_ldaps;
#endif
#endif /* HEADER_CURL_LDAP_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,19 +20,16 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_CRYPTO_AUTH)
/* NSS and OS/400 crypto library do not provide the MD4 hash algorithm, so
* that we have a local implementation of it */
#if defined(USE_NSS) || defined(USE_OS400CRYPTO)
#define MD4_DIGEST_LENGTH 16
void Curl_md4it(unsigned char *output, const unsigned char *input, size_t len);
void Curl_md4it(unsigned char *output, const unsigned char *input,
const size_t len);
#endif /* !defined(CURL_DISABLE_CRYPTO_AUTH) */
#endif /* defined(USE_NSS) || defined(USE_OS400CRYPTO) */
#endif /* HEADER_CURL_MD4_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_CRYPTO_AUTH
@ -29,36 +27,36 @@
#define MD5_DIGEST_LEN 16
typedef CURLcode (* Curl_MD5_init_func)(void *context);
typedef void (* Curl_MD5_init_func)(void *context);
typedef void (* Curl_MD5_update_func)(void *context,
const unsigned char *data,
unsigned int len);
typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context);
struct MD5_params {
typedef struct {
Curl_MD5_init_func md5_init_func; /* Initialize context procedure */
Curl_MD5_update_func md5_update_func; /* Update context with data */
Curl_MD5_final_func md5_final_func; /* Get final result procedure */
unsigned int md5_ctxtsize; /* Context structure size */
unsigned int md5_resultlen; /* Result length (bytes) */
};
} MD5_params;
struct MD5_context {
const struct MD5_params *md5_hash; /* Hash function definition */
typedef struct {
const MD5_params *md5_hash; /* Hash function definition */
void *md5_hashctx; /* Hash function context */
};
} MD5_context;
extern const struct MD5_params Curl_DIGEST_MD5[1];
extern const struct HMAC_params Curl_HMAC_MD5[1];
extern const MD5_params Curl_DIGEST_MD5[1];
extern const HMAC_params Curl_HMAC_MD5[1];
CURLcode Curl_md5it(unsigned char *output, const unsigned char *input,
const size_t len);
void Curl_md5it(unsigned char *output,
const unsigned char *input);
struct MD5_context *Curl_MD5_init(const struct MD5_params *md5params);
CURLcode Curl_MD5_update(struct MD5_context *context,
MD5_context * Curl_MD5_init(const MD5_params *md5params);
int Curl_MD5_update(MD5_context *context,
const unsigned char *data,
unsigned int len);
CURLcode Curl_MD5_final(struct MD5_context *context, unsigned char *result);
int Curl_MD5_final(MD5_context *context, unsigned char *result);
#endif

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
@ -41,7 +39,7 @@
*
* File lib/strdup.c is an exception, given that it provides a strdup
* clone implementation while using malloc. Extra care needed inside
* this one.
* this one. TODO: revisit this paragraph and related code.
*
* The need for curl_memory.h inclusion is due to libcurl's feature
* of allowing library user to provide memory replacement functions,

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -46,7 +44,6 @@
void *
Curl_memrchr(const void *s, int c, size_t n)
{
if(n > 0) {
const unsigned char *p = s;
const unsigned char *q = s;
@ -57,7 +54,7 @@ Curl_memrchr(const void *s, int c, size_t n)
return (void *)p;
p--;
}
}
return NULL;
}

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,29 +18,26 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
* This file is 'mem-include-scan' clean, which means memdebug.h and
* curl_memory.h are purposely not included in this file. See test 1132.
*
* The functions in this file are curlx functions which are not tracked by the
* curl memory tracker memdebug.
*/
#include "curl_setup.h"
#if defined(WIN32)
#include <curl/curl.h>
#include "curl_multibyte.h"
#if defined(USE_WIN32_IDN) || ((defined(USE_WINDOWS_SSPI) || \
defined(USE_WIN32_LDAP)) && defined(UNICODE))
/*
* MultiByte conversions using Windows kernel32 library.
*/
wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8)
#include "curl_multibyte.h"
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
wchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8)
{
wchar_t *str_w = NULL;
@ -62,18 +59,18 @@ wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8)
return str_w;
}
char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
char *Curl_convert_wchar_to_UTF8(const wchar_t *str_w)
{
char *str_utf8 = NULL;
if(str_w) {
int bytes = WideCharToMultiByte(CP_UTF8, 0, str_w, -1,
NULL, 0, NULL, NULL);
if(bytes > 0) {
str_utf8 = malloc(bytes);
int str_utf8_len = WideCharToMultiByte(CP_UTF8, 0, str_w, -1, NULL,
0, NULL, NULL);
if(str_utf8_len > 0) {
str_utf8 = malloc(str_utf8_len * sizeof(wchar_t));
if(str_utf8) {
if(WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, bytes,
NULL, NULL) == 0) {
if(WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, str_utf8_len,
NULL, FALSE) == 0) {
free(str_utf8);
return NULL;
}
@ -84,96 +81,4 @@ char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w)
return str_utf8;
}
#endif /* WIN32 */
#if defined(USE_WIN32_LARGE_FILES) || defined(USE_WIN32_SMALL_FILES)
int curlx_win32_open(const char *filename, int oflag, ...)
{
int pmode = 0;
#ifdef _UNICODE
int result = -1;
wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
#endif
va_list param;
va_start(param, oflag);
if(oflag & O_CREAT)
pmode = va_arg(param, int);
va_end(param);
#ifdef _UNICODE
if(filename_w) {
result = _wopen(filename_w, oflag, pmode);
curlx_unicodefree(filename_w);
}
else
errno = EINVAL;
return result;
#else
return (_open)(filename, oflag, pmode);
#endif
}
FILE *curlx_win32_fopen(const char *filename, const char *mode)
{
#ifdef _UNICODE
FILE *result = NULL;
wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
wchar_t *mode_w = curlx_convert_UTF8_to_wchar(mode);
if(filename_w && mode_w)
result = _wfopen(filename_w, mode_w);
else
errno = EINVAL;
curlx_unicodefree(filename_w);
curlx_unicodefree(mode_w);
return result;
#else
return (fopen)(filename, mode);
#endif
}
int curlx_win32_stat(const char *path, struct_stat *buffer)
{
#ifdef _UNICODE
int result = -1;
wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
if(path_w) {
#if defined(USE_WIN32_SMALL_FILES)
result = _wstat(path_w, buffer);
#else
result = _wstati64(path_w, buffer);
#endif
curlx_unicodefree(path_w);
}
else
errno = EINVAL;
return result;
#else
#if defined(USE_WIN32_SMALL_FILES)
return _stat(path, buffer);
#else
return _stati64(path, buffer);
#endif
#endif
}
int curlx_win32_access(const char *path, int mode)
{
#if defined(_UNICODE)
int result = -1;
wchar_t *path_w = curlx_convert_UTF8_to_wchar(path);
if(path_w) {
result = _waccess(path_w, mode);
curlx_unicodefree(path_w);
}
else
errno = EINVAL;
return result;
#else
return _access(path, mode);
#endif
}
#endif /* USE_WIN32_LARGE_FILES || USE_WIN32_SMALL_FILES */
#endif /* USE_WIN32_IDN || ((USE_WINDOWS_SSPI || USE_WIN32_LDAP) && UNICODE) */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,44 +20,49 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(WIN32)
#if defined(USE_WIN32_IDN) || ((defined(USE_WINDOWS_SSPI) || \
defined(USE_WIN32_LDAP)) && defined(UNICODE))
/*
* MultiByte conversions using Windows kernel32 library.
*/
wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8);
char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w);
#endif /* WIN32 */
wchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8);
char *Curl_convert_wchar_to_UTF8(const wchar_t *str_w);
#endif /* USE_WIN32_IDN || ((USE_WINDOWS_SSPI || USE_WIN32_LDAP) && UNICODE) */
#if defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI) || \
defined(USE_WIN32_LDAP)
/*
* Macros curlx_convert_UTF8_to_tchar(), curlx_convert_tchar_to_UTF8()
* and curlx_unicodefree() main purpose is to minimize the number of
* Macros Curl_convert_UTF8_to_tchar(), Curl_convert_tchar_to_UTF8()
* and Curl_unicodefree() main purpose is to minimize the number of
* preprocessor conditional directives needed by code using these
* to differentiate UNICODE from non-UNICODE builds.
*
* In the case of a non-UNICODE build the tchar strings are char strings that
* are duplicated via strdup and remain in whatever the passed in encoding is,
* which is assumed to be UTF-8 but may be other encoding. Therefore the
* significance of the conversion functions is primarily for UNICODE builds.
* When building with UNICODE defined, this two macros
* Curl_convert_UTF8_to_tchar() and Curl_convert_tchar_to_UTF8()
* return a pointer to a newly allocated memory area holding result.
* When the result is no longer needed, allocated memory is intended
* to be free'ed with Curl_unicodefree().
*
* Allocated memory should be free'd with curlx_unicodefree().
*
* Note: Because these are curlx functions their memory usage is not tracked
* by the curl memory tracker memdebug. You'll notice that curlx function-like
* macros call free and strdup in parentheses, eg (strdup)(ptr), and that's to
* ensure that the curl memdebug override macros do not replace them.
* When building without UNICODE defined, this macros
* Curl_convert_UTF8_to_tchar() and Curl_convert_tchar_to_UTF8()
* return the pointer received as argument. Curl_unicodefree() does
* no actual free'ing of this pointer it is simply set to NULL.
*/
#if defined(UNICODE) && defined(WIN32)
#ifdef UNICODE
#define curlx_convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr))
#define curlx_convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr))
#define Curl_convert_UTF8_to_tchar(ptr) Curl_convert_UTF8_to_wchar((ptr))
#define Curl_convert_tchar_to_UTF8(ptr) Curl_convert_wchar_to_UTF8((ptr))
#define Curl_unicodefree(ptr) \
do {if((ptr)) {free((ptr)); (ptr) = NULL;}} WHILE_FALSE
typedef union {
unsigned short *tchar_ptr;
@ -68,8 +73,10 @@ typedef union {
#else
#define curlx_convert_UTF8_to_tchar(ptr) (strdup)(ptr)
#define curlx_convert_tchar_to_UTF8(ptr) (strdup)(ptr)
#define Curl_convert_UTF8_to_tchar(ptr) (ptr)
#define Curl_convert_tchar_to_UTF8(ptr) (ptr)
#define Curl_unicodefree(ptr) \
do {(ptr) = NULL;} WHILE_FALSE
typedef union {
char *tchar_ptr;
@ -78,14 +85,8 @@ typedef union {
const unsigned char *const_tbyte_ptr;
} xcharp_u;
#endif /* UNICODE && WIN32 */
#endif /* UNICODE */
#define curlx_unicodefree(ptr) \
do { \
if(ptr) { \
(free)(ptr); \
(ptr) = NULL; \
} \
} while(0)
#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI || USE_WIN32_LDAP */
#endif /* HEADER_CURL_MULTIBYTE_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,63 +18,41 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(USE_CURL_NTLM_CORE)
#if defined(USE_NTLM)
/*
* NTLM details:
*
* https://davenport.sourceforge.net/ntlm.html
* https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
/* Please keep the SSL backend-specific #if branches in this order:
#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)
1. USE_OPENSSL
2. USE_GNUTLS
3. USE_NSS
4. USE_MBEDTLS
5. USE_SECTRANSP
6. USE_OS400CRYPTO
7. USE_WIN32_CRYPTO
#ifdef USE_OPENSSL
This ensures that:
- the same SSL branch gets activated throughout this source
file even if multiple backends are enabled at the same time.
- OpenSSL and NSS have higher priority than Windows Crypt, due
to issues with the latter supporting NTLM2Session responses
in NTLM type-3 messages.
*/
#if defined(USE_OPENSSL)
#include <openssl/opensslconf.h>
#if !defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_DEPRECATED_3_0)
#define USE_OPENSSL_DES
#endif
#endif
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
#if defined(USE_OPENSSL)
# ifdef USE_OPENSSL
# include <openssl/des.h>
# ifndef OPENSSL_NO_MD4
# include <openssl/md4.h>
# endif
# include <openssl/md5.h>
# include <openssl/ssl.h>
# include <openssl/rand.h>
# else
# include <wolfssl/options.h>
# include <wolfssl/openssl/des.h>
# include <wolfssl/openssl/md5.h>
# include <wolfssl/openssl/ssl.h>
# include <wolfssl/openssl/rand.h>
# include <des.h>
# ifndef OPENSSL_NO_MD4
# include <md4.h>
# endif
# if (defined(OPENSSL_VERSION_NUMBER) && \
(OPENSSL_VERSION_NUMBER < 0x00907001L)) && !defined(USE_WOLFSSL)
# include <md5.h>
# include <ssl.h>
# include <rand.h>
# endif
# if (OPENSSL_VERSION_NUMBER < 0x00907001L)
# define DES_key_schedule des_key_schedule
# define DES_cblock des_cblock
# define DES_set_odd_parity des_set_odd_parity
@ -87,34 +65,46 @@
# define DESKEY(x) &x
# endif
#elif defined(USE_GNUTLS)
#elif defined(USE_GNUTLS_NETTLE)
# include <nettle/des.h>
# include <nettle/md4.h>
#elif defined(USE_GNUTLS)
# include <gcrypt.h>
# define MD5_DIGEST_LENGTH 16
# define MD4_DIGEST_LENGTH 16
#elif defined(USE_MBEDTLS)
# include <mbedtls/des.h>
# include <mbedtls/md4.h>
#elif defined(USE_NSS)
# include <nss.h>
# include <pk11pub.h>
# include <hasht.h>
# include "curl_md4.h"
# define MD5_DIGEST_LENGTH MD5_LENGTH
#elif defined(USE_MBEDTLS)
# include <mbedtls/des.h>
#elif defined(USE_SECTRANSP)
#elif defined(USE_DARWINSSL)
# include <CommonCrypto/CommonCryptor.h>
# include <CommonCrypto/CommonDigest.h>
#elif defined(USE_OS400CRYPTO)
# include "cipher.mih" /* mih/cipher */
# include "curl_md4.h"
#elif defined(USE_WIN32_CRYPTO)
# include <wincrypt.h>
#else
# error "Can't compile NTLM support without a crypto library with DES."
# error "Can't compile NTLM support without a crypto library."
#endif
#include "urldata.h"
#include "non-ascii.h"
#include "strcase.h"
#include "curl_ntlm_core.h"
#include "curl_md5.h"
@ -122,12 +112,12 @@
#include "warnless.h"
#include "curl_endian.h"
#include "curl_des.h"
#include "curl_md4.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#define NTLM_HMAC_MD5_LEN (16)
#define NTLMv2_BLOB_SIGNATURE "\x01\x01\x00\x00"
#define NTLMv2_BLOB_LEN (44 -16 + ntlm->target_info_len + 4)
@ -146,7 +136,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key)
key[7] = (unsigned char) ((key_56[6] << 1) & 0xFF);
}
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
#ifdef USE_OPENSSL
/*
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key. The
* key schedule ks is also set.
@ -163,10 +153,10 @@ static void setup_des_key(const unsigned char *key_56,
DES_set_odd_parity(&key);
/* Set the key */
DES_set_key_unchecked(&key, ks);
DES_set_key(&key, ks);
}
#elif defined(USE_GNUTLS)
#elif defined(USE_GNUTLS_NETTLE)
static void setup_des_key(const unsigned char *key_56,
struct des_ctx *des)
@ -183,17 +173,58 @@ static void setup_des_key(const unsigned char *key_56,
des_set_key(des, (const uint8_t *) key);
}
#elif defined(USE_GNUTLS)
/*
* Turns a 56 bit key into the 64 bit, odd parity key and sets the key.
*/
static void setup_des_key(const unsigned char *key_56,
gcry_cipher_hd_t *des)
{
char key[8];
/* Expand the 56-bit key to 64-bits */
extend_key_56_to_64(key_56, key);
/* Set the key parity to odd */
Curl_des_set_odd_parity((unsigned char *) key, sizeof(key));
/* Set the key */
gcry_cipher_setkey(*des, key, sizeof(key));
}
#elif defined(USE_MBEDTLS)
static bool encrypt_des(const unsigned char *in, unsigned char *out,
const unsigned char *key_56)
{
mbedtls_des_context ctx;
char key[8];
/* Expand the 56-bit key to 64-bits */
extend_key_56_to_64(key_56, key);
/* Set the key parity to odd */
mbedtls_des_key_set_parity((unsigned char *) key);
/* Perform the encryption */
mbedtls_des_init(&ctx);
mbedtls_des_setkey_enc(&ctx, (unsigned char *) key);
return mbedtls_des_crypt_ecb(&ctx, in, out) == 0;
}
#elif defined(USE_NSS)
/*
* encrypt_des() expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of
* data, using the expanded key. IN should point to 64 bits of source data,
* OUT to a 64 bit output buffer.
* Expands a 56 bit key KEY_56 to 64 bit and encrypts 64 bit of data, using
* the expanded key. The caller is responsible for giving 64 bit of valid
* data is IN and (at least) 64 bit large buffer as OUT.
*/
static bool encrypt_des(const unsigned char *in, unsigned char *out,
const unsigned char *key_56)
{
const CK_MECHANISM_TYPE mech = CKM_DES_ECB; /* DES cipher in ECB mode */
PK11SlotInfo *slot = NULL;
char key[8]; /* expanded 64 bit key */
SECItem key_item;
PK11SymKey *symkey = NULL;
@ -203,7 +234,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
bool rv = FALSE;
/* use internal slot for DES encryption (requires NSS to be initialized) */
PK11SlotInfo *slot = PK11_GetInternalKeySlot();
slot = PK11_GetInternalKeySlot();
if(!slot)
return FALSE;
@ -247,27 +278,7 @@ fail:
return rv;
}
#elif defined(USE_MBEDTLS)
static bool encrypt_des(const unsigned char *in, unsigned char *out,
const unsigned char *key_56)
{
mbedtls_des_context ctx;
char key[8];
/* Expand the 56-bit key to 64-bits */
extend_key_56_to_64(key_56, key);
/* Set the key parity to odd */
mbedtls_des_key_set_parity((unsigned char *) key);
/* Perform the encryption */
mbedtls_des_init(&ctx);
mbedtls_des_setkey_enc(&ctx, (unsigned char *) key);
return mbedtls_des_crypt_ecb(&ctx, in, out) == 0;
}
#elif defined(USE_SECTRANSP)
#elif defined(USE_DARWINSSL)
static bool encrypt_des(const unsigned char *in, unsigned char *out,
const unsigned char *key_56)
@ -330,7 +341,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
/* Acquire the crypto provider */
if(!CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
CRYPT_VERIFYCONTEXT))
return FALSE;
/* Setup the key blob structure */
@ -375,7 +386,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
const unsigned char *plaintext,
unsigned char *results)
{
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
#ifdef USE_OPENSSL
DES_key_schedule ks;
setup_des_key(keys, DESKEY(ks));
@ -389,7 +400,7 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
setup_des_key(keys + 14, DESKEY(ks));
DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 16),
DESKEY(ks), DES_ENCRYPT);
#elif defined(USE_GNUTLS)
#elif defined(USE_GNUTLS_NETTLE)
struct des_ctx des;
setup_des_key(keys, &des);
des_encrypt(&des, 8, results, plaintext);
@ -397,7 +408,24 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
des_encrypt(&des, 8, results + 8, plaintext);
setup_des_key(keys + 14, &des);
des_encrypt(&des, 8, results + 16, plaintext);
#elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
#elif defined(USE_GNUTLS)
gcry_cipher_hd_t des;
gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
setup_des_key(keys, &des);
gcry_cipher_encrypt(des, results, 8, plaintext, 8);
gcry_cipher_close(des);
gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
setup_des_key(keys + 7, &des);
gcry_cipher_encrypt(des, results + 8, 8, plaintext, 8);
gcry_cipher_close(des);
gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
setup_des_key(keys + 14, &des);
gcry_cipher_encrypt(des, results + 16, 8, plaintext, 8);
gcry_cipher_close(des);
#elif defined(USE_MBEDTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) \
|| defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
encrypt_des(plaintext, results, keys);
encrypt_des(plaintext, results + 8, keys + 7);
@ -408,9 +436,11 @@ void Curl_ntlm_core_lm_resp(const unsigned char *keys,
/*
* Set up lanmanager hashed password
*/
CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data,
const char *password,
unsigned char *lmbuffer /* 21 bytes */)
{
CURLcode result;
unsigned char pw[14];
static const unsigned char magic[] = {
0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 /* i.e. KGS!@#$% */
@ -420,10 +450,18 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
Curl_strntoupper((char *)pw, password, len);
memset(&pw[len], 0, 14 - len);
/*
* The LanManager hashed password needs to be created using the
* password in the network encoding not the host encoding.
*/
result = Curl_convert_to_network(data, (char *)pw, 14);
if(result)
return result;
{
/* Create LanManager hashed password. */
#if defined(USE_OPENSSL_DES) || defined(USE_WOLFSSL)
#ifdef USE_OPENSSL
DES_key_schedule ks;
setup_des_key(pw, DESKEY(ks));
@ -433,13 +471,25 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
setup_des_key(pw + 7, DESKEY(ks));
DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer + 8),
DESKEY(ks), DES_ENCRYPT);
#elif defined(USE_GNUTLS)
#elif defined(USE_GNUTLS_NETTLE)
struct des_ctx des;
setup_des_key(pw, &des);
des_encrypt(&des, 8, lmbuffer, magic);
setup_des_key(pw + 7, &des);
des_encrypt(&des, 8, lmbuffer + 8, magic);
#elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_SECTRANSP) \
#elif defined(USE_GNUTLS)
gcry_cipher_hd_t des;
gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
setup_des_key(pw, &des);
gcry_cipher_encrypt(des, lmbuffer, 8, magic, 8);
gcry_cipher_close(des);
gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
setup_des_key(pw + 7, &des);
gcry_cipher_encrypt(des, lmbuffer + 8, 8, magic, 8);
gcry_cipher_close(des);
#elif defined(USE_MBEDTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) \
|| defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
encrypt_des(magic, lmbuffer, pw);
encrypt_des(magic, lmbuffer + 8, pw + 7);
@ -451,6 +501,7 @@ CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
return CURLE_OK;
}
#ifdef USE_NTRESPONSES
static void ascii_to_unicode_le(unsigned char *dest, const char *src,
size_t srclen)
{
@ -461,96 +512,110 @@ static void ascii_to_unicode_le(unsigned char *dest, const char *src,
}
}
#if !defined(USE_WINDOWS_SSPI)
#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
static void ascii_uppercase_to_unicode_le(unsigned char *dest,
const char *src, size_t srclen)
{
size_t i;
for(i = 0; i < srclen; i++) {
dest[2 * i] = (unsigned char)(Curl_raw_toupper(src[i]));
dest[2 * i] = (unsigned char)(toupper(src[i]));
dest[2 * i + 1] = '\0';
}
}
#endif /* !USE_WINDOWS_SSPI */
#endif /* USE_NTLM_V2 && !USE_WINDOWS_SSPI */
/*
* Set up nt hashed passwords
* @unittest: 1600
*/
CURLcode Curl_ntlm_core_mk_nt_hash(const char *password,
CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
const char *password,
unsigned char *ntbuffer /* 21 bytes */)
{
size_t len = strlen(password);
unsigned char *pw;
if(len > SIZE_T_MAX/2) /* avoid integer overflow */
return CURLE_OUT_OF_MEMORY;
pw = len ? malloc(len * 2) : (unsigned char *)strdup("");
unsigned char *pw = malloc(len * 2);
CURLcode result;
if(!pw)
return CURLE_OUT_OF_MEMORY;
ascii_to_unicode_le(pw, password, len);
/*
* The NT hashed password needs to be created using the password in the
* network encoding not the host encoding.
*/
result = Curl_convert_to_network(data, (char *)pw, len * 2);
if(result)
return result;
{
/* Create NT hashed password. */
#ifdef USE_OPENSSL
MD4_CTX MD4pw;
MD4_Init(&MD4pw);
MD4_Update(&MD4pw, pw, 2 * len);
MD4_Final(ntbuffer, &MD4pw);
#elif defined(USE_GNUTLS_NETTLE)
struct md4_ctx MD4pw;
md4_init(&MD4pw);
md4_update(&MD4pw, (unsigned int)(2 * len), pw);
md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer);
#elif defined(USE_GNUTLS)
gcry_md_hd_t MD4pw;
gcry_md_open(&MD4pw, GCRY_MD_MD4, 0);
gcry_md_write(MD4pw, pw, 2 * len);
memcpy(ntbuffer, gcry_md_read(MD4pw, 0), MD4_DIGEST_LENGTH);
gcry_md_close(MD4pw);
#elif defined(USE_MBEDTLS)
mbedtls_md4(pw, 2 * len, ntbuffer);
#elif defined(USE_NSS) || defined(USE_OS400CRYPTO)
Curl_md4it(ntbuffer, pw, 2 * len);
#elif defined(USE_DARWINSSL)
(void)CC_MD4(pw, (CC_LONG)(2 * len), ntbuffer);
#elif defined(USE_WIN32_CRYPTO)
HCRYPTPROV hprov;
if(CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)) {
HCRYPTHASH hhash;
if(CryptCreateHash(hprov, CALG_MD4, 0, 0, &hhash)) {
DWORD length = 16;
CryptHashData(hhash, pw, (unsigned int)len * 2, 0);
CryptGetHashParam(hhash, HP_HASHVAL, ntbuffer, &length, 0);
CryptDestroyHash(hhash);
}
CryptReleaseContext(hprov, 0);
}
#endif
memset(ntbuffer + 16, 0, 21 - 16);
}
free(pw);
return CURLE_OK;
}
#if !defined(USE_WINDOWS_SSPI)
#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
/* Timestamp in tenths of a microsecond since January 1, 1601 00:00:00 UTC. */
struct ms_filetime {
unsigned int dwLowDateTime;
unsigned int dwHighDateTime;
};
/* Convert a time_t to an MS FILETIME (MS-DTYP section 2.3.3). */
static void time2filetime(struct ms_filetime *ft, time_t t)
/* This returns the HMAC MD5 digest */
CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
const unsigned char *data, unsigned int datalen,
unsigned char *output)
{
#if SIZEOF_TIME_T > 4
t = (t + CURL_OFF_T_C(11644473600)) * 10000000;
ft->dwLowDateTime = (unsigned int) (t & 0xFFFFFFFF);
ft->dwHighDateTime = (unsigned int) (t >> 32);
#else
unsigned int r, s;
unsigned int i;
HMAC_context *ctxt = Curl_HMAC_init(Curl_HMAC_MD5, key, keylen);
ft->dwLowDateTime = t & 0xFFFFFFFF;
ft->dwHighDateTime = 0;
if(!ctxt)
return CURLE_OUT_OF_MEMORY;
# ifndef HAVE_TIME_T_UNSIGNED
/* Extend sign if needed. */
if(ft->dwLowDateTime & 0x80000000)
ft->dwHighDateTime = ~0;
# endif
/* Update the digest with the given challenge */
Curl_HMAC_update(ctxt, data, datalen);
/* Bias seconds to Jan 1, 1601.
134774 days = 11644473600 seconds = 0x2B6109100 */
r = ft->dwLowDateTime;
ft->dwLowDateTime = (ft->dwLowDateTime + 0xB6109100U) & 0xFFFFFFFF;
ft->dwHighDateTime += ft->dwLowDateTime < r? 0x03: 0x02;
/* Finalise the digest */
Curl_HMAC_final(ctxt, output);
/* Convert to tenths of microseconds. */
ft->dwHighDateTime *= 10000000;
i = 32;
do {
i -= 8;
s = ((ft->dwLowDateTime >> i) & 0xFF) * (10000000 - 1);
r = (s << i) & 0xFFFFFFFF;
s >>= 1; /* Split shift to avoid width overflow. */
s >>= 31 - i;
ft->dwLowDateTime = (ft->dwLowDateTime + r) & 0xFFFFFFFF;
if(ft->dwLowDateTime < r)
s++;
ft->dwHighDateTime += s;
} while(i);
ft->dwHighDateTime &= 0xFFFFFFFF;
#endif
return CURLE_OK;
}
/* This creates the NTLMv2 hash by using NTLM hash as the key and Unicode
@ -562,24 +627,19 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
unsigned char *ntlmv2hash)
{
/* Unicode representation */
size_t identity_len;
unsigned char *identity;
size_t identity_len = (userlen + domlen) * 2;
unsigned char *identity = malloc(identity_len);
CURLcode result = CURLE_OK;
if((userlen > CURL_MAX_INPUT_LENGTH) || (domlen > CURL_MAX_INPUT_LENGTH))
return CURLE_OUT_OF_MEMORY;
identity_len = (userlen + domlen) * 2;
identity = malloc(identity_len + 1);
if(!identity)
return CURLE_OUT_OF_MEMORY;
ascii_uppercase_to_unicode_le(identity, user, userlen);
ascii_to_unicode_le(identity + (userlen << 1), domain, domlen);
result = Curl_hmacit(Curl_HMAC_MD5, ntlmhash, 16, identity, identity_len,
result = Curl_hmac_md5(ntlmhash, 16, identity, curlx_uztoui(identity_len),
ntlmv2hash);
free(identity);
return result;
@ -625,45 +685,49 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
unsigned int len = 0;
unsigned char *ptr = NULL;
unsigned char hmac_output[HMAC_MD5_LENGTH];
struct ms_filetime tw;
unsigned char hmac_output[NTLM_HMAC_MD5_LEN];
curl_off_t tw;
CURLcode result = CURLE_OK;
#if CURL_SIZEOF_CURL_OFF_T < 8
#error "this section needs 64bit support to work"
#endif
/* Calculate the timestamp */
#ifdef DEBUGBUILD
char *force_timestamp = getenv("CURL_FORCETIME");
if(force_timestamp)
time2filetime(&tw, (time_t) 0);
tw = CURL_OFF_T_C(11644473600) * 10000000;
else
#endif
time2filetime(&tw, time(NULL));
tw = ((curl_off_t)time(NULL) + CURL_OFF_T_C(11644473600)) * 10000000;
/* Calculate the response len */
len = HMAC_MD5_LENGTH + NTLMv2_BLOB_LEN;
len = NTLM_HMAC_MD5_LEN + NTLMv2_BLOB_LEN;
/* Allocate the response */
ptr = calloc(1, len);
ptr = malloc(len);
if(!ptr)
return CURLE_OUT_OF_MEMORY;
memset(ptr, 0, len);
/* Create the BLOB structure */
msnprintf((char *)ptr + HMAC_MD5_LENGTH, NTLMv2_BLOB_LEN,
snprintf((char *)ptr + NTLM_HMAC_MD5_LEN, NTLMv2_BLOB_LEN,
"%c%c%c%c" /* NTLMv2_BLOB_SIGNATURE */
"%c%c%c%c" /* Reserved = 0 */
"%c%c%c%c%c%c%c%c", /* Timestamp */
"%c%c%c%c", /* Reserved = 0 */
NTLMv2_BLOB_SIGNATURE[0], NTLMv2_BLOB_SIGNATURE[1],
NTLMv2_BLOB_SIGNATURE[2], NTLMv2_BLOB_SIGNATURE[3],
0, 0, 0, 0,
LONGQUARTET(tw.dwLowDateTime), LONGQUARTET(tw.dwHighDateTime));
0, 0, 0, 0);
Curl_write64_le(tw, ptr + 24);
memcpy(ptr + 32, challenge_client, 8);
if(ntlm->target_info_len)
memcpy(ptr + 44, ntlm->target_info, ntlm->target_info_len);
/* Concatenate the Type 2 challenge with the BLOB and do HMAC MD5 */
memcpy(ptr + 8, &ntlm->nonce[0], 8);
result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, HMAC_MD5_LENGTH, ptr + 8,
result = Curl_hmac_md5(ntlmv2hash, NTLM_HMAC_MD5_LEN, ptr + 8,
NTLMv2_BLOB_LEN + 8, hmac_output);
if(result) {
free(ptr);
@ -671,7 +735,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
}
/* Concatenate the HMAC MD5 output with the BLOB */
memcpy(ptr, hmac_output, HMAC_MD5_LENGTH);
memcpy(ptr, hmac_output, NTLM_HMAC_MD5_LEN);
/* Return the response */
*ntresp = ptr;
@ -706,8 +770,7 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
memcpy(&data[0], challenge_server, 8);
memcpy(&data[8], challenge_client, 8);
result = Curl_hmacit(Curl_HMAC_MD5, ntlmv2hash, 16, &data[0], 16,
hmac_output);
result = Curl_hmac_md5(ntlmv2hash, 16, &data[0], 16, hmac_output);
if(result)
return result;
@ -718,6 +781,10 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
return result;
}
#endif /* !USE_WINDOWS_SSPI */
#endif /* USE_NTLM_V2 && !USE_WINDOWS_SSPI */
#endif /* USE_CURL_NTLM_CORE */
#endif /* USE_NTRESPONSES */
#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */
#endif /* USE_NTLM */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,46 +20,55 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if defined(USE_CURL_NTLM_CORE)
#if defined(USE_NTLM)
/* If NSS is the first available SSL backend (see order in curl_ntlm_core.c)
then it must be initialized to be used by NTLM. */
#if !defined(USE_OPENSSL) && \
!defined(USE_WOLFSSL) && \
!defined(USE_GNUTLS) && \
defined(USE_NSS)
#define NTLM_NEEDS_NSS_INIT
#if !defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)
#ifdef USE_OPENSSL
# if !defined(OPENSSL_VERSION_NUMBER) && \
!defined(HEADER_SSL_H) && !defined(HEADER_MD5_H)
# error "curl_ntlm_core.h shall not be included before OpenSSL headers."
# endif
#endif
#ifdef USE_WOLFSSL
# include <wolfssl/options.h>
# include <wolfssl/openssl/ssl.h>
#elif defined(USE_OPENSSL)
# include <openssl/ssl.h>
/* Define USE_NTRESPONSES in order to make the type-3 message include
* the NT response message. */
#if !defined(USE_OPENSSL) || !defined(OPENSSL_NO_MD4)
#define USE_NTRESPONSES
#endif
/* Helpers to generate function byte arguments in little endian order */
#define SHORTPAIR(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff))
#define LONGQUARTET(x) ((int)((x) & 0xff)), ((int)(((x) >> 8) & 0xff)), \
((int)(((x) >> 16) & 0xff)), ((int)(((x) >> 24) & 0xff))
/* Define USE_NTLM2SESSION in order to make the type-3 message include the
NTLM2Session response message, requires USE_NTRESPONSES defined to 1 and a
Crypto engine that we have curl_ssl_md5sum() for. */
#if defined(USE_NTRESPONSES) && !defined(USE_WIN32_CRYPTO)
#define USE_NTLM2SESSION
#endif
/* Define USE_NTLM_V2 in order to allow the type-3 message to include the
LMv2 and NTLMv2 response messages, requires USE_NTRESPONSES defined to 1
and support for 64-bit integers. */
#if defined(USE_NTRESPONSES) && (CURL_SIZEOF_CURL_OFF_T > 4)
#define USE_NTLM_V2
#endif
void Curl_ntlm_core_lm_resp(const unsigned char *keys,
const unsigned char *plaintext,
unsigned char *results);
CURLcode Curl_ntlm_core_mk_lm_hash(const char *password,
CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data,
const char *password,
unsigned char *lmbuffer /* 21 bytes */);
CURLcode Curl_ntlm_core_mk_nt_hash(const char *password,
#ifdef USE_NTRESPONSES
CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
const char *password,
unsigned char *ntbuffer /* 21 bytes */);
#if !defined(USE_WINDOWS_SSPI)
#if defined(USE_NTLM_V2) && !defined(USE_WINDOWS_SSPI)
CURLcode Curl_hmac_md5(const unsigned char *key, unsigned int keylen,
const unsigned char *data, unsigned int datalen,
@ -81,8 +90,12 @@ CURLcode Curl_ntlm_core_mk_lmv2_resp(unsigned char *ntlmv2hash,
unsigned char *challenge_server,
unsigned char *lmresp);
#endif /* !USE_WINDOWS_SSPI */
#endif /* USE_NTLM_V2 && !USE_WINDOWS_SSPI */
#endif /* USE_CURL_NTLM_CORE */
#endif /* USE_NTRESPONSES */
#endif /* !USE_WINDOWS_SSPI || USE_WIN32_CRYPTO */
#endif /* USE_NTLM */
#endif /* HEADER_CURL_NTLM_CORE_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -30,7 +28,7 @@
/*
* NTLM details:
*
* https://davenport.sourceforge.net/ntlm.html
* https://davenport.sourceforge.io/ntlm.html
* https://www.innovation.ch/java/ntlm.html
*/
@ -50,13 +48,10 @@
#include "sendf.h"
#include "select.h"
#include "vauth/ntlm.h"
#include "curl_ntlm_core.h"
#include "curl_ntlm_wb.h"
#include "url.h"
#include "strerror.h"
#include "strdup.h"
#include "strcase.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@ -78,22 +73,22 @@
# define sclose_nolog(x) close((x))
#endif
static void ntlm_wb_cleanup(struct ntlmdata *ntlm)
void Curl_ntlm_wb_cleanup(struct connectdata *conn)
{
if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {
sclose(ntlm->ntlm_auth_hlpr_socket);
ntlm->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD) {
sclose(conn->ntlm_auth_hlpr_socket);
conn->ntlm_auth_hlpr_socket = CURL_SOCKET_BAD;
}
if(ntlm->ntlm_auth_hlpr_pid) {
if(conn->ntlm_auth_hlpr_pid) {
int i;
for(i = 0; i < 4; i++) {
pid_t ret = waitpid(ntlm->ntlm_auth_hlpr_pid, NULL, WNOHANG);
if(ret == ntlm->ntlm_auth_hlpr_pid || errno == ECHILD)
pid_t ret = waitpid(conn->ntlm_auth_hlpr_pid, NULL, WNOHANG);
if(ret == conn->ntlm_auth_hlpr_pid || errno == ECHILD)
break;
switch(i) {
case 0:
kill(ntlm->ntlm_auth_hlpr_pid, SIGTERM);
kill(conn->ntlm_auth_hlpr_pid, SIGTERM);
break;
case 1:
/* Give the process another moment to shut down cleanly before
@ -101,21 +96,22 @@ static void ntlm_wb_cleanup(struct ntlmdata *ntlm)
Curl_wait_ms(1);
break;
case 2:
kill(ntlm->ntlm_auth_hlpr_pid, SIGKILL);
kill(conn->ntlm_auth_hlpr_pid, SIGKILL);
break;
case 3:
break;
}
}
ntlm->ntlm_auth_hlpr_pid = 0;
conn->ntlm_auth_hlpr_pid = 0;
}
Curl_safefree(ntlm->challenge);
Curl_safefree(ntlm->response);
free(conn->challenge_header);
conn->challenge_header = NULL;
free(conn->response_header);
conn->response_header = NULL;
}
static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
const char *userp)
static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
{
curl_socket_t sockfds[2];
pid_t child_pid;
@ -127,15 +123,11 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
struct passwd pw, *pw_res;
char pwbuf[1024];
#endif
char buffer[STRERROR_LEN];
#if defined(CURL_DISABLE_VERBOSE_STRINGS)
(void) data;
#endif
int error;
/* Return if communication with ntlm_auth already set up */
if(ntlm->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD ||
ntlm->ntlm_auth_hlpr_pid)
if(conn->ntlm_auth_hlpr_socket != CURL_SOCKET_BAD ||
conn->ntlm_auth_hlpr_pid)
return CURLE_OK;
username = userp;
@ -186,23 +178,26 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
ntlm_auth = NTLM_WB_FILE;
if(access(ntlm_auth, X_OK) != 0) {
failf(data, "Could not access ntlm_auth: %s errno %d: %s",
ntlm_auth, errno, Curl_strerror(errno, buffer, sizeof(buffer)));
error = ERRNO;
failf(conn->data, "Could not access ntlm_auth: %s errno %d: %s",
ntlm_auth, error, Curl_strerror(conn, error));
goto done;
}
if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
failf(data, "Could not open socket pair. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
error = ERRNO;
failf(conn->data, "Could not open socket pair. errno %d: %s",
error, Curl_strerror(conn, error));
goto done;
}
child_pid = fork();
if(child_pid == -1) {
error = ERRNO;
sclose(sockfds[0]);
sclose(sockfds[1]);
failf(data, "Could not fork. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
failf(conn->data, "Could not fork. errno %d: %s",
error, Curl_strerror(conn, error));
goto done;
}
else if(!child_pid) {
@ -213,14 +208,16 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
/* Don't use sclose in the child since it fools the socket leak detector */
sclose_nolog(sockfds[0]);
if(dup2(sockfds[1], STDIN_FILENO) == -1) {
failf(data, "Could not redirect child stdin. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
error = ERRNO;
failf(conn->data, "Could not redirect child stdin. errno %d: %s",
error, Curl_strerror(conn, error));
exit(1);
}
if(dup2(sockfds[1], STDOUT_FILENO) == -1) {
failf(data, "Could not redirect child stdout. errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
error = ERRNO;
failf(conn->data, "Could not redirect child stdout. errno %d: %s",
error, Curl_strerror(conn, error));
exit(1);
}
@ -238,15 +235,16 @@ static CURLcode ntlm_wb_init(struct Curl_easy *data, struct ntlmdata *ntlm,
"--username", username,
NULL);
error = ERRNO;
sclose_nolog(sockfds[1]);
failf(data, "Could not execl(). errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
failf(conn->data, "Could not execl(). errno %d: %s",
error, Curl_strerror(conn, error));
exit(1);
}
sclose(sockfds[1]);
ntlm->ntlm_auth_hlpr_socket = sockfds[0];
ntlm->ntlm_auth_hlpr_pid = child_pid;
conn->ntlm_auth_hlpr_socket = sockfds[0];
conn->ntlm_auth_hlpr_pid = child_pid;
free(domain);
free(ntlm_auth_alloc);
return CURLE_OK;
@ -257,20 +255,17 @@ done:
return CURLE_REMOTE_ACCESS_DENIED;
}
/* if larger than this, something is seriously wrong */
#define MAX_NTLM_WB_RESPONSE 100000
static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
static CURLcode ntlm_wb_response(struct connectdata *conn,
const char *input, curlntlm state)
{
char *buf = malloc(NTLM_BUFSIZE);
size_t len_in = strlen(input), len_out = 0;
struct dynbuf b;
char *ptr = NULL;
unsigned char *buf = (unsigned char *)data->state.buffer;
Curl_dyn_init(&b, MAX_NTLM_WB_RESPONSE);
if(!buf)
return CURLE_OUT_OF_MEMORY;
while(len_in > 0) {
ssize_t written = swrite(ntlm->ntlm_auth_hlpr_socket, input, len_in);
ssize_t written = swrite(conn->ntlm_auth_hlpr_socket, input, len_in);
if(written == -1) {
/* Interrupted by a signal, retry it */
if(errno == EINTR)
@ -283,8 +278,10 @@ static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
}
/* Read one line */
while(1) {
ssize_t size =
sread(ntlm->ntlm_auth_hlpr_socket, buf, data->set.buffer_size);
ssize_t size;
char *newbuf;
size = sread(conn->ntlm_auth_hlpr_socket, buf + len_out, NTLM_BUFSIZE);
if(size == -1) {
if(errno == EINTR)
continue;
@ -293,128 +290,75 @@ static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
else if(size == 0)
goto done;
if(Curl_dyn_addn(&b, buf, size))
goto done;
len_out = Curl_dyn_len(&b);
ptr = Curl_dyn_ptr(&b);
if(len_out && ptr[len_out - 1] == '\n') {
ptr[len_out - 1] = '\0';
break; /* done! */
len_out += size;
if(buf[len_out - 1] == '\n') {
buf[len_out - 1] = '\0';
break;
}
/* loop */
newbuf = Curl_saferealloc(buf, len_out + NTLM_BUFSIZE);
if(!newbuf)
return CURLE_OUT_OF_MEMORY;
buf = newbuf;
}
/* Samba/winbind installed but not configured */
if(state == NTLMSTATE_TYPE1 &&
len_out == 3 &&
ptr[0] == 'P' && ptr[1] == 'W')
buf[0] == 'P' && buf[1] == 'W')
goto done;
/* invalid response */
if(len_out < 4)
goto done;
if(state == NTLMSTATE_TYPE1 &&
(ptr[0]!='Y' || ptr[1]!='R' || ptr[2]!=' '))
(buf[0]!='Y' || buf[1]!='R' || buf[2]!=' '))
goto done;
if(state == NTLMSTATE_TYPE2 &&
(ptr[0]!='K' || ptr[1]!='K' || ptr[2]!=' ') &&
(ptr[0]!='A' || ptr[1]!='F' || ptr[2]!=' '))
(buf[0]!='K' || buf[1]!='K' || buf[2]!=' ') &&
(buf[0]!='A' || buf[1]!='F' || buf[2]!=' '))
goto done;
ntlm->response = strdup(ptr + 3);
Curl_dyn_free(&b);
if(!ntlm->response)
return CURLE_OUT_OF_MEMORY;
conn->response_header = aprintf("NTLM %.*s", len_out - 4, buf + 3);
free(buf);
return CURLE_OK;
done:
Curl_dyn_free(&b);
free(buf);
return CURLE_REMOTE_ACCESS_DENIED;
}
CURLcode Curl_input_ntlm_wb(struct Curl_easy *data,
struct connectdata *conn,
bool proxy,
const char *header)
{
struct ntlmdata *ntlm = proxy ? &conn->proxyntlm : &conn->ntlm;
curlntlm *state = proxy ? &conn->proxy_ntlm_state : &conn->http_ntlm_state;
(void) data; /* In case it gets unused by nop log macros. */
if(!checkprefix("NTLM", header))
return CURLE_BAD_CONTENT_ENCODING;
header += strlen("NTLM");
while(*header && ISSPACE(*header))
header++;
if(*header) {
ntlm->challenge = strdup(header);
if(!ntlm->challenge)
return CURLE_OUT_OF_MEMORY;
*state = NTLMSTATE_TYPE2; /* We got a type-2 message */
}
else {
if(*state == NTLMSTATE_LAST) {
infof(data, "NTLM auth restarted");
Curl_http_auth_cleanup_ntlm_wb(conn);
}
else if(*state == NTLMSTATE_TYPE3) {
infof(data, "NTLM handshake rejected");
Curl_http_auth_cleanup_ntlm_wb(conn);
*state = NTLMSTATE_NONE;
return CURLE_REMOTE_ACCESS_DENIED;
}
else if(*state >= NTLMSTATE_TYPE1) {
infof(data, "NTLM handshake failure (internal error)");
return CURLE_REMOTE_ACCESS_DENIED;
}
*state = NTLMSTATE_TYPE1; /* We should send away a type-1 */
}
return CURLE_OK;
}
/*
* This is for creating ntlm header output by delegating challenge/response
* to Samba's winbind daemon helper ntlm_auth.
*/
CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn,
CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
bool proxy)
{
/* point to the address of the pointer that holds the string to send to the
server, which is for a plain host or for an HTTP proxy */
server, which is for a plain host or for a HTTP proxy */
char **allocuserpwd;
/* point to the name and password for this */
const char *userp;
/* point to the correct struct with this */
struct ntlmdata *ntlm;
curlntlm *state;
struct auth *authp;
CURLcode res = CURLE_OK;
char *input;
DEBUGASSERT(conn);
DEBUGASSERT(data);
DEBUGASSERT(conn->data);
if(proxy) {
#ifndef CURL_DISABLE_PROXY
allocuserpwd = &data->state.aptr.proxyuserpwd;
allocuserpwd = &conn->allocptr.proxyuserpwd;
userp = conn->http_proxy.user;
ntlm = &conn->proxyntlm;
state = &conn->proxy_ntlm_state;
authp = &data->state.authproxy;
#else
return CURLE_NOT_BUILT_IN;
#endif
authp = &conn->data->state.authproxy;
}
else {
allocuserpwd = &data->state.aptr.userpwd;
allocuserpwd = &conn->allocptr.userpwd;
userp = conn->user;
ntlm = &conn->ntlm;
state = &conn->http_ntlm_state;
authp = &data->state.authhost;
authp = &conn->data->state.authhost;
}
authp->done = FALSE;
@ -422,14 +366,13 @@ CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn,
if(!userp)
userp="";
switch(*state) {
switch(ntlm->state) {
case NTLMSTATE_TYPE1:
default:
/* Use Samba's 'winbind' daemon to support NTLM authentication,
* by delegating the NTLM challenge/response protocol to a helper
* by delegating the NTLM challenge/response protocal to a helper
* in ntlm_auth.
* https://web.archive.org/web/20190925164737
* /devel.squid-cache.org/ntlm/squid_helper_protocol.html
* http://devel.squid-cache.org/ntlm/squid_helper_protocol.html
* https://www.samba.org/samba/docs/man/manpages-3/winbindd.8.html
* https://www.samba.org/samba/docs/man/manpages-3/ntlm_auth.1.html
* Preprocessor symbol 'NTLM_WB_ENABLED' is defined when this
@ -439,51 +382,45 @@ CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn,
* request handling process.
*/
/* Create communication with ntlm_auth */
res = ntlm_wb_init(data, ntlm, userp);
res = ntlm_wb_init(conn, userp);
if(res)
return res;
res = ntlm_wb_response(data, ntlm, "YR\n", *state);
res = ntlm_wb_response(conn, "YR\n", ntlm->state);
if(res)
return res;
free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
ntlm->response);
conn->response_header);
DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd));
Curl_safefree(ntlm->response);
if(!*allocuserpwd)
return CURLE_OUT_OF_MEMORY;
free(conn->response_header);
conn->response_header = NULL;
break;
case NTLMSTATE_TYPE2: {
char *input = aprintf("TT %s\n", ntlm->challenge);
case NTLMSTATE_TYPE2:
input = aprintf("TT %s\n", conn->challenge_header);
if(!input)
return CURLE_OUT_OF_MEMORY;
res = ntlm_wb_response(data, ntlm, input, *state);
res = ntlm_wb_response(conn, input, ntlm->state);
free(input);
input = NULL;
if(res)
return res;
free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
ntlm->response);
conn->response_header);
DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd));
*state = NTLMSTATE_TYPE3; /* we sent a type-3 */
ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */
authp->done = TRUE;
Curl_http_auth_cleanup_ntlm_wb(conn);
if(!*allocuserpwd)
return CURLE_OUT_OF_MEMORY;
Curl_ntlm_wb_cleanup(conn);
break;
}
case NTLMSTATE_TYPE3:
/* connection is already authenticated,
* don't send a header in future requests */
*state = NTLMSTATE_LAST;
/* FALLTHROUGH */
case NTLMSTATE_LAST:
Curl_safefree(*allocuserpwd);
free(*allocuserpwd);
*allocuserpwd=NULL;
authp->done = TRUE;
break;
}
@ -491,10 +428,4 @@ CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn,
return CURLE_OK;
}
void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn)
{
ntlm_wb_cleanup(&conn->ntlm);
ntlm_wb_cleanup(&conn->proxyntlm);
}
#endif /* !CURL_DISABLE_HTTP && USE_NTLM && NTLM_WB_ENABLED */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -29,16 +27,11 @@
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \
defined(NTLM_WB_ENABLED)
/* this is for ntlm header input */
CURLcode Curl_input_ntlm_wb(struct Curl_easy *data,
struct connectdata *conn, bool proxy,
const char *header);
/* this is for creating ntlm header output by delegating challenge/response
to Samba's winbind daemon helper ntlm_auth */
CURLcode Curl_output_ntlm_wb(struct connectdata *conn, bool proxy);
/* this is for creating ntlm header output */
CURLcode Curl_output_ntlm_wb(struct Curl_easy *data, struct connectdata *conn,
bool proxy);
void Curl_http_auth_cleanup_ntlm_wb(struct connectdata *conn);
void Curl_ntlm_wb_cleanup(struct connectdata *conn);
#endif /* !CURL_DISABLE_HTTP && USE_NTLM && NTLM_WB_ENABLED */

View File

@ -1,201 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl AND ISC
*
***************************************************************************/
#include "curl_setup.h"
#if defined(USE_SSH)
#include <curl/curl.h>
#include "curl_memory.h"
#include "curl_path.h"
#include "escape.h"
#include "memdebug.h"
/* figure out the path to work with in this particular request */
CURLcode Curl_getworkingpath(struct Curl_easy *data,
char *homedir, /* when SFTP is used */
char **path) /* returns the allocated
real path to work with */
{
char *real_path = NULL;
char *working_path;
size_t working_path_len;
CURLcode result =
Curl_urldecode(data->state.up.path, 0, &working_path,
&working_path_len, REJECT_ZERO);
if(result)
return result;
/* Check for /~/, indicating relative to the user's home directory */
if(data->conn->handler->protocol & CURLPROTO_SCP) {
real_path = malloc(working_path_len + 1);
if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
if((working_path_len > 3) && (!memcmp(working_path, "/~/", 3)))
/* It is referenced to the home directory, so strip the leading '/~/' */
memcpy(real_path, working_path + 3, working_path_len - 2);
else
memcpy(real_path, working_path, 1 + working_path_len);
}
else if(data->conn->handler->protocol & CURLPROTO_SFTP) {
if((working_path_len > 1) && (working_path[1] == '~')) {
size_t homelen = strlen(homedir);
real_path = malloc(homelen + working_path_len + 1);
if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
/* It is referenced to the home directory, so strip the
leading '/' */
memcpy(real_path, homedir, homelen);
/* Only add a trailing '/' if homedir does not end with one */
if(homelen == 0 || real_path[homelen - 1] != '/') {
real_path[homelen] = '/';
homelen++;
real_path[homelen] = '\0';
}
if(working_path_len > 3) {
memcpy(real_path + homelen, working_path + 3,
1 + working_path_len -3);
}
}
else {
real_path = malloc(working_path_len + 1);
if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
memcpy(real_path, working_path, 1 + working_path_len);
}
}
free(working_path);
/* store the pointer for the caller to receive */
*path = real_path;
return CURLE_OK;
}
/* The get_pathname() function is being borrowed from OpenSSH sftp.c
version 4.6p1. */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
{
const char *cp = *cpp, *end;
char quot;
unsigned int i, j;
size_t fullPathLength, pathLength;
bool relativePath = false;
static const char WHITESPACE[] = " \t\r\n";
DEBUGASSERT(homedir);
if(!*cp || !homedir) {
*cpp = NULL;
*path = NULL;
return CURLE_QUOTE_ERROR;
}
/* Ignore leading whitespace */
cp += strspn(cp, WHITESPACE);
/* Allocate enough space for home directory and filename + separator */
fullPathLength = strlen(cp) + strlen(homedir) + 2;
*path = malloc(fullPathLength);
if(!*path)
return CURLE_OUT_OF_MEMORY;
/* Check for quoted filenames */
if(*cp == '\"' || *cp == '\'') {
quot = *cp++;
/* Search for terminating quote, unescape some chars */
for(i = j = 0; i <= strlen(cp); i++) {
if(cp[i] == quot) { /* Found quote */
i++;
(*path)[j] = '\0';
break;
}
if(cp[i] == '\0') { /* End of string */
goto fail;
}
if(cp[i] == '\\') { /* Escaped characters */
i++;
if(cp[i] != '\'' && cp[i] != '\"' &&
cp[i] != '\\') {
goto fail;
}
}
(*path)[j++] = cp[i];
}
if(j == 0) {
goto fail;
}
*cpp = cp + i + strspn(cp + i, WHITESPACE);
}
else {
/* Read to end of filename - either to whitespace or terminator */
end = strpbrk(cp, WHITESPACE);
if(!end)
end = strchr(cp, '\0');
/* return pointer to second parameter if it exists */
*cpp = end + strspn(end, WHITESPACE);
pathLength = 0;
relativePath = (cp[0] == '/' && cp[1] == '~' && cp[2] == '/');
/* Handling for relative path - prepend home directory */
if(relativePath) {
strcpy(*path, homedir);
pathLength = strlen(homedir);
(*path)[pathLength++] = '/';
(*path)[pathLength] = '\0';
cp += 3;
}
/* Copy path name up until first "whitespace" */
memcpy(&(*path)[pathLength], cp, (int)(end - cp));
pathLength += (int)(end - cp);
(*path)[pathLength] = '\0';
}
return CURLE_OK;
fail:
Curl_safefree(*path);
return CURLE_QUOTE_ERROR;
}
#endif /* if SSH is used */

View File

@ -1,49 +0,0 @@
#ifndef HEADER_CURL_PATH_H
#define HEADER_CURL_PATH_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include <curl/curl.h>
#include "urldata.h"
#ifdef WIN32
# undef PATH_MAX
# define PATH_MAX MAX_PATH
# ifndef R_OK
# define R_OK 4
# endif
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024 /* just an extra precaution since there are systems that
have their definition hidden well */
#endif
CURLcode Curl_getworkingpath(struct Curl_easy *data,
char *homedir,
char **path);
CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir);
#endif /* HEADER_CURL_PATH_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
@ -33,7 +31,7 @@
# undef printf
# undef fprintf
# undef msnprintf
# undef snprintf
# undef vprintf
# undef vfprintf
# undef vsnprintf
@ -41,10 +39,18 @@
# undef vaprintf
# define printf curl_mprintf
# define fprintf curl_mfprintf
# define msnprintf curl_msnprintf
# define snprintf curl_msnprintf
# define vprintf curl_mvprintf
# define vfprintf curl_mvfprintf
# define mvsnprintf curl_mvsnprintf
# define vsnprintf curl_mvsnprintf
# define aprintf curl_maprintf
# define vaprintf curl_mvaprintf
/* We define away the sprintf functions unconditonally since we don't want
internal code to be using them, intentionally or by mistake!*/
# undef sprintf
# undef vsprintf
# define sprintf sprintf_was_used
# define vsprintf vsprintf_was_used
#endif /* HEADER_CURL_PRINTF_H */

View File

@ -1,96 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include <curl/curl.h>
#include "curl_range.h"
#include "sendf.h"
#include "strtoofft.h"
/* Only include this function if one or more of FTP, FILE are enabled. */
#if !defined(CURL_DISABLE_FTP) || !defined(CURL_DISABLE_FILE)
/*
Check if this is a range download, and if so, set the internal variables
properly.
*/
CURLcode Curl_range(struct Curl_easy *data)
{
curl_off_t from, to;
char *ptr;
char *ptr2;
if(data->state.use_range && data->state.range) {
CURLofft from_t;
CURLofft to_t;
from_t = curlx_strtoofft(data->state.range, &ptr, 10, &from);
if(from_t == CURL_OFFT_FLOW)
return CURLE_RANGE_ERROR;
while(*ptr && (ISBLANK(*ptr) || (*ptr == '-')))
ptr++;
to_t = curlx_strtoofft(ptr, &ptr2, 10, &to);
if(to_t == CURL_OFFT_FLOW)
return CURLE_RANGE_ERROR;
if((to_t == CURL_OFFT_INVAL) && !from_t) {
/* X - */
data->state.resume_from = from;
DEBUGF(infof(data, "RANGE %" CURL_FORMAT_CURL_OFF_T " to end of file",
from));
}
else if((from_t == CURL_OFFT_INVAL) && !to_t) {
/* -Y */
data->req.maxdownload = to;
data->state.resume_from = -to;
DEBUGF(infof(data, "RANGE the last %" CURL_FORMAT_CURL_OFF_T " bytes",
to));
}
else {
/* X-Y */
curl_off_t totalsize;
/* Ensure the range is sensible - to should follow from. */
if(from > to)
return CURLE_RANGE_ERROR;
totalsize = to - from;
if(totalsize == CURL_OFF_T_MAX)
return CURLE_RANGE_ERROR;
data->req.maxdownload = totalsize + 1; /* include last byte */
data->state.resume_from = from;
DEBUGF(infof(data, "RANGE from %" CURL_FORMAT_CURL_OFF_T
" getting %" CURL_FORMAT_CURL_OFF_T " bytes",
from, data->req.maxdownload));
}
DEBUGF(infof(data, "range-download from %" CURL_FORMAT_CURL_OFF_T
" to %" CURL_FORMAT_CURL_OFF_T ", totally %"
CURL_FORMAT_CURL_OFF_T " bytes",
from, to, data->req.maxdownload));
}
else
data->req.maxdownload = -1;
return CURLE_OK;
}
#endif

View File

@ -1,31 +0,0 @@
#ifndef HEADER_CURL_RANGE_H
#define HEADER_CURL_RANGE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#include "urldata.h"
CURLcode Curl_range(struct Curl_easy *data);
#endif /* HEADER_CURL_RANGE_H */

View File

@ -5,12 +5,12 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012, Howard Chu, <hyc@highlandsun.com>
* Copyright (C) 2012 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -19,15 +19,12 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#ifdef USE_LIBRTMP
#include "curl_rtmp.h"
#include "urldata.h"
#include "nonblock.h" /* for curlx_nonblock */
#include "progress.h" /* for Curl_pgrsSetUploadSize */
@ -39,24 +36,20 @@
/* The last #include file should be: */
#include "memdebug.h"
#if defined(WIN32) && !defined(USE_LWIPSOCK)
#ifdef _WIN32
#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)
#define SET_RCVTIMEO(tv,s) int tv = s*1000
#elif defined(LWIP_SO_SNDRCVTIMEO_NONSTANDARD)
#define SET_RCVTIMEO(tv,s) int tv = s*1000
#else
#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0}
#endif
#define DEF_BUFTIME (2*60*60*1000) /* 2 hours */
static CURLcode rtmp_setup_connection(struct Curl_easy *data,
struct connectdata *conn);
static CURLcode rtmp_do(struct Curl_easy *data, bool *done);
static CURLcode rtmp_done(struct Curl_easy *data, CURLcode, bool premature);
static CURLcode rtmp_connect(struct Curl_easy *data, bool *done);
static CURLcode rtmp_disconnect(struct Curl_easy *data,
struct connectdata *conn, bool dead);
static CURLcode rtmp_setup_connection(struct connectdata *conn);
static CURLcode rtmp_do(struct connectdata *conn, bool *done);
static CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature);
static CURLcode rtmp_connect(struct connectdata *conn, bool *done);
static CURLcode rtmp_disconnect(struct connectdata *conn, bool dead);
static Curl_recv rtmp_recv;
static Curl_send rtmp_send;
@ -80,11 +73,8 @@ const struct Curl_handler Curl_handler_rtmp = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMP, /* defport */
CURLPROTO_RTMP, /* protocol */
CURLPROTO_RTMP, /* family */
PROTOPT_NONE /* flags*/
};
@ -103,11 +93,8 @@ const struct Curl_handler Curl_handler_rtmpt = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMPT, /* defport */
CURLPROTO_RTMPT, /* protocol */
CURLPROTO_RTMPT, /* family */
PROTOPT_NONE /* flags*/
};
@ -126,11 +113,8 @@ const struct Curl_handler Curl_handler_rtmpe = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMP, /* defport */
CURLPROTO_RTMPE, /* protocol */
CURLPROTO_RTMPE, /* family */
PROTOPT_NONE /* flags*/
};
@ -149,11 +133,8 @@ const struct Curl_handler Curl_handler_rtmpte = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMPT, /* defport */
CURLPROTO_RTMPTE, /* protocol */
CURLPROTO_RTMPTE, /* family */
PROTOPT_NONE /* flags*/
};
@ -172,11 +153,8 @@ const struct Curl_handler Curl_handler_rtmps = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMPS, /* defport */
CURLPROTO_RTMPS, /* protocol */
CURLPROTO_RTMP, /* family */
PROTOPT_NONE /* flags*/
};
@ -195,16 +173,12 @@ const struct Curl_handler Curl_handler_rtmpts = {
ZERO_NULL, /* perform_getsock */
rtmp_disconnect, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_RTMPS, /* defport */
CURLPROTO_RTMPTS, /* protocol */
CURLPROTO_RTMPT, /* family */
PROTOPT_NONE /* flags*/
};
static CURLcode rtmp_setup_connection(struct Curl_easy *data,
struct connectdata *conn)
static CURLcode rtmp_setup_connection(struct connectdata *conn)
{
RTMP *r = RTMP_Alloc();
if(!r)
@ -212,26 +186,25 @@ static CURLcode rtmp_setup_connection(struct Curl_easy *data,
RTMP_Init(r);
RTMP_SetBufferMS(r, DEF_BUFTIME);
if(!RTMP_SetupURL(r, data->state.url)) {
if(!RTMP_SetupURL(r, conn->data->change.url)) {
RTMP_Free(r);
return CURLE_URL_MALFORMAT;
}
conn->proto.rtmp = r;
conn->proto.generic = r;
return CURLE_OK;
}
static CURLcode rtmp_connect(struct Curl_easy *data, bool *done)
static CURLcode rtmp_connect(struct connectdata *conn, bool *done)
{
struct connectdata *conn = data->conn;
RTMP *r = conn->proto.rtmp;
RTMP *r = conn->proto.generic;
SET_RCVTIMEO(tv, 10);
r->m_sb.sb_socket = (int)conn->sock[FIRSTSOCKET];
r->m_sb.sb_socket = conn->sock[FIRSTSOCKET];
/* We have to know if it's a write before we send the
* connect request packet
*/
if(data->set.upload)
if(conn->data->set.upload)
r->Link.protocol |= RTMP_FEATURE_WRITE;
/* For plain streams, use the buffer toggle trick to keep data flowing */
@ -255,54 +228,50 @@ static CURLcode rtmp_connect(struct Curl_easy *data, bool *done)
return CURLE_OK;
}
static CURLcode rtmp_do(struct Curl_easy *data, bool *done)
static CURLcode rtmp_do(struct connectdata *conn, bool *done)
{
struct connectdata *conn = data->conn;
RTMP *r = conn->proto.rtmp;
RTMP *r = conn->proto.generic;
if(!RTMP_ConnectStream(r, 0))
return CURLE_FAILED_INIT;
if(data->set.upload) {
Curl_pgrsSetUploadSize(data, data->state.infilesize);
Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
if(conn->data->set.upload) {
Curl_pgrsSetUploadSize(conn->data, conn->data->state.infilesize);
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);
}
else
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);
*done = TRUE;
return CURLE_OK;
}
static CURLcode rtmp_done(struct Curl_easy *data, CURLcode status,
static CURLcode rtmp_done(struct connectdata *conn, CURLcode status,
bool premature)
{
(void)data; /* unused */
(void)conn; /* unused */
(void)status; /* unused */
(void)premature; /* unused */
return CURLE_OK;
}
static CURLcode rtmp_disconnect(struct Curl_easy *data,
struct connectdata *conn,
static CURLcode rtmp_disconnect(struct connectdata *conn,
bool dead_connection)
{
RTMP *r = conn->proto.rtmp;
(void)data;
RTMP *r = conn->proto.generic;
(void)dead_connection;
if(r) {
conn->proto.rtmp = NULL;
conn->proto.generic = NULL;
RTMP_Close(r);
RTMP_Free(r);
}
return CURLE_OK;
}
static ssize_t rtmp_recv(struct Curl_easy *data, int sockindex, char *buf,
static ssize_t rtmp_recv(struct connectdata *conn, int sockindex, char *buf,
size_t len, CURLcode *err)
{
struct connectdata *conn = data->conn;
RTMP *r = conn->proto.rtmp;
RTMP *r = conn->proto.generic;
ssize_t nread;
(void)sockindex; /* unused */
@ -311,7 +280,7 @@ static ssize_t rtmp_recv(struct Curl_easy *data, int sockindex, char *buf,
if(nread < 0) {
if(r->m_read.status == RTMP_READ_COMPLETE ||
r->m_read.status == RTMP_READ_EOF) {
data->req.size = data->req.bytecount;
conn->data->req.size = conn->data->req.bytecount;
nread = 0;
}
else
@ -320,11 +289,10 @@ static ssize_t rtmp_recv(struct Curl_easy *data, int sockindex, char *buf,
return nread;
}
static ssize_t rtmp_send(struct Curl_easy *data, int sockindex,
static ssize_t rtmp_send(struct connectdata *conn, int sockindex,
const void *buf, size_t len, CURLcode *err)
{
struct connectdata *conn = data->conn;
RTMP *r = conn->proto.rtmp;
RTMP *r = conn->proto.generic;
ssize_t num;
(void)sockindex; /* unused */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010 - 2022, Howard Chu, <hyc@highlandsun.com>
* Copyright (C) 2010, Howard Chu, <hyc@highlandsun.com>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef USE_LIBRTMP
extern const struct Curl_handler Curl_handler_rtmp;

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,15 +18,11 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
* RFC2195 CRAM-MD5 authentication
* RFC2617 Basic and Digest Access Authentication
* RFC2831 DIGEST-MD5 authentication
* RFC4422 Simple Authentication and Security Layer (SASL)
* RFC4616 PLAIN authentication
* RFC5802 SCRAM-SHA-1 authentication
* RFC7677 SCRAM-SHA-256 authentication
* RFC6749 OAuth 2.0 Authorization Framework
* RFC7628 A Set of SASL Mechanisms for OAuth
* Draft LOGIN SASL Mechanism <draft-murchison-sasl-login-00.txt>
@ -35,22 +31,19 @@
#include "curl_setup.h"
#if !defined(CURL_DISABLE_IMAP) || !defined(CURL_DISABLE_SMTP) || \
!defined(CURL_DISABLE_POP3)
#include <curl/curl.h>
#include "urldata.h"
#include "curl_base64.h"
#include "curl_md5.h"
#include "vauth/vauth.h"
#include "cfilters.h"
#include "vtls/vtls.h"
#include "curl_hmac.h"
#include "curl_sasl.h"
#include "warnless.h"
#include "strtok.h"
#include "sendf.h"
#include "non-ascii.h" /* included for Curl_convert_... prototypes */
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@ -60,7 +53,7 @@
static const struct {
const char *name; /* Name */
size_t len; /* Name length */
unsigned short bit; /* Flag bit */
unsigned int bit; /* Flag bit */
} mechtable[] = {
{ "LOGIN", 5, SASL_MECH_LOGIN },
{ "PLAIN", 5, SASL_MECH_PLAIN },
@ -71,8 +64,6 @@ static const struct {
{ "NTLM", 4, SASL_MECH_NTLM },
{ "XOAUTH2", 7, SASL_MECH_XOAUTH2 },
{ "OAUTHBEARER", 11, SASL_MECH_OAUTHBEARER },
{ "SCRAM-SHA-1", 11, SASL_MECH_SCRAM_SHA_1 },
{ "SCRAM-SHA-256",13, SASL_MECH_SCRAM_SHA_256 },
{ ZERO_NULL, 0, 0 }
};
@ -87,31 +78,27 @@ static const struct {
* conn [in] - The connection data.
* authused [in] - The authentication mechanism used.
*/
void Curl_sasl_cleanup(struct connectdata *conn, unsigned short authused)
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused)
{
(void)conn;
(void)authused;
#if defined(USE_KERBEROS5)
/* Cleanup the gssapi structure */
if(authused == SASL_MECH_GSSAPI) {
Curl_auth_cleanup_gssapi(&conn->krb5);
}
#endif
#if defined(USE_GSASL)
/* Cleanup the GSASL structure */
if(authused & (SASL_MECH_SCRAM_SHA_1 | SASL_MECH_SCRAM_SHA_256)) {
Curl_auth_gsasl_cleanup(&conn->gsasl);
Curl_auth_gssapi_cleanup(&conn->krb5);
}
#endif
#if defined(USE_NTLM)
/* Cleanup the NTLM structure */
if(authused == SASL_MECH_NTLM) {
Curl_auth_cleanup_ntlm(&conn->ntlm);
Curl_auth_ntlm_cleanup(&conn->ntlm);
}
#endif
#if !defined(USE_KERBEROS5) && !defined(USE_NTLM)
/* Reserved for future use */
(void)conn;
(void)authused;
#endif
}
/*
@ -127,8 +114,7 @@ void Curl_sasl_cleanup(struct connectdata *conn, unsigned short authused)
*
* Returns the SASL mechanism token or 0 if no match.
*/
unsigned short Curl_sasl_decode_mech(const char *ptr, size_t maxlen,
size_t *len)
unsigned int Curl_sasl_decode_mech(const char *ptr, size_t maxlen, size_t *len)
{
unsigned int i;
char c;
@ -160,6 +146,7 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl,
const char *value, size_t len)
{
CURLcode result = CURLE_OK;
unsigned int mechbit;
size_t mechlen;
if(!len)
@ -173,7 +160,7 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl,
if(!strncmp(value, "*", len))
sasl->prefmech = SASL_AUTH_DEFAULT;
else {
unsigned short mechbit = Curl_sasl_decode_mech(value, len, &mechlen);
mechbit = Curl_sasl_decode_mech(value, len, &mechlen);
if(mechbit && mechlen == len)
sasl->prefmech |= mechbit;
else
@ -188,35 +175,16 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl,
*
* Initializes the SASL structure.
*/
void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data,
const struct SASLproto *params)
void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params)
{
unsigned long auth = data->set.httpauth;
sasl->params = params; /* Set protocol dependent parameters */
sasl->state = SASL_STOP; /* Not yet running */
sasl->curmech = NULL; /* No mechanism yet. */
sasl->authmechs = SASL_AUTH_NONE; /* No known authentication mechanism yet */
sasl->prefmech = params->defmechs; /* Default preferred mechanisms */
sasl->authused = SASL_AUTH_NONE; /* The authentication mechanism used */
sasl->prefmech = SASL_AUTH_DEFAULT; /* Prefer all mechanisms */
sasl->authused = SASL_AUTH_NONE; /* No the authentication mechanism used */
sasl->resetprefs = TRUE; /* Reset prefmech upon AUTH parsing. */
sasl->mutual_auth = FALSE; /* No mutual authentication (GSSAPI only) */
sasl->force_ir = FALSE; /* Respect external option */
if(auth != CURLAUTH_BASIC) {
sasl->resetprefs = FALSE;
sasl->prefmech = SASL_AUTH_NONE;
if(auth & CURLAUTH_BASIC)
sasl->prefmech |= SASL_MECH_PLAIN | SASL_MECH_LOGIN;
if(auth & CURLAUTH_DIGEST)
sasl->prefmech |= SASL_MECH_DIGEST_MD5;
if(auth & CURLAUTH_NTLM)
sasl->prefmech |= SASL_MECH_NTLM;
if(auth & CURLAUTH_BEARER)
sasl->prefmech |= SASL_MECH_OAUTHBEARER | SASL_MECH_XOAUTH2;
if(auth & CURLAUTH_GSSAPI)
sasl->prefmech |= SASL_MECH_GSSAPI;
}
}
/*
@ -224,7 +192,7 @@ void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data,
*
* This is the ONLY way to change SASL state!
*/
static void state(struct SASL *sasl, struct Curl_easy *data,
static void state(struct SASL *sasl, struct connectdata *conn,
saslstate newstate)
{
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
@ -245,78 +213,30 @@ static void state(struct SASL *sasl, struct Curl_easy *data,
"GSSAPI_NO_DATA",
"OAUTH2",
"OAUTH2_RESP",
"GSASL",
"CANCEL",
"FINAL",
/* LAST */
};
if(sasl->state != newstate)
infof(data, "SASL %p state change from %s to %s",
infof(conn->data, "SASL %p state change from %s to %s\n",
(void *)sasl, names[sasl->state], names[newstate]);
#else
(void) data;
(void) conn;
#endif
sasl->state = newstate;
}
/* Get the SASL server message and convert it to binary. */
static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data,
struct bufref *out)
{
CURLcode result = CURLE_OK;
result = sasl->params->getmessage(data, out);
if(!result && (sasl->params->flags & SASL_FLAG_BASE64)) {
unsigned char *msg;
size_t msglen;
const char *serverdata = (const char *) Curl_bufref_ptr(out);
if(!*serverdata || *serverdata == '=')
Curl_bufref_set(out, NULL, 0, NULL);
else {
result = Curl_base64_decode(serverdata, &msg, &msglen);
if(!result)
Curl_bufref_set(out, msg, msglen, curl_free);
}
}
return result;
}
/* Encode the outgoing SASL message. */
static CURLcode build_message(struct SASL *sasl, struct bufref *msg)
{
CURLcode result = CURLE_OK;
if(sasl->params->flags & SASL_FLAG_BASE64) {
if(!Curl_bufref_ptr(msg)) /* Empty message. */
Curl_bufref_set(msg, "", 0, NULL);
else if(!Curl_bufref_len(msg)) /* Explicit empty response. */
Curl_bufref_set(msg, "=", 1, NULL);
else {
char *base64;
size_t base64len;
result = Curl_base64_encode((const char *) Curl_bufref_ptr(msg),
Curl_bufref_len(msg), &base64, &base64len);
if(!result)
Curl_bufref_set(msg, base64, base64len, curl_free);
}
}
return result;
}
/*
* Curl_sasl_can_authenticate()
*
* Check if we have enough auth data and capabilities to authenticate.
*/
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data)
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn)
{
/* Have credentials been provided? */
if(data->state.aptr.user)
if(conn->bits.user_passwd)
return TRUE;
/* EXTERNAL can authenticate without a user name and/or password */
@ -331,29 +251,26 @@ bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data)
*
* Calculate the required login details for SASL authentication.
*/
CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
bool force_ir, saslprogress *progress)
{
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
unsigned short enabledmechs;
struct Curl_easy *data = conn->data;
unsigned int enabledmechs;
const char *mech = NULL;
struct bufref resp;
char *resp = NULL;
size_t len = 0;
saslstate state1 = SASL_STOP;
saslstate state2 = SASL_FINAL;
const char *hostname, *disp_hostname;
int port;
#if defined(USE_KERBEROS5) || defined(USE_NTLM)
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
#if defined(USE_KERBEROS5)
const char *service = data->set.str[STRING_SERVICE_NAME] ?
data->set.str[STRING_SERVICE_NAME] :
sasl->params->service;
#endif
const char *oauth_bearer = data->set.str[STRING_BEARER];
struct bufref nullmsg;
Curl_conn_get_host(data, FIRSTSOCKET, &hostname, &disp_hostname, &port);
Curl_bufref_init(&nullmsg);
Curl_bufref_init(&resp);
sasl->force_ir = force_ir; /* Latch for future use */
sasl->authused = 0; /* No mechanism used yet */
enabledmechs = sasl->authmechs & sasl->prefmech;
@ -367,13 +284,14 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
sasl->authused = SASL_MECH_EXTERNAL;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_external_message(conn->user, &resp);
result = Curl_auth_create_external_message(data, conn->user, &resp,
&len);
}
else if(data->state.aptr.user) {
else if(conn->bits.user_passwd) {
#if defined(USE_KERBEROS5)
if((enabledmechs & SASL_MECH_GSSAPI) && Curl_auth_is_gssapi_supported() &&
Curl_auth_user_contains_domain(conn->user)) {
sasl->mutual_auth = FALSE;
sasl->mutual_auth = FALSE; /* TODO: Calculate mutual authentication */
mech = SASL_MECH_STRING_GSSAPI;
state1 = SASL_GSSAPI;
state2 = SASL_GSSAPI_TOKEN;
@ -383,39 +301,11 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
result = Curl_auth_create_gssapi_user_message(data, conn->user,
conn->passwd,
service,
conn->host.name,
data->easy_conn->
host.name,
sasl->mutual_auth,
NULL, &conn->krb5,
&resp);
}
else
#endif
#ifdef USE_GSASL
if((enabledmechs & SASL_MECH_SCRAM_SHA_256) &&
Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_256,
&conn->gsasl)) {
mech = SASL_MECH_STRING_SCRAM_SHA_256;
sasl->authused = SASL_MECH_SCRAM_SHA_256;
state1 = SASL_GSASL;
state2 = SASL_GSASL;
result = Curl_auth_gsasl_start(data, conn->user,
conn->passwd, &conn->gsasl);
if(result == CURLE_OK && (force_ir || data->set.sasl_ir))
result = Curl_auth_gsasl_token(data, &nullmsg, &conn->gsasl, &resp);
}
else if((enabledmechs & SASL_MECH_SCRAM_SHA_1) &&
Curl_auth_gsasl_is_supported(data, SASL_MECH_STRING_SCRAM_SHA_1,
&conn->gsasl)) {
mech = SASL_MECH_STRING_SCRAM_SHA_1;
sasl->authused = SASL_MECH_SCRAM_SHA_1;
state1 = SASL_GSASL;
state2 = SASL_GSASL;
result = Curl_auth_gsasl_start(data, conn->user,
conn->passwd, &conn->gsasl);
if(result == CURLE_OK && (force_ir || data->set.sasl_ir))
result = Curl_auth_gsasl_token(data, &nullmsg, &conn->gsasl, &resp);
&resp, &len);
}
else
#endif
@ -441,46 +331,34 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
sasl->authused = SASL_MECH_NTLM;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_ntlm_type1_message(data,
conn->user, conn->passwd,
service,
hostname,
&conn->ntlm, &resp);
result = Curl_auth_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm, &resp, &len);
}
else
#endif
if((enabledmechs & SASL_MECH_OAUTHBEARER) && oauth_bearer) {
if((enabledmechs & SASL_MECH_OAUTHBEARER) && conn->oauth_bearer) {
mech = SASL_MECH_STRING_OAUTHBEARER;
state1 = SASL_OAUTH2;
state2 = SASL_OAUTH2_RESP;
sasl->authused = SASL_MECH_OAUTHBEARER;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_oauth_bearer_message(conn->user,
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
hostname,
port,
oauth_bearer,
&resp);
conn->oauth_bearer,
&resp, &len);
}
else if((enabledmechs & SASL_MECH_XOAUTH2) && oauth_bearer) {
else if((enabledmechs & SASL_MECH_XOAUTH2) && conn->oauth_bearer) {
mech = SASL_MECH_STRING_XOAUTH2;
state1 = SASL_OAUTH2;
sasl->authused = SASL_MECH_XOAUTH2;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_xoauth_bearer_message(conn->user,
oauth_bearer,
&resp);
}
else if(enabledmechs & SASL_MECH_PLAIN) {
mech = SASL_MECH_STRING_PLAIN;
state1 = SASL_PLAIN;
sasl->authused = SASL_MECH_PLAIN;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_plain_message(conn->sasl_authzid,
conn->user, conn->passwd,
&resp);
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
NULL, 0,
conn->oauth_bearer,
&resp, &len);
}
else if(enabledmechs & SASL_MECH_LOGIN) {
mech = SASL_MECH_STRING_LOGIN;
@ -489,29 +367,35 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
sasl->authused = SASL_MECH_LOGIN;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_login_message(conn->user, &resp);
result = Curl_auth_create_login_message(data, conn->user, &resp, &len);
}
else if(enabledmechs & SASL_MECH_PLAIN) {
mech = SASL_MECH_STRING_PLAIN;
state1 = SASL_PLAIN;
sasl->authused = SASL_MECH_PLAIN;
if(force_ir || data->set.sasl_ir)
result = Curl_auth_create_plain_message(data, conn->user, conn->passwd,
&resp, &len);
}
}
if(!result && mech) {
sasl->curmech = mech;
if(Curl_bufref_ptr(&resp))
result = build_message(sasl, &resp);
if(sasl->params->maxirlen &&
strlen(mech) + Curl_bufref_len(&resp) > sasl->params->maxirlen)
Curl_bufref_free(&resp);
if(!result)
result = sasl->params->sendauth(data, mech, &resp);
if(resp && sasl->params->maxirlen &&
strlen(mech) + len > sasl->params->maxirlen) {
free(resp);
resp = NULL;
}
result = sasl->params->sendauth(conn, mech, resp);
if(!result) {
*progress = SASL_INPROGRESS;
state(sasl, data, Curl_bufref_ptr(&resp) ? state2 : state1);
state(sasl, conn, resp ? state2 : state1);
}
}
Curl_bufref_free(&resp);
free(resp);
return result;
}
@ -520,41 +404,42 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
*
* Continue the authentication.
*/
CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
int code, saslprogress *progress)
{
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
struct Curl_easy *data = conn->data;
saslstate newstate = SASL_FINAL;
struct bufref resp;
const char *hostname, *disp_hostname;
int port;
#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_KERBEROS5) || \
defined(USE_NTLM)
char *resp = NULL;
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
conn->host.name;
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
#if !defined(CURL_DISABLE_CRYPTO_AUTH)
char *serverdata;
char *chlg = NULL;
size_t chlglen = 0;
#endif
#if !defined(CURL_DISABLE_CRYPTO_AUTH) || defined(USE_KERBEROS5)
const char *service = data->set.str[STRING_SERVICE_NAME] ?
data->set.str[STRING_SERVICE_NAME] :
sasl->params->service;
#endif
const char *oauth_bearer = data->set.str[STRING_BEARER];
struct bufref serverdata;
size_t len = 0;
Curl_conn_get_host(data, FIRSTSOCKET, &hostname, &disp_hostname, &port);
Curl_bufref_init(&serverdata);
Curl_bufref_init(&resp);
*progress = SASL_INPROGRESS;
if(sasl->state == SASL_FINAL) {
if(code != sasl->params->finalcode)
result = CURLE_LOGIN_DENIED;
*progress = SASL_DONE;
state(sasl, data, SASL_STOP);
state(sasl, conn, SASL_STOP);
return result;
}
if(sasl->state != SASL_CANCEL && sasl->state != SASL_OAUTH2_RESP &&
code != sasl->params->contcode) {
*progress = SASL_DONE;
state(sasl, data, SASL_STOP);
state(sasl, conn, SASL_STOP);
return CURLE_LOGIN_DENIED;
}
@ -563,68 +448,61 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
*progress = SASL_DONE;
return result;
case SASL_PLAIN:
result = Curl_auth_create_plain_message(conn->sasl_authzid,
conn->user, conn->passwd, &resp);
result = Curl_auth_create_plain_message(data, conn->user, conn->passwd,
&resp,
&len);
break;
case SASL_LOGIN:
result = Curl_auth_create_login_message(conn->user, &resp);
result = Curl_auth_create_login_message(data, conn->user, &resp, &len);
newstate = SASL_LOGIN_PASSWD;
break;
case SASL_LOGIN_PASSWD:
result = Curl_auth_create_login_message(conn->passwd, &resp);
result = Curl_auth_create_login_message(data, conn->passwd, &resp, &len);
break;
case SASL_EXTERNAL:
result = Curl_auth_create_external_message(conn->user, &resp);
result = Curl_auth_create_external_message(data, conn->user, &resp, &len);
break;
#ifndef CURL_DISABLE_CRYPTO_AUTH
#ifdef USE_GSASL
case SASL_GSASL:
result = get_server_message(sasl, data, &serverdata);
if(!result)
result = Curl_auth_gsasl_token(data, &serverdata, &conn->gsasl, &resp);
if(!result && Curl_bufref_len(&resp) > 0)
newstate = SASL_GSASL;
break;
#endif
case SASL_CRAMMD5:
result = get_server_message(sasl, data, &serverdata);
sasl->params->getmessage(data->state.buffer, &serverdata);
result = Curl_auth_decode_cram_md5_message(serverdata, &chlg, &chlglen);
if(!result)
result = Curl_auth_create_cram_md5_message(&serverdata, conn->user,
conn->passwd, &resp);
result = Curl_auth_create_cram_md5_message(data, chlg, conn->user,
conn->passwd, &resp, &len);
free(chlg);
break;
case SASL_DIGESTMD5:
result = get_server_message(sasl, data, &serverdata);
if(!result)
result = Curl_auth_create_digest_md5_message(data, &serverdata,
sasl->params->getmessage(data->state.buffer, &serverdata);
result = Curl_auth_create_digest_md5_message(data, serverdata,
conn->user, conn->passwd,
service, &resp);
if(!result && (sasl->params->flags & SASL_FLAG_BASE64))
service,
&resp, &len);
newstate = SASL_DIGESTMD5_RESP;
break;
case SASL_DIGESTMD5_RESP:
/* Keep response NULL to output an empty line. */
resp = strdup("");
if(!resp)
result = CURLE_OUT_OF_MEMORY;
break;
#endif
#ifdef USE_NTLM
case SASL_NTLM:
/* Create the type-1 message */
result = Curl_auth_create_ntlm_type1_message(data,
conn->user, conn->passwd,
service, hostname,
&conn->ntlm, &resp);
result = Curl_auth_create_ntlm_type1_message(conn->user, conn->passwd,
&conn->ntlm, &resp, &len);
newstate = SASL_NTLM_TYPE2MSG;
break;
case SASL_NTLM_TYPE2MSG:
/* Decode the type-2 message */
result = get_server_message(sasl, data, &serverdata);
if(!result)
result = Curl_auth_decode_ntlm_type2_message(data, &serverdata,
sasl->params->getmessage(data->state.buffer, &serverdata);
result = Curl_auth_decode_ntlm_type2_message(data, serverdata,
&conn->ntlm);
if(!result)
result = Curl_auth_create_ntlm_type3_message(data, conn->user,
conn->passwd, &conn->ntlm,
&resp);
&resp, &len);
break;
#endif
@ -633,63 +511,56 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
result = Curl_auth_create_gssapi_user_message(data, conn->user,
conn->passwd,
service,
conn->host.name,
data->easy_conn->host.name,
sasl->mutual_auth, NULL,
&conn->krb5,
&resp);
&resp, &len);
newstate = SASL_GSSAPI_TOKEN;
break;
case SASL_GSSAPI_TOKEN:
result = get_server_message(sasl, data, &serverdata);
if(!result) {
sasl->params->getmessage(data->state.buffer, &serverdata);
if(sasl->mutual_auth) {
/* Decode the user token challenge and create the optional response
message */
result = Curl_auth_create_gssapi_user_message(data, NULL, NULL,
NULL, NULL,
sasl->mutual_auth,
&serverdata,
&conn->krb5,
&resp);
serverdata, &conn->krb5,
&resp, &len);
newstate = SASL_GSSAPI_NO_DATA;
}
else
/* Decode the security challenge and create the response message */
result = Curl_auth_create_gssapi_security_message(data,
conn->sasl_authzid,
&serverdata,
result = Curl_auth_create_gssapi_security_message(data, serverdata,
&conn->krb5,
&resp);
}
&resp, &len);
break;
case SASL_GSSAPI_NO_DATA:
sasl->params->getmessage(data->state.buffer, &serverdata);
/* Decode the security challenge and create the response message */
result = get_server_message(sasl, data, &serverdata);
if(!result)
result = Curl_auth_create_gssapi_security_message(data,
conn->sasl_authzid,
&serverdata,
result = Curl_auth_create_gssapi_security_message(data, serverdata,
&conn->krb5,
&resp);
&resp, &len);
break;
#endif
case SASL_OAUTH2:
/* Create the authorization message */
/* Create the authorisation message */
if(sasl->authused == SASL_MECH_OAUTHBEARER) {
result = Curl_auth_create_oauth_bearer_message(conn->user,
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
hostname,
port,
oauth_bearer,
&resp);
conn->oauth_bearer,
&resp, &len);
/* Failures maybe sent by the server as continuations for OAUTHBEARER */
newstate = SASL_OAUTH2_RESP;
}
else
result = Curl_auth_create_xoauth_bearer_message(conn->user,
oauth_bearer,
&resp);
result = Curl_auth_create_oauth_bearer_message(data, conn->user,
NULL, 0,
conn->oauth_bearer,
&resp, &len);
break;
case SASL_OAUTH2_RESP:
@ -697,17 +568,20 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
if(code == sasl->params->finalcode) {
/* Final response was received so we are done */
*progress = SASL_DONE;
state(sasl, data, SASL_STOP);
state(sasl, conn, SASL_STOP);
return result;
}
else if(code == sasl->params->contcode) {
/* Acknowledge the continuation by sending a 0x01 response. */
Curl_bufref_set(&resp, "\x01", 1, NULL);
/* Acknowledge the continuation by sending a 0x01 response base64
encoded */
resp = strdup("AQ==");
if(!resp)
result = CURLE_OUT_OF_MEMORY;
break;
}
else {
*progress = SASL_DONE;
state(sasl, data, SASL_STOP);
state(sasl, conn, SASL_STOP);
return CURLE_LOGIN_DENIED;
}
@ -716,25 +590,24 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
sasl->authmechs ^= sasl->authused;
/* Start an alternative SASL authentication */
return Curl_sasl_start(sasl, data, sasl->force_ir, progress);
result = Curl_sasl_start(sasl, conn, sasl->force_ir, progress);
newstate = sasl->state; /* Use state from Curl_sasl_start() */
break;
default:
failf(data, "Unsupported SASL authentication mechanism");
result = CURLE_UNSUPPORTED_PROTOCOL; /* Should not happen */
break;
}
Curl_bufref_free(&serverdata);
switch(result) {
case CURLE_BAD_CONTENT_ENCODING:
/* Cancel dialog */
result = sasl->params->cancelauth(data, sasl->curmech);
result = sasl->params->sendcont(conn, "*");
newstate = SASL_CANCEL;
break;
case CURLE_OK:
result = build_message(sasl, &resp);
if(!result)
result = sasl->params->contauth(data, sasl->curmech, &resp);
if(resp)
result = sasl->params->sendcont(conn, resp);
break;
default:
newstate = SASL_STOP; /* Stop on error */
@ -742,10 +615,9 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
break;
}
Curl_bufref_free(&resp);
free(resp);
state(sasl, data, newstate);
state(sasl, conn, newstate);
return result;
}
#endif /* protocols are enabled that use SASL */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,14 +20,10 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include <curl/curl.h>
#include "bufref.h"
struct Curl_easy;
struct connectdata;
@ -41,12 +37,10 @@ struct connectdata;
#define SASL_MECH_NTLM (1 << 6)
#define SASL_MECH_XOAUTH2 (1 << 7)
#define SASL_MECH_OAUTHBEARER (1 << 8)
#define SASL_MECH_SCRAM_SHA_1 (1 << 9)
#define SASL_MECH_SCRAM_SHA_256 (1 << 10)
/* Authentication mechanism values */
#define SASL_AUTH_NONE 0
#define SASL_AUTH_ANY 0xffff
#define SASL_AUTH_ANY ~0U
#define SASL_AUTH_DEFAULT (SASL_AUTH_ANY & ~SASL_MECH_EXTERNAL)
/* Authentication mechanism strings */
@ -59,11 +53,6 @@ struct connectdata;
#define SASL_MECH_STRING_NTLM "NTLM"
#define SASL_MECH_STRING_XOAUTH2 "XOAUTH2"
#define SASL_MECH_STRING_OAUTHBEARER "OAUTHBEARER"
#define SASL_MECH_STRING_SCRAM_SHA_1 "SCRAM-SHA-1"
#define SASL_MECH_STRING_SCRAM_SHA_256 "SCRAM-SHA-256"
/* SASL flags */
#define SASL_FLAG_BASE64 0x0001 /* Messages are base64-encoded */
/* SASL machine states */
typedef enum {
@ -82,7 +71,6 @@ typedef enum {
SASL_GSSAPI_NO_DATA,
SASL_OAUTH2,
SASL_OAUTH2_RESP,
SASL_GSASL,
SASL_CANCEL,
SASL_FINAL
} saslstate;
@ -97,34 +85,25 @@ typedef enum {
/* Protocol dependent SASL parameters */
struct SASLproto {
const char *service; /* The service name */
CURLcode (*sendauth)(struct Curl_easy *data, const char *mech,
const struct bufref *ir);
/* Send authentication command */
CURLcode (*contauth)(struct Curl_easy *data, const char *mech,
const struct bufref *contauth);
/* Send authentication continuation */
CURLcode (*cancelauth)(struct Curl_easy *data, const char *mech);
/* Cancel authentication. */
CURLcode (*getmessage)(struct Curl_easy *data, struct bufref *out);
/* Get SASL response message */
size_t maxirlen; /* Maximum initial response + mechanism length,
or zero if no max. This is normally the max
command length - other characters count.
This has to be zero for non-base64 protocols. */
int contcode; /* Code to receive when continuation is expected */
int finalcode; /* Code to receive upon authentication success */
unsigned short defmechs; /* Mechanisms enabled by default */
unsigned short flags; /* Configuration flags. */
size_t maxirlen; /* Maximum initial response length */
CURLcode (*sendauth)(struct connectdata *conn,
const char *mech, const char *ir);
/* Send authentication command */
CURLcode (*sendcont)(struct connectdata *conn, const char *contauth);
/* Send authentication continuation */
void (*getmessage)(char *buffer, char **outptr);
/* Get SASL response message */
};
/* Per-connection parameters */
struct SASL {
const struct SASLproto *params; /* Protocol dependent parameters */
saslstate state; /* Current machine state */
const char *curmech; /* Current mechanism id. */
unsigned short authmechs; /* Accepted authentication mechanisms */
unsigned short prefmech; /* Preferred authentication mechanism */
unsigned short authused; /* Auth mechanism used for the connection */
unsigned int authmechs; /* Accepted authentication mechanisms */
unsigned int prefmech; /* Preferred authentication mechanism */
unsigned int authused; /* Auth mechanism used for the connection */
bool resetprefs; /* For URL auth option parsing. */
bool mutual_auth; /* Mutual authentication enabled (GSSAPI only) */
bool force_ir; /* Protocol always supports initial response */
@ -137,10 +116,10 @@ struct SASL {
/* This is used to cleanup any libraries or curl modules used by the sasl
functions */
void Curl_sasl_cleanup(struct connectdata *conn, unsigned short authused);
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused);
/* Convert a mechanism name to a token */
unsigned short Curl_sasl_decode_mech(const char *ptr,
unsigned int Curl_sasl_decode_mech(const char *ptr,
size_t maxlen, size_t *len);
/* Parse the URL login options */
@ -148,18 +127,17 @@ CURLcode Curl_sasl_parse_url_auth_option(struct SASL *sasl,
const char *value, size_t len);
/* Initializes an SASL structure */
void Curl_sasl_init(struct SASL *sasl, struct Curl_easy *data,
const struct SASLproto *params);
void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params);
/* Check if we have enough auth data and capabilities to authenticate */
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct Curl_easy *data);
bool Curl_sasl_can_authenticate(struct SASL *sasl, struct connectdata *conn);
/* Calculate the required login details for SASL authentication */
CURLcode Curl_sasl_start(struct SASL *sasl, struct Curl_easy *data,
CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
bool force_ir, saslprogress *progress);
/* Continue an SASL authentication */
CURLcode Curl_sasl_continue(struct SASL *sasl, struct Curl_easy *data,
CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
int code, saslprogress *progress);
#endif /* HEADER_CURL_SASL_H */

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_KRB5_H
#define HEADER_CURL_KRB5_H
#ifndef HEADER_CURL_SECURITY_H
#define HEADER_CURL_SECURITY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,17 +20,16 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
struct Curl_sec_client_mech {
const char *name;
size_t size;
int (*init)(void *);
int (*auth)(void *, struct Curl_easy *data, struct connectdata *);
int (*auth)(void *, struct connectdata *);
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
int (*encode)(void *, const void *, int, int, void **);
int (*decode)(void *, void *, int, int, struct connectdata *);
};
@ -40,13 +39,13 @@ struct Curl_sec_client_mech {
#define AUTH_ERROR 2
#ifdef HAVE_GSSAPI
int Curl_sec_read_msg(struct Curl_easy *data, struct connectdata *conn, char *,
int Curl_sec_read_msg(struct connectdata *conn, char *,
enum protection_level);
void Curl_sec_end(struct connectdata *);
CURLcode Curl_sec_login(struct Curl_easy *, struct connectdata *);
CURLcode Curl_sec_login(struct connectdata *);
int Curl_sec_request_prot(struct connectdata *conn, const char *level);
#else
#define Curl_sec_end(x)
extern struct Curl_sec_client_mech Curl_krb5_client_mech;
#endif
#endif /* HEADER_CURL_KRB5_H */
#endif /* HEADER_CURL_SECURITY_H */

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,59 +20,17 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#if defined(BUILDING_LIBCURL) && !defined(CURL_NO_OLDIES)
#define CURL_NO_OLDIES
#endif
/* define mingw version macros, eg __MINGW{32,64}_{MINOR,MAJOR}_VERSION */
#ifdef __MINGW32__
#include <_mingw.h>
#endif
/*
* Disable Visual Studio warnings:
* 4127 "conditional expression is constant"
*/
#ifdef _MSC_VER
#pragma warning(disable:4127)
#endif
/*
* Define WIN32 when build target is Win32 API
*/
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \
!defined(__SYMBIAN32__)
#define WIN32
#endif
#ifdef WIN32
/*
* Don't include unneeded stuff in Windows headers to avoid compiler
* warnings and macro clashes.
* Make sure to define this macro before including any Windows headers.
*/
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# ifndef NOGDI
# define NOGDI
# endif
/* Detect Windows App environment which has a restricted access
* to the Win32 APIs. */
# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
defined(WINAPI_FAMILY)
# include <winapifamily.h>
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define CURL_WINDOWS_APP
# endif
# endif
#endif
/*
* Include configuration script results or hand-crafted
* configuration file for platforms which lack config tool.
@ -92,7 +50,7 @@
# endif
#endif
#ifdef macintosh
#if defined(macintosh) && defined(__MRC__)
# include "config-mac.h"
#endif
@ -104,16 +62,20 @@
# include "config-amigaos.h"
#endif
#ifdef __SYMBIAN32__
# include "config-symbian.h"
#endif
#ifdef __OS400__
# include "config-os400.h"
#endif
#ifdef __PLAN9__
# include "config-plan9.h"
#ifdef TPF
# include "config-tpf.h"
#endif
#ifdef MSDOS
# include "config-dos.h"
#ifdef __VXWORKS__
# include "config-vxworks.h"
#endif
#endif /* HAVE_CONFIG_H */
@ -162,52 +124,60 @@
/* please, do it beyond the point further indicated in this file. */
/* ================================================================ */
#include <curl/curl.h>
/*
* Ensure that no one is using the old SIZEOF_CURL_OFF_T macro
*/
#ifdef SIZEOF_CURL_OFF_T
# error "SIZEOF_CURL_OFF_T shall not be defined!"
Error Compilation_aborted_SIZEOF_CURL_OFF_T_shall_not_be_defined
#endif
/*
* Disable other protocols when http is the only one desired.
*/
#ifdef HTTP_ONLY
# ifndef CURL_DISABLE_TFTP
# define CURL_DISABLE_TFTP
# endif
# ifndef CURL_DISABLE_FTP
# define CURL_DISABLE_FTP
# endif
# ifndef CURL_DISABLE_LDAP
# define CURL_DISABLE_LDAP
# endif
# ifndef CURL_DISABLE_TELNET
# define CURL_DISABLE_TELNET
# endif
# ifndef CURL_DISABLE_DICT
# define CURL_DISABLE_DICT
# endif
# ifndef CURL_DISABLE_FILE
# define CURL_DISABLE_FILE
# endif
# ifndef CURL_DISABLE_FTP
# define CURL_DISABLE_FTP
# endif
# ifndef CURL_DISABLE_GOPHER
# define CURL_DISABLE_GOPHER
# endif
# ifndef CURL_DISABLE_IMAP
# define CURL_DISABLE_IMAP
# endif
# ifndef CURL_DISABLE_LDAP
# define CURL_DISABLE_LDAP
# endif
# ifndef CURL_DISABLE_LDAPS
# define CURL_DISABLE_LDAPS
# endif
# ifndef CURL_DISABLE_MQTT
# define CURL_DISABLE_MQTT
# ifndef CURL_DISABLE_RTSP
# define CURL_DISABLE_RTSP
# endif
# ifndef CURL_DISABLE_POP3
# define CURL_DISABLE_POP3
# endif
# ifndef CURL_DISABLE_RTSP
# define CURL_DISABLE_RTSP
# endif
# ifndef CURL_DISABLE_SMB
# define CURL_DISABLE_SMB
# ifndef CURL_DISABLE_IMAP
# define CURL_DISABLE_IMAP
# endif
# ifndef CURL_DISABLE_SMTP
# define CURL_DISABLE_SMTP
# endif
# ifndef CURL_DISABLE_TELNET
# define CURL_DISABLE_TELNET
# ifndef CURL_DISABLE_RTMP
# define CURL_DISABLE_RTMP
# endif
# ifndef CURL_DISABLE_TFTP
# define CURL_DISABLE_TFTP
# ifndef CURL_DISABLE_GOPHER
# define CURL_DISABLE_GOPHER
# endif
# ifndef CURL_DISABLE_SMB
# define CURL_DISABLE_SMB
# endif
#endif
@ -221,7 +191,7 @@
/* ================================================================ */
/* No system header file shall be included in this file before this */
/* point. */
/* point. The only allowed ones are those included from curlbuild.h */
/* ================================================================ */
/*
@ -241,25 +211,65 @@
#endif
/*
* Windows setup file includes some system headers.
* Use getaddrinfo to resolve the IPv4 address literal. If the current network
* interface doesnt support IPv4, but supports IPv6, NAT64, and DNS64,
* performing this task will result in a synthesized IPv6 address.
*/
#ifdef __APPLE__
#define USE_RESOLVE_ON_IPS 1
#endif
/*
* Include header files for windows builds before redefining anything.
* Use this preprocessor block only to include or exclude windows.h,
* winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
* to any other further and independent block. Under Cygwin things work
* just as under linux (e.g. <sys/socket.h>) and the winsock headers should
* never be included when __CYGWIN__ is defined. configure script takes
* care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
* neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
*/
#ifdef HAVE_WINDOWS_H
# include "setup-win32.h"
# if defined(UNICODE) && !defined(_UNICODE)
# define _UNICODE
# endif
# if defined(_UNICODE) && !defined(UNICODE)
# define UNICODE
# endif
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
# endif
# else
# ifdef HAVE_WINSOCK_H
# include <winsock.h>
# endif
# endif
# include <tchar.h>
# ifdef UNICODE
typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
# endif
#endif
#include <curl/system.h>
/*
* Use getaddrinfo to resolve the IPv4 address literal. If the current network
* interface doesn't support IPv4, but supports IPv6, NAT64, and DNS64,
* performing this task will result in a synthesized IPv6 address.
* Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
* define USE_WINSOCK to 1 if we have and use WINSOCK API, else
* undefine USE_WINSOCK.
*/
#if defined(__APPLE__) && !defined(USE_ARES)
#include <TargetConditionals.h>
#define USE_RESOLVE_ON_IPS 1
# if defined(TARGET_OS_OSX) && TARGET_OS_OSX
# define CURL_OSX_CALL_COPYPROXIES 1
#undef USE_WINSOCK
#ifdef HAVE_WINSOCK2_H
# define USE_WINSOCK 2
#else
# ifdef HAVE_WINSOCK_H
# define USE_WINSOCK 1
# endif
#endif
@ -277,57 +287,39 @@
# include <extra/strdup.h>
#endif
#ifdef TPF
# include <strings.h> /* for bzero, strcasecmp, and strncasecmp */
# include <string.h> /* for strcpy and strlen */
# include <stdlib.h> /* for rand and srand */
# include <sys/socket.h> /* for select and ioctl*/
# include <netdb.h> /* for in_addr_t definition */
# include <tpf/sysapi.h> /* for tpf_process_signals */
/* change which select is used for libcurl */
# define select(a,b,c,d,e) tpf_select_libcurl(a,b,c,d,e)
#endif
#ifdef __VXWORKS__
# include <sockLib.h> /* for generic BSD socket functions */
# include <ioLib.h> /* for basic I/O interface functions */
#endif
#ifdef __AMIGA__
# ifdef __amigaos4__
# define __USE_INLINE__
/* use our own resolver which uses runtime feature detection */
# define CURLRES_AMIGA
/* getaddrinfo() currently crashes bsdsocket.library, so disable */
# undef HAVE_GETADDRINFO
# if !(defined(__NEWLIB__) || \
(defined(__CLIB2__) && defined(__THREAD_SAFE)))
/* disable threaded resolver with clib2 - requires newlib or clib-ts */
# undef USE_THREADS_POSIX
# endif
# endif
# ifndef __ixemul__
# include <exec/types.h>
# include <exec/execbase.h>
# include <proto/exec.h>
# include <proto/dos.h>
# include <unistd.h>
# if defined(HAVE_PROTO_BSDSOCKET_H) && \
(!defined(__amigaos4__) || defined(USE_AMISSL))
/* use bsdsocket.library directly, instead of libc networking functions */
# include <proto/bsdsocket.h>
# ifdef __amigaos4__
int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *errorfds, struct timeval *timeout);
# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e)
# else
# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
# endif
/* must not use libc's fcntl() on bsdsocket.library sockfds! */
# undef HAVE_FCNTL
# undef HAVE_FCNTL_O_NONBLOCK
# else
/* use libc networking and hence close() and fnctl() */
# undef HAVE_CLOSESOCKET_CAMEL
# undef HAVE_IOCTLSOCKET_CAMEL
# endif
/*
* In clib2 arpa/inet.h warns that some prototypes may clash
* with bsdsocket.library. This avoids the definition of those.
*/
# define __NO_NET_API
#endif
#include <stdio.h>
#ifdef HAVE_ASSERT_H
#include <assert.h>
#ifdef __TANDEM /* for ns*-tandem-nsk systems */
# if ! defined __LP64
# include <floss.h> /* FLOSS is only used for 32-bit builds. */
#endif
#ifdef __TANDEM /* for nsr-tandem-nsk systems */
#include <floss.h>
#endif
#ifndef STDC_HEADERS /* no standard C headers! */
@ -364,16 +356,9 @@
# undef fstat
# define fstat(fdes,stp) _fstati64(fdes, stp)
# undef stat
# define stat(fname,stp) curlx_win32_stat(fname, stp)
# define stat(fname,stp) _stati64(fname, stp)
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
# define open curlx_win32_open
# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
# define access(fname,mode) curlx_win32_access(fname, mode)
int curlx_win32_open(const char *filename, int oflag, ...);
int curlx_win32_stat(const char *path, struct_stat *buffer);
FILE *curlx_win32_fopen(const char *filename, const char *mode);
int curlx_win32_access(const char *path, int mode);
#endif
/*
@ -388,15 +373,8 @@
# undef lseek
# define lseek(fdes,offset,whence) _lseek(fdes, (long)offset, whence)
# define fstat(fdes,stp) _fstat(fdes, stp)
# define stat(fname,stp) curlx_win32_stat(fname, stp)
# define stat(fname,stp) _stat(fname, stp)
# define struct_stat struct _stat
# define open curlx_win32_open
# define fopen(fname,mode) curlx_win32_fopen(fname, mode)
# define access(fname,mode) curlx_win32_access(fname, mode)
int curlx_win32_stat(const char *path, struct_stat *buffer);
int curlx_win32_open(const char *filename, int oflag, ...);
FILE *curlx_win32_fopen(const char *filename, const char *mode);
int curlx_win32_access(const char *path, int mode);
# endif
# define LSEEK_ERROR (long)-1
#endif
@ -409,11 +387,6 @@
# define LSEEK_ERROR (off_t)-1
#endif
#ifndef SIZEOF_TIME_T
/* assume default size of time_t to be 32 bit */
#define SIZEOF_TIME_T 4
#endif
/*
* Default sizeof(off_t) in case it hasn't been defined in config file.
*/
@ -441,50 +414,6 @@
# endif
#endif
#if (SIZEOF_CURL_OFF_T == 4)
# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF)
#else
/* assume SIZEOF_CURL_OFF_T == 8 */
# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)
#endif
#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))
#if (SIZEOF_TIME_T == 4)
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX UINT_MAX
# define TIME_T_MIN 0
# else
# define TIME_T_MAX INT_MAX
# define TIME_T_MIN INT_MIN
# endif
#else
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX 0xFFFFFFFFFFFFFFFF
# define TIME_T_MIN 0
# else
# define TIME_T_MAX 0x7FFFFFFFFFFFFFFF
# define TIME_T_MIN (-TIME_T_MAX - 1)
# endif
#endif
#ifndef SIZE_T_MAX
/* some limits.h headers have this defined, some don't */
#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
#define SIZE_T_MAX 18446744073709551615U
#else
#define SIZE_T_MAX 4294967295U
#endif
#endif
#ifndef SSIZE_T_MAX
/* some limits.h headers have this defined, some don't */
#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
#define SSIZE_T_MAX 9223372036854775807
#else
#define SSIZE_T_MAX 2147483647
#endif
#endif
/*
* Arg 2 type for gethostname in case it hasn't been defined in config file.
*/
@ -506,6 +435,7 @@
#ifdef WIN32
# define DIR_CHAR "\\"
# define DOT_CHAR "_"
#else /* WIN32 */
@ -531,6 +461,14 @@
# endif
# define DIR_CHAR "/"
# ifndef DOT_CHAR
# define DOT_CHAR "."
# endif
# ifdef MSDOS
# undef DOT_CHAR
# define DOT_CHAR "_"
# endif
# ifndef fileno /* sunos 4 have this as a macro! */
int fileno(FILE *stream);
@ -550,6 +488,7 @@
# undef HAVE_GETADDRINFO_THREADSAFE
# undef HAVE_FREEADDRINFO
# undef HAVE_GETADDRINFO
# undef HAVE_GETNAMEINFO
# undef ENABLE_IPV6
# endif
#endif
@ -582,18 +521,13 @@
* Mutually exclusive CURLRES_* definitions.
*/
#if defined(ENABLE_IPV6) && defined(HAVE_GETADDRINFO)
# define CURLRES_IPV6
#else
# define CURLRES_IPV4
#endif
#ifdef USE_ARES
# define CURLRES_ASYNCH
# define CURLRES_ARES
/* now undef the stock libc functions just to avoid them being used */
# undef HAVE_GETADDRINFO
# undef HAVE_FREEADDRINFO
# undef HAVE_GETHOSTBYNAME
#elif defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
# define CURLRES_ASYNCH
# define CURLRES_THREADED
@ -601,8 +535,22 @@
# define CURLRES_SYNCH
#endif
#ifdef ENABLE_IPV6
# define CURLRES_IPV6
#else
# define CURLRES_IPV4
#endif
/* ---------------------------------------------------------------- */
/*
* When using WINSOCK, TELNET protocol requires WINSOCK2 API.
*/
#if defined(USE_WINSOCK) && (USE_WINSOCK != 2)
# define CURL_DISABLE_TELNET 1
#endif
/*
* msvc 6.0 does not have struct sockaddr_storage and
* does not define IPPROTO_ESP in winsock2.h. But both
@ -632,22 +580,30 @@
# endif
#endif
#if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H) && !defined(USE_WIN32_IDN)
#ifdef NETWARE
int netware_init(void);
#ifndef __NOVELL_LIBC__
#include <sys/bsdskt.h>
#include <sys/timeval.h>
#endif
#endif
#if defined(HAVE_LIBIDN2) && defined(HAVE_IDN2_H)
/* The lib and header are present */
#define USE_LIBIDN2
#endif
#if defined(USE_LIBIDN2) && defined(USE_WIN32_IDN)
#error "Both libidn2 and WinIDN are enabled, choose one."
#ifndef SIZEOF_TIME_T
/* assume default size of time_t to be 32 bit */
#define SIZEOF_TIME_T 4
#endif
#define LIBIDN_REQUIRED_VERSION "0.4.1"
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_NSS) || \
defined(USE_MBEDTLS) || \
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \
defined(USE_SECTRANSP) || defined(USE_GSKIT) || \
defined(USE_BEARSSL) || defined(USE_RUSTLS)
defined(USE_POLARSSL) || defined(USE_AXTLS) || defined(USE_MBEDTLS) || \
defined(USE_CYASSL) || defined(USE_SCHANNEL) || \
defined(USE_DARWINSSL) || defined(USE_GSKIT)
#define USE_SSL /* SSL support has been enabled */
#endif
@ -664,24 +620,25 @@
#endif
/* Single point where USE_NTLM definition might be defined */
#if !defined(CURL_DISABLE_CRYPTO_AUTH) && !defined(CURL_DISABLE_NTLM)
# if defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_SECTRANSP) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
(defined(USE_WOLFSSL) && defined(HAVE_WOLFSSL_DES_ECB_ENCRYPT))
# define USE_CURL_NTLM_CORE
# endif
# if defined(USE_CURL_NTLM_CORE) || defined(USE_WINDOWS_SSPI)
#if !defined(CURL_DISABLE_NTLM) && !defined(CURL_DISABLE_CRYPTO_AUTH)
#if defined(USE_OPENSSL) || defined(USE_WINDOWS_SSPI) || \
defined(USE_GNUTLS) || defined(USE_NSS) || defined(USE_DARWINSSL) || \
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO)
#define USE_NTLM
#elif defined(USE_MBEDTLS)
# include <mbedtls/md4.h>
# if defined(MBEDTLS_MD4_C)
#define USE_NTLM
# endif
#endif
#endif
#ifdef CURL_WANTS_CA_BUNDLE_ENV
#error "No longer supported. Set CURLOPT_CAINFO at runtime instead."
#endif
#if defined(USE_LIBSSH2) || defined(USE_LIBSSH) || defined(USE_WOLFSSH)
#define USE_SSH
/* non-configure builds may define CURL_WANTS_CA_BUNDLE_ENV */
#if defined(CURL_WANTS_CA_BUNDLE_ENV) && !defined(CURL_CA_BUNDLE)
#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")
#endif
/*
@ -712,7 +669,7 @@
*/
#ifndef Curl_nop_stmt
# define Curl_nop_stmt do { } while(0)
# define Curl_nop_stmt do { } WHILE_FALSE
#endif
/*
@ -722,34 +679,29 @@
#if defined(__LWIP_OPT_H__) || defined(LWIP_HDR_OPT_H)
# if defined(SOCKET) || \
defined(USE_WINSOCK) || \
defined(HAVE_WINSOCK_H) || \
defined(HAVE_WINSOCK2_H) || \
defined(HAVE_WS2TCPIP_H)
# error "WinSock and lwIP TCP/IP stack definitions shall not coexist!"
# error "Winsock and lwIP TCP/IP stack definitions shall not coexist!"
# endif
#endif
/*
* shutdown() flags for systems that don't define them
* Portable symbolic names for Winsock shutdown() mode flags.
*/
#ifndef SHUT_RD
#ifdef USE_WINSOCK
# define SHUT_RD 0x00
#endif
#ifndef SHUT_WR
# define SHUT_WR 0x01
#endif
#ifndef SHUT_RDWR
# define SHUT_RDWR 0x02
#endif
/* Define S_ISREG if not defined by system headers, e.g. MSVC */
/* Define S_ISREG if not defined by system headers, f.e. MSVC */
#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
/* Define S_ISDIR if not defined by system headers, e.g. MSVC */
/* Define S_ISDIR if not defined by system headers, f.e. MSVC */
#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
@ -760,7 +712,6 @@ Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
#if defined(WIN32) || defined(MSDOS)
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "wt"
#define FOPEN_APPENDTEXT "at"
#elif defined(__CYGWIN__)
/* Cygwin has specific behavior we need to address when WIN32 is not defined.
https://cygwin.com/cygwin-ug-net/using-textbinary.html
@ -770,11 +721,9 @@ endings either CRLF or LF so 't' is appropriate.
*/
#define FOPEN_READTEXT "rt"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#else
#define FOPEN_READTEXT "r"
#define FOPEN_WRITETEXT "w"
#define FOPEN_APPENDTEXT "a"
#endif
/* WinSock destroys recv() buffer when send() failed.
@ -786,70 +735,19 @@ endings either CRLF or LF so 't' is appropriate.
# if defined(WIN32) || defined(__CYGWIN__)
# define USE_RECV_BEFORE_SEND_WORKAROUND
# endif
#else /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
#else /* DONT_USE_RECV_BEFORE_SEND_WORKAROUNDS */
# ifdef USE_RECV_BEFORE_SEND_WORKAROUND
# undef USE_RECV_BEFORE_SEND_WORKAROUND
# endif
#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUND */
#endif /* DONT_USE_RECV_BEFORE_SEND_WORKAROUNDS */
/* for systems that don't detect this in configure */
#ifndef CURL_SA_FAMILY_T
# if defined(HAVE_SA_FAMILY_T)
# define CURL_SA_FAMILY_T sa_family_t
# elif defined(HAVE_ADDRESS_FAMILY)
# define CURL_SA_FAMILY_T ADDRESS_FAMILY
# else
/* use a sensible default */
# define CURL_SA_FAMILY_T unsigned short
# endif
#endif
/* Some convenience macros to get the larger/smaller value out of two given.
We prefix with CURL to prevent name collisions. */
#define CURLMAX(x,y) ((x)>(y)?(x):(y))
#define CURLMIN(x,y) ((x)<(y)?(x):(y))
/* A convenience macro to provide both the string literal and the length of
the string literal in one go, useful for functions that take "string,len"
as their argument */
#define STRCONST(x) x,sizeof(x)-1
/* Some versions of the Android SDK is missing the declaration */
#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
struct passwd;
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
size_t buflen, struct passwd **result);
#endif
#ifdef DEBUGBUILD
#define UNITTEST
#else
#define UNITTEST static
#endif
#if defined(USE_NGHTTP2) || defined(USE_HYPER)
#define USE_HTTP2
#endif
#if defined(USE_NGTCP2) || defined(USE_QUICHE) || defined(USE_MSH3)
#define ENABLE_QUIC
#define USE_HTTP3
#endif
#if defined(USE_UNIX_SOCKETS) && defined(WIN32)
# if defined(__MINGW32__) && !defined(LUP_SECURE)
typedef u_short ADDRESS_FAMILY; /* Classic mingw, 11y+ old mingw-w64 */
# endif
# if !defined(UNIX_PATH_MAX)
/* Replicating logic present in afunix.h
(distributed with newer Windows 10 SDK versions only) */
# define UNIX_PATH_MAX 108
/* !checksrc! disable TYPEDEFSTRUCT 1 */
typedef struct sockaddr_un {
ADDRESS_FAMILY sun_family;
char sun_path[UNIX_PATH_MAX];
} SOCKADDR_UN, *PSOCKADDR_UN;
# define WIN32_SOCKADDR_UN
/* Detect Windows App environment which has a restricted access
* to the Win32 APIs. */
# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)
# include <winapifamily.h>
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define CURL_WINDOWS_APP
# endif
# endif

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
@ -33,8 +31,11 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <ctype.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@ -54,6 +55,13 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#else
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#endif
#ifdef WIN32
@ -84,8 +92,6 @@
#include <sys/socket.h>
#endif
#include "functypes.h"
#ifdef __hpux
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
# ifdef OLD_APP32_64BIT_OFF_T
@ -95,6 +101,7 @@
# endif
#endif
/*
* Definition of timeval struct for platforms that don't have it.
*/
@ -148,10 +155,20 @@ struct timeval {
* SEND_TYPE_RETV must also be defined.
*/
#if !defined(RECV_TYPE_ARG1) || \
!defined(RECV_TYPE_ARG2) || \
!defined(RECV_TYPE_ARG3) || \
!defined(RECV_TYPE_ARG4) || \
!defined(RECV_TYPE_RETV)
/* */
Error Missing_definition_of_return_and_arguments_types_of_recv
/* */
#else
#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
(RECV_TYPE_ARG2)(y), \
(RECV_TYPE_ARG3)(z), \
(RECV_TYPE_ARG4)(0))
#endif
#else /* HAVE_RECV */
#ifndef sread
/* */
@ -168,10 +185,21 @@ struct timeval {
(SEND_TYPE_ARG3)(z))
#elif defined(HAVE_SEND)
#if !defined(SEND_TYPE_ARG1) || \
!defined(SEND_QUAL_ARG2) || \
!defined(SEND_TYPE_ARG2) || \
!defined(SEND_TYPE_ARG3) || \
!defined(SEND_TYPE_ARG4) || \
!defined(SEND_TYPE_RETV)
/* */
Error Missing_definition_of_return_and_arguments_types_of_send
/* */
#else
#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
(SEND_QUAL_ARG2 SEND_TYPE_ARG2)(y), \
(SEND_TYPE_ARG2)(y), \
(SEND_TYPE_ARG3)(z), \
(SEND_TYPE_ARG4)(SEND_4TH_ARG))
#endif
#else /* HAVE_SEND */
#ifndef swrite
/* */
@ -181,6 +209,46 @@ struct timeval {
#endif /* HAVE_SEND */
#if 0
#if defined(HAVE_RECVFROM)
/*
* Currently recvfrom is only used on udp sockets.
*/
#if !defined(RECVFROM_TYPE_ARG1) || \
!defined(RECVFROM_TYPE_ARG2) || \
!defined(RECVFROM_TYPE_ARG3) || \
!defined(RECVFROM_TYPE_ARG4) || \
!defined(RECVFROM_TYPE_ARG5) || \
!defined(RECVFROM_TYPE_ARG6) || \
!defined(RECVFROM_TYPE_RETV)
/* */
Error Missing_definition_of_return_and_arguments_types_of_recvfrom
/* */
#else
#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \
(RECVFROM_TYPE_ARG2 *)(b), \
(RECVFROM_TYPE_ARG3) (bl), \
(RECVFROM_TYPE_ARG4) (0), \
(RECVFROM_TYPE_ARG5 *)(f), \
(RECVFROM_TYPE_ARG6 *)(fl))
#endif
#else /* HAVE_RECVFROM */
#ifndef sreadfrom
/* */
Error Missing_definition_of_macro_sreadfrom
/* */
#endif
#endif /* HAVE_RECVFROM */
#ifdef RECVFROM_TYPE_ARG6_IS_VOID
# define RECVFROM_ARG6_T int
#else
# define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6
#endif
#endif /* if 0 */
/*
* Function-like macro definition used to close a socket.
*/
@ -206,6 +274,28 @@ struct timeval {
# define sfcntl fcntl
#endif
/*
* Uppercase macro versions of ANSI/ISO is*() functions/macros which
* avoid negative number inputs with argument byte codes > 127.
*/
#define ISSPACE(x) (isspace((int) ((unsigned char)x)))
#define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
#define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
#define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
#define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
#define ISPRINT(x) (isprint((int) ((unsigned char)x)))
#define ISUPPER(x) (isupper((int) ((unsigned char)x)))
#define ISLOWER(x) (islower((int) ((unsigned char)x)))
#define ISASCII(x) (isascii((int) ((unsigned char)x)))
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
(((unsigned char)x) == '\t'))
#define TOLOWER(x) (tolower((int) ((unsigned char)x)))
/*
* 'bool' stuff compatible with HP-UX headers.
*/
@ -242,14 +332,6 @@ struct timeval {
# define HAVE_BOOL_T
#endif
/* the type we use for storing a single boolean bit */
#ifdef _MSC_VER
typedef bool bit;
#define BIT(x) bool x
#else
typedef unsigned int bit;
#define BIT(x) bit x:1
#endif
/*
* Redefine TRUE and FALSE too, to catch current use. With this
@ -265,7 +347,56 @@ typedef unsigned int bit;
#define FALSE false
#endif
#include "curl_ctype.h"
/*
* Macro WHILE_FALSE may be used to build single-iteration do-while loops,
* avoiding compiler warnings. Mostly intended for other macro definitions.
*/
#define WHILE_FALSE while(0)
#if defined(_MSC_VER) && !defined(__POCC__)
# undef WHILE_FALSE
# if (_MSC_VER < 1500)
# define WHILE_FALSE while(1, 0)
# else
# define WHILE_FALSE \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
while(0) \
__pragma(warning(pop))
# endif
#endif
/*
* Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
*/
#ifndef HAVE_SIG_ATOMIC_T
typedef int sig_atomic_t;
#define HAVE_SIG_ATOMIC_T
#endif
/*
* Convenience SIG_ATOMIC_T definition
*/
#ifdef HAVE_SIG_ATOMIC_T_VOLATILE
#define SIG_ATOMIC_T static sig_atomic_t
#else
#define SIG_ATOMIC_T static volatile sig_atomic_t
#endif
/*
* Default return type for signal handlers.
*/
#ifndef RETSIGTYPE
#define RETSIGTYPE void
#endif
/*
@ -275,7 +406,7 @@ typedef unsigned int bit;
#ifdef DEBUGBUILD
#define DEBUGF(x) x
#else
#define DEBUGF(x) do { } while(0)
#define DEBUGF(x) do { } WHILE_FALSE
#endif
@ -283,11 +414,10 @@ typedef unsigned int bit;
* Macro used to include assertion code only in debug builds.
*/
#undef DEBUGASSERT
#if defined(DEBUGBUILD)
#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
#define DEBUGASSERT(x) assert(x)
#else
#define DEBUGASSERT(x) do { } while(0)
#define DEBUGASSERT(x) do { } WHILE_FALSE
#endif
@ -305,6 +435,20 @@ typedef unsigned int bit;
#endif
/*
* Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
* (or equivalent) on this platform to hide platform details to code using it.
*/
#if defined(WIN32) && !defined(USE_LWIPSOCK)
#define ERRNO ((int)GetLastError())
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
#else
#define ERRNO (errno)
#define SET_ERRNO(x) (errno = (x))
#endif
/*
* Portable error number symbolic names defined to Winsock error codes.
*/
@ -390,8 +534,6 @@ typedef unsigned int bit;
#ifdef __VMS
#define argv_item_t __char_ptr32
#elif defined(_UNICODE)
#define argv_item_t wchar_t *
#else
#define argv_item_t char *
#endif
@ -406,3 +548,4 @@ typedef unsigned int bit;
#endif /* HEADER_CURL_SETUP_ONCE_H */

View File

@ -1,48 +0,0 @@
#ifndef HEADER_CURL_SHA256_H
#define HEADER_CURL_SHA256_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2017, Florin Petriuc, <petriuc.florin@gmail.com>
* Copyright (C) 2018 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_CRYPTO_AUTH
#include <curl/curl.h>
#include "curl_hmac.h"
extern const struct HMAC_params Curl_HMAC_SHA256[1];
#ifdef USE_WOLFSSL
/* SHA256_DIGEST_LENGTH is an enum value in wolfSSL. Need to import it from
* sha.h */
#include <wolfssl/options.h>
#include <wolfssl/openssl/sha.h>
#else
#define SHA256_DIGEST_LENGTH 32
#endif
CURLcode Curl_sha256it(unsigned char *outbuffer, const unsigned char *input,
const size_t len);
#endif
#endif /* HEADER_CURL_SHA256_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -30,7 +28,6 @@
#include "curl_sspi.h"
#include "curl_multibyte.h"
#include "system_win32.h"
#include "version_win32.h"
#include "warnless.h"
/* The last #include files should be: */
@ -85,7 +82,7 @@ CURLcode Curl_sspi_global_init(void)
* have both these DLLs (security.dll forwards calls to secur32.dll) */
/* Load SSPI dll into the address space of the calling process */
if(curlx_verify_windows_version(4, 0, 0, PLATFORM_WINNT, VERSION_EQUAL))
if(Curl_verify_windows_version(4, 0, PLATFORM_WINNT, VERSION_EQUAL))
s_hSecDll = Curl_load_library(TEXT("security.dll"));
else
s_hSecDll = Curl_load_library(TEXT("secur32.dll"));
@ -93,9 +90,8 @@ CURLcode Curl_sspi_global_init(void)
return CURLE_FAILED_INIT;
/* Get address of the InitSecurityInterfaceA function from the SSPI dll */
pInitSecurityInterface =
CURLX_FUNCTION_CAST(INITSECURITYINTERFACE_FN,
(GetProcAddress(s_hSecDll, SECURITYENTRYPOINT)));
pInitSecurityInterface = (INITSECURITYINTERFACE_FN)
GetProcAddress(s_hSecDll, SECURITYENTRYPOINT);
if(!pInitSecurityInterface)
return CURLE_FAILED_INIT;
@ -135,7 +131,7 @@ void Curl_sspi_global_cleanup(void)
* Parameters:
*
* userp [in] - The user name in the format User or Domain\User.
* passwdp [in] - The user's password.
* passdwp [in] - The user's password.
* identity [in/out] - The identity structure.
*
* Returns CURLE_OK on success.
@ -154,7 +150,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Initialize the identity */
memset(identity, 0, sizeof(*identity));
useranddomain.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)userp);
useranddomain.tchar_ptr = Curl_convert_UTF8_to_tchar((char *)userp);
if(!useranddomain.tchar_ptr)
return CURLE_OUT_OF_MEMORY;
@ -176,7 +172,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Setup the identity's user and length */
dup_user.tchar_ptr = _tcsdup(user.tchar_ptr);
if(!dup_user.tchar_ptr) {
curlx_unicodefree(useranddomain.tchar_ptr);
Curl_unicodefree(useranddomain.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
identity->User = dup_user.tbyte_ptr;
@ -186,7 +182,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
/* Setup the identity's domain and length */
dup_domain.tchar_ptr = malloc(sizeof(TCHAR) * (domlen + 1));
if(!dup_domain.tchar_ptr) {
curlx_unicodefree(useranddomain.tchar_ptr);
Curl_unicodefree(useranddomain.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
_tcsncpy(dup_domain.tchar_ptr, domain.tchar_ptr, domlen);
@ -195,22 +191,22 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp,
identity->DomainLength = curlx_uztoul(domlen);
dup_domain.tchar_ptr = NULL;
curlx_unicodefree(useranddomain.tchar_ptr);
Curl_unicodefree(useranddomain.tchar_ptr);
/* Setup the identity's password and length */
passwd.tchar_ptr = curlx_convert_UTF8_to_tchar((char *)passwdp);
passwd.tchar_ptr = Curl_convert_UTF8_to_tchar((char *)passwdp);
if(!passwd.tchar_ptr)
return CURLE_OUT_OF_MEMORY;
dup_passwd.tchar_ptr = _tcsdup(passwd.tchar_ptr);
if(!dup_passwd.tchar_ptr) {
curlx_unicodefree(passwd.tchar_ptr);
Curl_unicodefree(passwd.tchar_ptr);
return CURLE_OUT_OF_MEMORY;
}
identity->Password = dup_passwd.tbyte_ptr;
identity->PasswordLength = curlx_uztoul(_tcslen(dup_passwd.tchar_ptr));
dup_passwd.tchar_ptr = NULL;
curlx_unicodefree(passwd.tchar_ptr);
Curl_unicodefree(passwd.tchar_ptr);
/* Setup the identity's flags */
identity->Flags = SECFLAG_WINNT_AUTH_IDENTITY;

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -31,8 +29,10 @@
# include <pthread.h>
# endif
#elif defined(USE_THREADS_WIN32)
# ifdef HAVE_PROCESS_H
# include <process.h>
# endif
#endif
#include "curl_threads.h"
#include "curl_memory.h"
@ -41,14 +41,14 @@
#if defined(USE_THREADS_POSIX)
struct Curl_actual_call {
struct curl_actual_call {
unsigned int (*func)(void *);
void *arg;
};
static void *curl_thread_create_thunk(void *arg)
{
struct Curl_actual_call *ac = arg;
struct curl_actual_call * ac = arg;
unsigned int (*func)(void *) = ac->func;
void *real_arg = ac->arg;
@ -62,7 +62,7 @@ static void *curl_thread_create_thunk(void *arg)
curl_thread_t Curl_thread_create(unsigned int (*func) (void *), void *arg)
{
curl_thread_t t = malloc(sizeof(pthread_t));
struct Curl_actual_call *ac = malloc(sizeof(struct Curl_actual_call));
struct curl_actual_call *ac = malloc(sizeof(struct curl_actual_call));
if(!(ac && t))
goto err;
@ -105,30 +105,14 @@ curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
void *arg)
{
#ifdef _WIN32_WCE
typedef HANDLE curl_win_thread_handle_t;
#elif defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
typedef unsigned long curl_win_thread_handle_t;
return CreateThread(NULL, 0, func, arg, 0, NULL);
#else
typedef uintptr_t curl_win_thread_handle_t;
#endif
curl_thread_t t;
curl_win_thread_handle_t thread_handle;
#ifdef _WIN32_WCE
thread_handle = CreateThread(NULL, 0, func, arg, 0, NULL);
#else
thread_handle = _beginthreadex(NULL, 0, func, arg, 0, NULL);
#endif
t = (curl_thread_t)thread_handle;
if((t == 0) || (t == LongToHandle(-1L))) {
#ifdef _WIN32_WCE
DWORD gle = GetLastError();
errno = ((gle == ERROR_ACCESS_DENIED ||
gle == ERROR_NOT_ENOUGH_MEMORY) ?
EACCES : EINVAL);
#endif
t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);
if((t == 0) || (t == (curl_thread_t)-1L))
return curl_thread_t_null;
}
return t;
#endif
}
void Curl_thread_destroy(curl_thread_t hnd)

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -40,8 +38,7 @@
# define curl_thread_t HANDLE
# define curl_thread_t_null (HANDLE)0
# if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_VISTA) || \
(_WIN32_WINNT < _WIN32_WINNT_VISTA) || \
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
(_WIN32_WINNT < _WIN32_WINNT_VISTA)
# define Curl_mutex_init(m) InitializeCriticalSection(m)
# else
# define Curl_mutex_init(m) InitializeCriticalSectionEx(m, 0, 1)

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
/*
@ -44,6 +42,16 @@
curl_off_t number from a given string.
*/
#include "timeval.h"
/*
"timeval.h" sets up a 'struct timeval' even for platforms that otherwise
don't have one and has protos for these functions:
curlx_tvnow()
curlx_tvdiff()
curlx_tvdiff_secs()
*/
#include "nonblock.h"
/* "nonblock.h" provides curlx_nonblock() */
@ -55,19 +63,6 @@
curlx_uztosi()
*/
#include "curl_multibyte.h"
/* "curl_multibyte.h" provides these functions and macros:
curlx_convert_UTF8_to_wchar()
curlx_convert_wchar_to_UTF8()
curlx_convert_UTF8_to_tchar()
curlx_convert_tchar_to_UTF8()
curlx_unicodefree()
*/
#include "version_win32.h"
/* "version_win32.h" provides curlx_verify_windows_version() */
/* Now setup curlx_ * names for the functions that are to become curlx_ and
be removed from a future libcurl official API:
curlx_getenv
@ -96,23 +91,25 @@
# undef printf
# undef fprintf
# undef sprintf
# undef msnprintf
# undef snprintf
# undef vprintf
# undef vfprintf
# undef vsprintf
# undef mvsnprintf
# undef vsnprintf
# undef aprintf
# undef vaprintf
# define printf curlx_mprintf
# define fprintf curlx_mfprintf
# define sprintf curlx_msprintf
# define msnprintf curlx_msnprintf
# define snprintf curlx_msnprintf
# define vprintf curlx_mvprintf
# define vfprintf curlx_mvfprintf
# define mvsnprintf curlx_mvsnprintf
# define vsprintf curlx_mvsprintf
# define vsnprintf curlx_mvsnprintf
# define aprintf curlx_maprintf
# define vaprintf curlx_mvaprintf
#endif /* ENABLE_CURLX_PRINTF */
#endif /* HEADER_CURL_CURLX_H */

View File

@ -5,11 +5,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -18,8 +18,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
@ -48,8 +46,6 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#elif defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include "urldata.h"
@ -59,7 +55,6 @@
#include "escape.h"
#include "progress.h"
#include "dict.h"
#include "curl_printf.h"
#include "strcase.h"
#include "curl_memory.h"
/* The last #include file should be: */
@ -69,7 +64,7 @@
* Forward declarations.
*/
static CURLcode dict_do(struct Curl_easy *data, bool *done);
static CURLcode dict_do(struct connectdata *conn, bool *done);
/*
* DICT protocol handler.
@ -90,30 +85,26 @@ const struct Curl_handler Curl_handler_dict = {
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
ZERO_NULL, /* readwrite */
ZERO_NULL, /* connection_check */
ZERO_NULL, /* attach connection */
PORT_DICT, /* defport */
CURLPROTO_DICT, /* protocol */
CURLPROTO_DICT, /* family */
PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
};
static char *unescape_word(const char *inputbuff)
static char *unescape_word(struct Curl_easy *data, const char *inputbuff)
{
char *newp = NULL;
char *dictp;
char *ptr;
size_t len;
char ch;
int olen=0;
CURLcode result = Curl_urldecode(inputbuff, 0, &newp, &len,
REJECT_NADA);
CURLcode result = Curl_urldecode(data, inputbuff, 0, &newp, &len, FALSE);
if(!newp || result)
return NULL;
dictp = malloc(len*2 + 1); /* add one for terminating zero */
dictp = malloc(((size_t)len)*2 + 1); /* add one for terminating zero */
if(dictp) {
char *ptr;
char ch;
int olen = 0;
/* According to RFC2229 section 2.2, these letters need to be escaped with
\[letter] */
for(ptr = newp;
@ -131,51 +122,7 @@ static char *unescape_word(const char *inputbuff)
return dictp;
}
/* sendf() sends formatted data to the server */
static CURLcode sendf(curl_socket_t sockfd, struct Curl_easy *data,
const char *fmt, ...)
{
ssize_t bytes_written;
size_t write_len;
CURLcode result = CURLE_OK;
char *s;
char *sptr;
va_list ap;
va_start(ap, fmt);
s = vaprintf(fmt, ap); /* returns an allocated string */
va_end(ap);
if(!s)
return CURLE_OUT_OF_MEMORY; /* failure */
bytes_written = 0;
write_len = strlen(s);
sptr = s;
for(;;) {
/* Write the buffer to the socket */
result = Curl_write(data, sockfd, sptr, write_len, &bytes_written);
if(result)
break;
Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written);
if((size_t)bytes_written != write_len) {
/* if not all was written at once, we must advance the pointer, decrease
the size left and try again! */
write_len -= bytes_written;
sptr += bytes_written;
}
else
break;
}
free(s); /* free the output string */
return result;
}
static CURLcode dict_do(struct Curl_easy *data, bool *done)
static CURLcode dict_do(struct connectdata *conn, bool *done)
{
char *word;
char *eword;
@ -185,13 +132,18 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
char *nthdef = NULL; /* This is not part of the protocol, but required
by RFC 2229 */
CURLcode result=CURLE_OK;
struct connectdata *conn = data->conn;
struct Curl_easy *data=conn->data;
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
char *path = data->state.up.path;
char *path = data->state.path;
curl_off_t *bytecount = &data->req.bytecount;
*done = TRUE; /* unconditionally */
if(conn->bits.user_passwd) {
/* AUTH is missing */
}
if(strncasecompare(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
strncasecompare(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
strncasecompare(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
@ -213,31 +165,33 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
}
}
if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing");
if((word == NULL) || (*word == (char)0)) {
infof(data, "lookup word is missing\n");
word=(char *)"default";
}
if(!database || (*database == (char)0)) {
if((database == NULL) || (*database == (char)0)) {
database = (char *)"!";
}
if(!strategy || (*strategy == (char)0)) {
if((strategy == NULL) || (*strategy == (char)0)) {
strategy = (char *)".";
}
eword = unescape_word(word);
eword = unescape_word(data, word);
if(!eword)
return CURLE_OUT_OF_MEMORY;
result = sendf(sockfd, data,
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"MATCH "
"%s " /* database */
"%s " /* strategy */
"%s\r\n" /* word */
"QUIT\r\n",
database,
strategy,
eword);
eword
);
free(eword);
@ -245,7 +199,8 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
failf(data, "Failed sending DICT request");
return result;
}
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1); /* no upload */
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
-1, NULL); /* no upload */
}
else if(strncasecompare(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
strncasecompare(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
@ -264,19 +219,19 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
}
}
if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing");
if((word == NULL) || (*word == (char)0)) {
infof(data, "lookup word is missing\n");
word=(char *)"default";
}
if(!database || (*database == (char)0)) {
if((database == NULL) || (*database == (char)0)) {
database = (char *)"!";
}
eword = unescape_word(word);
eword = unescape_word(data, word);
if(!eword)
return CURLE_OUT_OF_MEMORY;
result = sendf(sockfd, data,
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"DEFINE "
"%s " /* database */
@ -291,7 +246,8 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
failf(data, "Failed sending DICT request");
return result;
}
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount,
-1, NULL); /* no upload */
}
else {
@ -304,7 +260,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
if(ppath[i] == ':')
ppath[i] = ' ';
}
result = sendf(sockfd, data,
result = Curl_sendf(sockfd, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"%s\r\n"
"QUIT\r\n", ppath);
@ -313,7 +269,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
return result;
}
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL);
}
}

View File

@ -7,11 +7,11 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
@ -20,8 +20,6 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifndef CURL_DISABLE_DICT

View File

@ -1,982 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2018 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#ifndef CURL_DISABLE_DOH
#include "urldata.h"
#include "curl_addrinfo.h"
#include "doh.h"
#include "sendf.h"
#include "multiif.h"
#include "url.h"
#include "share.h"
#include "curl_base64.h"
#include "connect.h"
#include "strdup.h"
#include "dynbuf.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
#define DNS_CLASS_IN 0x01
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char * const errors[]={
"",
"Bad label",
"Out of range",
"Label loop",
"Too small",
"Out of memory",
"RDATA length",
"Malformat",
"Bad RCODE",
"Unexpected TYPE",
"Unexpected CLASS",
"No content",
"Bad ID",
"Name too long"
};
static const char *doh_strerror(DOHcode code)
{
if((code >= DOH_OK) && (code <= DOH_DNS_NAME_TOO_LONG))
return errors[code];
return "bad error code";
}
#endif
/* @unittest 1655
*/
UNITTEST DOHcode doh_encode(const char *host,
DNStype dnstype,
unsigned char *dnsp, /* buffer */
size_t len, /* buffer size */
size_t *olen) /* output length */
{
const size_t hostlen = strlen(host);
unsigned char *orig = dnsp;
const char *hostp = host;
/* The expected output length is 16 bytes more than the length of
* the QNAME-encoding of the host name.
*
* A valid DNS name may not contain a zero-length label, except at
* the end. For this reason, a name beginning with a dot, or
* containing a sequence of two or more consecutive dots, is invalid
* and cannot be encoded as a QNAME.
*
* If the host name ends with a trailing dot, the corresponding
* QNAME-encoding is one byte longer than the host name. If (as is
* also valid) the hostname is shortened by the omission of the
* trailing dot, then its QNAME-encoding will be two bytes longer
* than the host name.
*
* Each [ label, dot ] pair is encoded as [ length, label ],
* preserving overall length. A final [ label ] without a dot is
* also encoded as [ length, label ], increasing overall length
* by one. The encoding is completed by appending a zero byte,
* representing the zero-length root label, again increasing
* the overall length by one.
*/
size_t expected_len;
DEBUGASSERT(hostlen);
expected_len = 12 + 1 + hostlen + 4;
if(host[hostlen-1]!='.')
expected_len++;
if(expected_len > (256 + 16)) /* RFCs 1034, 1035 */
return DOH_DNS_NAME_TOO_LONG;
if(len < expected_len)
return DOH_TOO_SMALL_BUFFER;
*dnsp++ = 0; /* 16 bit id */
*dnsp++ = 0;
*dnsp++ = 0x01; /* |QR| Opcode |AA|TC|RD| Set the RD bit */
*dnsp++ = '\0'; /* |RA| Z | RCODE | */
*dnsp++ = '\0';
*dnsp++ = 1; /* QDCOUNT (number of entries in the question section) */
*dnsp++ = '\0';
*dnsp++ = '\0'; /* ANCOUNT */
*dnsp++ = '\0';
*dnsp++ = '\0'; /* NSCOUNT */
*dnsp++ = '\0';
*dnsp++ = '\0'; /* ARCOUNT */
/* encode each label and store it in the QNAME */
while(*hostp) {
size_t labellen;
char *dot = strchr(hostp, '.');
if(dot)
labellen = dot - hostp;
else
labellen = strlen(hostp);
if((labellen > 63) || (!labellen)) {
/* label is too long or too short, error out */
*olen = 0;
return DOH_DNS_BAD_LABEL;
}
/* label is non-empty, process it */
*dnsp++ = (unsigned char)labellen;
memcpy(dnsp, hostp, labellen);
dnsp += labellen;
hostp += labellen;
/* advance past dot, but only if there is one */
if(dot)
hostp++;
} /* next label */
*dnsp++ = 0; /* append zero-length label for root */
/* There are assigned TYPE codes beyond 255: use range [1..65535] */
*dnsp++ = (unsigned char)(255 & (dnstype>>8)); /* upper 8 bit TYPE */
*dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */
*dnsp++ = '\0'; /* upper 8 bit CLASS */
*dnsp++ = DNS_CLASS_IN; /* IN - "the Internet" */
*olen = dnsp - orig;
/* verify that our estimation of length is valid, since
* this has led to buffer overflows in this function */
DEBUGASSERT(*olen == expected_len);
return DOH_OK;
}
static size_t
doh_write_cb(const void *contents, size_t size, size_t nmemb, void *userp)
{
size_t realsize = size * nmemb;
struct dynbuf *mem = (struct dynbuf *)userp;
if(Curl_dyn_addn(mem, contents, realsize))
return 0;
return realsize;
}
/* called from multi.c when this DoH transfer is complete */
static int doh_done(struct Curl_easy *doh, CURLcode result)
{
struct Curl_easy *data = doh->set.dohfor;
struct dohdata *dohp = data->req.doh;
/* so one of the DoH request done for the 'data' transfer is now complete! */
dohp->pending--;
infof(data, "a DoH request is completed, %u to go", dohp->pending);
if(result)
infof(data, "DoH request %s", curl_easy_strerror(result));
if(!dohp->pending) {
/* DoH completed */
curl_slist_free_all(dohp->headers);
dohp->headers = NULL;
Curl_expire(data, 0, EXPIRE_RUN_NOW);
}
return 0;
}
#define ERROR_CHECK_SETOPT(x,y) \
do { \
result = curl_easy_setopt(doh, x, y); \
if(result && \
result != CURLE_NOT_BUILT_IN && \
result != CURLE_UNKNOWN_OPTION) \
goto error; \
} while(0)
static CURLcode dohprobe(struct Curl_easy *data,
struct dnsprobe *p, DNStype dnstype,
const char *host,
const char *url, CURLM *multi,
struct curl_slist *headers)
{
struct Curl_easy *doh = NULL;
char *nurl = NULL;
CURLcode result = CURLE_OK;
timediff_t timeout_ms;
DOHcode d = doh_encode(host, dnstype, p->dohbuffer, sizeof(p->dohbuffer),
&p->dohlen);
if(d) {
failf(data, "Failed to encode DoH packet [%d]", d);
return CURLE_OUT_OF_MEMORY;
}
p->dnstype = dnstype;
Curl_dyn_init(&p->serverdoh, DYN_DOH_RESPONSE);
timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms <= 0) {
result = CURLE_OPERATION_TIMEDOUT;
goto error;
}
/* Curl_open() is the internal version of curl_easy_init() */
result = Curl_open(&doh);
if(!result) {
/* pass in the struct pointer via a local variable to please coverity and
the gcc typecheck helpers */
struct dynbuf *resp = &p->serverdoh;
ERROR_CHECK_SETOPT(CURLOPT_URL, url);
ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https");
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb);
ERROR_CHECK_SETOPT(CURLOPT_WRITEDATA, resp);
ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDS, p->dohbuffer);
ERROR_CHECK_SETOPT(CURLOPT_POSTFIELDSIZE, (long)p->dohlen);
ERROR_CHECK_SETOPT(CURLOPT_HTTPHEADER, headers);
#ifdef USE_HTTP2
ERROR_CHECK_SETOPT(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
#endif
#ifndef CURLDEBUG
/* enforce HTTPS if not debug */
ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
#else
/* in debug mode, also allow http */
ERROR_CHECK_SETOPT(CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
#endif
ERROR_CHECK_SETOPT(CURLOPT_TIMEOUT_MS, (long)timeout_ms);
ERROR_CHECK_SETOPT(CURLOPT_SHARE, data->share);
if(data->set.err && data->set.err != stderr)
ERROR_CHECK_SETOPT(CURLOPT_STDERR, data->set.err);
if(data->set.verbose)
ERROR_CHECK_SETOPT(CURLOPT_VERBOSE, 1L);
if(data->set.no_signal)
ERROR_CHECK_SETOPT(CURLOPT_NOSIGNAL, 1L);
ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYHOST,
data->set.doh_verifyhost ? 2L : 0L);
ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYPEER,
data->set.doh_verifypeer ? 1L : 0L);
ERROR_CHECK_SETOPT(CURLOPT_SSL_VERIFYSTATUS,
data->set.doh_verifystatus ? 1L : 0L);
/* Inherit *some* SSL options from the user's transfer. This is a
best-guess as to which options are needed for compatibility. #3661
Note DoH does not inherit the user's proxy server so proxy SSL settings
have no effect and are not inherited. If that changes then two new
options should be added to check doh proxy insecure separately,
CURLOPT_DOH_PROXY_SSL_VERIFYHOST and CURLOPT_DOH_PROXY_SSL_VERIFYPEER.
*/
if(data->set.ssl.falsestart)
ERROR_CHECK_SETOPT(CURLOPT_SSL_FALSESTART, 1L);
if(data->set.str[STRING_SSL_CAFILE]) {
ERROR_CHECK_SETOPT(CURLOPT_CAINFO,
data->set.str[STRING_SSL_CAFILE]);
}
if(data->set.blobs[BLOB_CAINFO]) {
ERROR_CHECK_SETOPT(CURLOPT_CAINFO_BLOB,
data->set.blobs[BLOB_CAINFO]);
}
if(data->set.str[STRING_SSL_CAPATH]) {
ERROR_CHECK_SETOPT(CURLOPT_CAPATH,
data->set.str[STRING_SSL_CAPATH]);
}
if(data->set.str[STRING_SSL_CRLFILE]) {
ERROR_CHECK_SETOPT(CURLOPT_CRLFILE,
data->set.str[STRING_SSL_CRLFILE]);
}
if(data->set.ssl.certinfo)
ERROR_CHECK_SETOPT(CURLOPT_CERTINFO, 1L);
if(data->set.ssl.fsslctx)
ERROR_CHECK_SETOPT(CURLOPT_SSL_CTX_FUNCTION, data->set.ssl.fsslctx);
if(data->set.ssl.fsslctxp)
ERROR_CHECK_SETOPT(CURLOPT_SSL_CTX_DATA, data->set.ssl.fsslctxp);
if(data->set.str[STRING_SSL_EC_CURVES]) {
ERROR_CHECK_SETOPT(CURLOPT_SSL_EC_CURVES,
data->set.str[STRING_SSL_EC_CURVES]);
}
{
long mask =
(data->set.ssl.enable_beast ?
CURLSSLOPT_ALLOW_BEAST : 0) |
(data->set.ssl.no_revoke ?
CURLSSLOPT_NO_REVOKE : 0) |
(data->set.ssl.no_partialchain ?
CURLSSLOPT_NO_PARTIALCHAIN : 0) |
(data->set.ssl.revoke_best_effort ?
CURLSSLOPT_REVOKE_BEST_EFFORT : 0) |
(data->set.ssl.native_ca_store ?
CURLSSLOPT_NATIVE_CA : 0) |
(data->set.ssl.auto_client_cert ?
CURLSSLOPT_AUTO_CLIENT_CERT : 0);
(void)curl_easy_setopt(doh, CURLOPT_SSL_OPTIONS, mask);
}
doh->set.fmultidone = doh_done;
doh->set.dohfor = data; /* identify for which transfer this is done */
p->easy = doh;
/* DoH private_data must be null because the user must have a way to
distinguish their transfer's handle from DoH handles in user
callbacks (ie SSL CTX callback). */
DEBUGASSERT(!doh->set.private_data);
if(curl_multi_add_handle(multi, doh))
goto error;
}
else
goto error;
free(nurl);
return CURLE_OK;
error:
free(nurl);
Curl_close(&doh);
return result;
}
/*
* Curl_doh() resolves a name using DoH. It resolves a name and returns a
* 'Curl_addrinfo *' with the address information.
*/
struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
const char *hostname,
int port,
int *waitp)
{
CURLcode result = CURLE_OK;
int slot;
struct dohdata *dohp;
struct connectdata *conn = data->conn;
*waitp = TRUE; /* this never returns synchronously */
(void)hostname;
(void)port;
DEBUGASSERT(!data->req.doh);
DEBUGASSERT(conn);
/* start clean, consider allocating this struct on demand */
dohp = data->req.doh = calloc(sizeof(struct dohdata), 1);
if(!dohp)
return NULL;
conn->bits.doh = TRUE;
dohp->host = hostname;
dohp->port = port;
dohp->headers =
curl_slist_append(NULL,
"Content-Type: application/dns-message");
if(!dohp->headers)
goto error;
/* create IPv4 DoH request */
result = dohprobe(data, &dohp->probe[DOH_PROBE_SLOT_IPADDR_V4],
DNS_TYPE_A, hostname, data->set.str[STRING_DOH],
data->multi, dohp->headers);
if(result)
goto error;
dohp->pending++;
if((conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
/* create IPv6 DoH request */
result = dohprobe(data, &dohp->probe[DOH_PROBE_SLOT_IPADDR_V6],
DNS_TYPE_AAAA, hostname, data->set.str[STRING_DOH],
data->multi, dohp->headers);
if(result)
goto error;
dohp->pending++;
}
return NULL;
error:
curl_slist_free_all(dohp->headers);
data->req.doh->headers = NULL;
for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
Curl_close(&dohp->probe[slot].easy);
}
Curl_safefree(data->req.doh);
return NULL;
}
static DOHcode skipqname(const unsigned char *doh, size_t dohlen,
unsigned int *indexp)
{
unsigned char length;
do {
if(dohlen < (*indexp + 1))
return DOH_DNS_OUT_OF_RANGE;
length = doh[*indexp];
if((length & 0xc0) == 0xc0) {
/* name pointer, advance over it and be done */
if(dohlen < (*indexp + 2))
return DOH_DNS_OUT_OF_RANGE;
*indexp += 2;
break;
}
if(length & 0xc0)
return DOH_DNS_BAD_LABEL;
if(dohlen < (*indexp + 1 + length))
return DOH_DNS_OUT_OF_RANGE;
*indexp += 1 + length;
} while(length);
return DOH_OK;
}
static unsigned short get16bit(const unsigned char *doh, int index)
{
return (unsigned short)((doh[index] << 8) | doh[index + 1]);
}
static unsigned int get32bit(const unsigned char *doh, int index)
{
/* make clang and gcc optimize this to bswap by incrementing
the pointer first. */
doh += index;
/* avoid undefined behavior by casting to unsigned before shifting
24 bits, possibly into the sign bit. codegen is same, but
ub sanitizer won't be upset */
return ( (unsigned)doh[0] << 24) | (doh[1] << 16) |(doh[2] << 8) | doh[3];
}
static DOHcode store_a(const unsigned char *doh, int index, struct dohentry *d)
{
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
struct dohaddr *a = &d->addr[d->numaddr];
a->type = DNS_TYPE_A;
memcpy(&a->ip.v4, &doh[index], 4);
d->numaddr++;
}
return DOH_OK;
}
static DOHcode store_aaaa(const unsigned char *doh,
int index,
struct dohentry *d)
{
/* silently ignore addresses over the limit */
if(d->numaddr < DOH_MAX_ADDR) {
struct dohaddr *a = &d->addr[d->numaddr];
a->type = DNS_TYPE_AAAA;
memcpy(&a->ip.v6, &doh[index], 16);
d->numaddr++;
}
return DOH_OK;
}
static DOHcode store_cname(const unsigned char *doh,
size_t dohlen,
unsigned int index,
struct dohentry *d)
{
struct dynbuf *c;
unsigned int loop = 128; /* a valid DNS name can never loop this much */
unsigned char length;
if(d->numcname == DOH_MAX_CNAME)
return DOH_OK; /* skip! */
c = &d->cname[d->numcname++];
do {
if(index >= dohlen)
return DOH_DNS_OUT_OF_RANGE;
length = doh[index];
if((length & 0xc0) == 0xc0) {
int newpos;
/* name pointer, get the new offset (14 bits) */
if((index + 1) >= dohlen)
return DOH_DNS_OUT_OF_RANGE;
/* move to the new index */
newpos = (length & 0x3f) << 8 | doh[index + 1];
index = newpos;
continue;
}
else if(length & 0xc0)
return DOH_DNS_BAD_LABEL; /* bad input */
else
index++;
if(length) {
if(Curl_dyn_len(c)) {
if(Curl_dyn_addn(c, STRCONST(".")))
return DOH_OUT_OF_MEM;
}
if((index + length) > dohlen)
return DOH_DNS_BAD_LABEL;
if(Curl_dyn_addn(c, &doh[index], length))
return DOH_OUT_OF_MEM;
index += length;
}
} while(length && --loop);
if(!loop)
return DOH_DNS_LABEL_LOOP;
return DOH_OK;
}
static DOHcode rdata(const unsigned char *doh,
size_t dohlen,
unsigned short rdlength,
unsigned short type,
int index,
struct dohentry *d)
{
/* RDATA
- A (TYPE 1): 4 bytes
- AAAA (TYPE 28): 16 bytes
- NS (TYPE 2): N bytes */
DOHcode rc;
switch(type) {
case DNS_TYPE_A:
if(rdlength != 4)
return DOH_DNS_RDATA_LEN;
rc = store_a(doh, index, d);
if(rc)
return rc;
break;
case DNS_TYPE_AAAA:
if(rdlength != 16)
return DOH_DNS_RDATA_LEN;
rc = store_aaaa(doh, index, d);
if(rc)
return rc;
break;
case DNS_TYPE_CNAME:
rc = store_cname(doh, dohlen, index, d);
if(rc)
return rc;
break;
case DNS_TYPE_DNAME:
/* explicit for clarity; just skip; rely on synthesized CNAME */
break;
default:
/* unsupported type, just skip it */
break;
}
return DOH_OK;
}
UNITTEST void de_init(struct dohentry *de)
{
int i;
memset(de, 0, sizeof(*de));
de->ttl = INT_MAX;
for(i = 0; i < DOH_MAX_CNAME; i++)
Curl_dyn_init(&de->cname[i], DYN_DOH_CNAME);
}
UNITTEST DOHcode doh_decode(const unsigned char *doh,
size_t dohlen,
DNStype dnstype,
struct dohentry *d)
{
unsigned char rcode;
unsigned short qdcount;
unsigned short ancount;
unsigned short type = 0;
unsigned short rdlength;
unsigned short nscount;
unsigned short arcount;
unsigned int index = 12;
DOHcode rc;
if(dohlen < 12)
return DOH_TOO_SMALL_BUFFER; /* too small */
if(!doh || doh[0] || doh[1])
return DOH_DNS_BAD_ID; /* bad ID */
rcode = doh[3] & 0x0f;
if(rcode)
return DOH_DNS_BAD_RCODE; /* bad rcode */
qdcount = get16bit(doh, 4);
while(qdcount) {
rc = skipqname(doh, dohlen, &index);
if(rc)
return rc; /* bad qname */
if(dohlen < (index + 4))
return DOH_DNS_OUT_OF_RANGE;
index += 4; /* skip question's type and class */
qdcount--;
}
ancount = get16bit(doh, 6);
while(ancount) {
unsigned short class;
unsigned int ttl;
rc = skipqname(doh, dohlen, &index);
if(rc)
return rc; /* bad qname */
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
type = get16bit(doh, index);
if((type != DNS_TYPE_CNAME) /* may be synthesized from DNAME */
&& (type != DNS_TYPE_DNAME) /* if present, accept and ignore */
&& (type != dnstype))
/* Not the same type as was asked for nor CNAME nor DNAME */
return DOH_DNS_UNEXPECTED_TYPE;
index += 2;
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
class = get16bit(doh, index);
if(DNS_CLASS_IN != class)
return DOH_DNS_UNEXPECTED_CLASS; /* unsupported */
index += 2;
if(dohlen < (index + 4))
return DOH_DNS_OUT_OF_RANGE;
ttl = get32bit(doh, index);
if(ttl < d->ttl)
d->ttl = ttl;
index += 4;
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
rdlength = get16bit(doh, index);
index += 2;
if(dohlen < (index + rdlength))
return DOH_DNS_OUT_OF_RANGE;
rc = rdata(doh, dohlen, rdlength, type, index, d);
if(rc)
return rc; /* bad rdata */
index += rdlength;
ancount--;
}
nscount = get16bit(doh, 8);
while(nscount) {
rc = skipqname(doh, dohlen, &index);
if(rc)
return rc; /* bad qname */
if(dohlen < (index + 8))
return DOH_DNS_OUT_OF_RANGE;
index += 2 + 2 + 4; /* type, class and ttl */
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
rdlength = get16bit(doh, index);
index += 2;
if(dohlen < (index + rdlength))
return DOH_DNS_OUT_OF_RANGE;
index += rdlength;
nscount--;
}
arcount = get16bit(doh, 10);
while(arcount) {
rc = skipqname(doh, dohlen, &index);
if(rc)
return rc; /* bad qname */
if(dohlen < (index + 8))
return DOH_DNS_OUT_OF_RANGE;
index += 2 + 2 + 4; /* type, class and ttl */
if(dohlen < (index + 2))
return DOH_DNS_OUT_OF_RANGE;
rdlength = get16bit(doh, index);
index += 2;
if(dohlen < (index + rdlength))
return DOH_DNS_OUT_OF_RANGE;
index += rdlength;
arcount--;
}
if(index != dohlen)
return DOH_DNS_MALFORMAT; /* something is wrong */
if((type != DNS_TYPE_NS) && !d->numcname && !d->numaddr)
/* nothing stored! */
return DOH_NO_CONTENT;
return DOH_OK; /* ok */
}
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void showdoh(struct Curl_easy *data,
const struct dohentry *d)
{
int i;
infof(data, "TTL: %u seconds", d->ttl);
for(i = 0; i < d->numaddr; i++) {
const struct dohaddr *a = &d->addr[i];
if(a->type == DNS_TYPE_A) {
infof(data, "DoH A: %u.%u.%u.%u",
a->ip.v4[0], a->ip.v4[1],
a->ip.v4[2], a->ip.v4[3]);
}
else if(a->type == DNS_TYPE_AAAA) {
int j;
char buffer[128];
char *ptr;
size_t len;
msnprintf(buffer, 128, "DoH AAAA: ");
ptr = &buffer[10];
len = 118;
for(j = 0; j < 16; j += 2) {
size_t l;
msnprintf(ptr, len, "%s%02x%02x", j?":":"", d->addr[i].ip.v6[j],
d->addr[i].ip.v6[j + 1]);
l = strlen(ptr);
len -= l;
ptr += l;
}
infof(data, "%s", buffer);
}
}
for(i = 0; i < d->numcname; i++) {
infof(data, "CNAME: %s", Curl_dyn_ptr(&d->cname[i]));
}
}
#else
#define showdoh(x,y)
#endif
/*
* doh2ai()
*
* This function returns a pointer to the first element of a newly allocated
* Curl_addrinfo struct linked list filled with the data from a set of DoH
* lookups. Curl_addrinfo is meant to work like the addrinfo struct does for
* a IPv6 stack, but usable also for IPv4, all hosts and environments.
*
* The memory allocated by this function *MUST* be free'd later on calling
* Curl_freeaddrinfo(). For each successful call to this function there
* must be an associated call later to Curl_freeaddrinfo().
*/
static struct Curl_addrinfo *
doh2ai(const struct dohentry *de, const char *hostname, int port)
{
struct Curl_addrinfo *ai;
struct Curl_addrinfo *prevai = NULL;
struct Curl_addrinfo *firstai = NULL;
struct sockaddr_in *addr;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *addr6;
#endif
CURLcode result = CURLE_OK;
int i;
size_t hostlen = strlen(hostname) + 1; /* include null-terminator */
if(!de)
/* no input == no output! */
return NULL;
for(i = 0; i < de->numaddr; i++) {
size_t ss_size;
CURL_SA_FAMILY_T addrtype;
if(de->addr[i].type == DNS_TYPE_AAAA) {
#ifndef ENABLE_IPV6
/* we can't handle IPv6 addresses */
continue;
#else
ss_size = sizeof(struct sockaddr_in6);
addrtype = AF_INET6;
#endif
}
else {
ss_size = sizeof(struct sockaddr_in);
addrtype = AF_INET;
}
ai = calloc(1, sizeof(struct Curl_addrinfo) + ss_size + hostlen);
if(!ai) {
result = CURLE_OUT_OF_MEMORY;
break;
}
ai->ai_addr = (void *)((char *)ai + sizeof(struct Curl_addrinfo));
ai->ai_canonname = (void *)((char *)ai->ai_addr + ss_size);
memcpy(ai->ai_canonname, hostname, hostlen);
if(!firstai)
/* store the pointer we want to return from this function */
firstai = ai;
if(prevai)
/* make the previous entry point to this */
prevai->ai_next = ai;
ai->ai_family = addrtype;
/* we return all names as STREAM, so when using this address for TFTP
the type must be ignored and conn->socktype be used instead! */
ai->ai_socktype = SOCK_STREAM;
ai->ai_addrlen = (curl_socklen_t)ss_size;
/* leave the rest of the struct filled with zero */
switch(ai->ai_family) {
case AF_INET:
addr = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in_addr) == sizeof(de->addr[i].ip.v4));
memcpy(&addr->sin_addr, &de->addr[i].ip.v4, sizeof(struct in_addr));
addr->sin_family = addrtype;
addr->sin_port = htons((unsigned short)port);
break;
#ifdef ENABLE_IPV6
case AF_INET6:
addr6 = (void *)ai->ai_addr; /* storage area for this info */
DEBUGASSERT(sizeof(struct in6_addr) == sizeof(de->addr[i].ip.v6));
memcpy(&addr6->sin6_addr, &de->addr[i].ip.v6, sizeof(struct in6_addr));
addr6->sin6_family = addrtype;
addr6->sin6_port = htons((unsigned short)port);
break;
#endif
}
prevai = ai;
}
if(result) {
Curl_freeaddrinfo(firstai);
firstai = NULL;
}
return firstai;
}
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static const char *type2name(DNStype dnstype)
{
return (dnstype == DNS_TYPE_A)?"A":"AAAA";
}
#endif
UNITTEST void de_cleanup(struct dohentry *d)
{
int i = 0;
for(i = 0; i < d->numcname; i++) {
Curl_dyn_free(&d->cname[i]);
}
}
CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry **dnsp)
{
CURLcode result;
struct dohdata *dohp = data->req.doh;
*dnsp = NULL; /* defaults to no response */
if(!dohp)
return CURLE_OUT_OF_MEMORY;
if(!dohp->probe[DOH_PROBE_SLOT_IPADDR_V4].easy &&
!dohp->probe[DOH_PROBE_SLOT_IPADDR_V6].easy) {
failf(data, "Could not DoH-resolve: %s", data->state.async.hostname);
return CONN_IS_PROXIED(data->conn)?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
else if(!dohp->pending) {
DOHcode rc[DOH_PROBE_SLOTS] = {
DOH_OK, DOH_OK
};
struct dohentry de;
int slot;
/* remove DoH handles from multi handle and close them */
for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
curl_multi_remove_handle(data->multi, dohp->probe[slot].easy);
Curl_close(&dohp->probe[slot].easy);
}
/* parse the responses, create the struct and return it! */
de_init(&de);
for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
struct dnsprobe *p = &dohp->probe[slot];
if(!p->dnstype)
continue;
rc[slot] = doh_decode(Curl_dyn_uptr(&p->serverdoh),
Curl_dyn_len(&p->serverdoh),
p->dnstype,
&de);
Curl_dyn_free(&p->serverdoh);
if(rc[slot]) {
infof(data, "DoH: %s type %s for %s", doh_strerror(rc[slot]),
type2name(p->dnstype), dohp->host);
}
} /* next slot */
result = CURLE_COULDNT_RESOLVE_HOST; /* until we know better */
if(!rc[DOH_PROBE_SLOT_IPADDR_V4] || !rc[DOH_PROBE_SLOT_IPADDR_V6]) {
/* we have an address, of one kind or other */
struct Curl_dns_entry *dns;
struct Curl_addrinfo *ai;
infof(data, "DoH Host name: %s", dohp->host);
showdoh(data, &de);
ai = doh2ai(&de, dohp->host, dohp->port);
if(!ai) {
de_cleanup(&de);
return CURLE_OUT_OF_MEMORY;
}
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
/* we got a response, store it in the cache */
dns = Curl_cache_addr(data, ai, dohp->host, dohp->port);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
if(!dns) {
/* returned failure, bail out nicely */
Curl_freeaddrinfo(ai);
}
else {
data->state.async.dns = dns;
*dnsp = dns;
result = CURLE_OK; /* address resolution OK */
}
} /* address processing done */
/* Now process any build-specific attributes retrieved from DNS */
/* All done */
de_cleanup(&de);
Curl_safefree(data->req.doh);
return result;
} /* !dohp->pending */
/* else wait for pending DoH transactions to complete */
return CURLE_OK;
}
#endif /* CURL_DISABLE_DOH */

View File

@ -1,128 +0,0 @@
#ifndef HEADER_CURL_DOH_H
#define HEADER_CURL_DOH_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2018 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "urldata.h"
#include "curl_addrinfo.h"
#ifndef CURL_DISABLE_DOH
typedef enum {
DOH_OK,
DOH_DNS_BAD_LABEL, /* 1 */
DOH_DNS_OUT_OF_RANGE, /* 2 */
DOH_DNS_LABEL_LOOP, /* 3 */
DOH_TOO_SMALL_BUFFER, /* 4 */
DOH_OUT_OF_MEM, /* 5 */
DOH_DNS_RDATA_LEN, /* 6 */
DOH_DNS_MALFORMAT, /* 7 */
DOH_DNS_BAD_RCODE, /* 8 - no such name */
DOH_DNS_UNEXPECTED_TYPE, /* 9 */
DOH_DNS_UNEXPECTED_CLASS, /* 10 */
DOH_NO_CONTENT, /* 11 */
DOH_DNS_BAD_ID, /* 12 */
DOH_DNS_NAME_TOO_LONG /* 13 */
} DOHcode;
typedef enum {
DNS_TYPE_A = 1,
DNS_TYPE_NS = 2,
DNS_TYPE_CNAME = 5,
DNS_TYPE_AAAA = 28,
DNS_TYPE_DNAME = 39 /* RFC6672 */
} DNStype;
/* one of these for each DoH request */
struct dnsprobe {
CURL *easy;
DNStype dnstype;
unsigned char dohbuffer[512];
size_t dohlen;
struct dynbuf serverdoh;
};
struct dohdata {
struct curl_slist *headers;
struct dnsprobe probe[DOH_PROBE_SLOTS];
unsigned int pending; /* still outstanding requests */
int port;
const char *host;
};
/*
* Curl_doh() resolve a name using DoH (DNS-over-HTTPS). It resolves a name
* and returns a 'Curl_addrinfo *' with the address information.
*/
struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
const char *hostname,
int port,
int *waitp);
CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry **dns);
int Curl_doh_getsock(struct connectdata *conn, curl_socket_t *socks);
#define DOH_MAX_ADDR 24
#define DOH_MAX_CNAME 4
struct dohaddr {
int type;
union {
unsigned char v4[4]; /* network byte order */
unsigned char v6[16];
} ip;
};
struct dohentry {
struct dynbuf cname[DOH_MAX_CNAME];
struct dohaddr addr[DOH_MAX_ADDR];
int numaddr;
unsigned int ttl;
int numcname;
};
#ifdef DEBUGBUILD
DOHcode doh_encode(const char *host,
DNStype dnstype,
unsigned char *dnsp, /* buffer */
size_t len, /* buffer size */
size_t *olen); /* output length */
DOHcode doh_decode(const unsigned char *doh,
size_t dohlen,
DNStype dnstype,
struct dohentry *d);
void de_init(struct dohentry *d);
void de_cleanup(struct dohentry *d);
#endif
#else /* if DoH is disabled */
#define Curl_doh(a,b,c,d) NULL
#define Curl_doh_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
#endif
#endif /* HEADER_CURL_DOH_H */

Some files were not shown because too many files have changed in this diff Show More