Ver código fonte

Non-filter command can't be destination of pipe

Serj Kalichev 1 ano atrás
pai
commit
c0967ec180
1 arquivos alterados com 11 adições e 0 exclusões
  1. 11 0
      klish/ksession/ksession_parse.c

+ 11 - 0
klish/ksession/ksession_parse.c

@@ -526,6 +526,17 @@ kexec_t *ksession_parse_for_exec(ksession_t *session, const char *raw_line,
 		// Components after pipe "|"
 		} else {
 
+			// Only the first component can be non-filter
+			if (!kentry_filter(kpargv_command(pargv))) {
+				faux_error_sprintf(error, "The non-filter command \"%s\" "
+					"can't be destination of pipe",
+					kentry_name(kpargv_command(pargv)));
+				kpargv_free(pargv);
+				kexec_free(exec);
+				faux_list_free(split);
+				return NULL;
+			}
+
 			// Only the first component can have 'restore=true' attribute
 			if (kentry_restore(kpargv_command(pargv))) {
 				faux_error_sprintf(error, "The command \"%s\" "