MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / parse_acl_row

Function parse_acl_row

ffserver.c:1264–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1262}
1263
1264static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_acl,
1265 const char *p, const char *filename, int line_num)
1266{
1267 char arg[1024];
1268 IPAddressACL acl;
1269 int errors = 0;
1270
1271 get_arg(arg, sizeof(arg), &p);
1272 if (strcasecmp(arg, "allow") == 0)
1273 acl.action = IP_ALLOW;
1274 else if (strcasecmp(arg, "deny") == 0)
1275 acl.action = IP_DENY;
1276 else {
1277 fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n",
1278 filename, line_num, arg);
1279 errors++;
1280 }
1281
1282 get_arg(arg, sizeof(arg), &p);
1283
1284 if (resolve_host(&acl.first, arg) != 0) {
1285 fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
1286 filename, line_num, arg);
1287 errors++;
1288 } else
1289 acl.last = acl.first;
1290
1291 get_arg(arg, sizeof(arg), &p);
1292
1293 if (arg[0]) {
1294 if (resolve_host(&acl.last, arg) != 0) {
1295 fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
1296 filename, line_num, arg);
1297 errors++;
1298 }
1299 }
1300
1301 if (!errors) {
1302 IPAddressACL *nacl = av_mallocz(sizeof(*nacl));
1303 IPAddressACL **naclp = 0;
1304
1305 acl.next = 0;
1306 *nacl = acl;
1307
1308 if (stream)
1309 naclp = &stream->acl;
1310 else if (feed)
1311 naclp = &feed->acl;
1312 else if (ext_acl)
1313 naclp = &ext_acl;
1314 else {
1315 fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n",
1316 filename, line_num);
1317 errors++;
1318 }
1319
1320 if (naclp) {
1321 while (*naclp)

Callers 2

parse_dynamic_aclFunction · 0.85
parse_ffconfigFunction · 0.85

Calls 3

get_argFunction · 0.85
resolve_hostFunction · 0.85
av_malloczFunction · 0.85

Tested by

no test coverage detected