diff options
author | Colin Watson <cjwatson@debian.org> | 2019-06-05 06:41:44 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2019-06-09 22:09:07 +0100 |
commit | 865a97e05b6aab1619e1c8eeb33ccb8f9a9e48d3 (patch) | |
tree | 7bb2128eb663180bacfabca88f26d26bf0733824 /gss-serv.c | |
parent | ba627ba172d6649919baedff5ba2789610da382a (diff) | |
parent | 7d50f9e5be88179325983a1f58c9d51bb58f025a (diff) |
New upstream release (8.0p1)
Diffstat (limited to 'gss-serv.c')
-rw-r--r-- | gss-serv.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gss-serv.c b/gss-serv.c index 6c087a1b1..1d47870e7 100644 --- a/gss-serv.c +++ b/gss-serv.c | |||
@@ -51,12 +51,9 @@ | |||
51 | 51 | ||
52 | extern ServerOptions options; | 52 | extern ServerOptions options; |
53 | 53 | ||
54 | extern ServerOptions options; | ||
55 | |||
56 | static ssh_gssapi_client gssapi_client = | 54 | static ssh_gssapi_client gssapi_client = |
57 | { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, | 55 | { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, GSS_C_NO_CREDENTIAL, |
58 | GSS_C_NO_CREDENTIAL, GSS_C_NO_NAME, NULL, | 56 | GSS_C_NO_NAME, NULL, {NULL, NULL, NULL, NULL, NULL}, 0, 0}; |
59 | {NULL, NULL, NULL, NULL, NULL}, 0, 0}; | ||
60 | 57 | ||
61 | ssh_gssapi_mech gssapi_null_mech = | 58 | ssh_gssapi_mech gssapi_null_mech = |
62 | { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL, NULL}; | 59 | { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL, NULL}; |
@@ -151,7 +148,8 @@ ssh_gssapi_server_mechanisms(void) { | |||
151 | if (supported_oids == NULL) | 148 | if (supported_oids == NULL) |
152 | ssh_gssapi_prepare_supported_oids(); | 149 | ssh_gssapi_prepare_supported_oids(); |
153 | return (ssh_gssapi_kex_mechs(supported_oids, | 150 | return (ssh_gssapi_kex_mechs(supported_oids, |
154 | &ssh_gssapi_server_check_mech, NULL, NULL)); | 151 | &ssh_gssapi_server_check_mech, NULL, NULL, |
152 | options.gss_kex_algorithms)); | ||
155 | } | 153 | } |
156 | 154 | ||
157 | /* Unprivileged */ | 155 | /* Unprivileged */ |
@@ -160,7 +158,7 @@ ssh_gssapi_server_check_mech(Gssctxt **dum, gss_OID oid, const char *data, | |||
160 | const char *dummy) { | 158 | const char *dummy) { |
161 | Gssctxt *ctx = NULL; | 159 | Gssctxt *ctx = NULL; |
162 | int res; | 160 | int res; |
163 | 161 | ||
164 | res = !GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctx, oid))); | 162 | res = !GSS_ERROR(PRIVSEP(ssh_gssapi_server_ctx(&ctx, oid))); |
165 | ssh_gssapi_delete_ctx(&ctx); | 163 | ssh_gssapi_delete_ctx(&ctx); |
166 | 164 | ||
@@ -317,21 +315,21 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) | |||
317 | return GSS_S_COMPLETE; | 315 | return GSS_S_COMPLETE; |
318 | } | 316 | } |
319 | 317 | ||
320 | if ((ctx->major = gss_inquire_cred_by_mech(&ctx->minor, | 318 | if ((ctx->major = gss_inquire_cred_by_mech(&ctx->minor, |
321 | ctx->client_creds, ctx->oid, &new_name, | 319 | ctx->client_creds, ctx->oid, &new_name, |
322 | NULL, NULL, NULL))) { | 320 | NULL, NULL, NULL))) { |
323 | ssh_gssapi_error(ctx); | 321 | ssh_gssapi_error(ctx); |
324 | return (ctx->major); | 322 | return (ctx->major); |
325 | } | 323 | } |
326 | 324 | ||
327 | ctx->major = gss_compare_name(&ctx->minor, client->name, | 325 | ctx->major = gss_compare_name(&ctx->minor, client->name, |
328 | new_name, &equal); | 326 | new_name, &equal); |
329 | 327 | ||
330 | if (GSS_ERROR(ctx->major)) { | 328 | if (GSS_ERROR(ctx->major)) { |
331 | ssh_gssapi_error(ctx); | 329 | ssh_gssapi_error(ctx); |
332 | return (ctx->major); | 330 | return (ctx->major); |
333 | } | 331 | } |
334 | 332 | ||
335 | if (!equal) { | 333 | if (!equal) { |
336 | debug("Rekeyed credentials have different name"); | 334 | debug("Rekeyed credentials have different name"); |
337 | return GSS_S_COMPLETE; | 335 | return GSS_S_COMPLETE; |
@@ -343,7 +341,7 @@ ssh_gssapi_getclient(Gssctxt *ctx, ssh_gssapi_client *client) | |||
343 | gss_release_cred(&ctx->minor, &client->creds); | 341 | gss_release_cred(&ctx->minor, &client->creds); |
344 | client->name = new_name; | 342 | client->name = new_name; |
345 | client->creds = ctx->client_creds; | 343 | client->creds = ctx->client_creds; |
346 | ctx->client_creds = GSS_C_NO_CREDENTIAL; | 344 | ctx->client_creds = GSS_C_NO_CREDENTIAL; |
347 | client->updated = 1; | 345 | client->updated = 1; |
348 | return GSS_S_COMPLETE; | 346 | return GSS_S_COMPLETE; |
349 | } | 347 | } |
@@ -434,10 +432,12 @@ ssh_gssapi_do_child(char ***envp, u_int *envsizep) | |||
434 | 432 | ||
435 | /* Privileged */ | 433 | /* Privileged */ |
436 | int | 434 | int |
437 | ssh_gssapi_userok(char *user, struct passwd *pw) | 435 | ssh_gssapi_userok(char *user, struct passwd *pw, int kex) |
438 | { | 436 | { |
439 | OM_uint32 lmin; | 437 | OM_uint32 lmin; |
440 | 438 | ||
439 | (void) kex; /* used in privilege separation */ | ||
440 | |||
441 | if (gssapi_client.exportedname.length == 0 || | 441 | if (gssapi_client.exportedname.length == 0 || |
442 | gssapi_client.exportedname.value == NULL) { | 442 | gssapi_client.exportedname.value == NULL) { |
443 | debug("No suitable client data"); | 443 | debug("No suitable client data"); |
@@ -462,7 +462,7 @@ ssh_gssapi_userok(char *user, struct passwd *pw) | |||
462 | return (0); | 462 | return (0); |
463 | } | 463 | } |
464 | 464 | ||
465 | /* These bits are only used for rekeying. The unpriviledged child is running | 465 | /* These bits are only used for rekeying. The unpriviledged child is running |
466 | * as the user, the monitor is root. | 466 | * as the user, the monitor is root. |
467 | * | 467 | * |
468 | * In the child, we want to : | 468 | * In the child, we want to : |
@@ -473,7 +473,7 @@ ssh_gssapi_userok(char *user, struct passwd *pw) | |||
473 | /* Stuff for PAM */ | 473 | /* Stuff for PAM */ |
474 | 474 | ||
475 | #ifdef USE_PAM | 475 | #ifdef USE_PAM |
476 | static int ssh_gssapi_simple_conv(int n, const struct pam_message **msg, | 476 | static int ssh_gssapi_simple_conv(int n, const struct pam_message **msg, |
477 | struct pam_response **resp, void *data) | 477 | struct pam_response **resp, void *data) |
478 | { | 478 | { |
479 | return (PAM_CONV_ERR); | 479 | return (PAM_CONV_ERR); |
@@ -483,18 +483,18 @@ static int ssh_gssapi_simple_conv(int n, const struct pam_message **msg, | |||
483 | void | 483 | void |
484 | ssh_gssapi_rekey_creds(void) { | 484 | ssh_gssapi_rekey_creds(void) { |
485 | int ok; | 485 | int ok; |
486 | int ret; | ||
487 | #ifdef USE_PAM | 486 | #ifdef USE_PAM |
487 | int ret; | ||
488 | pam_handle_t *pamh = NULL; | 488 | pam_handle_t *pamh = NULL; |
489 | struct pam_conv pamconv = {ssh_gssapi_simple_conv, NULL}; | 489 | struct pam_conv pamconv = {ssh_gssapi_simple_conv, NULL}; |
490 | char *envstr; | 490 | char *envstr; |
491 | #endif | 491 | #endif |
492 | 492 | ||
493 | if (gssapi_client.store.filename == NULL && | 493 | if (gssapi_client.store.filename == NULL && |
494 | gssapi_client.store.envval == NULL && | 494 | gssapi_client.store.envval == NULL && |
495 | gssapi_client.store.envvar == NULL) | 495 | gssapi_client.store.envvar == NULL) |
496 | return; | 496 | return; |
497 | 497 | ||
498 | ok = PRIVSEP(ssh_gssapi_update_creds(&gssapi_client.store)); | 498 | ok = PRIVSEP(ssh_gssapi_update_creds(&gssapi_client.store)); |
499 | 499 | ||
500 | if (!ok) | 500 | if (!ok) |
@@ -517,7 +517,7 @@ ssh_gssapi_rekey_creds(void) { | |||
517 | if (ret) | 517 | if (ret) |
518 | return; | 518 | return; |
519 | 519 | ||
520 | xasprintf(&envstr, "%s=%s", gssapi_client.store.envvar, | 520 | xasprintf(&envstr, "%s=%s", gssapi_client.store.envvar, |
521 | gssapi_client.store.envval); | 521 | gssapi_client.store.envval); |
522 | 522 | ||
523 | ret = pam_putenv(pamh, envstr); | 523 | ret = pam_putenv(pamh, envstr); |
@@ -527,7 +527,7 @@ ssh_gssapi_rekey_creds(void) { | |||
527 | #endif | 527 | #endif |
528 | } | 528 | } |
529 | 529 | ||
530 | int | 530 | int |
531 | ssh_gssapi_update_creds(ssh_gssapi_ccache *store) { | 531 | ssh_gssapi_update_creds(ssh_gssapi_ccache *store) { |
532 | int ok = 0; | 532 | int ok = 0; |
533 | 533 | ||