Revision 2bd8416e ffserver.c

View differences:

ffserver.c
1120 1120
    enum IPAddressAction last_action = IP_DENY;
1121 1121
    IPAddressACL *acl;
1122 1122
    struct in_addr *src = &c->from_addr.sin_addr;
1123
    unsigned long src_addr = ntohl(src->s_addr);
1123
    unsigned long src_addr = src->s_addr;
1124 1124

  
1125 1125
    for (acl = stream->acl; acl; acl = acl->next) {
1126 1126
        if (src_addr >= acl->first.s_addr && src_addr <= acl->last.s_addr) {
......
4268 4268
            audio_id = CODEC_ID_NONE;
4269 4269
        } else if (!strcasecmp(cmd, "ACL")) {
4270 4270
            IPAddressACL acl;
4271
            struct hostent *he;
4272 4271

  
4273 4272
            get_arg(arg, sizeof(arg), &p);
4274 4273
            if (strcasecmp(arg, "allow") == 0) {
......
4282 4281
            }
4283 4282

  
4284 4283
            get_arg(arg, sizeof(arg), &p);
4285

  
4286
            he = gethostbyname(arg);
4287
            if (!he) {
4284
	    
4285
            if (resolve_host(&acl.first, arg) != 0) {
4288 4286
                fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
4289 4287
                        filename, line_num, arg);
4290 4288
                errors++;
4291 4289
            } else {
4292
                /* Only take the first */
4293
                acl.first.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr);
4294 4290
                acl.last = acl.first;
4295 4291
            }
4296 4292

  
4297 4293
            get_arg(arg, sizeof(arg), &p);
4298 4294

  
4299 4295
            if (arg[0]) {
4300
                he = gethostbyname(arg);
4301
                if (!he) {
4296
                if (resolve_host(&acl.last, arg) != 0) {
4302 4297
                    fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
4303 4298
                            filename, line_num, arg);
4304 4299
                    errors++;
4305
                } else {
4306
                    /* Only take the first */
4307
                    acl.last.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr);
4308 4300
                }
4309 4301
            }
4310 4302

  

Also available in: Unified diff