Documentation
¶
Overview ¶
Package nss contains the gateway to query system Name Switch Service databases.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultService = New(sys.DefaultExecutor)
DefaultService is the NSS gateway that interacts with the system using the default command execution process in sys.DefaultExecutor.
Functions ¶
func GetCurrentUser ¶
CurrentUser is an implementation of user.Current() since it's not implemented in some Linux distributions.
func GetIDsForUser ¶
GetIDsForUser searches the system for the given user name and returns the user ID and the primary group ID of that user.
Types ¶
type Database ¶
type Database string
Database represents NSS entry databases such as passwd, group, hosts, etc.
type GroupEntry ¶
GroupEntry is the representation of Name Switch Service 'group' database entry fields.
func GetGroupEntry ¶
func GetGroupEntry(s Service, groupKey string) (*GroupEntry, error)
GetGroup queries the Name Switch Service 'group' Database for a given group key. Group key is usually the name of that group. It returns the parsed group entry.
type GroupShadowEntry ¶
type GroupShadowEntry struct { GroupName string PasswordHash string Admins []string Members []string }
GroupShadowEntry is the representation of Name Switch Service 'gshadow' database entry fields.
func GetGroupShadowEntry ¶
func GetGroupShadowEntry(s Service, groupKey string) (*GroupShadowEntry, error)
GetGroup queries the Name Switch Service 'gshadow' Database. It returns the parsed 'gshadow' entry belonging to given group key.
type MockService ¶
func NewMockService ¶
func NewMockService() *MockService
func (*MockService) GetEntryFrom ¶
func (ms *MockService) GetEntryFrom(db Database, key string) (string, error)
type PasswdEntry ¶
type PasswdEntry struct { UserName string UID int GID int GECOS string HomeDir string DefaultShell string IsSystemAccount bool }
PasswdEntry is the representation of Name Switch Service 'passwd' database entry fields.
func GetPasswdEntry ¶
func GetPasswdEntry(s Service, key string) (*PasswdEntry, error)
type Server ¶
Server is an NSS Service implementation It takes a sys.Executor to execute nss query commands.
type ShadowEntry ¶
type ShadowEntry struct { UserName string PasswordHash string ChangedAgo string ChangedBefore string ExpiryPeriod string DisabledSince string }
ShadowEntry is the representation of Name Switch Service 'shadow' database entry fields.
func GetShadowEntry ¶
func GetShadowEntry(s Service, key string) (*ShadowEntry, error)
ShadowEntry queries the NSS User Shadow Database.