summaryrefslogtreecommitdiffstats
path: root/proxy
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-06-13 11:21:16 -0400
committerSimo Sorce <simo@redhat.com>2012-08-28 08:25:52 +0200
commitba2854952c59a6ffc9d2529f2b76934b7f9c5f90 (patch)
tree74d55a05bfbbb3bf3356df7c5055042fc244c13c /proxy
parentca0ff11fc945f15860086f6c2f76dfb1556018fa (diff)
downloadgss-proxy-ba2854952c59a6ffc9d2529f2b76934b7f9c5f90.tar.gz
gss-proxy-ba2854952c59a6ffc9d2529f2b76934b7f9c5f90.tar.xz
gss-proxy-ba2854952c59a6ffc9d2529f2b76934b7f9c5f90.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')
-rw-r--r--proxy/src/mechglue/gss_plugin.c24
-rw-r--r--proxy/src/mechglue/gss_plugin.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/proxy/src/mechglue/gss_plugin.c b/proxy/src/mechglue/gss_plugin.c
index ff85610..fcb3010 100644
--- a/proxy/src/mechglue/gss_plugin.c
+++ b/proxy/src/mechglue/gss_plugin.c
@@ -323,6 +323,30 @@ 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;
+}
+
/*
gssi_acquire_cred
gssi_release_cred
diff --git a/proxy/src/mechglue/gss_plugin.h b/proxy/src/mechglue/gss_plugin.h
index a45d217..f16bc95 100644
--- a/proxy/src/mechglue/gss_plugin.h
+++ b/proxy/src/mechglue/gss_plugin.h
@@ -42,5 +42,7 @@ gss_OID_set gss_mech_interposer(gss_OID mech_type);
enum gpp_behavior gpp_get_behavior(void);
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 /* _GGS_PLUGIN_H_ */