Deleted Added
full compact
addrmatch.c (181111) addrmatch.c (192595)
1/* $OpenBSD: addrmatch.c,v 1.3 2008/06/10 23:06:19 djm Exp $ */
1/* $OpenBSD: addrmatch.c,v 1.4 2008/12/10 03:55:20 stevesk Exp $ */
2
3/*
4 * Copyright (c) 2004-2008 Damien Miller <djm@mindrot.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *

--- 16 unchanged lines hidden (view full) ---

26#include <netdb.h>
27#include <string.h>
28#include <stdlib.h>
29#include <stdio.h>
30#include <stdarg.h>
31
32#include "match.h"
33#include "log.h"
2
3/*
4 * Copyright (c) 2004-2008 Damien Miller <djm@mindrot.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *

--- 16 unchanged lines hidden (view full) ---

26#include <netdb.h>
27#include <string.h>
28#include <stdlib.h>
29#include <stdio.h>
30#include <stdarg.h>
31
32#include "match.h"
33#include "log.h"
34#include "xmalloc.h"
34
35struct xaddr {
36 sa_family_t af;
37 union {
38 struct in_addr v4;
39 struct in6_addr v6;
40 u_int8_t addr8[16];
41 u_int32_t addr32[4];

--- 50 unchanged lines hidden (view full) ---

92 xa->af = AF_INET;
93 memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4));
94 break;
95 case AF_INET6:
96 if (slen < sizeof(*in6))
97 return -1;
98 xa->af = AF_INET6;
99 memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6));
35
36struct xaddr {
37 sa_family_t af;
38 union {
39 struct in_addr v4;
40 struct in6_addr v6;
41 u_int8_t addr8[16];
42 u_int32_t addr32[4];

--- 50 unchanged lines hidden (view full) ---

93 xa->af = AF_INET;
94 memcpy(&xa->v4, &in4->sin_addr, sizeof(xa->v4));
95 break;
96 case AF_INET6:
97 if (slen < sizeof(*in6))
98 return -1;
99 xa->af = AF_INET6;
100 memcpy(&xa->v6, &in6->sin6_addr, sizeof(xa->v6));
101#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
100 xa->scope_id = in6->sin6_scope_id;
102 xa->scope_id = in6->sin6_scope_id;
103#endif
101 break;
102 default:
103 return -1;
104 }
105
106 return 0;
107}
108

--- 301 unchanged lines hidden (view full) ---

410 }
411 continue;
412 } else {
413 /* If CIDR parse failed, try wildcard string match */
414 if (addr != NULL && match_pattern(addr, cp) == 1)
415 goto foundit;
416 }
417 }
104 break;
105 default:
106 return -1;
107 }
108
109 return 0;
110}
111

--- 301 unchanged lines hidden (view full) ---

413 }
414 continue;
415 } else {
416 /* If CIDR parse failed, try wildcard string match */
417 if (addr != NULL && match_pattern(addr, cp) == 1)
418 goto foundit;
419 }
420 }
418 free(o);
421 xfree(o);
419
420 return ret;
421}
422
423 return ret;
424}