Commit db3efd1
Fix SSH agent forwarding handled in wrong request handler
Move auth-agent-req@openssh.com handling from handleGlobalRequests
(SSH_MSG_GLOBAL_REQUEST) to handleSession (SSH_MSG_CHANNEL_REQUEST),
matching the SSH spec and what real clients like Go's
agent.RequestAgentForwarding() actually send.
The old handler was dead code — real clients send this as a session
channel request, which hit the default reject case in handleSession.
Tests passed only because they used client.SendRequest() (global)
instead of session-scoped requests.
Tests now use agent.RequestAgentForwarding(session) to exercise the
correct code path, including a same-session end-to-end test that
verifies SSH_AUTH_SOCK is set.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 490e9b7 commit db3efd1
3 files changed
Lines changed: 47 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 281 | + | |
| 282 | + | |
303 | 283 | | |
304 | 284 | | |
305 | 285 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
334 | 338 | | |
335 | 339 | | |
336 | 340 | | |
| |||
352 | 356 | | |
353 | 357 | | |
354 | 358 | | |
355 | | - | |
356 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
357 | 369 | | |
358 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
359 | 376 | | |
360 | 377 | | |
361 | 378 | | |
| |||
377 | 394 | | |
378 | 395 | | |
379 | 396 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
| 397 | + | |
| 398 | + | |
386 | 399 | | |
387 | 400 | | |
388 | 401 | | |
389 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
390 | 406 | | |
391 | 407 | | |
392 | 408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
122 | 136 | | |
123 | 137 | | |
124 | 138 | | |
| |||
0 commit comments