| 324 | } |
| 325 | |
| 326 | int |
| 327 | SocksProxy::state_read_socks4_client_request([[maybe_unused]] int event, [[maybe_unused]] void *data) |
| 328 | { |
| 329 | ink_assert(state == SOCKS_ACCEPT); |
| 330 | |
| 331 | int64_t n = reader->block_read_avail(); |
| 332 | /* Socks v4 request: |
| 333 | * VN CD DSTPORT DSTIP USERID NUL |
| 334 | * 1 + 1 + 2 + 4 + ? + 1 |
| 335 | * |
| 336 | * so the minimum length is 9 bytes |
| 337 | */ |
| 338 | if (n < 9) { |
| 339 | return EVENT_CONT; |
| 340 | } |
| 341 | |
| 342 | unsigned char *p = (unsigned char *)reader->start(); |
| 343 | int i; |
| 344 | // Skip UserID |
| 345 | for (i = 8; i < n && p[i] != 0; i++) { |
| 346 | ; |
| 347 | } |
| 348 | |
| 349 | if (p[i] == 0) { |
| 350 | port = p[2] * 256 + p[3]; |
| 351 | clientVC->socks_addr.type = SOCKS_ATYPE_IPV4; |
| 352 | reader->consume(i + 1); |
| 353 | state = AUTH_DONE; |
| 354 | |
| 355 | return parse_socks_client_request(p); |
| 356 | } else { |
| 357 | Dbg(dbg_ctl_SocksProxy, "Need more data to parse userid for Socks: %d\n", p[0]); |
| 358 | return EVENT_CONT; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | int |
| 363 | SocksProxy::state_read_socks5_client_auth_methods([[maybe_unused]] int event, [[maybe_unused]] void *data) |
nothing calls this directly
no test coverage detected