Lines Matching refs:tok

51 static int user_match(char *tok, struct login_info *item);
52 static int from_match(char *tok, struct login_info *item);
53 static int string_match(char *tok, char *string);
132 char *tok;
143 for (tok = strtok_r(list, sep, &foo);
144 tok != NULL;
145 tok = strtok_r(NULL, sep, &foo)) {
146 if (strcasecmp(tok, "EXCEPT") == 0) /* EXCEPT: give up */
148 if ((match = (*match_fn) (tok, item)) != 0) /* YES */
154 while ((tok = strtok_r(NULL, sep, &foo)) && strcasecmp(tok, "EXCEPT"))
156 if (tok == 0 || list_match(NULL, item, match_fn) == NO)
193 static int user_match(char *tok, struct login_info *item)
208 if ((at = strchr(tok + 1, '@')) != 0) { /* split user@host pattern */
211 return (user_match(tok, item) && from_match(at + 1, &fake_item));
212 } else if (tok[0] == '@') { /* netgroup */
213 return (netgroup_match(tok + 1, (char *) 0, string));
214 } else if (string_match(tok, string)) { /* ALL or exact match */
216 } else if ((group = getgrnam(tok)) != 0) { /* try group membership */
228 static int from_match(char *tok, struct login_info *item)
243 if (tok[0] == '@') { /* netgroup */
244 return (netgroup_match(tok + 1, string, (char *) 0));
245 } else if (string_match(tok, string)) { /* ALL or exact match */
247 } else if (tok[0] == '.') { /* domain: match last fields */
248 if ((str_len = strlen(string)) > (tok_len = strlen(tok))
249 && strcasecmp(tok, string + str_len - tok_len) == 0)
251 } else if (strcasecmp(tok, "LOCAL") == 0) { /* local: no dots */
254 } else if (tok[(tok_len = strlen(tok)) - 1] == '.' /* network */
255 && strncmp(tok, string, tok_len) == 0) {
263 static int string_match(char *tok, char *string)
271 if (strcasecmp(tok, "ALL") == 0) { /* all: always matches */
273 } else if (strcasecmp(tok, string) == 0) { /* try exact match */