Creates a mount point at an existing directory :param HANDLE tid: A vaild handle for the share where the path resides. :param str path: A path to a directory at which to create mount point (must already exist). :param str target: A target address of mount point.
(self, tid, path, target)
| 900 | return list(filter(None, snapshotData['SnapShots'].decode('utf16').split('\x00'))) |
| 901 | |
| 902 | def createMountPoint(self, tid, path, target): |
| 903 | """ |
| 904 | Creates a mount point at an existing directory |
| 905 | |
| 906 | :param HANDLE tid: A vaild handle for the share where the path resides. |
| 907 | :param str path: A path to a directory at which to create mount point (must already exist). |
| 908 | :param str target: A target address of mount point. |
| 909 | |
| 910 | :raise SessionError: If encountered an error. |
| 911 | """ |
| 912 | |
| 913 | # Verify we're under SMB2+ session |
| 914 | if self.getDialect() not in [SMB2_DIALECT_002, SMB2_DIALECT_21, SMB2_DIALECT_30]: |
| 915 | raise SessionError(error = nt_errors.STATUS_NOT_SUPPORTED) |
| 916 | |
| 917 | fid = self.openFile(tid, path, GENERIC_READ | GENERIC_WRITE, |
| 918 | creationOption=FILE_OPEN_REPARSE_POINT) |
| 919 | |
| 920 | if target.startswith("\\"): |
| 921 | fixed_name = target.encode('utf-16le') |
| 922 | else: |
| 923 | fixed_name = ("\\??\\" + target).encode('utf-16le') |
| 924 | |
| 925 | name = target.encode('utf-16le') |
| 926 | |
| 927 | reparseData = smb3structs.MOUNT_POINT_REPARSE_DATA_STRUCTURE() |
| 928 | |
| 929 | reparseData['PathBuffer'] = fixed_name + b"\x00\x00" + name + b"\x00\x00" |
| 930 | reparseData['SubstituteNameLength'] = len(fixed_name) |
| 931 | reparseData['PrintNameOffset'] = len(fixed_name) + 2 |
| 932 | reparseData['PrintNameLength'] = len(name) |
| 933 | |
| 934 | self._SMBConnection.ioctl(tid, fid, smb3structs.FSCTL_SET_REPARSE_POINT, flags=smb3structs.SMB2_0_IOCTL_IS_FSCTL, |
| 935 | inputBlob=reparseData) |
| 936 | |
| 937 | self.closeFile(tid, fid) |
| 938 | |
| 939 | def removeMountPoint(self, tid, path): |
| 940 | """ |
no test coverage detected