sandboxedjs 0.1.66 → 0.1.67

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.
@@ -314,6 +314,7 @@ declare const Errno: {
314
314
  readonly ELOOP: 40;
315
315
  readonly ENODATA: 61;
316
316
  readonly ENOTSOCK: 88;
317
+ readonly EPROTONOSUPPORT: 93;
317
318
  readonly EAFNOSUPPORT: 97;
318
319
  readonly EADDRINUSE: 98;
319
320
  readonly EADDRNOTAVAIL: 99;
@@ -314,6 +314,7 @@ declare const Errno: {
314
314
  readonly ELOOP: 40;
315
315
  readonly ENODATA: 61;
316
316
  readonly ENOTSOCK: 88;
317
+ readonly EPROTONOSUPPORT: 93;
317
318
  readonly EAFNOSUPPORT: 97;
318
319
  readonly EADDRINUSE: 98;
319
320
  readonly EADDRNOTAVAIL: 99;
@@ -84,6 +84,7 @@ var Errno = {
84
84
  ELOOP: 40,
85
85
  ENODATA: 61,
86
86
  ENOTSOCK: 88,
87
+ EPROTONOSUPPORT: 93,
87
88
  EAFNOSUPPORT: 97,
88
89
  EADDRINUSE: 98,
89
90
  EADDRNOTAVAIL: 99,
@@ -1270,6 +1271,9 @@ var MAX_TRANSFER = 8 * 1024 * 1024;
1270
1271
  var POLLIN = 1;
1271
1272
  var POLLOUT = 4;
1272
1273
  var POLLHUP = 16;
1274
+ var AF_INET = 2;
1275
+ var SOCK_STREAM = 1;
1276
+ var IPPROTO_TCP = 6;
1273
1277
  function createHostAbiServer(proc) {
1274
1278
  const files = new FileService(proc.vfs, proc.cred);
1275
1279
  const started = Date.now();
@@ -1519,7 +1523,8 @@ function createHostAbiServer(proc) {
1519
1523
  const family = r.u32();
1520
1524
  const type = r.u32();
1521
1525
  const protocol = r.i32();
1522
- if (family !== 2 || (type & 15) !== 1 || protocol !== 0) throw new PosixError(Errno.EAFNOSUPPORT);
1526
+ if (family !== AF_INET || (type & 15) !== SOCK_STREAM) throw new PosixError(Errno.EAFNOSUPPORT);
1527
+ if (protocol !== 0 && protocol !== IPPROTO_TCP) throw new PosixError(Errno.EPROTONOSUPPORT);
1523
1528
  if (!proc.sockets) throw new PosixError(Errno.ENOSYS);
1524
1529
  return { status: proc.table.add(new SocketDescription(new VirtualTcpSocket(proc.sockets))) };
1525
1530
  }