def set_auth_func(auth_func): global _context l.smbc_init(l.AUTHFUNC(l.py_auth_func), 1) _context = l.smbc_new_context() l.smbc_init_context(_context)
_check_error() return _smbfile(fd) def listdir(smb_url): dir_ = l.smbc_opendir(smb_url) if dir_ < 0: _check_error() while True: dirent = l.smbc_readdir(dir_) if not dirent: _check_error() break obj_ = _smbobj_from_dirent(smb_url, dirent) if obj_.type == l.DIR and obj_.name in ('.', '..'): continue yield obj_ # set_auth_func(l.py_auth_func) if __name__ == '__main__': l.smbc_init(l.auth_func, 1) l.smbc_init_context(l.smbc_new_context()) for i in listdir(sys.argv[1]): if isinstance(i, FileObj): f = i.open() import shutil import sys shutil.copyfileobj(f, sys.stdout)