X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/2fddb30eb177339eba6c1d64c3aea934704e5faf..d241dd27df3a32b5477eadb1a9d4897d7fcf76a7:/projects/rlm_stg/rlm_stg.c diff --git a/projects/rlm_stg/rlm_stg.c b/projects/rlm_stg/rlm_stg.c index 98c6a02a..50654593 100644 --- a/projects/rlm_stg/rlm_stg.c +++ b/projects/rlm_stg/rlm_stg.c @@ -98,7 +98,7 @@ static STG_PAIR* fromVPS(const VALUE_PAIR* pairs) bzero(res[pos].key, sizeof(res[0].key)); bzero(res[pos].value, sizeof(res[0].value)); strncpy(res[pos].key, pairs->name, sizeof(res[0].key)); - vp_prints_value(res[pos].value, sizeof(res[0].value), pairs, 0); + vp_prints_value(res[pos].value, sizeof(res[0].value), (VALUE_PAIR*)pairs, 0); ++pos; pairs = pairs->next; } @@ -107,6 +107,23 @@ static STG_PAIR* fromVPS(const VALUE_PAIR* pairs) return res; } +static int toRLMCode(int code) +{ + switch (code) + { + case STG_REJECT: return RLM_MODULE_REJECT; + case STG_FAIL: return RLM_MODULE_FAIL; + case STG_OK: return RLM_MODULE_OK; + case STG_HANDLED: return RLM_MODULE_HANDLED; + case STG_INVALID: return RLM_MODULE_INVALID; + case STG_USERLOCK: return RLM_MODULE_USERLOCK; + case STG_NOTFOUND: return RLM_MODULE_NOTFOUND; + case STG_NOOP: return RLM_MODULE_NOOP; + case STG_UPDATED: return RLM_MODULE_UPDATED; + } + return RLM_MODULE_REJECT; +} + /* * Do any per-module initialization that is separate to each * configured instance of the module. e.g. set up connections @@ -190,7 +207,7 @@ static int stg_authorize(void* instance, REQUEST* request) if (count) return RLM_MODULE_UPDATED; - return RLM_MODULE_NOOP; + return toRLMCode(result.returnCode); } /* @@ -231,7 +248,7 @@ static int stg_authenticate(void* instance, REQUEST* request) if (count) return RLM_MODULE_UPDATED; - return RLM_MODULE_NOOP; + return toRLMCode(result.returnCode); } /* @@ -272,7 +289,7 @@ static int stg_preacct(void* instance, REQUEST* request) if (count) return RLM_MODULE_UPDATED; - return RLM_MODULE_NOOP; + return toRLMCode(result.returnCode); } /* @@ -313,7 +330,7 @@ static int stg_accounting(void* instance, REQUEST* request) if (count) return RLM_MODULE_UPDATED; - return RLM_MODULE_OK; + return toRLMCode(result.returnCode); } /* @@ -372,7 +389,7 @@ static int stg_postauth(void* instance, REQUEST* request) if (count) return RLM_MODULE_UPDATED; - return RLM_MODULE_NOOP; + return toRLMCode(result.returnCode); } static int stg_detach(void* instance)