1. 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
  2. 11 7月, 2019 1 次提交
    • 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
  3. 10 4月, 2019 2 次提交
  4. 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
  5. 20 9月, 2018 1 次提交
  6. 19 9月, 2018 1 次提交
  7. 11 9月, 2018 1 次提交
  8. 04 9月, 2018 2 次提交
    • D
      tests: rewrite socket to do something sensible and reliable · 39015a6f
      Daniel P. Berrangé 提交于
      The current socket test is rather crazy in that it sets up a server
      listening for sockets and then runs a client connect call, relying on
      the fact that the kernel will accept this despite the application
      not having called accept() yet. It then closes the client socket and
      calls accept() on the server. On Linux accept() will always see that
      the client has gone and so skip the rest of the code. On FreeBSD,
      however, the accept sometimes succeeds, causing us to then go into
      code that attempts to read and write to the client which will fail
      aborting the test. The accept() never succeeds on FreeBSD guests
      with a single CPU, but as you add more CPUs, accept() becomes more and
      more likely to succeed, giving a 100% failure rate for the test when
      using 8 CPUs.
      
      This completely rewrites the test so that it is avoids this designed in
      race condition. We simply spawn a background thread to act as the
      client, which will read a byte from the server and write it back again.
      The main thread can now properly listen and accept the client in a
      synchronous manner avoiding any races.
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      39015a6f
    • D
      tests: merge code for UNIX and TCP socket testing · 9e2fad87
      Daniel P. Berrangé 提交于
      The test code for UNIX and TCP sockets will need to be rewritten and
      extended later, and will benefit from code sharing.
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      9e2fad87
  9. 30 8月, 2017 1 次提交
  10. 04 4月, 2017 1 次提交
  11. 24 6月, 2016 4 次提交
  12. 08 6月, 2016 2 次提交
  13. 03 5月, 2016 1 次提交
    • 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
  14. 04 11月, 2015 1 次提交
  15. 21 10月, 2015 1 次提交
  16. 11 6月, 2015 2 次提交
  17. 25 3月, 2014 1 次提交
  18. 18 3月, 2014 2 次提交
  19. 02 1月, 2014 2 次提交
  20. 21 10月, 2013 1 次提交
  21. 08 10月, 2013 1 次提交
  22. 11 7月, 2013 1 次提交
  23. 21 5月, 2013 1 次提交
  24. 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
  25. 23 1月, 2013 1 次提交
  26. 21 12月, 2012 4 次提交
  27. 21 9月, 2012 1 次提交
  28. 07 8月, 2012 1 次提交