|
| 1 | +/* |
| 2 | + * This file contains a subset of the RPC protocol for NFS, as described in |
| 3 | + * RFC 1813: |
| 4 | + * |
| 5 | + * https://www.ietf.org/rfc/rfc1813.txt |
| 6 | + * |
| 7 | + * Apart from omitting parts of the protocol that are not needed, only one |
| 8 | + * modification has been made: |
| 9 | + * |
| 10 | + * 1. The upper bound of the opaque data in an fhandle3 has been omitted, |
| 11 | + * to demonstrate a buffer overflow in Mac OS version 10.13.5. |
| 12 | + */ |
| 13 | + |
| 14 | +struct fhandle3 { |
| 15 | + opaque data<>; /* Note: upper bound deliberately omitted */ |
| 16 | +}; |
| 17 | + |
| 18 | +enum mountstat3 { |
| 19 | + MNT3_OK = 0, /* no error */ |
| 20 | + MNT3ERR_PERM = 1, /* Not owner */ |
| 21 | + MNT3ERR_NOENT = 2, /* No such file or directory */ |
| 22 | + MNT3ERR_IO = 5, /* I/O error */ |
| 23 | + MNT3ERR_ACCES = 13, /* Permission denied */ |
| 24 | + MNT3ERR_NOTDIR = 20, /* Not a directory */ |
| 25 | + MNT3ERR_INVAL = 22, /* Invalid argument */ |
| 26 | + MNT3ERR_NAMETOOLONG = 63, /* Filename too long */ |
| 27 | + MNT3ERR_NOTSUPP = 10004, /* Operation not supported */ |
| 28 | + MNT3ERR_SERVERFAULT = 10006 /* A failure on the server */ |
| 29 | +}; |
| 30 | + |
| 31 | +program NFS_PROGRAM { |
| 32 | + version NFS_V3 { |
| 33 | + void |
| 34 | + NFSPROC3_NULL(void) = 0; |
| 35 | + } = 3; |
| 36 | +} = 100003; |
| 37 | + |
| 38 | +const MNTPATHLEN = 1024; |
| 39 | +typedef string dirpath<MNTPATHLEN>; |
| 40 | + |
| 41 | +struct mountres3_ok { |
| 42 | + fhandle3 fhandle; |
| 43 | + int auth_flavors<>; |
| 44 | +}; |
| 45 | + |
| 46 | +const MNT_OK = 0; |
| 47 | + |
| 48 | +union mountres3 switch (mountstat3 fhs_status) { |
| 49 | +case MNT_OK: |
| 50 | + mountres3_ok mountinfo; |
| 51 | +default: |
| 52 | + void; |
| 53 | +}; |
| 54 | + |
| 55 | +program MOUNT_PROGRAM { |
| 56 | + version MOUNT_V3 { |
| 57 | + void MOUNTPROC3_NULL(void) = 0; |
| 58 | + mountres3 MOUNTPROC3_MNT(dirpath) = 1; |
| 59 | + } = 3; |
| 60 | +} = 100005; |
0 commit comments