mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-02 16:43:32 +01:00
Include "IMPLEMENTATION" parameter to STATUS TYPE=version PT messages.
This commit is contained in:
parent
d27ce6b8f0
commit
f459344488
@ -743,6 +743,7 @@ managed_proxy_destroy(managed_proxy_t *mp,
|
|||||||
|
|
||||||
/* free our version, if any is set. */
|
/* free our version, if any is set. */
|
||||||
tor_free(mp->version);
|
tor_free(mp->version);
|
||||||
|
tor_free(mp->implementation);
|
||||||
|
|
||||||
/* do we want to terminate our process if it's still running? */
|
/* do we want to terminate our process if it's still running? */
|
||||||
if (also_terminate_process && mp->process) {
|
if (also_terminate_process && mp->process) {
|
||||||
@ -1318,6 +1319,8 @@ handle_status_message(const config_line_t *values,
|
|||||||
/* Handle VERSION messages. */
|
/* Handle VERSION messages. */
|
||||||
if (! strcasecmp(message_type->value, "version")) {
|
if (! strcasecmp(message_type->value, "version")) {
|
||||||
const config_line_t *version = config_line_find(values, "VERSION");
|
const config_line_t *version = config_line_find(values, "VERSION");
|
||||||
|
const config_line_t *implementation = config_line_find(values,
|
||||||
|
"IMPLEMENTATION");
|
||||||
|
|
||||||
if (version == NULL) {
|
if (version == NULL) {
|
||||||
log_warn(LD_PT, "Managed proxy \"%s\" wrote a STATUS TYPE=version line "
|
log_warn(LD_PT, "Managed proxy \"%s\" wrote a STATUS TYPE=version line "
|
||||||
@ -1325,9 +1328,18 @@ handle_status_message(const config_line_t *values,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (implementation == NULL) {
|
||||||
|
log_warn(LD_PT, "Managed proxy \"%s\" wrote a STATUS TYPE=version line "
|
||||||
|
"with a missing IMPLEMENTATION field", mp->argv[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tor_free(mp->version);
|
tor_free(mp->version);
|
||||||
mp->version = tor_strdup(version->value);
|
mp->version = tor_strdup(version->value);
|
||||||
|
|
||||||
|
tor_free(mp->implementation);
|
||||||
|
mp->implementation = tor_strdup(implementation->value);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,9 @@ typedef struct {
|
|||||||
/** Version as set by STATUS TYPE=version messages. */
|
/** Version as set by STATUS TYPE=version messages. */
|
||||||
char *version;
|
char *version;
|
||||||
|
|
||||||
|
/** Implementation as set by the STATUS TYPE=version messages. */
|
||||||
|
char *implementation;
|
||||||
|
|
||||||
/* The 'transports' list contains all the transports this proxy has
|
/* The 'transports' list contains all the transports this proxy has
|
||||||
launched. */
|
launched. */
|
||||||
smartlist_t *transports;
|
smartlist_t *transports;
|
||||||
|
@ -160,12 +160,17 @@ test_pt_status_parsing(void *arg)
|
|||||||
|
|
||||||
/* STATUS TYPE=version messages. */
|
/* STATUS TYPE=version messages. */
|
||||||
tt_ptr_op(mp->version, OP_EQ, NULL);
|
tt_ptr_op(mp->version, OP_EQ, NULL);
|
||||||
strlcpy(line, "STATUS TRANSPORT=x "
|
tt_ptr_op(mp->implementation, OP_EQ, NULL);
|
||||||
|
|
||||||
|
strlcpy(line, "STATUS "
|
||||||
|
"IMPLEMENTATION=xyz "
|
||||||
"TYPE=version "
|
"TYPE=version "
|
||||||
"VERSION=\"1.33.7-hax beta\"",
|
"VERSION=\"1.33.7-hax beta\"",
|
||||||
sizeof(line));
|
sizeof(line));
|
||||||
handle_proxy_line(line, mp);
|
handle_proxy_line(line, mp);
|
||||||
|
|
||||||
tt_str_op(mp->version, OP_EQ, "1.33.7-hax beta");
|
tt_str_op(mp->version, OP_EQ, "1.33.7-hax beta");
|
||||||
|
tt_str_op(mp->implementation, OP_EQ, "xyz");
|
||||||
|
|
||||||
reset_mp(mp);
|
reset_mp(mp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user