diff --git a/cfg.mk b/cfg.mk index dad8a9070f16206b18eb22831097ab6999f1e2d3..f86469de6ac9bc98fbdcf7e3d125bb9e0abd0611 100644 --- a/cfg.mk +++ b/cfg.mk @@ -851,6 +851,11 @@ sc_prohibit_unbounded_arrays_in_rpc: halt='Arrays in XDR must have a upper limit set for ' \ $(_sc_search_regexp) +sc_prohibit_getenv: + @prohibit='\b(secure_)?getenv *\(' \ + exclude='exempt from syntax-check' \ + halt='Use virGetEnv{Allow,Block}SUID instead of getenv' \ + $(_sc_search_regexp) # We don't use this feature of maint.mk. prev_version_file = /dev/null @@ -1020,3 +1025,6 @@ exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \ exclude_file_name_regexp--sc_prohibit_int_ijk = \ ^(src/remote_protocol-structs|src/remote/remote_protocol.x|cfg.mk|include/)$ + +exclude_file_name_regexp--sc_prohibit_getenv = \ + ^tests/.*\.[ch]$$ diff --git a/src/util/virutil.c b/src/util/virutil.c index 405006c3db1423b4334136eb6ceddde125c9839f..043b31cf26b47e7d3b9719303221afdf98c2d1ef 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -2140,7 +2140,7 @@ cleanup: */ const char *virGetEnvBlockSUID(const char *name) { - return secure_getenv(name); + return secure_getenv(name); /* exempt from syntax-check-rules */ } @@ -2154,7 +2154,7 @@ const char *virGetEnvBlockSUID(const char *name) */ const char *virGetEnvAllowSUID(const char *name) { - return getenv(name); + return getenv(name); /* exempt from syntax-check-rules */ }