shadow

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: GPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

shadow package implements utilities for parsing and using shadow password database on Unix systems.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchUser    = errors.New("shadow: user entry is not present in database")
	ErrWrongPassword = errors.New("shadow: wrong password")
)

Functions

func New

func New(c *container.C, modName, instName string) (module.Module, error)

Types

type Auth

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

func (*Auth) AuthPlain added in v0.2.0

func (a *Auth) AuthPlain(username, password string) error

func (*Auth) Configure added in v0.9.0

func (a *Auth) Configure(inlineArgs []string, cfg *config.Map) error

func (*Auth) InstanceName

func (a *Auth) InstanceName() string

func (*Auth) Lookup added in v0.3.0

func (a *Auth) Lookup(username string) (string, bool, error)

func (*Auth) Name

func (a *Auth) Name() string

type Entry

type Entry struct {
	// User login name.
	Name string

	// Hashed user password.
	Pass string

	// Days since Jan 1, 1970 password was last changed.
	LastChange int

	// The number of days the user will have to wait before she will be allowed to
	// change her password again.
	//
	// -1 if password aging is disabled.
	MinPassAge int

	// The number of days after which the user will have to change her password.
	//
	// -1 is password aging is disabled.
	MaxPassAge int

	// The number of days before a password is going to expire (see the maximum
	// password age above) during which the user should be warned.
	//
	// -1 is password aging is disabled.
	WarnPeriod int

	// The number of days after a password has expired (see the maximum
	// password age above) during which the password should still be accepted.
	//
	// -1 is password aging is disabled.
	InactivityPeriod int

	// The date of expiration of the account, expressed as the number of days
	// since Jan 1, 1970.
	//
	// -1 is account never expires.
	AcctExpiry int

	// Unused now.
	Flags int
}

func Lookup

func Lookup(name string) (*Entry, error)

func Read

func Read() ([]Entry, error)

Read reads system shadow passwords database and returns all entires in it.

func (*Entry) IsAccountValid

func (e *Entry) IsAccountValid() bool

func (*Entry) IsPasswordValid

func (e *Entry) IsPasswordValid() bool

func (*Entry) VerifyPassword

func (e *Entry) VerifyPassword(pass string) (err error)

Jump to

Keyboard shortcuts

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