Deleted Added
full compact
radlib.c (197621) radlib.c (228730)
1/*-
2 * Copyright 1998 Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright 1998 Juniper Networks, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libradius/radlib.c 197621 2009-09-29 19:09:17Z mav $");
28__FBSDID("$FreeBSD: head/lib/libradius/radlib.c 228730 2011-12-20 11:13:44Z melifaro $");
29
30#include <sys/types.h>
31#include <sys/socket.h>
32#include <sys/time.h>
33#include <netinet/in.h>
34#include <arpa/inet.h>
35#ifdef WITH_SSL
36#include <openssl/hmac.h>

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

751 h->out[POS_AUTH+i+1] = (u_char)(r >> 8);
752 }
753 } else
754 memset(&h->out[POS_AUTH], 0, LEN_AUTH);
755 h->out_len = POS_ATTRS;
756 clear_password(h);
757 h->authentic_pos = 0;
758 h->out_created = 1;
29
30#include <sys/types.h>
31#include <sys/socket.h>
32#include <sys/time.h>
33#include <netinet/in.h>
34#include <arpa/inet.h>
35#ifdef WITH_SSL
36#include <openssl/hmac.h>

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

751 h->out[POS_AUTH+i+1] = (u_char)(r >> 8);
752 }
753 } else
754 memset(&h->out[POS_AUTH], 0, LEN_AUTH);
755 h->out_len = POS_ATTRS;
756 clear_password(h);
757 h->authentic_pos = 0;
758 h->out_created = 1;
759 h->bindto = INADDR_ANY;
759 return 0;
760}
761
760 return 0;
761}
762
763void
764rad_bind_to(struct rad_handle *h, in_addr_t addr)
765{
766 h->bindto = addr;
767}
768
762int
763rad_create_response(struct rad_handle *h, int code)
764{
765
766 if (h->type != RADIUS_SERVER) {
767 generr(h, "denied function call");
768 return (-1);
769 }

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

852
853 if ((h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
854 generr(h, "Cannot create socket: %s", strerror(errno));
855 return -1;
856 }
857 memset(&sin, 0, sizeof sin);
858 sin.sin_len = sizeof sin;
859 sin.sin_family = AF_INET;
769int
770rad_create_response(struct rad_handle *h, int code)
771{
772
773 if (h->type != RADIUS_SERVER) {
774 generr(h, "denied function call");
775 return (-1);
776 }

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

859
860 if ((h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
861 generr(h, "Cannot create socket: %s", strerror(errno));
862 return -1;
863 }
864 memset(&sin, 0, sizeof sin);
865 sin.sin_len = sizeof sin;
866 sin.sin_family = AF_INET;
860 sin.sin_addr.s_addr = INADDR_ANY;
867 sin.sin_addr.s_addr = h->bindto;
861 sin.sin_port = htons(0);
862 if (bind(h->fd, (const struct sockaddr *)&sin,
863 sizeof sin) == -1) {
864 generr(h, "bind: %s", strerror(errno));
865 close(h->fd);
866 h->fd = -1;
867 return -1;
868 }

--- 552 unchanged lines hidden ---
868 sin.sin_port = htons(0);
869 if (bind(h->fd, (const struct sockaddr *)&sin,
870 sizeof sin) == -1) {
871 generr(h, "bind: %s", strerror(errno));
872 close(h->fd);
873 h->fd = -1;
874 return -1;
875 }

--- 552 unchanged lines hidden ---