# # # patch "ssh_agent.cc" # from [dc41be80d965330d70731b00cafbc9d41978944b] # to [49184ca51f397eb5112fa6e190c6c06b62cea36a] # # patch "unix/ssh_agent_platform.cc" # from [f037df9bd9f715c860fc427da164d8bb067304cf] # to [1dcaa45083e55c495dbc9e8ecd445e17d9b0d513] # ============================================================ --- ssh_agent.cc dc41be80d965330d70731b00cafbc9d41978944b +++ ssh_agent.cc 49184ca51f397eb5112fa6e190c6c06b62cea36a @@ -245,19 +245,10 @@ ssh_agent::get_keys() return keys; } - string out("\0\0\0\11", 4); - /* - unsigned int ch; - void * v = (void *)&ch; - ch = 0; - stream->write(v, 1); - stream->write(v, 1); - stream->write(v, 1); - ch = 1; - stream->write(v, 1); - ch = 11; - stream->write(v, 1); - */ + string out("\0\0\0\1", 4); + char ch[1]; + ch[0] = 11; + out.append(ch, 1); write_data(out); string packet; fetch_packet(packet); ============================================================ --- unix/ssh_agent_platform.cc f037df9bd9f715c860fc427da164d8bb067304cf +++ unix/ssh_agent_platform.cc 1dcaa45083e55c495dbc9e8ecd445e17d9b0d513 @@ -72,6 +72,7 @@ ssh_agent_platform::write_data(string co void ssh_agent_platform::write_data(string const & data) { + L(FL("ssh_agent_platform::write_data: asked to write %u bytes") % data.length()); stream->write(data.c_str(), data.length()); } @@ -82,15 +83,17 @@ ssh_agent_platform::read_data(u32 const const u32 bufsize = 4096; char read_buf[bufsize]; u32 get = len; + L(FL("ssh_agent: read_data: asked to read %u bytes") % len); while (get > 0) { ret = stream->read(read_buf, min(get, bufsize)); E(ret >= 0, F("stream read failed (%i)") % ret); + /* if (ret > 0) - L(FL("ssh_agent: read_num_bytes: read %i bytes") % ret); + L(FL("ssh_agent: read_data: read %i bytes") % ret); + */ out.append(read_buf, ret); get -= ret; } - L(FL("ssh_agent: read_num_bytes: get: %u") % get); - L(FL("ssh_agent: read_num_bytes: length %u") % out.length()); + E(get == 0, F("%u extra bytes from ssh-agent") % -get); }