summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Marc <hi@colinmarc.com>2022-02-05 16:00:00 +0100
committerColin Marc <hi@colinmarc.com>2022-02-05 16:00:00 +0100
commit17d7dc39446a18e58af3b282ded74c2549263fa2 (patch)
tree38ae5c2ee7c8b43ca331ed216b89036dad77a97a
parentb27ccb5a7819066d704bb381ba74d81a9ca6d426 (diff)
Add a comment explaining why we sort the Qops
-rw-r--r--internal/rpc/kerberos.go5
-rw-r--r--internal/sasl/challenge.go2
-rw-r--r--internal/transfer/block_write_stream.go2
3 files changed, 6 insertions, 3 deletions
diff --git a/internal/rpc/kerberos.go b/internal/rpc/kerberos.go
index d505536..c34ce8c 100644
--- a/internal/rpc/kerberos.go
+++ b/internal/rpc/kerberos.go
@@ -5,6 +5,7 @@ import (
"fmt"
"net"
"regexp"
+ "sort"
hadoop "github.com/colinmarc/hdfs/v2/internal/protocol/hadoop_common"
"github.com/colinmarc/hdfs/v2/internal/sasl"
@@ -62,7 +63,11 @@ func (c *NamenodeConnection) doKerberosHandshake() error {
return err
}
+ // Some versions of HDP 3.x expect us to pick the highest Qop, and
+ // return a malformed response otherwise.
+ sort.Sort(challenge.Qop)
qop := challenge.Qop[0]
+
switch qop {
case sasl.QopPrivacy, sasl.QopIntegrity:
// Switch to SASL RPC handler
diff --git a/internal/sasl/challenge.go b/internal/sasl/challenge.go
index cc3f1d4..9e73fa6 100644
--- a/internal/sasl/challenge.go
+++ b/internal/sasl/challenge.go
@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"regexp"
- "sort"
"strings"
)
@@ -74,7 +73,6 @@ func ParseChallenge(challenge []byte) (*Challenge, error) {
ch.Nonce = val
case "qop":
ch.Qop = strings.Split(val, ",")
- sort.Sort(ch.Qop)
case "charset":
ch.Charset = val
case "cipher":
diff --git a/internal/transfer/block_write_stream.go b/internal/transfer/block_write_stream.go
index f657dde..0fa2ba8 100644
--- a/internal/transfer/block_write_stream.go
+++ b/internal/transfer/block_write_stream.go
@@ -290,7 +290,7 @@ Acks:
// Once we've seen an error, just keep reading packets off the channel (but
// not off the socket) until the writing thread figures it out. If we don't,
// the upstream thread could deadlock waiting for the channel to have space.
- for _ = range s.packets {
+ for range s.packets {
}
}