Documentation
¶
Index ¶
- Constants
- Variables
- func Authenticate(conf *config, username, password string) (authHandle, error)
- func AuthenticatePAM(conf *config, username, password string) (*pamHandle, error)
- func EffectiveUsername(conf *config, username string) string
- func FinalizeDesktopSelection(auth authHandle, conf *config, ud *desktop, selected *desktop, ...) *desktop
- func FormatCommand(command string) string
- func InitLogger(conf *Config)
- func LastUserHint(conf *Config) string
- func LoadConfigPath(args []string) (configPath string)
- func MotdText(conf *config) string
- func ProcessArgs(args []string, conf *config)
- func ProcessCommand(command string, c *config, auth authHandle, continuable bool) error
- func ProcessCoreArgs(args []string)
- func RunLoginSession(conf *config, h *SessionHandle, auth authHandle, d *desktop) (cmd string, err error)
- func ShouldProcessCommand(input string, conf *config) bool
- func StartDaemon(conf *Config) *os.File
- func StopDaemon(conf *Config, fTTY *os.File)
- func TryAutoSelectDesktop(auth authHandle, conf *config, ud *desktop) (chosen *desktop, desktops []*desktop, lastIdx int, needUI bool)
- type AuthHandle
- type Config
- type DefaultLoginRetryPathProvider
- type Desktop
- type LoginRetryPathProvider
- type SessionHandle
- type Sysuser
Constants ¶
const ( // Do not preselect any last user False enSelectLastUser = iota // Preselect last successfully logged in user per tty PerTty // Preselect last successfully logged in user per system Global )
const ( // Never show selection SelectionFalse enSelection = iota // Always show selection SelectionTrue // Show selection only if necessary SelectionAuto )
const ( // Undefined represents no environment Undefined enEnvironment = iota // X11 represents Xorg/XLibre environment X11 // Wayland represents Wayland environment Wayland // Custom represents custom desktops, only helper before real env is loaded Custom // UserCustom represents user's desktops, only helper before real env is loaded UserCustom )
const ( // Rotate represents saving into new file and backing up older with suffix Rotate enLogging = iota + 1 // Appending represents saving all logs into same file Appending // Disabled represents disabled logging Disabled )
Variables ¶
var TEST_MODE bool
TEST_MODE Defines if logging is in test mode
Functions ¶
func Authenticate ¶
Authenticate validates credentials (PAM when built with PAM support).
func AuthenticatePAM ¶
AuthenticatePAM validates credentials via PAM. On success the handle is ready for openAuthSession / session start. If the username is a :command (and AllowCommands), no PAM transaction is opened; getCommand is set instead.
func EffectiveUsername ¶
EffectiveUsername applies DefaultUser and last-logged hint when input is empty.
func FinalizeDesktopSelection ¶
func FinalizeDesktopSelection(auth authHandle, conf *config, ud *desktop, selected *desktop, desktops []*desktop) *desktop
FinalizeDesktopSelection merges user config, selection, and last-session persistence.
func FormatCommand ¶
FormatCommand strips ANSI and leading ':' from a login-buffer command.
func InitLogger ¶
func InitLogger(conf *Config)
InitLogger configures process logging according to conf.
func LastUserHint ¶
LastUserHint returns the cached last login name (per SELECT_LAST_USER), if any.
func LoadConfigPath ¶
LoadConfigPath resolves config file path from argv.
func MotdText ¶
func MotdText(conf *config) string
MotdText returns MOTD content for TUI display without printing to the terminal.
func ProcessArgs ¶
func ProcessArgs(args []string, conf *config)
ProcessArgs applies CLI flags to an already-allocated config.
func ProcessCommand ¶
ProcessCommand runs power/session-wide commands (poweroff, reboot, suspend, help).
func ProcessCoreArgs ¶
func ProcessCoreArgs(args []string)
ProcessCoreArgs handles -h / -v before configuration is loaded.
func RunLoginSession ¶
func RunLoginSession(conf *config, h *SessionHandle, auth authHandle, d *desktop) (cmd string, err error)
RunLoginSession starts the graphical session after auth and desktop resolution.
Returns:
- cmd: a built-in :command extracted from the username field, if any
- err: a short, user-facing error describing why the chosen environment could not start or terminated abnormally; the caller is expected to display it and offer the user to pick another session
On any return path the auth handle is closed; the caller must re-authenticate (the UI keeps the entered username/password for that purpose).
func ShouldProcessCommand ¶
ShouldProcessCommand reports whether the input is a built-in :command.
func StartDaemon ¶
StartDaemon switches stdin/stdout/stderr to the configured TTY when in daemon mode.
func StopDaemon ¶
StopDaemon restores the terminal after daemon mode.
func TryAutoSelectDesktop ¶
func TryAutoSelectDesktop(auth authHandle, conf *config, ud *desktop) (chosen *desktop, desktops []*desktop, lastIdx int, needUI bool)
TryAutoSelectDesktop returns a desktop without UI when autologin/default/single-session rules apply.
Types ¶
type Config ¶
type Config = config
Config is the display manager configuration (loaded from /etc/adm/conf by default).
func LoadConfig ¶
LoadConfig loads configuration from a properties file (empty path skips the file).
type DefaultLoginRetryPathProvider ¶
type DefaultLoginRetryPathProvider struct {
}
type Desktop ¶
type Desktop = desktop
Desktop describes a display session (.desktop entry).
func LoadUserConfig ¶
LoadUserConfig reads ~/.config/adm or ~/.adm and optional LANG for the user.
type LoginRetryPathProvider ¶
type LoginRetryPathProvider interface {
// contains filtered or unexported methods
}
type SessionHandle ¶
type SessionHandle struct {
// contains filtered or unexported fields
}
SessionHandle groups an active GUI session with auth for signal handling.
func InitSessionHandle ¶
func InitSessionHandle() *SessionHandle
InitSessionHandle registers interrupt handling for the current login/session lifecycle.