--- Trying to compile and use the DHCP server, I find these things that need to be fixed (code untested as yet, I intend to use the DHCP server in a production environment later this weekend). src/include/dhcp.h | 2 +- src/lib/dhcp.c | 4 ++-- src/lib/radius.c | 2 +- src/main/dhcpd.c | 8 ++++---- src/modules/rlm_ldap/rlm_ldap.c | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/include/dhcp.h b/src/include/dhcp.h index 63ab5e9..4305c0d 100644 --- a/src/include/dhcp.h +++ b/src/include/dhcp.h @@ -62,7 +62,7 @@ int fr_dhcp_decode(RADIUS_PACKET *packet); #define DHCP_UNPACK_OPTION1(x) (((x) & 0xff00) >> 8) #define PW_DHCP_MESSAGE_TYPE (53) -#define PW_DHCP_YOU_IP_ADDRESS (264) +#define PW_DHCP_YOUR_IP_ADDRESS (264) #define PW_DHCP_SUBNET_MASK (1) #define PW_DHCP_IP_ADDRESS_LEASE_TIME (51) diff --git a/src/lib/dhcp.c b/src/lib/dhcp.c index d234d60..5879135 100644 --- a/src/lib/dhcp.c +++ b/src/lib/dhcp.c @@ -1141,7 +1141,7 @@ int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original) } } - vp = pairfind(packet->vps, DHCP2ATTR(256)); + vp = pairfind(packet->vps, 256, DHCP_MAGIC_VENDOR); if (vp) { *p++ = vp->vp_integer & 0xff; } else { @@ -1154,7 +1154,7 @@ int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original) *p++ = 1; /* hardware type = ethernet */ *p++ = 6; /* 6 bytes of ethernet */ - vp = pairfind(packet->vps, DHCP2ATTR(259)); + vp = pairfind(packet->vps, 259, DHCP_MAGIC_VENDOR); if (vp) { *p++ = vp->vp_integer & 0xff; } else { diff --git a/src/lib/radius.c b/src/lib/radius.c index 5eb3ae3..6c09b4f 100644 --- a/src/lib/radius.c +++ b/src/lib/radius.c @@ -278,7 +278,7 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags, */ rcode = sendto(sockfd, data, data_len, flags, (struct sockaddr *) &dst, sizeof_dst); - if (rcode < 0) { +done: if (rcode < 0) { DEBUG("rad_send() failed: %s\n", strerror(errno)); } diff --git a/src/main/dhcpd.c b/src/main/dhcpd.c index c216bcf..5af566d 100644 --- a/src/main/dhcpd.c +++ b/src/main/dhcpd.c @@ -107,7 +107,7 @@ static int dhcp_process(REQUEST *request) /* * Hop count goes up. */ - vp = pairfind(request->reply->vps, DHCP2ATTR(259)); + vp = pairfind(request->reply->vps, 259, DHCP_MAGIC_VENDOR); if (vp) vp->vp_integer++; return 1; @@ -123,7 +123,7 @@ static int dhcp_process(REQUEST *request) * server. So we must be the destination of the * giaddr field. */ - pairdelete(&request->packet->vps, DHCP2ATTR(266)); + pairdelete(&request->packet->vps, 266, DHCP_MAGIC_VENDOR); rad_free(&request->reply); request->reply = request->packet; @@ -132,7 +132,7 @@ static int dhcp_process(REQUEST *request) /* * Search for client IP address. */ - vp = pairfind(request->packet->vps, DHCP2ATTR(264)); + vp = pairfind(request->packet->vps, 264, DHCP_MAGIC_VENDOR); if (!vp) { request->reply->code = 0; RDEBUG("DHCP: No YIAddr in the reply. Discarding packet"); @@ -151,7 +151,7 @@ static int dhcp_process(REQUEST *request) /* * Hop count goes down. */ - vp = pairfind(request->reply->vps, DHCP2ATTR(259)); + vp = pairfind(request->reply->vps, 259, DHCP_MAGIC_VENDOR); if (vp && (vp->vp_integer > 0)) vp->vp_integer--; /* diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c index 8b08f6a..129e5ea 100644 --- a/src/modules/rlm_ldap/rlm_ldap.c +++ b/src/modules/rlm_ldap/rlm_ldap.c @@ -1580,7 +1580,7 @@ static int ldap_authorize(void *instance, REQUEST * request) if (res == 0){ passwd_val = universal_password; if (passwd_val){ - passwd_item = radius_paircreate(request, &request->config_items, PW_CLEARTEXT_PASSWORD, PW_TYPE_STRING); + passwd_item = radius_paircreate(request, &request->config_items, PW_CLEARTEXT_PASSWORD, 0, PW_TYPE_STRING); strlcpy(passwd_item->vp_strvalue,passwd_val,sizeof(passwd_item->vp_strvalue)); passwd_item->length = strlen(passwd_item->vp_strvalue); added_known_password = 1; @@ -1602,7 +1602,7 @@ static int ldap_authorize(void *instance, REQUEST * request) * The authorize method of no other LDAP module instance has * processed this request. */ - vp_inst = radius_paircreate(request, &request->config_items, inst_attr, PW_TYPE_STRING); + vp_inst = radius_paircreate(request, &request->config_items, inst_attr, 0, PW_TYPE_STRING); strlcpy(vp_inst->vp_strvalue, inst->xlat_name, sizeof(vp_inst->vp_strvalue)); vp_inst->length = strlen(vp_inst->vp_strvalue); @@ -1611,7 +1611,7 @@ static int ldap_authorize(void *instance, REQUEST * request) * of UP in the config items list and whether eDirectory account * policy check is to be performed or not. */ - vp_apc = radius_paircreate(request, &request->config_items, apc_attr, PW_TYPE_STRING); + vp_apc = radius_paircreate(request, &request->config_items, apc_attr, 0, PW_TYPE_STRING); if(!inst->edir_account_policy_check){ /* Do nothing */ strcpy(vp_apc->vp_strvalue, "1"); @@ -1649,7 +1649,7 @@ static int ldap_authorize(void *instance, REQUEST * request) auth_opt_attr = dattr->attr; if(pairfind(*check_pairs, auth_opt_attr, 0) == NULL){ if ((auth_option = ldap_get_values(conn->ld, msg, "sasDefaultLoginSequence")) != NULL) { - if ((vp_auth_opt = paircreate(auth_opt_attr, PW_TYPE_STRING)) == NULL){ + if ((vp_auth_opt = paircreate(auth_opt_attr, 0, PW_TYPE_STRING)) == NULL){ radlog(L_ERR, " [%s] Could not allocate memory. Aborting.", inst->xlat_name); ldap_msgfree(result); ldap_release_conn(conn_id, inst); @@ -1979,7 +1979,7 @@ retry: /* Generate state attribute */ state = rad_malloc(MAX_CHALLENGE_LEN); (void) sprintf(state, "%s%s", challenge, challenge); - vp_state = paircreate(PW_STATE, PW_TYPE_OCTETS); + vp_state = paircreate(PW_STATE, 0, PW_TYPE_OCTETS); memcpy(vp_state->vp_strvalue, state, strlen(state)); vp_state->length = strlen(state); pairadd(&request->reply->vps, vp_state); -- 1.7.5.4 -- Stephen.