diff options
Diffstat (limited to 'debian/patches/gssapi.patch')
-rw-r--r-- | debian/patches/gssapi.patch | 451 |
1 files changed, 346 insertions, 105 deletions
diff --git a/debian/patches/gssapi.patch b/debian/patches/gssapi.patch index fd3b9b630..8e946aa88 100644 --- a/debian/patches/gssapi.patch +++ b/debian/patches/gssapi.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 8c27af53099b50387dda97c0aae36194197186f6 Mon Sep 17 00:00:00 2001 | 1 | From eecddf8b72fcad83ccca43b1badb03782704f6b7 Mon Sep 17 00:00:00 2001 |
2 | From: Simon Wilkinson <simon@sxw.org.uk> | 2 | From: Simon Wilkinson <simon@sxw.org.uk> |
3 | Date: Sun, 9 Feb 2014 16:09:48 +0000 | 3 | Date: Sun, 9 Feb 2014 16:09:48 +0000 |
4 | Subject: GSSAPI key exchange support | 4 | Subject: GSSAPI key exchange support |
@@ -17,26 +17,28 @@ have it merged into the main openssh package rather than having separate | |||
17 | security history. | 17 | security history. |
18 | 18 | ||
19 | Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242 | 19 | Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242 |
20 | Last-Updated: 2016-03-21 | 20 | Last-Updated: 2016-08-07 |
21 | 21 | ||
22 | Patch-Name: gssapi.patch | 22 | Patch-Name: gssapi.patch |
23 | --- | 23 | --- |
24 | ChangeLog.gssapi | 113 +++++++++++++++++++ | 24 | ChangeLog.gssapi | 113 +++++++++++++++++++ |
25 | Makefile.in | 3 +- | 25 | Makefile.in | 3 +- |
26 | auth-krb5.c | 17 ++- | 26 | auth-krb5.c | 17 ++- |
27 | auth.c | 3 +- | 27 | auth.c | 96 +--------------- |
28 | auth2-gss.c | 48 +++++++- | 28 | auth2-gss.c | 48 +++++++- |
29 | auth2.c | 2 + | 29 | auth2.c | 2 + |
30 | canohost.c | 93 +++++++++++++++ | ||
31 | canohost.h | 3 + | ||
30 | clientloop.c | 15 ++- | 32 | clientloop.c | 15 ++- |
31 | config.h.in | 6 + | 33 | config.h.in | 6 + |
32 | configure.ac | 24 ++++ | 34 | configure.ac | 24 ++++ |
33 | gss-genr.c | 275 ++++++++++++++++++++++++++++++++++++++++++++- | 35 | gss-genr.c | 275 +++++++++++++++++++++++++++++++++++++++++++- |
34 | gss-serv-krb5.c | 85 ++++++++++++-- | 36 | gss-serv-krb5.c | 85 ++++++++++++-- |
35 | gss-serv.c | 185 +++++++++++++++++++++++++++--- | 37 | gss-serv.c | 185 +++++++++++++++++++++++++++--- |
36 | kex.c | 16 +++ | 38 | kex.c | 19 ++++ |
37 | kex.h | 14 +++ | 39 | kex.h | 14 +++ |
38 | kexgssc.c | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 40 | kexgssc.c | 338 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
39 | kexgsss.c | 294 ++++++++++++++++++++++++++++++++++++++++++++++++ | 41 | kexgsss.c | 295 ++++++++++++++++++++++++++++++++++++++++++++++++ |
40 | monitor.c | 108 +++++++++++++++++- | 42 | monitor.c | 108 +++++++++++++++++- |
41 | monitor.h | 3 + | 43 | monitor.h | 3 + |
42 | monitor_wrap.c | 47 +++++++- | 44 | monitor_wrap.c | 47 +++++++- |
@@ -48,13 +50,13 @@ Patch-Name: gssapi.patch | |||
48 | ssh-gss.h | 41 ++++++- | 50 | ssh-gss.h | 41 ++++++- |
49 | ssh_config | 2 + | 51 | ssh_config | 2 + |
50 | ssh_config.5 | 32 ++++++ | 52 | ssh_config.5 | 32 ++++++ |
51 | sshconnect2.c | 120 +++++++++++++++++++- | 53 | sshconnect2.c | 122 +++++++++++++++++++- |
52 | sshd.c | 110 ++++++++++++++++++ | 54 | sshd.c | 110 ++++++++++++++++++ |
53 | sshd_config | 2 + | 55 | sshd_config | 2 + |
54 | sshd_config.5 | 10 ++ | 56 | sshd_config.5 | 10 ++ |
55 | sshkey.c | 3 +- | 57 | sshkey.c | 3 +- |
56 | sshkey.h | 1 + | 58 | sshkey.h | 1 + |
57 | 33 files changed, 1950 insertions(+), 46 deletions(-) | 59 | 35 files changed, 2054 insertions(+), 139 deletions(-) |
58 | create mode 100644 ChangeLog.gssapi | 60 | create mode 100644 ChangeLog.gssapi |
59 | create mode 100644 kexgssc.c | 61 | create mode 100644 kexgssc.c |
60 | create mode 100644 kexgsss.c | 62 | create mode 100644 kexgsss.c |
@@ -179,7 +181,7 @@ index 0000000..f117a33 | |||
179 | + (from jbasney AT ncsa.uiuc.edu) | 181 | + (from jbasney AT ncsa.uiuc.edu) |
180 | + <gssapi-with-mic support is Bugzilla #1008> | 182 | + <gssapi-with-mic support is Bugzilla #1008> |
181 | diff --git a/Makefile.in b/Makefile.in | 183 | diff --git a/Makefile.in b/Makefile.in |
182 | index d401787..0954c63 100644 | 184 | index 12991cd..51817df 100644 |
183 | --- a/Makefile.in | 185 | --- a/Makefile.in |
184 | +++ b/Makefile.in | 186 | +++ b/Makefile.in |
185 | @@ -92,6 +92,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ | 187 | @@ -92,6 +92,7 @@ LIBSSH_OBJS=${LIBOPENSSH_OBJS} \ |
@@ -187,7 +189,7 @@ index d401787..0954c63 100644 | |||
187 | kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \ | 189 | kexdhc.o kexgexc.o kexecdhc.o kexc25519c.o \ |
188 | kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \ | 190 | kexdhs.o kexgexs.o kexecdhs.o kexc25519s.o \ |
189 | + kexgssc.o \ | 191 | + kexgssc.o \ |
190 | platform-pledge.o | 192 | platform-pledge.o platform-tracing.o |
191 | 193 | ||
192 | SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ | 194 | SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \ |
193 | @@ -105,7 +106,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ | 195 | @@ -105,7 +106,7 @@ SSHDOBJS=sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \ |
@@ -200,10 +202,10 @@ index d401787..0954c63 100644 | |||
200 | sftp-server.o sftp-common.o \ | 202 | sftp-server.o sftp-common.o \ |
201 | sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \ | 203 | sandbox-null.o sandbox-rlimit.o sandbox-systrace.o sandbox-darwin.o \ |
202 | diff --git a/auth-krb5.c b/auth-krb5.c | 204 | diff --git a/auth-krb5.c b/auth-krb5.c |
203 | index d1c5a2f..f019fb1 100644 | 205 | index a5a81ed..38e7fee 100644 |
204 | --- a/auth-krb5.c | 206 | --- a/auth-krb5.c |
205 | +++ b/auth-krb5.c | 207 | +++ b/auth-krb5.c |
206 | @@ -183,8 +183,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) | 208 | @@ -182,8 +182,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) |
207 | 209 | ||
208 | len = strlen(authctxt->krb5_ticket_file) + 6; | 210 | len = strlen(authctxt->krb5_ticket_file) + 6; |
209 | authctxt->krb5_ccname = xmalloc(len); | 211 | authctxt->krb5_ccname = xmalloc(len); |
@@ -217,7 +219,7 @@ index d1c5a2f..f019fb1 100644 | |||
217 | 219 | ||
218 | #ifdef USE_PAM | 220 | #ifdef USE_PAM |
219 | if (options.use_pam) | 221 | if (options.use_pam) |
220 | @@ -241,15 +246,22 @@ krb5_cleanup_proc(Authctxt *authctxt) | 222 | @@ -240,15 +245,22 @@ krb5_cleanup_proc(Authctxt *authctxt) |
221 | #ifndef HEIMDAL | 223 | #ifndef HEIMDAL |
222 | krb5_error_code | 224 | krb5_error_code |
223 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 225 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
@@ -242,7 +244,7 @@ index d1c5a2f..f019fb1 100644 | |||
242 | old_umask = umask(0177); | 244 | old_umask = umask(0177); |
243 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 245 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
244 | oerrno = errno; | 246 | oerrno = errno; |
245 | @@ -266,6 +278,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 247 | @@ -265,6 +277,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
246 | return oerrno; | 248 | return oerrno; |
247 | } | 249 | } |
248 | close(tmpfd); | 250 | close(tmpfd); |
@@ -251,10 +253,10 @@ index d1c5a2f..f019fb1 100644 | |||
251 | return (krb5_cc_resolve(ctx, ccname, ccache)); | 253 | return (krb5_cc_resolve(ctx, ccname, ccache)); |
252 | } | 254 | } |
253 | diff --git a/auth.c b/auth.c | 255 | diff --git a/auth.c b/auth.c |
254 | index 214c2c7..bd6a026 100644 | 256 | index 24527dd..f56dcc6 100644 |
255 | --- a/auth.c | 257 | --- a/auth.c |
256 | +++ b/auth.c | 258 | +++ b/auth.c |
257 | @@ -354,7 +354,8 @@ auth_root_allowed(const char *method) | 259 | @@ -363,7 +363,8 @@ auth_root_allowed(const char *method) |
258 | case PERMIT_NO_PASSWD: | 260 | case PERMIT_NO_PASSWD: |
259 | if (strcmp(method, "publickey") == 0 || | 261 | if (strcmp(method, "publickey") == 0 || |
260 | strcmp(method, "hostbased") == 0 || | 262 | strcmp(method, "hostbased") == 0 || |
@@ -264,6 +266,106 @@ index 214c2c7..bd6a026 100644 | |||
264 | return 1; | 266 | return 1; |
265 | break; | 267 | break; |
266 | case PERMIT_FORCED_ONLY: | 268 | case PERMIT_FORCED_ONLY: |
269 | @@ -786,99 +787,6 @@ fakepw(void) | ||
270 | } | ||
271 | |||
272 | /* | ||
273 | - * Returns the remote DNS hostname as a string. The returned string must not | ||
274 | - * be freed. NB. this will usually trigger a DNS query the first time it is | ||
275 | - * called. | ||
276 | - * This function does additional checks on the hostname to mitigate some | ||
277 | - * attacks on legacy rhosts-style authentication. | ||
278 | - * XXX is RhostsRSAAuthentication vulnerable to these? | ||
279 | - * XXX Can we remove these checks? (or if not, remove RhostsRSAAuthentication?) | ||
280 | - */ | ||
281 | - | ||
282 | -static char * | ||
283 | -remote_hostname(struct ssh *ssh) | ||
284 | -{ | ||
285 | - struct sockaddr_storage from; | ||
286 | - socklen_t fromlen; | ||
287 | - struct addrinfo hints, *ai, *aitop; | ||
288 | - char name[NI_MAXHOST], ntop2[NI_MAXHOST]; | ||
289 | - const char *ntop = ssh_remote_ipaddr(ssh); | ||
290 | - | ||
291 | - /* Get IP address of client. */ | ||
292 | - fromlen = sizeof(from); | ||
293 | - memset(&from, 0, sizeof(from)); | ||
294 | - if (getpeername(ssh_packet_get_connection_in(ssh), | ||
295 | - (struct sockaddr *)&from, &fromlen) < 0) { | ||
296 | - debug("getpeername failed: %.100s", strerror(errno)); | ||
297 | - return strdup(ntop); | ||
298 | - } | ||
299 | - | ||
300 | - ipv64_normalise_mapped(&from, &fromlen); | ||
301 | - if (from.ss_family == AF_INET6) | ||
302 | - fromlen = sizeof(struct sockaddr_in6); | ||
303 | - | ||
304 | - debug3("Trying to reverse map address %.100s.", ntop); | ||
305 | - /* Map the IP address to a host name. */ | ||
306 | - if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), | ||
307 | - NULL, 0, NI_NAMEREQD) != 0) { | ||
308 | - /* Host name not found. Use ip address. */ | ||
309 | - return strdup(ntop); | ||
310 | - } | ||
311 | - | ||
312 | - /* | ||
313 | - * if reverse lookup result looks like a numeric hostname, | ||
314 | - * someone is trying to trick us by PTR record like following: | ||
315 | - * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5 | ||
316 | - */ | ||
317 | - memset(&hints, 0, sizeof(hints)); | ||
318 | - hints.ai_socktype = SOCK_DGRAM; /*dummy*/ | ||
319 | - hints.ai_flags = AI_NUMERICHOST; | ||
320 | - if (getaddrinfo(name, NULL, &hints, &ai) == 0) { | ||
321 | - logit("Nasty PTR record \"%s\" is set up for %s, ignoring", | ||
322 | - name, ntop); | ||
323 | - freeaddrinfo(ai); | ||
324 | - return strdup(ntop); | ||
325 | - } | ||
326 | - | ||
327 | - /* Names are stored in lowercase. */ | ||
328 | - lowercase(name); | ||
329 | - | ||
330 | - /* | ||
331 | - * Map it back to an IP address and check that the given | ||
332 | - * address actually is an address of this host. This is | ||
333 | - * necessary because anyone with access to a name server can | ||
334 | - * define arbitrary names for an IP address. Mapping from | ||
335 | - * name to IP address can be trusted better (but can still be | ||
336 | - * fooled if the intruder has access to the name server of | ||
337 | - * the domain). | ||
338 | - */ | ||
339 | - memset(&hints, 0, sizeof(hints)); | ||
340 | - hints.ai_family = from.ss_family; | ||
341 | - hints.ai_socktype = SOCK_STREAM; | ||
342 | - if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { | ||
343 | - logit("reverse mapping checking getaddrinfo for %.700s " | ||
344 | - "[%s] failed.", name, ntop); | ||
345 | - return strdup(ntop); | ||
346 | - } | ||
347 | - /* Look for the address from the list of addresses. */ | ||
348 | - for (ai = aitop; ai; ai = ai->ai_next) { | ||
349 | - if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, | ||
350 | - sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && | ||
351 | - (strcmp(ntop, ntop2) == 0)) | ||
352 | - break; | ||
353 | - } | ||
354 | - freeaddrinfo(aitop); | ||
355 | - /* If we reached the end of the list, the address was not there. */ | ||
356 | - if (ai == NULL) { | ||
357 | - /* Address not found for the host name. */ | ||
358 | - logit("Address %.100s maps to %.600s, but this does not " | ||
359 | - "map back to the address.", ntop, name); | ||
360 | - return strdup(ntop); | ||
361 | - } | ||
362 | - return strdup(name); | ||
363 | -} | ||
364 | - | ||
365 | -/* | ||
366 | * Return the canonical name of the host in the other side of the current | ||
367 | * connection. The host name is cached, so it is efficient to call this | ||
368 | * several times. | ||
267 | diff --git a/auth2-gss.c b/auth2-gss.c | 369 | diff --git a/auth2-gss.c b/auth2-gss.c |
268 | index 1ca8357..3b5036d 100644 | 370 | index 1ca8357..3b5036d 100644 |
269 | --- a/auth2-gss.c | 371 | --- a/auth2-gss.c |
@@ -352,7 +454,7 @@ index 1ca8357..3b5036d 100644 | |||
352 | "gssapi-with-mic", | 454 | "gssapi-with-mic", |
353 | userauth_gssapi, | 455 | userauth_gssapi, |
354 | diff --git a/auth2.c b/auth2.c | 456 | diff --git a/auth2.c b/auth2.c |
355 | index 7177962..3f49bdc 100644 | 457 | index 9108b86..ce0d376 100644 |
356 | --- a/auth2.c | 458 | --- a/auth2.c |
357 | +++ b/auth2.c | 459 | +++ b/auth2.c |
358 | @@ -70,6 +70,7 @@ extern Authmethod method_passwd; | 460 | @@ -70,6 +70,7 @@ extern Authmethod method_passwd; |
@@ -371,8 +473,126 @@ index 7177962..3f49bdc 100644 | |||
371 | &method_gssapi, | 473 | &method_gssapi, |
372 | #endif | 474 | #endif |
373 | &method_passwd, | 475 | &method_passwd, |
476 | diff --git a/canohost.c b/canohost.c | ||
477 | index f71a085..404731d 100644 | ||
478 | --- a/canohost.c | ||
479 | +++ b/canohost.c | ||
480 | @@ -35,6 +35,99 @@ | ||
481 | #include "canohost.h" | ||
482 | #include "misc.h" | ||
483 | |||
484 | +/* | ||
485 | + * Returns the remote DNS hostname as a string. The returned string must not | ||
486 | + * be freed. NB. this will usually trigger a DNS query the first time it is | ||
487 | + * called. | ||
488 | + * This function does additional checks on the hostname to mitigate some | ||
489 | + * attacks on legacy rhosts-style authentication. | ||
490 | + * XXX is RhostsRSAAuthentication vulnerable to these? | ||
491 | + * XXX Can we remove these checks? (or if not, remove RhostsRSAAuthentication?) | ||
492 | + */ | ||
493 | + | ||
494 | +char * | ||
495 | +remote_hostname(struct ssh *ssh) | ||
496 | +{ | ||
497 | + struct sockaddr_storage from; | ||
498 | + socklen_t fromlen; | ||
499 | + struct addrinfo hints, *ai, *aitop; | ||
500 | + char name[NI_MAXHOST], ntop2[NI_MAXHOST]; | ||
501 | + const char *ntop = ssh_remote_ipaddr(ssh); | ||
502 | + | ||
503 | + /* Get IP address of client. */ | ||
504 | + fromlen = sizeof(from); | ||
505 | + memset(&from, 0, sizeof(from)); | ||
506 | + if (getpeername(ssh_packet_get_connection_in(ssh), | ||
507 | + (struct sockaddr *)&from, &fromlen) < 0) { | ||
508 | + debug("getpeername failed: %.100s", strerror(errno)); | ||
509 | + return strdup(ntop); | ||
510 | + } | ||
511 | + | ||
512 | + ipv64_normalise_mapped(&from, &fromlen); | ||
513 | + if (from.ss_family == AF_INET6) | ||
514 | + fromlen = sizeof(struct sockaddr_in6); | ||
515 | + | ||
516 | + debug3("Trying to reverse map address %.100s.", ntop); | ||
517 | + /* Map the IP address to a host name. */ | ||
518 | + if (getnameinfo((struct sockaddr *)&from, fromlen, name, sizeof(name), | ||
519 | + NULL, 0, NI_NAMEREQD) != 0) { | ||
520 | + /* Host name not found. Use ip address. */ | ||
521 | + return strdup(ntop); | ||
522 | + } | ||
523 | + | ||
524 | + /* | ||
525 | + * if reverse lookup result looks like a numeric hostname, | ||
526 | + * someone is trying to trick us by PTR record like following: | ||
527 | + * 1.1.1.10.in-addr.arpa. IN PTR 2.3.4.5 | ||
528 | + */ | ||
529 | + memset(&hints, 0, sizeof(hints)); | ||
530 | + hints.ai_socktype = SOCK_DGRAM; /*dummy*/ | ||
531 | + hints.ai_flags = AI_NUMERICHOST; | ||
532 | + if (getaddrinfo(name, NULL, &hints, &ai) == 0) { | ||
533 | + logit("Nasty PTR record \"%s\" is set up for %s, ignoring", | ||
534 | + name, ntop); | ||
535 | + freeaddrinfo(ai); | ||
536 | + return strdup(ntop); | ||
537 | + } | ||
538 | + | ||
539 | + /* Names are stored in lowercase. */ | ||
540 | + lowercase(name); | ||
541 | + | ||
542 | + /* | ||
543 | + * Map it back to an IP address and check that the given | ||
544 | + * address actually is an address of this host. This is | ||
545 | + * necessary because anyone with access to a name server can | ||
546 | + * define arbitrary names for an IP address. Mapping from | ||
547 | + * name to IP address can be trusted better (but can still be | ||
548 | + * fooled if the intruder has access to the name server of | ||
549 | + * the domain). | ||
550 | + */ | ||
551 | + memset(&hints, 0, sizeof(hints)); | ||
552 | + hints.ai_family = from.ss_family; | ||
553 | + hints.ai_socktype = SOCK_STREAM; | ||
554 | + if (getaddrinfo(name, NULL, &hints, &aitop) != 0) { | ||
555 | + logit("reverse mapping checking getaddrinfo for %.700s " | ||
556 | + "[%s] failed.", name, ntop); | ||
557 | + return strdup(ntop); | ||
558 | + } | ||
559 | + /* Look for the address from the list of addresses. */ | ||
560 | + for (ai = aitop; ai; ai = ai->ai_next) { | ||
561 | + if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop2, | ||
562 | + sizeof(ntop2), NULL, 0, NI_NUMERICHOST) == 0 && | ||
563 | + (strcmp(ntop, ntop2) == 0)) | ||
564 | + break; | ||
565 | + } | ||
566 | + freeaddrinfo(aitop); | ||
567 | + /* If we reached the end of the list, the address was not there. */ | ||
568 | + if (ai == NULL) { | ||
569 | + /* Address not found for the host name. */ | ||
570 | + logit("Address %.100s maps to %.600s, but this does not " | ||
571 | + "map back to the address.", ntop, name); | ||
572 | + return strdup(ntop); | ||
573 | + } | ||
574 | + return strdup(name); | ||
575 | +} | ||
576 | + | ||
577 | void | ||
578 | ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len) | ||
579 | { | ||
580 | diff --git a/canohost.h b/canohost.h | ||
581 | index 26d6285..0cadc9f 100644 | ||
582 | --- a/canohost.h | ||
583 | +++ b/canohost.h | ||
584 | @@ -15,6 +15,9 @@ | ||
585 | #ifndef _CANOHOST_H | ||
586 | #define _CANOHOST_H | ||
587 | |||
588 | +struct ssh; | ||
589 | + | ||
590 | +char *remote_hostname(struct ssh *); | ||
591 | char *get_peer_ipaddr(int); | ||
592 | int get_peer_port(int); | ||
593 | char *get_local_ipaddr(int); | ||
374 | diff --git a/clientloop.c b/clientloop.c | 594 | diff --git a/clientloop.c b/clientloop.c |
375 | index 9820455..1567e4a 100644 | 595 | index 2c44f5d..421241f 100644 |
376 | --- a/clientloop.c | 596 | --- a/clientloop.c |
377 | +++ b/clientloop.c | 597 | +++ b/clientloop.c |
378 | @@ -114,6 +114,10 @@ | 598 | @@ -114,6 +114,10 @@ |
@@ -386,7 +606,7 @@ index 9820455..1567e4a 100644 | |||
386 | /* import options */ | 606 | /* import options */ |
387 | extern Options options; | 607 | extern Options options; |
388 | 608 | ||
389 | @@ -1662,9 +1666,18 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | 609 | @@ -1666,9 +1670,18 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) |
390 | break; | 610 | break; |
391 | 611 | ||
392 | /* Do channel operations unless rekeying in progress. */ | 612 | /* Do channel operations unless rekeying in progress. */ |
@@ -407,10 +627,10 @@ index 9820455..1567e4a 100644 | |||
407 | client_process_net_input(readset); | 627 | client_process_net_input(readset); |
408 | 628 | ||
409 | diff --git a/config.h.in b/config.h.in | 629 | diff --git a/config.h.in b/config.h.in |
410 | index 89bf1b0..621c139 100644 | 630 | index 39d018f..d7caf9a 100644 |
411 | --- a/config.h.in | 631 | --- a/config.h.in |
412 | +++ b/config.h.in | 632 | +++ b/config.h.in |
413 | @@ -1641,6 +1641,9 @@ | 633 | @@ -1668,6 +1668,9 @@ |
414 | /* Use btmp to log bad logins */ | 634 | /* Use btmp to log bad logins */ |
415 | #undef USE_BTMP | 635 | #undef USE_BTMP |
416 | 636 | ||
@@ -420,7 +640,7 @@ index 89bf1b0..621c139 100644 | |||
420 | /* Use libedit for sftp */ | 640 | /* Use libedit for sftp */ |
421 | #undef USE_LIBEDIT | 641 | #undef USE_LIBEDIT |
422 | 642 | ||
423 | @@ -1656,6 +1659,9 @@ | 643 | @@ -1683,6 +1686,9 @@ |
424 | /* Use PIPES instead of a socketpair() */ | 644 | /* Use PIPES instead of a socketpair() */ |
425 | #undef USE_PIPES | 645 | #undef USE_PIPES |
426 | 646 | ||
@@ -431,7 +651,7 @@ index 89bf1b0..621c139 100644 | |||
431 | #undef USE_SOLARIS_PRIVS | 651 | #undef USE_SOLARIS_PRIVS |
432 | 652 | ||
433 | diff --git a/configure.ac b/configure.ac | 653 | diff --git a/configure.ac b/configure.ac |
434 | index 7258cc0..5f1ff74 100644 | 654 | index 373d21b..894ec3b 100644 |
435 | --- a/configure.ac | 655 | --- a/configure.ac |
436 | +++ b/configure.ac | 656 | +++ b/configure.ac |
437 | @@ -632,6 +632,30 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) | 657 | @@ -632,6 +632,30 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) |
@@ -463,7 +683,7 @@ index 7258cc0..5f1ff74 100644 | |||
463 | + [AC_MSG_RESULT([no])] | 683 | + [AC_MSG_RESULT([no])] |
464 | + ) | 684 | + ) |
465 | m4_pattern_allow([AU_IPv]) | 685 | m4_pattern_allow([AU_IPv]) |
466 | AC_CHECK_DECL([AU_IPv4], [], | 686 | AC_CHECK_DECL([AU_IPv4], [], |
467 | AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) | 687 | AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) |
468 | diff --git a/gss-genr.c b/gss-genr.c | 688 | diff --git a/gss-genr.c b/gss-genr.c |
469 | index d617d60..b4eca3f 100644 | 689 | index d617d60..b4eca3f 100644 |
@@ -1214,10 +1434,10 @@ index 53993d6..2f6baf7 100644 | |||
1214 | 1434 | ||
1215 | #endif | 1435 | #endif |
1216 | diff --git a/kex.c b/kex.c | 1436 | diff --git a/kex.c b/kex.c |
1217 | index d371f47..913e923 100644 | 1437 | index 50c7a0f..c17d652 100644 |
1218 | --- a/kex.c | 1438 | --- a/kex.c |
1219 | +++ b/kex.c | 1439 | +++ b/kex.c |
1220 | @@ -54,6 +54,10 @@ | 1440 | @@ -55,6 +55,10 @@ |
1221 | #include "sshbuf.h" | 1441 | #include "sshbuf.h" |
1222 | #include "digest.h" | 1442 | #include "digest.h" |
1223 | 1443 | ||
@@ -1228,7 +1448,7 @@ index d371f47..913e923 100644 | |||
1228 | #if OPENSSL_VERSION_NUMBER >= 0x00907000L | 1448 | #if OPENSSL_VERSION_NUMBER >= 0x00907000L |
1229 | # if defined(HAVE_EVP_SHA256) | 1449 | # if defined(HAVE_EVP_SHA256) |
1230 | # define evp_ssh_sha256 EVP_sha256 | 1450 | # define evp_ssh_sha256 EVP_sha256 |
1231 | @@ -109,6 +113,14 @@ static const struct kexalg kexalgs[] = { | 1451 | @@ -113,6 +117,14 @@ static const struct kexalg kexalgs[] = { |
1232 | #endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */ | 1452 | #endif /* HAVE_EVP_SHA256 || !WITH_OPENSSL */ |
1233 | { NULL, -1, -1, -1}, | 1453 | { NULL, -1, -1, -1}, |
1234 | }; | 1454 | }; |
@@ -1243,7 +1463,7 @@ index d371f47..913e923 100644 | |||
1243 | 1463 | ||
1244 | char * | 1464 | char * |
1245 | kex_alg_list(char sep) | 1465 | kex_alg_list(char sep) |
1246 | @@ -141,6 +153,10 @@ kex_alg_by_name(const char *name) | 1466 | @@ -145,6 +157,10 @@ kex_alg_by_name(const char *name) |
1247 | if (strcmp(k->name, name) == 0) | 1467 | if (strcmp(k->name, name) == 0) |
1248 | return k; | 1468 | return k; |
1249 | } | 1469 | } |
@@ -1254,11 +1474,21 @@ index d371f47..913e923 100644 | |||
1254 | return NULL; | 1474 | return NULL; |
1255 | } | 1475 | } |
1256 | 1476 | ||
1477 | @@ -587,6 +603,9 @@ kex_free(struct kex *kex) | ||
1478 | sshbuf_free(kex->peer); | ||
1479 | sshbuf_free(kex->my); | ||
1480 | free(kex->session_id); | ||
1481 | +#ifdef GSSAPI | ||
1482 | + free(kex->gss_host); | ||
1483 | +#endif /* GSSAPI */ | ||
1484 | free(kex->client_version_string); | ||
1485 | free(kex->server_version_string); | ||
1486 | free(kex->failed_choice); | ||
1257 | diff --git a/kex.h b/kex.h | 1487 | diff --git a/kex.h b/kex.h |
1258 | index 1c58966..123ef83 100644 | 1488 | index c351955..8ed459a 100644 |
1259 | --- a/kex.h | 1489 | --- a/kex.h |
1260 | +++ b/kex.h | 1490 | +++ b/kex.h |
1261 | @@ -92,6 +92,9 @@ enum kex_exchange { | 1491 | @@ -98,6 +98,9 @@ enum kex_exchange { |
1262 | KEX_DH_GEX_SHA256, | 1492 | KEX_DH_GEX_SHA256, |
1263 | KEX_ECDH_SHA2, | 1493 | KEX_ECDH_SHA2, |
1264 | KEX_C25519_SHA256, | 1494 | KEX_C25519_SHA256, |
@@ -1268,7 +1498,7 @@ index 1c58966..123ef83 100644 | |||
1268 | KEX_MAX | 1498 | KEX_MAX |
1269 | }; | 1499 | }; |
1270 | 1500 | ||
1271 | @@ -140,6 +143,12 @@ struct kex { | 1501 | @@ -146,6 +149,12 @@ struct kex { |
1272 | u_int flags; | 1502 | u_int flags; |
1273 | int hash_alg; | 1503 | int hash_alg; |
1274 | int ec_nid; | 1504 | int ec_nid; |
@@ -1281,7 +1511,7 @@ index 1c58966..123ef83 100644 | |||
1281 | char *client_version_string; | 1511 | char *client_version_string; |
1282 | char *server_version_string; | 1512 | char *server_version_string; |
1283 | char *failed_choice; | 1513 | char *failed_choice; |
1284 | @@ -190,6 +199,11 @@ int kexecdh_server(struct ssh *); | 1514 | @@ -196,6 +205,11 @@ int kexecdh_server(struct ssh *); |
1285 | int kexc25519_client(struct ssh *); | 1515 | int kexc25519_client(struct ssh *); |
1286 | int kexc25519_server(struct ssh *); | 1516 | int kexc25519_server(struct ssh *); |
1287 | 1517 | ||
@@ -1290,15 +1520,15 @@ index 1c58966..123ef83 100644 | |||
1290 | +int kexgss_server(struct ssh *); | 1520 | +int kexgss_server(struct ssh *); |
1291 | +#endif | 1521 | +#endif |
1292 | + | 1522 | + |
1293 | int kex_dh_hash(const char *, const char *, | 1523 | int kex_dh_hash(int, const char *, const char *, |
1294 | const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, | 1524 | const u_char *, size_t, const u_char *, size_t, const u_char *, size_t, |
1295 | const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *); | 1525 | const BIGNUM *, const BIGNUM *, const BIGNUM *, u_char *, size_t *); |
1296 | diff --git a/kexgssc.c b/kexgssc.c | 1526 | diff --git a/kexgssc.c b/kexgssc.c |
1297 | new file mode 100644 | 1527 | new file mode 100644 |
1298 | index 0000000..a49bac2 | 1528 | index 0000000..10447f2 |
1299 | --- /dev/null | 1529 | --- /dev/null |
1300 | +++ b/kexgssc.c | 1530 | +++ b/kexgssc.c |
1301 | @@ -0,0 +1,336 @@ | 1531 | @@ -0,0 +1,338 @@ |
1302 | +/* | 1532 | +/* |
1303 | + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. | 1533 | + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. |
1304 | + * | 1534 | + * |
@@ -1570,7 +1800,9 @@ index 0000000..a49bac2 | |||
1570 | + switch (ssh->kex->kex_type) { | 1800 | + switch (ssh->kex->kex_type) { |
1571 | + case KEX_GSS_GRP1_SHA1: | 1801 | + case KEX_GSS_GRP1_SHA1: |
1572 | + case KEX_GSS_GRP14_SHA1: | 1802 | + case KEX_GSS_GRP14_SHA1: |
1573 | + kex_dh_hash( ssh->kex->client_version_string, | 1803 | + kex_dh_hash( |
1804 | + ssh->kex->hash_alg, | ||
1805 | + ssh->kex->client_version_string, | ||
1574 | + ssh->kex->server_version_string, | 1806 | + ssh->kex->server_version_string, |
1575 | + buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my), | 1807 | + buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my), |
1576 | + buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer), | 1808 | + buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer), |
@@ -1637,10 +1869,10 @@ index 0000000..a49bac2 | |||
1637 | +#endif /* GSSAPI */ | 1869 | +#endif /* GSSAPI */ |
1638 | diff --git a/kexgsss.c b/kexgsss.c | 1870 | diff --git a/kexgsss.c b/kexgsss.c |
1639 | new file mode 100644 | 1871 | new file mode 100644 |
1640 | index 0000000..dd8ba1d | 1872 | index 0000000..38ca082 |
1641 | --- /dev/null | 1873 | --- /dev/null |
1642 | +++ b/kexgsss.c | 1874 | +++ b/kexgsss.c |
1643 | @@ -0,0 +1,294 @@ | 1875 | @@ -0,0 +1,295 @@ |
1644 | +/* | 1876 | +/* |
1645 | + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. | 1877 | + * Copyright (c) 2001-2009 Simon Wilkinson. All rights reserved. |
1646 | + * | 1878 | + * |
@@ -1861,6 +2093,7 @@ index 0000000..dd8ba1d | |||
1861 | + case KEX_GSS_GRP1_SHA1: | 2093 | + case KEX_GSS_GRP1_SHA1: |
1862 | + case KEX_GSS_GRP14_SHA1: | 2094 | + case KEX_GSS_GRP14_SHA1: |
1863 | + kex_dh_hash( | 2095 | + kex_dh_hash( |
2096 | + ssh->kex->hash_alg, | ||
1864 | + ssh->kex->client_version_string, ssh->kex->server_version_string, | 2097 | + ssh->kex->client_version_string, ssh->kex->server_version_string, |
1865 | + buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer), | 2098 | + buffer_ptr(ssh->kex->peer), buffer_len(ssh->kex->peer), |
1866 | + buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my), | 2099 | + buffer_ptr(ssh->kex->my), buffer_len(ssh->kex->my), |
@@ -1936,10 +2169,10 @@ index 0000000..dd8ba1d | |||
1936 | +} | 2169 | +} |
1937 | +#endif /* GSSAPI */ | 2170 | +#endif /* GSSAPI */ |
1938 | diff --git a/monitor.c b/monitor.c | 2171 | diff --git a/monitor.c b/monitor.c |
1939 | index ac7dd30..6c82023 100644 | 2172 | index cb57bd0..05bb48a 100644 |
1940 | --- a/monitor.c | 2173 | --- a/monitor.c |
1941 | +++ b/monitor.c | 2174 | +++ b/monitor.c |
1942 | @@ -156,6 +156,8 @@ int mm_answer_gss_setup_ctx(int, Buffer *); | 2175 | @@ -158,6 +158,8 @@ int mm_answer_gss_setup_ctx(int, Buffer *); |
1943 | int mm_answer_gss_accept_ctx(int, Buffer *); | 2176 | int mm_answer_gss_accept_ctx(int, Buffer *); |
1944 | int mm_answer_gss_userok(int, Buffer *); | 2177 | int mm_answer_gss_userok(int, Buffer *); |
1945 | int mm_answer_gss_checkmic(int, Buffer *); | 2178 | int mm_answer_gss_checkmic(int, Buffer *); |
@@ -1948,7 +2181,7 @@ index ac7dd30..6c82023 100644 | |||
1948 | #endif | 2181 | #endif |
1949 | 2182 | ||
1950 | #ifdef SSH_AUDIT_EVENTS | 2183 | #ifdef SSH_AUDIT_EVENTS |
1951 | @@ -233,11 +235,18 @@ struct mon_table mon_dispatch_proto20[] = { | 2184 | @@ -235,11 +237,18 @@ struct mon_table mon_dispatch_proto20[] = { |
1952 | {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx}, | 2185 | {MONITOR_REQ_GSSSTEP, MON_ISAUTH, mm_answer_gss_accept_ctx}, |
1953 | {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok}, | 2186 | {MONITOR_REQ_GSSUSEROK, MON_AUTH, mm_answer_gss_userok}, |
1954 | {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic}, | 2187 | {MONITOR_REQ_GSSCHECKMIC, MON_ISAUTH, mm_answer_gss_checkmic}, |
@@ -1967,7 +2200,7 @@ index ac7dd30..6c82023 100644 | |||
1967 | #ifdef WITH_OPENSSL | 2200 | #ifdef WITH_OPENSSL |
1968 | {MONITOR_REQ_MODULI, 0, mm_answer_moduli}, | 2201 | {MONITOR_REQ_MODULI, 0, mm_answer_moduli}, |
1969 | #endif | 2202 | #endif |
1970 | @@ -352,6 +361,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | 2203 | @@ -354,6 +363,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) |
1971 | /* Permit requests for moduli and signatures */ | 2204 | /* Permit requests for moduli and signatures */ |
1972 | monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); | 2205 | monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); |
1973 | monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); | 2206 | monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); |
@@ -1978,7 +2211,7 @@ index ac7dd30..6c82023 100644 | |||
1978 | } else { | 2211 | } else { |
1979 | mon_dispatch = mon_dispatch_proto15; | 2212 | mon_dispatch = mon_dispatch_proto15; |
1980 | 2213 | ||
1981 | @@ -460,6 +473,10 @@ monitor_child_postauth(struct monitor *pmonitor) | 2214 | @@ -462,6 +475,10 @@ monitor_child_postauth(struct monitor *pmonitor) |
1982 | monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); | 2215 | monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); |
1983 | monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); | 2216 | monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); |
1984 | monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); | 2217 | monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); |
@@ -1989,7 +2222,7 @@ index ac7dd30..6c82023 100644 | |||
1989 | } else { | 2222 | } else { |
1990 | mon_dispatch = mon_dispatch_postauth15; | 2223 | mon_dispatch = mon_dispatch_postauth15; |
1991 | monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); | 2224 | monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); |
1992 | @@ -1861,6 +1878,13 @@ monitor_apply_keystate(struct monitor *pmonitor) | 2225 | @@ -1876,6 +1893,13 @@ monitor_apply_keystate(struct monitor *pmonitor) |
1993 | # endif | 2226 | # endif |
1994 | #endif /* WITH_OPENSSL */ | 2227 | #endif /* WITH_OPENSSL */ |
1995 | kex->kex[KEX_C25519_SHA256] = kexc25519_server; | 2228 | kex->kex[KEX_C25519_SHA256] = kexc25519_server; |
@@ -2003,7 +2236,7 @@ index ac7dd30..6c82023 100644 | |||
2003 | kex->load_host_public_key=&get_hostkey_public_by_type; | 2236 | kex->load_host_public_key=&get_hostkey_public_by_type; |
2004 | kex->load_host_private_key=&get_hostkey_private_by_type; | 2237 | kex->load_host_private_key=&get_hostkey_private_by_type; |
2005 | kex->host_key_index=&get_hostkey_index; | 2238 | kex->host_key_index=&get_hostkey_index; |
2006 | @@ -1960,6 +1984,9 @@ mm_answer_gss_setup_ctx(int sock, Buffer *m) | 2239 | @@ -1975,6 +1999,9 @@ mm_answer_gss_setup_ctx(int sock, Buffer *m) |
2007 | OM_uint32 major; | 2240 | OM_uint32 major; |
2008 | u_int len; | 2241 | u_int len; |
2009 | 2242 | ||
@@ -2013,7 +2246,7 @@ index ac7dd30..6c82023 100644 | |||
2013 | goid.elements = buffer_get_string(m, &len); | 2246 | goid.elements = buffer_get_string(m, &len); |
2014 | goid.length = len; | 2247 | goid.length = len; |
2015 | 2248 | ||
2016 | @@ -1987,6 +2014,9 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) | 2249 | @@ -2002,6 +2029,9 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) |
2017 | OM_uint32 flags = 0; /* GSI needs this */ | 2250 | OM_uint32 flags = 0; /* GSI needs this */ |
2018 | u_int len; | 2251 | u_int len; |
2019 | 2252 | ||
@@ -2023,7 +2256,7 @@ index ac7dd30..6c82023 100644 | |||
2023 | in.value = buffer_get_string(m, &len); | 2256 | in.value = buffer_get_string(m, &len); |
2024 | in.length = len; | 2257 | in.length = len; |
2025 | major = ssh_gssapi_accept_ctx(gsscontext, &in, &out, &flags); | 2258 | major = ssh_gssapi_accept_ctx(gsscontext, &in, &out, &flags); |
2026 | @@ -2004,6 +2034,7 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) | 2259 | @@ -2019,6 +2049,7 @@ mm_answer_gss_accept_ctx(int sock, Buffer *m) |
2027 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0); | 2260 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSSTEP, 0); |
2028 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); | 2261 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); |
2029 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1); | 2262 | monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1); |
@@ -2031,7 +2264,7 @@ index ac7dd30..6c82023 100644 | |||
2031 | } | 2264 | } |
2032 | return (0); | 2265 | return (0); |
2033 | } | 2266 | } |
2034 | @@ -2015,6 +2046,9 @@ mm_answer_gss_checkmic(int sock, Buffer *m) | 2267 | @@ -2030,6 +2061,9 @@ mm_answer_gss_checkmic(int sock, Buffer *m) |
2035 | OM_uint32 ret; | 2268 | OM_uint32 ret; |
2036 | u_int len; | 2269 | u_int len; |
2037 | 2270 | ||
@@ -2041,7 +2274,7 @@ index ac7dd30..6c82023 100644 | |||
2041 | gssbuf.value = buffer_get_string(m, &len); | 2274 | gssbuf.value = buffer_get_string(m, &len); |
2042 | gssbuf.length = len; | 2275 | gssbuf.length = len; |
2043 | mic.value = buffer_get_string(m, &len); | 2276 | mic.value = buffer_get_string(m, &len); |
2044 | @@ -2041,7 +2075,11 @@ mm_answer_gss_userok(int sock, Buffer *m) | 2277 | @@ -2056,7 +2090,11 @@ mm_answer_gss_userok(int sock, Buffer *m) |
2045 | { | 2278 | { |
2046 | int authenticated; | 2279 | int authenticated; |
2047 | 2280 | ||
@@ -2054,7 +2287,7 @@ index ac7dd30..6c82023 100644 | |||
2054 | 2287 | ||
2055 | buffer_clear(m); | 2288 | buffer_clear(m); |
2056 | buffer_put_int(m, authenticated); | 2289 | buffer_put_int(m, authenticated); |
2057 | @@ -2054,5 +2092,73 @@ mm_answer_gss_userok(int sock, Buffer *m) | 2290 | @@ -2069,5 +2107,73 @@ mm_answer_gss_userok(int sock, Buffer *m) |
2058 | /* Monitor loop will terminate if authenticated */ | 2291 | /* Monitor loop will terminate if authenticated */ |
2059 | return (authenticated); | 2292 | return (authenticated); |
2060 | } | 2293 | } |
@@ -2143,10 +2376,10 @@ index 93b8b66..bc50ade 100644 | |||
2143 | 2376 | ||
2144 | struct mm_master; | 2377 | struct mm_master; |
2145 | diff --git a/monitor_wrap.c b/monitor_wrap.c | 2378 | diff --git a/monitor_wrap.c b/monitor_wrap.c |
2146 | index c5db6df..74fbd2e 100644 | 2379 | index 99dc13b..5a9f1b5 100644 |
2147 | --- a/monitor_wrap.c | 2380 | --- a/monitor_wrap.c |
2148 | +++ b/monitor_wrap.c | 2381 | +++ b/monitor_wrap.c |
2149 | @@ -1068,7 +1068,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) | 2382 | @@ -1073,7 +1073,7 @@ mm_ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic) |
2150 | } | 2383 | } |
2151 | 2384 | ||
2152 | int | 2385 | int |
@@ -2155,7 +2388,7 @@ index c5db6df..74fbd2e 100644 | |||
2155 | { | 2388 | { |
2156 | Buffer m; | 2389 | Buffer m; |
2157 | int authenticated = 0; | 2390 | int authenticated = 0; |
2158 | @@ -1085,5 +1085,50 @@ mm_ssh_gssapi_userok(char *user) | 2391 | @@ -1090,5 +1090,50 @@ mm_ssh_gssapi_userok(char *user) |
2159 | debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not "); | 2392 | debug3("%s: user %sauthenticated",__func__, authenticated ? "" : "not "); |
2160 | return (authenticated); | 2393 | return (authenticated); |
2161 | } | 2394 | } |
@@ -2207,10 +2440,10 @@ index c5db6df..74fbd2e 100644 | |||
2207 | #endif /* GSSAPI */ | 2440 | #endif /* GSSAPI */ |
2208 | 2441 | ||
2209 | diff --git a/monitor_wrap.h b/monitor_wrap.h | 2442 | diff --git a/monitor_wrap.h b/monitor_wrap.h |
2210 | index eb820ae..403f8d0 100644 | 2443 | index 9fd02b3..b5414c2 100644 |
2211 | --- a/monitor_wrap.h | 2444 | --- a/monitor_wrap.h |
2212 | +++ b/monitor_wrap.h | 2445 | +++ b/monitor_wrap.h |
2213 | @@ -58,8 +58,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *); | 2446 | @@ -60,8 +60,10 @@ BIGNUM *mm_auth_rsa_generate_challenge(Key *); |
2214 | OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID); | 2447 | OM_uint32 mm_ssh_gssapi_server_ctx(Gssctxt **, gss_OID); |
2215 | OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *, | 2448 | OM_uint32 mm_ssh_gssapi_accept_ctx(Gssctxt *, |
2216 | gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *); | 2449 | gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *); |
@@ -2223,10 +2456,10 @@ index eb820ae..403f8d0 100644 | |||
2223 | 2456 | ||
2224 | #ifdef USE_PAM | 2457 | #ifdef USE_PAM |
2225 | diff --git a/readconf.c b/readconf.c | 2458 | diff --git a/readconf.c b/readconf.c |
2226 | index 69d4553..d2a3d4b 100644 | 2459 | index c177202..e019195 100644 |
2227 | --- a/readconf.c | 2460 | --- a/readconf.c |
2228 | +++ b/readconf.c | 2461 | +++ b/readconf.c |
2229 | @@ -148,6 +148,8 @@ typedef enum { | 2462 | @@ -160,6 +160,8 @@ typedef enum { |
2230 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, | 2463 | oClearAllForwardings, oNoHostAuthenticationForLocalhost, |
2231 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, | 2464 | oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout, |
2232 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, | 2465 | oAddressFamily, oGssAuthentication, oGssDelegateCreds, |
@@ -2235,7 +2468,7 @@ index 69d4553..d2a3d4b 100644 | |||
2235 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, | 2468 | oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly, |
2236 | oSendEnv, oControlPath, oControlMaster, oControlPersist, | 2469 | oSendEnv, oControlPath, oControlMaster, oControlPersist, |
2237 | oHashKnownHosts, | 2470 | oHashKnownHosts, |
2238 | @@ -193,10 +195,19 @@ static struct { | 2471 | @@ -205,10 +207,19 @@ static struct { |
2239 | { "afstokenpassing", oUnsupported }, | 2472 | { "afstokenpassing", oUnsupported }, |
2240 | #if defined(GSSAPI) | 2473 | #if defined(GSSAPI) |
2241 | { "gssapiauthentication", oGssAuthentication }, | 2474 | { "gssapiauthentication", oGssAuthentication }, |
@@ -2255,7 +2488,7 @@ index 69d4553..d2a3d4b 100644 | |||
2255 | #endif | 2488 | #endif |
2256 | { "fallbacktorsh", oDeprecated }, | 2489 | { "fallbacktorsh", oDeprecated }, |
2257 | { "usersh", oDeprecated }, | 2490 | { "usersh", oDeprecated }, |
2258 | @@ -926,10 +937,30 @@ parse_time: | 2491 | @@ -962,10 +973,30 @@ parse_time: |
2259 | intptr = &options->gss_authentication; | 2492 | intptr = &options->gss_authentication; |
2260 | goto parse_flag; | 2493 | goto parse_flag; |
2261 | 2494 | ||
@@ -2286,7 +2519,7 @@ index 69d4553..d2a3d4b 100644 | |||
2286 | case oBatchMode: | 2519 | case oBatchMode: |
2287 | intptr = &options->batch_mode; | 2520 | intptr = &options->batch_mode; |
2288 | goto parse_flag; | 2521 | goto parse_flag; |
2289 | @@ -1648,7 +1679,12 @@ initialize_options(Options * options) | 2522 | @@ -1777,7 +1808,12 @@ initialize_options(Options * options) |
2290 | options->pubkey_authentication = -1; | 2523 | options->pubkey_authentication = -1; |
2291 | options->challenge_response_authentication = -1; | 2524 | options->challenge_response_authentication = -1; |
2292 | options->gss_authentication = -1; | 2525 | options->gss_authentication = -1; |
@@ -2299,7 +2532,7 @@ index 69d4553..d2a3d4b 100644 | |||
2299 | options->password_authentication = -1; | 2532 | options->password_authentication = -1; |
2300 | options->kbd_interactive_authentication = -1; | 2533 | options->kbd_interactive_authentication = -1; |
2301 | options->kbd_interactive_devices = NULL; | 2534 | options->kbd_interactive_devices = NULL; |
2302 | @@ -1777,8 +1813,14 @@ fill_default_options(Options * options) | 2535 | @@ -1921,8 +1957,14 @@ fill_default_options(Options * options) |
2303 | options->challenge_response_authentication = 1; | 2536 | options->challenge_response_authentication = 1; |
2304 | if (options->gss_authentication == -1) | 2537 | if (options->gss_authentication == -1) |
2305 | options->gss_authentication = 0; | 2538 | options->gss_authentication = 0; |
@@ -2315,7 +2548,7 @@ index 69d4553..d2a3d4b 100644 | |||
2315 | options->password_authentication = 1; | 2548 | options->password_authentication = 1; |
2316 | if (options->kbd_interactive_authentication == -1) | 2549 | if (options->kbd_interactive_authentication == -1) |
2317 | diff --git a/readconf.h b/readconf.h | 2550 | diff --git a/readconf.h b/readconf.h |
2318 | index c84d068..37a0555 100644 | 2551 | index cef55f7..fd3d7c7 100644 |
2319 | --- a/readconf.h | 2552 | --- a/readconf.h |
2320 | +++ b/readconf.h | 2553 | +++ b/readconf.h |
2321 | @@ -45,7 +45,12 @@ typedef struct { | 2554 | @@ -45,7 +45,12 @@ typedef struct { |
@@ -2332,7 +2565,7 @@ index c84d068..37a0555 100644 | |||
2332 | * authentication. */ | 2565 | * authentication. */ |
2333 | int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ | 2566 | int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ |
2334 | diff --git a/servconf.c b/servconf.c | 2567 | diff --git a/servconf.c b/servconf.c |
2335 | index b19d30e..b8af6dd 100644 | 2568 | index 873b0d0..9b06281 100644 |
2336 | --- a/servconf.c | 2569 | --- a/servconf.c |
2337 | +++ b/servconf.c | 2570 | +++ b/servconf.c |
2338 | @@ -117,8 +117,10 @@ initialize_server_options(ServerOptions *options) | 2571 | @@ -117,8 +117,10 @@ initialize_server_options(ServerOptions *options) |
@@ -2362,7 +2595,7 @@ index b19d30e..b8af6dd 100644 | |||
2362 | if (options->password_authentication == -1) | 2595 | if (options->password_authentication == -1) |
2363 | options->password_authentication = 1; | 2596 | options->password_authentication = 1; |
2364 | if (options->kbd_interactive_authentication == -1) | 2597 | if (options->kbd_interactive_authentication == -1) |
2365 | @@ -419,6 +425,7 @@ typedef enum { | 2598 | @@ -427,6 +433,7 @@ typedef enum { |
2366 | sHostKeyAlgorithms, | 2599 | sHostKeyAlgorithms, |
2367 | sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile, | 2600 | sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile, |
2368 | sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, | 2601 | sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor, |
@@ -2370,7 +2603,7 @@ index b19d30e..b8af6dd 100644 | |||
2370 | sAcceptEnv, sPermitTunnel, | 2603 | sAcceptEnv, sPermitTunnel, |
2371 | sMatch, sPermitOpen, sForceCommand, sChrootDirectory, | 2604 | sMatch, sPermitOpen, sForceCommand, sChrootDirectory, |
2372 | sUsePrivilegeSeparation, sAllowAgentForwarding, | 2605 | sUsePrivilegeSeparation, sAllowAgentForwarding, |
2373 | @@ -492,12 +499,20 @@ static struct { | 2606 | @@ -500,12 +507,20 @@ static struct { |
2374 | #ifdef GSSAPI | 2607 | #ifdef GSSAPI |
2375 | { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL }, | 2608 | { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL }, |
2376 | { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL }, | 2609 | { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL }, |
@@ -2391,7 +2624,7 @@ index b19d30e..b8af6dd 100644 | |||
2391 | { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL }, | 2624 | { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL }, |
2392 | { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL }, | 2625 | { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL }, |
2393 | { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, | 2626 | { "challengeresponseauthentication", sChallengeResponseAuthentication, SSHCFG_GLOBAL }, |
2394 | @@ -1242,6 +1257,10 @@ process_server_config_line(ServerOptions *options, char *line, | 2627 | @@ -1251,6 +1266,10 @@ process_server_config_line(ServerOptions *options, char *line, |
2395 | intptr = &options->gss_authentication; | 2628 | intptr = &options->gss_authentication; |
2396 | goto parse_flag; | 2629 | goto parse_flag; |
2397 | 2630 | ||
@@ -2402,7 +2635,7 @@ index b19d30e..b8af6dd 100644 | |||
2402 | case sGssCleanupCreds: | 2635 | case sGssCleanupCreds: |
2403 | intptr = &options->gss_cleanup_creds; | 2636 | intptr = &options->gss_cleanup_creds; |
2404 | goto parse_flag; | 2637 | goto parse_flag; |
2405 | @@ -1250,6 +1269,10 @@ process_server_config_line(ServerOptions *options, char *line, | 2638 | @@ -1259,6 +1278,10 @@ process_server_config_line(ServerOptions *options, char *line, |
2406 | intptr = &options->gss_strict_acceptor; | 2639 | intptr = &options->gss_strict_acceptor; |
2407 | goto parse_flag; | 2640 | goto parse_flag; |
2408 | 2641 | ||
@@ -2413,7 +2646,7 @@ index b19d30e..b8af6dd 100644 | |||
2413 | case sPasswordAuthentication: | 2646 | case sPasswordAuthentication: |
2414 | intptr = &options->password_authentication; | 2647 | intptr = &options->password_authentication; |
2415 | goto parse_flag; | 2648 | goto parse_flag; |
2416 | @@ -2265,7 +2288,10 @@ dump_config(ServerOptions *o) | 2649 | @@ -2308,7 +2331,10 @@ dump_config(ServerOptions *o) |
2417 | #endif | 2650 | #endif |
2418 | #ifdef GSSAPI | 2651 | #ifdef GSSAPI |
2419 | dump_cfg_fmtint(sGssAuthentication, o->gss_authentication); | 2652 | dump_cfg_fmtint(sGssAuthentication, o->gss_authentication); |
@@ -2556,7 +2789,7 @@ index 90fb63f..4e879cd 100644 | |||
2556 | # CheckHostIP yes | 2789 | # CheckHostIP yes |
2557 | # AddressFamily any | 2790 | # AddressFamily any |
2558 | diff --git a/ssh_config.5 b/ssh_config.5 | 2791 | diff --git a/ssh_config.5 b/ssh_config.5 |
2559 | index caf13a6..9060d5b 100644 | 2792 | index 7630e7b..707d0e1 100644 |
2560 | --- a/ssh_config.5 | 2793 | --- a/ssh_config.5 |
2561 | +++ b/ssh_config.5 | 2794 | +++ b/ssh_config.5 |
2562 | @@ -826,10 +826,42 @@ The default is | 2795 | @@ -826,10 +826,42 @@ The default is |
@@ -2603,10 +2836,10 @@ index caf13a6..9060d5b 100644 | |||
2603 | Indicates that | 2836 | Indicates that |
2604 | .Xr ssh 1 | 2837 | .Xr ssh 1 |
2605 | diff --git a/sshconnect2.c b/sshconnect2.c | 2838 | diff --git a/sshconnect2.c b/sshconnect2.c |
2606 | index f79c96b..b452eae 100644 | 2839 | index fae8b0f..34b9d30 100644 |
2607 | --- a/sshconnect2.c | 2840 | --- a/sshconnect2.c |
2608 | +++ b/sshconnect2.c | 2841 | +++ b/sshconnect2.c |
2609 | @@ -161,6 +161,11 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) | 2842 | @@ -162,6 +162,11 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) |
2610 | struct kex *kex; | 2843 | struct kex *kex; |
2611 | int r; | 2844 | int r; |
2612 | 2845 | ||
@@ -2618,7 +2851,7 @@ index f79c96b..b452eae 100644 | |||
2618 | xxx_host = host; | 2851 | xxx_host = host; |
2619 | xxx_hostaddr = hostaddr; | 2852 | xxx_hostaddr = hostaddr; |
2620 | 2853 | ||
2621 | @@ -195,6 +200,33 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) | 2854 | @@ -192,6 +197,36 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) |
2622 | order_hostkeyalgs(host, hostaddr, port)); | 2855 | order_hostkeyalgs(host, hostaddr, port)); |
2623 | } | 2856 | } |
2624 | 2857 | ||
@@ -2628,12 +2861,15 @@ index f79c96b..b452eae 100644 | |||
2628 | + * client to the key exchange algorithm proposal */ | 2861 | + * client to the key exchange algorithm proposal */ |
2629 | + orig = myproposal[PROPOSAL_KEX_ALGS]; | 2862 | + orig = myproposal[PROPOSAL_KEX_ALGS]; |
2630 | + | 2863 | + |
2631 | + if (options.gss_trust_dns) | 2864 | + if (options.gss_server_identity) |
2632 | + gss_host = (char *)get_canonical_hostname(1); | 2865 | + gss_host = xstrdup(options.gss_server_identity); |
2866 | + else if (options.gss_trust_dns) | ||
2867 | + gss_host = remote_hostname(active_state); | ||
2633 | + else | 2868 | + else |
2634 | + gss_host = host; | 2869 | + gss_host = xstrdup(host); |
2635 | + | 2870 | + |
2636 | + gss = ssh_gssapi_client_mechanisms(gss_host, options.gss_client_identity); | 2871 | + gss = ssh_gssapi_client_mechanisms(gss_host, |
2872 | + options.gss_client_identity); | ||
2637 | + if (gss) { | 2873 | + if (gss) { |
2638 | + debug("Offering GSSAPI proposal: %s", gss); | 2874 | + debug("Offering GSSAPI proposal: %s", gss); |
2639 | + xasprintf(&myproposal[PROPOSAL_KEX_ALGS], | 2875 | + xasprintf(&myproposal[PROPOSAL_KEX_ALGS], |
@@ -2652,7 +2888,7 @@ index f79c96b..b452eae 100644 | |||
2652 | if (options.rekey_limit || options.rekey_interval) | 2888 | if (options.rekey_limit || options.rekey_interval) |
2653 | packet_set_rekey_limits((u_int32_t)options.rekey_limit, | 2889 | packet_set_rekey_limits((u_int32_t)options.rekey_limit, |
2654 | (time_t)options.rekey_interval); | 2890 | (time_t)options.rekey_interval); |
2655 | @@ -213,10 +245,30 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) | 2891 | @@ -213,10 +248,26 @@ ssh_kex2(char *host, struct sockaddr *hostaddr, u_short port) |
2656 | # endif | 2892 | # endif |
2657 | #endif | 2893 | #endif |
2658 | kex->kex[KEX_C25519_SHA256] = kexc25519_client; | 2894 | kex->kex[KEX_C25519_SHA256] = kexc25519_client; |
@@ -2672,18 +2908,14 @@ index f79c96b..b452eae 100644 | |||
2672 | + kex->gss_deleg_creds = options.gss_deleg_creds; | 2908 | + kex->gss_deleg_creds = options.gss_deleg_creds; |
2673 | + kex->gss_trust_dns = options.gss_trust_dns; | 2909 | + kex->gss_trust_dns = options.gss_trust_dns; |
2674 | + kex->gss_client = options.gss_client_identity; | 2910 | + kex->gss_client = options.gss_client_identity; |
2675 | + if (options.gss_server_identity) { | 2911 | + kex->gss_host = gss_host; |
2676 | + kex->gss_host = options.gss_server_identity; | ||
2677 | + } else { | ||
2678 | + kex->gss_host = gss_host; | ||
2679 | + } | ||
2680 | + } | 2912 | + } |
2681 | +#endif | 2913 | +#endif |
2682 | + | 2914 | + |
2683 | dispatch_run(DISPATCH_BLOCK, &kex->done, active_state); | 2915 | dispatch_run(DISPATCH_BLOCK, &kex->done, active_state); |
2684 | 2916 | ||
2685 | /* remove ext-info from the KEX proposals for rekeying */ | 2917 | /* remove ext-info from the KEX proposals for rekeying */ |
2686 | @@ -311,6 +363,7 @@ int input_gssapi_token(int type, u_int32_t, void *); | 2918 | @@ -311,6 +362,7 @@ int input_gssapi_token(int type, u_int32_t, void *); |
2687 | int input_gssapi_hash(int type, u_int32_t, void *); | 2919 | int input_gssapi_hash(int type, u_int32_t, void *); |
2688 | int input_gssapi_error(int, u_int32_t, void *); | 2920 | int input_gssapi_error(int, u_int32_t, void *); |
2689 | int input_gssapi_errtok(int, u_int32_t, void *); | 2921 | int input_gssapi_errtok(int, u_int32_t, void *); |
@@ -2691,7 +2923,7 @@ index f79c96b..b452eae 100644 | |||
2691 | #endif | 2923 | #endif |
2692 | 2924 | ||
2693 | void userauth(Authctxt *, char *); | 2925 | void userauth(Authctxt *, char *); |
2694 | @@ -326,6 +379,11 @@ static char *authmethods_get(void); | 2926 | @@ -326,6 +378,11 @@ static char *authmethods_get(void); |
2695 | 2927 | ||
2696 | Authmethod authmethods[] = { | 2928 | Authmethod authmethods[] = { |
2697 | #ifdef GSSAPI | 2929 | #ifdef GSSAPI |
@@ -2703,18 +2935,18 @@ index f79c96b..b452eae 100644 | |||
2703 | {"gssapi-with-mic", | 2935 | {"gssapi-with-mic", |
2704 | userauth_gssapi, | 2936 | userauth_gssapi, |
2705 | NULL, | 2937 | NULL, |
2706 | @@ -656,19 +714,31 @@ userauth_gssapi(Authctxt *authctxt) | 2938 | @@ -650,25 +707,40 @@ userauth_gssapi(Authctxt *authctxt) |
2707 | static u_int mech = 0; | 2939 | static u_int mech = 0; |
2708 | OM_uint32 min; | 2940 | OM_uint32 min; |
2709 | int ok = 0; | 2941 | int ok = 0; |
2710 | + const char *gss_host; | 2942 | + char *gss_host; |
2711 | + | 2943 | + |
2712 | + if (options.gss_server_identity) | 2944 | + if (options.gss_server_identity) |
2713 | + gss_host = options.gss_server_identity; | 2945 | + gss_host = xstrdup(options.gss_server_identity); |
2714 | + else if (options.gss_trust_dns) | 2946 | + else if (options.gss_trust_dns) |
2715 | + gss_host = get_canonical_hostname(1); | 2947 | + gss_host = remote_hostname(active_state); |
2716 | + else | 2948 | + else |
2717 | + gss_host = authctxt->host; | 2949 | + gss_host = xstrdup(authctxt->host); |
2718 | 2950 | ||
2719 | /* Try one GSSAPI method at a time, rather than sending them all at | 2951 | /* Try one GSSAPI method at a time, rather than sending them all at |
2720 | * once. */ | 2952 | * once. */ |
@@ -2723,6 +2955,7 @@ index f79c96b..b452eae 100644 | |||
2723 | - gss_indicate_mechs(&min, &gss_supported); | 2955 | - gss_indicate_mechs(&min, &gss_supported); |
2724 | + if (GSS_ERROR(gss_indicate_mechs(&min, &gss_supported))) { | 2956 | + if (GSS_ERROR(gss_indicate_mechs(&min, &gss_supported))) { |
2725 | + gss_supported = NULL; | 2957 | + gss_supported = NULL; |
2958 | + free(gss_host); | ||
2726 | + return 0; | 2959 | + return 0; |
2727 | + } | 2960 | + } |
2728 | 2961 | ||
@@ -2737,7 +2970,15 @@ index f79c96b..b452eae 100644 | |||
2737 | ok = 1; /* Mechanism works */ | 2970 | ok = 1; /* Mechanism works */ |
2738 | } else { | 2971 | } else { |
2739 | mech++; | 2972 | mech++; |
2740 | @@ -765,8 +835,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | 2973 | } |
2974 | } | ||
2975 | |||
2976 | + free(gss_host); | ||
2977 | + | ||
2978 | if (!ok) | ||
2979 | return 0; | ||
2980 | |||
2981 | @@ -759,8 +831,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | ||
2741 | { | 2982 | { |
2742 | Authctxt *authctxt = ctxt; | 2983 | Authctxt *authctxt = ctxt; |
2743 | Gssctxt *gssctxt; | 2984 | Gssctxt *gssctxt; |
@@ -2748,7 +2989,7 @@ index f79c96b..b452eae 100644 | |||
2748 | 2989 | ||
2749 | if (authctxt == NULL) | 2990 | if (authctxt == NULL) |
2750 | fatal("input_gssapi_response: no authentication context"); | 2991 | fatal("input_gssapi_response: no authentication context"); |
2751 | @@ -879,6 +949,48 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt) | 2992 | @@ -873,6 +945,48 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt) |
2752 | free(lang); | 2993 | free(lang); |
2753 | return 0; | 2994 | return 0; |
2754 | } | 2995 | } |
@@ -2798,7 +3039,7 @@ index f79c96b..b452eae 100644 | |||
2798 | 3039 | ||
2799 | int | 3040 | int |
2800 | diff --git a/sshd.c b/sshd.c | 3041 | diff --git a/sshd.c b/sshd.c |
2801 | index 430569c..5cd9129 100644 | 3042 | index 799c771..ebb88c7 100644 |
2802 | --- a/sshd.c | 3043 | --- a/sshd.c |
2803 | +++ b/sshd.c | 3044 | +++ b/sshd.c |
2804 | @@ -125,6 +125,10 @@ | 3045 | @@ -125,6 +125,10 @@ |
@@ -2812,7 +3053,7 @@ index 430569c..5cd9129 100644 | |||
2812 | #ifndef O_NOCTTY | 3053 | #ifndef O_NOCTTY |
2813 | #define O_NOCTTY 0 | 3054 | #define O_NOCTTY 0 |
2814 | #endif | 3055 | #endif |
2815 | @@ -1833,10 +1837,13 @@ main(int ac, char **av) | 3056 | @@ -1892,10 +1896,13 @@ main(int ac, char **av) |
2816 | logit("Disabling protocol version 1. Could not load host key"); | 3057 | logit("Disabling protocol version 1. Could not load host key"); |
2817 | options.protocol &= ~SSH_PROTO_1; | 3058 | options.protocol &= ~SSH_PROTO_1; |
2818 | } | 3059 | } |
@@ -2826,8 +3067,8 @@ index 430569c..5cd9129 100644 | |||
2826 | if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) { | 3067 | if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) { |
2827 | logit("sshd: no hostkeys available -- exiting."); | 3068 | logit("sshd: no hostkeys available -- exiting."); |
2828 | exit(1); | 3069 | exit(1); |
2829 | @@ -2151,6 +2158,60 @@ main(int ac, char **av) | 3070 | @@ -2207,6 +2214,60 @@ main(int ac, char **av) |
2830 | remote_ip, remote_port, laddr, get_local_port()); | 3071 | remote_ip, remote_port, laddr, ssh_local_port(ssh)); |
2831 | free(laddr); | 3072 | free(laddr); |
2832 | 3073 | ||
2833 | +#ifdef USE_SECURITY_SESSION_API | 3074 | +#ifdef USE_SECURITY_SESSION_API |
@@ -2887,7 +3128,7 @@ index 430569c..5cd9129 100644 | |||
2887 | /* | 3128 | /* |
2888 | * We don't want to listen forever unless the other side | 3129 | * We don't want to listen forever unless the other side |
2889 | * successfully authenticates itself. So we set up an alarm which is | 3130 | * successfully authenticates itself. So we set up an alarm which is |
2890 | @@ -2571,6 +2632,48 @@ do_ssh2_kex(void) | 3131 | @@ -2631,6 +2692,48 @@ do_ssh2_kex(void) |
2891 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( | 3132 | myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = compat_pkalg_proposal( |
2892 | list_hostkey_types()); | 3133 | list_hostkey_types()); |
2893 | 3134 | ||
@@ -2936,7 +3177,7 @@ index 430569c..5cd9129 100644 | |||
2936 | /* start key exchange */ | 3177 | /* start key exchange */ |
2937 | if ((r = kex_setup(active_state, myproposal)) != 0) | 3178 | if ((r = kex_setup(active_state, myproposal)) != 0) |
2938 | fatal("kex_setup: %s", ssh_err(r)); | 3179 | fatal("kex_setup: %s", ssh_err(r)); |
2939 | @@ -2585,6 +2688,13 @@ do_ssh2_kex(void) | 3180 | @@ -2648,6 +2751,13 @@ do_ssh2_kex(void) |
2940 | # endif | 3181 | # endif |
2941 | #endif | 3182 | #endif |
2942 | kex->kex[KEX_C25519_SHA256] = kexc25519_server; | 3183 | kex->kex[KEX_C25519_SHA256] = kexc25519_server; |
@@ -2951,10 +3192,10 @@ index 430569c..5cd9129 100644 | |||
2951 | kex->client_version_string=client_version_string; | 3192 | kex->client_version_string=client_version_string; |
2952 | kex->server_version_string=server_version_string; | 3193 | kex->server_version_string=server_version_string; |
2953 | diff --git a/sshd_config b/sshd_config | 3194 | diff --git a/sshd_config b/sshd_config |
2954 | index a848d73..f103298 100644 | 3195 | index 75ae8e7..3fe3e01 100644 |
2955 | --- a/sshd_config | 3196 | --- a/sshd_config |
2956 | +++ b/sshd_config | 3197 | +++ b/sshd_config |
2957 | @@ -84,6 +84,8 @@ AuthorizedKeysFile .ssh/authorized_keys | 3198 | @@ -83,6 +83,8 @@ AuthorizedKeysFile .ssh/authorized_keys |
2958 | # GSSAPI options | 3199 | # GSSAPI options |
2959 | #GSSAPIAuthentication no | 3200 | #GSSAPIAuthentication no |
2960 | #GSSAPICleanupCredentials yes | 3201 | #GSSAPICleanupCredentials yes |
@@ -2964,10 +3205,10 @@ index a848d73..f103298 100644 | |||
2964 | # Set this to 'yes' to enable PAM authentication, account processing, | 3205 | # Set this to 'yes' to enable PAM authentication, account processing, |
2965 | # and session processing. If this is enabled, PAM authentication will | 3206 | # and session processing. If this is enabled, PAM authentication will |
2966 | diff --git a/sshd_config.5 b/sshd_config.5 | 3207 | diff --git a/sshd_config.5 b/sshd_config.5 |
2967 | index a37a3ac..c6d6858 100644 | 3208 | index 1bc26ec..3b4cba9 100644 |
2968 | --- a/sshd_config.5 | 3209 | --- a/sshd_config.5 |
2969 | +++ b/sshd_config.5 | 3210 | +++ b/sshd_config.5 |
2970 | @@ -623,6 +623,11 @@ The default is | 3211 | @@ -632,6 +632,11 @@ The default is |
2971 | Specifies whether user authentication based on GSSAPI is allowed. | 3212 | Specifies whether user authentication based on GSSAPI is allowed. |
2972 | The default is | 3213 | The default is |
2973 | .Dq no . | 3214 | .Dq no . |
@@ -2979,7 +3220,7 @@ index a37a3ac..c6d6858 100644 | |||
2979 | .It Cm GSSAPICleanupCredentials | 3220 | .It Cm GSSAPICleanupCredentials |
2980 | Specifies whether to automatically destroy the user's credentials cache | 3221 | Specifies whether to automatically destroy the user's credentials cache |
2981 | on logout. | 3222 | on logout. |
2982 | @@ -643,6 +648,11 @@ machine's default store. | 3223 | @@ -652,6 +657,11 @@ machine's default store. |
2983 | This facility is provided to assist with operation on multi homed machines. | 3224 | This facility is provided to assist with operation on multi homed machines. |
2984 | The default is | 3225 | The default is |
2985 | .Dq yes . | 3226 | .Dq yes . |
@@ -2992,7 +3233,7 @@ index a37a3ac..c6d6858 100644 | |||
2992 | Specifies the key types that will be accepted for hostbased authentication | 3233 | Specifies the key types that will be accepted for hostbased authentication |
2993 | as a comma-separated pattern list. | 3234 | as a comma-separated pattern list. |
2994 | diff --git a/sshkey.c b/sshkey.c | 3235 | diff --git a/sshkey.c b/sshkey.c |
2995 | index 87b093e..e595b11 100644 | 3236 | index c9f04cd..558bbbe 100644 |
2996 | --- a/sshkey.c | 3237 | --- a/sshkey.c |
2997 | +++ b/sshkey.c | 3238 | +++ b/sshkey.c |
2998 | @@ -115,6 +115,7 @@ static const struct keytype keytypes[] = { | 3239 | @@ -115,6 +115,7 @@ static const struct keytype keytypes[] = { |
@@ -3013,7 +3254,7 @@ index 87b093e..e595b11 100644 | |||
3013 | if ((certs_only && !kt->cert) || (plain_only && kt->cert)) | 3254 | if ((certs_only && !kt->cert) || (plain_only && kt->cert)) |
3014 | continue; | 3255 | continue; |
3015 | diff --git a/sshkey.h b/sshkey.h | 3256 | diff --git a/sshkey.h b/sshkey.h |
3016 | index a20a14f..2259cbb 100644 | 3257 | index 8c3d866..e0caa37 100644 |
3017 | --- a/sshkey.h | 3258 | --- a/sshkey.h |
3018 | +++ b/sshkey.h | 3259 | +++ b/sshkey.h |
3019 | @@ -62,6 +62,7 @@ enum sshkey_types { | 3260 | @@ -62,6 +62,7 @@ enum sshkey_types { |