| 525 | } |
| 526 | |
| 527 | int |
| 528 | loadSocksAuthInfo(swoc::TextView content, socks_conf_struct *socks_stuff) |
| 529 | { |
| 530 | static constexpr swoc::TextView PREFIX = "auth u "; |
| 531 | std::string text; |
| 532 | |
| 533 | while (content.ltrim_if(&isspace)) { |
| 534 | auto line = content.take_prefix_at('\n'); |
| 535 | |
| 536 | if (line.starts_with(PREFIX)) { |
| 537 | line.remove_prefix(PREFIX.size()).ltrim_if(&isspace); |
| 538 | auto user_name = line.take_prefix_if(&isspace); |
| 539 | auto password = line.take_prefix_if(&isspace); |
| 540 | |
| 541 | if (!user_name.empty() && !password.empty()) { |
| 542 | Dbg(dbg_ctl_Socks, "%s", swoc::bwprint(text, "Read auth credentials \"{}\" : \"{}\"", user_name, password).c_str()); |
| 543 | swoc::bwprint(socks_stuff->user_name_n_passwd, "{}{}{}{}", static_cast<char>(user_name.size()), user_name, |
| 544 | static_cast<char>(password.size()), password); |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | return 0; |
| 549 | } |
| 550 | |
| 551 | swoc::Errata |
| 552 | loadSocksIPAddrs(swoc::TextView content, socks_conf_struct *socks_stuff) |
no test coverage detected