dbusmodule

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dbusmodule includes the tool for DBus PAM module interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransaction

func NewTransaction(ctx context.Context, address string, o ...TransactionOptions) (tx pam.ModuleTransaction, cleanup func(), err error)

NewTransaction creates a new dbusmodule.Transaction with the provided connection. A pam.ModuleTransaction implementation is returned together with a cleanup function that should be called to release the connection.

func WithSharedConnection

func WithSharedConnection(isShared bool) func(o *options)

WithSharedConnection indicates that we're using a shared dbus connection.

Types

type StringResponse

type StringResponse struct {
	ConvStyle pam.Style
	Content   string
}

StringResponse is a simple implementation of pam.StringConvResponse.

func (StringResponse) Response

func (s StringResponse) Response() string

Response returns the string response of the StringResponse.

func (StringResponse) Style

func (s StringResponse) Style() pam.Style

Style returns the conversation style of the StringResponse.

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction is a pam.Transaction with dbus support.

func (*Transaction) BusObject added in v0.5.0

func (tx *Transaction) BusObject() dbus.BusObject

BusObject gets the DBus object.

func (*Transaction) GetData

func (tx *Transaction) GetData(key string) (any, error)

GetData allows to get any value from the module data saved using SetData that is preserved across the whole time the module is loaded.

func (*Transaction) GetEnv

func (tx *Transaction) GetEnv(name string) string

GetEnv is used to retrieve a PAM environment variable.

func (*Transaction) GetEnvList

func (tx *Transaction) GetEnvList() (map[string]string, error)

GetEnvList returns a copy of the PAM environment as a map.

func (*Transaction) GetItem

func (tx *Transaction) GetItem(item pam.Item) (string, error)

GetItem retrieves a PAM item.

func (*Transaction) GetUser

func (tx *Transaction) GetUser(prompt string) (string, error)

GetUser is similar to GetItem(User), but it would start a conversation if no user is currently set in PAM.

func (*Transaction) InvokeHandler

func (tx *Transaction) InvokeHandler(handler pam.ModuleHandlerFunc,
	flags pam.Flags, args []string) error

InvokeHandler is called by the C code to invoke the proper handler.

func (*Transaction) PutEnv

func (tx *Transaction) PutEnv(nameVal string) error

PutEnv adds or changes the value of PAM environment variables.

NAME=value will set a variable to a value. NAME= will set a variable to an empty value. NAME (without an "=") will delete a variable.

func (*Transaction) SetData

func (tx *Transaction) SetData(key string, data any) error

SetData allows to save any value in the module data that is preserved during the whole time the module is loaded.

func (*Transaction) SetItem

func (tx *Transaction) SetItem(item pam.Item, value string) error

SetItem sets a PAM item.

func (*Transaction) StartBinaryConv

func (tx *Transaction) StartBinaryConv(bytes []byte) (
	pam.BinaryConvResponse, error)

StartBinaryConv starts a binary conversation using the provided bytes.

func (*Transaction) StartConv

func (tx *Transaction) StartConv(req pam.ConvRequest) (
	pam.ConvResponse, error)

StartConv initiates a PAM conversation using the provided ConvRequest.

func (*Transaction) StartConvMulti

func (tx *Transaction) StartConvMulti(requests []pam.ConvRequest) (
	responses []pam.ConvResponse, err error)

StartConvMulti initiates a PAM conversation with multiple ConvRequest's.

func (*Transaction) StartStringConv

func (tx *Transaction) StartStringConv(style pam.Style, prompt string) (
	pam.StringConvResponse, error)

StartStringConv starts a text-based conversation using the provided style and prompt.

func (*Transaction) StartStringConvf

func (tx *Transaction) StartStringConvf(style pam.Style, format string, args ...interface{}) (
	pam.StringConvResponse, error)

StartStringConvf allows to start string conversation with formatting support.

type TransactionOptions

type TransactionOptions func(*options)

TransactionOptions is the function signature used to tweak the transaction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL