version 1.5.2.3, 2002/06/26 15:30:38 |
version 1.5.2.4, 2002/10/11 14:51:52 |
|
|
void |
void |
mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) |
mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) |
{ |
{ |
u_char buf[5]; |
|
u_int mlen = buffer_len(m); |
u_int mlen = buffer_len(m); |
|
u_char buf[5]; |
|
|
debug3("%s entering: type %d", __func__, type); |
debug3("%s entering: type %d", __func__, type); |
|
|
|
|
mm_request_receive(int socket, Buffer *m) |
mm_request_receive(int socket, Buffer *m) |
{ |
{ |
u_char buf[4]; |
u_char buf[4]; |
ssize_t res; |
|
u_int msg_len; |
u_int msg_len; |
|
ssize_t res; |
|
|
debug3("%s entering", __func__); |
debug3("%s entering", __func__); |
|
|
|
|
return (pw); |
return (pw); |
} |
} |
|
|
char* mm_auth2_read_banner(void) |
char *mm_auth2_read_banner(void) |
{ |
{ |
Buffer m; |
Buffer m; |
char *banner; |
char *banner; |
|
|
enc->key = buffer_get_string(&b, &enc->key_len); |
enc->key = buffer_get_string(&b, &enc->key_len); |
enc->iv = buffer_get_string(&b, &len); |
enc->iv = buffer_get_string(&b, &len); |
if (len != enc->block_size) |
if (len != enc->block_size) |
fatal("%s: bad ivlen: expected %d != %d", __func__, |
fatal("%s: bad ivlen: expected %u != %u", __func__, |
enc->block_size, len); |
enc->block_size, len); |
|
|
if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher) |
if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher) |
|
|
mac->enabled = buffer_get_int(&b); |
mac->enabled = buffer_get_int(&b); |
mac->key = buffer_get_string(&b, &len); |
mac->key = buffer_get_string(&b, &len); |
if (len > mac->key_len) |
if (len > mac->key_len) |
fatal("%s: bad mac key length: %d > %d", __func__, len, |
fatal("%s: bad mac key length: %u > %d", __func__, len, |
mac->key_len); |
mac->key_len); |
mac->key_len = len; |
mac->key_len = len; |
|
|
|
|
|
|
len = buffer_len(&b); |
len = buffer_len(&b); |
if (len != 0) |
if (len != 0) |
error("newkeys_from_blob: remaining bytes in blob %d", len); |
error("newkeys_from_blob: remaining bytes in blob %u", len); |
buffer_free(&b); |
buffer_free(&b); |
return (newkey); |
return (newkey); |
} |
} |
|
|
{ |
{ |
Buffer b; |
Buffer b; |
int len; |
int len; |
u_char *buf; |
|
Enc *enc; |
Enc *enc; |
Mac *mac; |
Mac *mac; |
Comp *comp; |
Comp *comp; |
|
|
buffer_put_cstring(&b, comp->name); |
buffer_put_cstring(&b, comp->name); |
|
|
len = buffer_len(&b); |
len = buffer_len(&b); |
buf = xmalloc(len); |
|
memcpy(buf, buffer_ptr(&b), len); |
|
memset(buffer_ptr(&b), 0, len); |
|
buffer_free(&b); |
|
if (lenp != NULL) |
if (lenp != NULL) |
*lenp = len; |
*lenp = len; |
if (blobp != NULL) |
if (blobp != NULL) { |
*blobp = buf; |
*blobp = xmalloc(len); |
|
memcpy(*blobp, buffer_ptr(&b), len); |
|
} |
|
memset(buffer_ptr(&b), 0, len); |
|
buffer_free(&b); |
return len; |
return len; |
} |
} |
|
|
|
|
mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) |
mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) |
{ |
{ |
Buffer m; |
Buffer m; |
u_char *p; |
char *p; |
int success = 0; |
int success = 0; |
|
|
buffer_init(&m); |
buffer_init(&m); |
|
|
*name = xstrdup(""); |
*name = xstrdup(""); |
*infotxt = xstrdup(""); |
*infotxt = xstrdup(""); |
*numprompts = 1; |
*numprompts = 1; |
*prompts = xmalloc(*numprompts * sizeof(char*)); |
*prompts = xmalloc(*numprompts * sizeof(char *)); |
*echo_on = xmalloc(*numprompts * sizeof(u_int)); |
*echo_on = xmalloc(*numprompts * sizeof(u_int)); |
(*echo_on)[0] = 0; |
(*echo_on)[0] = 0; |
} |
} |
|
|
|
|
return (success); |
return (success); |
} |
} |
|
|
|
#ifdef KRB4 |
|
int |
|
mm_auth_krb4(Authctxt *authctxt, void *_auth, char **client, void *_reply) |
|
{ |
|
KTEXT auth, reply; |
|
Buffer m; |
|
u_int rlen; |
|
int success = 0; |
|
char *p; |
|
|
|
debug3("%s entering", __func__); |
|
auth = _auth; |
|
reply = _reply; |
|
|
|
buffer_init(&m); |
|
buffer_put_string(&m, auth->dat, auth->length); |
|
|
|
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KRB4, &m); |
|
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KRB4, &m); |
|
|
|
success = buffer_get_int(&m); |
|
if (success) { |
|
*client = buffer_get_string(&m, NULL); |
|
p = buffer_get_string(&m, &rlen); |
|
if (rlen >= MAX_KTXT_LEN) |
|
fatal("%s: reply from monitor too large", __func__); |
|
reply->length = rlen; |
|
memcpy(reply->dat, p, rlen); |
|
memset(p, 0, rlen); |
|
xfree(p); |
|
} |
|
buffer_free(&m); |
|
return (success); |
|
} |
|
#endif |
|
|
|
#ifdef KRB5 |
|
int |
|
mm_auth_krb5(void *ctx, void *argp, char **userp, void *resp) |
|
{ |
|
krb5_data *tkt, *reply; |
|
Buffer m; |
|
int success; |
|
|
|
debug3("%s entering", __func__); |
|
tkt = (krb5_data *) argp; |
|
reply = (krb5_data *) resp; |
|
|
|
buffer_init(&m); |
|
buffer_put_string(&m, tkt->data, tkt->length); |
|
|
|
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KRB5, &m); |
|
mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_KRB5, &m); |
|
|
|
success = buffer_get_int(&m); |
|
if (success) { |
|
u_int len; |
|
|
|
*userp = buffer_get_string(&m, NULL); |
|
reply->data = buffer_get_string(&m, &len); |
|
reply->length = len; |
|
} else { |
|
memset(reply, 0, sizeof(*reply)); |
|
*userp = NULL; |
|
} |
|
|
|
buffer_free(&m); |
|
return (success); |
|
} |
|
#endif |