diff options
author | 2016-08-15 09:44:54 -0400 | |
---|---|---|
committer | 2016-08-15 09:44:54 -0400 | |
commit | 00258a8e5c1f31b60020302cf1560cd0d13260ad (patch) | |
tree | 33be5b6e5bc17b6d2a0550a5197708110bd49f91 /src/firejail/restricted_shell.c | |
parent | more ssh fixes (diff) | |
download | firejail-00258a8e5c1f31b60020302cf1560cd0d13260ad.tar.gz firejail-00258a8e5c1f31b60020302cf1560cd0d13260ad.tar.zst firejail-00258a8e5c1f31b60020302cf1560cd0d13260ad.zip |
removed prompt, ssh fixes
Diffstat (limited to 'src/firejail/restricted_shell.c')
-rw-r--r-- | src/firejail/restricted_shell.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/firejail/restricted_shell.c b/src/firejail/restricted_shell.c index e66ed0e6b..24ce27c2e 100644 --- a/src/firejail/restricted_shell.c +++ b/src/firejail/restricted_shell.c | |||
@@ -84,16 +84,28 @@ int restricted_shell(const char *user) { | |||
84 | int i; | 84 | int i; |
85 | ptr = args; | 85 | ptr = args; |
86 | for (i = 1; i < MAX_ARGS; i++) { | 86 | for (i = 1; i < MAX_ARGS; i++) { |
87 | fullargv[i] = ptr; | 87 | // skip blanks |
88 | while (*ptr != ' ' && *ptr != '\t' && *ptr != '\0') | 88 | while (*ptr == ' ' || *ptr == '\t') |
89 | ptr++; | 89 | ptr++; |
90 | fullargv[i] = ptr; | ||
91 | #ifdef DEBUG_RESTRICTED_SHELL | ||
92 | {EUID_ROOT(); | ||
93 | FILE *fp = fopen("/firelog", "a"); | ||
94 | if (fp) { | ||
95 | fprintf(fp, "i %d ptr #%s#\n", i, fullargv[i]); | ||
96 | fclose(fp); | ||
97 | } | ||
98 | EUID_USER();} | ||
99 | #endif | ||
100 | |||
90 | if (*ptr != '\0') { | 101 | if (*ptr != '\0') { |
102 | // go to the end of the word | ||
103 | while (*ptr != ' ' && *ptr != '\t' && *ptr != '\0') | ||
104 | ptr++; | ||
91 | *ptr ='\0'; | 105 | *ptr ='\0'; |
92 | fullargv[i] = strdup(fullargv[i]); | 106 | fullargv[i] = strdup(fullargv[i]); |
93 | if (fullargv[i] == NULL) { | 107 | if (fullargv[i] == NULL) |
94 | fprintf(stderr, "Error: cannot allocate memory\n"); | 108 | errExit("strdup"); |
95 | exit(1); | ||
96 | } | ||
97 | ptr++; | 109 | ptr++; |
98 | while (*ptr == ' ' || *ptr == '\t') | 110 | while (*ptr == ' ' || *ptr == '\t') |
99 | ptr++; | 111 | ptr++; |