diff options
author | 2016-08-15 08:01:50 -0400 | |
---|---|---|
committer | 2016-08-15 08:01:50 -0400 | |
commit | 31413e510b9822c5632dbde3c7cb4417f66bc808 (patch) | |
tree | a70561d7ab5c188382785ef045fee341b698c9f2 | |
parent | ssh fixes (diff) | |
download | firejail-31413e510b9822c5632dbde3c7cb4417f66bc808.tar.gz firejail-31413e510b9822c5632dbde3c7cb4417f66bc808.tar.zst firejail-31413e510b9822c5632dbde3c7cb4417f66bc808.zip |
more ssh fixes
-rw-r--r-- | src/firejail/main.c | 2 | ||||
-rw-r--r-- | src/firejail/no_sandbox.c | 6 | ||||
-rw-r--r-- | src/firejail/restricted_shell.c | 8 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/firejail/main.c b/src/firejail/main.c index c6c1bc866..6f1e7531a 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -891,7 +891,7 @@ if (fp) { | |||
891 | } | 891 | } |
892 | EUID_USER(); | 892 | EUID_USER(); |
893 | #endif | 893 | #endif |
894 | 894 | ||
895 | // run sftp and scp directly without any sandboxing | 895 | // run sftp and scp directly without any sandboxing |
896 | // regular login has argv[0] == "-firejail" | 896 | // regular login has argv[0] == "-firejail" |
897 | if (*argv[0] != '-') { | 897 | if (*argv[0] != '-') { |
diff --git a/src/firejail/no_sandbox.c b/src/firejail/no_sandbox.c index 933922ece..80ed72dca 100644 --- a/src/firejail/no_sandbox.c +++ b/src/firejail/no_sandbox.c | |||
@@ -172,8 +172,8 @@ void run_no_sandbox(int argc, char **argv) { | |||
172 | int len = 0; | 172 | int len = 0; |
173 | int i; | 173 | int i; |
174 | for (i = 1; i < argc; i++) { | 174 | for (i = 1; i < argc; i++) { |
175 | // if (i == 1 && strcmp(argv[i], "-c") == 0) | 175 | if (i == 1 && strcmp(argv[i], "-c") == 0) |
176 | // continue; | 176 | continue; |
177 | if (*argv[i] == '-') | 177 | if (*argv[i] == '-') |
178 | continue; | 178 | continue; |
179 | break; | 179 | break; |
@@ -204,7 +204,7 @@ void run_no_sandbox(int argc, char **argv) { | |||
204 | } | 204 | } |
205 | 205 | ||
206 | // start the program in /bin/sh | 206 | // start the program in /bin/sh |
207 | // if (!arg_quiet) | 207 | if (!arg_quiet) |
208 | fprintf(stderr, "Warning: an existing sandbox was detected. " | 208 | fprintf(stderr, "Warning: an existing sandbox was detected. " |
209 | "%s will run without any additional sandboxing features in a /bin/sh shell\n", command); | 209 | "%s will run without any additional sandboxing features in a /bin/sh shell\n", command); |
210 | int rv = system(command); | 210 | int rv = system(command); |
diff --git a/src/firejail/restricted_shell.c b/src/firejail/restricted_shell.c index 1920da40a..e66ed0e6b 100644 --- a/src/firejail/restricted_shell.c +++ b/src/firejail/restricted_shell.c | |||
@@ -40,7 +40,7 @@ int restricted_shell(const char *user) { | |||
40 | char buf[MAX_READ]; | 40 | char buf[MAX_READ]; |
41 | while (fgets(buf, MAX_READ, fp)) { | 41 | while (fgets(buf, MAX_READ, fp)) { |
42 | lineno++; | 42 | lineno++; |
43 | 43 | ||
44 | // remove empty spaces at the beginning of the line | 44 | // remove empty spaces at the beginning of the line |
45 | char *ptr = buf; | 45 | char *ptr = buf; |
46 | while (*ptr == ' ' || *ptr == '\t') { | 46 | while (*ptr == ' ' || *ptr == '\t') { |
@@ -48,7 +48,7 @@ int restricted_shell(const char *user) { | |||
48 | } | 48 | } |
49 | if (*ptr == '\n' || *ptr == '#') | 49 | if (*ptr == '\n' || *ptr == '#') |
50 | continue; | 50 | continue; |
51 | 51 | ||
52 | // parse line | 52 | // parse line |
53 | char *usr = ptr; | 53 | char *usr = ptr; |
54 | char *args = strchr(usr, ':'); | 54 | char *args = strchr(usr, ':'); |
@@ -56,6 +56,7 @@ int restricted_shell(const char *user) { | |||
56 | fprintf(stderr, "Error: users.conf line %d\n", lineno); | 56 | fprintf(stderr, "Error: users.conf line %d\n", lineno); |
57 | exit(1); | 57 | exit(1); |
58 | } | 58 | } |
59 | |||
59 | *args = '\0'; | 60 | *args = '\0'; |
60 | args++; | 61 | args++; |
61 | ptr = strchr(args, '\n'); | 62 | ptr = strchr(args, '\n'); |
@@ -70,6 +71,7 @@ int restricted_shell(const char *user) { | |||
70 | found = 1; | 71 | found = 1; |
71 | break; | 72 | break; |
72 | } | 73 | } |
74 | ptr2++; | ||
73 | } | 75 | } |
74 | if (!found) | 76 | if (!found) |
75 | continue; | 77 | continue; |
@@ -107,7 +109,7 @@ int restricted_shell(const char *user) { | |||
107 | } | 109 | } |
108 | } | 110 | } |
109 | fclose(fp); | 111 | fclose(fp); |
110 | 112 | ||
111 | return 0; | 113 | return 0; |
112 | } | 114 | } |
113 | 115 | ||