edward6018 / libnetconf

Automatically exported from code.google.com/p/libnetconf
Other
0 stars 0 forks source link

Handling invalid XML configuration received #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi guys,

Ran into this issue while testing a couple of configurations.

** What steps will reproduce the problem?
1. Send an invalid (syntax incorrect) XML configuration file

** What is the expected output? What do you see instead?
Expected an error message ('Malformed message') to be returned to the client.
Instead, the session gets dropped without any error message on the client side. 

** What version of the product are you using? On what operating system?
Using the tip of libnetconf master branch at this moment (commit tag 
e559385d7f33052df5a4d16adbb65d679f7111aa)

** Please provide any additional information below.
From within the code (libnetconf/src/session.c) at function 
'nc_session_receive' the malformed_msg label is hit as expected. However the 
call to 'nc_session_send_reply' has the 'rpc' parameter set to NULL which 
immediately fails without sending any error message to the client.

Regards
Dirk vd Merwe

Original issue reported on code.google.com by dirk.van...@netronome.com on 30 Oct 2014 at 10:35

GoogleCodeExporter commented 9 years ago
I have the same problem but there is some different thing.

When I send an invalid (syntax incorrect) XML configuration file, the first 
time I edit this module, server accept the xml config and write to the 
datastore without check. Like below,

netconf> edit-config running

  Type the edit configuration data (close editor by Ctrl-D):
<toaster xmlns="http://netconfcentral.org/ns/toaster">
<hello/>
</toaster >

  Result OK
netconf> get-config running

  Result:
<toaster xmlns="http://netconfcentral.org/ns/toaster">
    <hello/>
  </toaster><netopeer xmlns="urn:cesnet:tmc:netopeer:1.0">
    <modules>
      <module>
        <name>toaster</name>
        <enabled>true</enabled>
      </module>
    </modules>
</netopeer>

Original comment by allenray...@gmail.com on 7 Nov 2014 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by rkre...@cesnet.cz on 7 Nov 2014 at 10:21

GoogleCodeExporter commented 9 years ago
This issue was closed by revision ba1a489df35c.

Original comment by rkre...@cesnet.cz on 7 Nov 2014 at 10:23

GoogleCodeExporter commented 9 years ago
Please verify, that the fix works correctly. Note, that this works only for 
NETCONF v1.1, v1.0 do not behave this way.

Original comment by rkre...@cesnet.cz on 7 Nov 2014 at 10:24