[or-cvs] cleanup: use strcmpstart() in more places
Roger Dingledine
arma at seul.org
Thu Sep 23 22:18:52 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuituse.c connection_edge.c connection_or.c directory.c
router.c routerparse.c test.c
Log Message:
cleanup: use strcmpstart() in more places
Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuituse.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- circuituse.c 18 Aug 2004 20:34:43 -0000 1.11
+++ circuituse.c 23 Sep 2004 22:18:49 -0000 1.12
@@ -79,7 +79,7 @@
/* 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)) {
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- connection_edge.c 21 Sep 2004 18:12:12 -0000 1.208
+++ connection_edge.c 23 Sep 2004 22:18:49 -0000 1.209
@@ -957,7 +957,7 @@
/* 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,
Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- connection_or.c 15 Aug 2004 05:28:09 -0000 1.124
+++ connection_or.c 23 Sep 2004 22:18:50 -0000 1.125
@@ -218,7 +218,7 @@
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;
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- directory.c 21 Sep 2004 18:09:38 -0000 1.127
+++ directory.c 23 Sep 2004 22:18:50 -0000 1.128
@@ -623,7 +623,7 @@
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;
@@ -709,7 +709,7 @@
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);
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- router.c 8 Sep 2004 07:16:33 -0000 1.86
+++ router.c 23 Sep 2004 22:18:50 -0000 1.87
@@ -397,7 +397,7 @@
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;
}
Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- routerparse.c 2 Sep 2004 18:39:59 -0000 1.38
+++ routerparse.c 23 Sep 2004 22:18:50 -0000 1.39
@@ -591,7 +591,7 @@
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++;
Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- test.c 2 Sep 2004 18:22:51 -0000 1.113
+++ test.c 23 Sep 2004 22:18:50 -0000 1.114
@@ -869,8 +869,7 @@
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));
More information about the tor-commits
mailing list