mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	#2147 fix rewrites authorized_keys when builtin SSH server is enabled
This commit is contained in:
		| @@ -299,6 +299,11 @@ func addKey(e Engine, key *PublicKey) (err error) { | |||||||
| 	if _, err = e.Insert(key); err != nil { | 	if _, err = e.Insert(key); err != nil { | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
|  | 	// Don't need to rewrite this file if builtin SSH server is enabled. | ||||||
|  | 	if setting.StartSSHServer { | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
| 	return saveAuthorizedKeyFile(key) | 	return saveAuthorizedKeyFile(key) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @@ -439,6 +444,11 @@ func deletePublicKey(e *xorm.Session, keyID int64) error { | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	// Don't need to rewrite this file if builtin SSH server is enabled. | ||||||
|  | 	if setting.StartSSHServer { | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	fpath := filepath.Join(SSHPath, "authorized_keys") | 	fpath := filepath.Join(SSHPath, "authorized_keys") | ||||||
| 	tmpPath := filepath.Join(SSHPath, "authorized_keys.tmp") | 	tmpPath := filepath.Join(SSHPath, "authorized_keys.tmp") | ||||||
| 	if err = rewriteAuthorizedKeys(key, fpath, tmpPath); err != nil { | 	if err = rewriteAuthorizedKeys(key, fpath, tmpPath); err != nil { | ||||||
		Reference in New Issue
	
	Block a user