Diff

Differences From Artifact [8fddb2d9d2]:

To Artifact [db88364e0c]:


450
451
452
453
454
455
456
457
458
459
460




461
462
463
464
465
466
467
450
451
452
453
454
455
456




457
458
459
460
461
462
463
464
465
466
467







-
-
-
-
+
+
+
+







     */
    packetlen = len + 4;
    maclen = scmac ? scmac->len : 0;

    /*
     * Adjust memory allocation if packet is too big.
     */
    if (pktin.maxlen < packetlen) {
	pktin.maxlen = packetlen;
	pktin.data = (pktin.data == NULL ? malloc(packetlen+APIEXTRA) :
	              realloc(pktin.data, packetlen+APIEXTRA));
    if (pktin.maxlen < packetlen+maclen) {
	pktin.maxlen = packetlen+maclen;
	pktin.data = (pktin.data == NULL ? malloc(pktin.maxlen+APIEXTRA) :
	              realloc(pktin.data, pktin.maxlen+APIEXTRA));
	if (!pktin.data)
	    fatalbox("Out of memory");
    }

    /*
     * Read and decrypt the remainder of the packet.
     */
2167
2168
2169
2170
2171
2172
2173
2174
2175


2176
2177
2178
2179
2180
2181
2182
2167
2168
2169
2170
2171
2172
2173


2174
2175
2176
2177
2178
2179
2180
2181
2182







-
-
+
+








    /*
     * So now create a channel with a session in it.
     */
    ssh2_pkt_init(SSH2_MSG_CHANNEL_OPEN);
    ssh2_pkt_addstring("session");
    ssh2_pkt_adduint32(100);           /* as good as any */
    ssh2_pkt_adduint32(0xFFFFFFFFUL);  /* very big window which we ignore */
    ssh2_pkt_adduint32(0xFFFFFFFFUL);  /* very big max pkt size */
    ssh2_pkt_adduint32(0x7FFFFFFFUL);  /* very big window which we ignore */
    ssh2_pkt_adduint32(0x7FFFFFFFUL);  /* very big max pkt size */
    ssh2_pkt_send();
    crWaitUntilV(ispkt);
    if (pktin.type != SSH2_MSG_CHANNEL_OPEN_CONFIRMATION) {
        fatalbox("Server refused to open a session");
        /* FIXME: error data comes back in FAILURE packet */
    }
    if (ssh2_pkt_getuint32() != 100) {