1. 24 6月, 2016 2 次提交
  2. 05 5月, 2016 2 次提交
    • M
      virNetServerClientNewPostExecRestart: Avoid align problems · b17e610e
      Michal Privoznik 提交于
      I've noticed this while trying to compile libvirt on my arm box.
      
        CC       rpc/libvirt_net_rpc_server_la-virnetserverclient.lo
      rpc/virnetserverclient.c: In function 'virNetServerClientNewPostExecRestart':
      rpc/virnetserverclient.c:516:45: error: cast increases required alignment of target type [-Werror=cast-align]
                                                   (long long *) &timestamp) < 0) {
                                                   ^
      cc1: all warnings being treated as errors
      
      Problem is, @timestap is defined as time_t which is 32 bits long,
      and we are typecasting it to long long which is 64bits long.
      Solution is to make @timestamp type of long long. At the same
      time, we can make @conn_time in _virNetServerClient struct long
      long too. There is no need for it to be type of time_t.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b17e610e
    • M
      virNetServerClientNewPostExecRestart: Drop useless typecasts · 2a3a2c2f
      Michal Privoznik 提交于
      In this function, @id is defined as unsigned long long. When
      passing this variable to virJSONValueObjectGetNumberUlong(),
      well address of this variable, it's typecasted to ull*. There
      is no need for that. It's a same story with @nrequests_max.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2a3a2c2f
  3. 03 5月, 2016 6 次提交
    • E
      virnetserverclient: Add an internal method to retrieve client's identity · 8420a53e
      Erik Skultety 提交于
      This method just aggregates various client object attributes, like socket
      address, connection type (RO/RW), and some TCP/TLS/UNIX identity in an atomic
      manner.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      8420a53e
    • E
      virneserverclient: Introduce virNetServerClientHasSASLSession · bde2cb61
      Erik Skultety 提交于
      We do have a similar method, serving the same purpose, for TLS, but we lack
      one for SASL. So introduce one, in order for other modules to be able to find
      out, if a SASL session is active, or better said, that a SASL session exists
      at all.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      bde2cb61
    • E
      virnetsocket: Provide socket address format in a more standard form · 9b45c9f0
      Erik Skultety 提交于
      Our socket address format is in a rather non-standard format and that is
      because sasl library requires the IP address and service to be delimited by a
      semicolon. The string form is a completely internal matter, however once the
      admin interfaces to retrieve client identity information are merged, we should
      return the socket address string in a common format, e.g. format defined by
      URI rfc-3986, i.e. the IP address and service are delimited by a colon and
      in case of an IPv6 address, square brackets are added:
      
      Examples:
          127.0.0.1:1234
          [::1]:1234
      
      This patch changes our default format to the one described above, while adding
      separate methods to request the non-standard SASL format using semicolon as a
      delimiter.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      9b45c9f0
    • E
      rpc: virnetserverclient: Implement client connection transport retrieval · 42b06aa6
      Erik Skultety 提交于
      Although we document 6 types of transport that we support, internally we can
      only differentiate between TCP, TLS, and UNIX transports only, since both SSH
      and libssh2 transports, due to using netcat, behave in the exactly the same
      way as a UNIX socket.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      42b06aa6
    • E
      rpc: virnetserverclient: Introduce new attribute conn_time to client · a32135b3
      Erik Skultety 提交于
      Besides ID, libvirt should provide several parameters to help the user
      distinguish two clients from each other. One of them is the connection
      timestamp. This patch also adds a testcase for proper JSON formatting of the
      new attribute too (proper formatting of older clients that did not support
      this attribute yet is included in the existing tests) - in order to
      testGenerateJSON to work, a mock of time_t time(time_t *timer) needed to be
      created.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      a32135b3
    • E
      rpc: virnetserverclient: Identify clients by an integer ID · 5841d64d
      Erik Skultety 提交于
      Admin API needs a way of addressing specific clients. Unlike servers, which we
      are happy to address by names both because its name reflects its purpose (to
      some extent) and we only have two of them (so far), naming clients doesn't make
      any sense, since a) each client is an anonymous, i.e. not recognized after a
      disconnect followed by a reconnect, b) we can't predict what kind of requests
      it's going to send to daemon, and c) the are loads of them comming and going,
      so the only viable option is to use an ID which is of a reasonably wide data
      type.
      Signed-off-by: NErik Skultety <eskultet@redhat.com>
      5841d64d
  4. 12 1月, 2016 1 次提交
    • B
      rpc: Don't rewrite msg->fds on every read dispatch · 133c511b
      Ben Gray 提交于
      When we are receiving data in smaller chunks it might happen that
      virNetServerClientDispatchRead() will be called multiple times.  And as
      that happens, if it is a message that also transfer headers, we decode
      the number of them every single time and, unfortunately, also allocate
      the memory for them.  That causes a leak, in the best scenario.
      
      Best viewed with '-w'.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      133c511b
  5. 05 6月, 2015 1 次提交
  6. 25 3月, 2015 2 次提交
    • P
      rpc: Don't unref identity object while callbacks still can be executed · a98129c0
      Peter Krempa 提交于
      While this thread is cleaning up the client and connection objects:
       #2  virFileReadAll (path=0x7f28780012b0 "/proc/1319/stat", maxlen=maxlen@entry=1024, buf=buf@entry=0x7f289c60fc40) at util/virfile.c:1287
       #3  0x00007f28adbb1539 in virProcessGetStartTime (pid=<optimized out>, timestamp=timestamp@entry=0x7f289c60fc98) at util/virprocess.c:838
       #4  0x00007f28adb91981 in virIdentityGetSystem () at util/viridentity.c:151
       #5  0x00007f28ae73f17c in remoteClientFreeFunc (data=<optimized out>) at remote.c:1131
       #6  0x00007f28adcb7f33 in virNetServerClientDispose (obj=0x7f28aecad180) at rpc/virnetserverclient.c:858
       #7  0x00007f28adba8eeb in virObjectUnref (anyobj=<optimized out>) at util/virobject.c:265
       #8  0x00007f28ae74ad05 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7f28aec93ff0) at rpc/virnetserver.c:205
       #9  0x00007f28adbbef4e in virThreadPoolWorker (opaque=opaque@entry=0x7f28aec88030) at util/virthreadpool.c:145
      
      In stack frame #6 the client->identity object got unref'd, but the code
      that removes the event callbacks in frame #5 did not run yet as we are
      trying to obtain the system identity (frames #4, #3, #2).
      
      In other thead:
       #0  virObjectUnref (anyobj=anyobj@entry=0x7f288c162c60) at util/virobject.c:264
              klass = 0xdeadbeef
              obj = 0x7f288c162c60
       #1  0x00007f28ae71c709 in remoteRelayDomainEventCheckACL (client=<optimized out>, conn=<optimized out>, dom=dom@entry=0x7f28aecaafc0) at remote.c:164
       #2  0x00007f28ae71fc83 in remoteRelayDomainEventTrayChange (conn=<optimized out>, dom=0x7f28aecaafc0, ... ) at remote.c:717
       #3  0x00007f28adc04e53 in virDomainEventDispatchDefaultFunc (conn=0x7f287c0009a0, event=0x7f28aecab1a0, ...) at conf/domain_event.c:1455
       #4  0x00007f28adc03831 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, ....) at conf/object_event.c:724
       #5  virObjectEventStateQueueDispatch (callbacks=0x7f288c083730, queue=0x7fff51f90030, state=0x7f288c18da20) at conf/object_event.c:738
       #6  virObjectEventStateFlush (state=0x7f288c18da20) at conf/object_event.c:816
       #7  virObjectEventTimer (timer=<optimized out>, opaque=0x7f288c18da20) at conf/object_event.c:562
       #8  0x00007f28adb859cd in virEventPollDispatchTimeouts () at util/vireventpoll.c:459
      
      Frame #0 is unrefing an invalid identity object while frame #2 hints
      that the client is still dispatching the event.
      
      For untrimmed backtrace see the bugzilla attachment.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1203030
      a98129c0
    • P
      6c7bdcb1
  7. 10 3月, 2015 1 次提交
  8. 15 11月, 2014 1 次提交
  9. 24 9月, 2014 1 次提交
  10. 25 3月, 2014 1 次提交
  11. 21 3月, 2014 1 次提交
  12. 18 3月, 2014 2 次提交
  13. 14 1月, 2014 1 次提交
  14. 13 1月, 2014 1 次提交
    • J
      Don't crash if a connection closes early · 173c2914
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1047577
      
      When a client closes its connection to libvirtd early during
      virConnectOpen, more specifically just after making
      REMOTE_PROC_CONNECT_SUPPORTS_FEATURE call to check if
      VIR_DRV_FEATURE_PROGRAM_KEEPALIVE is supported without even waiting for
      the result, libvirtd may crash due to a race in keep-alive
      initialization. Once receiving the REMOTE_PROC_CONNECT_SUPPORTS_FEATURE
      call, the daemon's event loop delegates it to a worker thread. In case
      the event loop detects EOF on the connection and calls
      virNetServerClientClose before the worker thread starts to handle
      REMOTE_PROC_CONNECT_SUPPORTS_FEATURE call, client->keepalive will be
      disposed by the time virNetServerClientStartKeepAlive gets called from
      remoteDispatchConnectSupportsFeature. Because the flow is common for
      both authenticated and read-only connections, even unprivileged clients
      may cause the daemon to crash.
      
      To avoid the crash, virNetServerClientStartKeepAlive needs to check if
      the connection is still open before starting keep-alive protocol.
      
      Every libvirt release since 0.9.8 is affected by this bug.
      173c2914
  15. 04 12月, 2013 2 次提交
  16. 24 9月, 2013 1 次提交
  17. 18 9月, 2013 1 次提交
  18. 10 7月, 2013 1 次提交
  19. 30 5月, 2013 1 次提交
  20. 23 5月, 2013 1 次提交
  21. 21 5月, 2013 1 次提交
  22. 08 5月, 2013 2 次提交
  23. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  24. 20 3月, 2013 1 次提交
  25. 19 3月, 2013 2 次提交
  26. 14 3月, 2013 1 次提交
    • D
      Re-add DTrace probes on 'dispose' functions · ad9ea4a9
      Daniel P. Berrange 提交于
      When converting to virObject, the probes on the 'Free' functions
      were removed on the basis that there is a probe on virObjectFree
      that suffices. This puts a burden on people writing probe scripts
      to identify which object is being dispose. This adds back probes
      in the 'Dispose' functions and updates the rpc monitor systemtap
      example to use them
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ad9ea4a9
  27. 13 3月, 2013 1 次提交
    • D
      Remove hack using existance of an 'identity' string to disable auth · be27de6e
      Daniel P. Berrange 提交于
      Currently the server determines whether authentication of clients
      is complete, by checking whether an identity is set. This patch
      removes that lame hack and replaces it with an explicit method
      for changing the client auth code
      
      * daemon/remote.c: Update for new APis
      * src/libvirt_private.syms, src/rpc/virnetserverclient.c,
        src/rpc/virnetserverclient.h: Remove virNetServerClientGetIdentity
        and virNetServerClientSetIdentity, adding a new method
        virNetServerClientSetAuth.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      be27de6e
  28. 29 1月, 2013 1 次提交
    • P
      rpc: Fix crash on error paths of message dispatching · 46532e3e
      Peter Krempa 提交于
      This patch resolves CVE-2013-0170:
      https://bugzilla.redhat.com/show_bug.cgi?id=893450
      
      When reading and dispatching of a message failed the message was freed
      but wasn't removed from the message queue.
      
      After that when the connection was about to be closed the pointer for
      the message was still present in the queue and it was passed to
      virNetMessageFree which tried to call the callback function from an
      uninitialized pointer.
      
      This patch removes the message from the queue before it's freed.
      
      * rpc/virnetserverclient.c: virNetServerClientDispatchRead:
          - avoid use after free of RPC messages
      46532e3e