GUAC-363: Warn of invalid preconnection IDs.

This commit is contained in:
Michael Jumper 2015-11-03 15:41:28 -08:00
parent b47cff044e
commit 5d608b3500

View File

@ -780,9 +780,21 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
/* Preconnection ID */ /* Preconnection ID */
settings->preconnection_id = -1; settings->preconnection_id = -1;
if (argv[IDX_PRECONNECTION_ID][0] != '\0') { if (argv[IDX_PRECONNECTION_ID][0] != '\0') {
settings->preconnection_id = atoi(argv[IDX_PRECONNECTION_ID]);
guac_client_log(client, GUAC_LOG_DEBUG, /* Parse preconnection ID, warn if invalid */
"Preconnection ID: %i", settings->preconnection_id); int preconnection_id = atoi(argv[IDX_PRECONNECTION_ID]);
if (preconnection_id < 0)
guac_client_log(client, GUAC_LOG_WARNING,
"Ignoring invalid preconnection ID: %i",
preconnection_id);
/* Otherwise, assign specified ID */
else {
settings->preconnection_id = preconnection_id;
guac_client_log(client, GUAC_LOG_DEBUG,
"Preconnection ID: %i", settings->preconnection_id);
}
} }
/* Preconnection BLOB */ /* Preconnection BLOB */