diff options
author | Simo Sorce <simo@redhat.com> | 2013-10-14 16:41:13 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2013-10-14 17:31:11 -0400 |
commit | 97c47d3f12e6a236d34a12f5a66e6a1450b62388 (patch) | |
tree | c44b2046b710acd86867dbac5e7ff28257ce19ae /proxy/src/gp_config.c | |
parent | f513734b61873fa9bbbaec78f1221d291a0c94a5 (diff) | |
download | gss-proxy-97c47d3f12e6a236d34a12f5a66e6a1450b62388.tar.gz gss-proxy-97c47d3f12e6a236d34a12f5a66e6a1450b62388.tar.xz gss-proxy-97c47d3f12e6a236d34a12f5a66e6a1450b62388.zip |
Add option to specify allowed usage.
Credentials can often be used both to accept and to initiate contexts.
With this option admins can allow a specific usage only.
This is to avoid allowing an unprivileged process to fool a remote
client by allowing it to impersonate a server, when we only want to
allow this service to use credentials to initiate contexts.
Diffstat (limited to 'proxy/src/gp_config.c')
-rw-r--r-- | proxy/src/gp_config.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c index 943906a..2aeaaa9 100644 --- a/proxy/src/gp_config.c +++ b/proxy/src/gp_config.c @@ -163,6 +163,9 @@ static int load_services(struct gp_config *cfg, struct gp_ini_context *ctx) } cfg->num_svcs++; + /* by default allow both */ + cfg->svcs[n]->cred_usage = GSS_C_BOTH; + cfg->svcs[n]->name = strdup(secname + 8); if (!cfg->svcs[n]->name) { ret = ENOMEM; @@ -271,6 +274,22 @@ static int load_services(struct gp_config *cfg, struct gp_ini_context *ctx) goto done; } } + + ret = gp_config_get_string(ctx, secname, "cred_usage", &value); + if (ret == 0) { + if (strcasecmp(value, "initiate") == 0) { + cfg->svcs[n]->cred_usage = GSS_C_INITIATE; + } else if (strcasecmp(value, "accept") == 0) { + cfg->svcs[n]->cred_usage = GSS_C_ACCEPT; + } else if (strcasecmp(value, "both") == 0) { + cfg->svcs[n]->cred_usage = GSS_C_BOTH; + } else { + GPDEBUG("Invalid value '%s' for cred_usage in [%s].\n", + value, secname); + ret = EINVAL; + goto done; + } + } } safefree(secname); } |