Commit ed5dce22 authored by Johannes Schilling's avatar Johannes Schilling
Browse files

use USERID:UNIX and only 10 bytes MAC

this makes us compatible with (among others) again, albeit
slightly lying about the type userid (which no one really seems to care
about anyway)
parent cb4dd43d
......@@ -41,7 +41,10 @@ import (
const (
MacBytes = 12 // how many bytes of the hash we send in the ident response
// how many bytes of the hash we send in the ident response. note that some
// servers don't use more than 10 bytes (e.g. freenode) or can't handle more
// than 10 bytes (e.g., so be careful when increasing
MacBytes = 10
func main() {
......@@ -144,7 +147,10 @@ func handleIdentRequest(c net.Conn, hmacSecret []byte) error {
fmt.Fprintln(mac, uid)
macHex := hex.EncodeToString(mac.Sum(nil))
_, err = fmt.Fprintf(c, "%d,%d:USERID:OTHER:%s\r\n",
// we are well aware what we're sending isn't actually a UNIX userid. some
// servers (notably don't handle OTHER well, so we just claim
// UNIX, which all servers we tested can handle.
_, err = fmt.Fprintf(c, "%d,%d:USERID:UNIX:%s\r\n",
lPort, rPort, macHex[:MacBytes])
if err != nil {
return err
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment