@@ -434,9 +434,6 @@ func (c *Client) init(o *Options) error {
434
434
case slices .Contains (f .Mechanisms .Mechanism ,
435
435
"PLAIN" ) && tlsConnOK :
436
436
mechanism = "PLAIN"
437
- case slices .Contains (f .Mechanisms .Mechanism ,
438
- "DIGEST-MD5" ):
439
- mechanism = "DIGEST-MD5"
440
437
}
441
438
if strings .HasPrefix (mechanism , "SCRAM-SHA" ) {
442
439
if strings .HasSuffix (mechanism , "PLUS" ) {
@@ -641,50 +638,6 @@ func (c *Client) init(o *Options) error {
641
638
base64 .StdEncoding .Encode (enc , []byte (raw ))
642
639
fmt .Fprintf (c .conn , "<auth xmlns='%s' mechanism='PLAIN'>%s</auth>\n " , nsSASL , enc )
643
640
}
644
- if mechanism == "DIGEST-MD5" {
645
- // Digest-MD5 authentication
646
- fmt .Fprintf (c .stanzaWriter , "<auth xmlns='%s' mechanism='DIGEST-MD5'/>\n " , nsSASL )
647
- var ch saslChallenge
648
- if err = c .p .DecodeElement (& ch , nil ); err != nil {
649
- return errors .New ("unmarshal <challenge>: " + err .Error ())
650
- }
651
- b , err := base64 .StdEncoding .DecodeString (string (ch ))
652
- if err != nil {
653
- return err
654
- }
655
- tokens := map [string ]string {}
656
- for _ , token := range strings .Split (string (b ), "," ) {
657
- kv := strings .SplitN (strings .TrimSpace (token ), "=" , 2 )
658
- if len (kv ) == 2 {
659
- if kv [1 ][0 ] == '"' && kv [1 ][len (kv [1 ])- 1 ] == '"' {
660
- kv [1 ] = kv [1 ][1 : len (kv [1 ])- 1 ]
661
- }
662
- tokens [kv [0 ]] = kv [1 ]
663
- }
664
- }
665
- realm , _ := tokens ["realm" ]
666
- nonce , _ := tokens ["nonce" ]
667
- qop , _ := tokens ["qop" ]
668
- charset , _ := tokens ["charset" ]
669
- cnonceStr := cnonce ()
670
- digestURI := "xmpp/" + domain
671
- nonceCount := fmt .Sprintf ("%08x" , 1 )
672
- digest := saslDigestResponse (user , realm , o .Password , nonce , cnonceStr , "AUTHENTICATE" , digestURI , nonceCount )
673
- message := "username=\" " + user + "\" , realm=\" " + realm + "\" , nonce=\" " + nonce + "\" , cnonce=\" " + cnonceStr +
674
- "\" , nc=" + nonceCount + ", qop=" + qop + ", digest-uri=\" " + digestURI + "\" , response=" + digest + ", charset=" + charset
675
-
676
- fmt .Fprintf (c .stanzaWriter , "<response xmlns='%s'>%s</response>\n " , nsSASL , base64 .StdEncoding .EncodeToString ([]byte (message )))
677
-
678
- var rspauth saslRspAuth
679
- if err = c .p .DecodeElement (& rspauth , nil ); err != nil {
680
- return errors .New ("unmarshal <challenge>: " + err .Error ())
681
- }
682
- b , err = base64 .StdEncoding .DecodeString (string (rspauth ))
683
- if err != nil {
684
- return err
685
- }
686
- fmt .Fprintf (c .stanzaWriter , "<response xmlns='%s'/>\n " , nsSASL )
687
- }
688
641
}
689
642
if mechanism == "" {
690
643
return fmt .Errorf ("PLAIN authentication is not an option: %v" , f .Mechanisms .Mechanism )
0 commit comments