comparison managesieve.go @ 12:66b46b3d73be default tip

Handle capabilities sent by the server after negotiating a SASL security layer
author Guido Berhoerster <guido+managesieve@berhoerster.name>
date Tue, 09 Feb 2021 23:01:02 +0100
parents b790df0733d4
children
comparison
equal deleted inserted replaced
11:b790df0733d4 12:66b46b3d73be
393 if _, err = a.Next(msg, false); err != nil { 393 if _, err = a.Next(msg, false); err != nil {
394 return AuthenticationError(err.Error()) 394 return AuthenticationError(err.Error())
395 } 395 }
396 } 396 }
397 397
398 // capabilities are no longer valid after succesful authentication 398 if a.SASLSecurityLayer() {
399 r, err = c.cmd("CAPABILITY") 399 // server sends capabilities response
400 if err != nil { 400 r, err := c.p.readReply()
401 return err 401 if err != nil {
402 return err
403 }
404 if r.resp == responseNo {
405 return &ServerError{r.code, r.msg}
406 } else if r.resp == responseBye {
407 return &ConnClosedError{r.code, r.msg}
408 }
409 } else {
410 // capabilities are no longer valid after succesful
411 // authentication
412 r, err = c.cmd("CAPABILITY")
413 if err != nil {
414 return err
415 }
402 } 416 }
403 c.capa, err = parseCapabilities(r) 417 c.capa, err = parseCapabilities(r)
404 return err 418 return err
405 } 419 }
406 420