╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────────╮ │src/serve_ssh.zig│ ╰─────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │619 -fn isKeyInAuthorizedKeys(ssh_keys: []const u8, fingerprint: *const [ssh.fingerprint_len]u8) bool {│ │620 - var it = std.mem.splitScalar(u8, ssh_keys, '\n'); │ │621 - while (it.next()) |line| { │ │622 - const fp = fingerprintOfAuthorizedKey(line) orelse continue; │ │623 - if (std.mem.eql(u8, &fp, fingerprint)) return true; │ │624 - } │ │625 - return false; │ │626 -} │ │627 - │ │628 -// the SHA256 fingerprint of one authorized_keys line, or null if the line is │ │629 -// blank or not a parseable "<type> <base64> [comment]" entry │ │630 -fn fingerprintOfAuthorizedKey(line: []const u8) ?[ssh.fingerprint_len]u8 { │ │631 - var it = std.mem.tokenizeAny(u8, line, " \t\r"); │ │632 - _ = it.next() orelse return null; // key type │ │633 - const blob_b64 = it.next() orelse return null; │ │634 - │ │635 - const decoder = std.base64.standard.Decoder; │ │636 - const blob_len = decoder.calcSizeForSlice(blob_b64) catch return null; │ │637 - var blob_buf: [4096]u8 = undefined; │ │638 - if (blob_len > blob_buf.len) return null; │ │639 - decoder.decode(blob_buf[0..blob_len], blob_b64) catch return null; │ │640 - │ │641 - return ssh.formatFingerprint(blob_buf[0..blob_len]); │ │642 -} │ │643 - │ │611 fn writeError(sess: *ssh.SessionCtx, comptime msg: []const u8) !void { │ │612 const body = "ERR haxy ssh: " ++ msg; │ │613 var packet: [body.len + 4]u8 = undefined; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