Changeset 730 in code
- Timestamp:
- Dec 1, 2021, 10:03:27 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/soju.1.scd
r728 r730 345 345 currently used with the network. 346 346 347 *sasl status* <network name> 348 Show current SASL status. 349 347 350 *sasl set-plain* <network name> <username> <password> 348 351 Set SASL PLAIN credentials. -
trunk/service.go
r710 r730 242 242 "sasl": { 243 243 children: serviceCommandSet{ 244 "status": { 245 usage: "<network name>", 246 desc: "show SASL status", 247 handle: handleServiceSaslStatus, 248 }, 244 249 "set-plain": { 245 250 usage: "<network name> <username> <password>", … … 685 690 } 686 691 692 func handleServiceSaslStatus(ctx context.Context, dc *downstreamConn, params []string) error { 693 if len(params) != 1 { 694 return fmt.Errorf("expected exactly one argument") 695 } 696 697 net := dc.user.getNetwork(params[0]) 698 if net == nil { 699 return fmt.Errorf("unknown network %q", params[0]) 700 } 701 702 switch net.SASL.Mechanism { 703 case "PLAIN": 704 sendServicePRIVMSG(dc, fmt.Sprintf("SASL PLAIN enabled with username %q", net.SASL.Plain.Username)) 705 case "EXTERNAL": 706 sendServicePRIVMSG(dc, "SASL EXTERNAL (CertFP) enabled") 707 case "": 708 sendServicePRIVMSG(dc, "SASL is disabled") 709 } 710 711 if uc := net.conn; uc != nil { 712 if uc.account != "" { 713 sendServicePRIVMSG(dc, fmt.Sprintf("Authenticated on upstream network with account %q", uc.account)) 714 } else { 715 sendServicePRIVMSG(dc, "Unauthenticated on upstream network") 716 } 717 } else { 718 sendServicePRIVMSG(dc, "Disconnected from upstream network") 719 } 720 721 return nil 722 } 723 687 724 func handleServiceSASLSetPlain(ctx context.Context, dc *downstreamConn, params []string) error { 688 725 if len(params) != 3 {
Note:
See TracChangeset
for help on using the changeset viewer.