mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
Make unix sockets require allow-write (#4939)
This commit is contained in:
parent
a1974cbe43
commit
95a08857f1
2 changed files with 3 additions and 2 deletions
4
cli/js/lib.deno.ns.d.ts
vendored
4
cli/js/lib.deno.ns.d.ts
vendored
|
@ -1919,7 +1919,7 @@ declare namespace Deno {
|
||||||
*
|
*
|
||||||
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unix" })
|
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unix" })
|
||||||
*
|
*
|
||||||
* Requires `allow-read` permission. */
|
* Requires `allow-read` and `allow-write` permission. */
|
||||||
export function listen(
|
export function listen(
|
||||||
options: UnixListenOptions & { transport: "unix" }
|
options: UnixListenOptions & { transport: "unix" }
|
||||||
): Listener;
|
): Listener;
|
||||||
|
@ -1940,7 +1940,7 @@ declare namespace Deno {
|
||||||
*
|
*
|
||||||
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unixpacket" })
|
* const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unixpacket" })
|
||||||
*
|
*
|
||||||
* Requires `allow-read` permission. */
|
* Requires `allow-read` and `allow-write` permission. */
|
||||||
export function listen(
|
export function listen(
|
||||||
options: UnixListenOptions & { transport: "unixpacket" }
|
options: UnixListenOptions & { transport: "unixpacket" }
|
||||||
): DatagramConn;
|
): DatagramConn;
|
||||||
|
|
|
@ -521,6 +521,7 @@ fn op_listen(
|
||||||
} if transport == "unix" || transport == "unixpacket" => {
|
} if transport == "unix" || transport == "unixpacket" => {
|
||||||
let address_path = net_unix::Path::new(&args.address);
|
let address_path = net_unix::Path::new(&args.address);
|
||||||
state.check_read(&address_path)?;
|
state.check_read(&address_path)?;
|
||||||
|
state.check_write(&address_path)?;
|
||||||
let (rid, local_addr) = if transport == "unix" {
|
let (rid, local_addr) = if transport == "unix" {
|
||||||
net_unix::listen_unix(&mut resource_table, &address_path)?
|
net_unix::listen_unix(&mut resource_table, &address_path)?
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue