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

MinGW: use namless unions in ext_ad_group_acl #2004

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

Conversation

kinkie
Copy link
Contributor

@kinkie kinkie commented Feb 27, 2025

ext_ad_group_acl was written working
around missing support for nameless unions
which are now required to build it.

error: 'IADs' {aka 'struct IADs'} has no member named 'lpVtbl'
error: 'VARIANT' {aka 'struct tagVARIANT'} has no member named 'n1'

@squid-anubis squid-anubis added the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Feb 27, 2025
@squid-anubis squid-anubis removed the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Feb 27, 2025
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

I do not know enough to review this at low level, but please make the following PR title/description adjustments:

  • Fix PR title spelling
  • Please use "MinGW" variant (at least in PR title):
% git log --oneline | grep -c MinGW
58
% git log --oneline | grep -c mingw
2

Whenever you are writing a new PR title, please watch out for spelling and naming consistency bugs. They are quite frequent...

The examples given below are just for illustration purposes. They are probably wrong on several levels. Please do not spend time criticizing/discussing them. Again, I do not know enough to write correct examples here and am not going to defend any of the requests below.

  • In PR description, please mention what this change does at higher/admin level (e.g., "ext_ad_group_acl fails to build (and has to be disabled at ./configure time) without this fix"). Assume mingw scope.
  • In PR description, please quote a compiler error message (or equivalent) that one would get without these changes. Abridge as needed. If there was no error, rephrase PR description to express the same "now required" idea differently.
  • In PR description: If possible without heroic efforts, please mention what has changed outside of Squid that prompted these Squid changes (e.g., "newer Windows headers no longer provide legacy APIs that ext_ad_group_acl was using").

@@ -181,9 +181,9 @@ Get_primaryGroup(IADs * pUser)
VariantInit(&var);

/* Get the primaryGroupID property */
hr = pUser->lpVtbl->Get(pUser, L"primaryGroupID", &var);
hr = pUser->Get(BSTR(L"primaryGroupID"), &var);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my own edification, what error do you get if this explicit BSTR conversion is removed? Please ignore this question if it takes too long to answer.

Suggested change
hr = pUser->Get(BSTR(L"primaryGroupID"), &var);
hr = pUser->Get(L"primaryGroupID", &var);

This optional question is not requesting any PR changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

../../../../../src/acl/external/AD_group/ext_ad_group_acl.cc: In function 'HRESULT Recursive_Memberof(IADs*)':
../../../../../src/acl/external/AD_group/ext_ad_group_acl.cc:429:20: error: ISO C++ forbids converting a string constant to 'BSTR' {aka 'wchar_t*'} [-Werror=write-strings]
  429 |     hr = pObj->Get(L"memberOf", &var);
      |                    ^~~~~~~~~~~

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! Using that error, I found an article that, AFAICT, claims that the changes proposed by this PR are buggy: "This code builds (compiles and links) correctly, but it will not function properly because the string does not have a length prefix."

I still do not know enough to be certain that this PR is buggy, but I believe this concern has to be addressed, so I have to block this PR.

@rousskov rousskov added the S-waiting-for-author author action is expected (and usually required) label Feb 27, 2025
@kinkie kinkie changed the title mingw: use namleess unions in ext_ad_group_acl MinGW: use namleess unions in ext_ad_group_acl Feb 27, 2025
@kinkie
Copy link
Contributor Author

kinkie commented Feb 27, 2025

Examples of errors this fixes:

../../../../../src/acl/external/AD_group/ext_ad_group_acl.cc:466:39: error: 'IADs' {aka 'struct IADs'} has no member named 'lpVtbl'
  466 |                                 pGrp->lpVtbl->Release(pGrp);
      |                                       ^~~~~~
../../../../../src/acl/external/AD_group/ext_ad_group_acl.cc:468:63: error: 'VARIANT' {aka 'struct tagVARIANT'} has no member named 'n1'
  468 |                                 Group_Path = GetLDAPPath(elem.n1.n2.n3.bstrVal, LDAP_MODE);
      |                                                               ^~

@kinkie kinkie changed the title MinGW: use namleess unions in ext_ad_group_acl MinGW: use namless unions in ext_ad_group_acl Feb 27, 2025
@kinkie kinkie added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box S-waiting-for-more-reviewers needs a reviewer and/or a second opinion and removed S-waiting-for-author author action is expected (and usually required) labels Feb 27, 2025
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

  • Fix PR title spelling

The title was changed, but the above request remains valid. FWIW, I recommend using good text editors for writing PR title/descriptions, but most browsers will also spellcheck text fields for you if you enable that feature for single-line text fields.

@@ -181,9 +181,9 @@ Get_primaryGroup(IADs * pUser)
VariantInit(&var);

/* Get the primaryGroupID property */
hr = pUser->lpVtbl->Get(pUser, L"primaryGroupID", &var);
hr = pUser->Get(BSTR(L"primaryGroupID"), &var);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! Using that error, I found an article that, AFAICT, claims that the changes proposed by this PR are buggy: "This code builds (compiles and links) correctly, but it will not function properly because the string does not have a length prefix."

I still do not know enough to be certain that this PR is buggy, but I believe this concern has to be addressed, so I have to block this PR.

@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Feb 27, 2025
@rousskov
Copy link
Contributor

Alex: In PR description, please quote a compiler error message (or equivalent) that one would get without these changes

Francesco: Examples of errors this fixes: ...

I copied that info to the PR description, addressing one of my earlier requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-for-author author action is expected (and usually required) S-waiting-for-more-reviewers needs a reviewer and/or a second opinion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants