summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-05-11 18:06:12 -0400
committerNick Mathewson <nickm@torproject.org>2012-05-11 18:06:12 -0400
commit31eb73f88e858d4dedceb4a748cab5c068896036 (patch)
treed2c42035c1c70778772ad84424fd78dbb56858f4 /src
parenta2f0e7a65bb2397087ce92cf23149686185de8e9 (diff)
downloadtor-31eb73f88e858d4dedceb4a748cab5c068896036.tar.gz
tor-31eb73f88e858d4dedceb4a748cab5c068896036.zip
Do not publish the "git-XXX" tag in server descriptors
Instead, allow packagers to put a 'TOR_BUILD_TAG' field in the server descriptor to indicate a platform-specific value, if they need to. (According to weasel, this was his use for the git- tag previously.) This is part of 2988
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c22
-rw-r--r--src/or/config.h1
-rw-r--r--src/or/router.c2
3 files changed, 22 insertions, 3 deletions
diff --git a/src/or/config.c b/src/or/config.c
index d11835463b..dcc57f8e77 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -783,6 +783,7 @@ extern const char tor_git_revision[]; /* from tor_main.c */
/** The version of this Tor process, as parsed. */
static char *the_tor_version = NULL;
+static char *the_short_tor_version = NULL;
/** Return the current Tor version. */
const char *
@@ -790,14 +791,31 @@ get_version(void)
{
if (the_tor_version == NULL) {
if (strlen(tor_git_revision)) {
- tor_asprintf(&the_tor_version, "%s (git-%s)", VERSION, tor_git_revision);
+ tor_asprintf(&the_tor_version, "%s (git-%s)", get_short_version(),
+ tor_git_revision);
} else {
- the_tor_version = tor_strdup(VERSION);
+ the_tor_version = tor_strdup(get_short_version());
}
}
return the_tor_version;
}
+/** Return the current Tor version, without any git tag. */
+const char *
+get_short_version(void)
+{
+
+ if (the_short_tor_version == NULL) {
+#ifdef TOR_BUILD_TAG
+ tor_asprintf(&the_short_tor_version, "%s (%s)", VERSION, TOR_BUILD_TAG);
+#else
+ the_short_tor_version = tor_strdup(VERSION);
+#endif
+ }
+ return the_short_tor_version;
+}
+
+
/** Release additional memory allocated in options
*/
static void
diff --git a/src/or/config.h b/src/or/config.h
index 0495186514..a68a3e3113 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -22,6 +22,7 @@ const char *safe_str(const char *address);
const char *escaped_safe_str_client(const char *address);
const char *escaped_safe_str(const char *address);
const char *get_version(void);
+const char *get_short_version(void);
int config_get_lines(const char *string, config_line_t **result, int extended);
void config_free_lines(config_line_t *front);
diff --git a/src/or/router.c b/src/or/router.c
index 4468c7b26a..a967f0dc4b 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -1949,7 +1949,7 @@ router_guess_address_from_dir_headers(uint32_t *guess)
void
get_platform_str(char *platform, size_t len)
{
- tor_snprintf(platform, len, "Tor %s on %s", get_version(), get_uname());
+ tor_snprintf(platform, len, "Tor %s on %s", get_short_version(), get_uname());
}
/* XXX need to audit this thing and count fenceposts. maybe