diff options
author | Simo Sorce <simo@redhat.com> | 2012-06-13 11:21:16 -0400 |
---|---|---|
committer | Günther Deschner <gdeschner@redhat.com> | 2012-06-26 14:44:43 +0200 |
commit | be4aec34ea1861dbd492ab2486c3f28de93f11e7 (patch) | |
tree | 7a3437622e8722eb1a39312456af20df71062a5d | |
parent | 931c4d61e64af9db194c82c5d750d018710d4628 (diff) | |
download | gss-proxy-be4aec34ea1861dbd492ab2486c3f28de93f11e7.tar.gz gss-proxy-be4aec34ea1861dbd492ab2486c3f28de93f11e7.tar.xz gss-proxy-be4aec34ea1861dbd492ab2486c3f28de93f11e7.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.
-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 834b68b..fd976a5 100644 --- a/proxy/src/mechglue/gss_plugin.c +++ b/proxy/src/mechglue/gss_plugin.c @@ -226,6 +226,30 @@ done: return amechs; } +#define MAP_ERROR_BASE 0x04200000 + +uint32_t gpm_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 gpm_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; +} + /* gssi_acquire_cred gssi_release_cred diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h index a3d2b36..76ab9f3 100644 --- a/proxy/src/mechglue/gss_plugin.h +++ b/proxy/src/mechglue/gss_plugin.h @@ -33,5 +33,7 @@ extern const gss_OID_desc gssproxy_mech_interposer; gss_OID_set gss_mech_interposer(gss_OID mech_type); const gss_OID gpm_special_mech(const gss_OID mech_type); gss_OID_set gpm_special_available_mechs(const gss_OID_set mechs); +uint32_t gpm_map_error(uint32_t err); +uint32_t gpm_unmap_error(uint32_t err); #endif /* _GGS_PLUGIN_H_ */ |