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 macOS Packed Structs #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support macOS Packed Structs #5

wants to merge 2 commits into from

Conversation

t0rr3sp3dr0
Copy link

@t0rr3sp3dr0 t0rr3sp3dr0 commented Nov 16, 2019

Due to pack pragma on krb5.h that is only used on macOS, some struct fields are not accessible from Go directly.

#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
#    pragma pack(push,2)
#endif

In these cases is necessary to use an auxiliary function to get/set those fields.

Fixes golang/go#35640

Signed-off-by: Pedro Tôrres <[email protected]>
@@ -56,6 +56,78 @@ package krb5
// krb5_data *outbuf) {
// return krb5_mk_req_extended(context, auth_context, ap_req_options, in_data, &in_creds, outbuf);
// }
//
// krb5_data *krb5_cc_get_principal_realm(krb5_principal_data *principal) {
Copy link
Contributor

@davidben davidben Nov 25, 2019

Choose a reason for hiding this comment

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

krb5_cc_* is functions defined by Kerberos relating to the krb5_ccache. These functions are neither of these.

For the other wrappers, I made them file-local (static) which means they don't need a prefix since they don't get exported out of the cgo-generated C file.

@@ -56,6 +56,78 @@ package krb5
// krb5_data *outbuf) {
// return krb5_mk_req_extended(context, auth_context, ap_req_options, in_data, &in_creds, outbuf);
// }
//
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind adding a short comment for why these are necessary?

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.

Missing struct fields when using CGO on macOS
3 participants