Bug 1578

Summary: Remote port forwarding with a listen port of '0' only works for root user bz #1003
Product: Portable OpenSSH Reporter: Gavin Mathias <gavin>
Component: sshdAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm, dtucker
Priority: P2    
Version: 5.2p1   
Hardware: Other   
OS: Linux   
Bug Depends on:    
Bug Blocks: 1560    
Attachments:
Description Flags
Change made to line 1123 of serverloop.c none

Description Gavin Mathias 2009-03-27 14:51:06 AEDT
Created attachment 1618 [details]
Change made to line 1123 of serverloop.c

In 5.2p1 only root can login using remote forwarding with port 0 and get a port dynamically assigned. Non root users get an error like this:

debug1: Remote: Server has disabled port forwarding.
debug1: remote forward failure for: listen 0, connect localhost:8080
Warning: remote port forwarding failed for listen port 0
debug1: All remote forwarding requests processed

when running:
ssh -v -R 0:localhost:8080 -N gavin@xxxxx.com

whereas the port is dynamically assigned as expected when the user is root
ssh -v -R 0:localhost:8080 -N root@xxxxx.com

debug1: remote forward success for: listen 0, connect localhost:80
Allocated port 49189 for remote forward to localhost:80
debug1: All remote forwarding requests processed


I fixed this in line 1123 serverloop.c. Hopefully this doesn't break something important.

Gavin
Comment 1 Damien Miller 2009-09-09 11:08:24 AEST
Fix applied. This will be in OpenSSH 5.3 - thanks!
Comment 2 Damien Miller 2009-10-06 15:03:05 AEDT
Mass move of RESOLVED bugs to CLOSED now that 5.3 is out.