Complete IRCv3 SASL 3.2 login for PLAIN

Turn the PLAIN verification exchange into a full account login:

- Advertise the mechanism list to the uplink as `saslmechlist` network
  metadata, so clients see `sasl=PLAIN` in CAP LS (SASL 3.2).
- On a valid response set the client's `accountname` metadata (drives
  RPL_LOGGEDIN 900) before reporting success (D S, drives 903); a bad
  credential or unknown mechanism reports failure (D F, drives 904).
- Reassemble the base64 response from the uplink's 400-byte AUTHENTICATE
  chunks, ending on a short chunk or a lone "+", with an upper bound to
  cap a pre-auth client's buffer.
- Log the user in on NickServ REGISTER and IDENTIFY too, through the same
  accountname metadata, and return the canonical account name from the
  store so the login keeps its registered casing.

Verified against irctest server_tests/sasl.py (PLAIN success/failure,
non-ASCII, no-authzid, chunked payloads, unknown mechanism, too-long,
retry) on InspIRCd + fedserv.
This commit is contained in:
Jean Chevronnet 2026-07-12 00:36:51 +00:00
parent 63028d99e5
commit 65deeef2f7
No known key found for this signature in database
6 changed files with 117 additions and 28 deletions

View file

@ -159,6 +159,10 @@ impl Protocol for InspIrcd {
}
vec![self.from_us(line)]
}
// METADATA <target> <key> :<value> — "*" is server-global metadata.
NetAction::Metadata { target, key, value } => {
vec![self.from_us(format!("METADATA {} {} :{}", target, key, value))]
}
NetAction::Raw(s) => vec![s.clone()],
}
}