mirror of
https://github.com/go-gitea/gitea.git
synced 2025-09-06 18:03:59 +00:00
Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16849)
* Upgrade xorm to v1.2.2 (#16663) Backport #16663 Fix #16683 * Upgrade xorm to v1.2.2 * Change the Engine interface to match xorm v1.2.2 * Add test to ensure that dumping of login sources remains correct (#16847) #16831 has occurred because of a missed regression. This PR adds a simple test to try to prevent this occuring again. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
12
vendor/github.com/lib/pq/.travis.sh
generated
vendored
12
vendor/github.com/lib/pq/.travis.sh
generated
vendored
@@ -1,17 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -eux
|
||||
|
||||
client_configure() {
|
||||
sudo chmod 600 $PQSSLCERTTEST_PATH/postgresql.key
|
||||
}
|
||||
|
||||
pgdg_repository() {
|
||||
local sourcelist='sources.list.d/postgresql.list'
|
||||
|
||||
curl -sS 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' | sudo apt-key add -
|
||||
echo deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main $PGVERSION | sudo tee "/etc/apt/$sourcelist"
|
||||
sudo apt-get -o Dir::Etc::sourcelist="$sourcelist" -o Dir::Etc::sourceparts='-' -o APT::Get::List-Cleanup='0' update
|
||||
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
postgresql_configure() {
|
||||
@@ -51,10 +49,10 @@ postgresql_configure() {
|
||||
}
|
||||
|
||||
postgresql_install() {
|
||||
xargs sudo apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confnew' install <<-packages
|
||||
xargs sudo apt-get -y install <<-packages
|
||||
postgresql-$PGVERSION
|
||||
postgresql-client-$PGVERSION
|
||||
postgresql-server-dev-$PGVERSION
|
||||
postgresql-contrib-$PGVERSION
|
||||
packages
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/lib/pq/.travis.yml
generated
vendored
2
vendor/github.com/lib/pq/.travis.yml
generated
vendored
@@ -3,7 +3,7 @@ language: go
|
||||
go:
|
||||
- 1.14.x
|
||||
- 1.15.x
|
||||
- master
|
||||
- 1.16.x
|
||||
|
||||
sudo: true
|
||||
|
||||
|
2
vendor/github.com/lib/pq/array.go
generated
vendored
2
vendor/github.com/lib/pq/array.go
generated
vendored
@@ -22,7 +22,7 @@ var typeSQLScanner = reflect.TypeOf((*sql.Scanner)(nil)).Elem()
|
||||
// db.Query(`SELECT * FROM t WHERE id = ANY($1)`, pq.Array([]int{235, 401}))
|
||||
//
|
||||
// var x []sql.NullInt64
|
||||
// db.QueryRow('SELECT ARRAY[235, 401]').Scan(pq.Array(&x))
|
||||
// db.QueryRow(`SELECT ARRAY[235, 401]`).Scan(pq.Array(&x))
|
||||
//
|
||||
// Scanning multi-dimensional arrays is not supported. Arrays where the lower
|
||||
// bound is not one (such as `[0:0]={1}') are not supported.
|
||||
|
15
vendor/github.com/lib/pq/conn.go
generated
vendored
15
vendor/github.com/lib/pq/conn.go
generated
vendored
@@ -298,7 +298,13 @@ func (c *Connector) open(ctx context.Context) (cn *conn, err error) {
|
||||
// the user.
|
||||
defer errRecoverNoErrBadConn(&err)
|
||||
|
||||
o := c.opts
|
||||
// Create a new values map (copy). This makes it so maps in different
|
||||
// connections do not reference the same underlying data structure, so it
|
||||
// is safe for multiple connections to concurrently write to their opts.
|
||||
o := make(values)
|
||||
for k, v := range c.opts {
|
||||
o[k] = v
|
||||
}
|
||||
|
||||
bad := &atomic.Value{}
|
||||
bad.Store(false)
|
||||
@@ -1100,7 +1106,7 @@ func isDriverSetting(key string) bool {
|
||||
return true
|
||||
case "password":
|
||||
return true
|
||||
case "sslmode", "sslcert", "sslkey", "sslrootcert":
|
||||
case "sslmode", "sslcert", "sslkey", "sslrootcert", "sslinline":
|
||||
return true
|
||||
case "fallback_application_name":
|
||||
return true
|
||||
@@ -1725,10 +1731,9 @@ func (cn *conn) processParameterStatus(r *readBuf) {
|
||||
case "server_version":
|
||||
var major1 int
|
||||
var major2 int
|
||||
var minor int
|
||||
_, err = fmt.Sscanf(r.string(), "%d.%d.%d", &major1, &major2, &minor)
|
||||
_, err = fmt.Sscanf(r.string(), "%d.%d", &major1, &major2)
|
||||
if err == nil {
|
||||
cn.parameterStatus.serverVersion = major1*10000 + major2*100 + minor
|
||||
cn.parameterStatus.serverVersion = major1*10000 + major2*100
|
||||
}
|
||||
|
||||
case "TimeZone":
|
||||
|
13
vendor/github.com/lib/pq/conn_go18.go
generated
vendored
13
vendor/github.com/lib/pq/conn_go18.go
generated
vendored
@@ -129,7 +129,16 @@ func (cn *conn) watchCancel(ctx context.Context) func() {
|
||||
}
|
||||
|
||||
func (cn *conn) cancel(ctx context.Context) error {
|
||||
c, err := dial(ctx, cn.dialer, cn.opts)
|
||||
// Create a new values map (copy). This makes sure the connection created
|
||||
// in this method cannot write to the same underlying data, which could
|
||||
// cause a concurrent map write panic. This is necessary because cancel
|
||||
// is called from a goroutine in watchCancel.
|
||||
o := make(values)
|
||||
for k, v := range cn.opts {
|
||||
o[k] = v
|
||||
}
|
||||
|
||||
c, err := dial(ctx, cn.dialer, o)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -142,7 +151,7 @@ func (cn *conn) cancel(ctx context.Context) error {
|
||||
c: c,
|
||||
bad: bad,
|
||||
}
|
||||
err = can.ssl(cn.opts)
|
||||
err = can.ssl(o)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
14
vendor/github.com/lib/pq/encode.go
generated
vendored
14
vendor/github.com/lib/pq/encode.go
generated
vendored
@@ -200,11 +200,17 @@ func appendEscapedText(buf []byte, text string) []byte {
|
||||
func mustParse(f string, typ oid.Oid, s []byte) time.Time {
|
||||
str := string(s)
|
||||
|
||||
// check for a 30-minute-offset timezone
|
||||
if (typ == oid.T_timestamptz || typ == oid.T_timetz) &&
|
||||
str[len(str)-3] == ':' {
|
||||
f += ":00"
|
||||
// Check for a minute and second offset in the timezone.
|
||||
if typ == oid.T_timestamptz || typ == oid.T_timetz {
|
||||
for i := 3; i <= 6; i += 3 {
|
||||
if str[len(str)-i] == ':' {
|
||||
f += ":00"
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Special case for 24:00 time.
|
||||
// Unfortunately, golang does not parse 24:00 as a proper time.
|
||||
// In this case, we want to try "round to the next day", to differentiate.
|
||||
|
24
vendor/github.com/lib/pq/ssl.go
generated
vendored
24
vendor/github.com/lib/pq/ssl.go
generated
vendored
@@ -83,6 +83,16 @@ func ssl(o values) (func(net.Conn) (net.Conn, error), error) {
|
||||
// in the user's home directory. The configured files must exist and have
|
||||
// the correct permissions.
|
||||
func sslClientCertificates(tlsConf *tls.Config, o values) error {
|
||||
sslinline := o["sslinline"]
|
||||
if sslinline == "true" {
|
||||
cert, err := tls.X509KeyPair([]byte(o["sslcert"]), []byte(o["sslkey"]))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tlsConf.Certificates = []tls.Certificate{cert}
|
||||
return nil
|
||||
}
|
||||
|
||||
// user.Current() might fail when cross-compiling. We have to ignore the
|
||||
// error and continue without home directory defaults, since we wouldn't
|
||||
// know from where to load them.
|
||||
@@ -137,9 +147,17 @@ func sslCertificateAuthority(tlsConf *tls.Config, o values) error {
|
||||
if sslrootcert := o["sslrootcert"]; len(sslrootcert) > 0 {
|
||||
tlsConf.RootCAs = x509.NewCertPool()
|
||||
|
||||
cert, err := ioutil.ReadFile(sslrootcert)
|
||||
if err != nil {
|
||||
return err
|
||||
sslinline := o["sslinline"]
|
||||
|
||||
var cert []byte
|
||||
if sslinline == "true" {
|
||||
cert = []byte(sslrootcert)
|
||||
} else {
|
||||
var err error
|
||||
cert, err = ioutil.ReadFile(sslrootcert)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if !tlsConf.RootCAs.AppendCertsFromPEM(cert) {
|
||||
|
4
vendor/github.com/lib/pq/url.go
generated
vendored
4
vendor/github.com/lib/pq/url.go
generated
vendored
@@ -40,10 +40,10 @@ func ParseURL(url string) (string, error) {
|
||||
}
|
||||
|
||||
var kvs []string
|
||||
escaper := strings.NewReplacer(` `, `\ `, `'`, `\'`, `\`, `\\`)
|
||||
escaper := strings.NewReplacer(`'`, `\'`, `\`, `\\`)
|
||||
accrue := func(k, v string) {
|
||||
if v != "" {
|
||||
kvs = append(kvs, k+"="+escaper.Replace(v))
|
||||
kvs = append(kvs, k+"='"+escaper.Replace(v)+"'")
|
||||
}
|
||||
}
|
||||
|
||||
|
9
vendor/github.com/lib/pq/user_other.go
generated
vendored
Normal file
9
vendor/github.com/lib/pq/user_other.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// Package pq is a pure Go Postgres driver for the database/sql package.
|
||||
|
||||
// +build js android hurd illumos zos
|
||||
|
||||
package pq
|
||||
|
||||
func userCurrent() (string, error) {
|
||||
return "", ErrCouldNotDetectUsername
|
||||
}
|
Reference in New Issue
Block a user