Files
bbs/internal/server/ymsgconfig.go
T
Claude b81f07e558 ymsg: Y!M 6 to 8's login, and file transfer
The challenge login of Yahoo! Messenger 6 to 8 (auth type 1) is served
for YMSG 10 to 15. The BBS writes each challenge so that the client's
search lands on depth 0, table 0: the transform then runs zero times and
the server needs none of Yahoo's tables. old_login = yes offers these
clients the Y!M 5 login instead.

Files go between Yahoo users through the web half: Y!M 7 and later by
the relay (FILETRANSFER_15 to _ACC_15, then /relay POST, HEAD and GET),
Y!M 5 and 6 by /notifyft, with a /ft/ link sent to the receiver. Files
are held in a temporary file until fetched, at most max_file_mb (16)
and an hour. Offers to users not on Yahoo are declined with a pointer
to the file areas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRfVskEUYFs9gMFCLD
2026-11-10 16:22:47 +00:00

73 lines
2.2 KiB
Go

package server
import (
"errors"
"fmt"
"net"
"strings"
"github.com/D-Modem/bbs/internal/certs"
"github.com/D-Modem/bbs/internal/config"
"github.com/D-Modem/bbs/internal/ymsg"
)
// ymsgSection reads [ymsg]: the Yahoo! Messenger server for the chat.
func (c *Config) ymsgSection(cf *config.File) error {
s := cf.Get("ymsg", "")
if s == nil {
return nil
}
err := func() error {
y := &ymsg.Settings{Address: s.String("address", ":5050"), HTTPAddress: s.String("http_address", ""),
HTTPSAddress: s.String("https_address", ""), CertFile: s.String("tls_cert", ""),
KeyFile: s.String("tls_key", ""), Host: s.String("host", ""), System: s.String("system", "bbs")}
for _, a := range []struct{ key, v string }{{"address", y.Address}, {"http_address", y.HTTPAddress},
{"https_address", y.HTTPSAddress}} {
if a.v == "" {
continue
}
if _, _, err := net.SplitHostPort(a.v); err != nil {
return fmt.Errorf("%s: %v", a.key, err)
}
}
if y.Address == "" {
return errors.New("address: where the pager listens (:5050)")
}
if y.HTTPSAddress != "" {
if y.CertFile == "" || y.KeyFile == "" && !certs.IsACME(y.CertFile) {
return errors.New("https_address needs tls_cert and tls_key (one for login.yahoo.com: not a name a CA will sign for this host)")
}
if err := certs.Check(y.CertFile, y.KeyFile, c.acmeNames()); err != nil {
return fmt.Errorf("tls_cert, tls_key: %v", err)
}
}
if y.Host != "" && strings.ContainsAny(y.Host, ":/ ") && net.ParseIP(y.Host) == nil {
return errors.New("host: the pager's IP address or host name, without a port")
}
if y.System == "" || len(y.System) > 32 || strings.ContainsAny(y.System, "@ ") {
return errors.New("system: a Yahoo ID of 1 to 32 letters and digits")
}
var err error
if y.MaxClients, err = s.Int("max_clients", 256, 1, 100000); err != nil {
return err
}
if y.MaxPerIP, err = s.Int("max_per_ip", 4, 0, 1000); err != nil {
return err
}
if y.OldLogin, err = s.Bool("old_login", false); err != nil {
return err
}
mb, err := s.Int("max_file_mb", 16, 0, 4096)
if err != nil {
return err
}
y.MaxFileSize = int64(mb) << 20
c.YMSG = y
return nil
}()
if err != nil {
return fmt.Errorf("[ymsg] %w", err)
}
return nil
}