Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif entry.smbc_type == pysmb.smbc.SERVER:
# Server
try:
if self.expanding_row:
return
except:
self.expanding_row = 1
busy (self.SMBBrowseDialog)
uri = "smb://%s/" % entry.name
debug = 0
if get_debugging ():
debug = 10
smbc_auth = pysmb.AuthContext (self.SMBBrowseDialog)
ctx = pysmb.smbc.Context (debug=debug,
auth_fn=smbc_auth.callback)
shares = []
try:
while smbc_auth.perform_authentication () > 0:
try:
shares = ctx.opendir (uri).getdents ()
except Exception, e:
smbc_auth.failed (e)
except RuntimeError, (e, s):
if e != errno.EACCES and e != errno.EPERM:
debugprint ("Runtime error: %s" % repr ((e, s)))
except:
nonfatalException()
while model.iter_has_child (iter):
i = model.iter_nth_child (iter, 0)
user = self.entSMBUsername.get_text ()
passwd = self.entSMBPassword.get_text ()
accessible = False
canceled = False
busy (self.NewPrinterWindow)
try:
debug = 0
if get_debugging ():
debug = 10
if auth_set:
# No prompting.
def do_auth (svr, shr, wg, un, pw):
return (group, user, passwd)
ctx = pysmb.smbc.Context (debug=debug, auth_fn=do_auth)
f = ctx.open ("smb://%s/%s" % (host, share),
os.O_RDWR, 0777)
accessible = True
else:
# May need to prompt.
smbc_auth = pysmb.AuthContext (self.NewPrinterWindow,
workgroup=group,
user=user,
passwd=passwd)
ctx = pysmb.smbc.Context (debug=debug,
auth_fn=smbc_auth.callback)
while smbc_auth.perform_authentication () > 0:
try:
f = ctx.open ("smb://%s/%s" % (host, share),
os.O_RDWR, 0777)
accessible = True
# Be careful though: if there is a server with the
# same name as the workgroup we will get a list of its
# shares, not the workgroup's servers.
try:
if self.expanding_row:
return
except:
self.expanding_row = 1
busy (self.SMBBrowseDialog)
uri = "smb://%s/" % entry.name
debug = 0
if get_debugging ():
debug = 10
smbc_auth = pysmb.AuthContext (self.SMBBrowseDialog)
ctx = pysmb.smbc.Context (debug=debug,
auth_fn=smbc_auth.callback)
entries = []
try:
while smbc_auth.perform_authentication () > 0:
try:
entries = ctx.opendir (uri).getdents ()
except Exception, e:
smbc_auth.failed (e)
except RuntimeError, (e, s):
if e != errno.ENOENT:
debugprint ("Runtime error: %s" % repr ((e, s)))
except:
nonfatalException()
while model.iter_has_child (iter):
i = model.iter_nth_child (iter, 0)