diff options
Diffstat (limited to 'core/Addon.zig')
| -rw-r--r-- | core/Addon.zig | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/Addon.zig b/core/Addon.zig index c60f2430..aa3195f9 100644 --- a/core/Addon.zig +++ b/core/Addon.zig @@ -567,9 +567,11 @@ pub fn loadedOf(ops: *const Kind.Ops, path: []const u8, hash: [32]u8, words: *[6 /// This process's code for a kind a session's core lists, which a client /// runs itself: PA_PLAIN, of the same name, version, ABI and functions (a -/// compiled-in addon's library hash is 0: never by the hash), and not -/// caught breaking its promise here (`distrusted`, the client's). Null: its -/// panes say so. +/// compiled-in addon's library hash is 0: never by the hash), or else the +/// library at the session's path when its bytes are the session's (P51: a +/// client on its machine; never bytes the session sent), and not caught +/// breaking its promise here (`distrusted`, the client's). Null: its panes +/// say so. pub fn plainOps(e: *const Kind.Entry, distrusted: ?*const Distrusted) ?*const Kind.Ops { if (!e.caps.plain or e.refused) return null; // A client scans for its addons only when its session has a plain kind. @@ -582,6 +584,16 @@ pub fn plainOps(e: *const Kind.Entry, distrusted: ?*const Distrusted) ?*const Ki if (l.ops == 0) l.ops = loadListed(i, &why) orelse return null; return @ptrFromInt(l.ops); }; + var words: [64]LoadedWord = undefined; + var why: Why = .{}; + var data_buf: [4096]u8 = undefined; + const l = read(dataDir(&data_buf), e.path.slice(), &words, &why); + if (l.why.len > 0) return null; + const ops: *const Kind.Ops = @ptrFromInt(l.ops); + if (std.mem.eql(u8, &l.hash, &e.hash)) return ops; + const lib = libOf(ops).?; + lib.refs -= 1; + closeIdle(lib); return null; } |
