diff options
author | des <des@FreeBSD.org> | 2002-10-29 10:16:02 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-10-29 10:16:02 +0000 |
commit | 279b0fa809e30e3a007bbc4b2adb1ccbd4d4a87a (patch) | |
tree | 404fa392fc6f2560e3c459fa20228c7031d0289d /crypto/openssh/monitor_wrap.c | |
parent | ce26c10eda4d687d476e9bbac51ccd26564af8da (diff) | |
download | FreeBSD-src-279b0fa809e30e3a007bbc4b2adb1ccbd4d4a87a.zip FreeBSD-src-279b0fa809e30e3a007bbc4b2adb1ccbd4d4a87a.tar.gz |
Resolve conflicts.
Diffstat (limited to 'crypto/openssh/monitor_wrap.c')
-rw-r--r-- | crypto/openssh/monitor_wrap.c | 102 |
1 files changed, 86 insertions, 16 deletions
diff --git a/crypto/openssh/monitor_wrap.c b/crypto/openssh/monitor_wrap.c index 71ea233..4ca5e49 100644 --- a/crypto/openssh/monitor_wrap.c +++ b/crypto/openssh/monitor_wrap.c @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: monitor_wrap.c,v 1.11 2002/06/19 18:01:00 markus Exp $"); +RCSID("$OpenBSD: monitor_wrap.c,v 1.19 2002/09/26 11:38:43 markus Exp $"); RCSID("$FreeBSD$"); #include <openssl/bn.h> @@ -63,8 +63,8 @@ extern Buffer input, output; void mm_request_send(int socket, enum monitor_reqtype type, Buffer *m) { - u_char buf[5]; u_int mlen = buffer_len(m); + u_char buf[5]; debug3("%s entering: type %d", __func__, type); @@ -80,8 +80,8 @@ void mm_request_receive(int socket, Buffer *m) { u_char buf[4]; - ssize_t res; u_int msg_len; + ssize_t res; debug3("%s entering", __func__); @@ -208,7 +208,7 @@ mm_getpwnamallow(const char *login) return (pw); } -char* mm_auth2_read_banner(void) +char *mm_auth2_read_banner(void) { Buffer m; char *banner; @@ -412,7 +412,7 @@ mm_newkeys_from_blob(u_char *blob, int blen) enc->key = buffer_get_string(&b, &enc->key_len); enc->iv = buffer_get_string(&b, &len); 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); if (enc->name == NULL || cipher_by_name(enc->name) != enc->cipher) @@ -426,7 +426,7 @@ mm_newkeys_from_blob(u_char *blob, int blen) mac->enabled = buffer_get_int(&b); mac->key = buffer_get_string(&b, &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 = len; @@ -437,7 +437,7 @@ mm_newkeys_from_blob(u_char *blob, int blen) len = buffer_len(&b); 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); return (newkey); } @@ -447,7 +447,6 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp) { Buffer b; int len; - u_char *buf; Enc *enc; Mac *mac; Comp *comp; @@ -485,14 +484,14 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp) buffer_put_cstring(&b, comp->name); 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) *lenp = len; - if (blobp != NULL) - *blobp = buf; + if (blobp != NULL) { + *blobp = xmalloc(len); + memcpy(*blobp, buffer_ptr(&b), len); + } + memset(buffer_ptr(&b), 0, len); + buffer_free(&b); return len; } @@ -601,7 +600,7 @@ int mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) { Buffer m; - u_char *p; + char *p; int success = 0; buffer_init(&m); @@ -788,7 +787,7 @@ mm_chall_setup(char **name, char **infotxt, u_int *numprompts, *name = xstrdup(""); *infotxt = xstrdup(""); *numprompts = 1; - *prompts = xmalloc(*numprompts * sizeof(char*)); + *prompts = xmalloc(*numprompts * sizeof(char *)); *echo_on = xmalloc(*numprompts * sizeof(u_int)); (*echo_on)[0] = 0; } @@ -1022,3 +1021,74 @@ mm_auth_rsa_verify_response(Key *key, BIGNUM *p, u_char response[16]) 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 |