static int s_write(Ssh ssh, void *data, int len)
{
- log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len, 0, NULL);
+ if (ssh->logctx)
+ log_packet(ssh->logctx, PKT_OUTGOING, -1, NULL, data, len, 0, NULL);
return sk_write(ssh->s, (char *)data, len);
}
crBegin(ssh->do_ssh_init_crstate);
- /*
- * If the SSH version number's fixed, set it now, and if it's SSH-2,
- * send the version string too.
- *
- * XXX This isn't actually early enough to be useful, since we only
- * get here when the first incoming byte turns up.
- */
- if (ssh->cfg.sshprot == 0)
- ssh->version = 1;
- if (ssh->cfg.sshprot == 3) {
- ssh->version = 2;
- ssh_send_verstring(ssh, NULL);
- }
-
/* Search for a line beginning with the string "SSH-" in the input. */
for (;;) {
if (c != 'S') goto no;
static void ssh_gotdata(Ssh ssh, unsigned char *data, int datalen)
{
/* Log raw data, if we're in that mode. */
- log_packet(ssh->logctx, PKT_INCOMING, -1, NULL, data, datalen, 0, NULL);
+ if (ssh->logctx)
+ log_packet(ssh->logctx, PKT_INCOMING, -1, NULL, data, datalen,
+ 0, NULL);
crBegin(ssh->ssh_gotdata_crstate);
return err;
}
+ /*
+ * If the SSH version number's fixed, set it now, and if it's SSH-2,
+ * send the version string too.
+ */
+ if (ssh->cfg.sshprot == 0)
+ ssh->version = 1;
+ if (ssh->cfg.sshprot == 3) {
+ ssh->version = 2;
+ ssh_send_verstring(ssh, NULL);
+ }
+
return NULL;
}