1. 04 11月, 2015 1 次提交
  2. 12 8月, 2015 1 次提交
  3. 17 7月, 2015 1 次提交
    • D
      rpc: ensure daemon is spawn even if dead socket exists · 406ee8c2
      Daniel P. Berrange 提交于
      The auto-spawn code would originally attempt to spawn the
      daemon for both ENOENT and ECONNREFUSED errors from connect().
      The various refactorings eventually lost this so we only
      spawn the daemon on ENOENT. The result is if the daemon exits
      uncleanly, so that the socket is left in the filesystem, we
      will never be able to auto-spawn the daemon again.
      406ee8c2
  4. 19 6月, 2015 2 次提交
    • M
      virNetSocket: Fix @watch corner case · 9ee5a798
      Michal Privoznik 提交于
      Although highly unlikely, nobody says that virEventAddHandle()
      can't return 0 as a handle to socket callback. It can't happen
      with our default implementation since all watches will have value
      1 or greater, but users can register their own callback functions
      (which can re-use unused watch IDs for instance). If this is the
      case, weird things may happen.
      
      Also, there's a little bug I'm fixing too, upon
      virNetSocketRemoveIOCallback(), the variable holding callback ID
      was not reset. Therefore calling AddIOCallback() once again would
      fail. Not that we are doing it right now, but we might.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      9ee5a798
    • M
      virNetSocketRemoveIOCallback: Be explicit about unref · 899e49a2
      Michal Privoznik 提交于
      When going through the code I've notice that
      virNetSocketAddIOCallback() increases the reference counter of
      @socket. However, its counter part RemoveIOCallback does not. It took
      me a while to realize this disproportion. The AddIOCallback registers
      our own callback which eventually calls the desired callback and then
      unref the @sock. Yeah, a bit complicated but it works. So, lets note
      this hard learned fact in a comment in RemoveIOCallback().
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      899e49a2
  5. 11 6月, 2015 2 次提交
  6. 24 4月, 2015 1 次提交
    • J
      Fix memory leak in virNetSocketNewConnectUNIX · da4d7c30
      Jiri Denemark 提交于
      ==26726==    by 0x673CD67: __vasprintf_chk (vasprintf_chk.c:80)
      ==26726==    by 0x5673605: UnknownInlinedFun (stdio2.h:210)
      ==26726==    by 0x5673605: virVasprintfInternal (virstring.c:476)
      ==26726==    by 0x56736EE: virAsprintfInternal (virstring.c:497)
      ==26726==    by 0x5680C37: virGetUserRuntimeDirectory (virutil.c:866)
      ==26726==    by 0x5783A89: virNetSocketNewConnectUNIX (virnetsocket.c:572)
      ==26726==    by 0x57751AF: virNetClientNewUNIX (virnetclient.c:344)
      ==26726==    by 0x57689B3: doRemoteOpen (remote_driver.c:895)
      ==26726==    by 0x5769F8E: remoteConnectOpen (remote_driver.c:1195)
      ==26726==    by 0x57092DF: do_open (libvirt.c:1189)
      ==26726==    by 0x570A7BF: virConnectOpenAuth (libvirt.c:1341)
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1215042Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      da4d7c30
  7. 17 4月, 2015 1 次提交
  8. 15 4月, 2015 1 次提交
    • M
      virNetSocketNewConnectUNIX: Use flocks when spawning a daemon · be78814a
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1200149
      
      Even though we have a mutex mechanism so that two clients don't spawn
      two daemons, it's not strong enough. It can happen that while one
      client is spawning the daemon, the other one fails to connect.
      Basically two possible errors can happen:
      
        error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': Connection refused
      
      or:
      
        error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': No such file or directory
      
      The problem in both cases is, the daemon is only starting up, while we
      are trying to connect (and fail). We should postpone the connecting
      phase until the daemon is started (by the other thread that is
      spawning it). In order to do that, create a file lock 'libvirt-lock'
      in the directory where session daemon would create its socket. So even
      when called from multiple processes, spawning a daemon will serialize
      on the file lock. So only the first to come will spawn the daemon.
      Tested-by: NRichard W. M. Jones <rjones@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be78814a
  9. 20 11月, 2014 1 次提交
  10. 17 9月, 2014 1 次提交
  11. 15 9月, 2014 1 次提交
  12. 09 9月, 2014 1 次提交
  13. 05 9月, 2014 1 次提交
    • E
      maint: use consistent if-else braces in remaining spots · d194d6e7
      Eric Blake 提交于
      I'm about to add a syntax check that enforces our documented
      HACKING style of always using matching {} on if-else statements.
      
      This patch focuses on all remaining problems, where there weren't
      enough issues to warrant splitting it further.
      
      * src/remote/remote_driver.c (doRemoteOpen): Correct use of {}.
      * src/security/virt-aa-helper.c (vah_add_path, valid_path, main):
      Likewise.
      * src/rpc/virnetsocket.c (virNetSocketNewConnectLibSSH2):
      Likewise.
      * src/esx/esx_vi_types.c (esxVI_Type_FromString): Likewise.
      * src/uml/uml_driver.c (umlDomainDetachDevice): Likewise.
      * src/util/viralloc.c (virShrinkN): Likewise.
      * src/util/virbuffer.c (virBufferURIEncodeString): Likewise.
      * src/util/virdbus.c (virDBusCall): Likewise.
      * src/util/virnetdev.c (virNetDevValidateConfig): Likewise.
      * src/util/virnetdevvportprofile.c
      (virNetDevVPortProfileGetNthParent): Likewise.
      * src/util/virpci.c (virPCIDeviceIterDevices)
      (virPCIDeviceWaitForCleanup)
      (virPCIDeviceIsBehindSwitchLackingACS): Likewise.
      * src/util/virsocketaddr.c (virSocketAddrGetNumNetmaskBits):
      Likewise.
      * src/util/viruri.c (virURIParseParams): Likewise.
      * daemon/stream.c (daemonStreamHandleAbort): Likewise.
      * tests/testutils.c (virtTestResult): Likewise.
      * tests/cputest.c (cpuTestBaseline): Likewise.
      * tools/virsh-domain.c (cmdDomPMSuspend): Likewise.
      * tools/virsh-host.c (cmdNodeSuspend): Likewise.
      * src/esx/esx_vi_generator.py (Type.generate_typefromstring):
      Tweak generated code.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d194d6e7
  14. 01 9月, 2014 1 次提交
    • C
      Fix connection to already running session libvirtd · 0f03ca6d
      Christophe Fergeau 提交于
      Since 1b807f92, connecting with virsh to an already running session
      libvirtd fails with:
      $ virsh list --all
      error: failed to connect to the hypervisor
      error: no valid connection
      error: Failed to connect socket to
      '/run/user/1000/libvirt/libvirt-sock': Transport endpoint is already
      connected
      
      This is caused by a logic error in virNetSocketNewConnectUnix: even if
      the connection to the daemon socket succeeded, we still try to spawn the
      daemon and then connect to it.
      This commit changes the logic to not try to spawn libvirtd if we
      successfully connected to its socket.
      
      Most of this commit is whitespace changes, use of -w is recommended to
      look at it.
      0f03ca6d
  15. 23 8月, 2014 1 次提交
    • J
      virnetsocket: Resolve Coverity RESOURCE_LEAK · cc1bbbbe
      John Ferlan 提交于
      Since '1b807f92' - Coverity complains that in the error paths of
      both virFork() and virProcessWait() that the 'passfd' will not be closed.
      Added the VIR_FORCE_CLOSE(passfd) and initialized it to -1.
      
      Also noted that variable 'buf' was never really used - so I removed it
      cc1bbbbe
  16. 22 8月, 2014 1 次提交
  17. 03 7月, 2014 1 次提交
    • J
      Use virBufferCheckError everywhere we report OOM error · 92a8e72f
      Ján Tomko 提交于
      Replace:
      if (virBufferError(&buf)) {
          virBufferFreeAndReset(&buf);
          virReportOOMError();
          ...
      }
      
      with:
      if (virBufferCheckError(&buf) < 0)
          ...
      
      This should not be a functional change (unless some callers
      misused the virBuffer APIs - a different error would be reported
      then)
      92a8e72f
  18. 02 6月, 2014 1 次提交
  19. 29 4月, 2014 1 次提交
  20. 25 3月, 2014 1 次提交
  21. 18 3月, 2014 2 次提交
  22. 04 11月, 2013 1 次提交
    • R
      virnetsocket: fix getsockopt on FreeBSD · 8079b0e0
      Ryota Ozaki 提交于
      aa0f0992 introduced a strict error checking for getsockopt and it
      revealed that getting a peer credential of a socket on FreeBSD
      didn't work. Libvirtd hits the error:
        error : virNetSocketGetUNIXIdentity:1198 : Failed to get valid
        client socket identity groups
      
      SOL_SOCKET (0xffff) was used as a level of getsockopt for
      LOCAL_PEERCRED, however, it was wrong. 0 is correct as well as
      Mac OS X.
      
      So for LOCAL_PEERCRED our options are SOL_LOCAL (if defined) or
      0 on Mac OS X and FreeBSD. According to the fact, the patch
      simplifies the code by removing ifdef __APPLE__.
      
      I tested the patch on FreeBSD 8.4, 9.2 and 10.0-BETA1.
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      8079b0e0
  23. 22 10月, 2013 1 次提交
  24. 21 10月, 2013 1 次提交
  25. 17 10月, 2013 1 次提交
    • B
      better error checking for LOCAL_PEERCRED · aa0f0992
      Brian Candler 提交于
      This patch improves the error checking in the LOCAL_PEERCRED version
      of virNetSocketGetUNIXIdentity, used by FreeBSD and Mac OSX.
      
      1. The error return paths now correctly unlock the socket. This is
      implemented in exactly the same way as the SO_PEERCRED version,
      using "goto cleanup"
      
      2. cr.cr_ngroups is initialised to -1, and cr.cr_ngroups is checked
      for negative and overlarge values.
      
      This means that if the getsockopt() call returns success but doesn't
      actually update the xucred structure, this is now caught. This
      happened previously when getsockopt was called with SOL_SOCKET
      instead of SOL_LOCAL, prior to commit 5a468b38, and resulted in
      random uids being accepted.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      aa0f0992
  26. 11 10月, 2013 1 次提交
  27. 07 10月, 2013 1 次提交
    • R
      rpc: fix getsockopt for LOCAL_PEERCRED on Mac OS X · 5a468b38
      Ryota Ozaki 提交于
      This fixes the following error:
        error : virGetUserEnt:703 : Failed to find user record for uid '32654'
      
      '32654' (it's random and varies) comes from getsockopt with
      LOCAL_PEERCRED option. getsockopt returns w/o error but seems
      to not set any value to the buffer for uid.
      
      For Mac OS X, LOCAL_PEERCRED has to be used with SOL_LOCAL level.
      With SOL_LOCAL, getsockopt returns a correct uid.
      
      Note that SOL_LOCAL can be found in
      /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/un.h.
      Signed-off-by: NRyota Ozaki <ozaki.ryota@gmail.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5a468b38
  28. 28 9月, 2013 2 次提交
  29. 24 9月, 2013 1 次提交
  30. 12 7月, 2013 1 次提交
    • P
      remote: Improve libssh2 password authentication · 273745b4
      Peter Krempa 提交于
      This patch enables the password authentication in the libssh2 connection
      driver. There are a few benefits to this step:
      
      1) Hosts with challenge response authentication will now be supported
      with the libssh2 connection driver.
      
      2) Credential for hosts can now be stored in the authentication
      credential config file
      273745b4
  31. 11 7月, 2013 1 次提交
  32. 10 7月, 2013 1 次提交
  33. 23 5月, 2013 1 次提交
  34. 21 5月, 2013 1 次提交
  35. 08 5月, 2013 2 次提交