mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	#1681 some fixes for builtin SSH server on Windows
This commit is contained in:
		@@ -65,7 +65,7 @@ func parseCmd(cmd string) (string, string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	COMMANDS = map[string]models.AccessMode{
 | 
			
		||||
	allowedCommands = map[string]models.AccessMode{
 | 
			
		||||
		"git-upload-pack":    models.ACCESS_MODE_READ,
 | 
			
		||||
		"git-upload-archive": models.ACCESS_MODE_READ,
 | 
			
		||||
		"git-receive-pack":   models.ACCESS_MODE_WRITE,
 | 
			
		||||
@@ -163,7 +163,7 @@ func runServ(c *cli.Context) {
 | 
			
		||||
		fail("Internal error", "Failed to get repository: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	requestedMode, has := COMMANDS[verb]
 | 
			
		||||
	requestedMode, has := allowedCommands[verb]
 | 
			
		||||
	if !has {
 | 
			
		||||
		fail("Unknown git command", "Unknown git command %s", verb)
 | 
			
		||||
	}
 | 
			
		||||
@@ -234,6 +234,11 @@ func runServ(c *cli.Context) {
 | 
			
		||||
	uuid := uuid.NewV4().String()
 | 
			
		||||
	os.Setenv("uuid", uuid)
 | 
			
		||||
 | 
			
		||||
	// Special handle for Windows.
 | 
			
		||||
	if setting.IsWindows {
 | 
			
		||||
		verb = strings.Replace(verb, "-", " ", 1)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var gitcmd *exec.Cmd
 | 
			
		||||
	verbs := strings.Split(verb, " ")
 | 
			
		||||
	if len(verbs) == 2 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user