summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/ctld.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-10-24 11:40:09 +0000
committertrasz <trasz@FreeBSD.org>2014-10-24 11:40:09 +0000
commit904ee8f9378b694958e470ffc7d0ae7fc8ad8f95 (patch)
tree661abf2cba7a204ad3c2512c1babfa5b7c3b7d61 /usr.sbin/ctld/ctld.c
parente2e58f80cc8a6e6632b043d08a1cc05ef3ccdcd6 (diff)
downloadFreeBSD-src-904ee8f9378b694958e470ffc7d0ae7fc8ad8f95.zip
FreeBSD-src-904ee8f9378b694958e470ffc7d0ae7fc8ad8f95.tar.gz
Make the initiator-name and initiator-portal checks a little nicer.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/ctld/ctld.c')
-rw-r--r--usr.sbin/ctld/ctld.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index c8ca4a9..d27d73c 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -318,6 +318,18 @@ auth_name_find(const struct auth_group *ag, const char *name)
return (NULL);
}
+int
+auth_name_check(const struct auth_group *ag, const char *initiator_name)
+{
+ if (!auth_name_defined(ag))
+ return (0);
+
+ if (auth_name_find(ag, initiator_name) == NULL)
+ return (1);
+
+ return (0);
+}
+
const struct auth_portal *
auth_portal_new(struct auth_group *ag, const char *portal)
{
@@ -430,6 +442,19 @@ next:
return (NULL);
}
+int
+auth_portal_check(const struct auth_group *ag, const struct sockaddr_storage *sa)
+{
+
+ if (!auth_portal_defined(ag))
+ return (0);
+
+ if (auth_portal_find(ag, sa) == NULL)
+ return (1);
+
+ return (0);
+}
+
struct auth_group *
auth_group_new(struct conf *conf, const char *name)
{
OpenPOWER on IntegriCloud