[MM-19422] Add SQL trace and LDAP trace output to both console and server logs (#13190)
* Add MLOG for sql store * Update printf function * Update store/sqlstore/supplier.go Co-Authored-By: Martin Kraft <martin@upspin.org> * Update go mod * update go mod and tidy it up * update vendor folder
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a83df931b9
Коммит
de0672937c
3
go.mod
3
go.mod
@@ -44,7 +44,7 @@ require (
|
|||||||
github.com/mailru/easyjson v0.7.0 // indirect
|
github.com/mailru/easyjson v0.7.0 // indirect
|
||||||
github.com/mattermost/go-i18n v1.11.0
|
github.com/mattermost/go-i18n v1.11.0
|
||||||
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible
|
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible
|
||||||
github.com/mattermost/ldap v3.0.4+incompatible
|
github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d
|
||||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
||||||
github.com/mattermost/viper v1.0.4
|
github.com/mattermost/viper v1.0.4
|
||||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||||
@@ -95,7 +95,6 @@ require (
|
|||||||
google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c // indirect
|
google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c // indirect
|
||||||
google.golang.org/grpc v1.24.0 // indirect
|
google.golang.org/grpc v1.24.0 // indirect
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
|
|
||||||
gopkg.in/ini.v1 v1.48.0 // indirect
|
gopkg.in/ini.v1 v1.48.0 // indirect
|
||||||
gopkg.in/mail.v2 v2.3.1
|
gopkg.in/mail.v2 v2.3.1
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||||
|
|||||||
8
go.sum
8
go.sum
@@ -86,6 +86,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
|||||||
github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3 h1:QW2p25fGTu/S0MvEftCo3wV7aEFHBt2m1DTg1HUwh+o=
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||||
github.com/go-gorp/gorp v2.0.0+incompatible h1:dIQPsBtl6/H1MjVseWuWPXa7ET4p6Dve4j3Hg+UjqYw=
|
github.com/go-gorp/gorp v2.0.0+incompatible h1:dIQPsBtl6/H1MjVseWuWPXa7ET4p6Dve4j3Hg+UjqYw=
|
||||||
github.com/go-gorp/gorp v2.0.0+incompatible/go.mod h1:7IfkAQnO7jfT/9IQ3R9wL1dFhukN6aQxzKTHnkxzA/E=
|
github.com/go-gorp/gorp v2.0.0+incompatible/go.mod h1:7IfkAQnO7jfT/9IQ3R9wL1dFhukN6aQxzKTHnkxzA/E=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
@@ -242,8 +244,8 @@ github.com/mattermost/go-i18n v1.11.0 h1:1hLKqn/ZvhZ80OekjVPGYcCrBfMz+YxNNgqS+be
|
|||||||
github.com/mattermost/go-i18n v1.11.0/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34=
|
github.com/mattermost/go-i18n v1.11.0/go.mod h1:RyS7FDNQlzF1PsjbJWHRI35exqaKGSO9qD4iv8QjE34=
|
||||||
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible h1:FN4zK2wNig7MVVsOsGEZ+LeIq0gUcudn3LEGgbodMq8=
|
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible h1:FN4zK2wNig7MVVsOsGEZ+LeIq0gUcudn3LEGgbodMq8=
|
||||||
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible/go.mod h1:0kX1qa3DOpaPJyOdMLeo7TcBN0QmUszj9a/VygOhDe0=
|
github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible/go.mod h1:0kX1qa3DOpaPJyOdMLeo7TcBN0QmUszj9a/VygOhDe0=
|
||||||
github.com/mattermost/ldap v3.0.4+incompatible h1:SOeNnz+JNR+foQ3yHkYqijb9MLPhXN2BZP/PdX23VDU=
|
github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d h1:2DV7VIlEv6J5R5o6tUcb3ZMKJYeeZuWZL7Rv1m23TgQ=
|
||||||
github.com/mattermost/ldap v3.0.4+incompatible/go.mod h1:b4reDCcGpBxJ4WX0f224KFY+OR0npin7or7EFpeIko4=
|
github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
|
||||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0 h1:G9tL6JXRBMzjuD1kkBtcnd42kUiT6QDwxfFYu7adM6o=
|
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0 h1:G9tL6JXRBMzjuD1kkBtcnd42kUiT6QDwxfFYu7adM6o=
|
||||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
|
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
|
||||||
github.com/mattermost/viper v1.0.4 h1:cMYOz4PhguscGSPxrSokUtib5HrG4gCpiUh27wyA3d0=
|
github.com/mattermost/viper v1.0.4 h1:cMYOz4PhguscGSPxrSokUtib5HrG4gCpiUh27wyA3d0=
|
||||||
@@ -570,8 +572,6 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn
|
|||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
|
||||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM=
|
|
||||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
sqltrace "log"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@@ -114,6 +113,16 @@ type SqlSupplier struct {
|
|||||||
lockedToMaster bool
|
lockedToMaster bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TraceOnAdapter struct{}
|
||||||
|
|
||||||
|
func (t *TraceOnAdapter) Printf(format string, v ...interface{}) {
|
||||||
|
originalString := fmt.Sprintf(format, v...)
|
||||||
|
newString := strings.ReplaceAll(originalString, "\n", " ")
|
||||||
|
newString = strings.ReplaceAll(newString, "\t", " ")
|
||||||
|
newString = strings.ReplaceAll(newString, "\"", "")
|
||||||
|
mlog.Debug(newString)
|
||||||
|
}
|
||||||
|
|
||||||
func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlSupplier {
|
func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlSupplier {
|
||||||
supplier := &SqlSupplier{
|
supplier := &SqlSupplier{
|
||||||
rrCounter: 0,
|
rrCounter: 0,
|
||||||
@@ -248,7 +257,7 @@ func setupConnection(con_type string, dataSource string, settings *model.SqlSett
|
|||||||
}
|
}
|
||||||
|
|
||||||
if settings.Trace != nil && *settings.Trace {
|
if settings.Trace != nil && *settings.Trace {
|
||||||
dbmap.TraceOn("", sqltrace.New(os.Stdout, "sql-trace:", sqltrace.Lmicroseconds))
|
dbmap.TraceOn("sql-trace:", &TraceOnAdapter{})
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbmap
|
return dbmap
|
||||||
|
|||||||
8
vendor/gopkg.in/asn1-ber.v1/.travis.yml → vendor/github.com/go-asn1-ber/asn1-ber/.travis.yml
сгенерированный
поставляемый
8
vendor/gopkg.in/asn1-ber.v1/.travis.yml → vendor/github.com/go-asn1-ber/asn1-ber/.travis.yml
сгенерированный
поставляемый
@@ -18,12 +18,14 @@ matrix:
|
|||||||
- go: 1.9.x
|
- go: 1.9.x
|
||||||
- go: 1.10.x
|
- go: 1.10.x
|
||||||
- go: 1.11.x
|
- go: 1.11.x
|
||||||
|
- go: 1.12.x
|
||||||
|
- go: 1.13.x
|
||||||
env: GOOS=linux GOARCH=amd64
|
env: GOOS=linux GOARCH=amd64
|
||||||
- go: 1.11.x
|
- go: 1.13.x
|
||||||
env: GOOS=linux GOARCH=386
|
env: GOOS=linux GOARCH=386
|
||||||
- go: 1.11.x
|
- go: 1.13.x
|
||||||
env: GOOS=windows GOARCH=amd64
|
env: GOOS=windows GOARCH=amd64
|
||||||
- go: 1.11.x
|
- go: 1.13.x
|
||||||
env: GOOS=windows GOARCH=386
|
env: GOOS=windows GOARCH=386
|
||||||
- go: tip
|
- go: tip
|
||||||
go_import_path: gopkg.in/asn-ber.v1
|
go_import_path: gopkg.in/asn-ber.v1
|
||||||
0
vendor/gopkg.in/asn1-ber.v1/LICENSE → vendor/github.com/go-asn1-ber/asn1-ber/LICENSE
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/LICENSE → vendor/github.com/go-asn1-ber/asn1-ber/LICENSE
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/README.md → vendor/github.com/go-asn1-ber/asn1-ber/README.md
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/README.md → vendor/github.com/go-asn1-ber/asn1-ber/README.md
сгенерированный
поставляемый
4
vendor/gopkg.in/asn1-ber.v1/ber.go → vendor/github.com/go-asn1-ber/asn1-ber/ber.go
сгенерированный
поставляемый
4
vendor/gopkg.in/asn1-ber.v1/ber.go → vendor/github.com/go-asn1-ber/asn1-ber/ber.go
сгенерированный
поставляемый
@@ -160,6 +160,10 @@ func PrintBytes(out io.Writer, buf []byte, indent string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WritePacket(out io.Writer, p *Packet) {
|
||||||
|
printPacket(out, p, 0, false)
|
||||||
|
}
|
||||||
|
|
||||||
func PrintPacket(p *Packet) {
|
func PrintPacket(p *Packet) {
|
||||||
printPacket(os.Stdout, p, 0, false)
|
printPacket(os.Stdout, p, 0, false)
|
||||||
}
|
}
|
||||||
0
vendor/gopkg.in/asn1-ber.v1/content_int.go → vendor/github.com/go-asn1-ber/asn1-ber/content_int.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/content_int.go → vendor/github.com/go-asn1-ber/asn1-ber/content_int.go
сгенерированный
поставляемый
3
vendor/github.com/go-asn1-ber/asn1-ber/go.mod
сгенерированный
поставляемый
Обычный файл
3
vendor/github.com/go-asn1-ber/asn1-ber/go.mod
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,3 @@
|
|||||||
|
module github.com/go-asn1-ber/asn1-ber
|
||||||
|
|
||||||
|
go 1.13
|
||||||
0
vendor/gopkg.in/asn1-ber.v1/header.go → vendor/github.com/go-asn1-ber/asn1-ber/header.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/header.go → vendor/github.com/go-asn1-ber/asn1-ber/header.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/identifier.go → vendor/github.com/go-asn1-ber/asn1-ber/identifier.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/identifier.go → vendor/github.com/go-asn1-ber/asn1-ber/identifier.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/length.go → vendor/github.com/go-asn1-ber/asn1-ber/length.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/length.go → vendor/github.com/go-asn1-ber/asn1-ber/length.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/util.go → vendor/github.com/go-asn1-ber/asn1-ber/util.go
сгенерированный
поставляемый
0
vendor/gopkg.in/asn1-ber.v1/util.go → vendor/github.com/go-asn1-ber/asn1-ber/util.go
сгенерированный
поставляемый
7
vendor/github.com/mattermost/ldap/.travis.yml
сгенерированный
поставляемый
7
vendor/github.com/mattermost/ldap/.travis.yml
сгенерированный
поставляемый
@@ -9,18 +9,19 @@ go:
|
|||||||
- "1.10.x"
|
- "1.10.x"
|
||||||
- "1.11.x"
|
- "1.11.x"
|
||||||
- "1.12.x"
|
- "1.12.x"
|
||||||
|
- "1.13.x"
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
git:
|
git:
|
||||||
depth: 1
|
depth: 1
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- go: tip
|
- go: tip
|
||||||
go_import_path: gopkg.in/ldap.v3
|
go_import_path: github.com/go-ldap/ldap
|
||||||
install:
|
install:
|
||||||
- go get gopkg.in/asn1-ber.v1
|
- go get github.com/go-asn1-ber/asn1-ber
|
||||||
- go get code.google.com/p/go.tools/cmd/cover || go get golang.org/x/tools/cmd/cover
|
- go get code.google.com/p/go.tools/cmd/cover || go get golang.org/x/tools/cmd/cover
|
||||||
- go get github.com/golang/lint/golint || go get golang.org/x/lint/golint || true
|
- go get github.com/golang/lint/golint || go get golang.org/x/lint/golint || true
|
||||||
- go build -v ./...
|
- go build -v ./...
|
||||||
|
|||||||
37
vendor/github.com/mattermost/ldap/README.md
сгенерированный
поставляемый
37
vendor/github.com/mattermost/ldap/README.md
сгенерированный
поставляемый
@@ -1,22 +1,8 @@
|
|||||||
[](https://godoc.org/gopkg.in/ldap.v3)
|
[](https://godoc.org/github.com/go-ldap/ldap)
|
||||||
[](https://travis-ci.org/go-ldap/ldap)
|
[](https://travis-ci.org/go-ldap/ldap)
|
||||||
|
|
||||||
# Basic LDAP v3 functionality for the GO programming language.
|
# Basic LDAP v3 functionality for the GO programming language.
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
For the latest version use:
|
|
||||||
|
|
||||||
go get gopkg.in/ldap.v3
|
|
||||||
|
|
||||||
Import the latest version with:
|
|
||||||
|
|
||||||
import "gopkg.in/ldap.v3"
|
|
||||||
|
|
||||||
## Required Libraries:
|
|
||||||
|
|
||||||
- gopkg.in/asn1-ber.v1
|
|
||||||
|
|
||||||
## Features:
|
## Features:
|
||||||
|
|
||||||
- Connecting to LDAP server (non-TLS, TLS, STARTTLS)
|
- Connecting to LDAP server (non-TLS, TLS, STARTTLS)
|
||||||
@@ -34,6 +20,27 @@ Import the latest version with:
|
|||||||
- search
|
- search
|
||||||
- modify
|
- modify
|
||||||
|
|
||||||
|
## Go Modules:
|
||||||
|
|
||||||
|
`go get github.com/go-ldap/ldap/v3`
|
||||||
|
|
||||||
|
As go-ldap was v2+ when Go Modules came out, updating to Go Modules would be considered a breaking change.
|
||||||
|
|
||||||
|
To maintain backwards compatability, we ultimately decided to use subfolders (as v3 was already a branch).
|
||||||
|
Whilst this duplicates the code, we can move toward implementing a backwards-compatible versioning system that allows for code reuse.
|
||||||
|
The alternative would be to increment the version number, however we believe that this would confuse users as v3 is in line with LDAPv3 (RFC-4511)
|
||||||
|
https://tools.ietf.org/html/rfc4511
|
||||||
|
|
||||||
|
|
||||||
|
For more info, please visit the pull request that updated to modules.
|
||||||
|
https://github.com/go-ldap/ldap/pull/247
|
||||||
|
|
||||||
|
To install with `GOMODULE111=off`, use `go get github.com/go-ldap/ldap`
|
||||||
|
https://golang.org/cmd/go/#hdr-Legacy_GOPATH_go_get
|
||||||
|
|
||||||
|
As always, we are looking for contributors with great ideas on how to best move forward.
|
||||||
|
|
||||||
|
|
||||||
## Contributing:
|
## Contributing:
|
||||||
|
|
||||||
Bug reports and pull requests are welcome!
|
Bug reports and pull requests are welcome!
|
||||||
|
|||||||
53
vendor/github.com/mattermost/ldap/add.go
сгенерированный
поставляемый
53
vendor/github.com/mattermost/ldap/add.go
сгенерированный
поставляемый
@@ -10,10 +10,9 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Attribute represents an LDAP attribute
|
// Attribute represents an LDAP attribute
|
||||||
@@ -45,20 +44,26 @@ type AddRequest struct {
|
|||||||
Controls []Control
|
Controls []Control
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AddRequest) encode() *ber.Packet {
|
func (req *AddRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationAddRequest, nil, "Add Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationAddRequest, nil, "Add Request")
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, a.DN, "DN"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
|
||||||
attributes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
|
attributes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
|
||||||
for _, attribute := range a.Attributes {
|
for _, attribute := range req.Attributes {
|
||||||
attributes.AppendChild(attribute.encode())
|
attributes.AppendChild(attribute.encode())
|
||||||
}
|
}
|
||||||
request.AppendChild(attributes)
|
pkt.AppendChild(attributes)
|
||||||
return request
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
if len(req.Controls) > 0 {
|
||||||
|
envelope.AppendChild(encodeControls(req.Controls))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attribute adds an attribute with the given type and values
|
// Attribute adds an attribute with the given type and values
|
||||||
func (a *AddRequest) Attribute(attrType string, attrVals []string) {
|
func (req *AddRequest) Attribute(attrType string, attrVals []string) {
|
||||||
a.Attributes = append(a.Attributes, Attribute{Type: attrType, Vals: attrVals})
|
req.Attributes = append(req.Attributes, Attribute{Type: attrType, Vals: attrVals})
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAddRequest returns an AddRequest for the given DN, with no attributes
|
// NewAddRequest returns an AddRequest for the given DN, with no attributes
|
||||||
@@ -72,39 +77,17 @@ func NewAddRequest(dn string, controls []Control) *AddRequest {
|
|||||||
|
|
||||||
// Add performs the given AddRequest
|
// Add performs the given AddRequest
|
||||||
func (l *Conn) Add(addRequest *AddRequest) error {
|
func (l *Conn) Add(addRequest *AddRequest) error {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(addRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
packet.AppendChild(addRequest.encode())
|
|
||||||
if len(addRequest.Controls) > 0 {
|
|
||||||
packet.AppendChild(encodeControls(addRequest.Controls))
|
|
||||||
}
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
packet, err := l.readPacket(msgCtx)
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationAddResponse {
|
if packet.Children[1].Tag == ApplicationAddResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -113,7 +96,5 @@ func (l *Conn) Add(addRequest *AddRequest) error {
|
|||||||
} else {
|
} else {
|
||||||
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Debug.Printf("%d: returning", msgCtx.id)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
83
vendor/github.com/mattermost/ldap/bind.go
сгенерированный
поставляемый
83
vendor/github.com/mattermost/ldap/bind.go
сгенерированный
поставляемый
@@ -4,7 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SimpleBindRequest represents a username/password bind operation
|
// SimpleBindRequest represents a username/password bind operation
|
||||||
@@ -35,13 +35,18 @@ func NewSimpleBindRequest(username string, password string, controls []Control)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bindRequest *SimpleBindRequest) encode() *ber.Packet {
|
func (req *SimpleBindRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
|
||||||
request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, bindRequest.Username, "User Name"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Username, "User Name"))
|
||||||
request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, bindRequest.Password, "Password"))
|
pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.Password, "Password"))
|
||||||
|
|
||||||
return request
|
envelope.AppendChild(pkt)
|
||||||
|
if len(req.Controls) > 0 {
|
||||||
|
envelope.AppendChild(encodeControls(req.Controls))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimpleBind performs the simple bind operation defined in the given request
|
// SimpleBind performs the simple bind operation defined in the given request
|
||||||
@@ -50,41 +55,17 @@ func (l *Conn) SimpleBind(simpleBindRequest *SimpleBindRequest) (*SimpleBindResu
|
|||||||
return nil, NewError(ErrorEmptyPassword, errors.New("ldap: empty password not allowed by the client"))
|
return nil, NewError(ErrorEmptyPassword, errors.New("ldap: empty password not allowed by the client"))
|
||||||
}
|
}
|
||||||
|
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(simpleBindRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
encodedBindRequest := simpleBindRequest.encode()
|
|
||||||
packet.AppendChild(encodedBindRequest)
|
|
||||||
if len(simpleBindRequest.Controls) > 0 {
|
|
||||||
packet.AppendChild(encodeControls(simpleBindRequest.Controls))
|
|
||||||
}
|
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
packetResponse, ok := <-msgCtx.responses
|
packet, err := l.readPacket(msgCtx)
|
||||||
if !ok {
|
|
||||||
return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err = addLDAPDescriptions(packet); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
result := &SimpleBindResult{
|
result := &SimpleBindResult{
|
||||||
Controls: make([]Control, 0),
|
Controls: make([]Control, 0),
|
||||||
}
|
}
|
||||||
@@ -133,3 +114,39 @@ func (l *Conn) UnauthenticatedBind(username string) error {
|
|||||||
_, err := l.SimpleBind(req)
|
_, err := l.SimpleBind(req)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var externalBindRequest = requestFunc(func(envelope *ber.Packet) error {
|
||||||
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationBindRequest, nil, "Bind Request")
|
||||||
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, 3, "Version"))
|
||||||
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "User Name"))
|
||||||
|
|
||||||
|
saslAuth := ber.Encode(ber.ClassContext, ber.TypeConstructed, 3, "", "authentication")
|
||||||
|
saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "EXTERNAL", "SASL Mech"))
|
||||||
|
saslAuth.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, "", "SASL Cred"))
|
||||||
|
|
||||||
|
pkt.AppendChild(saslAuth)
|
||||||
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
// ExternalBind performs SASL/EXTERNAL authentication.
|
||||||
|
//
|
||||||
|
// Use ldap.DialURL("ldapi://") to connect to the Unix socket before ExternalBind.
|
||||||
|
//
|
||||||
|
// See https://tools.ietf.org/html/rfc4422#appendix-A
|
||||||
|
func (l *Conn) ExternalBind() error {
|
||||||
|
msgCtx, err := l.doRequest(externalBindRequest)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
|
packet, err := l.readPacket(msgCtx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetLDAPError(packet)
|
||||||
|
}
|
||||||
|
|||||||
18
vendor/github.com/mattermost/ldap/client.go
сгенерированный
поставляемый
18
vendor/github.com/mattermost/ldap/client.go
сгенерированный
поставляемый
@@ -8,21 +8,23 @@ import (
|
|||||||
// Client knows how to interact with an LDAP server
|
// Client knows how to interact with an LDAP server
|
||||||
type Client interface {
|
type Client interface {
|
||||||
Start()
|
Start()
|
||||||
StartTLS(config *tls.Config) error
|
StartTLS(*tls.Config) error
|
||||||
Close()
|
Close()
|
||||||
SetTimeout(time.Duration)
|
SetTimeout(time.Duration)
|
||||||
|
|
||||||
Bind(username, password string) error
|
Bind(username, password string) error
|
||||||
SimpleBind(simpleBindRequest *SimpleBindRequest) (*SimpleBindResult, error)
|
UnauthenticatedBind(username string) error
|
||||||
|
SimpleBind(*SimpleBindRequest) (*SimpleBindResult, error)
|
||||||
|
ExternalBind() error
|
||||||
|
|
||||||
Add(addRequest *AddRequest) error
|
Add(*AddRequest) error
|
||||||
Del(delRequest *DelRequest) error
|
Del(*DelRequest) error
|
||||||
Modify(modifyRequest *ModifyRequest) error
|
Modify(*ModifyRequest) error
|
||||||
ModifyDN(modifyDNRequest *ModifyDNRequest) error
|
ModifyDN(*ModifyDNRequest) error
|
||||||
|
|
||||||
Compare(dn, attribute, value string) (bool, error)
|
Compare(dn, attribute, value string) (bool, error)
|
||||||
PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*PasswordModifyResult, error)
|
PasswordModify(*PasswordModifyRequest) (*PasswordModifyResult, error)
|
||||||
|
|
||||||
Search(searchRequest *SearchRequest) (*SearchResult, error)
|
Search(*SearchRequest) (*SearchResult, error)
|
||||||
SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
|
SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
|
||||||
}
|
}
|
||||||
|
|||||||
59
vendor/github.com/mattermost/ldap/compare.go
сгенерированный
поставляемый
59
vendor/github.com/mattermost/ldap/compare.go
сгенерированный
поставляемый
@@ -20,53 +20,50 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// CompareRequest represents an LDAP CompareRequest operation.
|
||||||
|
type CompareRequest struct {
|
||||||
|
DN string
|
||||||
|
Attribute string
|
||||||
|
Value string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (req *CompareRequest) appendTo(envelope *ber.Packet) error {
|
||||||
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationCompareRequest, nil, "Compare Request")
|
||||||
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
|
||||||
|
|
||||||
|
ava := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "AttributeValueAssertion")
|
||||||
|
ava.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Attribute, "AttributeDesc"))
|
||||||
|
ava.AppendChild(ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.Value, "AssertionValue"))
|
||||||
|
|
||||||
|
pkt.AppendChild(ava)
|
||||||
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Compare checks to see if the attribute of the dn matches value. Returns true if it does otherwise
|
// Compare checks to see if the attribute of the dn matches value. Returns true if it does otherwise
|
||||||
// false with any error that occurs if any.
|
// false with any error that occurs if any.
|
||||||
func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
|
func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(&CompareRequest{
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
DN: dn,
|
||||||
|
Attribute: attribute,
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationCompareRequest, nil, "Compare Request")
|
Value: value})
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, dn, "DN"))
|
|
||||||
|
|
||||||
ava := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "AttributeValueAssertion")
|
|
||||||
ava.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "AttributeDesc"))
|
|
||||||
ava.AppendChild(ber.Encode(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, value, "AssertionValue"))
|
|
||||||
request.AppendChild(ava)
|
|
||||||
packet.AppendChild(request)
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
packet, err := l.readPacket(msgCtx)
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return false, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationCompareResponse {
|
if packet.Children[1].Tag == ApplicationCompareResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
|
|
||||||
|
|||||||
20
vendor/github.com/mattermost/ldap/conn.go
сгенерированный
поставляемый
20
vendor/github.com/mattermost/ldap/conn.go
сгенерированный
поставляемый
@@ -11,7 +11,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -140,7 +140,6 @@ func DialTLS(network, addr string, config *tls.Config) (*Conn, error) {
|
|||||||
// or ldap:// specified as protocol. On success a new Conn for the connection
|
// or ldap:// specified as protocol. On success a new Conn for the connection
|
||||||
// is returned.
|
// is returned.
|
||||||
func DialURL(addr string) (*Conn, error) {
|
func DialURL(addr string) (*Conn, error) {
|
||||||
|
|
||||||
lurl, err := url.Parse(addr)
|
lurl, err := url.Parse(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, NewError(ErrorNetwork, err)
|
return nil, NewError(ErrorNetwork, err)
|
||||||
@@ -154,6 +153,11 @@ func DialURL(addr string) (*Conn, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch lurl.Scheme {
|
switch lurl.Scheme {
|
||||||
|
case "ldapi":
|
||||||
|
if lurl.Path == "" || lurl.Path == "/" {
|
||||||
|
lurl.Path = "/var/run/slapd/ldapi"
|
||||||
|
}
|
||||||
|
return Dial("unix", lurl.Path)
|
||||||
case "ldap":
|
case "ldap":
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = DefaultLdapPort
|
port = DefaultLdapPort
|
||||||
@@ -187,9 +191,9 @@ func NewConn(conn net.Conn, isTLS bool) *Conn {
|
|||||||
|
|
||||||
// Start initializes goroutines to read responses and process messages
|
// Start initializes goroutines to read responses and process messages
|
||||||
func (l *Conn) Start() {
|
func (l *Conn) Start() {
|
||||||
|
l.wgClose.Add(1)
|
||||||
go l.reader()
|
go l.reader()
|
||||||
go l.processMessages()
|
go l.processMessages()
|
||||||
l.wgClose.Add(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsClosing returns whether or not we're currently closing.
|
// IsClosing returns whether or not we're currently closing.
|
||||||
@@ -274,7 +278,7 @@ func (l *Conn) StartTLS(config *tls.Config) error {
|
|||||||
l.Close()
|
l.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ber.PrintPacket(packet)
|
l.Debug.PrintPacket(packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := GetLDAPError(packet); err == nil {
|
if err := GetLDAPError(packet); err == nil {
|
||||||
@@ -447,7 +451,7 @@ func (l *Conn) processMessages() {
|
|||||||
msgCtx.sendResponse(&PacketResponse{message.Packet, nil})
|
msgCtx.sendResponse(&PacketResponse{message.Packet, nil})
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Received unexpected message %d, %v", message.MessageID, l.IsClosing())
|
log.Printf("Received unexpected message %d, %v", message.MessageID, l.IsClosing())
|
||||||
ber.PrintPacket(message.Packet)
|
l.Debug.PrintPacket(message.Packet)
|
||||||
}
|
}
|
||||||
case MessageTimeout:
|
case MessageTimeout:
|
||||||
// Handle the timeout by closing the channel
|
// Handle the timeout by closing the channel
|
||||||
@@ -490,11 +494,13 @@ func (l *Conn) reader() {
|
|||||||
// A read error is expected here if we are closing the connection...
|
// A read error is expected here if we are closing the connection...
|
||||||
if !l.IsClosing() {
|
if !l.IsClosing() {
|
||||||
l.closeErr.Store(fmt.Errorf("unable to read LDAP response packet: %s", err))
|
l.closeErr.Store(fmt.Errorf("unable to read LDAP response packet: %s", err))
|
||||||
l.Debug.Printf("reader error: %s", err.Error())
|
l.Debug.Printf("reader error: %s", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
addLDAPDescriptions(packet)
|
if err := addLDAPDescriptions(packet); err != nil {
|
||||||
|
l.Debug.Printf("descriptions error: %s", err)
|
||||||
|
}
|
||||||
if len(packet.Children) == 0 {
|
if len(packet.Children) == 0 {
|
||||||
l.Debug.Printf("Received bad ldap packet")
|
l.Debug.Printf("Received bad ldap packet")
|
||||||
continue
|
continue
|
||||||
|
|||||||
2
vendor/github.com/mattermost/ldap/control.go
сгенерированный
поставляемый
2
vendor/github.com/mattermost/ldap/control.go
сгенерированный
поставляемый
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
"github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
19
vendor/github.com/mattermost/ldap/debug.go
сгенерированный
поставляемый
19
vendor/github.com/mattermost/ldap/debug.go
сгенерированный
поставляемый
@@ -1,24 +1,37 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const LDAP_TRACE_PREFIX = "ldap-trace: "
|
||||||
|
|
||||||
// debugging type
|
// debugging type
|
||||||
// - has a Printf method to write the debug output
|
// - has a Printf method to write the debug output
|
||||||
type debugging bool
|
type debugging bool
|
||||||
|
|
||||||
// write debug output
|
// Enable controls debugging mode.
|
||||||
|
func (debug *debugging) Enable(b bool) {
|
||||||
|
*debug = debugging(b)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Printf writes debug output.
|
||||||
func (debug debugging) Printf(format string, args ...interface{}) {
|
func (debug debugging) Printf(format string, args ...interface{}) {
|
||||||
if debug {
|
if debug {
|
||||||
|
format = LDAP_TRACE_PREFIX + format
|
||||||
log.Printf(format, args...)
|
log.Printf(format, args...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintPacket dumps a packet.
|
||||||
func (debug debugging) PrintPacket(packet *ber.Packet) {
|
func (debug debugging) PrintPacket(packet *ber.Packet) {
|
||||||
if debug {
|
if debug {
|
||||||
ber.PrintPacket(packet)
|
var b bytes.Buffer
|
||||||
|
ber.WritePacket(&b, packet)
|
||||||
|
textToPrint := LDAP_TRACE_PREFIX + b.String()
|
||||||
|
log.Printf(textToPrint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
vendor/github.com/mattermost/ldap/del.go
сгенерированный
поставляемый
48
vendor/github.com/mattermost/ldap/del.go
сгенерированный
поставляемый
@@ -6,10 +6,9 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DelRequest implements an LDAP deletion request
|
// DelRequest implements an LDAP deletion request
|
||||||
@@ -20,15 +19,20 @@ type DelRequest struct {
|
|||||||
Controls []Control
|
Controls []Control
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d DelRequest) encode() *ber.Packet {
|
func (req *DelRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypePrimitive, ApplicationDelRequest, d.DN, "Del Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypePrimitive, ApplicationDelRequest, req.DN, "Del Request")
|
||||||
request.Data.Write([]byte(d.DN))
|
pkt.Data.Write([]byte(req.DN))
|
||||||
return request
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
if len(req.Controls) > 0 {
|
||||||
|
envelope.AppendChild(encodeControls(req.Controls))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDelRequest creates a delete request for the given DN and controls
|
// NewDelRequest creates a delete request for the given DN and controls
|
||||||
func NewDelRequest(DN string,
|
func NewDelRequest(DN string, Controls []Control) *DelRequest {
|
||||||
Controls []Control) *DelRequest {
|
|
||||||
return &DelRequest{
|
return &DelRequest{
|
||||||
DN: DN,
|
DN: DN,
|
||||||
Controls: Controls,
|
Controls: Controls,
|
||||||
@@ -37,39 +41,17 @@ func NewDelRequest(DN string,
|
|||||||
|
|
||||||
// Del executes the given delete request
|
// Del executes the given delete request
|
||||||
func (l *Conn) Del(delRequest *DelRequest) error {
|
func (l *Conn) Del(delRequest *DelRequest) error {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(delRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
packet.AppendChild(delRequest.encode())
|
|
||||||
if len(delRequest.Controls) > 0 {
|
|
||||||
packet.AppendChild(encodeControls(delRequest.Controls))
|
|
||||||
}
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
packet, err := l.readPacket(msgCtx)
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationDelResponse {
|
if packet.Children[1].Tag == ApplicationDelResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -78,7 +60,5 @@ func (l *Conn) Del(delRequest *DelRequest) error {
|
|||||||
} else {
|
} else {
|
||||||
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Debug.Printf("%d: returning", msgCtx.id)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
2
vendor/github.com/mattermost/ldap/dn.go
сгенерированный
поставляемый
2
vendor/github.com/mattermost/ldap/dn.go
сгенерированный
поставляемый
@@ -48,7 +48,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
"github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AttributeTypeAndValue represents an attributeTypeAndValue from https://tools.ietf.org/html/rfc4514
|
// AttributeTypeAndValue represents an attributeTypeAndValue from https://tools.ietf.org/html/rfc4514
|
||||||
|
|||||||
6
vendor/github.com/mattermost/ldap/error.go
сгенерированный
поставляемый
6
vendor/github.com/mattermost/ldap/error.go
сгенерированный
поставляемый
@@ -3,7 +3,7 @@ package ldap
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LDAP Result Codes
|
// LDAP Result Codes
|
||||||
@@ -196,7 +196,9 @@ func (e *Error) Error() string {
|
|||||||
func GetLDAPError(packet *ber.Packet) error {
|
func GetLDAPError(packet *ber.Packet) error {
|
||||||
if packet == nil {
|
if packet == nil {
|
||||||
return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty packet")}
|
return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty packet")}
|
||||||
} else if len(packet.Children) >= 2 {
|
}
|
||||||
|
|
||||||
|
if len(packet.Children) >= 2 {
|
||||||
response := packet.Children[1]
|
response := packet.Children[1]
|
||||||
if response == nil {
|
if response == nil {
|
||||||
return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty response in packet")}
|
return &Error{ResultCode: ErrorUnexpectedResponse, Err: fmt.Errorf("Empty response in packet")}
|
||||||
|
|||||||
2
vendor/github.com/mattermost/ldap/filter.go
сгенерированный
поставляемый
2
vendor/github.com/mattermost/ldap/filter.go
сгенерированный
поставляемый
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
"github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Filter choices
|
// Filter choices
|
||||||
|
|||||||
5
vendor/github.com/mattermost/ldap/go.mod
сгенерированный
поставляемый
Обычный файл
5
vendor/github.com/mattermost/ldap/go.mod
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,5 @@
|
|||||||
|
module github.com/mattermost/ldap
|
||||||
|
|
||||||
|
require github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3
|
||||||
|
|
||||||
|
go 1.13
|
||||||
4
vendor/github.com/mattermost/ldap/go.sum
сгенерированный
поставляемый
Обычный файл
4
vendor/github.com/mattermost/ldap/go.sum
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,4 @@
|
|||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.1 h1:gvPdv/Hr++TRFCl0UbPFHC54P9N9jgsRPnmnr419Uck=
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3 h1:QW2p25fGTu/S0MvEftCo3wV7aEFHBt2m1DTg1HUwh+o=
|
||||||
|
github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
||||||
5
vendor/github.com/mattermost/ldap/ldap.go
сгенерированный
поставляемый
5
vendor/github.com/mattermost/ldap/ldap.go
сгенерированный
поставляемый
@@ -1,12 +1,11 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LDAP Application Codes
|
// LDAP Application Codes
|
||||||
@@ -87,7 +86,7 @@ var BeheraPasswordPolicyErrorMap = map[int8]string{
|
|||||||
func addLDAPDescriptions(packet *ber.Packet) (err error) {
|
func addLDAPDescriptions(packet *ber.Packet) (err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
err = NewError(ErrorDebugging, errors.New("ldap: cannot process packet to add descriptions"))
|
err = NewError(ErrorDebugging, fmt.Errorf("ldap: cannot process packet to add descriptions: %s", r))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
packet.Description = "LDAP Response"
|
packet.Description = "LDAP Response"
|
||||||
|
|||||||
47
vendor/github.com/mattermost/ldap/moddn.go
сгенерированный
поставляемый
47
vendor/github.com/mattermost/ldap/moddn.go
сгенерированный
поставляемый
@@ -11,10 +11,9 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ModifyDNRequest holds the request to modify a DN
|
// ModifyDNRequest holds the request to modify a DN
|
||||||
@@ -46,50 +45,34 @@ func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *Modi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ModifyDNRequest) encode() *ber.Packet {
|
func (req *ModifyDNRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyDNRequest, nil, "Modify DN Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyDNRequest, nil, "Modify DN Request")
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, m.DN, "DN"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, m.NewRDN, "New RDN"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.NewRDN, "New RDN"))
|
||||||
request.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, m.DeleteOldRDN, "Delete old RDN"))
|
pkt.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, req.DeleteOldRDN, "Delete old RDN"))
|
||||||
if m.NewSuperior != "" {
|
if req.NewSuperior != "" {
|
||||||
request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, m.NewSuperior, "New Superior"))
|
pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.NewSuperior, "New Superior"))
|
||||||
}
|
}
|
||||||
return request
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModifyDN renames the given DN and optionally move to another base (when the "newSup" argument
|
// ModifyDN renames the given DN and optionally move to another base (when the "newSup" argument
|
||||||
// to NewModifyDNRequest() is not "").
|
// to NewModifyDNRequest() is not "").
|
||||||
func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
|
func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(m)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
packet.AppendChild(m.encode())
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
packet, err := l.readPacket(msgCtx)
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return NewError(ErrorNetwork, errors.New("ldap: channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationModifyDNResponse {
|
if packet.Children[1].Tag == ApplicationModifyDNResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -98,7 +81,5 @@ func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
|
|||||||
} else {
|
} else {
|
||||||
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Debug.Printf("%d: returning", msgCtx.id)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
70
vendor/github.com/mattermost/ldap/modify.go
сгенерированный
поставляемый
70
vendor/github.com/mattermost/ldap/modify.go
сгенерированный
поставляемый
@@ -26,10 +26,9 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Change operation choices
|
// Change operation choices
|
||||||
@@ -84,40 +83,43 @@ type ModifyRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add appends the given attribute to the list of changes to be made
|
// Add appends the given attribute to the list of changes to be made
|
||||||
func (m *ModifyRequest) Add(attrType string, attrVals []string) {
|
func (req *ModifyRequest) Add(attrType string, attrVals []string) {
|
||||||
m.appendChange(AddAttribute, attrType, attrVals)
|
req.appendChange(AddAttribute, attrType, attrVals)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete appends the given attribute to the list of changes to be made
|
// Delete appends the given attribute to the list of changes to be made
|
||||||
func (m *ModifyRequest) Delete(attrType string, attrVals []string) {
|
func (req *ModifyRequest) Delete(attrType string, attrVals []string) {
|
||||||
m.appendChange(DeleteAttribute, attrType, attrVals)
|
req.appendChange(DeleteAttribute, attrType, attrVals)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace appends the given attribute to the list of changes to be made
|
// Replace appends the given attribute to the list of changes to be made
|
||||||
func (m *ModifyRequest) Replace(attrType string, attrVals []string) {
|
func (req *ModifyRequest) Replace(attrType string, attrVals []string) {
|
||||||
m.appendChange(ReplaceAttribute, attrType, attrVals)
|
req.appendChange(ReplaceAttribute, attrType, attrVals)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModifyRequest) appendChange(operation uint, attrType string, attrVals []string) {
|
func (req *ModifyRequest) appendChange(operation uint, attrType string, attrVals []string) {
|
||||||
m.Changes = append(m.Changes, Change{operation, PartialAttribute{Type: attrType, Vals: attrVals}})
|
req.Changes = append(req.Changes, Change{operation, PartialAttribute{Type: attrType, Vals: attrVals}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m ModifyRequest) encode() *ber.Packet {
|
func (req *ModifyRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyRequest, nil, "Modify Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationModifyRequest, nil, "Modify Request")
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, m.DN, "DN"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.DN, "DN"))
|
||||||
changes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Changes")
|
changes := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Changes")
|
||||||
for _, change := range m.Changes {
|
for _, change := range req.Changes {
|
||||||
changes.AppendChild(change.encode())
|
changes.AppendChild(change.encode())
|
||||||
}
|
}
|
||||||
request.AppendChild(changes)
|
pkt.AppendChild(changes)
|
||||||
return request
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
if len(req.Controls) > 0 {
|
||||||
|
envelope.AppendChild(encodeControls(req.Controls))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewModifyRequest creates a modify request for the given DN
|
// NewModifyRequest creates a modify request for the given DN
|
||||||
func NewModifyRequest(
|
func NewModifyRequest(dn string, controls []Control) *ModifyRequest {
|
||||||
dn string,
|
|
||||||
controls []Control,
|
|
||||||
) *ModifyRequest {
|
|
||||||
return &ModifyRequest{
|
return &ModifyRequest{
|
||||||
DN: dn,
|
DN: dn,
|
||||||
Controls: controls,
|
Controls: controls,
|
||||||
@@ -126,39 +128,17 @@ func NewModifyRequest(
|
|||||||
|
|
||||||
// Modify performs the ModifyRequest
|
// Modify performs the ModifyRequest
|
||||||
func (l *Conn) Modify(modifyRequest *ModifyRequest) error {
|
func (l *Conn) Modify(modifyRequest *ModifyRequest) error {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(modifyRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
packet.AppendChild(modifyRequest.encode())
|
|
||||||
if len(modifyRequest.Controls) > 0 {
|
|
||||||
packet.AppendChild(encodeControls(modifyRequest.Controls))
|
|
||||||
}
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
packet, err := l.readPacket(msgCtx)
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationModifyResponse {
|
if packet.Children[1].Tag == ApplicationModifyResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -167,7 +147,5 @@ func (l *Conn) Modify(modifyRequest *ModifyRequest) error {
|
|||||||
} else {
|
} else {
|
||||||
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
log.Printf("Unexpected Response: %d", packet.Children[1].Tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
l.Debug.Printf("%d: returning", msgCtx.id)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
64
vendor/github.com/mattermost/ldap/passwdmodify.go
сгенерированный
поставляемый
64
vendor/github.com/mattermost/ldap/passwdmodify.go
сгенерированный
поставляемый
@@ -6,10 +6,9 @@
|
|||||||
package ldap
|
package ldap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -36,25 +35,28 @@ type PasswordModifyResult struct {
|
|||||||
Referral string
|
Referral string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PasswordModifyRequest) encode() (*ber.Packet, error) {
|
func (req *PasswordModifyRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationExtendedRequest, nil, "Password Modify Extended Operation")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationExtendedRequest, nil, "Password Modify Extended Operation")
|
||||||
request.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, passwordModifyOID, "Extended Request Name: Password Modify OID"))
|
pkt.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, passwordModifyOID, "Extended Request Name: Password Modify OID"))
|
||||||
|
|
||||||
extendedRequestValue := ber.Encode(ber.ClassContext, ber.TypePrimitive, 1, nil, "Extended Request Value: Password Modify Request")
|
extendedRequestValue := ber.Encode(ber.ClassContext, ber.TypePrimitive, 1, nil, "Extended Request Value: Password Modify Request")
|
||||||
passwordModifyRequestValue := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Password Modify Request")
|
passwordModifyRequestValue := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Password Modify Request")
|
||||||
if r.UserIdentity != "" {
|
if req.UserIdentity != "" {
|
||||||
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, r.UserIdentity, "User Identity"))
|
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 0, req.UserIdentity, "User Identity"))
|
||||||
}
|
}
|
||||||
if r.OldPassword != "" {
|
if req.OldPassword != "" {
|
||||||
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 1, r.OldPassword, "Old Password"))
|
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 1, req.OldPassword, "Old Password"))
|
||||||
}
|
}
|
||||||
if r.NewPassword != "" {
|
if req.NewPassword != "" {
|
||||||
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 2, r.NewPassword, "New Password"))
|
passwordModifyRequestValue.AppendChild(ber.NewString(ber.ClassContext, ber.TypePrimitive, 2, req.NewPassword, "New Password"))
|
||||||
}
|
}
|
||||||
|
|
||||||
extendedRequestValue.AppendChild(passwordModifyRequestValue)
|
extendedRequestValue.AppendChild(passwordModifyRequestValue)
|
||||||
request.AppendChild(extendedRequestValue)
|
|
||||||
|
|
||||||
return request, nil
|
pkt.AppendChild(extendedRequestValue)
|
||||||
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPasswordModifyRequest creates a new PasswordModifyRequest
|
// NewPasswordModifyRequest creates a new PasswordModifyRequest
|
||||||
@@ -84,46 +86,18 @@ func NewPasswordModifyRequest(userIdentity string, oldPassword string, newPasswo
|
|||||||
|
|
||||||
// PasswordModify performs the modification request
|
// PasswordModify performs the modification request
|
||||||
func (l *Conn) PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*PasswordModifyResult, error) {
|
func (l *Conn) PasswordModify(passwordModifyRequest *PasswordModifyRequest) (*PasswordModifyResult, error) {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(passwordModifyRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
|
|
||||||
encodedPasswordModifyRequest, err := passwordModifyRequest.encode()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
packet.AppendChild(encodedPasswordModifyRequest)
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer l.finishMessage(msgCtx)
|
defer l.finishMessage(msgCtx)
|
||||||
|
|
||||||
result := &PasswordModifyResult{}
|
packet, err := l.readPacket(msgCtx)
|
||||||
|
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if packet == nil {
|
result := &PasswordModifyResult{}
|
||||||
return nil, NewError(ErrorNetwork, errors.New("ldap: could not retrieve message"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if packet.Children[1].Tag == ApplicationExtendedResponse {
|
if packet.Children[1].Tag == ApplicationExtendedResponse {
|
||||||
err := GetLDAPError(packet)
|
err := GetLDAPError(packet)
|
||||||
|
|||||||
66
vendor/github.com/mattermost/ldap/request.go
сгенерированный
поставляемый
Обычный файл
66
vendor/github.com/mattermost/ldap/request.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,66 @@
|
|||||||
|
package ldap
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
errRespChanClosed = errors.New("ldap: response channel closed")
|
||||||
|
errCouldNotRetMsg = errors.New("ldap: could not retrieve message")
|
||||||
|
)
|
||||||
|
|
||||||
|
type request interface {
|
||||||
|
appendTo(*ber.Packet) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type requestFunc func(*ber.Packet) error
|
||||||
|
|
||||||
|
func (f requestFunc) appendTo(p *ber.Packet) error {
|
||||||
|
return f(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Conn) doRequest(req request) (*messageContext, error) {
|
||||||
|
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
||||||
|
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
||||||
|
if err := req.appendTo(packet); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.Debug {
|
||||||
|
l.Debug.PrintPacket(packet)
|
||||||
|
}
|
||||||
|
|
||||||
|
msgCtx, err := l.sendMessage(packet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l.Debug.Printf("%d: returning", msgCtx.id)
|
||||||
|
return msgCtx, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Conn) readPacket(msgCtx *messageContext) (*ber.Packet, error) {
|
||||||
|
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
||||||
|
packetResponse, ok := <-msgCtx.responses
|
||||||
|
if !ok {
|
||||||
|
return nil, NewError(ErrorNetwork, errRespChanClosed)
|
||||||
|
}
|
||||||
|
packet, err := packetResponse.ReadPacket()
|
||||||
|
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if packet == nil {
|
||||||
|
return nil, NewError(ErrorNetwork, errCouldNotRetMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
if l.Debug {
|
||||||
|
if err = addLDAPDescriptions(packet); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
l.Debug.PrintPacket(packet)
|
||||||
|
}
|
||||||
|
return packet, nil
|
||||||
|
}
|
||||||
75
vendor/github.com/mattermost/ldap/search.go
сгенерированный
поставляемый
75
vendor/github.com/mattermost/ldap/search.go
сгенерированный
поставляемый
@@ -61,7 +61,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/asn1-ber.v1"
|
ber "github.com/go-asn1-ber/asn1-ber"
|
||||||
)
|
)
|
||||||
|
|
||||||
// scope choices
|
// scope choices
|
||||||
@@ -246,27 +246,33 @@ type SearchRequest struct {
|
|||||||
Controls []Control
|
Controls []Control
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SearchRequest) encode() (*ber.Packet, error) {
|
func (req *SearchRequest) appendTo(envelope *ber.Packet) error {
|
||||||
request := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationSearchRequest, nil, "Search Request")
|
pkt := ber.Encode(ber.ClassApplication, ber.TypeConstructed, ApplicationSearchRequest, nil, "Search Request")
|
||||||
request.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, s.BaseDN, "Base DN"))
|
pkt.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, req.BaseDN, "Base DN"))
|
||||||
request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(s.Scope), "Scope"))
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(req.Scope), "Scope"))
|
||||||
request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(s.DerefAliases), "Deref Aliases"))
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagEnumerated, uint64(req.DerefAliases), "Deref Aliases"))
|
||||||
request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(s.SizeLimit), "Size Limit"))
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(req.SizeLimit), "Size Limit"))
|
||||||
request.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(s.TimeLimit), "Time Limit"))
|
pkt.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, uint64(req.TimeLimit), "Time Limit"))
|
||||||
request.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, s.TypesOnly, "Types Only"))
|
pkt.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, req.TypesOnly, "Types Only"))
|
||||||
// compile and encode filter
|
// compile and encode filter
|
||||||
filterPacket, err := CompileFilter(s.Filter)
|
filterPacket, err := CompileFilter(req.Filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return err
|
||||||
}
|
}
|
||||||
request.AppendChild(filterPacket)
|
pkt.AppendChild(filterPacket)
|
||||||
// encode attributes
|
// encode attributes
|
||||||
attributesPacket := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
|
attributesPacket := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Attributes")
|
||||||
for _, attribute := range s.Attributes {
|
for _, attribute := range req.Attributes {
|
||||||
attributesPacket.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "Attribute"))
|
attributesPacket.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "Attribute"))
|
||||||
}
|
}
|
||||||
request.AppendChild(attributesPacket)
|
pkt.AppendChild(attributesPacket)
|
||||||
return request, nil
|
|
||||||
|
envelope.AppendChild(pkt)
|
||||||
|
if len(req.Controls) > 0 {
|
||||||
|
envelope.AppendChild(encodeControls(req.Controls))
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSearchRequest creates a new search request
|
// NewSearchRequest creates a new search request
|
||||||
@@ -366,22 +372,7 @@ func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32)
|
|||||||
|
|
||||||
// Search performs the given search request
|
// Search performs the given search request
|
||||||
func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
|
func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
|
||||||
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
|
msgCtx, err := l.doRequest(searchRequest)
|
||||||
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))
|
|
||||||
// encode search request
|
|
||||||
encodedSearchRequest, err := searchRequest.encode()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
packet.AppendChild(encodedSearchRequest)
|
|
||||||
// encode search controls
|
|
||||||
if len(searchRequest.Controls) > 0 {
|
|
||||||
packet.AppendChild(encodeControls(searchRequest.Controls))
|
|
||||||
}
|
|
||||||
|
|
||||||
l.Debug.PrintPacket(packet)
|
|
||||||
|
|
||||||
msgCtx, err := l.sendMessage(packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -392,26 +383,12 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
|
|||||||
Referrals: make([]string, 0),
|
Referrals: make([]string, 0),
|
||||||
Controls: make([]Control, 0)}
|
Controls: make([]Control, 0)}
|
||||||
|
|
||||||
foundSearchResultDone := false
|
for {
|
||||||
for !foundSearchResultDone {
|
packet, err := l.readPacket(msgCtx)
|
||||||
l.Debug.Printf("%d: waiting for response", msgCtx.id)
|
|
||||||
packetResponse, ok := <-msgCtx.responses
|
|
||||||
if !ok {
|
|
||||||
return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
|
|
||||||
}
|
|
||||||
packet, err = packetResponse.ReadPacket()
|
|
||||||
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.Debug {
|
|
||||||
if err := addLDAPDescriptions(packet); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
ber.PrintPacket(packet)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch packet.Children[1].Tag {
|
switch packet.Children[1].Tag {
|
||||||
case 4:
|
case 4:
|
||||||
entry := new(Entry)
|
entry := new(Entry)
|
||||||
@@ -440,11 +417,9 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
|
|||||||
result.Controls = append(result.Controls, decodedChild)
|
result.Controls = append(result.Controls, decodedChild)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foundSearchResultDone = true
|
return result, nil
|
||||||
case 19:
|
case 19:
|
||||||
result.Referrals = append(result.Referrals, packet.Children[1].Children[0].Value.(string))
|
result.Referrals = append(result.Referrals, packet.Children[1].Children[0].Value.(string))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l.Debug.Printf("%d: returning", msgCtx.id)
|
|
||||||
return result, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
vendor/modules.txt
поставляемый
6
vendor/modules.txt
поставляемый
@@ -22,6 +22,8 @@ github.com/disintegration/imaging
|
|||||||
github.com/dyatlov/go-opengraph/opengraph
|
github.com/dyatlov/go-opengraph/opengraph
|
||||||
# github.com/fsnotify/fsnotify v1.4.7
|
# github.com/fsnotify/fsnotify v1.4.7
|
||||||
github.com/fsnotify/fsnotify
|
github.com/fsnotify/fsnotify
|
||||||
|
# github.com/go-asn1-ber/asn1-ber v1.3.2-0.20191121212151-29be175fc3a3
|
||||||
|
github.com/go-asn1-ber/asn1-ber
|
||||||
# github.com/go-sql-driver/mysql v1.4.1
|
# github.com/go-sql-driver/mysql v1.4.1
|
||||||
github.com/go-sql-driver/mysql
|
github.com/go-sql-driver/mysql
|
||||||
# github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
# github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||||
@@ -116,7 +118,7 @@ github.com/mattermost/go-i18n/i18n/language
|
|||||||
github.com/mattermost/go-i18n/i18n/translation
|
github.com/mattermost/go-i18n/i18n/translation
|
||||||
# github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible
|
# github.com/mattermost/gorp v2.0.1-0.20190301154413-3b31e9a39d05+incompatible
|
||||||
github.com/mattermost/gorp
|
github.com/mattermost/gorp
|
||||||
# github.com/mattermost/ldap v3.0.4+incompatible
|
# github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d
|
||||||
github.com/mattermost/ldap
|
github.com/mattermost/ldap
|
||||||
# github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
# github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0
|
||||||
github.com/mattermost/rsc/gf256
|
github.com/mattermost/rsc/gf256
|
||||||
@@ -354,8 +356,6 @@ google.golang.org/grpc/status
|
|||||||
google.golang.org/grpc/tap
|
google.golang.org/grpc/tap
|
||||||
# gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
|
# gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
|
||||||
gopkg.in/alexcesaro/quotedprintable.v3
|
gopkg.in/alexcesaro/quotedprintable.v3
|
||||||
# gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d
|
|
||||||
gopkg.in/asn1-ber.v1
|
|
||||||
# gopkg.in/ini.v1 v1.48.0
|
# gopkg.in/ini.v1 v1.48.0
|
||||||
gopkg.in/ini.v1
|
gopkg.in/ini.v1
|
||||||
# gopkg.in/mail.v2 v2.3.1
|
# gopkg.in/mail.v2 v2.3.1
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user