Changeset 538 for trunk/src/ocatctrl.c
- Timestamp:
- 01/24/10 19:55:24 (2 years ago)
- File:
-
- 1 edited
-
trunk/src/ocatctrl.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ocatctrl.c
r535 r538 38 38 int fd, c; 39 39 FILE *ff, *fo; 40 char buf[FRAME_SIZE], addrstr[INET6_ADDRSTRLEN], onionstr[NDESC(name_size)], timestr[32], *s, *tokbuf ;40 char buf[FRAME_SIZE], addrstr[INET6_ADDRSTRLEN], onionstr[NDESC(name_size)], timestr[32], *s, *tokbuf, *bufp; 41 41 int rlen, cfd; 42 42 struct tm *tm; … … 72 72 } 73 73 log_debug("fd %d fdopen'ed \"r\"", fd); 74 fo = CNF(logf) ;74 fo = CNF(logf) ? CNF(logf) : stderr; 75 75 //CNF(config_read) = 1; 76 76 } … … 133 133 continue; 134 134 135 if (! strtok_r(buf, " \t\r\n", &tokbuf))135 if (!(bufp = strtok_r(buf, " \t\r\n", &tokbuf))) 136 136 continue; 137 137 138 138 // "exit"/"quit" => terminate thread 139 if (!strncmp(buf , "exit", 4) || !strncmp(buf, "quit", 4))139 if (!strncmp(bufp, "exit", 4) || !strncmp(bufp, "quit", 4)) 140 140 break; 141 141 // "status" 142 else if (!strcmp(buf , "status"))142 else if (!strcmp(bufp, "status")) 143 143 { 144 144 lock_peers(); … … 159 159 unlock_peers(); 160 160 } 161 else if (!strcmp(buf , "close"))162 { 163 cfd = atoi( &buf[6]);161 else if (!strcmp(bufp, "close")) 162 { 163 cfd = atoi(bufp +6); 164 164 lock_peers(); 165 165 for (peer = get_first_peer(); peer; peer = peer->next) … … 178 178 unlock_peers(); 179 179 } 180 else if (!strcmp(buf , "threads"))180 else if (!strcmp(bufp, "threads")) 181 181 { 182 182 print_threads(ff); 183 183 } 184 else if (!strcmp(buf , "terminate"))184 else if (!strcmp(bufp, "terminate")) 185 185 { 186 186 log_msg(LOG_INFO, "terminate request from control port"); 187 187 kill(getpid(), SIGINT); 188 188 } 189 else if (!strcmp(buf , "route"))189 else if (!strcmp(bufp, "route")) 190 190 { 191 191 if (rlen > 6) 192 192 { 193 if ((c = parse_route( &buf[6])) == E_RT_SYNTAX)194 if ((c = ipv6_parse_route( &buf[6])) > 0)193 if ((c = parse_route(bufp + 6)) == E_RT_SYNTAX) 194 if ((c = ipv6_parse_route(bufp + 6)) > 0) 195 195 c = 0; 196 196 switch (c) … … 224 224 } 225 225 } 226 else if (!strcmp(buf , "connect"))226 else if (!strcmp(bufp, "connect")) 227 227 { 228 228 if ((s = strtok_r(NULL, " \t\r\n", &tokbuf))) 229 229 { 230 230 if ((strlen(s) != 16) || (oniontipv6(s, &in6) == -1)) 231 fprintf(ff, "ERR \"%s\" not valid .onion-URL\n", &buf[8]);231 fprintf(ff, "ERR \"%s\" not valid .onion-URL\n", bufp + 8); 232 232 else 233 233 { … … 243 243 fprintf(ff, "ERR missing args\n"); 244 244 } 245 else if (!strcmp(buf , "macs"))245 else if (!strcmp(bufp, "macs")) 246 246 { 247 247 print_mac_tbl(ff); 248 248 } 249 else if (!strcmp(buf , "queue"))249 else if (!strcmp(bufp, "queue")) 250 250 { 251 251 print_socks_queue((FILE*) (long) pfd[1]); … … 258 258 } 259 259 } 260 else if (!strcmp(buf , "setup"))260 else if (!strcmp(bufp, "setup")) 261 261 { 262 262 print_setup_struct(ff); 263 263 } 264 else if (!strcmp(buf , "version"))264 else if (!strcmp(bufp, "version")) 265 265 { 266 266 fprintf(ff, "%s\n", CNF(version)); 267 267 } 268 else if (!strcmp(buf , "help") || !strcmp(buf, "?"))268 else if (!strcmp(bufp, "help") || !strcmp(bufp, "?")) 269 269 { 270 270 fprintf(fo,
Note: See TracChangeset
for help on using the changeset viewer.
