From 1d2fcf87bcc73e697198fb07493174df550d71c5 Mon Sep 17 00:00:00 2001 From: damitha Date: Tue, 31 May 2011 09:05:26 +0000 Subject: Initial commit of ntlm authentication code git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@1129578 13f79535-47bb-0310-9956-ffa450edef68 --- .../transport/http/sender/ntlm/default/Makefile.am | 24 ++++ .../sender/ntlm/default/default_ntlm_wrapper.c | 137 +++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 src/core/transport/http/sender/ntlm/default/Makefile.am create mode 100644 src/core/transport/http/sender/ntlm/default/default_ntlm_wrapper.c (limited to 'src/core/transport/http/sender/ntlm/default') diff --git a/src/core/transport/http/sender/ntlm/default/Makefile.am b/src/core/transport/http/sender/ntlm/default/Makefile.am new file mode 100644 index 0000000..1457475 --- /dev/null +++ b/src/core/transport/http/sender/ntlm/default/Makefile.am @@ -0,0 +1,24 @@ +# 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. +lib_LTLIBRARIES = libaxis2_ntlm.la + + +libaxis2_ntlm_la_SOURCES = ../ntlm.c \ + default_ntlm_wrapper.c + +libaxis2_ntlm_la_LIBADD = $(top_builddir)/util/src/libaxutil.la + +INCLUDES = -I$(top_builddir)/include \ + -I$(top_builddir)/util/include diff --git a/src/core/transport/http/sender/ntlm/default/default_ntlm_wrapper.c b/src/core/transport/http/sender/ntlm/default/default_ntlm_wrapper.c new file mode 100644 index 0000000..3a4f25f --- /dev/null +++ b/src/core/transport/http/sender/ntlm/default/default_ntlm_wrapper.c @@ -0,0 +1,137 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include + +void AXIS2_CALL +default_ntlm_wrapper_free( + axis2_ntlm_t * ntlm, + const axutil_env_t * env); + +axis2_status_t AXIS2_CALL +default_ntlm_wrapper_create_type1_message( + axis2_ntlm_t * ntlm, + const axutil_env_t * env, + axis2_char_t **encoded_message, + int *encoded_len, + const axis2_char_t *uname, + const axis2_char_t *passwd, + const int flags, + const axis2_char_t *domain, + const axis2_char_t *workstation); + +axis2_status_t AXIS2_CALL +default_ntlm_wrapper_create_type3_message( + axis2_ntlm_t * ntlm, + const axutil_env_t * env, + axis2_char_t *header_value, + axis2_char_t **encoded_message, + int *encoded_len, + const axis2_char_t *uname, + const axis2_char_t *passwd, + const int flags, + const axis2_char_t *domain, + const axis2_char_t *workstation); + +typedef struct default_ntlm_wrapper_impl_t +{ + axis2_ntlm_t ntlm; + + /*xmlTextReaderPtr reader;*/ + +} default_ntlm_wrapper_impl_t; + +#define AXIS2_INTF_TO_IMPL(p) ((default_ntlm_wrapper_impl_t*)p) +#define AXIS2_IMPL_TO_INTF(p) &(p->ntlm) + +static const axis2_ntlm_ops_t axis2_ntlm_ops_var = { + default_ntlm_wrapper_free, + default_ntlm_wrapper_create_type1_message, + default_ntlm_wrapper_create_type3_message }; + +AXIS2_EXTERN axis2_ntlm_t *AXIS2_CALL +axis2_ntlm_create( + const axutil_env_t *env) +{ + default_ntlm_wrapper_impl_t *wrapper_impl = NULL; + wrapper_impl = (default_ntlm_wrapper_impl_t *)AXIS2_MALLOC(env->allocator, + sizeof(default_ntlm_wrapper_impl_t)); + + if(!wrapper_impl) + { + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create default ntlm wrapper"); + return NULL; + } + memset(wrapper_impl, 0, sizeof(default_ntlm_wrapper_impl_t)); + /*wrapper_impl->x=NULL;*/ + wrapper_impl->ntlm.ops = &axis2_ntlm_ops_var; + return &(wrapper_impl->ntlm); +} + +/** + */ +void AXIS2_CALL +default_ntlm_wrapper_free( + axis2_ntlm_t * ntlm, + const axutil_env_t * env) +{ + default_ntlm_wrapper_impl_t *ntlm_impl = NULL; + ntlm_impl = AXIS2_INTF_TO_IMPL(ntlm); + + AXIS2_FREE(env->allocator, AXIS2_INTF_TO_IMPL(ntlm)); + return; +} + +axis2_status_t AXIS2_CALL +default_ntlm_wrapper_create_type1_message( + axis2_ntlm_t * ntlm, + const axutil_env_t * env, + axis2_char_t **encoded_message, + int *encoded_len, + const axis2_char_t *user, + const axis2_char_t *password, + const int flags, + const axis2_char_t *domain, + const axis2_char_t *workstation) +{ + axis2_status_t status = AXIS2_FAILURE; + return status; +} + +axis2_status_t AXIS2_CALL +default_ntlm_wrapper_create_type3_message( + axis2_ntlm_t * ntlm, + const axutil_env_t * env, + axis2_char_t *header_value, + axis2_char_t **encoded_message, + int *encoded_len, + const axis2_char_t *user, + const axis2_char_t *password, + const int flags, + const axis2_char_t *domain, + const axis2_char_t *workstation) +{ + axis2_status_t status = AXIS2_FAILURE; + return status; +} + + -- cgit v1.1-32-gdbae