- 03 9月, 2013 1 次提交
-
-
由 Peter Krempa 提交于
-
- 29 8月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
The use of <> is a security issue for RPC parameters, since a malicious client can set a huge array length causing arbitrary memory allocation in the daemon. It is also a robustness issue for RPC return values, because if the stream is corrupted, it can cause the client to also allocate arbitrary memory. Use a syntax-check rule to prohibit any use of <> Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 8月, 2013 2 次提交
-
-
由 Daniel P. Berrange 提交于
The virnettlscontexttest.c tests both virNetTLSContext and virNetTLSSession functionality. Split into two separate tests, to make the code size more manageable Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Eric Blake 提交于
Commit 3d0e3c1a reintroduced a problem previously squelched in commit 7e5aa78d. Add a syntax check this time around. util/virutil.c: In function 'virGetGroupList': util/virutil.c:1015: error: 'for' loop initial declaration used outside C99 mode * cfg.mk (sc_prohibit_loop_var_decl): New rule. * src/util/virutil.c (virGetGroupList): Fix offender. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 19 7月, 2013 2 次提交
-
-
由 Eric Blake 提交于
Makefiles are another easy file to enforce line limits. Mostly straightforward; interesting tricks worth noting: src/Makefile.am: $(confdir) was already defined, use it in more places tests/Makefile.am: path_add and VG required some interesting compression * cfg.mk (sc_prohibit_long_lines): Add another test. * Makefile.am: Fix offenders. * daemon/Makefile.am: Likewise. * docs/Makefile.am: Likewise. * python/Makefile.am: Likewise. * src/Makefile.am: Likewise. * tests/Makefile.am: Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Long lines are harder to read and harder to diff; in fact, if lines get too long (> 1000 bytes), it starts causing issues where git send-email refuses to send patches for the file. I've cleaned up the tests directory in the past (see commits bd6c46fa, 3b750d13), but new long lines have been introduced in the meantime. Why 90 instead of 80? Because there were too many tests on the fringe edge, and I didn't want to edit that many files. Add a syntax check to prevent future long lines. * cfg.mk (sc_prohibit_long_lines): New rule. * tests/qemuxml2argvdata/qemuxml2argv-*.args: Split lines of any file with content longer than 90 columns. * tests/storagevolxml2argvdata/*.argv: Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 11 7月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Add two syntax-check rules - sc_prohibit_int_ijk - block use of 'int' as a data type for any variables named 'i', 'j', 'k' - sc_prohibit_int_iijjkk - block use of 'ii', 'jj', 'kk' for any variable names
-
- 10 7月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
Actually, I'm turning this function into a macro as filename, function name and line number needs to be passed. The new function virAsprintfInternal is introduced with the extended set of arguments.
-
由 Eric Blake 提交于
Based on a report by Chandrashekar Shastri, at https://bugzilla.redhat.com/show_bug.cgi?id=979360 On systems where git cannot access the outside world, a developer can instead arrange to get a copy of gnulib at the right commit via side channels (such as NFS share drives), set GNULIB_SRCDIR, then use ./autogen.sh --no-git. In this setup, we will now avoid direct use of git. Of course, this means no automatic gnulib updates when libvirt.git updates its submodule, but it is expected that any developer in such a situation is already prepared to deal with the fallout. * .gnulib: Update to latest, for bootstrap. * bootstrap: Synchronize from gnulib. * autogen.sh (no_git): Avoid git when requested. * cfg.mk (_update_required): Skip automatic rerun of bootstrap if we can't use git. * docs/compiling.html.in: Document this setup. * docs/hacking.html.in: Mention this. * HACKING: Regenerate. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 25 6月, 2013 1 次提交
-
-
由 Laine Stump 提交于
add it to the syntax-check list and fix the one offending caller.
-
- 05 6月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Enforce the rule that .h files don't need to (redundantly) include <config.h>. * cfg.mk (sc_prohibit_config_h_in_headers): New rule. (_virsh_includes): Delete; instead, inline a smaller number of exclusions... (exclude_file_name_regexp--sc_require_config_h) (exclude_file_name_regexp--sc_require_config_h_first): ...here. * daemon/libvirtd.h (includes): Fix offenders. * src/driver.h (includes): Likewise. * src/gnutls_1_0_compat.h (includes): Likewise. * src/libxl/libxl_conf.h (includes): Likewise. * src/libxl/libxl_driver.h (includes): Likewise. * src/lxc/lxc_conf.h (includes): Likewise. * src/lxc/lxc_driver.h (includes): Likewise. * src/lxc/lxc_fuse.h (includes): Likewise. * src/network/bridge_driver.h (includes): Likewise. * src/phyp/phyp_driver.h (includes): Likewise. * src/qemu/qemu_conf.h (includes): Likewise. * src/util/virnetlink.h (includes): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 28 5月, 2013 2 次提交
-
-
由 Eric Blake 提交于
Osier Yang pointed out that I introduced a syntax error in my syntax check (I really shouldn't make last-minute changes without testing them....). /bin/sh: -c: line 2: syntax error near unexpected token `;' /bin/sh: -c: line 2: ` { echo 'maint.mk: incorrect whitespace, see HACKING for rules' 2>&; \' make: *** [bracket-spacing-check] Error 1 * cfg.mk (bracket-spacing-check): Fix copy-and-paste error. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Enforce the style cleanup in the previous patch. * build-aux/bracket-spacing.pl: Enforce trailing spacing. * cfg.mk (bracket-spacing-check): Tweak error wording. * docs/hacking.html.in: Document the rule. * HACKING: Regenerate. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 24 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 21 5月, 2013 2 次提交
-
-
由 Eric Blake 提交于
To ensure we don't regress and cause the need for further cleanups, add a 'make syntax-check' rule that ensures new files have proper copyright contents. * cfg.mk (sc_copyright_address): Rename... (sc_copyright_usage): ...and enhance. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html states: You should also include a copy of the license itself somewhere in the distribution of your program. All programs, whether they are released under the GPL or LGPL, should include the text version of the GPL. In GNU programs the license is usually in a file called COPYING. If you are releasing your program under the LGPL, you should also include the text version of the LGPL, usually in a file called COPYING.LESSER. Please note that, since the LGPL is a set of additional permissions on top of the GPL, it's important to include both licenses so users have all the materials they need to understand their rights. * configure.ac (COPYING): No more games with non-git file. * COPYING: New file, copied from gnulib. * COPYING.LIB: Rename... * COPYING.LESSER: ...to this. * .gitignore: Track licenses in git. * cfg.mk (exclude_file_name_regexp--sc_copyright_address): Tweak rule. * libvirt.spec.in (daemon, client, python): Reflect rename. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 14 5月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Use of the select() system call is inherantly dangerous since applications will hit a buffer overrun if any FD number exceeds the size of the select set size (typically 1024). Replace the two uses of select() with poll() and use cfg.mk to ban any future use of select(). NB: This changes the phyp driver so that it uses an infinite timeout, instead of busy-waiting for 1ms at a time. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 11 5月, 2013 1 次提交
-
-
由 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.
-
- 07 5月, 2013 1 次提交
-
-
由 Ján Tomko 提交于
-
- 03 5月, 2013 1 次提交
-
-
由 Eric Blake 提交于
virAsprintf(&foo, "%s", bar) is wasteful compared to foo = strdup(bar) (or eventually, VIR_STRDUP(foo, bar), but one thing at a time...). Noticed while reviewing Laine's attempt to clean up broken qemu:///session. * cfg.mk (sc_prohibit_asprintf): Enhance rule. * src/esx/esx_storage_backend_vmfs.c (esxStorageBackendVMFSVolumeLookupByKey): Fix offender. * src/network/bridge_driver.c (networkStateInitialize): Likewise. * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopDHCPOpen): Likewise. * src/storage/storage_backend_sheepdog.c (virStorageBackendSheepdogRefreshVol): Likewise. * src/util/vircgroup.c (virCgroupAddTaskStrController): Likewise. * src/util/virdnsmasq.c (addnhostsAdd): Likewise. * src/xen/block_stats.c (xenLinuxDomainDeviceID): Likewise. * src/xen/xen_driver.c (xenUnifiedConnectOpen): Likewise. * tools/virsh.c (vshGetTypedParamValue): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 02 5月, 2013 1 次提交
-
-
由 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.
-
- 26 4月, 2013 1 次提交
-
-
由 Eric Blake 提交于
POSIX says that both basename() and dirname() may return static storage (aka they need not be thread-safe); and that they may but not must modify their input argument. Furthermore, <libgen.h> is not available on all platforms. For these reasons, you should never use these functions in a multi-threaded library. Gnulib instead recommends a way to avoid the portability nightmare: gnulib's "dirname.h" provides useful thread-safe counterparts. The obvious dir_name() and base_name() are GPL (because they malloc(), but call exit() on failure) so we can't use them; but the LGPL variants mdir_name() (malloc's or returns NULL) and last_component (always points into the incoming string without modifying it, differing from basename semantics only on corner cases like the empty string that we shouldn't be hitting in the first place) are already in use in libvirt. This finishes the swap over to the safe functions. * cfg.mk (sc_prohibit_libgen): New rule. * src/util/vircgroup.c: Fix offenders. * src/parallels/parallels_storage.c (parallelsPoolAddByDomain): Likewise. * src/parallels/parallels_network.c (parallelsGetBridgedNetInfo): Likewise. * src/node_device/node_device_udev.c (udevProcessSCSIHost) (udevProcessSCSIDevice): Likewise. * src/storage/storage_backend_disk.c (virStorageBackendDiskDeleteVol): Likewise. * src/util/virpci.c (virPCIGetDeviceAddressFromSysfsLink): Likewise. * src/util/virstoragefile.h (_virStorageFileMetadata): Avoid false positive. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 18 4月, 2013 3 次提交
-
-
由 Osier Yang 提交于
With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
-
由 Osier Yang 提交于
Directories python/tools/examples should include them in <> form, though this patch allows "" form in these directories by excluding them, a later patch will do the cleanup.
-
由 Osier Yang 提交于
gnulib is excluded.
-
- 16 4月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Some aspects of the cgroups setup / detection code are quite subtle and easy to break. It would greatly benefit from unit testing, but this is difficult because the test suite won't have privileges to play around with cgroups. The solution is to use monkey patching via LD_PRELOAD to override the fopen, open, mkdir, access functions to redirect access of cgroups files to some magic stubs in the test suite. Using this we provide custom content for the /proc/cgroup and /proc/self/mounts files which report a fixed cgroup setup. We then override open/mkdir/access so that access to the cgroups filesystem gets redirected into files in a temporary directory tree in the test suite build dir. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 16 3月, 2013 1 次提交
-
-
由 Eric Blake 提交于
We've already scrubbed for comparisons of 'uid_t == -1' (which fail on platforms where uid_t is a u16), but another one snuck in. * src/util/virutil.c (virSetUIDGIDWithCaps): Correct uid comparison. * cfg.mk (sc_prohibit_risky_id_promotion): New rule.
-
- 26 2月, 2013 1 次提交
-
-
由 Eric Blake 提交于
testutils.c likes to print summaries after a test completes, including if it failed. But if the test outright exit()s, this summary is skipped. Enforce that we return instead of exit. * cfg.mk (sc_prohibit_exit_in_tests): New syntax check. * tests/commandhelper.c (main): Fix offenders. * tests/qemumonitorjsontest.c (mymain): Likewise. * tests/seclabeltest.c (main): Likewise. * tests/securityselinuxlabeltest.c (mymain): Likewise. * tests/securityselinuxtest.c (mymain): Likewise. * tests/testutils.h (VIRT_TEST_MAIN_PRELOAD): Likewise. * tests/testutils.c (virtTestMain): Likewise. (virtTestCaptureProgramOutput): Use symbolic name.
-
- 08 2月, 2013 3 次提交
-
-
由 John Ferlan 提交于
hacking: Add some text around the running of Valgrind along with example output for "real" vs. "false positives". cfg.mk: Add hacking.in.html to sc_prohibit_raw_allocation
-
由 Guido Günther 提交于
We allow for a trailing semicolon in full line comments since docs/index.py has some SQL statements in it.
-
由 Peter Krempa 提交于
Otherwise constructions like "random (used by default)" end up breaking syntax check by apparently using non-reentrant functions.
-
- 26 1月, 2013 1 次提交
-
-
由 John Ferlan 提交于
Adjust the macros to free memory allocated during various calls to perform the check if parameter is NULL prior to really freeing and to set the pointer to NULL after done freeing.
-
- 22 1月, 2013 1 次提交
-
-
由 Eric Blake 提交于
Nested conditionals are hard to read if they are not indented. We can't add arbitrary whitespace to everything in spec files, but we CAN add spaces before %if and %define. Use this trick, plus a fancy sed script that rewrites a spec file into a C file, so we can use cppi to keep our spec file nice. For reference, the sed script converts code like: |# RHEL-5 builds are client-only for s390, ppc |%if 0%{?rhel} == 5 | %ifnarch %{ix86} x86_64 ia64 | %define client_only 1 | %endif |%endif into the following for cppi: |// # RHEL-5 builds are client-only for s390, ppc |#if a // 0%{?rhel} == 5 |# if a // %{ix86} x86_64 ia64 |# define client_only 1 |# endif |#endif and errors from 'make syntax-check' look like: spec_indentation cppi: mingw-libvirt.spec.in: line 130: not properly indented maint.mk: incorrect preprocessor indentation * libvirt.spec.in: Add some indentation to make it easier to follow various conditionals. * mingw-libvirt-spec.in: Likewise. * cfg.mk (sc_spec_indentation): New syntax check to enforce it.
-
- 14 1月, 2013 2 次提交
-
-
由 Daniel P. Berrange 提交于
This patch introduces support for LXC specific public APIs. In common with what was done for QEMU, this creates a libvirt_lxc.so library and libvirt/libvirt-lxc.h header file. The actual APIs are int virDomainLxcOpenNamespace(virDomainPtr domain, int **fdlist, unsigned int flags); int virDomainLxcEnterNamespace(virDomainPtr domain, unsigned int nfdlist, int *fdlist, unsigned int *noldfdlist, int **oldfdlist, unsigned int flags); which provide a way to use the setns() system call to move the calling process into the container's namespace. It is not practical to write in a generically applicable manner. The nearest that we could get to such an API would be an API which allows to pass a command + argv to be executed inside a container. Even if we had such a generic API, this LXC specific API is still useful, because it allows the caller to maintain the current process context, in particular any I/O streams they have open. NB the virDomainLxcEnterNamespace() API is special in that it runs client side, so does not involve the internal driver API. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
由 Daniel P. Berrange 提交于
There are many aspects of the guest XML which result in the SELinux driver applying file labelling. With the increasing configuration options it is desirable to test this behaviour. It is not possible to assume that the test suite has the ability to set SELinux labels. Most filesystems though will support extended attributes. Thus for the purpose of testing, it is possible to extend the existing LD_PRELOAD hack to override setfilecon() and getfilecon() to simply use the 'user.libvirt.selinux' attribute for the sake of testing. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 11 1月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Most checks for libraries take the same format * --with-libFOO=yes|no|check|/some/path argument * check for a function NNN in libFOO.so * check for a header file DDD/HHH.h * Define a WITH_FOO config.h symbol * Define a WITH_FOO make conditional * Substitute FOO_CFLAGS and FOO_LIBS make variables * Print CFLAGS & LIBS summary at the end Doing all this correctly is rather difficult, typically done by copy+paste of a previous usage. Further small improvements people make are not applied to all previous usages. Improve this by creating some helper macros to apply good practice. First, to perform the actual checks: LIBVIRT_CHECK_LIB([SELINUX], [selinux], [getfilecon], [selinux/selinux.h]) This checks for 'getfilecon' in -lselinux, and the existence of 'selinux/selinux.h' header file. If successful it sets SELINUX_CFLAGS and SELINUX_LIBS. The WITH_SELINUX config.h macro and WITH_SELINUX make conditional are also defined. In some cases we need to check two variants of the same library LIBVIRT_CHECK_LIB_ALT([SASL], [sasl2], [sasl_client_init], [sasl/sasl.h], [SASL1], [sasl], [sasl_client_init], [sasl/sasl.h]) This checks for sasl_client_init in libsasl2, and if that is not found, checks sasl_client_init in libsasl. If the first check succeeds WITH_SASL is set, while if the second check succeeds *both* WITH_SASL and WITH_SASL1 are set. If the library supports pkg-config, then another variant is available LIBVIRT_CHECK_PKG([AVAHI], [avahi-client], [0.6.0]) This checks for avahi-client >= 0.6.0 via pkg-config and sets WITH_AVAHI if found. Finally to print a summary of CFLAGS & LIBs found (if any): LIBVIRT_RESULT_LIB([SELINUX]) Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 08 1月, 2013 1 次提交
-
-
由 John Ferlan 提交于
Added 'usbFreeDevice' to the useless_free_options list in cfg.mk
-
- 21 12月, 2012 3 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-