You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by "necouchman (via GitHub)" <gi...@apache.org> on 2023/12/28 19:26:01 UTC
[PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
necouchman opened a new pull request, #470:
URL: https://github.com/apache/guacamole-server/pull/470
This PR adds to the Wake-on-LAN functionality, implementing a new function that checks the connection to the destination server both before sending the WOL packet and, again, after sending the packet. If the host responds before sending the WOL packet, there is no need to actually send the WOL packet. If the packet does get sent, then the function will attempt to connect, then wait for the specified time period and then re-try the connection.
As a by-product of this implementation, I've also added a couple of other things:
* Centralized the TCP socket connection functionality into a common function, and updated the protocols that use it (SSH and Telnet, at the moment) to use that function. I'm not sure I got this in the right place, so if there are opinions about where to move it, I'm happy to adjust.
* Implemented a shared function to convert an integer to a string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1450821759
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Looks like it's still allocating the memory? I think we'd decided to let the caller allocate the memory for it, yeah?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437863920
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Yeah, that's a fair point. I could remove the freeing, but then I'd also have to remove the automatic allocation, and make the assumption that the caller has already allocated the correct amount of memory, right? I was trying to roll as much of that into this "convenience" function as possible, but I'm open to other suggestions if that makes sense.
From what little I can gather, it isn't possible to detect if something is heap or stack allocated?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437918889
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Ah, nevermind, misunderstood what you were saying. Will switch it over to an unsigned integer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2005167403
Thanks, @kohrar! I suspect that after I converted the `guac_itoa()` function to not do the allocation itself I forgot to go back and allocate. I'll fix this up...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437879365
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
I don't think it's unreasonable to expect the caller to have to allocate enough space - that's pretty normal.
If you do want to have this allocate space itself, consider having the length of the string passed in as a pointer the way that `dest` currently is, and having it return the newly allocated string. That way there won't be any chance of somebody passing something un-freeable into the function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437925731
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Ugh, sorry I typed that backwards when I commented. `%i` is signed, and `%d` is unsigned. So this is still wrong. My bad.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437887757
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Yes. That would allow the greatest flexibility in how this function could be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1567294635
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+int guac_itoa(char* restrict dest, unsigned int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%i", integer);
Review Comment:
Fixed via rebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437886602
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
> On balance I think the first option is still better though.
By which you mean, just ditch the automatic allocation and assume that they've allocated the space for it to begin with?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437890509
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Sounds good - should be implemented as suggested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1450824514
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Yeah, sorry, you're correct. Let me fix that up...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "kohrar (via GitHub)" <gi...@apache.org>.
kohrar commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2000185842
Thanks for the PR. I gave it a try after merging it with master but can't seem to get my VNC connection to work as designed.
It seems as though the guacd thread stops immediately after sending the WoL packet, possibly after calling `guac_wol_wake_and_wait`. This is what I see in the debug logs:
```
guacd[216]: INFO: User "@129a3167-dfc7-4826-80cd-89b938108cd8" joined connection "$9068079c-9de1-4f0c-b29e-f8651ba25cf1" (1 users now present)
guacd[216]: DEBUG: Sending Wake-on-LAN packet, and pausing for 2 seconds.
guacd[216]: DEBUG: Client is using protocol version "VERSION_1_5_0"
guacd[1]: INFO: Connection "$9068079c-9de1-4f0c-b29e-f8651ba25cf1" removed.
guacd[1]: DEBUG: Unable to request termination of client process: No such process
guacd[1]: DEBUG: All child processes for connection "$9068079c-9de1-4f0c-b29e-f8651ba25cf1" have been terminated.
```
If I set wol-wake-time to 0 which (which bypasses the call to `guac_wol_wake_and_wait`), the VNC connection works once the machine comes up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437879365
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
I don't think it's unreasonable to expect the caller to have to allocate enough space - that's pretty normal. Especially for an integer value - the maximum possible length of string isn't that long.
Or, if you do want to have this allocate space itself, consider having the length of the string passed in as a pointer the way that `dest` currently is, and having it return the newly allocated string. That way there won't be any chance of somebody passing something un-freeable into the function.
On balance I think the first option is still better though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437879365
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
I don't think it's unreasonable to expect the caller to have to allocate enough space - that's pretty normal. Especially for an integer value - the maximum possible length of string isn't that long.
Or, if you do want to have this allocate space itself, consider having the length of the string passed in as a pointer the way that `dest` currently is, and having it return the newly allocated string. That way there won't be any chance of somebody passing something un-freeable into the function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437917914
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Nah - I should probably be consistent with the return type of the function and just use `size_t`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "kohrar (via GitHub)" <gi...@apache.org>.
kohrar commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2005142229
Just a quick update -- the segfault comes from [`str_port` being uninitialized before getting passed to `guac_itoa`](https://github.com/necouchman/guacamole-server/blob/working/wol-improvements/src/protocols/vnc/vnc.c#L289). After fixing that (I just hard coded a malloc of 6 bytes to it) and it seems to be working OK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437909845
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
This is a signed integer specifier (as opposed to `%i` for unsigned) but neither the type nor the documentation for this function indicate that fact.
Is that intentional?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1450818266
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
No, just didn't remove it...fixed via rebase.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1450826571
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
Okay, maybe now I've done it correctly?! LoL :facepalm:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437851223
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
What if somebody wants to write an integer value into something that can't be freed, like a stack-allocated character buffer?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2123734497
@jmuehlner Any further changes that need to be made on this one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner merged PR #470:
URL: https://github.com/apache/guacamole-server/pull/470
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1450815155
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
I'm still seeing the `free()` call - did a commit get lost?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "NickVStepin (via GitHub)" <gi...@apache.org>.
NickVStepin commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2037169879
For RDP connection "guac_socket_tcp_connect" don't work. Function "guac_wol_wake_and_wait" allways wait "wait_time" seconds.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "NickVStepin (via GitHub)" <gi...@apache.org>.
NickVStepin commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1553200290
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+int guac_itoa(char* restrict dest, unsigned int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%i", integer);
Review Comment:
correct: int str_size = snprintf(dest, 0, "%i", integer)+1; // snprinf add \0 symbol to result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "NickVStepin (via GitHub)" <gi...@apache.org>.
NickVStepin commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2124075217
I don't have any other changes.
С наилучшими пожеланиями,
Николай В.Степин
Директор информационной службы
ООО "Декор"
<http://www.evroplast.ru/> www.evroplast.ru
***@***.***> ***@***.***
+7(495) 789-6270 д.3108
Post hoc, non est propter hoc.
From: Virtually Nick ***@***.***
Sent: Wednesday, May 22, 2024 5:01 AM
To: apache/guacamole-server
Cc: NickVStepin; Comment
Subject: Re: [apache/guacamole-server] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. (PR #470)
@jmuehlner <https://github.com/jmuehlner> Any further changes that need to be made on this one?
—
Reply to this email directly, view it on GitHub <https://github.com/apache/guacamole-server/pull/470#issuecomment-2123734497> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AMQZH7YYYEP33K3QPH7H26DZDP37LAVCNFSM6AAAAABBF2OEDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTG4ZTINBZG4> .
You are receiving this because you commented. <https://github.com/notifications/beacon/AMQZH725DCTIGQ3UVFFED7DZDP37LA5CNFSM6AAAAABBF2OEDKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT6SWO6C.gif> Message ID: ***@***.***>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2125202384
> @jmuehlner Any further changes that need to be made on this one?
Nope, looks reasonable to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437879365
##########
src/libguac/string.c:
##########
@@ -44,6 +45,22 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Make sure memory is cleared. */
+ guac_mem_free(dest);
Review Comment:
I don't think it's unreasonable to expect the caller to have to allocate enough space - that's pretty normal. Especially for an integer value - the maximum possible length of string isn't that long.
If you do want to have this allocate space itself, consider having the length of the string passed in as a pointer the way that `dest` currently is, and having it return the newly allocated string. That way there won't be any chance of somebody passing something un-freeable into the function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437950219
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Actually, according to the man page for the `*printf` functions:
```
d, i The int argument is converted to signed decimal notation. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires
fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
o, u, x, X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation. The letters abcdef are used for x conver‐
sions; the letters ABCDEF are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer
digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
```
So, seems like maybe I should try "%u", instead??
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Actually, according to the man page for the `*printf` functions:
```
d, i The int argument is converted to signed decimal notation. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires
fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
o, u, x, X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation. The letters abcdef are used for x conver‐
sions; the letters ABCDEF are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer
digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
```
So, seems like maybe I should try `%u`, instead??
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437950219
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Actually, according to the man page for the `*printf` functions:
```
d, i The int argument is converted to signed decimal notation. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires
fewer digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
o, u, x, X
The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation. The letters abcdef are used for x conver‐
sions; the letters ABCDEF are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer
digits, it is padded on the left with zeros. The default precision is 1. When 0 is printed with an explicit precision 0, the output is empty.
```
So, seems like maybe I should try "u", instead??
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "jmuehlner (via GitHub)" <gi...@apache.org>.
jmuehlner commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437925731
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Ugh, sorry I typed that backwards when I commented. `%i` is signed, and `%d` is unsigned. So this is still wrong. My bad.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on code in PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#discussion_r1437920570
##########
src/libguac/string.c:
##########
@@ -44,6 +45,16 @@
*/
#define REMAINING(n, length) (((n) < (length)) ? 0 : ((n) - (length)))
+size_t guac_itoa(char* restrict dest, int integer) {
+
+ /* Determine size of string. */
+ int str_size = snprintf(dest, 0, "%d", integer);
Review Comment:
Okay, changed it to "%i" and updated the function documentation and the type to make it `unsigned`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GUACAMOLE-1686: Make WOL functionality capable of testing connectivity to the server. [guacamole-server]
Posted by "necouchman (via GitHub)" <gi...@apache.org>.
necouchman commented on PR #470:
URL: https://github.com/apache/guacamole-server/pull/470#issuecomment-2018947279
> Just a quick update -- the segfault comes from [`str_port` being uninitialized before getting passed to `guac_itoa`](https://github.com/necouchman/guacamole-server/blob/working/wol-improvements/src/protocols/vnc/vnc.c#L289). After fixing that (I just hard coded a malloc of 6 bytes to it) and it seems to be working OK.
Apparently I had already fixed this in my git code, but not pushed it :facepalm:. Should be fixed, now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org