mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
src: switch from fnmatch to g_pattern_match_simple
The g_pattern_match function_simple is an acceptably close approximation of fnmatch for libvirt's needs. In contrast to fnmatch(), the '/' character can be matched by the wildcards, there are no '[...]' character ranges and '*' and '?' can not be escaped to include them literally in a pattern. Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <getopt.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
@@ -67,14 +66,14 @@ static int virLoginShellAllowedUser(virConfPtr conf,
|
||||
for (i = 0; i < ngroups; i++) {
|
||||
if (!(gname = virGetGroupName(groups[i])))
|
||||
continue;
|
||||
if (fnmatch(entry, gname, 0) == 0) {
|
||||
if (g_pattern_match_simple(entry, gname)) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
VIR_FREE(gname);
|
||||
}
|
||||
} else {
|
||||
if (fnmatch(entry, name, 0) == 0) {
|
||||
if (g_pattern_match_simple(entry, name)) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user