MCPcopy Create free account
hub / github.com/F-Stack/f-stack / login_hostok

Function login_hostok

tools/libutil/login_ok.c:176–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 */
175
176int
177login_hostok(login_cap_t *lc, const char *host, const char *ip,
178 const char *allowcap, const char *denycap)
179{
180 int rc = 1; /* Default is ok */
181
182 if (lc != NULL &&
183 ((host != NULL && *host != '\0') || (ip != NULL && *ip != '\0'))) {
184 const char **hl;
185
186 hl = login_getcaplist(lc, allowcap, NULL);
187 if (hl != NULL && !login_str2inlist(hl, host, ip, FNM_CASEFOLD))
188 rc = 0; /* host or IP not in allow list */
189 else {
190
191 hl = login_getcaplist(lc, denycap, NULL);
192 if (hl != NULL && login_str2inlist(hl, host, ip, FNM_CASEFOLD))
193 rc = 0; /* host or IP in deny list */
194 }
195 }
196
197 return rc;
198}
199
200
201/*

Callers 1

auth_hostokFunction · 0.85

Calls 2

login_getcaplistFunction · 0.85
login_str2inlistFunction · 0.85

Tested by

no test coverage detected