version 1.35, 2003/11/17 11:06:07 |
version 1.36, 2004/06/21 17:36:31 |
|
|
} |
} |
|
|
void |
void |
mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) |
mm_request_send(int sock, enum monitor_reqtype type, Buffer *m) |
{ |
{ |
u_int mlen = buffer_len(m); |
u_int mlen = buffer_len(m); |
u_char buf[5]; |
u_char buf[5]; |
|
|
|
|
PUT_32BIT(buf, mlen + 1); |
PUT_32BIT(buf, mlen + 1); |
buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ |
buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */ |
if (atomicio(vwrite, socket, buf, sizeof(buf)) != sizeof(buf)) |
if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf)) |
fatal("%s: write", __func__); |
fatal("%s: write", __func__); |
if (atomicio(vwrite, socket, buffer_ptr(m), mlen) != mlen) |
if (atomicio(vwrite, sock, buffer_ptr(m), mlen) != mlen) |
fatal("%s: write", __func__); |
fatal("%s: write", __func__); |
} |
} |
|
|
void |
void |
mm_request_receive(int socket, Buffer *m) |
mm_request_receive(int sock, Buffer *m) |
{ |
{ |
u_char buf[4]; |
u_char buf[4]; |
u_int msg_len; |
u_int msg_len; |
|
|
|
|
debug3("%s entering", __func__); |
debug3("%s entering", __func__); |
|
|
res = atomicio(read, socket, buf, sizeof(buf)); |
res = atomicio(read, sock, buf, sizeof(buf)); |
if (res != sizeof(buf)) { |
if (res != sizeof(buf)) { |
if (res == 0) |
if (res == 0) |
cleanup_exit(255); |
cleanup_exit(255); |
|
|
fatal("%s: read: bad msg_len %d", __func__, msg_len); |
fatal("%s: read: bad msg_len %d", __func__, msg_len); |
buffer_clear(m); |
buffer_clear(m); |
buffer_append_space(m, msg_len); |
buffer_append_space(m, msg_len); |
res = atomicio(read, socket, buffer_ptr(m), msg_len); |
res = atomicio(read, sock, buffer_ptr(m), msg_len); |
if (res != msg_len) |
if (res != msg_len) |
fatal("%s: read: %ld != msg_len", __func__, (long)res); |
fatal("%s: read: %ld != msg_len", __func__, (long)res); |
} |
} |
|
|
void |
void |
mm_request_receive_expect(int socket, enum monitor_reqtype type, Buffer *m) |
mm_request_receive_expect(int sock, enum monitor_reqtype type, Buffer *m) |
{ |
{ |
u_char rtype; |
u_char rtype; |
|
|
debug3("%s entering: type %d", __func__, type); |
debug3("%s entering: type %d", __func__, type); |
|
|
mm_request_receive(socket, m); |
mm_request_receive(sock, m); |
rtype = buffer_get_char(m); |
rtype = buffer_get_char(m); |
if (rtype != type) |
if (rtype != type) |
fatal("%s: read: rtype %d != type %d", __func__, |
fatal("%s: read: rtype %d != type %d", __func__, |
|
|
} |
} |
|
|
void |
void |
mm_send_keystate(struct monitor *pmonitor) |
mm_send_keystate(struct monitor *monitor) |
{ |
{ |
Buffer m; |
Buffer m; |
u_char *blob, *p; |
u_char *blob, *p; |
|
|
goto skip; |
goto skip; |
} else { |
} else { |
/* Kex for rekeying */ |
/* Kex for rekeying */ |
mm_send_kex(&m, *pmonitor->m_pkex); |
mm_send_kex(&m, *monitor->m_pkex); |
} |
} |
|
|
debug3("%s: Sending new keys: %p %p", |
debug3("%s: Sending new keys: %p %p", |
|
|
buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input)); |
buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input)); |
buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); |
buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output)); |
|
|
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); |
mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m); |
debug3("%s: Finished sending state", __func__); |
debug3("%s: Finished sending state", __func__); |
|
|
buffer_free(&m); |
buffer_free(&m); |
|
|
|
|
#ifdef GSSAPI |
#ifdef GSSAPI |
OM_uint32 |
OM_uint32 |
mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid) |
mm_ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID goid) |
{ |
{ |
Buffer m; |
Buffer m; |
OM_uint32 major; |
OM_uint32 major; |
|
|
*ctx = NULL; |
*ctx = NULL; |
|
|
buffer_init(&m); |
buffer_init(&m); |
buffer_put_string(&m, oid->elements, oid->length); |
buffer_put_string(&m, goid->elements, goid->length); |
|
|
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m); |
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, &m); |
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m); |
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, &m); |