diff options
| author | Simo Sorce <simo@redhat.com> | 2012-01-30 09:39:17 -0500 |
|---|---|---|
| committer | Simo Sorce <simo@redhat.com> | 2012-01-30 10:49:03 -0500 |
| commit | 5c21c9e55374915114852398d5d5eb466a6bc148 (patch) | |
| tree | bd2d00eb554727acb70fefc7a0e3643c79a833bf /proxy/src/gp_conv.c | |
| parent | 266b81ef65dc4d41a328341799b1493508ecb24b (diff) | |
| download | gss-proxy-5c21c9e55374915114852398d5d5eb466a6bc148.tar.gz gss-proxy-5c21c9e55374915114852398d5d5eb466a6bc148.tar.xz gss-proxy-5c21c9e55374915114852398d5d5eb466a6bc148.zip | |
Add gpm_display_status function to mechglue library
Also add method to save status per-thread
Uses gccism for thread-local storage for now.
Diffstat (limited to 'proxy/src/gp_conv.c')
| -rw-r--r-- | proxy/src/gp_conv.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 99b1c05..0d4d276 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -454,3 +454,72 @@ int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, done: return ret; } + +int gp_copy_utf8string(utf8string *in, utf8string *out) +{ + out->utf8string_val = strdup(in->utf8string_val); + if (!out->utf8string_val) { + return ENOMEM; + } + out->utf8string_len = in->utf8string_len; + return 0; +} + +int gp_copy_gssx_status_alloc(gssx_status *in, gssx_status **out) +{ + gssx_status *o; + int ret; + + o = calloc(1, sizeof(gssx_status)); + if (!o) { + return ENOMEM; + } + + o->major_status = in->major_status; + o->minor_status = in->minor_status; + + if (in->mech.octet_string_len) { + ret = gp_conv_octet_string(in->mech.octet_string_len, + in->mech.octet_string_val, + &o->mech); + if (ret) { + goto done; + } + } + + if (in->major_status_string.utf8string_len) { + ret = gp_copy_utf8string(&in->major_status_string, + &o->major_status_string); + if (ret) { + goto done; + } + } + + if (in->minor_status_string.utf8string_len) { + ret = gp_copy_utf8string(&in->minor_status_string, + &o->minor_status_string); + if (ret) { + goto done; + } + } + + if (in->server_ctx.octet_string_len) { + ret = gp_conv_octet_string(in->server_ctx.octet_string_len, + in->server_ctx.octet_string_val, + &o->server_ctx); + if (ret) { + goto done; + } + } + + *out = o; + ret = 0; + +done: + if (ret) { + xdr_free((xdrproc_t)xdr_gssx_status, (char *)o); + free(o); + } + return ret; +} + |
