-
Notifications
You must be signed in to change notification settings - Fork 41
WIP for Issue #62 #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I get segfault with "GssapiNameAttributes json" configuration. |
|
This stops the crash but not necessarily correct. diff --git a/src/environ.c b/src/environ.c
index 1c04c43..dfc30b7 100644
--- a/src/environ.c
+++ b/src/environ.c
@@ -152,7 +152,7 @@ static void mag_set_name_attributes(struct mag_config *cfg, request_rec *req,
if (cfg->name_attributes->output_json) {
mag_add_json_name_attr(req, i == 0, &attr, &json);
}
- mag_set_env_name_attr(req, &attr);
+ if (cfg->name_attributes->map_count) mag_set_env_name_attr(req, &attr);
gss_release_buffer(&min, &attr.value);
gss_release_buffer(&min, &attr.display_value); |
|
And btw that's the json i get (I thought I'd see the name of the attribute). {"name":"avi@FRENCHE.CP","attributes":{,("BAAAAAAAAAABAAAAAAIAAEgAAAAAAAAACgAAABAAAABIAgAAAAAAAAYAAAAUAAAAWAIAAAAAAAAHAAAAFAAAAHACAAAAAAAAARAIAMzMzMzwAQAAAAAAAAAAAgAcofoAfCzRAf////////9//////////38u9aEU8T/QAS61Cz+6QNAB/////////38GAAYABAACAAYABgAIAAIAAAAAAAwAAgAAAAAAEAACAAAAAAAUAAIAAAAAABgAAgCxAQAAWAQAAAECAAADAAAAHAACACAAAAAAAAAAAAAAAAAAAAAAAAAABAAGACAAAgAOABAAJAACACgAAgAAAAAAAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACwAAgAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAABhAHYAaQAAAAMAAAAAAAAAAwAAAGEAdgBpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGYEAAAHAAAAAQIAAAcAAAB7BAAABwAAAAMAAAAAAAAAAgAAAE0AUwAIAAAAAAAAAAcAAABGAFIARQBOAEMASABFAAAABAAAAAEEAAAAAAAFFQAAAB6jRAlKgY3PAV2JqQIAAAAwAAIABwAAIDQAAgAHAAAgBQAAAAEFAAAAAAAFFQAAAB6jRAlKgY3PAV2JqXoEAAAFAAAAAQUAAAAAAAUVAAAAHqNECUqBjc8BXYmpVgQAAAAAAACAWnELfCzRAQYAYQB2AGkAdv///wB0e7Y3BJ5s+Xmx+PeyAKkAAAAAdv///1urMv/BRy09Yosvns58OEEAAAAA","(null)")]],("ARAIAMzMzMzwAQAAAAAAAAAAAgAcofoAfCzRAf////////9//////////38u9aEU8T/QAS61Cz+6QNAB/////////38GAAYABAACAAYABgAIAAIAAAAAAAwAAgAAAAAAEAACAAAAAAAUAAIAAAAAABgAAgCxAQAAWAQAAAECAAADAAAAHAACACAAAAAAAAAAAAAAAAAAAAAAAAAABAAGACAAAgAOABAAJAACACgAAgAAAAAAAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACwAAgAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAABhAHYAaQAAAAMAAAAAAAAAAwAAAGEAdgBpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGYEAAAHAAAAAQIAAAcAAAB7BAAABwAAAAMAAAAAAAAAAgAAAE0AUwAIAAAAAAAAAAcAAABGAFIARQBOAEMASABFAAAABAAAAAEEAAAAAAAFFQAAAB6jRAlKgY3PAV2JqQIAAAAwAAIABwAAIDQAAgAHAAAgBQAAAAEFAAAAAAAFFQAAAB6jRAlKgY3PAV2JqXoEAAAFAAAAAQUAAAAAAAUVAAAAHqNECUqBjc8BXYmpVgQAAAAAAAA=","(null)")]],("gFpxC3ws0QEGAGEAdgBpAA==","(null)")]],("dv///wB0e7Y3BJ5s+Xmx+PeyAKk=","(null)")]],("dv///1urMv/BRy09Yosvns58OEE=","(null)")]]}} |
|
Also, when I try "GssapiNameAttributes GSS_MS_PAC urn:mspac:" i get: |
|
Ah silly me, I did not push to the right repo, I fixed this problem. |
|
I should have fixed all the issues you have identified, and rebase this PR |
|
I am reviving an AD environment of mine to test with the mspac attributes |
|
Now the json looks good: But the two variables is configure are not set: I'll test some more tomorrow. |
|
I have an env now to reproduce, I think though this is normal because those mspac attributes do not have a display name (I am looking at MIT code and no display_name is ever returned for MSPAC attributes). I guess I am going to make the code fall back to the raw value if display_name is NULL. |
|
Ok now a b64 encoded raw value is returned if display_value is not available. |
|
@Frenche I have all working now I think, if you can test and ack I'll push to master. |
|
Looks good. Maybe we can give little more thoughts on the json format. |
|
Ok, I am rewriting part if the patch to be able to preserve env vars when connection bound is set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the round brackets aren't needed, json_decode and js-eval fail with them.
|
Here's what i get what I would have liked to see (visual: http://json.parser.online.fr/). Current: {"name":"avi@FRENCHE.CP","attributes":{"urn:mspac:":[1,1,[("BAAAAAAAAAABAAAAAAIAAEgAAAAAAAAACgAAABAAAABIAgAAAAAAAAYAAAAUAAAAWAIAAAAAAAAHAAAAFAAAAHACAAAAAAAAARAIAMzMzMzwAQAAAAAAAAAAAgAirowLfCzRAf////////9//////////38u9aEU8T/QAS61Cz+6QNAB/////////38GAAYABAACAAYABgAIAAIAAAAAAAwAAgAAAAAAEAACAAAAAAAUAAIAAAAAABgAAgCyAQAAWAQAAAECAAADAAAAHAACACAAAAAAAAAAAAAAAAAAAAAAAAAABAAGACAAAgAOABAAJAACACgAAgAAAAAAAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACwAAgAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAABhAHYAaQAAAAMAAAAAAAAAAwAAAGEAdgBpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAA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")]],"urn:mspac:server-checksum":[1,1,[("dv///9RN+pmTXHB7X/OwDx1RXo0=","")]],"urn:mspac:privsvr-checksum":[1,1,[("dv///+XnjFDw2vhc6d6M2sxvjms=","")]]}} Like: {"name":"avi@FRENCHE.CP","attributes":{"urn:mspac:":{"authenticated":true, "complete":true,"display_value":null,"raw_value_b64":"BAAAAAAAAAABAAAAAAIAAEgAAAAAAAAACgAAABAAAABIAgAAAAAAAAYAAAAUAAAAWAIAAAAAAAAHAAAAFAAAAHACAAAAAAAAARAIAMzMzMzwAQAAAAAAAAAAAgAirowLfCzRAf////////9//////////38u9aEU8T/QAS61Cz+6QNAB/////////38GAAYABAACAAYABgAIAAIAAAAAAAwAAgAAAAAAEAACAAAAAAAUAAIAAAAAABgAAgCyAQAAWAQAAAECAAADAAAAHAACACAAAAAAAAAAAAAAAAAAAAAAAAAABAAGACAAAgAOABAAJAACACgAAgAAAAAAAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACwAAgAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAABhAHYAaQAAAAMAAAAAAAAAAwAAAGEAdgBpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGYEAAAHAAAAAQIAAAcAAAB7BAAABwAAAAMAAAAAAAAAAgAAAE0AUwAIAAAAAAAAAAcAAABGAFIARQBOAEMASABFAAAABAAAAAEEAAAAAAAFFQAAAB6jRAlKgY3PAV2JqQIAAAAwAAIABwAAIDQAAgAHAAAgBQAAAAEFAAAAAAAFFQAAAB6jRAlKgY3PAV2JqXoEAAAFAAAAAQUAAAAAAAUVAAAAHqNECUqBjc8BXYmpVgQAAAAAAACA4Y8QMC3RAQYAYQB2AGkAdv///9RN+pmTXHB7X/OwDx1RXo0AAAAAdv///+XnjFDw2vhc6d6M2sxvjmsAAAAA"},"urn:mspac:logon-info":{"authenticated":true,"complete":true,"display_value":null,"raw_value_b64":"ARAIAMzMzMzwAQAAAAAAAAAAAgAirowLfCzRAf////////9//////////38u9aEU8T/QAS61Cz+6QNAB/////////38GAAYABAACAAYABgAIAAIAAAAAAAwAAgAAAAAAEAACAAAAAAAUAAIAAAAAABgAAgCyAQAAWAQAAAECAAADAAAAHAACACAAAAAAAAAAAAAAAAAAAAAAAAAABAAGACAAAgAOABAAJAACACgAAgAAAAAAAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACwAAgAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAABhAHYAaQAAAAMAAAAAAAAAAwAAAGEAdgBpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAGYEAAAHAAAAAQIAAAcAAAB7BAAABwAAAAMAAAAAAAAAAgAAAE0AUwAIAAAAAAAAAAcAAABGAFIARQBOAEMASABFAAAABAAAAAEEAAAAAAAFFQAAAB6jRAlKgY3PAV2JqQIAAAAwAAIABwAAIDQAAgAHAAAgBQAAAAEFAAAAAAAFFQAAAB6jRAlKgY3PAV2JqXoEAAAFAAAAAQUAAAAAAAUVAAAAHqNECUqBjc8BXYmpVgQAAAAAAAA="},"urn:mspac:client-info":{"authenticated":true,"complete":true,"display_value":null,"raw_value_b64":"gOGPEDAt0QEGAGEAdgBpAA=="},"urn:mspac:server-checksum":{"authenticated":true,"complete":true,"display_value":null,"raw_value_b64":"dv///9RN+pmTXHB7X/OwDx1RXo0="},"urn:mspac:privsvr-checksum":{"authenticated":true,"complete":true,"display_value":null,"raw_value_b64":"dv///+XnjFDw2vhc6d6M2sxvjms="}}} |
|
I forgot that json does not have tuples, and you are supposed to turn them into lists. Is null and actual valid value ? The reason why I used a list of tuples is that name attribute may have multiple values, your syntax does not allow that. At least for values I will have a list of tuples (rendered as list), I can used a dictionary for the outer values like authenticated and complete. |
In preparation for the next commit. Signed-off-by: Simo Sorce <simo@redhat.com>
|
yea, null / true / false I think a list of values could be represented as: "values":[null,"dv///9RN+pmTXHB7X/OwDx1RXo0="] but how the app will distinguish between the display_value to the raw_b64 (isn't that what they are? could there be more values?) |
|
Ok I changed the patches so that now we store attributes in the mc context. It works with basica auth, could you test if it keeps working properly with Connection-bound ? |
|
On Wed, 2015-12-02 at 15:49 -0800, Isaac Boukris wrote:
the list will have to be: Yes name attributes can be multivalued. Simo. Simo Sorce * Red Hat, Inc * New York |
|
@Frenche and now updated to a better json. I had to use lists as mentioned above but I changed the attributes to use dictionaries and named boolean values for "authenticated" and "completed", as well as returning 'null' for empty values. |
|
@simo5 - it looks good but the app would still wanna know what type of value it looks at. Perhaps instead of: We can do (still allowing multiple values): |
|
Ok I added a dict in the list as you proposed, the values are "display" and "raw", no need to specify b64 in the name IMO. |
|
It looks good to me. One little thing though - it looks as if attributes may repeat themselves, like in ms-pac 'urn:mspac:' clearly contains the other ones. |
|
BTW the JSON idea is really nice, maybe we can take it a step further and extract (ndr decode) the KERB_VALIDATION_INFO struct into a json class (and perhaps other goodies). Imagine we reveal all this info nicely to the app: |
|
I'll take the last 2 messages as an ack :-) On unfolding MSPAC, that is a request for the display_value (ie RFE for MIT kerberos/Heimdal) and not the mod_auth_gssapi job IMHO. In any case this is somehitng we can discuss in a separate RFE. |
|
Thanks for the clarifications! |
No description provided.