1. 22 7月, 2011 6 次提交
    • O
      remote/ssh: optional "keyfile" parameter. · 6b01c83a
      Oskari Saarenmaa 提交于
      New optional parameter "keyfile" for ssh transport allows the user to select
      the private key to be used to authenticate to the remote host.
      6b01c83a
    • D
      Refactor the certification validation code · 637711cb
      Daniel P. Berrange 提交于
      There is some commonality between the code for sanity checking
      certs when initializing libvirt and the code for validating
      certs during a live TLS session handshake. This patchset splits
      up the sanity checking function into several smaller functions
      each doing a specific type of check. The cert validation code
      is then updated to also call into these functions
      
      * src/rpc/virnettlscontext.c: Refactor cert validation code
      637711cb
    • D
      Remove call to deprecated gnutls_certificate_type_set_priority (again) · 3b8061c7
      Daniel P. Berrange 提交于
      The gnutls_certificate_type_set_priority method is deprecated.
      Since we already set the default gnutls priority, it was not
      serving any useful purpose and can be removed
      
      * src/rpc/virnettlscontext.c: Remove gnutls_certificate_type_set_priority
        call
      3b8061c7
    • D
      Ensure that libvirtd shuts down if initialization fails · 92509413
      Daniel P. Berrange 提交于
      If the virStateInitialize call fails we must shutdown libvirtd
      since drivers will not be available. Just free'ing the virNetServer
      is not sufficient, we must send a SIGTERM to ourselves so that
      we interrupt the event loop and trigger a orderly shutdown
      
      * daemon/libvirtd.c: Kill ourselves if state init fails
      * src/rpc/virnetserver.c: Add some debugging to event loop
      92509413
    • A
      Add virDomainBlockPull support to the remote driver · 4daeefac
      Adam Litke 提交于
      The generator can handle everything except virDomainGetBlockJobInfo().
      
      * src/remote/remote_protocol.x: provide defines for the new entry points
      * src/remote/remote_driver.c daemon/remote.c: implement the client and
        server side for virDomainGetBlockJobInfo.
      * src/remote_protocol-structs: structure definitions for protocol verification
      * src/rpc/gendispatch.pl: Permit some unsigned long parameters
      4daeefac
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  2. 21 7月, 2011 2 次提交
    • M
      rpc: Make the dispatch generator handle 'void name(void)' style procedures · fbd5465a
      Matthias Bolte 提交于
      The only 'void name(void)' style procedure in the protocol is 'close' that
      is handled special, but also programming errors like a missing _args or
      _ret suffix on the structs in the .x files can create such a situation by
      accident. Making the generator aware of this avoids bogus errors from the
      generator such as:
      
        Use of uninitialized value in exists at ./rpc/gendispatch.pl line 967.
      
      Also this allows to get rid of the -c option and the special case code for
      the 'close' procedure, as the generator handles it now correctly.
      
      Reported by Michal Privoznik
      fbd5465a
    • C
      rpc: Pass through DISPLAY so ssh can launch askpass · e0a21dfe
      Cole Robinson 提交于
      Though we prefer users to have SSH keys setup, virt-manager users still
      depend on remote SSH connections to launch a password dialog. This fixes
      launch ssh-askpass
      
      Fix suggested by danpb
      e0a21dfe
  3. 20 7月, 2011 4 次提交
  4. 19 7月, 2011 7 次提交
    • D
      Add sanity checking of basic constraints, key purpose & key usage · 79591d4f
      Daniel P. Berrange 提交于
      Gnutls requires that certificates have basic constraints present
      to be used as a CA certificate. OpenSSL doesn't add this data
      by default, so add a sanity check to catch this situation. Also
      validate that the key usage and key purpose constraints contain
      correct data
      
      * src/rpc/virnettlscontext.c: Add sanity checking of certificate
        constraints
      79591d4f
    • D
      Add some basic sanity checking of certificates before use · 543c266d
      Daniel P. Berrange 提交于
      If the libvirt daemon or libvirt client is configured with bogus
      certificates, it is very unhelpful to only find out about this
      when a TLS connection is actually attempted. Not least because
      the error messages you get back for failures are incredibly
      obscure.
      
      This adds some basic sanity checking of certificates at the
      time the virNetTLSContext object is created. This is at libvirt
      startup, or when creating a virNetClient instance.
      
      This checks that the certificate expiry/start dates are valid
      and that the certificate is actually signed by the CA that is
      loaded.
      
      * src/rpc/virnettlscontext.c: Add certificate sanity checks
      543c266d
    • D
      Add an explicit virNetClientClose method · e06c8ede
      Daniel P. Berrange 提交于
      Since the I/O callback registered against virNetSocket will
      hold a reference on the virNetClient, we can't rely on the
      virNetClientFree to be able to close the network connection.
      The last reference will only go away when the event callback
      fires (likely due to EOF from the server).
      
      This is sub-optimal and can potentially cause a leak of the
      virNetClient object if the server were to not explicitly
      close the socket itself
      
      * src/remote/remote_driver.c: Explicitly close the client
        object when disconnecting
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Add a
        virNetClientClose method
      e06c8ede
    • D
      Use a virFreeCallback on virNetSocket to ensure safe release · 7ea2ef4c
      Daniel P. Berrange 提交于
      When unregistering an I/O callback from a virNetSocket object,
      there is still a chance that an event may come in on the callback.
      In this case it is possible that the virNetSocket might have been
      freed already. Make use of a virFreeCallback when registering
      the I/O callbacks and hold a reference for the entire time the
      callback is set.
      
      * src/rpc/virnetsocket.c: Register a free function for the
        file handle watch
      * src/rpc/virnetsocket.h, src/rpc/virnetserverservice.c,
        src/rpc/virnetserverclient.c, src/rpc/virnetclient.c: Add
        a free function for the socket I/O watches
      7ea2ef4c
    • D
      Add mutex locking and reference counting to virNetSocket · 6198f3a1
      Daniel P. Berrange 提交于
      Remove the need for a virNetSocket object to be protected by
      locks from the object using it, by introducing its own native
      locking and reference counting
      
      * src/rpc/virnetsocket.c: Add locking & reference counting
      6198f3a1
    • D
      Add some debugging for virNetClient reference counting · 06c0d184
      Daniel P. Berrange 提交于
      * src/rpc/virnetclient.c: Add debugging of ref counts
      06c0d184
    • D
      Unregister event callback if a fatal error occurs during dispatch · 07b39a94
      Daniel P. Berrange 提交于
      If we get an I/O error in the async event callback for an RPC
      client, we might not have consumed all pending data off the
      wire. This could result in the callback being immediately
      invoked again. At which point the same I/O might occur. And
      we're invoked again. And again...And again...
      
      Unregistering the async event callback if an error occurs is
      a good safety net. The real error will be seen when the next
      RPC method is invoked
      
      * src/rpc/virnetclient.c: Unregister event callback on error
      07b39a94
  5. 17 7月, 2011 1 次提交
    • O
      rpc: Fix typos in rpc generator scripts · 92f0a7f5
      Osier Yang 提交于
      These typos are introduced by file renaming in commit b17b4afa.
      
      src/remote/qemu_protocol.x \
      src/remote/remote_protocol.x \
      src/rpc/gendispatch.pl:
          s/remote_generator/gendispatch/
      
      src/rpc/genprotocol.pl:
          s/remote\/remote_protocol/remote_protocol/
      92f0a7f5
  6. 15 7月, 2011 3 次提交
    • D
      Fix error message for missing TLS write function · c8771867
      Daniel P. Berrange 提交于
      * src/rpc/virnettlscontext.c: s/read/write/
      c8771867
    • D
      Fix reporting of cert validation failures · f2845177
      Daniel P. Berrange 提交于
      If the server succesfully validates the client cert, it will send
      back a single byte, under TLS. If it fails, it will close the
      connection. In this case, we were just reporting the standard
      I/O error. The original RPC code had a special case hack for the
      GNUTLS_E_UNEXPECTED_PACKET_LENGTH error code to make us report
      a more useful error message
      
      * src/rpc/virnetclient.c: Return ENOMSG if we get
        GNUTLS_E_UNEXPECTED_PACKET_LENGTH
      * src/rpc/virnettlscontext.c: Report cert failure if we
        see ENOMSG
      f2845177
    • E
      virnetsocket: use new API for uniform child cleanup · a59a99f2
      Eric Blake 提交于
      Rather than trying to clean up the ssh child ourselves, and risk
      subtle differences from the socket creation error path, we can
      just use the new APIs.
      
      * src/rpc/virnetsocket.c (virNetSocketFree): Use new function.
      a59a99f2
  7. 13 7月, 2011 3 次提交
    • E
      maint: print flags in hex during debug · 06dbfa6d
      Eric Blake 提交于
      Continuation of commit 313ac7fd, and enforce things with a syntax
      check.
      
      Technically, virNetServerClientCalculateHandleMode is not printing
      a mode_t, but rather a collection of VIR_EVENT_HANDLE_* bits;
      however, these bits are < 8, so there is no different in the
      output, and that was the easiest way to silence the new syntax check.
      
      * cfg.mk (sc_flags_debug): New syntax check.
      (exclude_file_name_regexp--sc_flags_debug): Add exemptions.
      * src/fdstream.c (virFDStreamOpenFileInternal): Print flags in
      hex, mode_t in octal.
      * src/libvirt-qemu.c (virDomainQemuMonitorCommand)
      (virDomainQemuAttach): Likewise.
      * src/locking/lock_driver_nop.c (virLockManagerNopInit): Likewise.
      * src/locking/lock_driver_sanlock.c (virLockManagerSanlockInit):
      Likewise.
      * src/locking/lock_manager.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/qemu/qemu_monitor.c: Likewise.
      * src/rpc/virnetserverclient.c
      (virNetServerClientCalculateHandleMode): Print mode with %o.
      06dbfa6d
    • D
      Ensure signal handler propagates fatal signals to default handler · 83d768fa
      Daniel P. Berrange 提交于
      When replacing the default SEGV/ABORT/BUS signal handlers you
      can't rely on the process being terminated after your custom
      handler runs. It is neccessary to manually restore the default
      handler and then re-raise the signal
      
      * src/rpc/virnetserver.c: Restore default handler and raise
        signal
      83d768fa
    • D
      Remove unused virNetServerProgramErrorHander typedef · 1a81687a
      Daniel P. Berrange 提交于
      * src/rpc/virnetserverprogram.h: Remove unused typedef for
        virNetServerProgramErrorHander function callback
      * daemon/remote.h: Remove decl for non-existant variables
      1a81687a
  8. 12 7月, 2011 4 次提交
  9. 11 7月, 2011 1 次提交
  10. 09 7月, 2011 1 次提交
  11. 08 7月, 2011 5 次提交
    • D
      Fix sending of reply to final RPC message · 3cfdc57b
      Daniel P. Berrange 提交于
      The dispatch for the CLOSE RPC call was invoking the method
      virNetServerClientClose(). This caused the client connection
      to be immediately terminated. This meant the reply to the
      final RPC message was never sent. Prior to the RPC rewrite
      we merely flagged the connection for closing, and actually
      closed it when the next RPC call dispatch had completed.
      
      * daemon/remote.c: Flag connection for a delayed close
      * daemon/stream.c: Update to use new API for closing
        failed connection
      * src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
        Add support for a delayed connection close. Rename the
        virNetServerClientMarkClose method to virNetServerClientImmediateClose
        to clarify its semantics
      3cfdc57b
    • D
      Fix release of outgoing stream confirmation/abort message · 2c85644b
      Daniel P. Berrange 提交于
      When sending back the final OK or ERROR message on completion
      of a stream, we were not decrementing the 'nrequests' tracker
      on the client. With the default requests limit of '5', this
      meant once a client had created 5 streams, they are unable to
      process any further RPC calls.  There was also a bug when
      handling an error from decoding a message length header, which
      meant a client connection would not immediately be closed.
      
      * src/rpc/virnetserverclient.c: Fix release of request after
        stream completion & mark client for close on error
      2c85644b
    • D
      Fix leak of 'msg' object in client stream code · 927dfcf6
      Daniel P. Berrange 提交于
      In one exit path we forgot to free the virNetMessage object causing
      a large memory leak for streams which send a lot of data. Some other
      paths were calling VIR_FREE directly instead of virNetMessageFree
      although this was (currently) harmless.
      
      * src/rpc/virnetclientstream.c: Fix leak of msg object
      * src/rpc/virnetclientprogram.c: Call virNetMessageFree instead
        of VIR_FREE
      927dfcf6
    • D
      Fix mistaken order of server cert/key parameters in constructor · c2ddd536
      Daniel P. Berrange 提交于
      The virNetTLSContextNew was being passed key/cert parameters in
      the wrong order. This wasn't immediately visible because if
      virNetTLSContextNewPath was used, a second bug reversed the order
      of those parameters again.
      
      Only if the paths were manually specified in /etc/libvirt/libvirtd.conf
      did the bug appear
      
      * src/rpc/virnettlscontext.c: Fix order of params passed to
        virNetTLSContextNew
      c2ddd536
    • E
      build: use gnulib pthread_sigmask · 8437e738
      Eric Blake 提交于
      Gnulib finally learned how to do pthread_sigmask on mingw.
      
      * .gnulib: Update to latest, for pthread_sigmask.
      * bootstrap.conf (gnulib_modules): Add pthread_sigmask.
      * configure.ac (AC_CHECK_FUNCS): Drop redundant check.
      * src/rpc/virnetclient.c (virNetClientSetTLSSession)
      (virNetClientIOEventLoop): Make code unconditional.
      * src/util/command.c (virFork): Likewise.
      * tools/virsh.c (doMigrate, cmdMigrate): Likewise.
      8437e738
  12. 04 7月, 2011 3 次提交
    • E
      rpc: silence coverity warning · dd0c42ab
      Eric Blake 提交于
      Coverity noted that 4 out of 5 calls to virNetClientStreamRaiseError
      checked the return value.  This case expects a particular value, so
      warn if our expectations went wrong due to some bug elsewhere.
      
      * src/rpc/virnetclient.c (virNetClientCallDispatchStream): Warn on
        unexpected scenario.
      dd0c42ab
    • E
      rpc: avoid memory leak on error · 6e07f72e
      Eric Blake 提交于
      Detected by Coverity.  The leak is on an error path, but I'm not
      sure whether that path is likely to be triggered in practice.
      
      * src/rpc/virnetserverservice.c (virNetServerServiceAccept): Plug leak.
      6e07f72e
    • E
      rpc: fix logic bug · 2aa83b43
      Eric Blake 提交于
      Spotted by Coverity.  If we don't update tmp each time through
      the loop, then if the filter being removed was not the head of
      the list, we accidentally lose all filters prior to the one we
      wanted to remove.
      
      * src/rpc/virnetserverclient.c (virNetServerClientRemoveFilter):
          Don't lose unrelated filters.
      2aa83b43