From 9e3d51ddbbad860892faf7c68bd7fcbe74079009 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 09:51:06 +0000 Subject: [PATCH] Stop reading [modemmenu], the old name of [dmodem-login] A file with [modemmenu] now gets the unknown-section error. The setup screens and the catalog know only [dmodem-login], and the wiki says to rename the section. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01B82eRTD8BSptdpaUWGcs65 --- bbs.conf.sample | 2 +- docs/wiki/Configuration-Reference.md | 2 +- docs/wiki/Modem-Callers.md | 4 ++-- internal/confedit/catalog.go | 7 ------- internal/confui/fields.go | 6 ++---- internal/confui/menus.go | 11 +---------- internal/server/config.go | 16 ++++------------ internal/server/loginconfig_test.go | 26 ++++++++++---------------- 8 files changed, 21 insertions(+), 53 deletions(-) diff --git a/bbs.conf.sample b/bbs.conf.sample index 5998e3a..e46a849 100644 --- a/bbs.conf.sample +++ b/bbs.conf.sample @@ -372,7 +372,7 @@ address = 127.0.0.1:2513 ; dmodem-login's auth socket ([authd] there): the accounts dmodem-login logs in ; (no password here) log in by telnet, SSH, the web ... with their ; dmodem-login password, asked of dmodem-login's backends. See -; docs/wiki/Modem-Callers.md. [modemmenu], its old name, is read too +; docs/wiki/Modem-Callers.md. ;[dmodem-login] ;auth_socket = /run/dmodem-login/auth.sock ; a user dmodem-login knows and the BBS does not gets an account at their diff --git a/docs/wiki/Configuration-Reference.md b/docs/wiki/Configuration-Reference.md index d66ef3d..b1a91bd 100644 --- a/docs/wiki/Configuration-Reference.md +++ b/docs/wiki/Configuration-Reference.md @@ -220,7 +220,7 @@ There may be any number of these, each with its own NAME. ## `[dmodem-login]` -dmodem-login's auth socket ([authd] there): the accounts dmodem-login logs in (no password here) log in by telnet, SSH, the web ... with their dmodem-login password, asked of dmodem-login's backends. See docs/wiki/Modem-Callers.md. [modemmenu], its old name, is read too. +dmodem-login's auth socket ([authd] there): the accounts dmodem-login logs in (no password here) log in by telnet, SSH, the web ... with their dmodem-login password, asked of dmodem-login's backends. See docs/wiki/Modem-Callers.md. | key | default | live | what it does | |---|---|---|---| diff --git a/docs/wiki/Modem-Callers.md b/docs/wiki/Modem-Callers.md index 28c4973..84bd06a 100644 --- a/docs/wiki/Modem-Callers.md +++ b/docs/wiki/Modem-Callers.md @@ -133,8 +133,8 @@ auth_socket = /run/dmodem-login/auth.sock | `timeout` | `15` | seconds for the answer of dmodem-login (the answer for an incorrect password comes after its `fail_delay`) | The old name of dmodem-login is modemmenu, and the old name of this -section is `[modemmenu]`. The BBS still reads `[modemmenu]`. Do not use -`[modemmenu]` and `[dmodem-login]` in the same file. +section is `[modemmenu]`. The BBS does not read `[modemmenu]`. If your +file has `[modemmenu]`, change its name to `[dmodem-login]`. The BBS asks dmodem-login only about accounts that dmodem-login created (external accounts with no BBS password). An account with its own BBS diff --git a/internal/confedit/catalog.go b/internal/confedit/catalog.go index 266a52d..1f32339 100644 --- a/internal/confedit/catalog.go +++ b/internal/confedit/catalog.go @@ -331,16 +331,9 @@ func (k *Kind) free(key string) bool { // Kind is a kind of section (nil: none such). func (c *Catalog) Kind(name string) *Kind { - if alias, ok := oldKinds[name]; ok { - name = alias - } return c.byName[name] } -// oldKinds are the old names of kinds of sections, still read: the -// catalog gives the current kind's keys and help for them -var oldKinds = map[string]string{"modemmenu": "dmodem-login"} - // Key is a key of a kind of section: one of the sample's, or one of the // sysop's own (a menu's item); nil if it is neither. func (c *Catalog) Key(kind, key string) *Key { diff --git a/internal/confui/fields.go b/internal/confui/fields.go index 8b861a2..829954f 100644 --- a/internal/confui/fields.go +++ b/internal/confui/fields.go @@ -91,10 +91,8 @@ var labels = map[string]string{ "chan.dir": "Image boards' files", "fido.dir": "FidoNet's packets", "general.user": "Run as user", "general.group": "and group", "dmodem-login.auth_socket": "dmodem-login's auth socket", "dmodem-login.create_users": "Make accounts it knows", - "dmodem-login.timeout": "Its answer within (s)", - "modemmenu.auth_socket": "dmodem-login's auth socket", "modemmenu.create_users": "Make accounts it knows", - "modemmenu.timeout": "Its answer within (s)", - "backup.dir": "Backup directory", "backup.at": "Daily at (HH:MM)", "backup.keep": "Backups kept", + "dmodem-login.timeout": "Its answer within (s)", + "backup.dir": "Backup directory", "backup.at": "Daily at (HH:MM)", "backup.keep": "Backups kept", "backup.files": "With the files", } diff --git a/internal/confui/menus.go b/internal/confui/menus.go index 1b2c978..c814d55 100644 --- a/internal/confui/menus.go +++ b/internal/confui/menus.go @@ -311,7 +311,7 @@ func (e *Editor) connectionsMenu() page { out = append(out, heading("Line speeds (telnet, SSH and web callers)")) out = append(out, e.fields(g, "line_speeds", "line_speed", "line_speed_ask")...) out = append(out, heading("Passwords by dmodem-login (its auth socket)")) - out = append(out, e.fields(e.loginSec(), "auth_socket", "create_users", "timeout")...) + out = append(out, e.fields(sec("dmodem-login"), "auth_socket", "create_users", "timeout")...) out = append(out, heading("Caller ID and where callers are")) out = append(out, e.fields(g, "phone_country", "geoip", "geoip_credit", "geoip_credit_url", "geoip_users", "geoip_prefill")...) @@ -628,12 +628,3 @@ func (e *Editor) fidoPage() page { return out }} } - -// loginSec is [dmodem-login], or [modemmenu] (its old name) in a file -// that has only that one, so that the setup edits the section in use. -func (e *Editor) loginSec() confedit.Section { - if old := sec("modemmenu"); e.doc.Has(old) && !e.doc.Has(sec("dmodem-login")) { - return old - } - return sec("dmodem-login") -} diff --git a/internal/server/config.go b/internal/server/config.go index 6928fe3..fb3979b 100644 --- a/internal/server/config.go +++ b/internal/server/config.go @@ -228,16 +228,8 @@ func load(cf *config.File) (*Config, error) { if err := c.backupSection(cf.Get("backup", "")); err != nil { return nil, fmt.Errorf("[backup] %w", err) } - // [modemmenu]: the old name of [dmodem-login], still read - login, loginName := cf.Get("dmodem-login", ""), "dmodem-login" - if old := cf.Get("modemmenu", ""); old != nil { - if login != nil { - return nil, fmt.Errorf("[modemmenu] and [dmodem-login]: one only ([modemmenu] is the old name)") - } - login, loginName = old, "modemmenu" - } - if err := c.loginSection(login); err != nil { - return nil, fmt.Errorf("[%s] %w", loginName, err) + if err := c.loginSection(cf.Get("dmodem-login", "")); err != nil { + return nil, fmt.Errorf("[dmodem-login] %w", err) } for _, sec := range cf.All("event") { e, err := c.event(sec) @@ -282,7 +274,7 @@ func load(cf *config.File) (*Config, error) { } for _, s := range cf.Sections { switch s.Kind { - case "general", "security", "acme", "backup", "dmodem-login", "modemmenu", "event", "listen", "ftp", "news", "nntp", "peer", "qwknet", "fido", "binkp", "link", "door", "finger", "gopher", "gemini", "time", "ntp", "nts", "ptp", "dns", "dnsrecord", "irc", "oscar", "aol", "msn", "marvel", "ymsg", "mrc", "irclink", "ircpeer", "menu", "strings", "http", "level", "chan", + case "general", "security", "acme", "backup", "dmodem-login", "event", "listen", "ftp", "news", "nntp", "peer", "qwknet", "fido", "binkp", "link", "door", "finger", "gopher", "gemini", "time", "ntp", "nts", "ptp", "dns", "dnsrecord", "irc", "oscar", "aol", "msn", "marvel", "ymsg", "mrc", "irclink", "ircpeer", "menu", "strings", "http", "level", "chan", "feeds", "feed", "weather", "quotes", "mail", "smarthost", "pop3", "imap", "smtp", "mx", "lmtp": default: @@ -472,7 +464,7 @@ type MenuAuth struct { Timeout time.Duration // for its answer } -// loginSection reads [dmodem-login] (or [modemmenu], its old name). +// loginSection reads [dmodem-login]. func (c *Config) loginSection(sec *config.Section) error { if sec == nil { return nil diff --git a/internal/server/loginconfig_test.go b/internal/server/loginconfig_test.go index b346fd3..35b4faf 100644 --- a/internal/server/loginconfig_test.go +++ b/internal/server/loginconfig_test.go @@ -5,25 +5,19 @@ import ( "testing" ) -// TestLoginSection: [dmodem-login], and [modemmenu], its old name, read -// the same; both at once is an error. +// TestLoginSection: [dmodem-login] is read; [modemmenu], its old name, +// is an unknown section. func TestLoginSection(t *testing.T) { const listen = "[listen telnet]\ntype = telnet\naddress = :2300\n" - for _, name := range []string{"dmodem-login", "modemmenu"} { - c, err := Parse([]byte(listen + "[" + name + "]\nauth_socket = /run/dmodem-login/auth.sock\ntimeout = 5\n")) - if err != nil { - t.Fatalf("[%s]: %v", name, err) - } - if c.MenuAuth == nil || c.MenuAuth.Socket != "/run/dmodem-login/auth.sock" || c.MenuAuth.Timeout.Seconds() != 5 { - t.Errorf("[%s]: %+v", name, c.MenuAuth) - } + c, err := Parse([]byte(listen + "[dmodem-login]\nauth_socket = /run/dmodem-login/auth.sock\ntimeout = 5\n")) + if err != nil { + t.Fatal(err) } - _, err := Parse([]byte(listen + "[modemmenu]\nauth_socket = /a\n[dmodem-login]\nauth_socket = /b\n")) - if err == nil || !strings.Contains(err.Error(), "one only") { - t.Errorf("both: %v", err) + if c.MenuAuth == nil || c.MenuAuth.Socket != "/run/dmodem-login/auth.sock" || c.MenuAuth.Timeout.Seconds() != 5 { + t.Errorf("%+v", c.MenuAuth) } - _, err = Parse([]byte(listen + "[modemmenu]\nauth_socket = relative\n")) - if err == nil || !strings.Contains(err.Error(), "[modemmenu]") { - t.Errorf("an error in the old section names it: %v", err) + _, err = Parse([]byte(listen + "[modemmenu]\nauth_socket = /run/dmodem-login/auth.sock\n")) + if err == nil || !strings.Contains(err.Error(), "unknown section [modemmenu]") { + t.Errorf("[modemmenu]: %v", err) } }