Make a function that validates an HS address and can return either a reason as a string or an error code indicating the error type (maybe use errno values for that?).
int is_valid_rendservice_addr(const char *addr, char **reason);
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
This legacy/trac#14847 (moved) would use it. Also a SOCKS connection requesting a .onion would use it. More and more places in the code validate a .onion which we could simply make a function for it. Basically, every entry point in the tor code that parses a .onion would be useful.
Since I'm partly to blame for requesting this, this is also a future-proofing measure so that when we do move to Ed25519 onions, we don't have a ton of slightly different ".onion" validation checks in our code that all need to be changed.
A lot of this logic is in parse_extended_hostname; you could refactor it out of there, but you'd need to split out the part that changes the address.
I agree, I would do a simple refactor here to create a "is valid onion address" function that parse_extended_hostname could use. Simple move around code so we can have one that validates and can take a const char and the other can parse it like it does right now.