Skip to content
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

Implement support for GSSAPI extension RFC 5587 #121

Merged
merged 1 commit into from
Jul 21, 2017

Conversation

cipherboy
Copy link
Contributor

@cipherboy cipherboy commented Jul 14, 2017

RFC 5587 provides extended mech inquiry calls to GSSAPI.
This adds the ability to indicate mechs by their
mech attrs, along with determining the attrs supported
by a mech. These calls are provided as a part of
the raw interface and are not exposed in the high-level
interface due to not having objects for mechs or attrs.

Thanks!

@cipherboy cipherboy force-pushed the rfc5587 branch 2 times, most recently from 6569bce to 8871dc8 Compare July 14, 2017 19:08
Copy link
Member

@frozencemetery frozencemetery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! Some comments inline.

mechs.shouldnt_be_empty()
mechs.should_be_a(set)

last_mech = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just use mechs[-1] instead of repeatedly updating a variable for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mechs is a set; sets don't support indexing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it is. Please move the update call to the top of the loop in that case.


last_mech = mech

last_mech.shouldnt_be_none
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this check redundant with the one in the loop?

last_attr = None

for mech in mechs:
mech.shouldnt_be_none
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to call your functions, in this line and elsewhere

last_mech = mech

last_mech.shouldnt_be_none
last_attr.shouldnt_be_none
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, why is this checked here?

@cipherboy cipherboy force-pushed the rfc5587 branch 2 times, most recently from f7c51b5 to 0b53bc2 Compare July 14, 2017 20:09
@cipherboy
Copy link
Contributor Author

@frozencemetery Updated!

Copy link
Member

@frozencemetery frozencemetery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will merge once we unbreak CI

@DirectXMan12
Copy link
Member

😢 please put a full description on the PR body and commit message. For example:

Implement support for GSSAPI extension RFC 5587

RFC 5587 adds extended mechanism inquiry APIs to the GSSAPI.
This allows users to query mechanisms using a number of attributes associated with those
mechanisms.   This is surfaced directly in the low-level API, but is not surfaced in the
high-level API because $REASONS.

Copy link
Member

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments inline.

if mech is not None:
m = &mech.raw_oid

maj_stat = gss_inquire_attrs_for_mech(&min_stat, m, &mech_attrs,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calls to the GSSAPI functions themselves should generally drop the GIL while being called with nogil:.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that annotation makes sense now. :) I notice that e.g., rfc5588 has a "nogil" on the cdef -- do you want that as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you'd need to add that

&long_desc)

if maj_stat == GSS_S_COMPLETE:
out_name = name.value[:name.length].decode("UTF-8")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't decode in the low-level API -- we just return bytes.

mech_attr.should_be_a(gb.OID)

display_out = gb.display_mech_attr(mech_attr)
display_out.name.shouldnt_be_none()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we test a specific attr to make sure that's right, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done -- see here.

@cipherboy cipherboy force-pushed the rfc5587 branch 2 times, most recently from 590d016 to 11180ad Compare July 17, 2017 15:59
@DirectXMan12
Copy link
Member

Ok, last thing: you should have doc strings on the functions. Otherwise, LGTM.

@cipherboy cipherboy force-pushed the rfc5587 branch 3 times, most recently from f726863 to 9e60f3d Compare July 17, 2017 19:41
@cipherboy
Copy link
Contributor Author

Thanks @DirectXMan12! :)

Copy link
Member

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small doc nit, and then you're good


def inquire_attrs_for_mech(OID mech):
"""
inquire_attrs_for_mech(OID mech)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now I'm nitpicking, but the method signature in the docstring should look like normal Python (so no types in the docstring signature)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking welcome :)


def display_mech_attr(OID attr):
"""
display_mech_attrs(OID attr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@cipherboy
Copy link
Contributor Author

cipherboy commented Jul 18, 2017

Are we looking for higher level changes at this time to include mechs / mech_attrs as a class of their own? It seems like they'd be a storage class with only a few helper functions, so I'm not sure there's a need.

RFC 5587 provides extended mech inquiry calls to GSSAPI.
This adds the ability to indicate mechs by their
mech attrs, along with determining the attrs supported
by a mech. These calls are provided as a part of
the raw interface and are not exposed in the high-level
interface due to not having objects for mechs or attrs.

Signed-off-by: Alexander Scheel <ascheel@redhat.com>
@cipherboy
Copy link
Contributor Author

I've added comments to the tests and added RFC 5587 support to the README.

@DirectXMan12
Copy link
Member

LGTM. We may have to revisit the exact message checking test in the future, but I'm fine to merge now.

@DirectXMan12 DirectXMan12 merged commit ae99d0c into pythongssapi:master Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants