summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-10-10 15:08:06 +1000
committerDamien Miller <djm@mindrot.org>2001-10-10 15:08:06 +1000
commitae45246696fed011e1a9941d33b89669c74b3198 (patch)
tree6f6be5c9b623c09b2e1df73473b1fc4d3dc92e72
parent139d4cd9087bb3eaf751406016bc2223d7d0d7b1 (diff)
- markus@cvs.openbsd.org 2001/10/09 19:32:49
[session.c] stat subsystem command before calling do_exec, and return error to client.
-rw-r--r--ChangeLog5
-rw-r--r--session.c20
2 files changed, 18 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index c0e076e77..93f90af68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,9 @@
37 - markus@cvs.openbsd.org 2001/10/09 10:12:08 37 - markus@cvs.openbsd.org 2001/10/09 10:12:08
38 [session.c] 38 [session.c]
39 chdir $HOME after krb_afslog(); from bbense@networking.stanford.edu 39 chdir $HOME after krb_afslog(); from bbense@networking.stanford.edu
40 - markus@cvs.openbsd.org 2001/10/09 19:32:49
41 [session.c]
42 stat subsystem command before calling do_exec, and return error to client.
40 43
4120011007 4420011007
42 - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys. 45 - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys.
@@ -6682,4 +6685,4 @@
6682 - Wrote replacements for strlcpy and mkdtemp 6685 - Wrote replacements for strlcpy and mkdtemp
6683 - Released 1.0pre1 6686 - Released 1.0pre1
6684 6687
6685$Id: ChangeLog,v 1.1595 2001/10/10 05:07:44 djm Exp $ 6688$Id: ChangeLog,v 1.1596 2001/10/10 05:08:06 djm Exp $
diff --git a/session.c b/session.c
index 0e3e933f9..c1305da6a 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.104 2001/10/09 10:12:08 markus Exp $"); 36RCSID("$OpenBSD: session.c,v 1.105 2001/10/09 19:32:49 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -1672,25 +1672,33 @@ session_pty_req(Session *s)
1672static int 1672static int
1673session_subsystem_req(Session *s) 1673session_subsystem_req(Session *s)
1674{ 1674{
1675 struct stat st;
1675 u_int len; 1676 u_int len;
1676 int success = 0; 1677 int success = 0;
1677 char *subsys = packet_get_string(&len); 1678 char *cmd, *subsys = packet_get_string(&len);
1678 int i; 1679 int i;
1679 1680
1680 packet_done(); 1681 packet_done();
1681 log("subsystem request for %s", subsys); 1682 log("subsystem request for %s", subsys);
1682 1683
1683 for (i = 0; i < options.num_subsystems; i++) { 1684 for (i = 0; i < options.num_subsystems; i++) {
1684 if(strcmp(subsys, options.subsystem_name[i]) == 0) { 1685 if (strcmp(subsys, options.subsystem_name[i]) == 0) {
1685 debug("subsystem: exec() %s", options.subsystem_command[i]); 1686 cmd = options.subsystem_command[i];
1687 if (stat(cmd, &st) < 0) {
1688 error("subsystem: cannot stat %s: %s", cmd,
1689 strerror(errno));
1690 break;
1691 }
1692 debug("subsystem: exec() %s", cmd);
1686 s->is_subsystem = 1; 1693 s->is_subsystem = 1;
1687 do_exec(s, options.subsystem_command[i]); 1694 do_exec(s, cmd);
1688 success = 1; 1695 success = 1;
1689 } 1696 }
1690 } 1697 }
1691 1698
1692 if (!success) 1699 if (!success)
1693 log("subsystem request for %s failed, subsystem not found", subsys); 1700 log("subsystem request for %s failed, subsystem not found",
1701 subsys);
1694 1702
1695 xfree(subsys); 1703 xfree(subsys);
1696 return success; 1704 return success;