=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/clientloop.c,v retrieving revision 1.381 retrieving revision 1.382 diff -u -r1.381 -r1.382 --- src/usr.bin/ssh/clientloop.c 2022/11/09 01:37:44 1.381 +++ src/usr.bin/ssh/clientloop.c 2022/11/10 23:03:10 1.382 @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.381 2022/11/09 01:37:44 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.382 2022/11/10 23:03:10 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -837,8 +837,15 @@ } logit("Canceled forwarding."); } else { - if (!parse_forward(&fwd, s, dynamic, remote)) { - logit("Bad forwarding specification."); + /* -R specs can be both dynamic or not, so check both. */ + if (remote) { + if (!parse_forward(&fwd, s, 0, remote) && + !parse_forward(&fwd, s, 1, remote)) { + logit("Bad remote forwarding specification."); + goto out; + } + } else if (!parse_forward(&fwd, s, dynamic, remote)) { + logit("Bad local forwarding specification."); goto out; } if (local || dynamic) {