mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 00:54:28 +00:00
work on #1880
This commit is contained in:
parent
75aab86a8d
commit
8eb4c3121a
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
|||||||
|
|
||||||
![](public/img/gogs-large-resize.png)
|
![](public/img/gogs-large-resize.png)
|
||||||
|
|
||||||
##### Current version: 0.6.20 Beta
|
##### Current version: 0.6.21 Beta
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
2
gogs.go
2
gogs.go
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.20.1102 Beta"
|
const APP_VER = "0.6.21.1102 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
@ -218,9 +218,9 @@ func CheckPublicKeyString(content string) (_ string, err error) {
|
|||||||
tmpFile.Close()
|
tmpFile.Close()
|
||||||
|
|
||||||
// Check if ssh-keygen recognizes its contents.
|
// Check if ssh-keygen recognizes its contents.
|
||||||
stdout, stderr, err := process.Exec("CheckPublicKeyString", "ssh-keygen", "-l", "-f", tmpPath)
|
stdout, stderr, err := process.Exec("CheckPublicKeyString", "ssh-keygen", "-lf", tmpPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.New("ssh-keygen -l -f: " + stderr)
|
return "", errors.New("ssh-keygen -lf: " + stderr)
|
||||||
} else if len(stdout) < 2 {
|
} else if len(stdout) < 2 {
|
||||||
return "", errors.New("ssh-keygen returned not enough output to evaluate the key: " + stdout)
|
return "", errors.New("ssh-keygen returned not enough output to evaluate the key: " + stdout)
|
||||||
}
|
}
|
||||||
@ -241,7 +241,8 @@ func CheckPublicKeyString(content string) (_ string, err error) {
|
|||||||
if keySize == 0 {
|
if keySize == 0 {
|
||||||
return "", errors.New("cannot get key size of the given key")
|
return "", errors.New("cannot get key size of the given key")
|
||||||
}
|
}
|
||||||
keyType := strings.Trim(sshKeygenOutput[len(sshKeygenOutput)-1], " ()")
|
|
||||||
|
keyType := strings.Trim(sshKeygenOutput[len(sshKeygenOutput)-1], " ()\n")
|
||||||
if minimumKeySize := setting.Service.MinimumKeySizes[keyType]; minimumKeySize == 0 {
|
if minimumKeySize := setting.Service.MinimumKeySizes[keyType]; minimumKeySize == 0 {
|
||||||
return "", fmt.Errorf("unrecognized public key type: %s", keyType)
|
return "", fmt.Errorf("unrecognized public key type: %s", keyType)
|
||||||
} else if keySize < minimumKeySize {
|
} else if keySize < minimumKeySize {
|
||||||
@ -311,9 +312,9 @@ func addKey(e Engine, key *PublicKey) (err error) {
|
|||||||
if err = ioutil.WriteFile(tmpPath, []byte(key.Content), 0644); err != nil {
|
if err = ioutil.WriteFile(tmpPath, []byte(key.Content), 0644); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
stdout, stderr, err := process.Exec("AddPublicKey", "ssh-keygen", "-l", "-f", tmpPath)
|
stdout, stderr, err := process.Exec("AddPublicKey", "ssh-keygen", "-lf", tmpPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("ssh-keygen -l -f: " + stderr)
|
return errors.New("ssh-keygen -lf: " + stderr)
|
||||||
} else if len(stdout) < 2 {
|
} else if len(stdout) < 2 {
|
||||||
return errors.New("not enough output for calculating fingerprint: " + stdout)
|
return errors.New("not enough output for calculating fingerprint: " + stdout)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
0.6.20.1102 Beta
|
0.6.21.1102 Beta
|
Loading…
Reference in New Issue
Block a user