~ubuntu-branches/ubuntu/vivid/libssh2/vivid-proposed

« back to all changes in this revision

Viewing changes to src/session.c

  • Committer: Bazaar Package Importer
  • Author(s): Mikhail Gusarov
  • Date: 2010-02-28 13:11:14 UTC
  • mto: (1.1.6 upstream) (2.1.8 sid)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20100228131114-g8d2ps9p1u8i80s3
Tags: upstream-1.2.4
ImportĀ upstreamĀ versionĀ 1.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
 
112
112
        ret = _libssh2_recv(session->socket_fd, &c, 1,
113
113
                            LIBSSH2_SOCKET_RECV_FLAGS(session));
 
114
        if (ret < 0)
 
115
            _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
 
116
                           "Error recving %d bytes to %p: %d", 1, &c, errno);
 
117
        else
 
118
            _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
 
119
                           "Recved %d bytes to %p", ret, &c);
114
120
 
115
121
        if (ret < 0) {
116
122
            if (errno == EAGAIN) {
162
168
    }
163
169
    memcpy(session->remote.banner, session->banner_TxRx_banner, banner_len);
164
170
    session->remote.banner[banner_len] = '\0';
165
 
    _libssh2_debug(session, LIBSSH2_DBG_TRANS, "Received Banner: %s",
 
171
    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Received Banner: %s",
166
172
                   session->remote.banner);
167
173
    return 0;
168
174
}
203
209
            banner[255] = '\0';
204
210
        }
205
211
 
206
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS, "Sending Banner: %s",
 
212
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Sending Banner: %s",
207
213
                       banner_dup);
208
214
#endif
209
215
 
217
223
                        banner + session->banner_TxRx_total_send,
218
224
                        banner_len - session->banner_TxRx_total_send,
219
225
                        LIBSSH2_SOCKET_SEND_FLAGS(session));
 
226
    if (ret < 0)
 
227
        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
 
228
                       "Error sending %d bytes: %d",
 
229
                       banner_len - session->banner_TxRx_total_send, errno);
 
230
    else
 
231
        _libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
 
232
                       "Sent %d/%d bytes at %p+%d", ret,
 
233
                       banner_len - session->banner_TxRx_total_send,
 
234
                       banner, session->banner_TxRx_total_send);
220
235
 
221
236
    if (ret != (banner_len - session->banner_TxRx_total_send)) {
222
237
        if ((ret > 0) || ((ret == -1) && (errno == EAGAIN))) {
395
410
 
396
411
    memcpy(session->local.banner, banner, banner_len);
397
412
    session->local.banner[banner_len] = '\0';
398
 
    _libssh2_debug(session, LIBSSH2_DBG_TRANS, "Setting local Banner: %s",
 
413
    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Setting local Banner: %s",
399
414
                   session->local.banner);
400
415
    session->local.banner[banner_len++] = '\r';
401
416
    session->local.banner[banner_len++] = '\n';
441
456
        session->realloc = local_realloc;
442
457
        session->abstract = abstract;
443
458
        session->api_block_mode = 1; /* blocking API by default */
444
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS,
 
459
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
445
460
                       "New session resource allocated");
446
461
        libssh2_crypto_init();
447
462
    }
490
505
        return oldcb;
491
506
 
492
507
    }
493
 
    _libssh2_debug(session, LIBSSH2_DBG_TRANS, "Setting Callback %d", cbtype);
 
508
    _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Setting Callback %d", cbtype);
494
509
 
495
510
    return NULL;
496
511
}
540
555
    int rc;
541
556
 
542
557
    if (session->startup_state == libssh2_NB_state_idle) {
543
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS,
 
558
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
544
559
                       "session_startup for socket %d", sock);
545
 
        /* FIXME: on some platforms (like win32) sockets are unsigned */
546
 
        if (sock < 0) {
 
560
        if (INVALID_SOCKET == sock) {
547
561
            /* Did we forget something? */
548
562
            libssh2_error(session, LIBSSH2_ERROR_SOCKET_NONE,
549
563
                          "Bad socket provided", 0);
595
609
    }
596
610
 
597
611
    if (session->startup_state == libssh2_NB_state_sent2) {
598
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS,
 
612
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
599
613
                       "Requesting userauth service");
600
614
 
601
615
        /* Request the userauth service */
686
700
    LIBSSH2_LISTENER *l;
687
701
 
688
702
    if (session->free_state == libssh2_NB_state_idle) {
689
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS, "Freeing session resource",
 
703
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS, "Freeing session resource",
690
704
                       session->remote.banner);
691
705
 
692
706
        session->state = libssh2_NB_state_created;
946
960
    int rc;
947
961
 
948
962
    if (session->disconnect_state == libssh2_NB_state_idle) {
949
 
        _libssh2_debug(session, LIBSSH2_DBG_TRANS,
 
963
        _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
950
964
                       "Disconnecting: reason=%d, desc=%s, lang=%s", reason,
951
965
                       description, lang);
952
966
        if (description) {
1192
1206
_libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking)
1193
1207
{
1194
1208
    int bl = session->api_block_mode;
1195
 
    _libssh2_debug(session, LIBSSH2_DBG_CONN,
 
1209
    _libssh2_debug(session, LIBSSH2_TRACE_CONN,
1196
1210
                   "Setting blocking mode %s", blocking?"ON":"OFF");
1197
1211
    session->api_block_mode = blocking;
1198
1212