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

HPCC-10323 ESP incorrectly checks for errors querying file perms #5080

Merged

Conversation

RussWhitehead
Copy link
Member

In dasess.cpp, CClientSessionManager::getPermissionsLDAP never reads
the error code from the message buffer into the local 'e' variable. This
code fix reads the error code, ensuring either the caller will receive
the error or an exception will be thrown if the caller does not want it

Signed-off-by: William Whitehead william.whitehead@lexisnexis.com

In dasess.cpp, CClientSessionManager::getPermissionsLDAP never reads
the error code from the message buffer into the local 'e' variable. This
code fix reads the error code, ensuring either the caller will receive
the error or an exception will be thrown if the caller does not want it

Signed-off-by: William Whitehead <william.whitehead@lexisnexis.com>
@hpcc-jirabot
Copy link

Jira updated

@richardkchapman
Copy link
Member

@jakesmith Please review

int e = 0;
if (mb.remaining()>=sizeof(e)) {
if (mb.remaining()>=sizeof(int)) {
int e = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Looks ok, but now the above few lines of code do both sizeof(int) and sizeof().
Should be consistent, I think better as it was (sizeof(e))

Copy link
Member

Choose a reason for hiding this comment

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

It was changed to sizeof(int) because e is not in scope , I assume

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but either the 'ret' case should look the same, i.e. sizeof(int) and int ret moved into block, or it should be sizeof(e) and int e moved out of block again. I prefer the sizeof(variable name) approach, but not fussed really as long as consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moving 'int ret" is beyond the scope of this bug fix (as I have been told before) so I stuck to fixing the problem at hand. It doesn't make sense to allocate stack space for "int e" if there is nothing to be read into it, hence my modification to move it within the "if (mb.remaining()>=sizeof(int)) {" block

Copy link
Member

Choose a reason for hiding this comment

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

This is not time critical, so allocating stack for int e, is not going to matter.

The main point is the two different approaches within a few lines code.

Copy link
Member

Choose a reason for hiding this comment

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

I think Jake is being a bit over-critical.

Copy link
Member

Choose a reason for hiding this comment

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

Well, have to find something to comment on..

Though still maintain makes for more readable code if consistent

richardkchapman added a commit that referenced this pull request Nov 6, 2013
HPCC-10323 ESP incorrectly checks for errors querying file perms

Reviewed-By: Jake Smith <jake.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
@richardkchapman richardkchapman merged commit 528a461 into hpcc-systems:candidate-4.2.0 Nov 6, 2013
@RussWhitehead RussWhitehead deleted the getPerms branch January 7, 2014 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants