diff options
author | Philip Gladstone <philipjsg@users.sourceforge.net> | 2003-02-23 20:35:47 +0000 |
---|---|---|
committer | Philip Gladstone <philipjsg@users.sourceforge.net> | 2003-02-23 20:35:47 +0000 |
commit | efa04ce2967724778a10a1db0fa65fa693625557 (patch) | |
tree | 40855a3ba5e092977b7a17f3079b9b8d6cbf7f5a /ffserver.c | |
parent | df081b2f3b7edb06d282b084d0b0eaa445b014fb (diff) | |
download | ffmpeg-efa04ce2967724778a10a1db0fa65fa693625557.tar.gz |
Make ACLs work correctly for streams. Try comparing the addresses in
host order rather than network order.
Originally committed as revision 1597 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffserver.c')
-rw-r--r-- | ffserver.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ffserver.c b/ffserver.c index 33989f8e54..bedfe5a7a3 100644 --- a/ffserver.c +++ b/ffserver.c @@ -165,6 +165,7 @@ enum IPAddressAction { typedef struct IPAddressACL { struct IPAddressACL *next; enum IPAddressAction action; + /* These are in host order */ struct in_addr first; struct in_addr last; } IPAddressACL; @@ -1076,9 +1077,10 @@ static int validate_acl(FFStream *stream, HTTPContext *c) enum IPAddressAction last_action = IP_DENY; IPAddressACL *acl; struct in_addr *src = &c->from_addr.sin_addr; + unsigned long src_addr = ntohl(src->s_addr); for (acl = stream->acl; acl; acl = acl->next) { - if (src->s_addr >= acl->first.s_addr && src->s_addr <= acl->last.s_addr) { + if (src_addr >= acl->first.s_addr && src_addr <= acl->last.s_addr) { return (acl->action == IP_ALLOW) ? 1 : 0; } last_action = acl->action; @@ -4095,7 +4097,7 @@ static int parse_ffconfig(const char *filename) errors++; } else { /* Only take the first */ - acl.first = *(struct in_addr *) he->h_addr_list[0]; + acl.first.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr); acl.last = acl.first; } @@ -4109,7 +4111,7 @@ static int parse_ffconfig(const char *filename) errors++; } else { /* Only take the first */ - acl.last = *(struct in_addr *) he->h_addr_list[0]; + acl.last.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr); } } |