mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	internal/ssh: ignore env command totally (#6825)
* ssh: ignore env command totally * Remove commented code Needed fix described in issue #6889
This commit is contained in:
		
				
					committed by
					
						 techknowlogick
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							2f21bc33a5
						
					
				
				
					commit
					10ff527fae
				
			| @@ -52,18 +52,6 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) { | |||||||
| 			for req := range in { | 			for req := range in { | ||||||
| 				payload := cleanCommand(string(req.Payload)) | 				payload := cleanCommand(string(req.Payload)) | ||||||
| 				switch req.Type { | 				switch req.Type { | ||||||
| 				case "env": |  | ||||||
| 					args := strings.Split(strings.Replace(payload, "\x00", "", -1), "\v") |  | ||||||
| 					if len(args) != 2 { |  | ||||||
| 						log.Warn("SSH: Invalid env arguments: '%#v'", args) |  | ||||||
| 						continue |  | ||||||
| 					} |  | ||||||
| 					args[0] = strings.TrimLeft(args[0], "\x04") |  | ||||||
| 					_, _, err := com.ExecCmdBytes("env", args[0]+"="+args[1]) |  | ||||||
| 					if err != nil { |  | ||||||
| 						log.Error("env: %v", err) |  | ||||||
| 						return |  | ||||||
| 					} |  | ||||||
| 				case "exec": | 				case "exec": | ||||||
| 					cmdName := strings.TrimLeft(payload, "'()") | 					cmdName := strings.TrimLeft(payload, "'()") | ||||||
| 					log.Trace("SSH: Payload: %v", cmdName) | 					log.Trace("SSH: Payload: %v", cmdName) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user