summaryrefslogtreecommitdiffstats
path: root/proxy/src/gp_export.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-07-05 12:18:48 -0400
committerSimo Sorce <simo@redhat.com>2012-07-06 08:44:52 -0400
commit8205c95c577c91a1cfa20380ce257328cf5fce90 (patch)
tree79e42ce278581b52463b391db21c4248631aed53 /proxy/src/gp_export.c
parent0835536f64d331a1e42fcca4d203a22180baa9f6 (diff)
downloadgss-proxy-8205c95c577c91a1cfa20380ce257328cf5fce90.tar.gz
gss-proxy-8205c95c577c91a1cfa20380ce257328cf5fce90.tar.xz
gss-proxy-8205c95c577c91a1cfa20380ce257328cf5fce90.zip
Unify find creds
Diffstat (limited to 'proxy/src/gp_export.c')
-rw-r--r--proxy/src/gp_export.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
index 35b40dd..1267edc 100644
--- a/proxy/src/gp_export.c
+++ b/proxy/src/gp_export.c
@@ -428,29 +428,36 @@ static int gp_import_gssx_cred(struct gp_ring_buffer *ring_buffer,
return 0;
}
-int gp_find_cred(struct gp_service *svc,
- gssx_cred *cred, gss_cred_id_t *out)
+
+
+int gp_find_cred_int(struct gp_ring_buffer *ring_buffer, gssx_cred *cred,
+ gss_cred_id_t *out, struct gp_credential_handle *handle)
+{
+ int ret;
+
+ ret = gp_conv_octet_string_to_cred_handle(&cred->cred_handle_reference,
+ handle);
+ if (ret) {
+ return ENOENT;
+ }
+
+ return gp_import_gssx_cred(ring_buffer, handle, out);
+}
+
+int gp_find_cred(struct gp_service *svc, gssx_cred *cred, gss_cred_id_t *out)
{
struct gp_ring_buffer *ring_buffer;
struct gp_credential_handle handle;
- int ret;
ring_buffer = gp_service_get_ring_buffer(svc);
if (!ring_buffer) {
return EINVAL;
}
- ret = gp_conv_octet_string_to_cred_handle(&cred->cred_handle_reference,
- &handle);
- if (ret) {
- return ENOENT;
- }
-
- return gp_import_gssx_cred(ring_buffer, &handle, out);
+ return gp_find_cred_int(ring_buffer, cred, out, &handle);
}
-int gp_find_and_free_cred(struct gp_service *svc,
- gssx_cred *cred)
+int gp_find_and_free_cred(struct gp_service *svc, gssx_cred *cred)
{
struct gp_ring_buffer *ring_buffer;
struct gp_credential_handle handle;
@@ -462,13 +469,7 @@ int gp_find_and_free_cred(struct gp_service *svc,
return EINVAL;
}
- ret = gp_conv_octet_string_to_cred_handle(&cred->cred_handle_reference,
- &handle);
- if (ret) {
- return ret;
- }
-
- ret = gp_import_gssx_cred(ring_buffer, &handle, &gss_cred);
+ ret = gp_find_cred_int(ring_buffer, cred, &gss_cred, &handle);
if (ret) {
return ret;
}