Codebase list pysmb / f913221
Merge branch 'patch-2' of git://github.com/christopherpickering/pysmb into christopherpickering-patch-2 Michael Teo 3 years ago
1 changed file(s) with 13 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
0
10 import os, sys, socket, urllib.request, urllib.error, urllib.parse, mimetypes, email, tempfile
21 from urllib.parse import (unwrap, unquote, splittype, splithost, quote,
32 splitport, splittag, splitattr, splituser, splitpasswd, splitvalue)
2524 port = int(port)
2625
2726 # username/password handling
27
2828 user, host = splituser(host)
29
2930 if user:
3031 user, passwd = splitpasswd(user)
3132 else:
3233 passwd = None
34
3335 host = unquote(host)
3436 user = user or ''
3537
4042 passwd = passwd or ''
4143 myname = MACHINE_NAME or self.generateClientMachineName()
4244
43 n = NetBIOS()
44 names = n.queryIPForName(host)
45 if names:
46 server_name = names[0]
47 else:
48 raise urllib.error.URLError('SMB error: Hostname does not reply back with its machine name')
45 server_name,host = host.split(',') if ',' in host else [None,host]
46
47 if server_name is None:
48 n = NetBIOS()
49
50 names = n.queryIPForName(host)
51 if names:
52 server_name = names[0]
53 else:
54 raise urllib.error.URLError('SMB error: Hostname does not reply back with its machine name')
4955
5056 path, attrs = splitattr(req.selector)
5157 if path.startswith('/'):