summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-01-25 14:22:35 -0500
committerSimo Sorce <simo@redhat.com>2012-01-25 16:55:08 -0500
commitcaf72feef692c990b37e9b7300d63500f70a7840 (patch)
treee5043ec74ac19684d9feaccd3c3552ad85fb5a65
parentdace994bf54750c67385cdfe17898376394af622 (diff)
downloadgss-proxy-caf72feef692c990b37e9b7300d63500f70a7840.tar.gz
gss-proxy-caf72feef692c990b37e9b7300d63500f70a7840.tar.xz
gss-proxy-caf72feef692c990b37e9b7300d63500f70a7840.zip
Add release_handle implementation
-rw-r--r--proxy/Makefile.am1
-rw-r--r--proxy/src/gp_rpc_process.c4
-rw-r--r--proxy/src/gp_rpc_release_handle.c69
3 files changed, 70 insertions, 4 deletions
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index ca9d7b6..c76e9b5 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -98,6 +98,7 @@ gssproxy_SOURCES = \
src/gp_conv.c \
src/gp_export.c \
src/gp_rpc_accept_sec_context.c \
+ src/gp_rpc_release_handle.c \
src/gssproxy.c
accept_context_SOURCES = \
diff --git a/proxy/src/gp_rpc_process.c b/proxy/src/gp_rpc_process.c
index dd2f538..cd7f60c 100644
--- a/proxy/src/gp_rpc_process.c
+++ b/proxy/src/gp_rpc_process.c
@@ -397,10 +397,6 @@ int gp_init_sec_context(gp_exec_std_args)
return 0;
}
-int gp_release_handle(gp_exec_std_args)
-{
- return 0;
-}
int gp_get_mic(gp_exec_std_args)
{
return 0;
diff --git a/proxy/src/gp_rpc_release_handle.c b/proxy/src/gp_rpc_release_handle.c
new file mode 100644
index 0000000..9f423d6
--- /dev/null
+++ b/proxy/src/gp_rpc_release_handle.c
@@ -0,0 +1,69 @@
+/*
+ GSS-PROXY
+
+ Copyright (C) 2011 Red Hat, Inc.
+ Copyright (C) 2011 Simo Sorce <simo.sorce@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"
+
+int gp_release_handle(struct gssproxy_ctx *gpctx,
+ union gp_rpc_arg *arg,
+ union gp_rpc_res *res)
+{
+ struct gssx_arg_release_handle *rha;
+ struct gssx_res_release_handle *rhr;
+ uint32_t ret_maj;
+ uint32_t ret_min;
+ gss_cred_id_t *cred;
+ int ret;
+
+ rha = &arg->release_handle;
+ rhr = &res->release_handle;
+
+ switch (rha->cred_handle.handle_type) {
+ case GSSX_C_HANDLE_SEC_CTX:
+ /* We do not need release for any security
+ * context for now */
+ ret_maj = GSS_S_UNAVAILABLE;
+ ret_min = 0;
+ break;
+ case GSSX_C_HANDLE_CRED:
+ ret = gp_find_cred(&rha->cred_handle.gssx_handle_u.cred_info, cred);
+ if (ret) {
+ ret_maj = GSS_S_UNAVAILABLE;
+ ret_min = 0;
+ } else {
+ ret_maj = gss_release_cred(&ret_min, cred);
+ }
+ break;
+ default:
+ ret_maj = GSS_S_CALL_BAD_STRUCTURE;
+ ret_min = 0;
+ break;
+ }
+
+ ret = gp_conv_status_to_gssx(&rha->call_ctx,
+ ret_maj, ret_min, GSS_C_NO_OID,
+ &rhr->status);
+
+ return ret;
+}