~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to nchan.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenBSD: nchan.c,v 1.57 2006/08/03 03:34:42 deraadt Exp $ */
 
1
/* $OpenBSD: nchan.c,v 1.60 2008/06/30 12:16:02 djm Exp $ */
2
2
/*
3
3
 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl.  All rights reserved.
4
4
 *
32
32
#include <string.h>
33
33
#include <stdarg.h>
34
34
 
 
35
#include "openbsd-compat/sys-queue.h"
35
36
#include "ssh1.h"
36
37
#include "ssh2.h"
37
38
#include "buffer.h"
77
78
static void     chan_send_oclose1(Channel *);
78
79
static void     chan_send_close2(Channel *);
79
80
static void     chan_send_eof2(Channel *);
 
81
static void     chan_send_eow2(Channel *);
80
82
 
81
83
/* helper */
82
84
static void     chan_shutdown_write(Channel *);
305
307
                break;
306
308
        }
307
309
}
 
310
void
 
311
chan_rcvd_eow(Channel *c)
 
312
{
 
313
        debug2("channel %d: rcvd eow", c->self);
 
314
        switch (c->istate) {
 
315
        case CHAN_INPUT_OPEN:
 
316
                chan_shutdown_read(c);
 
317
                chan_set_istate(c, CHAN_INPUT_CLOSED);
 
318
                break;
 
319
        }
 
320
}
308
321
static void
309
322
chan_rcvd_eof2(Channel *c)
310
323
{
321
334
        case CHAN_OUTPUT_OPEN:
322
335
        case CHAN_OUTPUT_WAIT_DRAIN:
323
336
                chan_shutdown_write(c);
 
337
                if (strcmp(c->ctype, "session") == 0)
 
338
                        chan_send_eow2(c);
324
339
                chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
325
340
                break;
326
341
        default:
363
378
                c->flags |= CHAN_CLOSE_SENT;
364
379
        }
365
380
}
 
381
static void
 
382
chan_send_eow2(Channel *c)
 
383
{
 
384
        debug2("channel %d: send eow", c->self);
 
385
        if (c->ostate == CHAN_OUTPUT_CLOSED) {
 
386
                error("channel %d: must not sent eow on closed output",
 
387
                    c->self);
 
388
                return;
 
389
        }
 
390
        packet_start(SSH2_MSG_CHANNEL_REQUEST);
 
391
        packet_put_int(c->remote_id);
 
392
        packet_put_cstring("eow@openssh.com");
 
393
        packet_put_char(0);
 
394
        packet_send();
 
395
}
366
396
 
367
397
/* shared */
368
398