Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpack the RPC response data error #10

Open
aszx826477 opened this issue Sep 5, 2024 · 1 comment
Open

Unpack the RPC response data error #10

aszx826477 opened this issue Sep 5, 2024 · 1 comment

Comments

@aszx826477
Copy link

Dear CharmingYang, I meet a problem while using your NfsClient library. Could you help me to see this problem. I use your sample code like this. When it getport from 10.232.94.126, it can get the correct port 635 from the NFS server (I print it)

mnt_port = portmap.getport(Mount.program, Mount.program_version)

However when running the mount

mnt_res = mount.mnt(mount_path, None) 

the RPC cannot unpack data correctly, it seems the data format is wrong but I don't know why.

Looking forward for your reply!

The Code written like this:

# variable preparation
host = "10.232.94.126"
mount_path = "/vol_log/VASC_SILA/VMS/VMSKPI"

auth = {
    "flavor": 1,
    "machine_name": "maccrt03",
    "uid": 0,
    "gid": 0,
    "aux_gid": list(),
}

# portmap initialization
portmap = Portmap(host, timeout=3600)
portmap.connect()

# mount initialization
mnt_port = portmap.getport(Mount.program, Mount.program_version)
print("mnt_port")
print(mnt_port)
mount = Mount(host=host, port=mnt_port, timeout=3600, auth=auth)
mount.connect()

# do mount
mnt_res = mount.mnt(mount_path, None) # Have problem
print(mnt_res)

[2024-09-05 04:43:42 mnt_port]
[2024-09-05 04:43:42 635]
[2024-09-05 04:43:42 rpc.request:125 - unpack requires a buffer of 24 bytesTraceback (most recent call last): File "pyNfsClient/rpc.py", line 117, in request ) = struct.unpack('!LLLLLL', rpc)struct.error: unpack requires a buffer of 24 bytes]
[2024-09-05 04:43:42
'value=1725511422 not in enum mountstat3':
Traceback (most recent call last):; File: "index.py", line 31, in handler;
mnt_res = mount.mnt(mount_path, None); File: "pyNfsClient/mount.py", line 38, in mnt; res = unpacker.unpack_mountres3();
File: "pyNfsClient/pack.py", line 1728, in unpack_mountres3; data.status = self.unpack_mountstat3();
File: "pyNfsClient/pack.py", line 1717, in unpack_mountstat3; raise XDRError('value=%s not in enum mountstat3' % data);
xdrlib.Error: value=1725511422 not in enum mountstat3;]

@NeffIsBack
Copy link

Hi, i had the same problem so i dove into the issue. The problem is an incomplete handling of the rpc answer. If the rpc request gets a MSG_DENIED error the reply is shorter than usual, so the unpacking fails. As i don't think this repo is maintained anymore (the last commit is over 5 years ago) i patched it myself:
https://github.com/Pennyw0rth/NfsClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants