Update Apache Serf to 1.3.9 to make it buildable with OpenSSL 1.1.1.

This commit is contained in:
Jung-uk Kim 2018-09-19 06:49:55 +00:00
parent b7aeb266b0
commit 3d32dc633c
47 changed files with 911 additions and 556 deletions

View File

@ -1,7 +1,26 @@
Serf 1.3.8 [2014-10-20, from /tags/1.3.8, rxxxx]
Fix issue #152: CRC calculation error for gzipped http reponses > 4GB.
Fix issue #153: SSPI CredHandle not freed when APR pool is destroyed.
Fix issue #154: Disable SSLv2 and SSLv3 as both or broken.
Apache Serf 1.3.9 [2016-09-01, from tags/1.3.9, rxxxx]
serf is now Apache Serf; apply header changes (r1700062)
Fix issue #151: SCons build broken when only one library in ENVPATH
Fix issue #153: avoid SSPI handle leak
Fix issue #167: Explicitly use the ANSI version of SSPI
Fix issue #170: Allow building with Microsoft Visual Studio 2015
Fix build of 'check' target when using VPATH-style builds (r1699858, ...)
(builddir != srcdir).
Resolve a bucket (aka "memory") leak when a request bucket is
destroyed before it is morphed into an aggregate bucket (r1699791)
Reset state variables when resetting connection (r1708849)
Fix types of passed, but unused batons (r1699986, r1699987)
Fix some usages of the openssl BIO api (r1699852)
Improve handling of bad data in the response state line. (r1699985)
Resolve several compiler issues with less common compilers
Support more overrides via SCons arguments (r1701836, ...)
Adapt to OpenSSL 1.1.x api (r1750819)
Serf 1.3.8 [2014-10-20, from /tags/1.3.8, r2441]
Fix issue #152: CRC calculation error for gzipped http reponses > 4GB.
Fix issue #153: SSPI CredHandle not freed when APR pool is destroyed.
Fix issue #154: Disable SSLv2 and SSLv3 as both or broken.
Serf 1.3.7 [2014-08-11, from /tags/1.3.7, r2411]

View File

