diff options
author | Kozlov Dmitry <dima@server> | 2010-12-28 13:56:49 +0300 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-12-28 13:56:49 +0300 |
commit | 7ab0dd10cbb94ea8246237246fb67d08922bd2d4 (patch) | |
tree | c513b7d4b6dc088d9dca9109174428dbc2e5953d /accel-pptpd | |
parent | 73b6989bdc0066caa4d8c351127345d7785feb92 (diff) | |
download | accel-ppp-xebd-7ab0dd10cbb94ea8246237246fb67d08922bd2d4.tar.gz accel-ppp-xebd-7ab0dd10cbb94ea8246237246fb67d08922bd2d4.zip |
radius: implemented unsigned integer attribute type
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/radius/dict.c | 2 | ||||
-rw-r--r-- | accel-pptpd/radius/dict/dictionary.rfc2866 | 10 | ||||
-rw-r--r-- | accel-pptpd/radius/dict/dictionary.rfc2869 | 4 | ||||
-rw-r--r-- | accel-pptpd/radius/packet.c | 7 | ||||
-rw-r--r-- | accel-pptpd/radius/radius.h | 10 |
5 files changed, 21 insertions, 12 deletions
diff --git a/accel-pptpd/radius/dict.c b/accel-pptpd/radius/dict.c index 9704569..785e960 100644 --- a/accel-pptpd/radius/dict.c +++ b/accel-pptpd/radius/dict.c @@ -147,6 +147,8 @@ static int dict_load(const char *fname) goto out_err_syntax; if (!strcmp(ptr[2], "integer")) attr->type = ATTR_TYPE_INTEGER; + else if (!strcmp(ptr[2], "uinteger")) + attr->type = ATTR_TYPE_UINTEGER; else if (!strcmp(ptr[2], "string")) attr->type = ATTR_TYPE_STRING; else if (!strcmp(ptr[2], "date")) diff --git a/accel-pptpd/radius/dict/dictionary.rfc2866 b/accel-pptpd/radius/dict/dictionary.rfc2866 index 15472bd..cd95871 100644 --- a/accel-pptpd/radius/dict/dictionary.rfc2866 +++ b/accel-pptpd/radius/dict/dictionary.rfc2866 @@ -6,14 +6,14 @@ # $Id: dictionary.rfc2866,v 1.2 2005/08/08 22:23:38 aland Exp $ # ATTRIBUTE Acct-Status-Type 40 integer -ATTRIBUTE Acct-Delay-Time 41 integer -ATTRIBUTE Acct-Input-Octets 42 integer -ATTRIBUTE Acct-Output-Octets 43 integer +ATTRIBUTE Acct-Delay-Time 41 uinteger +ATTRIBUTE Acct-Input-Octets 42 uinteger +ATTRIBUTE Acct-Output-Octets 43 uinteger ATTRIBUTE Acct-Session-Id 44 string ATTRIBUTE Acct-Authentic 45 integer ATTRIBUTE Acct-Session-Time 46 integer -ATTRIBUTE Acct-Input-Packets 47 integer -ATTRIBUTE Acct-Output-Packets 48 integer +ATTRIBUTE Acct-Input-Packets 47 uinteger +ATTRIBUTE Acct-Output-Packets 48 uinteger ATTRIBUTE Acct-Terminate-Cause 49 integer ATTRIBUTE Acct-Multi-Session-Id 50 string ATTRIBUTE Acct-Link-Count 51 integer diff --git a/accel-pptpd/radius/dict/dictionary.rfc2869 b/accel-pptpd/radius/dict/dictionary.rfc2869 index 1a2631e..9ece7fe 100644 --- a/accel-pptpd/radius/dict/dictionary.rfc2869 +++ b/accel-pptpd/radius/dict/dictionary.rfc2869 @@ -5,8 +5,8 @@ # # $Id: dictionary.rfc2869,v 1.2 2005/08/08 22:23:39 aland Exp $ # -ATTRIBUTE Acct-Input-Gigawords 52 integer -ATTRIBUTE Acct-Output-Gigawords 53 integer +ATTRIBUTE Acct-Input-Gigawords 52 uinteger +ATTRIBUTE Acct-Output-Gigawords 53 uinteger ATTRIBUTE Event-Timestamp 55 date diff --git a/accel-pptpd/radius/packet.c b/accel-pptpd/radius/packet.c index 21ea8ef..d4d8a9e 100644 --- a/accel-pptpd/radius/packet.c +++ b/accel-pptpd/radius/packet.c @@ -74,6 +74,7 @@ int rad_packet_build(struct rad_packet_t *pack, uint8_t *RA) *ptr = attr->len + 2; ptr++; switch(attr->attr->type) { case ATTR_TYPE_INTEGER: + case ATTR_TYPE_UINTEGER: *(uint32_t*)ptr = htonl(attr->val.integer); break; case ATTR_TYPE_OCTETS: @@ -211,6 +212,7 @@ int rad_packet_recv(int fd, struct rad_packet_t **p, struct sockaddr_in *addr) break; case ATTR_TYPE_DATE: case ATTR_TYPE_INTEGER: + case ATTR_TYPE_UINTEGER: attr->val.integer = ntohl(*(uint32_t*)ptr); break; case ATTR_TYPE_IPADDR: @@ -306,11 +308,14 @@ void rad_packet_print(struct rad_packet_t *pack, void (*print)(const char *fmt, print(" <%s ", attr->attr->name); switch (attr->attr->type) { case ATTR_TYPE_INTEGER: + case ATTR_TYPE_UINTEGER: val = rad_dict_find_val(attr->attr, attr->val); if (val) print("%s", val->name); - else + else if (attr->attr->type == ATTR_TYPE_INTEGER) print("%i", attr->val.integer); + else + print("%u", attr->val.uinteger); break; case ATTR_TYPE_STRING: print("\"%s\"", attr->val.string); diff --git a/accel-pptpd/radius/radius.h b/accel-pptpd/radius/radius.h index c42989e..eadf9e3 100644 --- a/accel-pptpd/radius/radius.h +++ b/accel-pptpd/radius/radius.h @@ -6,10 +6,11 @@ #define REQ_LENGTH_MAX 4096 #define ATTR_TYPE_INTEGER 0 -#define ATTR_TYPE_STRING 1 -#define ATTR_TYPE_OCTETS 2 -#define ATTR_TYPE_DATE 3 -#define ATTR_TYPE_IPADDR 4 +#define ATTR_TYPE_UINTEGER 1 +#define ATTR_TYPE_STRING 2 +#define ATTR_TYPE_OCTETS 3 +#define ATTR_TYPE_DATE 4 +#define ATTR_TYPE_IPADDR 5 #define CODE_ACCESS_REQUEST 1 #define CODE_ACCESS_ACCEPT 2 @@ -29,6 +30,7 @@ typedef union { int integer; + unsigned int uinteger; char *string; uint8_t *octets; time_t date; |