You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

  1. From 3fe7510b261098e3937ab5417935916a46e6727b Mon Sep 17 00:00:00 2001
  2. From: Andreas Schneider <asn@cryptomilk.org>
  3. Date: Fri, 19 Oct 2018 11:40:44 +0200
  4. Subject: [PATCH 4/8] messages: Check that the requested service is
  5. 'ssh-connection'
  6. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
  7. (cherry picked from commit 9c200d3ef4f62d724d3bae2563b81c38cc31e215)
  8. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
  9. ---
  10. src/messages.c | 8 ++++++++
  11. 1 file changed, 8 insertions(+)
  12. --- a/src/messages.c
  13. +++ b/src/messages.c
  14. @@ -649,6 +649,7 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_
  15. ssh_message msg = NULL;
  16. char *service = NULL;
  17. char *method = NULL;
  18. + int cmp;
  19. int rc;
  20. (void)user;
  21. @@ -675,6 +676,13 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_
  22. service, method,
  23. msg->auth_request.username);
  24. + cmp = strcmp(service, "ssh-connection");
  25. + if (cmp != 0) {
  26. + SSH_LOG(SSH_LOG_WARNING,
  27. + "Invalid service request: %s",
  28. + service);
  29. + goto end;
  30. + }
  31. if (strcmp(method, "none") == 0) {
  32. msg->auth_request.method = SSH_AUTH_METHOD_NONE;