diff options
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 145 |
1 files changed, 68 insertions, 77 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 7b83c591b..19ed3459f 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.196 2013/05/16 02:00:34 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.197 2013/05/17 00:13:14 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -146,10 +146,10 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) | |||
146 | if (*first != '\0') | 146 | if (*first != '\0') |
147 | debug3("%s: prefer hostkeyalgs: %s", __func__, first); | 147 | debug3("%s: prefer hostkeyalgs: %s", __func__, first); |
148 | 148 | ||
149 | xfree(first); | 149 | free(first); |
150 | xfree(last); | 150 | free(last); |
151 | xfree(hostname); | 151 | free(hostname); |
152 | xfree(oavail); | 152 | free(oavail); |
153 | free_hostkeys(hostkeys); | 153 | free_hostkeys(hostkeys); |
154 | 154 | ||
155 | return ret; | 155 | return ret; |
@@ -384,7 +384,7 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, | |||
384 | if (packet_remaining() > 0) { | 384 | if (packet_remaining() > 0) { |
385 | char *reply = packet_get_string(NULL); | 385 | char *reply = packet_get_string(NULL); |
386 | debug2("service_accept: %s", reply); | 386 | debug2("service_accept: %s", reply); |
387 | xfree(reply); | 387 | free(reply); |
388 | } else { | 388 | } else { |
389 | debug2("buggy server: service_accept w/o service"); | 389 | debug2("buggy server: service_accept w/o service"); |
390 | } | 390 | } |
@@ -431,15 +431,12 @@ userauth(Authctxt *authctxt, char *authlist) | |||
431 | if (authctxt->method != NULL && authctxt->method->cleanup != NULL) | 431 | if (authctxt->method != NULL && authctxt->method->cleanup != NULL) |
432 | authctxt->method->cleanup(authctxt); | 432 | authctxt->method->cleanup(authctxt); |
433 | 433 | ||
434 | if (authctxt->methoddata) { | 434 | free(authctxt->methoddata); |
435 | xfree(authctxt->methoddata); | 435 | authctxt->methoddata = NULL; |
436 | authctxt->methoddata = NULL; | ||
437 | } | ||
438 | if (authlist == NULL) { | 436 | if (authlist == NULL) { |
439 | authlist = authctxt->authlist; | 437 | authlist = authctxt->authlist; |
440 | } else { | 438 | } else { |
441 | if (authctxt->authlist) | 439 | free(authctxt->authlist); |
442 | xfree(authctxt->authlist); | ||
443 | authctxt->authlist = authlist; | 440 | authctxt->authlist = authlist; |
444 | } | 441 | } |
445 | for (;;) { | 442 | for (;;) { |
@@ -487,10 +484,10 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) | |||
487 | msg = xmalloc(len * 4 + 1); /* max expansion from strnvis() */ | 484 | msg = xmalloc(len * 4 + 1); /* max expansion from strnvis() */ |
488 | strnvis(msg, raw, len * 4 + 1, VIS_SAFE|VIS_OCTAL|VIS_NOSLASH); | 485 | strnvis(msg, raw, len * 4 + 1, VIS_SAFE|VIS_OCTAL|VIS_NOSLASH); |
489 | fprintf(stderr, "%s", msg); | 486 | fprintf(stderr, "%s", msg); |
490 | xfree(msg); | 487 | free(msg); |
491 | } | 488 | } |
492 | xfree(raw); | 489 | free(raw); |
493 | xfree(lang); | 490 | free(lang); |
494 | } | 491 | } |
495 | 492 | ||
496 | /* ARGSUSED */ | 493 | /* ARGSUSED */ |
@@ -501,16 +498,12 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) | |||
501 | 498 | ||
502 | if (authctxt == NULL) | 499 | if (authctxt == NULL) |
503 | fatal("input_userauth_success: no authentication context"); | 500 | fatal("input_userauth_success: no authentication context"); |
504 | if (authctxt->authlist) { | 501 | free(authctxt->authlist); |
505 | xfree(authctxt->authlist); | 502 | authctxt->authlist = NULL; |
506 | authctxt->authlist = NULL; | ||
507 | } | ||
508 | if (authctxt->method != NULL && authctxt->method->cleanup != NULL) | 503 | if (authctxt->method != NULL && authctxt->method->cleanup != NULL) |
509 | authctxt->method->cleanup(authctxt); | 504 | authctxt->method->cleanup(authctxt); |
510 | if (authctxt->methoddata) { | 505 | free(authctxt->methoddata); |
511 | xfree(authctxt->methoddata); | 506 | authctxt->methoddata = NULL; |
512 | authctxt->methoddata = NULL; | ||
513 | } | ||
514 | authctxt->success = 1; /* break out */ | 507 | authctxt->success = 1; /* break out */ |
515 | } | 508 | } |
516 | 509 | ||
@@ -599,7 +592,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) | |||
599 | } | 592 | } |
600 | fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); | 593 | fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); |
601 | debug2("input_userauth_pk_ok: fp %s", fp); | 594 | debug2("input_userauth_pk_ok: fp %s", fp); |
602 | xfree(fp); | 595 | free(fp); |
603 | 596 | ||
604 | /* | 597 | /* |
605 | * search keys in the reverse order, because last candidate has been | 598 | * search keys in the reverse order, because last candidate has been |
@@ -615,8 +608,8 @@ input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) | |||
615 | done: | 608 | done: |
616 | if (key != NULL) | 609 | if (key != NULL) |
617 | key_free(key); | 610 | key_free(key); |
618 | xfree(pkalg); | 611 | free(pkalg); |
619 | xfree(pkblob); | 612 | free(pkblob); |
620 | 613 | ||
621 | /* try another method if we did not send a packet */ | 614 | /* try another method if we did not send a packet */ |
622 | if (sent == 0) | 615 | if (sent == 0) |
@@ -754,7 +747,7 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | |||
754 | if (oidlen <= 2 || | 747 | if (oidlen <= 2 || |
755 | oidv[0] != SSH_GSS_OIDTYPE || | 748 | oidv[0] != SSH_GSS_OIDTYPE || |
756 | oidv[1] != oidlen - 2) { | 749 | oidv[1] != oidlen - 2) { |
757 | xfree(oidv); | 750 | free(oidv); |
758 | debug("Badly encoded mechanism OID received"); | 751 | debug("Badly encoded mechanism OID received"); |
759 | userauth(authctxt, NULL); | 752 | userauth(authctxt, NULL); |
760 | return; | 753 | return; |
@@ -765,7 +758,7 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | |||
765 | 758 | ||
766 | packet_check_eom(); | 759 | packet_check_eom(); |
767 | 760 | ||
768 | xfree(oidv); | 761 | free(oidv); |
769 | 762 | ||
770 | if (GSS_ERROR(process_gssapi_token(ctxt, GSS_C_NO_BUFFER))) { | 763 | if (GSS_ERROR(process_gssapi_token(ctxt, GSS_C_NO_BUFFER))) { |
771 | /* Start again with next method on list */ | 764 | /* Start again with next method on list */ |
@@ -794,7 +787,7 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt) | |||
794 | 787 | ||
795 | status = process_gssapi_token(ctxt, &recv_tok); | 788 | status = process_gssapi_token(ctxt, &recv_tok); |
796 | 789 | ||
797 | xfree(recv_tok.value); | 790 | free(recv_tok.value); |
798 | 791 | ||
799 | if (GSS_ERROR(status)) { | 792 | if (GSS_ERROR(status)) { |
800 | /* Start again with the next method in the list */ | 793 | /* Start again with the next method in the list */ |
@@ -827,7 +820,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
827 | (void)ssh_gssapi_init_ctx(gssctxt, options.gss_deleg_creds, | 820 | (void)ssh_gssapi_init_ctx(gssctxt, options.gss_deleg_creds, |
828 | &recv_tok, &send_tok, NULL); | 821 | &recv_tok, &send_tok, NULL); |
829 | 822 | ||
830 | xfree(recv_tok.value); | 823 | free(recv_tok.value); |
831 | gss_release_buffer(&ms, &send_tok); | 824 | gss_release_buffer(&ms, &send_tok); |
832 | 825 | ||
833 | /* Server will be returning a failed packet after this one */ | 826 | /* Server will be returning a failed packet after this one */ |
@@ -848,8 +841,8 @@ input_gssapi_error(int type, u_int32_t plen, void *ctxt) | |||
848 | packet_check_eom(); | 841 | packet_check_eom(); |
849 | 842 | ||
850 | debug("Server GSSAPI Error:\n%s", msg); | 843 | debug("Server GSSAPI Error:\n%s", msg); |
851 | xfree(msg); | 844 | free(msg); |
852 | xfree(lang); | 845 | free(lang); |
853 | } | 846 | } |
854 | #endif /* GSSAPI */ | 847 | #endif /* GSSAPI */ |
855 | 848 | ||
@@ -890,7 +883,7 @@ userauth_passwd(Authctxt *authctxt) | |||
890 | packet_put_char(0); | 883 | packet_put_char(0); |
891 | packet_put_cstring(password); | 884 | packet_put_cstring(password); |
892 | memset(password, 0, strlen(password)); | 885 | memset(password, 0, strlen(password)); |
893 | xfree(password); | 886 | free(password); |
894 | packet_add_padding(64); | 887 | packet_add_padding(64); |
895 | packet_send(); | 888 | packet_send(); |
896 | 889 | ||
@@ -923,8 +916,8 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
923 | lang = packet_get_string(NULL); | 916 | lang = packet_get_string(NULL); |
924 | if (strlen(info) > 0) | 917 | if (strlen(info) > 0) |
925 | logit("%s", info); | 918 | logit("%s", info); |
926 | xfree(info); | 919 | free(info); |
927 | xfree(lang); | 920 | free(lang); |
928 | packet_start(SSH2_MSG_USERAUTH_REQUEST); | 921 | packet_start(SSH2_MSG_USERAUTH_REQUEST); |
929 | packet_put_cstring(authctxt->server_user); | 922 | packet_put_cstring(authctxt->server_user); |
930 | packet_put_cstring(authctxt->service); | 923 | packet_put_cstring(authctxt->service); |
@@ -936,7 +929,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
936 | password = read_passphrase(prompt, 0); | 929 | password = read_passphrase(prompt, 0); |
937 | packet_put_cstring(password); | 930 | packet_put_cstring(password); |
938 | memset(password, 0, strlen(password)); | 931 | memset(password, 0, strlen(password)); |
939 | xfree(password); | 932 | free(password); |
940 | password = NULL; | 933 | password = NULL; |
941 | while (password == NULL) { | 934 | while (password == NULL) { |
942 | snprintf(prompt, sizeof(prompt), | 935 | snprintf(prompt, sizeof(prompt), |
@@ -953,16 +946,16 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
953 | retype = read_passphrase(prompt, 0); | 946 | retype = read_passphrase(prompt, 0); |
954 | if (strcmp(password, retype) != 0) { | 947 | if (strcmp(password, retype) != 0) { |
955 | memset(password, 0, strlen(password)); | 948 | memset(password, 0, strlen(password)); |
956 | xfree(password); | 949 | free(password); |
957 | logit("Mismatch; try again, EOF to quit."); | 950 | logit("Mismatch; try again, EOF to quit."); |
958 | password = NULL; | 951 | password = NULL; |
959 | } | 952 | } |
960 | memset(retype, 0, strlen(retype)); | 953 | memset(retype, 0, strlen(retype)); |
961 | xfree(retype); | 954 | free(retype); |
962 | } | 955 | } |
963 | packet_put_cstring(password); | 956 | packet_put_cstring(password); |
964 | memset(password, 0, strlen(password)); | 957 | memset(password, 0, strlen(password)); |
965 | xfree(password); | 958 | free(password); |
966 | packet_add_padding(64); | 959 | packet_add_padding(64); |
967 | packet_send(); | 960 | packet_send(); |
968 | 961 | ||
@@ -1017,13 +1010,13 @@ jpake_password_to_secret(Authctxt *authctxt, const char *crypt_scheme, | |||
1017 | 1010 | ||
1018 | bzero(password, strlen(password)); | 1011 | bzero(password, strlen(password)); |
1019 | bzero(crypted, strlen(crypted)); | 1012 | bzero(crypted, strlen(crypted)); |
1020 | xfree(password); | 1013 | free(password); |
1021 | xfree(crypted); | 1014 | free(crypted); |
1022 | 1015 | ||
1023 | if ((ret = BN_bin2bn(secret, secret_len, NULL)) == NULL) | 1016 | if ((ret = BN_bin2bn(secret, secret_len, NULL)) == NULL) |
1024 | fatal("%s: BN_bin2bn (secret)", __func__); | 1017 | fatal("%s: BN_bin2bn (secret)", __func__); |
1025 | bzero(secret, secret_len); | 1018 | bzero(secret, secret_len); |
1026 | xfree(secret); | 1019 | free(secret); |
1027 | 1020 | ||
1028 | return ret; | 1021 | return ret; |
1029 | } | 1022 | } |
@@ -1061,8 +1054,8 @@ input_userauth_jpake_server_step1(int type, u_int32_t seq, void *ctxt) | |||
1061 | pctx->s = jpake_password_to_secret(authctxt, crypt_scheme, salt); | 1054 | pctx->s = jpake_password_to_secret(authctxt, crypt_scheme, salt); |
1062 | bzero(crypt_scheme, strlen(crypt_scheme)); | 1055 | bzero(crypt_scheme, strlen(crypt_scheme)); |
1063 | bzero(salt, strlen(salt)); | 1056 | bzero(salt, strlen(salt)); |
1064 | xfree(crypt_scheme); | 1057 | free(crypt_scheme); |
1065 | xfree(salt); | 1058 | free(salt); |
1066 | JPAKE_DEBUG_BN((pctx->s, "%s: s = ", __func__)); | 1059 | JPAKE_DEBUG_BN((pctx->s, "%s: s = ", __func__)); |
1067 | 1060 | ||
1068 | /* Calculate step 2 values */ | 1061 | /* Calculate step 2 values */ |
@@ -1077,8 +1070,8 @@ input_userauth_jpake_server_step1(int type, u_int32_t seq, void *ctxt) | |||
1077 | 1070 | ||
1078 | bzero(x3_proof, x3_proof_len); | 1071 | bzero(x3_proof, x3_proof_len); |
1079 | bzero(x4_proof, x4_proof_len); | 1072 | bzero(x4_proof, x4_proof_len); |
1080 | xfree(x3_proof); | 1073 | free(x3_proof); |
1081 | xfree(x4_proof); | 1074 | free(x4_proof); |
1082 | 1075 | ||
1083 | JPAKE_DEBUG_CTX((pctx, "step 2 sending in %s", __func__)); | 1076 | JPAKE_DEBUG_CTX((pctx, "step 2 sending in %s", __func__)); |
1084 | 1077 | ||
@@ -1089,7 +1082,7 @@ input_userauth_jpake_server_step1(int type, u_int32_t seq, void *ctxt) | |||
1089 | packet_send(); | 1082 | packet_send(); |
1090 | 1083 | ||
1091 | bzero(x2_s_proof, x2_s_proof_len); | 1084 | bzero(x2_s_proof, x2_s_proof_len); |
1092 | xfree(x2_s_proof); | 1085 | free(x2_s_proof); |
1093 | 1086 | ||
1094 | /* Expect step 2 packet from peer */ | 1087 | /* Expect step 2 packet from peer */ |
1095 | dispatch_set(SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP2, | 1088 | dispatch_set(SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP2, |
@@ -1129,7 +1122,7 @@ input_userauth_jpake_server_step2(int type, u_int32_t seq, void *ctxt) | |||
1129 | &pctx->h_k_cid_sessid, &pctx->h_k_cid_sessid_len); | 1122 | &pctx->h_k_cid_sessid, &pctx->h_k_cid_sessid_len); |
1130 | 1123 | ||
1131 | bzero(x4_s_proof, x4_s_proof_len); | 1124 | bzero(x4_s_proof, x4_s_proof_len); |
1132 | xfree(x4_s_proof); | 1125 | free(x4_s_proof); |
1133 | 1126 | ||
1134 | JPAKE_DEBUG_CTX((pctx, "confirm sending in %s", __func__)); | 1127 | JPAKE_DEBUG_CTX((pctx, "confirm sending in %s", __func__)); |
1135 | 1128 | ||
@@ -1211,7 +1204,7 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id) | |||
1211 | 1204 | ||
1212 | fp = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); | 1205 | fp = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); |
1213 | debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp); | 1206 | debug3("sign_and_send_pubkey: %s %s", key_type(id->key), fp); |
1214 | xfree(fp); | 1207 | free(fp); |
1215 | 1208 | ||
1216 | if (key_to_blob(id->key, &blob, &bloblen) == 0) { | 1209 | if (key_to_blob(id->key, &blob, &bloblen) == 0) { |
1217 | /* we cannot handle this key */ | 1210 | /* we cannot handle this key */ |
@@ -1246,7 +1239,7 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id) | |||
1246 | ret = identity_sign(id, &signature, &slen, | 1239 | ret = identity_sign(id, &signature, &slen, |
1247 | buffer_ptr(&b), buffer_len(&b)); | 1240 | buffer_ptr(&b), buffer_len(&b)); |
1248 | if (ret == -1) { | 1241 | if (ret == -1) { |
1249 | xfree(blob); | 1242 | free(blob); |
1250 | buffer_free(&b); | 1243 | buffer_free(&b); |
1251 | return 0; | 1244 | return 0; |
1252 | } | 1245 | } |
@@ -1266,11 +1259,11 @@ sign_and_send_pubkey(Authctxt *authctxt, Identity *id) | |||
1266 | buffer_put_cstring(&b, key_ssh_name(id->key)); | 1259 | buffer_put_cstring(&b, key_ssh_name(id->key)); |
1267 | buffer_put_string(&b, blob, bloblen); | 1260 | buffer_put_string(&b, blob, bloblen); |
1268 | } | 1261 | } |
1269 | xfree(blob); | 1262 | free(blob); |
1270 | 1263 | ||
1271 | /* append signature */ | 1264 | /* append signature */ |
1272 | buffer_put_string(&b, signature, slen); | 1265 | buffer_put_string(&b, signature, slen); |
1273 | xfree(signature); | 1266 | free(signature); |
1274 | 1267 | ||
1275 | /* skip session id and packet type */ | 1268 | /* skip session id and packet type */ |
1276 | if (buffer_len(&b) < skip + 1) | 1269 | if (buffer_len(&b) < skip + 1) |
@@ -1310,7 +1303,7 @@ send_pubkey_test(Authctxt *authctxt, Identity *id) | |||
1310 | if (!(datafellows & SSH_BUG_PKAUTH)) | 1303 | if (!(datafellows & SSH_BUG_PKAUTH)) |
1311 | packet_put_cstring(key_ssh_name(id->key)); | 1304 | packet_put_cstring(key_ssh_name(id->key)); |
1312 | packet_put_string(blob, bloblen); | 1305 | packet_put_string(blob, bloblen); |
1313 | xfree(blob); | 1306 | free(blob); |
1314 | packet_send(); | 1307 | packet_send(); |
1315 | return 1; | 1308 | return 1; |
1316 | } | 1309 | } |
@@ -1347,7 +1340,7 @@ load_identity_file(char *filename, int userprovided) | |||
1347 | quit = 1; | 1340 | quit = 1; |
1348 | } | 1341 | } |
1349 | memset(passphrase, 0, strlen(passphrase)); | 1342 | memset(passphrase, 0, strlen(passphrase)); |
1350 | xfree(passphrase); | 1343 | free(passphrase); |
1351 | if (private != NULL || quit) | 1344 | if (private != NULL || quit) |
1352 | break; | 1345 | break; |
1353 | debug2("bad passphrase given, try again..."); | 1346 | debug2("bad passphrase given, try again..."); |
@@ -1424,7 +1417,7 @@ pubkey_prepare(Authctxt *authctxt) | |||
1424 | /* agent keys from the config file are preferred */ | 1417 | /* agent keys from the config file are preferred */ |
1425 | if (key_equal(key, id->key)) { | 1418 | if (key_equal(key, id->key)) { |
1426 | key_free(key); | 1419 | key_free(key); |
1427 | xfree(comment); | 1420 | free(comment); |
1428 | TAILQ_REMOVE(&files, id, next); | 1421 | TAILQ_REMOVE(&files, id, next); |
1429 | TAILQ_INSERT_TAIL(preferred, id, next); | 1422 | TAILQ_INSERT_TAIL(preferred, id, next); |
1430 | id->ac = ac; | 1423 | id->ac = ac; |
@@ -1470,9 +1463,8 @@ pubkey_cleanup(Authctxt *authctxt) | |||
1470 | TAILQ_REMOVE(&authctxt->keys, id, next); | 1463 | TAILQ_REMOVE(&authctxt->keys, id, next); |
1471 | if (id->key) | 1464 | if (id->key) |
1472 | key_free(id->key); | 1465 | key_free(id->key); |
1473 | if (id->filename) | 1466 | free(id->filename); |
1474 | xfree(id->filename); | 1467 | free(id); |
1475 | xfree(id); | ||
1476 | } | 1468 | } |
1477 | } | 1469 | } |
1478 | 1470 | ||
@@ -1570,9 +1562,9 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | |||
1570 | logit("%s", name); | 1562 | logit("%s", name); |
1571 | if (strlen(inst) > 0) | 1563 | if (strlen(inst) > 0) |
1572 | logit("%s", inst); | 1564 | logit("%s", inst); |
1573 | xfree(name); | 1565 | free(name); |
1574 | xfree(inst); | 1566 | free(inst); |
1575 | xfree(lang); | 1567 | free(lang); |
1576 | 1568 | ||
1577 | num_prompts = packet_get_int(); | 1569 | num_prompts = packet_get_int(); |
1578 | /* | 1570 | /* |
@@ -1593,8 +1585,8 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | |||
1593 | 1585 | ||
1594 | packet_put_cstring(response); | 1586 | packet_put_cstring(response); |
1595 | memset(response, 0, strlen(response)); | 1587 | memset(response, 0, strlen(response)); |
1596 | xfree(response); | 1588 | free(response); |
1597 | xfree(prompt); | 1589 | free(prompt); |
1598 | } | 1590 | } |
1599 | packet_check_eom(); /* done with parsing incoming message. */ | 1591 | packet_check_eom(); /* done with parsing incoming message. */ |
1600 | 1592 | ||
@@ -1714,12 +1706,12 @@ userauth_hostbased(Authctxt *authctxt) | |||
1714 | if (p == NULL) { | 1706 | if (p == NULL) { |
1715 | error("userauth_hostbased: cannot get local ipaddr/name"); | 1707 | error("userauth_hostbased: cannot get local ipaddr/name"); |
1716 | key_free(private); | 1708 | key_free(private); |
1717 | xfree(blob); | 1709 | free(blob); |
1718 | return 0; | 1710 | return 0; |
1719 | } | 1711 | } |
1720 | xasprintf(&chost, "%s.", p); | 1712 | xasprintf(&chost, "%s.", p); |
1721 | debug2("userauth_hostbased: chost %s", chost); | 1713 | debug2("userauth_hostbased: chost %s", chost); |
1722 | xfree(p); | 1714 | free(p); |
1723 | 1715 | ||
1724 | service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : | 1716 | service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : |
1725 | authctxt->service; | 1717 | authctxt->service; |
@@ -1748,9 +1740,9 @@ userauth_hostbased(Authctxt *authctxt) | |||
1748 | buffer_free(&b); | 1740 | buffer_free(&b); |
1749 | if (ok != 0) { | 1741 | if (ok != 0) { |
1750 | error("key_sign failed"); | 1742 | error("key_sign failed"); |
1751 | xfree(chost); | 1743 | free(chost); |
1752 | xfree(pkalg); | 1744 | free(pkalg); |
1753 | xfree(blob); | 1745 | free(blob); |
1754 | return 0; | 1746 | return 0; |
1755 | } | 1747 | } |
1756 | packet_start(SSH2_MSG_USERAUTH_REQUEST); | 1748 | packet_start(SSH2_MSG_USERAUTH_REQUEST); |
@@ -1763,10 +1755,10 @@ userauth_hostbased(Authctxt *authctxt) | |||
1763 | packet_put_cstring(authctxt->local_user); | 1755 | packet_put_cstring(authctxt->local_user); |
1764 | packet_put_string(signature, slen); | 1756 | packet_put_string(signature, slen); |
1765 | memset(signature, 's', slen); | 1757 | memset(signature, 's', slen); |
1766 | xfree(signature); | 1758 | free(signature); |
1767 | xfree(chost); | 1759 | free(chost); |
1768 | xfree(pkalg); | 1760 | free(pkalg); |
1769 | xfree(blob); | 1761 | free(blob); |
1770 | 1762 | ||
1771 | packet_send(); | 1763 | packet_send(); |
1772 | return 1; | 1764 | return 1; |
@@ -1821,8 +1813,8 @@ userauth_jpake(Authctxt *authctxt) | |||
1821 | 1813 | ||
1822 | bzero(x1_proof, x1_proof_len); | 1814 | bzero(x1_proof, x1_proof_len); |
1823 | bzero(x2_proof, x2_proof_len); | 1815 | bzero(x2_proof, x2_proof_len); |
1824 | xfree(x1_proof); | 1816 | free(x1_proof); |
1825 | xfree(x2_proof); | 1817 | free(x2_proof); |
1826 | 1818 | ||
1827 | /* Expect step 1 packet from peer */ | 1819 | /* Expect step 1 packet from peer */ |
1828 | dispatch_set(SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP1, | 1820 | dispatch_set(SSH2_MSG_USERAUTH_JPAKE_SERVER_STEP1, |
@@ -1899,8 +1891,7 @@ authmethod_get(char *authlist) | |||
1899 | 1891 | ||
1900 | if (supported == NULL || strcmp(authlist, supported) != 0) { | 1892 | if (supported == NULL || strcmp(authlist, supported) != 0) { |
1901 | debug3("start over, passed a different list %s", authlist); | 1893 | debug3("start over, passed a different list %s", authlist); |
1902 | if (supported != NULL) | 1894 | free(supported); |
1903 | xfree(supported); | ||
1904 | supported = xstrdup(authlist); | 1895 | supported = xstrdup(authlist); |
1905 | preferred = options.preferred_authentications; | 1896 | preferred = options.preferred_authentications; |
1906 | debug3("preferred %s", preferred); | 1897 | debug3("preferred %s", preferred); |
@@ -1921,7 +1912,7 @@ authmethod_get(char *authlist) | |||
1921 | authmethod_is_enabled(current)) { | 1912 | authmethod_is_enabled(current)) { |
1922 | debug3("authmethod_is_enabled %s", name); | 1913 | debug3("authmethod_is_enabled %s", name); |
1923 | debug("Next authentication method: %s", name); | 1914 | debug("Next authentication method: %s", name); |
1924 | xfree(name); | 1915 | free(name); |
1925 | return current; | 1916 | return current; |
1926 | } | 1917 | } |
1927 | } | 1918 | } |