(find_message, **kwargs)
| 2246 | return b'' |
| 2247 | |
| 2248 | def findFirstCB(find_message, **kwargs): |
| 2249 | self._pushToArray(messages_history, find_message) |
| 2250 | if not find_message.status.hasError: |
| 2251 | if 'total_count' not in kwargs: |
| 2252 | # TRANS2_FIND_FIRST2 response. [MS-CIFS]: 2.2.6.2.2 |
| 2253 | sid, search_count, end_of_search, _, last_name_offset = struct.unpack('<HHHHH', find_message.payload.params_bytes[:10]) |
| 2254 | kwargs.update({ 'sid': sid, 'end_of_search': end_of_search, 'last_name_offset': last_name_offset, 'data_buf': b'' }) |
| 2255 | else: |
| 2256 | sid, end_of_search, last_name_offset = kwargs['sid'], kwargs['end_of_search'], kwargs['last_name_offset'] |
| 2257 | |
| 2258 | send_next = True |
| 2259 | if find_message.payload.data_bytes: |
| 2260 | d = decodeFindStruct(kwargs['data_buf'] + find_message.payload.data_bytes) |
| 2261 | if 'data_count' not in kwargs: |
| 2262 | if len(find_message.payload.data_bytes) != find_message.payload.total_data_count: |
| 2263 | kwargs.update({ 'data_count': len(find_message.payload.data_bytes), |
| 2264 | 'total_count': find_message.payload.total_data_count, |
| 2265 | 'data_buf': d, |
| 2266 | }) |
| 2267 | send_next = False |
| 2268 | else: |
| 2269 | kwargs['data_count'] += len(find_message.payload.data_bytes) |
| 2270 | kwargs['total_count'] = min(find_message.payload.total_data_count, kwargs['total_count']) |
| 2271 | kwargs['data_buf'] = d |
| 2272 | if kwargs['data_count'] != kwargs['total_count']: |
| 2273 | send_next = False |
| 2274 | |
| 2275 | if not send_next: |
| 2276 | self.pending_requests[find_message.mid] = _PendingRequest(find_message.mid, expiry_time, findFirstCB, errback, **kwargs) |
| 2277 | elif end_of_search: |
| 2278 | callback(results) |
| 2279 | else: |
| 2280 | sendFindNext(find_message.tid, sid, 0, results[-1].filename, kwargs.get('support_dfs', False)) |
| 2281 | else: |
| 2282 | if find_message.status.internal_value == 0xC000000F: # [MS-ERREF]: STATUS_NO_SUCH_FILE |
| 2283 | # Remote server returns STATUS_NO_SUCH_FILE error so we assume that the search returns no matching files |
| 2284 | callback([ ]) |
| 2285 | else: |
| 2286 | errback(OperationFailure('Failed to list %s on %s: Unable to retrieve file list' % ( path, service_name ), messages_history)) |
| 2287 | |
| 2288 | def sendFindNext(tid, sid, resume_key, resume_file, support_dfs): |
| 2289 | setup_bytes = struct.pack('<H', 0x0002) # TRANS2_FIND_NEXT2 sub-command. See [MS-CIFS]: 2.2.6.3.1 |
nothing calls this directly
no test coverage detected