1. 04 2月, 2020 1 次提交
  2. 29 1月, 2020 5 次提交
  3. 23 1月, 2020 1 次提交
  4. 17 1月, 2020 1 次提交
  5. 03 1月, 2020 1 次提交
  6. 20 12月, 2019 1 次提交
  7. 10 12月, 2019 1 次提交
  8. 14 11月, 2019 1 次提交
  9. 13 11月, 2019 1 次提交
  10. 12 11月, 2019 1 次提交
  11. 25 10月, 2019 1 次提交
  12. 21 10月, 2019 1 次提交
  13. 15 10月, 2019 1 次提交
  14. 14 10月, 2019 1 次提交
  15. 01 10月, 2019 1 次提交
    • D
      rpc: fix escaping of shell path for netcat binary · 76d31244
      Daniel P. Berrangé 提交于
      Consider having a nc binary in the path with a space in its name,
      for example '/tmp/fo o/nc'
      
      This results in libvirt running SSH with the following arg value
      
        "'if ''/tmp/fo o/nc'' -q 2>&1 | grep \"requires
          an argument\" >/dev/null 2>&1; then ARG=-q0;
          else ARG=;fi;''/tmp/fo o/nc'' $ARG -U
          /var/run/libvirt/libvirt-sock'"
      
      The use of the single quote escaping was introduced by
      
        commit 6ac6238d
        Author: Guido Günther <agx@sigxcpu.org>
        Date:   Thu Oct 13 21:49:01 2011 +0200
      
          Use virBufferEscapeShell in virNetSocketNewConnectSSH
      
          to escape the netcat command since it's passed to the shell. Adjust
          expected test case output accordingly.
      
      While the intention of this change was good, the result is broken as it
      is still underquoted.
      
      On the SSH server side, SSH itself runs the command via the shell.
      Our command is then invoking the shell again. Thus we see
      
      $ virsh -c qemu+ssh://root@domokun/system?netcat=%2Ftmp%2Ffo%20o%2Fnc list
      error: failed to connect to the hypervisor
      error: End of file while reading data: sh: /tmp/fo: No such file or directory: Input/output error
      
      With the second level of escaping added we can now successfully use a nc
      binary with a space in the path.
      
      The original test case added was misleading as it illustrated using a
      binary path of 'nc -4' which is not a path, it is a command with a
      separate argument, which is getting interpreted as a path.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      76d31244
  16. 07 8月, 2019 1 次提交
  17. 19 7月, 2019 1 次提交
    • D
      remote: increase daemon shutdown timer to 2 minutes · 9d7fcdbf
      Daniel P. Berrangé 提交于
      Shutting down the daemon after 30 seconds of being idle is a little bit
      too aggressive. Especially when using 'virsh' in single-shot mode, as
      opposed to interactive shell mode, it would not be unusual to have
      more than 30 seconds between commands. This will lead to the daemon
      shutting down and starting up between a series of commands.
      
      Increasing the shutdown timer to 2 minutes will make it less likely that
      the daemon will shutdown while the user is in the middle of a series of
      commands.
      Reviewed-by: NJim Fehlig <jfehlig@suse.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      9d7fcdbf
  18. 12 7月, 2019 2 次提交
  19. 11 7月, 2019 2 次提交
    • D
      rpc: always pass "-T -e none" args to ssh · 1939bcd5
      Daniel P. Berrangé 提交于
      Way back in the past, the "no_tty=1" option was added for the remote
      driver to disable local password prompting by disabling use of the local
      tty:
      
        commit b32f4298
        Author: Daniel P. Berrange <berrange@redhat.com>
        Date:   Fri Sep 21 20:17:09 2007 +0000
      
          Added a no_tty param to remote URIs to stop SSH prompting for password
      
      This was done by adding "-T -o BatchMode=yes -e none" args to ssh. This
      achieved the desired results but is none the less semantically flawed
      because it is mixing up config parameters for the local tty vs the
      remote tty.
      
      The "-T" arg stops allocation of a TTY on the remote host. This is good
      for all libvirt SSH tunnels as we never require a TTY for our usage
      model, so we should have just passed this unconditionally.
      
      The "-e none" option disables the escape character for sessions with a
      TTY. If we pass "-T" this is not required, but it also not harmful to
      add it, so we should just pass it unconditionally too.
      
      Only the "-o BatchMode=yes" option is related to disabling local
      password prompts and thus needs control via the no_tty URI param.
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      1939bcd5
    • D
  20. 04 2月, 2019 1 次提交
  21. 14 12月, 2018 1 次提交
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  22. 25 7月, 2018 2 次提交
  23. 23 7月, 2018 1 次提交
    • A
      src: Make virStr*cpy*() functions return an int · 6c0d0210
      Andrea Bolognani 提交于
      Currently, the functions return a pointer to the
      destination buffer on success or NULL on failure.
      
      Not only does this kind of error handling look quite
      alien in the context of libvirt, where most functions
      return zero on success and a negative int on failure,
      but it's also somewhat pointless because unless there's
      been a failure the returned pointer will be the same
      one passed in by the user, thus offering no additional
      value.
      
      Change the functions so that they return an int
      instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      6c0d0210
  24. 04 5月, 2018 1 次提交
  25. 18 4月, 2018 1 次提交
    • M
      virobject: Introduce VIR_CLASS_NEW() macro · 10f94828
      Michal Privoznik 提交于
      So far we are repeating the following lines over and over:
      
        if (!(virSomeObjectClass = virClassNew(virClassForObject(),
                                   "virSomeObject",
                                   sizeof(virSomeObject),
                                   virSomeObjectDispose)))
            return -1;
      
      While this works, it is impossible to do some checking. Firstly,
      the class name (the 2nd argument) doesn't match the name in the
      code in all cases (the 3rd argument). Secondly, the current style
      is needlessly verbose. This commit turns example into following:
      
        if (!(VIR_CLASS_NEW(virSomeObject,
                            virClassForObject)))
            return -1;
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      10f94828
  26. 06 4月, 2018 1 次提交
    • J
      util: introduce virSocketAddrParseAny · 412afdb8
      Jim Fehlig 提交于
      When preparing for migration, the libxl driver creates a new TCP listen
      socket for the incoming migration by calling virNetSocketNewListenTCP,
      passing the destination host name. virNetSocketNewListenTCP calls
      virSocketAddrParse to check if the host name is a wildcard address, in
      which case it avoids adding the AI_ADDRCONFIG flag to the hints passed to
      getaddrinfo. If the host name is not an IP address, virSocketAddrParse
      reports an error
      
      error : virSocketAddrParseInternal:121 : Cannot parse socket address
      'myhost.example.com': Name or service not known
      
      But virNetSocketNewListenTCP succeeds regardless and the overall migration
      operation succeeds.
      
      Introduce virSocketAddrParseAny and use it when simply testing if a host
      name/addr is parsable.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      412afdb8
  27. 26 1月, 2018 1 次提交
    • D
      rpc: fix race sending and encoding sasl data · 4e13fb02
      Daniel P. Berrange 提交于
      The virNetSocketWriteSASL method has to encode the buffer it is given and then
      write it to the underlying socket. This write is not guaranteed to send the
      full amount of data that was encoded by SASL. We cache the SASL encoded data so
      that on the next invocation of virNetSocketWriteSASL we carry on sending it.
      
      The subtle problem is that the 'len' value passed into virNetSocketWriteSASL on
      the 2nd call may be larger than the original value. So when we've completed
      sending the SASL encoded data we previously cached, we must return the original
      length we encoded, not the new length.
      
      This flaw means we could potentially have been discarded queued data without
      sending it. This would have exhibited itself as a libvirt client never receiving
      the reply to a method it invokes, async events silently going missing, or worse
      stream data silently getting dropped.
      
      For this to be a problem libvirtd would have to be queued data to send to the
      client, while at the same time the TCP socket send buffer is full (due to a very
      slow client). This is quite unlikely so if this bug was ever triggered by a real
      world user it would be almost impossible to reproduce or diagnose, if indeed it
      was ever noticed at all.
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4e13fb02
  28. 30 8月, 2017 1 次提交
    • D
      rpc: avoid ssh interpreting malicious hostname as arguments · e4cb8500
      Daniel P. Berrange 提交于
      Inspired by the recent GIT / Mercurial security flaws
      (http://blog.recurity-labs.com/2017-08-10/scm-vulns),
      consider someone/something manages to feed libvirt a bogus
      URI such as:
      
        virsh -c qemu+ssh://-oProxyCommand=gnome-calculator/system
      
      In this case, the hosname "-oProxyCommand=gnome-calculator"
      will get interpreted as an argument to ssh, not a hostname.
      Fortunately, due to the set of args we have following the
      hostname, SSH will then interpret our bit of shell script
      that runs 'nc' on the remote host as a cipher name, which is
      clearly invalid. This makes ssh exit during argv parsing and
      so it never tries to run gnome-calculator.
      
      We are lucky this time, but lets be more paranoid, by using
      '--' to explicitly tell SSH when it has finished seeing
      command line options. This forces it to interpret
      "-oProxyCommand=gnome-calculator" as a hostname, and thus
      see a fail from hostname lookup.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e4cb8500
  29. 18 3月, 2017 1 次提交
  30. 15 11月, 2016 2 次提交
    • P
      remote: expose a new libssh transport · 22eaee8e
      Pino Toscano 提交于
      Implement in virtNetClient and VirNetSocket the needed functions to
      expose a new libssh transport, providing all the options that the
      libssh2 transport supports.
      22eaee8e
    • P
      virNetSocket: allow to not close FD · 0e9fec97
      Pino Toscano 提交于
      Add an internal variable to mark the FD as "not owned" by the
      virNetSocket, in case the internal implementation takes the actual
      ownership of the descriptor; this avoids a warning when closing the
      socket, as the FD would be invalid.
      0e9fec97
  31. 24 6月, 2016 2 次提交