限制管理员重置为显式启动并隔离终端输入
This commit is contained in:
1 parent
0df6e0ee66
commit
f7325210ff
12 files changed
+646
-18
No files matched your search
@@ -0,0 +1,27 @@
|
||||
//go:build !linux
|
||||
|
||||
package adminreset
|
||||
|
||||
import "context"
|
||||
|
||||
// OpenInvocation 保留其他平台原有的本机管理员身份校验。
|
||||
func OpenInvocation(parent context.Context) (context.Context, func(), error) {
|
||||
if err := AuthorizeCurrentProcess(); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
ctx, cancel := context.WithCancel(parent)
|
||||
return ctx, cancel, nil
|
||||
}
|
||||
|
||||
func ReadProtectedPasswordContext(ctx context.Context) (string, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return ReadProtectedPassword()
|
||||
}
|
||||
|
||||
func ShowResultContext(ctx context.Context, message string) {
|
||||
if ctx.Err() == nil {
|
||||
ShowResult(message)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user