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

Function ipfw_check_object_name

tools/ipfw/ipfw2.c:2987–3008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2985};
2986
2987int
2988ipfw_check_object_name(const char *name)
2989{
2990 int c, i, l;
2991
2992 /*
2993 * Check that name is null-terminated and contains
2994 * valid symbols only. Valid mask is:
2995 * [a-zA-Z0-9\-_\.]{1,63}
2996 */
2997 l = strlen(name);
2998 if (l == 0 || l >= 64)
2999 return (EINVAL);
3000 for (i = 0; i < l; i++) {
3001 c = name[i];
3002 if (isalpha(c) || isdigit(c) || c == '_' ||
3003 c == '-' || c == '.')
3004 continue;
3005 return (EINVAL);
3006 }
3007 return (0);
3008}
3009
3010static const char *default_state_name = "default";
3011

Callers 3

table_check_nameFunction · 0.85
state_check_nameFunction · 0.85
eaction_check_nameFunction · 0.85

Calls 2

isalphaFunction · 0.85
isdigitFunction · 0.85

Tested by

no test coverage detected