equal
deleted
inserted
replaced
11 "math/big" |
11 "math/big" |
12 "regexp" |
12 "regexp" |
13 "strings" |
13 "strings" |
14 ) |
14 ) |
15 |
15 |
|
16 // Server is advertising auth mechanisms it supports. Choose one and |
|
17 // respond. |
16 // BUG(cjyar): Doesn't implement TLS/SASL EXTERNAL. |
18 // BUG(cjyar): Doesn't implement TLS/SASL EXTERNAL. |
17 func (cl *Client) chooseSasl(fe *Features) { |
19 func (cl *Client) chooseSasl(fe *Features) { |
18 var digestMd5 bool |
20 var digestMd5 bool |
19 for _, m := range fe.Mechanisms.Mechanism { |
21 for _, m := range fe.Mechanisms.Mechanism { |
20 switch strings.ToLower(m) { |
22 switch strings.ToLower(m) { |
28 Mechanism: "DIGEST-MD5"} |
30 Mechanism: "DIGEST-MD5"} |
29 cl.sendXml <- auth |
31 cl.sendXml <- auth |
30 } |
32 } |
31 } |
33 } |
32 |
34 |
|
35 // Server is responding to our auth request. |
33 func (cl *Client) handleSasl(srv *auth) { |
36 func (cl *Client) handleSasl(srv *auth) { |
34 switch strings.ToLower(srv.XMLName.Local) { |
37 switch strings.ToLower(srv.XMLName.Local) { |
35 case "challenge": |
38 case "challenge": |
36 b64 := base64.StdEncoding |
39 b64 := base64.StdEncoding |
37 str, err := b64.DecodeString(srv.Chardata) |
40 str, err := b64.DecodeString(srv.Chardata) |