★ wanayoo — archive 1999 https://github.com/pythongssapi/python-gssapi/pull/210Nouvelle recherche | Portail wanayoo
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

Support IOV functions on macOS #210

Open
wants to merge 1 commit into
base: master
from

Conversation

@jborean93
Copy link
Contributor

@jborean93 jborean93 commented Jun 4, 2020

The DCE IOV functions are not exported in any public header on macOS which means the ext_dce functions cannot be used on that platform using the normal way. The actual framework has actually implemented these functions but they need to be loaded dynamically.

This PR uses dlsym to lookup the symbol of the GSS.Framework binary and get the address of the function based on the symbol name. The symbols names does not seem to have changed ever since the release of GSS.Framework and if they are removed/renamed in a future version the worst thing to happen is for the functions to no longer be available just like before.

One part I'm not sure on is whether we can use the Cython compile time definitions. If I understand the process correctly we create the sdist with the C files already generated which means the compile time directives won't be in place for macOS. As I see it we could either

  • Generate a wheel specifically for macOS and the various Python versions that are supported, or
  • Find another way to alternatively define the functions that are done when the C files are compiled and not when Cython generates the C files
@jborean93 jborean93 force-pushed the jborean93:macos-dce branch 5 times, most recently from 242c6eb to 9ddd1d2 Jun 4, 2020
@simo5
Copy link
Contributor

@simo5 simo5 commented Jun 4, 2020

Uuuggh hairy ....

@jborean93
Copy link
Contributor Author

@jborean93 jborean93 commented Jun 4, 2020

You're telling me, unfortunately WinRM message encryption requires the IOV functions as it needs the header/trailer length to encode in the exchange messages. Without something stupid like this we can't do that on macOS.

Really I just wanted to see whether it was possible to achieve this in gssapi and see what everyone's thoughts are in trying to expose it for end users. Willing to hear alternatives if available.

Copy link
Member

@frozencemetery frozencemetery left a comment

I think you're the only one with macOS set up, so this means any "does this work" questions are unfortunately yours to resolve. If it comes to that, I'm not opposed to macOS wheels if it helps with something (and it's easier than the Linux ones, though I imagine it is).

As long as we're confident that our detection works, I don't see anything wrong with exposing it to users.

@@ -111,14 +111,20 @@
except ImportError:
pass

# optional DCE (IOV/AEAD) support
# optional DCE (IOV) support

This comment has been minimized.

@frozencemetery

frozencemetery Jun 10, 2020
Member

I think we should make it more clear (here and below) that DCE != IOV. That is, this is the IOV part of the DCE functions.

This comment has been minimized.

@jborean93

jborean93 Jun 10, 2020
Author Contributor

What would you suggest, I can do # optional DCE (IOV only) support and the same for the AEAD imports below?

void *wrap_iov_length_fn = NULL
void *release_iov_buffer_fn = NULL

cdef void * _dlsym(void *handle, name):

This comment has been minimized.

@frozencemetery

frozencemetery Jun 10, 2020
Member

How likely are we to need these for other GSSAPI functions on macOS? Wondering if it'd make sense to put this glue in a common file somewhere.

This comment has been minimized.

@jborean93

jborean93 Jun 10, 2020
Author Contributor

Honestly I'm not sure, I had a brief check for some other extensions that are not available on macOS, like the aead stuff, but it doesn't seem to be present in the symbols. There's probably other stuff so I can move it out if you would like it.

@jborean93
Copy link
Contributor Author

@jborean93 jborean93 commented Jun 10, 2020

Thanks for replying @frozencemetery. I'll try and have a look at what will go into creating the wheels when I find some time in the future, can't guarantee I'll get to it anytime soon unfortunately.

One question I do have with the sdist that is currently created and published to pypi. Is the cython build just run on a system that has all the extensions present or can Cython create the .c files without the actual C headers potentially being present on the system?

@frozencemetery
Copy link
Member

@frozencemetery frozencemetery commented Jun 11, 2020

Apologies, I didn't mean to make it sound like I'm dumping a lot of work on you. Creating and uploading wheels should be fairly simple - we have logic for doing it on Windows that should translate, especially https://github.com/pythongssapi/python-gssapi/blob/master/ci/release-win.sh#L11-L13

Inspection suggests that the C files are part of the sdist - the pyx files aren't shipped there. (Our build logic detects this case.) It happens that all extensions are present on our build system, but the C files are generated regardless. When running pip install without a wheel, krb5 headers and a C compiler need to be present because the check for whether extensions are present is "does this build and import".

The DCE IOV functions on macOS are not exported by any public header on
the GSS.Framework. They can still be accessed by dynamically getting the
address of the known symbols for each function and invoking that.

This allows users of this library on macOS to better interop with
Windows SSPI message encryption which typically require the IOV wrapping
functions that were previously unavailable.
@jborean93 jborean93 force-pushed the jborean93:macos-dce branch from 9ddd1d2 to d2726a6 Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.