summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGünther Deschner <gdeschner@redhat.com>2012-07-27 12:38:53 +0200
committerSimo Sorce <simo@redhat.com>2012-08-23 17:11:36 +0200
commit6455b93e424b0999836a590548650c56e25e017f (patch)
treed34c00fc1ca5ddfb43f5418f70504cb0cc3659d9
parent47dd8ad02100990f17fc1d0f866dc71b5e6373c0 (diff)
downloadgss-proxy-6455b93e424b0999836a590548650c56e25e017f.tar.gz
gss-proxy-6455b93e424b0999836a590548650c56e25e017f.tar.xz
gss-proxy-6455b93e424b0999836a590548650c56e25e017f.zip
Implement gp_verify_mic().
Acked-by: Simo Sorce <simo@redhat.com>
-rw-r--r--proxy/Makefile.am1
-rw-r--r--proxy/src/gp_rpc_process.c6
-rw-r--r--proxy/src/gp_rpc_process.h2
-rw-r--r--proxy/src/gp_rpc_verify_mic.c105
4 files changed, 108 insertions, 6 deletions
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index c4fe177..debc9e3 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -131,6 +131,7 @@ gssproxy_SOURCES = \
src/gp_rpc_import_and_canon_name.c \
src/gp_rpc_init_sec_context.c \
src/gp_rpc_get_mic.c \
+ src/gp_rpc_verify_mic.c \
src/gssproxy.c
cli_srv_comm_SOURCES = \
diff --git a/proxy/src/gp_rpc_process.c b/proxy/src/gp_rpc_process.c
index 5834f60..f89c673 100644
--- a/proxy/src/gp_rpc_process.c
+++ b/proxy/src/gp_rpc_process.c
@@ -95,7 +95,7 @@ struct gp_rpc_fn_set {
{ /* GSSX_VERIFY */
(xdrproc_t)xdr_gssx_arg_verify_mic,
(xdrproc_t)xdr_gssx_res_verify_mic,
- gp_verify
+ gp_verify_mic
},
{ /* GSSX_WRAP */
(xdrproc_t)xdr_gssx_arg_wrap,
@@ -390,10 +390,6 @@ int gp_store_cred(gp_exec_std_args)
return 0;
}
-int gp_verify(gp_exec_std_args)
-{
- return 0;
-}
int gp_wrap(gp_exec_std_args)
{
return 0;
diff --git a/proxy/src/gp_rpc_process.h b/proxy/src/gp_rpc_process.h
index e85cff6..ef76d25 100644
--- a/proxy/src/gp_rpc_process.h
+++ b/proxy/src/gp_rpc_process.h
@@ -57,7 +57,7 @@ int gp_init_sec_context(gp_exec_std_args);
int gp_accept_sec_context(gp_exec_std_args);
int gp_release_handle(gp_exec_std_args);
int gp_get_mic(gp_exec_std_args);
-int gp_verify(gp_exec_std_args);
+int gp_verify_mic(gp_exec_std_args);
int gp_wrap(gp_exec_std_args);
int gp_unwrap(gp_exec_std_args);
int gp_wrap_size_limit(gp_exec_std_args);
diff --git a/proxy/src/gp_rpc_verify_mic.c b/proxy/src/gp_rpc_verify_mic.c
new file mode 100644
index 0000000..b2032de
--- /dev/null
+++ b/proxy/src/gp_rpc_verify_mic.c
@@ -0,0 +1,105 @@
+/*
+ GSS-PROXY
+
+ Copyright (C) 2011 Red Hat, Inc.
+ Copyright (C) 2011 Simo Sorce <simo.sorce@redhat.com>
+ Copyright (C) 2012 Guenther Deschner <guenther.deschner@redhat.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include "gp_rpc_process.h"
+#include <gssapi/gssapi.h>
+
+int gp_verify_mic(struct gssproxy_ctx *gpctx,
+ struct gp_service *gpsvc,
+ union gp_rpc_arg *arg,
+ union gp_rpc_res *res)
+{
+ gss_ctx_id_t context_handle = GSS_C_NO_CONTEXT;
+ struct gssx_arg_verify_mic *vma;
+ struct gssx_res_verify_mic *vmr;
+ gss_buffer_desc message_buffer;
+ gss_buffer_desc token_buffer;
+ gss_qop_t qop_state;
+ int exp_ctx_type;
+ uint32_t ret_maj;
+ uint32_t ret_min;
+ int ret;
+
+ vma = &arg->verify_mic;
+ vmr = &res->verify_mic;
+
+ exp_ctx_type = gp_get_exported_context_type(&vma->call_ctx);
+ if (exp_ctx_type == -1) {
+ ret_maj = GSS_S_FAILURE;
+ ret_min = EINVAL;
+ goto done;
+ }
+
+ ret_maj = gp_import_gssx_to_ctx_id(&ret_min, 0,
+ &vma->context_handle,
+ &context_handle);
+ if (ret_maj) {
+ goto done;
+ }
+
+ gp_conv_gssx_to_buffer(&vma->message_buffer, &message_buffer);
+ gp_conv_gssx_to_buffer(&vma->token_buffer, &token_buffer);
+
+ ret_maj = gss_verify_mic(&ret_min, context_handle,
+ &message_buffer, &token_buffer,
+ &qop_state);
+ if (ret_maj) {
+ goto done;
+ }
+
+ vmr->context_handle = calloc(1, sizeof(gssx_ctx));
+ if (!vmr->context_handle) {
+ ret_maj = GSS_S_FAILURE;
+ ret_min = ENOMEM;
+ goto done;
+ }
+
+ ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type,
+ &context_handle,
+ vmr->context_handle);
+ if (ret_maj) {
+ goto done;
+ }
+
+ vmr->qop_state = calloc(1, sizeof(gssx_qop));
+ if (!vmr->qop_state) {
+ ret_maj = GSS_S_FAILURE;
+ ret_min = ENOMEM;
+ goto done;
+ }
+
+ *vmr->qop_state = qop_state;
+
+ ret_maj = GSS_S_COMPLETE;
+ ret_min = 0;
+
+done:
+ ret = gp_conv_status_to_gssx(&vma->call_ctx,
+ ret_maj, ret_min,
+ GSS_C_NO_OID,
+ &vmr->status);
+ return ret;
+}