diff options
author | Simo Sorce <simo@redhat.com> | 2012-06-13 11:21:16 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2012-10-25 15:52:54 -0400 |
commit | ef9cf5483a5716af2e6342b6ad92f3bf1504dea0 (patch) | |
tree | 098ff59e1a671889a6bd3dee2305f4ab9b03f585 /proxy/src | |
parent | 6349fcfdbf2668af203b9ca60efece64b7feba85 (diff) | |
download | gss-proxy-ef9cf5483a5716af2e6342b6ad92f3bf1504dea0.tar.gz gss-proxy-ef9cf5483a5716af2e6342b6ad92f3bf1504dea0.tar.xz gss-proxy-ef9cf5483a5716af2e6342b6ad92f3bf1504dea0.zip |
Add simple functions to map errors
The mechglue stores a map of errors/mech oids, this means that we should never
return the same error we got from a mechanism after re-entering the mechglue as
we then may get the mechglue confused and prevent us from asking an interposed
mech for the error. Also we want to try to aqvoid collisions from errors
returned from the proxy, as they could end up fetching errors from the wrong
mechanism.
For now just make a very simple mapping by always adding a special error base.
Diffstat (limited to 'proxy/src')
-rw-r--r-- | proxy/src/mechglue/gss_plugin.c | 24 | ||||
-rw-r--r-- | proxy/src/mechglue/gss_plugin.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c index 21bcd0d..f573e12 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -341,3 +341,27 @@ done: } return amechs; } + +#define MAP_ERROR_BASE 0x04200000 + +uint32_t gpp_map_error(uint32_t err) +{ + /* placeholder, + * we will need an actual map but to speed up testing just make a sum with + * a special base and hope no conflicts will happen in the mechglue */ + if (err) { + err += MAP_ERROR_BASE; + } + return err; +} + +uint32_t gpp_unmap_error(uint32_t err) +{ + /* placeholder, + * we will need an actual map but to speed up testing just make a sum with + * a special base and hope no conflicts will happen in the mechglue */ + if (err) { + err -= MAP_ERROR_BASE; + } + return err; +} diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index 1807fc0..f57fa4c 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -43,5 +43,7 @@ enum gpp_behavior gpp_get_behavior(void); bool gpp_is_special_oid(const gss_OID mech_type); const gss_OID gpp_special_mech(const gss_OID mech_type); gss_OID_set gpp_special_available_mechs(const gss_OID_set mechs); +uint32_t gpp_map_error(uint32_t err); +uint32_t gpp_unmap_error(uint32_t err); #endif /* _GSS_PLUGIN_H_ */ |