Skip to content

Commit

Permalink
Merge branch 'master' into feat/extend_request
Browse files Browse the repository at this point in the history
  • Loading branch information
cpuschma authored Oct 11, 2024
2 parents b6483ea + 25c2d48 commit d0a241d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version: '1.23'
cache: false
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true
11 changes: 6 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
strategy:
matrix:
go: [
'1.23',
'1.22',
'1.21',
'1.20',
Expand All @@ -24,10 +25,10 @@ jobs:
name: Go ${{ matrix.go }}.x PR Validate ${{ matrix.branch }} (Modules)
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

Expand All @@ -46,9 +47,9 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: v1.50.0
version: latest
only-new-issues: true
5 changes: 3 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,10 @@ func (l *Conn) processMessages() {
l.messageContexts[message.MessageID] = message.Context

// Add timeout if defined
if l.getTimeout() > 0 {
requestTimeout := l.getTimeout()
if requestTimeout > 0 {
go func() {
timer := time.NewTimer(time.Duration(l.getTimeout()))
timer := time.NewTimer(time.Duration(requestTimeout))
defer func() {
if err := recover(); err != nil {
l.err = fmt.Errorf("ldap: recovered panic in RequestTimeout: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func GetLDAPError(packet *ber.Packet) error {
return &Error{
ResultCode: resultCode,
MatchedDN: response.Children[1].Value.(string),
Err: fmt.Errorf("%s", response.Children[2].Value.(string)),
Err: fmt.Errorf("%v", response.Children[2].Value),
Packet: packet,
}
}
Expand Down
6 changes: 5 additions & 1 deletion search.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,13 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
return result, ErrSizeLimitExceeded
}

attr := make([]*ber.Packet, 0)
if len(packet.Children[1].Children) > 1 {
attr = packet.Children[1].Children[1].Children
}
entry := &Entry{
DN: packet.Children[1].Children[0].Value.(string),
Attributes: unpackAttributes(packet.Children[1].Children[1].Children),
Attributes: unpackAttributes(attr),
}
result.Entries = append(result.Entries, entry)
case 5:
Expand Down
2 changes: 1 addition & 1 deletion v3/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func GetLDAPError(packet *ber.Packet) error {
return &Error{
ResultCode: resultCode,
MatchedDN: response.Children[1].Value.(string),
Err: fmt.Errorf("%s", response.Children[2].Value.(string)),
Err: fmt.Errorf("%v", response.Children[2].Value),
Packet: packet,
}
}
Expand Down
6 changes: 5 additions & 1 deletion v3/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,13 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error) {
return result, ErrSizeLimitExceeded
}

attr := make([]*ber.Packet, 0)
if len(packet.Children[1].Children) > 1 {
attr = packet.Children[1].Children[1].Children
}
entry := &Entry{
DN: packet.Children[1].Children[0].Value.(string),
Attributes: unpackAttributes(packet.Children[1].Children[1].Children),
Attributes: unpackAttributes(attr),
}
result.Entries = append(result.Entries, entry)
case 5:
Expand Down

0 comments on commit d0a241d

Please sign in to comment.