@ -1,2 +1,7 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Apache Serf
Copyright 2015 The Apache Software Foundation
This product includes software developed by many people, and distributed
under Contributor License Agreements to The Apache Software Foundation
(http://www.apache.org/). See the revision logs for an exact contribution
history.

View File

@ -1,15 +1,14 @@
Welcome to serf, a high-performance asynchronous HTTP client library.
Welcome to Apache Serf, a high-performance asynchronous HTTP client library.
The serf library is a C-based HTTP client library built upon the Apache
The Apache Serf library is a C-based HTTP client library built upon the Apache
Portable Runtime (APR) library. It multiplexes connections, running the
read/write communication asynchronously. Memory copies and transformations are
kept to a minimum to provide high performance operation.
* Status: http://code.google.com/p/serf/wiki/
* Site: http://code.google.com/p/serf/
* Code: http://serf.googlecode.com/svn/
* Issues: http://code.google.com/p/serf/issues/list
* Mail: serf-dev@googlegroups.com
* Site: http://serf.apache.org//
* Code: http://svn.apache.org/repos/asf/serf/
* Issues: https://issues.apache.org/jira/browse/SERF
* Mail: dev@serf.apache.org
* People: Justin Erenkrantz, Greg Stein
----
@ -18,8 +17,8 @@ kept to a minimum to provide high performance operation.
1.1. SCons build system
serf uses SCons 2.3 for its build system. If it is not installed on
your system, then you can install it onto your system. If you do not
Apache Serf uses SCons 2.3 for its build system. If it is not installed
on your system, then you can install it onto your system. If you do not
have permissions, then you can download and install the "local"
version into your home directory. When installed privately, simply
create a symlink for 'scons' in your PATH to /path/to/scons/scons.py.
@ -28,7 +27,7 @@ Fetch the scons-local package:
http://prdownloads.sourceforge.net/scons/scons-local-2.3.0.tar.gz
1.2 Building serf
1.2 Building Apache Serf
To build serf:
@ -70,7 +69,7 @@ $ scons --help
$ scons check
1.4 Installing serf
1.4 Installing Apache Serf
$ scons install

View File

@ -1,18 +1,23 @@
# -*- python -*-
#
# Copyright 2011-2012 Justin Erenkrantz and Greg Stein
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ====================================================================
#
import sys
@ -135,7 +140,8 @@ if sys.platform == 'win32':
EnumVariable('MSVC_VERSION',
"Visual C++ to use for building (E.g. 11.0, 9.0)",
None,
allowed_values=('12.0', '11.0', '10.0', '9.0', '8.0', '6.0')
allowed_values=('14.0', '12.0',
'11.0', '10.0', '9.0', '8.0', '6.0')
),
# We always documented that we handle an install layout, but in fact we
@ -177,8 +183,7 @@ CALLOUT_OKAY = not (env.GetOption('clean') or env.GetOption('help'))
unknown = opts.UnknownVariables()
if unknown:
print 'Unknown variables:', ', '.join(unknown.keys())
Exit(1)
print 'Warning: Used unknown variables:', ', '.join(unknown.keys())
apr = str(env['APR'])
apu = str(env['APU'])
@ -210,7 +215,8 @@ incdir = '$PREFIX/include/serf-$MAJOR'
# Unfortunately we can't set the .dylib compatibility_version option separately
# from current_version, so don't use the PATCH level to avoid that build and
# runtime patch levels have to be identical.
env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
if sys.platform != 'sunos5':
env['SHLIBVERSION'] = '%d.%d.%d' % (MAJOR, MINOR, 0)
LIBNAME = 'libserf-%d' % (MAJOR,)
if sys.platform != 'win32':
@ -223,31 +229,43 @@ env.Append(RPATH=libdir,
if sys.platform == 'darwin':
# linkflags.append('-Wl,-install_name,@executable_path/%s.dylib' % (LIBNAME,))
env.Append(LINKFLAGS='-Wl,-install_name,%s/%s.dylib' % (thisdir, LIBNAME,))
env.Append(LINKFLAGS=['-Wl,-install_name,%s/%s.dylib' % (thisdir, LIBNAME,)])
if sys.platform != 'win32':
### gcc only. figure out appropriate test / better way to check these
### flags, and check for gcc.
env.Append(CFLAGS='-std=c89')
def CheckGnuCC(context):
src = '''
#ifndef __GNUC__
oh noes!
#endif
'''
context.Message('Checking for GNU-compatible C compiler...')
result = context.TryCompile(src, '.c')
context.Result(result)
return result
### These warnings are not available on Solaris
if sys.platform != 'sunos5':
conf = Configure(env, custom_tests = dict(CheckGnuCC=CheckGnuCC))
have_gcc = conf.CheckGnuCC()
env = conf.Finish()
if have_gcc:
env.Append(CFLAGS=['-std=c89'])
env.Append(CCFLAGS=['-Wdeclaration-after-statement',
'-Wmissing-prototypes',
'-Wall'])
if debug:
env.Append(CCFLAGS='-g')
env.Append(CCFLAGS=['-g'])
env.Append(CPPDEFINES=['DEBUG', '_DEBUG'])
else:
env.Append(CCFLAGS='-O2')
env.Append(CPPDEFINES='NDEBUG')
env.Append(CCFLAGS=['-O2'])
env.Append(CPPDEFINES=['NDEBUG'])
### works for Mac OS. probably needs to change
env.Append(LIBS=['ssl', 'crypto', 'z', ])
if sys.platform == 'sunos5':
env.Append(LIBS='m')
env.Append(LIBS=['m'])
env.Append(PLATFORM='posix')
else:
# Warning level 4, no unused argument warnings
env.Append(CCFLAGS=['/W4', '/wd4100'])
@ -260,8 +278,8 @@ else:
else:
# Optimize for speed, use DLL runtime
env.Append(CCFLAGS=['/O2', '/MD'])
env.Append(CPPDEFINES='NDEBUG')
env.Append(LINKFLAGS='/RELEASE')
env.Append(CPPDEFINES=['NDEBUG'])
env.Append(LINKFLAGS=['/RELEASE'])
# PLAN THE BUILD
SHARED_SOURCES = []
@ -291,6 +309,7 @@ if sys.platform == 'win32':
if aprstatic:
apr_libs='apr-1.lib'
apu_libs='aprutil-1.lib'
env.Append(LIBS=['shell32.lib', 'xml.lib'])
else:
apr_libs='libapr-1.lib'
apu_libs='libaprutil-1.lib'
@ -307,25 +326,25 @@ if sys.platform == 'win32':
CPPPATH=['$APR/include', '$APU/include'])
# zlib
env.Append(LIBS='zlib.lib')
env.Append(LIBS=['zlib.lib'])
if not env.get('SOURCE_LAYOUT', None):
env.Append(CPPPATH='$ZLIB/include',
LIBPATH='$ZLIB/lib')
env.Append(CPPPATH=['$ZLIB/include'],
LIBPATH=['$ZLIB/lib'])
else:
env.Append(CPPPATH='$ZLIB',
LIBPATH='$ZLIB')
env.Append(CPPPATH=['$ZLIB'],
LIBPATH=['$ZLIB'])
# openssl
env.Append(LIBS=['libeay32.lib', 'ssleay32.lib'])
if not env.get('SOURCE_LAYOUT', None):
env.Append(CPPPATH='$OPENSSL/include/openssl',
LIBPATH='$OPENSSL/lib')
env.Append(CPPPATH=['$OPENSSL/include/openssl'],
LIBPATH=['$OPENSSL/lib'])
elif 0: # opensslstatic:
env.Append(CPPPATH='$OPENSSL/inc32',
LIBPATH='$OPENSSL/out32')
env.Append(CPPPATH=['$OPENSSL/inc32'],
LIBPATH=['$OPENSSL/out32'])
else:
env.Append(CPPPATH='$OPENSSL/inc32',
LIBPATH='$OPENSSL/out32dll')
env.Append(CPPPATH=['$OPENSSL/inc32'],
LIBPATH=['$OPENSSL/out32dll'])
else:
if os.path.isdir(apr):
apr = os.path.join(apr, 'bin', 'apr-1-config')
@ -351,8 +370,8 @@ else:
apr_libs = ''
apu_libs = ''
env.Append(CPPPATH='$OPENSSL/include')
env.Append(LIBPATH='$OPENSSL/lib')
env.Append(CPPPATH=['$OPENSSL/include'])
env.Append(LIBPATH=['$OPENSSL/lib'])
# If build with gssapi, get its information and define SERF_HAVE_GSSAPI
@ -362,7 +381,7 @@ if gssapi and CALLOUT_OKAY:
env['GSSAPI_LIBS'] = cmd.strip()
return env.MergeFlags(cmd, unique)
env.ParseConfig('$GSSAPI --libs gssapi', parse_libs)
env.Append(CPPDEFINES='SERF_HAVE_GSSAPI')
env.Append(CPPDEFINES=['SERF_HAVE_GSSAPI'])
if sys.platform == 'win32':
env.Append(CPPDEFINES=['SERF_HAVE_SSPI'])
@ -428,6 +447,12 @@ env.Alias('install', ['install-lib', 'install-inc', 'install-pc', ])
tenv = env.Clone()
# MockHTTP requires C99 standard, so use it for the test suite.
cflags = tenv['CFLAGS']
tenv.Replace(CFLAGS = [f.replace('-std=c89', '-std=c99') for f in cflags])
tenv.Append(CPPDEFINES=['MOCKHTTP_OPENSSL'])
TEST_PROGRAMS = [ 'serf_get', 'serf_response', 'serf_request', 'serf_spider',
'test_all', 'serf_bwtp' ]
if sys.platform == 'win32':
@ -435,14 +460,23 @@ if sys.platform == 'win32':
else:
TEST_EXES = [ os.path.join('test', '%s' % (prog)) for prog in TEST_PROGRAMS ]
env.AlwaysBuild(env.Alias('check', TEST_EXES, sys.executable + ' build/check.py',
ENV={'PATH' : os.environ['PATH']}))
# Find the (dynamic) library in this directory
tenv.Replace(RPATH=thisdir)
tenv.Prepend(LIBS=[LIBNAMESTATIC, ],
LIBPATH=[thisdir, ])
check_script = env.File('build/check.py').rstr()
test_dir = env.File('test/test_all.c').rfile().get_dir()
src_dir = env.File('serf.h').rfile().get_dir()
test_app = ("%s %s %s %s") % (sys.executable, check_script, test_dir, 'test')
# Set the library search path for the test programs
test_env = {'PATH' : os.environ['PATH'],
'srcdir' : src_dir}
if sys.platform != 'win32':
test_env['LD_LIBRARY_PATH'] = ':'.join(tenv.get('LIBPATH', []))
env.AlwaysBuild(env.Alias('check', TEST_EXES, test_app, ENV=test_env))
testall_files = [
'test/test_all.c',
'test/CuTest.c',

View File

@ -1,16 +1,21 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include "serf.h"

View File

@ -1,16 +1,21 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef AUTH_H

View File

@ -1,16 +1,21 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
/*** Basic authentication ***/

View File

@ -1,16 +1,21 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
/*** Digest authentication ***/

View File

@ -1,18 +1,24 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include "auth_spnego.h"
#ifdef SERF_HAVE_SPNEGO

View File

@ -1,16 +1,21 @@
/* Copyright 2010 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef AUTH_SPNEGO_H

View File

@ -1,16 +1,21 @@
/* Copyright 2009 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include "serf.h"

View File

@ -1,16 +1,21 @@
/* Copyright 2010 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include "auth_spnego.h"
@ -138,7 +143,7 @@ serf__spnego_create_sec_context(serf__spnego_context_t **ctx_p,
else
sspi_package = "NTLM";
sspi_status = AcquireCredentialsHandle(
sspi_status = AcquireCredentialsHandleA(
NULL, sspi_package, SECPKG_CRED_OUTBOUND,
NULL, NULL, NULL, NULL,
&ctx->sspi_credentials, NULL);
@ -247,7 +252,7 @@ serf__spnego_init_sec_context(serf_connection_t *conn,
sspi_out_buffer_desc.pBuffers = &sspi_out_buffer;
sspi_out_buffer_desc.ulVersion = SECBUFFER_VERSION;
status = InitializeSecurityContext(
status = InitializeSecurityContextA(
&ctx->sspi_credentials,
ctx->initalized ? &ctx->sspi_context : NULL,
ctx->target_name,

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include "serf.h"

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <stdlib.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_strings.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_strings.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <stdlib.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2011 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>
@ -190,6 +195,20 @@ static apr_status_t serf_request_peek(serf_bucket_t *bucket,
return serf_bucket_peek(bucket, data, len);
}
/* Note that this function is only called when serialize_data()
hasn't been called on the bucket */
static void serf_request_destroy(serf_bucket_t *bucket)
{
request_context_t *ctx = bucket->data;
serf_bucket_destroy(ctx->headers);
if (ctx->body)
serf_bucket_destroy(ctx->body);
serf_default_destroy_and_data(bucket);
}
void serf_bucket_request_become(
serf_bucket_t *bucket,
const char *method,
@ -218,6 +237,6 @@ const serf_bucket_type_t serf_bucket_type_request = {
serf_default_read_for_sendfile,
serf_default_read_bucket,
serf_request_peek,
serf_default_destroy_and_data,
serf_request_destroy,
};

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_lib.h>
@ -128,7 +133,17 @@ static apr_status_t parse_status_line(response_context_t *ctx,
int res;
char *reason; /* ### stupid APR interface makes this non-const */
/* ctx->linebuf.line should be of form: HTTP/1.1 200 OK */
/* Ensure a valid length, to avoid overflow on the final '\0' */
if (ctx->linebuf.used >= SERF_LINEBUF_LIMIT) {
return SERF_ERROR_BAD_HTTP_RESPONSE;
}
/* apr_date_checkmask assumes its arguments are valid C strings */
ctx->linebuf.line[ctx->linebuf.used] = '\0';
/* ctx->linebuf.line should be of form: 'HTTP/1.1 200 OK',
but we also explicitly allow the forms 'HTTP/1.1 200' (no reason)
and 'HTTP/1.1 401.1 Logon failed' (iis extended error codes) */
res = apr_date_checkmask(ctx->linebuf.line, "HTTP/#.# ###*");
if (!res) {
/* Not an HTTP response? Well, at least we won't understand it. */

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,36 +1,24 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* ----
*
* For the OpenSSL thread-safety locking code:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Originally developed by Aaron Bannert and Justin Erenkrantz, eBuilt.
*/
@ -64,6 +52,10 @@
#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
#endif
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L
#define USE_OPENSSL_1_1_API
#endif
/*
* Here's an overview of the SSL bucket's relationship to OpenSSL and serf.
@ -152,6 +144,7 @@ struct serf_ssl_context_t {
SSL_CTX *ctx;
SSL *ssl;
BIO *bio;
BIO_METHOD *biom;
serf_ssl_stream_t encrypt;
serf_ssl_stream_t decrypt;
@ -244,10 +237,28 @@ apps_ssl_info_callback(const SSL *s, int where, int ret)
}
#endif
static void bio_set_data(BIO *bio, void *data)
{
#ifdef USE_OPENSSL_1_1_API
BIO_set_data(bio, data);
#else
bio->ptr = data;
#endif
}
static void *bio_get_data(BIO *bio)
{
#ifdef USE_OPENSSL_1_1_API
return BIO_get_data(bio);
#else
return bio->ptr;
#endif
}
/* Returns the amount read. */
static int bio_bucket_read(BIO *bio, char *in, int inlen)
{
serf_ssl_context_t *ctx = bio->ptr;
serf_ssl_context_t *ctx = bio_get_data(bio);
const char *data;
apr_status_t status;
apr_size_t len;
@ -291,7 +302,7 @@ static int bio_bucket_read(BIO *bio, char *in, int inlen)
/* Returns the amount written. */
static int bio_bucket_write(BIO *bio, const char *in, int inl)
{
serf_ssl_context_t *ctx = bio->ptr;
serf_ssl_context_t *ctx = bio_get_data(bio);
serf_bucket_t *tmp;
serf__log(SSL_VERBOSE, __FILE__, "bio_bucket_write called for %d bytes\n",
@ -319,19 +330,16 @@ static int bio_bucket_write(BIO *bio, const char *in, int inl)
/* Returns the amount read. */
static int bio_file_read(BIO *bio, char *in, int inlen)
{
apr_file_t *file = bio->ptr;
apr_file_t *file = bio_get_data(bio);
apr_status_t status;
apr_size_t len;
BIO_clear_retry_flags(bio);
len = inlen;
status = apr_file_read(file, in, &len);
if (!SERF_BUCKET_READ_ERROR(status)) {
/* Oh suck. */
if (APR_STATUS_IS_EOF(status)) {
BIO_set_retry_read(bio);
return -1;
} else {
return len;
@ -344,7 +352,7 @@ static int bio_file_read(BIO *bio, char *in, int inlen)
/* Returns the amount written. */
static int bio_file_write(BIO *bio, const char *in, int inl)
{
apr_file_t *file = bio->ptr;
apr_file_t *file = bio_get_data(bio);
apr_size_t nbytes;
BIO_clear_retry_flags(bio);
@ -357,15 +365,32 @@ static int bio_file_write(BIO *bio, const char *in, int inl)
static int bio_file_gets(BIO *bio, char *in, int inlen)
{
return bio_file_read(bio, in, inlen);
apr_file_t *file = bio_get_data(bio);
apr_status_t status;
status = apr_file_gets(in, inlen, file);
if (! status) {
return (int)strlen(in);
} else if (APR_STATUS_IS_EOF(status)) {
return 0;
} else {
return -1; /* Signal generic error */
}
}
static int bio_bucket_create(BIO *bio)
{
#ifdef USE_OPENSSL_1_1_API
BIO_set_shutdown(bio, 1);
BIO_set_init(bio, 1);
BIO_set_data(bio, NULL);
#else
bio->shutdown = 1;
bio->init = 1;
bio->num = -1;
bio->ptr = NULL;
#endif
return 1;
}
@ -399,6 +424,7 @@ static long bio_bucket_ctrl(BIO *bio, int cmd, long num, void *ptr)
return ret;
}
#ifndef USE_OPENSSL_1_1_API
static BIO_METHOD bio_bucket_method = {
BIO_TYPE_MEM,
"Serf SSL encryption and decryption buckets",
@ -428,6 +454,55 @@ static BIO_METHOD bio_file_method = {
NULL /* sslc does not have the callback_ctrl field */
#endif
};
#endif
static BIO_METHOD *bio_meth_bucket_new(void)
{
BIO_METHOD *biom = NULL;
#ifdef USE_OPENSSL_1_1_API
biom = BIO_meth_new(BIO_TYPE_MEM,
"Serf SSL encryption and decryption buckets");
if (biom) {
BIO_meth_set_write(biom, bio_bucket_write);
BIO_meth_set_read(biom, bio_bucket_read);
BIO_meth_set_ctrl(biom, bio_bucket_ctrl);
BIO_meth_set_create(biom, bio_bucket_create);
BIO_meth_set_destroy(biom, bio_bucket_destroy);
}
#else
biom = &bio_bucket_method;
#endif
return biom;
}
static BIO_METHOD *bio_meth_file_new(void)
{
BIO_METHOD *biom = NULL;
#ifdef USE_OPENSSL_1_1_API
biom = BIO_meth_new(BIO_TYPE_FILE,
"Wrapper around APR file structures");
BIO_meth_set_write(biom, bio_file_write);
BIO_meth_set_read(biom, bio_file_read);
BIO_meth_set_gets(biom, bio_file_gets);
BIO_meth_set_ctrl(biom, bio_bucket_ctrl);
BIO_meth_set_create(biom, bio_bucket_create);
BIO_meth_set_destroy(biom, bio_bucket_destroy);
#else
biom = &bio_file_method;
#endif
return biom;
}
static void bio_meth_free(BIO_METHOD *biom)
{
#ifdef USE_OPENSSL_1_1_API
BIO_meth_free(biom);
#endif
}
typedef enum san_copy_t {
EscapeNulAndCopy = 0,
@ -977,7 +1052,7 @@ static apr_status_t ssl_encrypt(void *baton, apr_size_t bufsize,
return status;
}
#if APR_HAS_THREADS
#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
static apr_pool_t *ssl_pool;
static apr_thread_mutex_t **ssl_locks;
@ -1064,7 +1139,7 @@ static void init_ssl_libraries(void)
val = apr_atomic_cas32(&have_init_ssl, INIT_BUSY, INIT_UNINITIALIZED);
if (!val) {
#if APR_HAS_THREADS
#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
int i, numlocks;
#endif
@ -1081,13 +1156,17 @@ static void init_ssl_libraries(void)
}
#endif
#ifdef USE_OPENSSL_1_1_API
OPENSSL_malloc_init();
#else
CRYPTO_malloc_init();
#endif
ERR_load_crypto_strings();
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();
#if APR_HAS_THREADS
#if APR_HAS_THREADS && !defined(USE_OPENSSL_1_1_API)
numlocks = CRYPTO_num_locks();
apr_pool_create(&ssl_pool, NULL);
ssl_locks = apr_palloc(ssl_pool, sizeof(apr_thread_mutex_t*)*numlocks);
@ -1140,6 +1219,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
const char *cert_path;
apr_file_t *cert_file;
BIO *bio;
BIO_METHOD *biom;
PKCS12 *p12;
int i;
int retrying_success = 0;
@ -1165,8 +1245,9 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
continue;
}
bio = BIO_new(&bio_file_method);
bio->ptr = cert_file;
biom = bio_meth_file_new();
bio = BIO_new(biom);
bio_set_data(bio, cert_file);
ctx->cert_path = cert_path;
p12 = d2i_PKCS12_bio(bio, NULL);
@ -1176,6 +1257,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
if (i == 1) {
PKCS12_free(p12);
bio_meth_free(biom);
ctx->cached_cert = *cert;
ctx->cached_cert_pw = *pkey;
if (!retrying_success && ctx->cert_cache_pool) {
@ -1211,6 +1293,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
i = PKCS12_parse(p12, password, pkey, cert, NULL);
if (i == 1) {
PKCS12_free(p12);
bio_meth_free(biom);
ctx->cached_cert = *cert;
ctx->cached_cert_pw = *pkey;
if (!retrying_success && ctx->cert_cache_pool) {
@ -1238,6 +1321,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
}
}
PKCS12_free(p12);
bio_meth_free(biom);
return 0;
}
else {
@ -1245,6 +1329,7 @@ static int ssl_need_client_cert(SSL *ssl, X509 **cert, EVP_PKEY **pkey)
ERR_GET_FUNC(err),
ERR_GET_REASON(err));
PKCS12_free(p12);
bio_meth_free(biom);
}
}
}
@ -1339,8 +1424,9 @@ static serf_ssl_context_t *ssl_init_context(serf_bucket_alloc_t *allocator)
disable_compression(ssl_ctx);
ssl_ctx->ssl = SSL_new(ssl_ctx->ctx);
ssl_ctx->bio = BIO_new(&bio_bucket_method);
ssl_ctx->bio->ptr = ssl_ctx;
ssl_ctx->biom = bio_meth_bucket_new();
ssl_ctx->bio = BIO_new(ssl_ctx->biom);
bio_set_data(ssl_ctx->bio, ssl_ctx);
SSL_set_bio(ssl_ctx->ssl, ssl_ctx->bio, ssl_ctx->bio);
@ -1383,6 +1469,7 @@ static apr_status_t ssl_free_context(
/* SSL_free implicitly frees the underlying BIO. */
SSL_free(ssl_ctx->ssl);
bio_meth_free(ssl_ctx->biom);
SSL_CTX_free(ssl_ctx->ctx);
serf_bucket_mem_free(ssl_ctx->allocator, ssl_ctx);

View File

@ -2,21 +2,25 @@
#
# check.py : Run all the test cases.
#
# ====================================================================
# Copyright 2013 Justin Erenkrantz and Greg Stein
# ===================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ===================================================================
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
import sys
import glob
@ -31,6 +35,11 @@
else:
testdir = 'test'
if len(sys.argv) > 2:
test_builddir = sys.argv[2]
else:
test_builddir = 'test'
# define test executable paths
if sys.platform == 'win32':
SERF_RESPONSE_EXE = 'serf_response.exe'
@ -38,8 +47,8 @@
else:
SERF_RESPONSE_EXE = 'serf_response'
TEST_ALL_EXE = 'test_all'
SERF_RESPONSE_EXE = os.path.join(testdir, SERF_RESPONSE_EXE)
TEST_ALL_EXE = os.path.join(testdir, TEST_ALL_EXE)
SERF_RESPONSE_EXE = os.path.join(test_builddir, SERF_RESPONSE_EXE)
TEST_ALL_EXE = os.path.join(test_builddir, TEST_ALL_EXE)
# Find test responses and run them one by one
for case in glob.glob(testdir + "/testcases/*.response"):

View File

@ -2,22 +2,24 @@
#
# gen_def.py : Generate the .DEF file for Windows builds
#
# ====================================================================
# Copyright 2002-2010 Justin Erenkrantz and Greg Stein
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
#
# ===================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ===================================================================
#
# Typically, this script is used like:
#

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>
@ -212,7 +217,7 @@ apr_status_t serf_event_trigger(
tdesc.desc.s = conn->skt;
tdesc.reqevents = conn->reqevents;
ctx->pollset_rm(ctx->pollset_baton,
&tdesc, conn);
&tdesc, &conn->baton);
return conn->status;
}
/* apr_pollset_poll() can return a conn multiple times... */
@ -233,7 +238,7 @@ apr_status_t serf_event_trigger(
tdesc.desc.s = conn->skt;
tdesc.reqevents = conn->reqevents;
ctx->pollset_rm(ctx->pollset_baton,
&tdesc, conn);
&tdesc, &conn->baton);
}
return conn->status;
}
@ -295,9 +300,9 @@ apr_status_t serf_context_run(
}
while (num--) {
serf_connection_t *conn = desc->client_data;
serf_io_baton_t *io = desc->client_data;
status = serf_event_trigger(ctx, conn, desc);
status = serf_event_trigger(ctx, io, desc);
if (status) {
return status;
}

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#include <apr_pools.h>
@ -142,7 +147,7 @@ apr_status_t serf__conn_update_pollset(serf_connection_t *conn)
desc.reqevents = conn->reqevents;
status = ctx->pollset_rm(ctx->pollset_baton,
&desc, conn);
&desc, &conn->baton);
if (status && !APR_STATUS_IS_NOTFOUND(status))
return status;
@ -547,7 +552,7 @@ static apr_status_t remove_connection(serf_context_t *ctx,
desc.reqevents = conn->reqevents;
return ctx->pollset_rm(ctx->pollset_baton,
&desc, conn);
&desc, &conn->baton);
}
/* A socket was closed, inform the application. */
@ -623,6 +628,11 @@ static apr_status_t reset_connection(serf_connection_t *conn,
conn->ctx->dirty_pollset = 1;
conn->state = SERF_CONN_INIT;
conn->hit_eof = 0;
conn->connect_time = 0;
conn->latency = -1;
conn->stop_writing = 0;
serf__log(CONN_VERBOSE, __FILE__, "reset connection 0x%x\n", conn);
conn->status = APR_SUCCESS;

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SERF_H
@ -1062,7 +1067,7 @@ void serf_debug__bucket_alloc_check(
/* Version info */
#define SERF_MAJOR_VERSION 1
#define SERF_MINOR_VERSION 3
#define SERF_PATCH_VERSION 8
#define SERF_PATCH_VERSION 9
/* Version number string */
#define SERF_VERSION_STRING APR_STRINGIFY(SERF_MAJOR_VERSION) "." \

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SERF_BUCKET_TYPES_H

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SERF_BUCKET_UTIL_H

View File

@ -1,16 +1,21 @@
/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef _SERF_PRIVATE_H_

View File

@ -1,16 +1,21 @@
/* Copyright 2011 Justin Erenkrantz and Greg Stein
/* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
/*** Setup a SSL tunnel over a HTTP proxy, according to RFC 2817. ***/

View File

@ -207,9 +207,9 @@ fb64_start(struct fb *fbp, int dir, int server __unused)
/*
* Create a random feed and send it over.
*/
des_random_key((Block *)fbp->temp_feed);
des_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
fbp->krbdes_sched, 1);
DES_random_key((Block *)fbp->temp_feed);
DES_ecb_encrypt((Block *)fbp->temp_feed, (Block *)fbp->temp_feed,
&fbp->krbdes_sched, 1);
p = fbp->fb_feed + 3;
*p++ = ENCRYPT_IS;
p++;
@ -393,7 +393,7 @@ fb64_session(Session_Key *key, int server, struct fb *fbp)
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_ENCRYPT-1]);
fb64_stream_key(fbp->krbdes_key, &fbp->streams[DIR_DECRYPT-1]);
des_key_sched((Block *)fbp->krbdes_key, fbp->krbdes_sched);
DES_key_sched((Block *)fbp->krbdes_key, &fbp->krbdes_sched);
/*
* Now look to see if krbdes_start() was was waiting for
* the key to show up. If so, go ahead an call it now
@ -499,7 +499,7 @@ fb64_stream_iv(Block seed, struct stinfo *stp)
memmove((void *)stp->str_iv, (void *)seed, sizeof(Block));
memmove((void *)stp->str_output, (void *)seed, sizeof(Block));
des_key_sched((Block *)stp->str_ikey, stp->str_sched);
DES_key_sched((Block *)stp->str_ikey, &stp->str_sched);
stp->str_index = sizeof(Block);
}
@ -508,7 +508,7 @@ void
fb64_stream_key(Block key, struct stinfo *stp)
{
memmove((void *)stp->str_ikey, (void *)key, sizeof(Block));
des_key_sched((Block *)key, stp->str_sched);
DES_key_sched((Block *)key, &stp->str_sched);
memmove((void *)stp->str_output, (void *)stp->str_iv, sizeof(Block));
@ -547,7 +547,7 @@ cfb64_encrypt(unsigned char *s, int c)
while (c-- > 0) {
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
idx = 0;
}
@ -580,7 +580,7 @@ cfb64_decrypt(int data)
idx = stp->str_index++;
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_output, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_output, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
idx = 0; /* But now use 0 */
@ -620,7 +620,7 @@ ofb64_encrypt(unsigned char *s, int c)
while (c-- > 0) {
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
idx = 0;
}
@ -650,7 +650,7 @@ ofb64_decrypt(int data)
idx = stp->str_index++;
if (idx == sizeof(Block)) {
Block b;
des_ecb_encrypt((Block *)stp->str_feed, (Block *)b, stp->str_sched, 1);
DES_ecb_encrypt((Block *)stp->str_feed, (Block *)b, &stp->str_sched, 1);
memmove((void *)stp->str_feed, (void *)b, sizeof(Block));
stp->str_index = 1; /* Next time will be 1 */
idx = 0; /* But now use 0 */

View File

@ -67,7 +67,7 @@ typedef unsigned char *BlockT;
#if 0
typedef struct { Block __; } Schedule[16];
#else
#define Schedule des_key_schedule
#define Schedule DES_key_schedule
#endif
#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \

View File

@ -91,7 +91,7 @@ static char name[ANAME_SZ];
static AUTH_DAT adat = { 0, "", "", "", 0, {}, 0, 0, 0, { 0, "", 0 } };
#ifdef ENCRYPTION
static Block session_key = { 0 };
static des_key_schedule sched;
static DES_key_schedule sched;
static Block challenge = { 0 };
#endif /* ENCRYPTION */
@ -206,10 +206,10 @@ kerberos4_send(Authenticator *ap)
if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {
register int i;
des_key_sched(&cred.session, sched);
des_random_key(&session_key);
des_ecb_encrypt(&session_key, &session_key, sched, 0);
des_ecb_encrypt(&session_key, &challenge, sched, 0);
DES_key_sched(&cred.session, sched);
DES_random_key(&session_key);
DES_ecb_encrypt(&session_key, &session_key, sched, 0);
DES_ecb_encrypt(&session_key, &challenge, sched, 0);
/*
* Increment the challenge by 1, and encrypt it for
* later comparison.
@ -221,7 +221,7 @@ kerberos4_send(Authenticator *ap)
if (x < 256) /* if no overflow, all done */
break;
}
des_ecb_encrypt(&challenge, &challenge, sched, 1);
DES_ecb_encrypt(&challenge, &challenge, sched, 1);
}
#endif /* ENCRYPTION */
@ -298,14 +298,14 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
break;
}
des_key_sched(&session_key, sched);
DES_key_sched(&session_key, sched);
memmove((void *)datablock, (void *)data, sizeof(Block));
/*
* Take the received encrypted challenge, and encrypt
* it again to get a unique session_key for the
* ENCRYPT option.
*/
des_ecb_encrypt(&datablock, &session_key, sched, 1);
DES_ecb_encrypt(&datablock, &session_key, sched, 1);
skey.type = SK_DES;
skey.length = 8;
skey.data = session_key;
@ -314,7 +314,7 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
* Now decrypt the received encrypted challenge,
* increment by one, re-encrypt it and send it back.
*/
des_ecb_encrypt(&datablock, &challenge, sched, 0);
DES_ecb_encrypt(&datablock, &challenge, sched, 0);
for (r = 7; r >= 0; r--) {
register int t;
t = (unsigned int)challenge[r] + 1;
@ -322,7 +322,7 @@ kerberos4_is(Authenticator *ap, unsigned char *data, int cnt)
if (t < 256) /* if no overflow, all done */
break;
}
des_ecb_encrypt(&challenge, &challenge, sched, 1);
DES_ecb_encrypt(&challenge, &challenge, sched, 1);
Data(ap, KRB_RESPONSE, challenge, sizeof(challenge));
#endif /* ENCRYPTION */
break;
@ -364,7 +364,7 @@ kerberos4_reply(Authenticator *ap, unsigned char *data, int cnt)
#else /* ENCRYPTION */
Data(ap, KRB_CHALLENGE, session_key,
sizeof(session_key));
des_ecb_encrypt(&session_key, &session_key, sched, 1);
DES_ecb_encrypt(&session_key, &session_key, sched, 1);
skey.type = SK_DES;
skey.length = 8;
skey.data = session_key;

View File

@ -129,7 +129,7 @@ common_key(char *xsecret, char *xpublic, IdeaData *ideakey, DesData *deskey)
mp_pow(public, secret, modulus, common);
extractdeskey(common, deskey);
extractideakey(common, ideakey);
des_set_odd_parity(deskey);
DES_set_odd_parity(deskey);
mp_mfree(common);
mp_mfree(secret);
mp_mfree(public);
@ -221,14 +221,14 @@ pk_encode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
des_key_schedule k;
DES_key_schedule k;
int l,op,deslen;
memset(&i,0,sizeof(i));
memset(buf,0,sizeof(buf));
deslen = ((strlen(in) + 7)/8)*8;
des_key_sched(key, k);
des_cbc_encrypt(in,buf,deslen, k,&i,DES_ENCRYPT);
DES_key_sched(key, &k);
DES_cbc_encrypt(in, buf, deslen, &k, &i, DES_ENCRYPT);
for (l=0,op=0;l<deslen;l++) {
out[op++] = hextab[(buf[l] & 0xf0) >> 4];
out[op++] = hextab[(buf[l] & 0x0f)];
@ -242,7 +242,7 @@ pk_decode(char *in, char *out, DesData *key)
{
char buf[256];
DesData i;
des_key_schedule k;
DES_key_schedule k;
int n1,n2,op;
size_t l;
@ -259,7 +259,7 @@ pk_decode(char *in, char *out, DesData *key)
n2 = in[op+1] - '0';
buf[l] = n1*16 +n2;
}
des_key_sched(key, k);
des_cbc_encrypt(buf,out,strlen(in)/2, k,&i,DES_DECRYPT);
DES_key_sched(key, &k);
DES_cbc_encrypt(buf, out, strlen(in) / 2, &k, &i, DES_DECRYPT);
out[strlen(in)/2] = '\0';
}

View File

@ -32,7 +32,7 @@
/* header for the des routines that we will use */
typedef unsigned char byte, DesData[ 8], IdeaData[16];
#define DesKeys des_key_schedule
#define DesKeys DES_key_schedule
#define DES_DECRYPT 0
#define DES_ENCRYPT 1

View File

@ -135,7 +135,7 @@
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `DSA_SIG_set0' function. */
/* #undef HAVE_DSA_SIG_SET0 */
#define HAVE_DSA_SIG_SET0 1
/* Define to 1 if you have the <endian.h> header file. */
/* #undef HAVE_ENDIAN_H */
@ -177,10 +177,10 @@
/* #undef HAVE_EVP_DIGESTVERIFY */
/* Define to 1 if you have the `EVP_dss1' function. */
#define HAVE_EVP_DSS1 1
/* #undef HAVE_EVP_DSS1 */
/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
/* #undef HAVE_EVP_MD_CTX_NEW */
#define HAVE_EVP_MD_CTX_NEW 1
/* Define to 1 if you have the `EVP_sha1' function. */
#define HAVE_EVP_SHA1 1