handlers

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakerootExecHandler

func FakerootExecHandler(killTimeout time.Duration) interp.ExecHandlerFunc

FakerootExecHandler was extracted from github.com/mvdan/sh/interp/handler.go and modified to run commands in a fakeroot environent.

func InsufficientArgsError

func InsufficientArgsError(cmd string, exp, got int) error

func NopExec

func NopExec(context.Context, []string) error

func NopReadDir

func NopReadDir(context.Context, string) ([]fs.DirEntry, error)

func NopStat

func NopStat(context.Context, string, bool) (os.FileInfo, error)

func RestrictedExec

func RestrictedExec(allowedCmds ...string) interp.ExecHandlerFunc

func RestrictedOpen

func RestrictedOpen(allowedPrefixes ...string) interp.OpenHandlerFunc

func RestrictedReadDir

func RestrictedReadDir(allowedPrefixes ...string) interp.ReadDirHandlerFunc2

func RestrictedStat

func RestrictedStat(allowedPrefixes ...string) interp.StatHandlerFunc

Types

type ExecFunc

type ExecFunc func(hc interp.HandlerContext, name string, args []string) error

type ExecFuncs

type ExecFuncs map[string]ExecFunc

func (ExecFuncs) ExecHandler

func (ef ExecFuncs) ExecHandler(fallback interp.ExecHandlerFunc) interp.ExecHandlerFunc

ExecHandler returns a new ExecHandlerFunc that falls back to fallback if the command cannot be found in the map. If fallback is nil, the default handler is used.

type NopRWC

type NopRWC struct{}

func (NopRWC) Close

func (NopRWC) Close() error

func (NopRWC) Read

func (NopRWC) Read([]byte) (int, error)

func (NopRWC) Write

func (NopRWC) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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