-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add detailed logging to libxrdp #1742
Conversation
Removed v0.9.15 milestone based on discussion on gitter chat. |
93c0f72
to
5530c91
Compare
I've rebased this change to devel, and it is now ready to be reviewed. |
Hi @aquesnel - I've started to review this, but I'm sure you appreciate it may take me a while! What you've done looks very thorough. Thanks for structuring it the way you have - it should help a lot. |
@matt335672 thank you for taking the time to review this big pull request. That's a good point about this taking a lot of time just to review. I think for the next pull request like this I'll split the request by file instead of by directory so that it can be reviewed and merged incrementally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three things to say up-front:-
- Absolutely the first thing to say; this is an amazing piece of work. The extra commenting you've added against the spec is a significant contribution in itself, in addition to all the work you've put in to the logging.
- Second thing to say is, sorry it's taken me a while. I've tried to be thorough while balancing by xrdp time against the other issues we've had come in recently.
- Thirdly, I haven't come across anything I'd regard as a show-stopper here. There are a couple of minor functional changes but they all look OK. If this gets merged as-is, it will be a major step forward in any case.
Virtually all of my comments are along the lines of a query as to whether something should be a LOG() or LOG_DEVEL(). The reasoning I've adapted is that if an error is returned which will drop the connection, it should be logged. I suspect that in a lot of these cases a static analysis will show that this happens anyway. I've not done that analysis myself - you may well have done. Please treat these comments as queries only.
I've got one other general comment; there's a lot of code along the lines of ;
if (!s_check_rem(s, <some val>))
{
LOG_DEVEL(LOG_LEVEL_ERROR, "Not enough bytes in the stream "
"len %d, remaining %d", <some_val>, s_rem(s));
...
}
It might be worth considering factoring that out into a macro like s_check_rem_and_log()
#define s_check_rem_and_log(s, n) \
( ((s)->p + (n) <= (s)->end) ? 1 : log_insufficient_in_stream(s, n) )
where log_insufficient_in_stream()
is a function call or another lightweight macro wrapper which returns 0.
Please challenge me on anything you think I'm being unreasonable about - and thanks again for a great piece of work!
@matt335672 thank for taking the time to look at the changes. Somehow I had missed this comment last week. I'll take a deeper look and start to implement the feedback tomorrow. |
I've implemented |
@matt335672 I've finished implement the feedback you suggested. Can you please take another look and let me know if there is any additional feedback before this can be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few extra minor comments
libxrdp/xrdp_mcs.c
Outdated
LOG_DEVEL(LOG_LEVEL_ERROR, "MCS Protocol error: length too big. " | ||
"max length %d, len %d", 16 * 1024, len); | ||
LOG(LOG_LEVEL_ERROR, | ||
"Parsing [ITU-T T.125] Connect-Initial userData: length too big. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest 'invalid' rather than 'too big', as <=0 could be an error value too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could still be <= 0. Suggest 'invalid' rather than 'too big'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this diff got updated when I pushed commit a736ac1 where I changed the message to say "invalid length"
libxrdp/xrdp_sec.c
Outdated
@@ -920,38 +1039,35 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s) | |||
self->rdp_layer->client_info.directory); | |||
LOG(LOG_LEVEL_DEBUG, "Client supplied domain: %s", self->rdp_layer->client_info.domain); | |||
LOG(LOG_LEVEL_DEBUG, "Client supplied username: %s", self->rdp_layer->client_info.username); | |||
LOG(LOG_LEVEL_DEBUG, "Client supplied password: ommitted from the log"); | |||
LOG(LOG_LEVEL_DEBUG, "Client supplied password: <ommitted from log>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ommitted -> omitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant it's a spelling mistake. Should be 'omitted' rather than 'ommitted'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this diff got updated when I pushed commit a736ac1 where I changed the message to say "omitted"
@aquesnel - this is really great work! I've just reviewed your additional changes. I'm out-of-time today, but tomorrow I'll go through our previous conversation and resolve things. |
@matt335672 I've implemented the feedback you gave me, and resolved conflicts with devel. I've give you a chance to look at the minimal changes that you recommended before I rebase or squash these changes. |
Thanks for that - looks good. I've made a few comments in reply. I should be able to approve this in the next few days, then it's over to @metalefty |
LGTM. @matt335672 Feel free to merge this at your convenience. |
@matt335672 I've implemented the suggestions you made. Please let me know if I missed anything. Do you want me to squash the changes before you merge them? |
That's fine - I've done a squash and merge. It results in a slightly cleaner git log. Thanks again for this - it should make debugging quite a bit easier! |
Follow up pull request from #1738 to add logs with more detailed information to the libxrdp code.
This code conflicts with #1738 and should therefore wait to to be merge until after #1738
TODO