From ad546b1e685babd73a63526e70b4471cee5c482f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 5 Sep 2020 04:21:56 +0000 Subject: [PATCH] scst: Add support for wildcard matching to the copy manager Reported-by: L <514005989@qq.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9150 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 2 +- scst/src/scst_priv.h | 2 ++ scst/src/scst_targ.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 640885158..68e081b8a 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2823,7 +2823,7 @@ static bool scst_cm_check_access_acg(const char *initiator_name, if (default_acg) goto found; list_for_each_entry(acn, &acg->acn_list, acn_list_entry) { - if (strcmp(acn->name, initiator_name) == 0) + if (wildcmp(acn->name, initiator_name)) goto found; } } diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index a17ac3960..8a51f94d6 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -379,6 +379,8 @@ int scst_del_free_acg(struct scst_acg *acg, bool close_sessions); void scst_get_acg(struct scst_acg *acg); void scst_put_acg(struct scst_acg *acg); +bool wildcmp(const char *wild, const char *string); + struct scst_acg *scst_tgt_find_acg(struct scst_tgt *tgt, const char *name); struct scst_acg *scst_find_acg(const struct scst_session *sess); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index c5d0fda31..c65aff79e 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -7132,7 +7132,7 @@ static bool __wildcmp(const char *wild, const char *string, int recursion_level) * * Also see comment for __wildcmp(). */ -static bool wildcmp(const char *wild, const char *string) +bool wildcmp(const char *wild, const char *string) { return __wildcmp(wild, string, 0); }