Diff

Differences From Artifact [68fbc006e2]:

To Artifact [e5819e95ce]:


435
436
437
438
439
440
441
442
443


444
445
446
447
448
449
450
435
436
437
438
439
440
441


442
443
444
445
446
447
448
449
450







-
-
+
+







#define crStateP(t, v)				\
    struct t *s; 				\
    if (!(v)) { s = (v) = snew(struct t); s->crLine = 0; }	\
    s = (v);
#define crState(t)	crStateP(t, ssh->t)
#define crFinish(z)	} *crLine = 0; return (z); }
#define crFinishV	} *crLine = 0; return; }
#define crFinishFree(z, s)	} *crLine = 0; sfree(s); return (z); }
#define crFinishFreeV(s)	} *crLine = 0; sfree(s); return; }
#define crFinishFree(z)	} sfree(s); return (z); }
#define crFinishFreeV	} sfree(s); return; }
#define crReturn(z)	\
	do {\
	    *crLine =__LINE__; return (z); case __LINE__:;\
	} while (0)
#define crReturnV	\
	do {\
	    *crLine=__LINE__; return; case __LINE__:;\
7507
7508
7509
7510
7511
7512
7513
7514

7515
7516
7517
7518
7519
7520
7521
7507
7508
7509
7510
7511
7512
7513

7514
7515
7516
7517
7518
7519
7520
7521







-
+







	    if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS) {
		logevent("X11 forwarding enabled");
		ssh->X11_fwd_enabled = TRUE;
	    } else
		logevent("X11 forwarding refused");
	}
    }
    crFinishFreeV(s);
    crFinishFreeV;
}

static void ssh2_maybe_setup_agent(struct ssh_channel *c, struct Packet *pktin,
				   void *ctx)
{
    struct ssh2_maybe_setup_agent_state {
	int crLine;
7538
7539
7540
7541
7542
7543
7544
7545

7546
7547
7548
7549
7550
7551
7552
7538
7539
7540
7541
7542
7543
7544

7545
7546
7547
7548
7549
7550
7551
7552







-
+







	    if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS) {
		logevent("Agent forwarding enabled");
		ssh->agentfwd_enabled = TRUE;
	    } else
		logevent("Agent forwarding refused");
	}
    }
    crFinishFreeV(s);
    crFinishFreeV;
}

static void ssh2_maybe_setup_pty(struct ssh_channel *c, struct Packet *pktin,
				 void *ctx)
{
    struct ssh2_maybe_setup_pty_state {
	int crLine;
7591
7592
7593
7594
7595
7596
7597
7598

7599
7600
7601
7602
7603
7604
7605
7591
7592
7593
7594
7595
7596
7597

7598
7599
7600
7601
7602
7603
7604
7605







-
+







		c_write_str(ssh, "Server refused to allocate pty\r\n");
		ssh->editing = ssh->echoing = 1;
	    }
	}
    } else {
	ssh->editing = ssh->echoing = 1;
    }
    crFinishFreeV(s);
    crFinishFreeV;
}

static void ssh2_setup_env(struct ssh_channel *c, struct Packet *pktin,
			   void *ctx)
{
    struct ssh2_setup_env_state {
	int crLine;
7655
7656
7657
7658
7659
7660
7661
7662

7663
7664
7665
7666
7667
7668
7669
7655
7656
7657
7658
7659
7660
7661

7662
7663
7664
7665
7666
7667
7668
7669







-
+







	} else {
	    logeventf(ssh, "%d environment variables refused",
		      s->num_env - s->env_ok);
	    c_write_str(ssh, "Server refused to set all environment variables\r\n");
	}
    }
  out:;
    crFinishFreeV(s);
    crFinishFreeV;
}

/*
 * Handle the SSH-2 userauth and connection layers.
 */
static void ssh2_msg_authconn(Ssh ssh, struct Packet *pktin)
{