Commit c1f9d191 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan
Browse files

nfsv41: fix regression introduced in 4f419d854807

deviceid should always have a size of NFS4_DEVICEID4_SIZE
parent 8577c51d
......@@ -179,6 +179,11 @@ public class DeviceManager implements NFSv41DeviceManager {
private static byte[] id2deviceid(int id) {
byte[] buf = Integer.toString(id).getBytes();
return buf;
byte[] devData = new byte[nfs4_prot.NFS4_DEVICEID4_SIZE];
int len = Math.min(buf.length, nfs4_prot.NFS4_DEVICEID4_SIZE);
System.arraycopy(buf, 0, devData, 0, len);
return devData;
}
}
......@@ -16,10 +16,6 @@ public class deviceid4 implements XdrAble {
}
public deviceid4(byte [] value) {
if(value.length > nfs4_prot.NFS4_DEVICEID4_SIZE) {
throw new IllegalArgumentException("device id size is bigger than " +
nfs4_prot.NFS4_DEVICEID4_SIZE );
}
this.value = value;
}
......@@ -30,12 +26,12 @@ public class deviceid4 implements XdrAble {
public void xdrEncode(XdrEncodingStream xdr)
throws OncRpcException, IOException {
xdr.xdrEncodeDynamicOpaque(value);
xdr.xdrEncodeOpaque(value, nfs4_prot.NFS4_DEVICEID4_SIZE);
}
public void xdrDecode(XdrDecodingStream xdr)
throws OncRpcException, IOException {
value = xdr.xdrDecodeDynamicOpaque();
value = xdr.xdrDecodeOpaque(nfs4_prot.NFS4_DEVICEID4_SIZE);
}
@Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment