2017-04-21 14:14 GMT+03:00 Michal Privoznik <mprivozn(a)redhat.com>:
That's how strings are encoded in RPC. the first four bytes say
how long the
string is followed by N bytes (padded to 4 bytes boundary) of the actual
string.
I know, I'm use
https://godoc.org/github.com/davecgh/go-xdr/xdr2 and
as i see EncodeString already to that. And all other functions what
operates on strings works fine. Fow example LookupDomainByName. Or
StoragePool functions
Bad payload from own prog:
0x0000: 6001 2a87 006c 0640 2a04 ac00 0006 0001 `.*..l.@*.......
0x0010: 0000 0000 0000 0001 2a04 ac00 0004 0010 ........*.......
0x0020: 0ec4 7aff fe54 cb0a e8b2 407d e44c 1249 ..z..T....(a)}.L.I
0x0030: eafc 4a72 8018 00e1 ffba 0000 0101 080a ..Jr............
0x0040: 2ef0 9ea7 02ad afcb 0000 004c 2000 8086 ...........L....
0x0050: 0000 0001 0000 00c9 0000 0000 0000 0009 ................
0x0060: 0000 0000 0000 0006 3134 3331 3737 0000 ........143177..
0x0070: 49bf 97e1 4bda 5749 ca89 0000 7db6 2f02 I...K.WI....}./.
0x0080: 0000 0001 0000 0007 7365 7269 616c 3000 ........serial0.
0x0090: 0000 0001 ....
Good payload from virsh:
0x0000: 6009 09de 0070 0640 2a04 ac00 0006 0001 `....p.@*.......
0x0010: 0000 0000 0000 0001 2a04 ac00 0004 0010 ........*.......
0x0020: 0ec4 7aff fe54 cb0a e8a8 407d e159 1a3e ..z..T....(a)}.Y.>
0x0030: 2e25 4a72 8018 00ea ffbe 0000 0101 080a .%Jr............
0x0040: 2eed 6e7c 02ac e3be 0000 0050 2000 8086 ..n|.......P....
0x0050: 0000 0001 0000 00c9 0000 0000 0000 0009 ................
0x0060: 0000 0000 0000 0006 3134 3331 3737 0000 ........143177..
0x0070: 49bf 97e1 4bda 5749 ca89 0000 7db6 2f02 I...K.WI....}./.
0x0080: 0000 0001 0000 0001 0000 0007 7365 7269 ............seri
0x0090: 616c 3000 0000 0000 al0.....
Good payload from own prog append Flags before dev_name and after:
0x0000: 6001 84e3 0070 0640 2a04 ac00 0006 0001 `....p.@*.......
0x0010: 0000 0000 0000 0001 2a04 ac00 0004 0010 ........*.......
0x0020: 0ec4 7aff fe54 cb0a e8b6 407d 9e48 cd8b ..z..T....(a)}.H..
0x0030: e141 7380 8018 00e1 ffbe 0000 0101 080a .As.............
0x0040: 2ef2 d3de 02ae 3d19 0000 0050 2000 8086 ......=....P....
0x0050: 0000 0001 0000 00c9 0000 0000 0000 0009 ................
0x0060: 0000 0000 0000 0006 3134 3331 3737 0000 ........143177..
0x0070: 49bf 97e1 4bda 5749 ca89 0000 7db6 2f02 I...K.WI....}./.
0x0080: 0000 0001 0000 0001 0000 0007 7365 7269 ............seri
0x0090: 616c 3000 0000 0001 al0.....
So i think that in case of function Open conse Libvirt send to remote
server flags twice. Before dev_name and after.
Do you have any comments ?
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru