1. 12 7月, 2013 2 次提交
    • 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
    • P
      libssh2: Improve password based authentication · 676504e3
      Peter Krempa 提交于
      The password authentication method wasn't used as there wasn't a
      pleasant way to pass the password. This patch adds the option to use
      virAuth util functions to request the password either from a config file
      or uses the conf callback to request it from the user.
      676504e3
  2. 11 7月, 2013 1 次提交
  3. 10 7月, 2013 1 次提交
  4. 03 7月, 2013 1 次提交
  5. 24 6月, 2013 2 次提交
    • D
      Auto-generate helpers for checking access control rules · 68602622
      Daniel P. Berrange 提交于
      Extend the 'gendispatch.pl' script to be able to generate
      three new types of file.
      
      - 'aclheader' - defines signatures of helper APIs for
        doing authorization checks. There is one helper API
        for each API requiring an auth check. Any @acl
        annotations result in a method being generated with
        a suffix of 'EnsureACL'. If the ACL check requires
        examination of flags, an extra 'flags' param will be
        present. Some examples
      
        extern int virConnectBaselineCPUEnsureACL(void);
        extern int virConnectDomainEventDeregisterEnsureACL(virDomainDefPtr domain);
        extern int virDomainAttachDeviceFlagsEnsureACL(virDomainDefPtr domain, unsigned int flags);
      
        Any @aclfilter annotations resuilt in a method being
        generated with a suffix of 'CheckACL'.
      
        extern int virConnectListAllDomainsCheckACL(virDomainDefPtr domain);
      
        These are used for filtering individual objects from APIs
        which return a list of objects
      
      - 'aclbody' - defines the actual implementation of the
        methods described above. This calls into the access
        manager APIs. A complex example:
      
          /* Returns: -1 on error (denied==error), 0 on allowed */
          int virDomainAttachDeviceFlagsEnsureACL(virConnectPtr conn,
                                                  virDomainDefPtr domain,
                                                  unsigned int flags)
          {
              virAccessManagerPtr mgr;
              int rv;
      
              if (!(mgr = virAccessManagerGetDefault()))
                  return -1;
      
              if ((rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_WRITE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE)) == 0) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG)) == (VIR_DOMAIN_AFFECT_CONFIG)) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              virObjectUnref(mgr);
              return 0;
          }
      
      - 'aclsyms' - generates a linker script to export the
         APIs to drivers. Some examples
      
        virConnectBaselineCPUEnsureACL;
        virConnectCompareCPUEnsureACL;
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      68602622
    • D
      Add ACL annotations to all RPC messages · e341435e
      Daniel P. Berrange 提交于
      Introduce annotations to all RPC messages to declare what
      access control checks are required. There are two new
      annotations defined:
      
       @acl: <object>:<permission>
       @acl: <object>:<permission>:<flagname>
      
        Declare the access control requirements for the API. May be repeated
        multiple times, if multiple rules are required.
      
          <object> is one of 'connect', 'domain', 'network', 'storagepool',
                   'interface', 'nodedev', 'secret'.
          <permission> is one of the permissions in access/viraccessperm.h
          <flagname> indicates the rule only applies if the named flag
          is set in the API call
      
       @aclfilter: <object>:<permission>
      
        Declare an access control filter that will be applied to a list
        of objects being returned by an API. This allows the returned
        list to be filtered to only show those the user has permissions
        against
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e341435e
  6. 06 6月, 2013 1 次提交
  7. 30 5月, 2013 2 次提交
  8. 29 5月, 2013 1 次提交
    • E
      build: fix build with newer gnutls · 7d21d6b6
      Eric Blake 提交于
      Building with gnutls 3.2.0 (such as shipped with current cygwin) fails
      with:
      
      rpc/virnettlscontext.c: In function 'virNetTLSSessionGetKeySize':
      rpc/virnettlscontext.c:1358:5: error: implicit declaration of function 'gnutls_cipher_get_key_size' [-Wimplicit-function-declaration]
      
      Yeah, it's stupid that gnutls broke API by moving their declaration
      into a new header without including that header from the old one,
      but it's easy enough to work around, all without breaking on gnutls
      1.4.1 (hello RHEL 5) that lacked the new header.
      
      * configure.ac (gnutls): Check for <gnutls/crypto.h>.
      * src/rpc/virnettlscontext.c (includes): Include additional header.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7d21d6b6
  9. 23 5月, 2013 3 次提交
  10. 22 5月, 2013 1 次提交
    • O
      syntax-check: Add the rule to forbid whitespace before ";" · ba0880b2
      Osier Yang 提交于
      Only a few cases are allowed:
      
      1) The expression is empty for "for" loop, E.g.
      
        for (i = 0; ; i++)
      
      2) An empty statement
      
        while (write(statuswrite, &status, 1) == -1 &&
               errno == EINTR)
            ; /* empty */
      
      3) ";" is inside double-quote, I.e, as part of const string. E.g.
      
        vshPrint(ctl, "a ; b ; cd;\n");
      
      The "for" loop in src/rpc/virnettlscontext.c is the special case,
      1) applies for it, so change it together in this patch.
      ba0880b2
  11. 21 5月, 2013 2 次提交
    • O
      src/rpc: Remove the whitespace before ";" · 13dbad40
      Osier Yang 提交于
      13dbad40
    • E
      maint: use LGPL correctly · d7f53c7b
      Eric Blake 提交于
      Several files called out COPYING or COPYING.LIB instead of using
      the normal boilerplate.  It's especially important that we don't
      call out COPYING from an LGPL file, since COPYING is traditionally
      used for the GPL.  A few files were lacking copyright altogether.
      
      * src/rpc/gendispatch.pl: Add missing copyright.
      * Makefile.nonreentrant: Likewise.
      * src/check-symfile.pl: Likewise.
      * src/check-symsorting.pl: Likewise.
      * src/driver.h: Likewise.
      * src/internal.h: Likewise.
      * tools/libvirt-guests.sh.in: Likewise.
      * tools/virt-pki-validate.in: Mention copyright in comment, not just code.
      * tools/virt-sanlock-cleanup.in: Likewise.
      * src/rpc/genprotocol.pl: Spell out license terms.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * Makefile.am: Likewise.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * docs/schemas/Makefile.am: Likewise.
      * examples/apparmor/Makefile.am: Likewise.
      * examples/domain-events/events-c/Makefile.am: Likewise.
      * examples/dominfo/Makefile.am: Likewise.
      * examples/domsuspend/Makefile.am: Likewise.
      * examples/hellolibvirt/Makefile.am: Likewise.
      * examples/openauth/Makefile.am: Likewise.
      * examples/python/Makefile.am: Likewise.
      * examples/systemtap/Makefile.am: Likewise.
      * examples/xml/nwfilter/Makefile.am: Likewise.
      * gnulib/lib/Makefile.am: Likewise.
      * gnulib/tests/Makefile.am: Likewise.
      * include/Makefile.am: Likewise.
      * include/libvirt/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * python/tests/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      * configure.ac: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d7f53c7b
  12. 11 5月, 2013 1 次提交
    • L
      util: move virFile* functions from virutil.c to virfile.c · bfe7721d
      Laine Stump 提交于
      These all existed before virfile.c was created, and for some reason
      weren't moved.
      
      This is mostly straightfoward, although the syntax rule prohibiting
      write() had to be changed to have an exception for virfile.c instead
      of virutil.c.
      
      This movement pointed out that there is a function called
      virBuildPath(), and another almost identical function called
      virFileBuildPath(). They really should be a single function, which
      I'll take care of as soon as I figure out what the arglist should look
      like.
      bfe7721d
  13. 08 5月, 2013 2 次提交
  14. 07 5月, 2013 1 次提交
    • D
      rpc: message related sizes enlarged · e914dcfd
      Daniel Hansel 提交于
      We have seen an issue on s390x platform where domain XMLs larger than 1MB
      were used. The define command was finished successfully. The dumpxml command
      was not successful (i.e. could not encode message payload).
      
      Enlarged message related sizes (e.g. maximum string size, message size, etc.)
      to handle larger system configurations used on s390x platform.
      
      To improve handling of the RPC message size the allocation during encode process
      is changed to a dynamic one (i.e. starting with 64kB initial size and increasing
      that size in steps up to 16MB if the payload data is larger).
      Signed-off-by: NDaniel Hansel <daniel.hansel@linux.vnet.ibm.com>
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      e914dcfd
  15. 03 5月, 2013 3 次提交
  16. 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
  17. 24 4月, 2013 4 次提交
  18. 23 4月, 2013 1 次提交
  19. 20 4月, 2013 1 次提交
    • E
      docs: fix usage of 'onto' · 1bf25ba2
      Eric Blake 提交于
      http://www.uhv.edu/ac/newsletters/writing/grammartip2009.07.01.htm
      (and several other sites) give hints that 'onto' is best used if
      you can also add 'up' just before it and still make sense. In many
      cases in the code base, we really want the two-word form, or even
      a simplification to just 'on' or 'to'.
      
      * docs/hacking.html.in: Use correct 'on to'.
      * python/libvirt-override.c: Likewise.
      * src/lxc/lxc_controller.c: Likewise.
      * src/util/virpci.c: Likewise.
      * daemon/THREADS.txt: Use simpler 'on'.
      * docs/formatdomain.html.in: Better usage.
      * docs/internals/rpc.html.in: Likewise.
      * src/conf/domain_event.c: Likewise.
      * src/rpc/virnetclient.c: Likewise.
      * tests/qemumonitortestutils.c: Likewise.
      * HACKING: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1bf25ba2
  20. 27 3月, 2013 1 次提交
    • J
      rpc: Fix client crash when server drops connection · d8d4aa01
      Jiri Denemark 提交于
      Despite the comment stating virNetClientIncomingEvent handler should
      never be called with either client->haveTheBuck or client->wantClose
      set, there is a sequence of events that may lead to both booleans being
      true when virNetClientIncomingEvent is called. However, when that
      happens, we must not immediately close the socket as there are other
      threads waiting for the buck and they would cause SIGSEGV once they are
      woken up after the socket was closed. Another thing is we should clear
      all remaining calls in the queue after closing the socket.
      
      The situation that can lead to the crash involves three threads, one of
      them running event loop and the other two calling libvirt APIs. The
      event loop thread detects an event on client->sock and calls
      virNetClientIncomingEvent handler. But before the handler gets a chance
      to lock client, the other two threads (T1 and T2) start calling some
      APIs. T1 gets the buck and detects EOF on client->sock while processing
      its RPC call. Since T2 is waiting for its own call, T1 passes the buck
      on to it and unlocks client. But before T2 gets the signal, the event
      loop thread wakes up, does its job and closes client->sock. The crash
      happens when T2 actually wakes up and tries to do its job using a closed
      client->sock.
      d8d4aa01
  21. 21 3月, 2013 1 次提交
    • G
      Don't fail if SELinux is diabled · 82eec793
      Guido Günther 提交于
      but libvirt is built with --with-selinux. In this case getpeercon
      returns ENOPROTOOPT so don't return an error in that case but simply
      don't set seccon.
      82eec793
  22. 20 3月, 2013 2 次提交
  23. 19 3月, 2013 3 次提交
  24. 14 3月, 2013 2 次提交
    • D
      Fix generation of systemtap probes for RPC protocols · 403594eb
      Daniel P. Berrange 提交于
      The naming used in the RPC protocols for the LXC monitor and
      lock daemon confused the script used to generate systemtap
      helper functions. Rename the LXC monitor protocol symbols to
      reduce confusion. Adapt the gensystemtap.pl script to cope
      with the LXC monitor / lock daemon naming conversions.
      
      This has no functional impact on RPC wire protocol, since
      names are only used in the C layer
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      403594eb
    • 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