@ai-ecoverse/slicc-kernel 1.196.17 → 1.196.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +70 -66
- package/dist/cloudflare.js.map +3 -3
- package/dist/kernel-worker.js +70 -66
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +70 -66
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +1 -1
- package/dist/types/kernel/children.d.ts +1 -3
- package/dist/types/sudo.d.ts +5 -4
- package/package.json +1 -1
|
@@ -9313,7 +9313,7 @@ var init_version = __esm({
|
|
|
9313
9313
|
"src/version.ts"() {
|
|
9314
9314
|
"use strict";
|
|
9315
9315
|
init_captured_globals();
|
|
9316
|
-
KERNEL_VERSION = true ? "1.196.
|
|
9316
|
+
KERNEL_VERSION = true ? "1.196.18" : "0.0.0-dev";
|
|
9317
9317
|
OS_RELEASE = "6.0.0-slicc";
|
|
9318
9318
|
}
|
|
9319
9319
|
});
|
|
@@ -9312,7 +9312,7 @@ var init_version = __esm({
|
|
|
9312
9312
|
"src/version.ts"() {
|
|
9313
9313
|
"use strict";
|
|
9314
9314
|
init_captured_globals();
|
|
9315
|
-
KERNEL_VERSION = true ? "1.196.
|
|
9315
|
+
KERNEL_VERSION = true ? "1.196.18" : "0.0.0-dev";
|
|
9316
9316
|
OS_RELEASE = "6.0.0-slicc";
|
|
9317
9317
|
}
|
|
9318
9318
|
});
|
package/dist/node.js
CHANGED
|
@@ -7734,7 +7734,7 @@ function satisfies(version, range2) {
|
|
|
7734
7734
|
}
|
|
7735
7735
|
|
|
7736
7736
|
// src/version.ts
|
|
7737
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
7737
|
+
var KERNEL_VERSION = true ? "1.196.18" : "0.0.0-dev";
|
|
7738
7738
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7739
7739
|
function procVersion() {
|
|
7740
7740
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -12479,12 +12479,8 @@ var SpawnError = class extends Error {
|
|
|
12479
12479
|
}
|
|
12480
12480
|
};
|
|
12481
12481
|
var ChangedError = class extends SpawnError {
|
|
12482
|
-
|
|
12483
|
-
file;
|
|
12484
|
-
constructor(notice, file) {
|
|
12482
|
+
constructor() {
|
|
12485
12483
|
super("EPERM");
|
|
12486
|
-
this.notice = notice;
|
|
12487
|
-
this.file = file;
|
|
12488
12484
|
}
|
|
12489
12485
|
};
|
|
12490
12486
|
function interrupted(signal) {
|
|
@@ -20240,11 +20236,11 @@ function stdinMatches(rule2, stdin) {
|
|
|
20240
20236
|
function recordable(cwd, argv) {
|
|
20241
20237
|
return !hasControl2(cwd) && !argv.some(hasControl2);
|
|
20242
20238
|
}
|
|
20243
|
-
function changedText(
|
|
20244
|
-
return `sudo: ${
|
|
20239
|
+
function changedText(word) {
|
|
20240
|
+
return `sudo: ${quoteWord(word)} changed since it was approved`;
|
|
20245
20241
|
}
|
|
20246
|
-
function requestedText(
|
|
20247
|
-
return `sudo: ${
|
|
20242
|
+
function requestedText(word) {
|
|
20243
|
+
return `sudo: ${quoteWord(word)} changed since it was requested`;
|
|
20248
20244
|
}
|
|
20249
20245
|
function changedFile(approved, now) {
|
|
20250
20246
|
const files = /* @__PURE__ */ new Set([...Object.keys(approved), ...Object.keys(now)]);
|
|
@@ -20711,12 +20707,12 @@ var Sudo = class {
|
|
|
20711
20707
|
if (file.split("/").includes("..")) return physicalPathAsync(fs, file, true);
|
|
20712
20708
|
return await fs.realpath?.(file, true).catch(() => file) ?? file;
|
|
20713
20709
|
}
|
|
20714
|
-
async moved({ routes }
|
|
20710
|
+
async moved({ routes }) {
|
|
20715
20711
|
for (const [asked, approved] of Object.entries(routes)) {
|
|
20716
20712
|
const real = await this.real(asked).catch(() => void 0);
|
|
20717
|
-
if (real !== approved) return
|
|
20713
|
+
if (real !== approved) return true;
|
|
20718
20714
|
}
|
|
20719
|
-
return
|
|
20715
|
+
return false;
|
|
20720
20716
|
}
|
|
20721
20717
|
async missingBacking(hashes, except) {
|
|
20722
20718
|
for (const path of Object.keys(hashes)) {
|
|
@@ -20759,6 +20755,11 @@ var Sudo = class {
|
|
|
20759
20755
|
await lstat("/");
|
|
20760
20756
|
return physicalPathAsync({ lstat, readlink: (at) => fs.readlink(at) }, path, true);
|
|
20761
20757
|
}
|
|
20758
|
+
async executablePath(fs, cred, asked) {
|
|
20759
|
+
const path = await this.searched(fs, cred, asked);
|
|
20760
|
+
const st = await fs.stat(path);
|
|
20761
|
+
return st.isFile && (st.mode & 73) !== 0 ? path : void 0;
|
|
20762
|
+
}
|
|
20762
20763
|
async locate(word, cwd, reads, target) {
|
|
20763
20764
|
const fs = this.o.planFs?.(reads) ?? this.o.fs;
|
|
20764
20765
|
const candidates = word.includes("/") ? [askedPath(cwd, word)] : SECURE_PATH.split(":").map((dir) => `${dir}/${word}`);
|
|
@@ -20766,9 +20767,8 @@ var Sudo = class {
|
|
|
20766
20767
|
let denial;
|
|
20767
20768
|
for (const asked of candidates) {
|
|
20768
20769
|
try {
|
|
20769
|
-
const path = await this.
|
|
20770
|
-
|
|
20771
|
-
if (st.isFile && (st.mode & 73) !== 0) return { path, asked };
|
|
20770
|
+
const path = await this.executablePath(fs, cred, asked);
|
|
20771
|
+
if (path !== void 0) return { path, asked };
|
|
20772
20772
|
} catch (err) {
|
|
20773
20773
|
const code = err.code;
|
|
20774
20774
|
if (code === "EACCES") denial = failed2(code, `sudo: ${word}: Permission denied`);
|
|
@@ -20847,7 +20847,7 @@ ${SCRIPT_HELP}
|
|
|
20847
20847
|
const [word = "", ...args] = r.argv;
|
|
20848
20848
|
const argv = [r.path, ...args];
|
|
20849
20849
|
if (!await this.mayAsk(self, target, r, argv)) {
|
|
20850
|
-
const quoted = argv.map(quoteWord).join(" ");
|
|
20850
|
+
const quoted = r.argv.map(quoteWord).join(" ");
|
|
20851
20851
|
return failed2(
|
|
20852
20852
|
"EACCES",
|
|
20853
20853
|
`sudo: ${self.name} may no longer ask to run ${quoted} as ${target.name}`
|
|
@@ -20867,19 +20867,19 @@ ${SCRIPT_HELP}
|
|
|
20867
20867
|
if (located && "error" in located) return located;
|
|
20868
20868
|
if (!located) {
|
|
20869
20869
|
const gone = await this.missingBacking(r.bound, r.path);
|
|
20870
|
-
return gone ? failed2("EPERM", requestedText(
|
|
20870
|
+
return gone ? failed2("EPERM", requestedText(word)) : failed2("ENOENT", `sudo: ${word}: command not found`);
|
|
20871
20871
|
}
|
|
20872
20872
|
const { path, asked } = located;
|
|
20873
|
-
if (path !== r.path) return failed2("EPERM",
|
|
20873
|
+
if (path !== r.path) return failed2("EPERM", requestedText(word));
|
|
20874
20874
|
const bound3 = await this.bound(path, r.cwd, asked, void 0, reads);
|
|
20875
|
-
if (!bound3) return failed2("EPERM", requestedText(
|
|
20875
|
+
if (!bound3) return failed2("EPERM", requestedText(word));
|
|
20876
20876
|
const changed2 = changedDecision(r.bound, r, bound3, path);
|
|
20877
20877
|
if (changed2 !== void 0) {
|
|
20878
20878
|
const missing7 = ["chainSha256", "routeSha256"].filter(
|
|
20879
20879
|
(key) => bound3[key] !== void 0 && r[key] === void 0
|
|
20880
20880
|
);
|
|
20881
20881
|
const hint = missing7.length && changedFile(r.bound, bound3.hashes) === void 0 ? `; the saved request lacks ${missing7.join(" and ")}; pass back the whole request from approve unchanged` : "";
|
|
20882
|
-
return failed2("EPERM", requestedText(
|
|
20882
|
+
return failed2("EPERM", requestedText(word) + hint);
|
|
20883
20883
|
}
|
|
20884
20884
|
const now = await this.rootOnly(r.cwd, args);
|
|
20885
20885
|
const flipped = Object.keys(r.rootOnly).find((at) => r.rootOnly[at] && now[at] !== true);
|
|
@@ -20914,6 +20914,11 @@ ${SCRIPT_HELP}
|
|
|
20914
20914
|
const { caller, self, target, parsed: parsed3 } = s;
|
|
20915
20915
|
const { cred } = caller;
|
|
20916
20916
|
const [word = "", ...args] = parsed3.command;
|
|
20917
|
+
const notAllowed = () => failed2(
|
|
20918
|
+
"EPERM",
|
|
20919
|
+
`sudo: ${self.name} is not allowed to run ${parsed3.command.map(quoteWord).join(" ")} as ${target.name}`
|
|
20920
|
+
);
|
|
20921
|
+
if (!root && mine.length === 0) return notAllowed();
|
|
20917
20922
|
const cwd = await this.canonical(call.cwd, cred);
|
|
20918
20923
|
if (cwd === void 0 || !await this.reachable(cred, cwd)) {
|
|
20919
20924
|
return failed2(
|
|
@@ -20934,13 +20939,7 @@ ${SCRIPT_HELP}
|
|
|
20934
20939
|
const matching = applicable.filter((rule2) => pinned(rule2, bound3.hashes, bound3));
|
|
20935
20940
|
const grant = () => this.grant(self, target, cred, parsed3.command, path, cwd, call.term, bound3, s.kept, asked);
|
|
20936
20941
|
if (root || matching.some((rule2) => rule2.nopasswd)) return grant();
|
|
20937
|
-
|
|
20938
|
-
if (matching.length === 0) {
|
|
20939
|
-
return failed2(
|
|
20940
|
-
"EPERM",
|
|
20941
|
-
`sudo: ${self.name} is not allowed to run ${quoted} as ${target.name}`
|
|
20942
|
-
);
|
|
20943
|
-
}
|
|
20942
|
+
if (matching.length === 0) return notAllowed();
|
|
20944
20943
|
if (!parsed3.reset && this.timestamps.current(s.owner, s.policy, stampOf(bound3))) {
|
|
20945
20944
|
this.timestamps.stamp(s.owner, s.policy, stampOf(bound3));
|
|
20946
20945
|
this.logged(s, cwd, argv);
|
|
@@ -20964,14 +20963,11 @@ ${SCRIPT_HELP}
|
|
|
20964
20963
|
if (await this.canonical(call.cwd, cred) !== cwd || !await this.reachable(cred, cwd)) {
|
|
20965
20964
|
return failed2("EACCES", `sudo: ${call.cwd} changed while the request waited`);
|
|
20966
20965
|
}
|
|
20967
|
-
|
|
20968
|
-
if (moved2 !== void 0) return failed2("EPERM", changedText(moved2));
|
|
20966
|
+
if (await this.moved(bound3)) return failed2("EPERM", changedText(word));
|
|
20969
20967
|
if (answer2.answer === "once" && !answer2.person) return grant();
|
|
20970
20968
|
const now = await this.bound(path, cwd, asked, caller.pid);
|
|
20971
|
-
if (!now)
|
|
20972
|
-
return failed2("EPERM", changedText(
|
|
20973
|
-
const changed2 = changedDecision(bound3.hashes, bound3, now, path);
|
|
20974
|
-
if (changed2 !== void 0) return failed2("EPERM", changedText(changed2));
|
|
20969
|
+
if (!now || changedDecision(bound3.hashes, bound3, now, path) !== void 0)
|
|
20970
|
+
return failed2("EPERM", changedText(word));
|
|
20975
20971
|
const shown2 = recordable(cwd, [...parsed3.command, ...Object.keys(bound3.hashes)]);
|
|
20976
20972
|
const result = answer2.answer === "once" ? grant() : await this.always(
|
|
20977
20973
|
self,
|
|
@@ -29684,8 +29680,8 @@ var WasmProcess = class _WasmProcess {
|
|
|
29684
29680
|
close: () => source.release()
|
|
29685
29681
|
});
|
|
29686
29682
|
}
|
|
29687
|
-
nonblocking(fd,
|
|
29688
|
-
return
|
|
29683
|
+
nonblocking(fd, requested) {
|
|
29684
|
+
return requested === true || !this.options.perCallNonblock && ((this.fds.statusFlags(fd) ?? 0) & O_NONBLOCK3) !== 0;
|
|
29689
29685
|
}
|
|
29690
29686
|
async fdSyscall(req, cancelled) {
|
|
29691
29687
|
if (isVfsSyscall(req)) return this.vfsSyscall(req);
|
|
@@ -30567,7 +30563,8 @@ var WasmProcess = class _WasmProcess {
|
|
|
30567
30563
|
})
|
|
30568
30564
|
};
|
|
30569
30565
|
} catch (err) {
|
|
30570
|
-
if (err instanceof ChangedError)
|
|
30566
|
+
if (err instanceof ChangedError)
|
|
30567
|
+
return { error: changedText(argv[0] ?? asked), errno: err.code };
|
|
30571
30568
|
throw err;
|
|
30572
30569
|
}
|
|
30573
30570
|
}
|
|
@@ -38042,8 +38039,7 @@ function describe(req, tty) {
|
|
|
38042
38039
|
return { argv: [req.argv0, ...req.args], tty, started: Date.now(), ...exe };
|
|
38043
38040
|
}
|
|
38044
38041
|
function refuseChanged(approved, now) {
|
|
38045
|
-
|
|
38046
|
-
if (changed2 !== void 0) throw new ChangedError(changedText(changed2), changed2);
|
|
38042
|
+
if (changedFile(approved, now) !== void 0) throw new ChangedError();
|
|
38047
38043
|
}
|
|
38048
38044
|
var O_WRONLY2 = 1;
|
|
38049
38045
|
var OUTPUT_MODE = 384;
|
|
@@ -38062,10 +38058,14 @@ function sudoCause(err) {
|
|
|
38062
38058
|
if (typeof code !== "string") throw err;
|
|
38063
38059
|
return code;
|
|
38064
38060
|
}
|
|
38065
|
-
|
|
38066
|
-
|
|
38067
|
-
|
|
38068
|
-
|
|
38061
|
+
var LOST_ROUTE = /* @__PURE__ */ new Set([
|
|
38062
|
+
"ENOENT",
|
|
38063
|
+
"ENOTDIR",
|
|
38064
|
+
"EACCES",
|
|
38065
|
+
"ELOOP",
|
|
38066
|
+
"ESTALE",
|
|
38067
|
+
"ENAMETOOLONG"
|
|
38068
|
+
]);
|
|
38069
38069
|
var MAX_SPAWN_TAGS = 8;
|
|
38070
38070
|
function tagList(value2) {
|
|
38071
38071
|
if (!Array.isArray(value2)) {
|
|
@@ -39365,16 +39365,20 @@ var Launcher = class {
|
|
|
39365
39365
|
const refused5 = (err) => {
|
|
39366
39366
|
throw codeOf9(err) === "EACCES" ? new SpawnError("EACCES") : err;
|
|
39367
39367
|
};
|
|
39368
|
+
const lost = (err) => {
|
|
39369
|
+
if (LOST_ROUTE.has(codeOf9(err))) throw new ChangedError();
|
|
39370
|
+
throw err;
|
|
39371
|
+
};
|
|
39368
39372
|
const { file, parentHops } = await this.execFile(
|
|
39369
39373
|
req.file,
|
|
39370
39374
|
req.cwd,
|
|
39371
39375
|
this.execGuard(cred, ppid),
|
|
39372
39376
|
ppid
|
|
39373
|
-
).catch(refused5);
|
|
39377
|
+
).catch(grant?.files ? lost : refused5);
|
|
39374
39378
|
const reads = prepared ?? (grant?.files && await this.scriptReads(grant.files, cred, ppid));
|
|
39375
39379
|
if (grant?.asked && reads) {
|
|
39376
|
-
const destination = await this.sudoer.
|
|
39377
|
-
if (destination !== file) throw new ChangedError(
|
|
39380
|
+
const destination = await this.sudoer.executablePath(this.sudoFs(reads), cred, grant.asked).catch(lost);
|
|
39381
|
+
if (destination !== file) throw new ChangedError();
|
|
39378
39382
|
}
|
|
39379
39383
|
const plan = await this.plan(file, req.argv, req.cwd, scope, {
|
|
39380
39384
|
argv0: req.argv0,
|
|
@@ -39393,10 +39397,7 @@ var Launcher = class {
|
|
|
39393
39397
|
async checkFailedPlan(file, req, scope, grant) {
|
|
39394
39398
|
const reads = this.sudoer.reads();
|
|
39395
39399
|
const { planned } = await this.plan(file, req.argv, req.cwd, scope, { reads });
|
|
39396
|
-
if (!planned)
|
|
39397
|
-
const gone = await this.sudoer.missingBacking(grant.files.hashes) ?? file;
|
|
39398
|
-
throw new ChangedError(changedText(gone), gone);
|
|
39399
|
-
}
|
|
39400
|
+
if (!planned) throw new ChangedError();
|
|
39400
39401
|
await this.unchanged({ ...planned, reads }, file, req.cwd, grant);
|
|
39401
39402
|
}
|
|
39402
39403
|
async enterable(g, cwd) {
|
|
@@ -39550,26 +39551,26 @@ var Launcher = class {
|
|
|
39550
39551
|
const now = await planned.reads.bind([file, grant.asked ?? file, ...files]);
|
|
39551
39552
|
refuseChanged(approved.hashes, now.hashes);
|
|
39552
39553
|
refuseChanged(approved.routes, now.routes);
|
|
39553
|
-
if (now.chainSha256 !== approved.chainSha256) throw new ChangedError(
|
|
39554
|
+
if (now.chainSha256 !== approved.chainSha256) throw new ChangedError();
|
|
39554
39555
|
return { pinned: approved };
|
|
39555
39556
|
}
|
|
39556
39557
|
approvedChain(planned, file, cwd, grant) {
|
|
39557
39558
|
if (!grant) return void 0;
|
|
39558
39559
|
return async (next3) => {
|
|
39559
39560
|
const chain2 = (p) => [...p.via ?? [], ...p.binfmts ?? []];
|
|
39560
|
-
if (!sameList(chain2(next3), chain2(planned))) throw new ChangedError(
|
|
39561
|
+
if (!sameList(chain2(next3), chain2(planned))) throw new ChangedError();
|
|
39561
39562
|
await this.unchanged(next3, file, cwd, grant);
|
|
39562
39563
|
};
|
|
39563
39564
|
}
|
|
39564
39565
|
async scriptReads(files, cred, pid) {
|
|
39565
|
-
await this.checkRoutes(files
|
|
39566
|
+
await this.checkRoutes(files);
|
|
39566
39567
|
const snapshots = /* @__PURE__ */ new Map();
|
|
39567
39568
|
const reads = this.sudoer.reads(snapshots);
|
|
39568
39569
|
const guard2 = { fs: this.sudoFs(reads), dac: this.dac, cred, pid, links: cred.euid };
|
|
39569
39570
|
for (const path of files.scripts ?? []) {
|
|
39570
39571
|
const real = files.routes[path];
|
|
39571
39572
|
const walked2 = await need(guard2, "open", path, R_OK, { directory: false });
|
|
39572
|
-
if (walked2.missing || walked2.path !== real) throw new ChangedError(
|
|
39573
|
+
if (walked2.missing || walked2.path !== real) throw new ChangedError();
|
|
39573
39574
|
if (!snapshots.has(real))
|
|
39574
39575
|
snapshots.set(real, new Uint8Array(await this.noLinksFs.readFileBuffer(real)));
|
|
39575
39576
|
}
|
|
@@ -39582,14 +39583,13 @@ var Launcher = class {
|
|
|
39582
39583
|
const real = files.routes[path];
|
|
39583
39584
|
if (real === void 0) continue;
|
|
39584
39585
|
const bytes = reads.snapshots.get(real);
|
|
39585
|
-
if (!bytes) throw new ChangedError(
|
|
39586
|
+
if (!bytes) throw new ChangedError();
|
|
39586
39587
|
args[args.length - fromEnd] = scriptFd(fds, bytes);
|
|
39587
39588
|
}
|
|
39588
39589
|
return { ...planned, args };
|
|
39589
39590
|
}
|
|
39590
|
-
async checkRoutes(files
|
|
39591
|
-
|
|
39592
|
-
if (file !== void 0) throw new ChangedError(changedText(file), file);
|
|
39591
|
+
async checkRoutes(files) {
|
|
39592
|
+
if (await this.sudoer.moved(files)) throw new ChangedError();
|
|
39593
39593
|
}
|
|
39594
39594
|
async pinOf(path, caller) {
|
|
39595
39595
|
const { pinned: pinned2 } = caller;
|
|
@@ -39597,7 +39597,7 @@ var Launcher = class {
|
|
|
39597
39597
|
const real = await this.sudoer.real(path);
|
|
39598
39598
|
const approved = pinned2.routes[path];
|
|
39599
39599
|
if (approved !== real && (approved !== void 0 || !await this.sudoer.trustedThrough(path)))
|
|
39600
|
-
throw new ChangedError(
|
|
39600
|
+
throw new ChangedError();
|
|
39601
39601
|
const hex4 = pinned2.hashes[real];
|
|
39602
39602
|
return hex4 === void 0 ? {} : { [real]: hex4 };
|
|
39603
39603
|
}
|
|
@@ -40039,7 +40039,7 @@ var Launcher = class {
|
|
|
40039
40039
|
const own = env.HOSTNAME;
|
|
40040
40040
|
if (asked.target.abi === "wasi") env.HOSTNAME = this.hostname;
|
|
40041
40041
|
const planned = chosen2(asked, env);
|
|
40042
|
-
if (req.pinned) await this.checkRoutes(req.pinned
|
|
40042
|
+
if (req.pinned) await this.checkRoutes(req.pinned);
|
|
40043
40043
|
const caller = {
|
|
40044
40044
|
pid: req.ppid ?? 0,
|
|
40045
40045
|
uid: req.cred.euid,
|
|
@@ -41850,12 +41850,16 @@ var Launcher = class {
|
|
|
41850
41850
|
this.resetCatalogs();
|
|
41851
41851
|
const req = { file: grant.file, argv: grant.argv, env: grant.env, cwd: grant.cwd };
|
|
41852
41852
|
const ctx = { ppid: 0, cred: grant.cred, scope: "", grant };
|
|
41853
|
+
const word = grant.argv[0] ?? grant.asked;
|
|
41854
|
+
const requested = (err2) => {
|
|
41855
|
+
if (err2 instanceof ChangedError) throw sudoFailure(err2.code, requestedText(word));
|
|
41856
|
+
throw err2;
|
|
41857
|
+
};
|
|
41853
41858
|
const planned = await this.planOne(req, ctx).catch((err2) => {
|
|
41854
41859
|
if (err2 instanceof ChangedError) requested(err2);
|
|
41855
41860
|
const code = sudoCause(err2);
|
|
41856
|
-
|
|
41857
|
-
|
|
41858
|
-
throw sudoFailure(code, `sudo: ${grant.file}: ${ERRNO_TEXT[code] ?? code}`);
|
|
41861
|
+
if (code === "ENOENT") throw sudoFailure(code, `sudo: ${quoteWord(word)}: command not found`);
|
|
41862
|
+
throw sudoFailure(code, `sudo: ${quoteWord(word)}: ${ERRNO_TEXT[code] ?? code}`);
|
|
41859
41863
|
});
|
|
41860
41864
|
const pin = await this.unchanged(planned, grant.file, grant.cwd, grant).catch(requested);
|
|
41861
41865
|
const fds = await this.sudoOutputs(options, caller, this.stackFor(tags, tagged.tagBase));
|
|
@@ -42570,9 +42574,9 @@ async function accountOf(l, user) {
|
|
|
42570
42574
|
if (!found) throw fsError("ENOENT", `no user ${String(user)}`);
|
|
42571
42575
|
return found;
|
|
42572
42576
|
}
|
|
42573
|
-
async function runAs(l, self,
|
|
42574
|
-
if (
|
|
42575
|
-
const target = await accountOf(l,
|
|
42577
|
+
async function runAs(l, self, requested) {
|
|
42578
|
+
if (requested === void 0) return self;
|
|
42579
|
+
const target = await accountOf(l, requested);
|
|
42576
42580
|
if (self.uid !== 0 && target.uid !== self.uid) {
|
|
42577
42581
|
throw fsError("EPERM", `${self.name} may not run as ${target.name}`);
|
|
42578
42582
|
}
|