Lines Matching defs:fwd
3752 struct Forward *fwd, int *allocated_listen_port,
3764 if (is_client && fwd->connect_path != NULL) {
3765 host = fwd->connect_path;
3768 fwd->listen_host : fwd->connect_host;
3780 addr = channel_fwd_bind_addr(ssh, fwd->listen_host, &wildcard,
3793 snprintf(strport, sizeof strport, "%d", fwd->listen_port);
3825 fwd->listen_port == 0 && allocated_listen_port != NULL &&
3869 * fwd->listen_port == 0 requests a dynamically allocated port -
3873 fwd->listen_port == 0 &&
3886 c->host_port = fwd->connect_port;
3888 if (fwd->listen_port == 0 && allocated_listen_port != NULL &&
3892 c->listening_port = fwd->listen_port;
3896 error_f("cannot listen to port: %d", fwd->listen_port);
3903 struct Forward *fwd, struct ForwardOptions *fwd_opts)
3913 if (fwd->connect_path != NULL) {
3914 if (strlen(fwd->connect_path) > sizeof(sunaddr.sun_path)) {
3916 fwd->connect_path);
3919 path = fwd->connect_path;
3922 if (fwd->connect_host == NULL) {
3926 if (strlen(fwd->connect_host) >= NI_MAXHOST) {
3930 path = fwd->connect_host;
3931 port = fwd->connect_port;
3935 path = fwd->listen_path;
3943 if (fwd->listen_path == NULL) {
3947 if (strlen(fwd->listen_path) > sizeof(sunaddr.sun_path)) {
3948 error("Local listening path too long: %s", fwd->listen_path);
3952 debug3_f("type %d path %s", type, fwd->listen_path);
3956 sock = unix_listener(fwd->listen_path, SSH_LISTEN_BACKLOG,
3962 debug("Local forwarding listening on path %s.", fwd->listen_path);
3971 c->listening_addr = xstrdup(fwd->listen_path);
4019 channel_cancel_rport_listener(struct ssh *ssh, struct Forward *fwd)
4021 if (fwd->listen_path != NULL) {
4023 fwd->listen_path);
4026 fwd->listen_host, fwd->listen_port);
4095 struct Forward *fwd, int cport, struct ForwardOptions *fwd_opts)
4097 if (fwd->listen_path != NULL) {
4099 fwd->listen_path);
4102 fwd->listen_host, fwd->listen_port, cport, fwd_opts);
4106 /* protocol local port fwd, used by ssh */
4109 struct Forward *fwd, struct ForwardOptions *fwd_opts)
4111 if (fwd->listen_path != NULL) {
4113 SSH_CHANNEL_UNIX_LISTENER, fwd, fwd_opts);
4116 SSH_CHANNEL_PORT_LISTENER, fwd, NULL, fwd_opts);
4122 remote_open_match(struct permission *allowed_open, struct Forward *fwd)
4128 if (fwd->listen_path != NULL)
4131 if (fwd->listen_host == NULL || allowed_open->listen_host == NULL)
4135 allowed_open->listen_port != fwd->listen_port)
4139 lhost = xstrdup(fwd->listen_host);
4149 check_rfwd_permission(struct ssh *ssh, struct Forward *fwd)
4162 if (remote_open_match(perm, fwd)) {
4173 if (remote_open_match(perm, fwd)) {
4183 /* protocol v2 remote port fwd, used by sshd */
4185 channel_setup_remote_fwd_listener(struct ssh *ssh, struct Forward *fwd,
4188 if (!check_rfwd_permission(ssh, fwd)) {
4190 if (fwd->listen_path != NULL)
4196 fwd->listen_path);
4197 else if(fwd->listen_host != NULL)
4202 fwd->listen_host, fwd->listen_port );
4209 if (fwd->listen_path != NULL) {
4211 SSH_CHANNEL_RUNIX_LISTENER, fwd, fwd_opts);
4214 SSH_CHANNEL_RPORT_LISTENER, fwd, allocated_listen_port,
4241 channel_request_remote_forwarding(struct ssh *ssh, struct Forward *fwd)
4248 if (fwd->listen_path != NULL) {
4253 (r = sshpkt_put_cstring(ssh, fwd->listen_path)) != 0 ||
4262 channel_rfwd_bind_host(fwd->listen_host))) != 0 ||
4263 (r = sshpkt_put_u32(ssh, fwd->listen_port)) != 0 ||
4274 if (fwd->connect_path != NULL) {
4275 host_to_connect = fwd->connect_path;
4278 host_to_connect = fwd->connect_host;
4279 port_to_connect = fwd->connect_port;
4281 if (fwd->listen_path != NULL) {
4282 listen_path = fwd->listen_path;
4285 listen_host = fwd->listen_host;
4286 listen_port = fwd->listen_port;
4429 channel_request_rforward_cancel(struct ssh *ssh, struct Forward *fwd)
4431 if (fwd->listen_path != NULL) {
4433 fwd->listen_path);
4436 fwd->listen_host,
4437 fwd->listen_port ? fwd->listen_port : fwd->allocated_port);