diff options
author | Simo Sorce <simo@redhat.com> | 2012-02-08 11:00:49 -0500 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-02-09 01:36:07 -0500 |
commit | ab83710deb7b7b60c1fc3bdaaf6b2d4e7f062558 (patch) | |
tree | 052a51a3bf61f514311632f54d84f07bea3e7a29 | |
parent | 523b7ad875444d888e349d72c75aa2c2c723f319 (diff) | |
download | gss-proxy-ab83710deb7b7b60c1fc3bdaaf6b2d4e7f062558.tar.gz gss-proxy-ab83710deb7b7b60c1fc3bdaaf6b2d4e7f062558.tar.xz gss-proxy-ab83710deb7b7b60c1fc3bdaaf6b2d4e7f062558.zip |
gp_conv: Allow null oids as input in conversion functions
-rw-r--r-- | proxy/src/gp_conv.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 0105d00..486c727 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -82,6 +82,11 @@ int gp_conv_octet_string_alloc(size_t length, void *value, void gp_conv_gssx_to_oid(gssx_OID *in, gss_OID out) { + if (in == NULL) { + out->length = 0; + out->elements = NULL; + return; + } out->length = in->octet_string_len; out->elements = (void *)in->octet_string_val; } @@ -108,11 +113,18 @@ int gp_conv_gssx_to_oid_alloc(gssx_OID *in, gss_OID *out) int gp_conv_oid_to_gssx(gss_OID in, gssx_OID *out) { + if (in == GSS_C_NO_OID) { + return gp_conv_octet_string(0, NULL, out); + } return gp_conv_octet_string(in->length, in->elements, out); } int gp_conv_oid_to_gssx_alloc(gss_OID in, gssx_OID **out) { + if (in == GSS_C_NO_OID) { + *out = NULL; + return 0; + } return gp_conv_octet_string_alloc(in->length, in->elements, out); } |