/* 0.0.7 servers and earlier don't support DNS resolution. There are no
* ORs running code before 0.0.7, so we only worry about 0.0.7. Once all
* servers are running 0.0.8, remove this check. */
- if (!strncmp(exitrouter->platform, "Tor 0.0.7", 9))
+ if (!strcmpstart(exitrouter->platform, "Tor 0.0.7"))
return 0;
} else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) {
if(!connection_ap_can_use_exit(conn, exitrouter)) {
/* 0.0.7 servers and earlier don't support DNS resolution. There are no
* ORs running code before 0.0.7, so we only worry about 0.0.7. Once all
* servers are running 0.0.8, remove this check. XXX */
- return strncmp(exit->platform, "Tor 0.0.7", 9) ? 1 : 0;
+ return strcmpstart(exit->platform, "Tor 0.0.7") ? 1 : 0;
}
addr = client_dns_lookup_entry(conn->socks_request->address);
if(router_compare_addr_to_exit_policy(addr,
him = router_get_by_digest(conn->identity_digest);
me = router_get_my_routerinfo();
- if(him && !strncmp(him->platform, "Tor 0.0.7", 9) &&
+ if(him && !strcmpstart(him->platform, "Tor 0.0.7") &&
(!me || !me->is_verified)) {
log_fn(LOG_INFO,"He's running 0.0.7, and I'm unverified. Acting like OP.");
use_no_cert = 1;
return 0;
}
- if(!strncmp(url,rend_fetch_url,strlen(rend_fetch_url))) {
+ if(!strcmpstart(url,rend_fetch_url)) {
/* rendezvous descriptor fetch */
const char *descp;
int desc_len;
return 0;
}
- if(!strncmp(url,rend_publish_string,strlen(rend_publish_string))) {
+ if(!strcmpstart(url,rend_publish_string)) {
/* rendezvous descriptor post */
if(rend_cache_store(body, body_len) < 0)
connection_write_to_buf(answer400, strlen(answer400), conn);
int router_is_clique_mode(routerinfo_t *router) {
if(router->is_trusted_dir)
return 1;
- if(!strncmp(router->platform, "Tor 0.0.7", 9))
+ if(!strcmpstart(router->platform, "Tor 0.0.7"))
return 1;
return 0;
}
while (1) {
*s = eat_whitespace(*s);
/* Don't start parsing the rest of *s unless it contains a router. */
- if (strncmp(*s, "router ", 7)!=0)
+ if (strcmpstart(*s, "router ")!=0)
break;
if ((end = strstr(*s+1, "\nrouter "))) {
end++;
bw_lines = rep_hist_get_bandwidth_lines();
test_assert(bw_lines);
- test_assert(!strncmp(bw_lines, "opt write-history ",
- strlen("opt write-history ")));
+ test_assert(!strcmpstart(bw_lines, "opt write-history "));
test_assert(!crypto_pk_write_public_key_to_string(pk1, &pk1_str,
&pk1_str_len));