diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-09-13 01:19:42 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2010-09-13 01:19:42 +0400 |
commit | f39fda2ddb7a8b80a33f155994f27794dd84a198 (patch) | |
tree | 1e13a8f658504a0f0e4f1cd2a0cf26d9f0d1dcec | |
parent | 65a665f6c655766a6d990e8aba47a811d0c3fecc (diff) | |
download | accel-ppp-f39fda2ddb7a8b80a33f155994f27794dd84a198.tar.gz accel-ppp-f39fda2ddb7a8b80a33f155994f27794dd84a198.zip |
log_pgsql: fixed bug - msg->tpd is uninitialized when general_log is called
radius: upgraded dictionary to support vendor-specific
-rw-r--r-- | accel-pptpd/accel-pptpd.conf | 6 | ||||
-rw-r--r-- | accel-pptpd/logs/log_pgsql.c | 11 | ||||
-rw-r--r-- | accel-pptpd/radius/auth.c | 2 | ||||
-rw-r--r-- | accel-pptpd/radius/dict.c | 272 | ||||
-rw-r--r-- | accel-pptpd/radius/dictionary | 243 | ||||
-rw-r--r-- | accel-pptpd/radius/radius.c | 2 | ||||
-rw-r--r-- | accel-pptpd/radius/radius.h | 10 | ||||
-rw-r--r-- | accel-pptpd/radius/req.c | 4 |
8 files changed, 203 insertions, 347 deletions
diff --git a/accel-pptpd/accel-pptpd.conf b/accel-pptpd/accel-pptpd.conf index e3df5f2c..7d711e02 100644 --- a/accel-pptpd/accel-pptpd.conf +++ b/accel-pptpd/accel-pptpd.conf @@ -1,10 +1,10 @@ [modules] +./liblog_file.so +./liblog_pgsql.so ./libpptp.so ./libauth_pap.so ./libauth_chap_md5.so ./libradius.so -./liblog_file.so -./liblog_pgsql.so [core] log-error=/dev/stderr @@ -20,7 +20,7 @@ echo-failure=3 echo-interval=3 [radius] -dictionary=dictionary +dictionary=../radius/etc/dictionary nas-identifier=pptp nas-ip-address=127.0.0.1 gw-ip-address=192.168.100.100 diff --git a/accel-pptpd/logs/log_pgsql.c b/accel-pptpd/logs/log_pgsql.c index 81e35cca..cd06881d 100644 --- a/accel-pptpd/logs/log_pgsql.c +++ b/accel-pptpd/logs/log_pgsql.c @@ -136,7 +136,7 @@ static void wakeup_log(void) write_next_msg(); } -static void general_log(struct log_msg_t *msg) +static void queue_log(struct log_msg_t *msg) { int r = 0; spin_lock(&queue_lock); @@ -152,10 +152,17 @@ static void general_log(struct log_msg_t *msg) triton_context_call(&pgsql_ctx, (void (*)(void*))wakeup_log, NULL); } + +static void general_log(struct log_msg_t *msg) +{ + msg->tpd = NULL; + queue_log(msg); +} + static void session_log(struct ppp_t *ppp, struct log_msg_t *msg) { msg->tpd = ppp; - general_log(msg); + queue_log(msg); } static int wait_connect(struct triton_md_handler_t *h) diff --git a/accel-pptpd/radius/auth.c b/accel-pptpd/radius/auth.c index e2d2478b..5792b8f1 100644 --- a/accel-pptpd/radius/auth.c +++ b/accel-pptpd/radius/auth.c @@ -60,7 +60,7 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args) if (!epasswd) goto out; - if (rad_packet_add_octets(req->pack, "Password", epasswd, epasswd_len)) { + if (rad_packet_add_octets(req->pack, "User-Password", epasswd, epasswd_len)) { free(epasswd); goto out; } diff --git a/accel-pptpd/radius/dict.c b/accel-pptpd/radius/dict.c index 0e969627..27923518 100644 --- a/accel-pptpd/radius/dict.c +++ b/accel-pptpd/radius/dict.c @@ -2,6 +2,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <limits.h> #include "list.h" #include "radius.h" @@ -30,13 +31,13 @@ static int split(char *buf, char **ptr) for (i = 0; i < 3; i++) { buf = skip_word(buf); if (!*buf) - return -1; + return i; *buf = 0; buf = skip_space(buf + 1); if (!*buf) - return -1; + return i; ptr[i] = buf; } @@ -47,14 +48,14 @@ static int split(char *buf, char **ptr) //else if (*buf) // return -1; - return 0; + return i; } -struct rad_dict_attr_t *find_attr(struct rad_dict_t *dict, const char *name) +struct rad_dict_attr_t *find_attr(struct list_head *items, const char *name) { struct rad_dict_attr_t *attr; - list_for_each_entry(attr, &dict->items, entry) + list_for_each_entry(attr, items, entry) if (!strcmp(attr->name, name)) return attr; @@ -62,124 +63,191 @@ struct rad_dict_attr_t *find_attr(struct rad_dict_t *dict, const char *name) } #define BUF_SIZE 1024 -int rad_dict_load(const char *fname) + +static char *path, *fname1, *buf; +static int dict_load(const char *fname) { FILE *f; - char *buf, *ptr[3], *endptr; - int n = 0; + char *ptr[3], *endptr; + int r, n = 0; struct rad_dict_attr_t *attr; struct rad_dict_value_t *val; - + struct rad_dict_vendor_t *vendor; + struct list_head *items; + f = fopen(fname, "r"); if (!f) { log_error("radius: open dictioanary '%s': %s\n", fname, strerror(errno)); return -1; } - buf = malloc(BUF_SIZE); - if (!buf) { - log_emerg("radius: out of memory\n"); - fclose(f); - return -1; - } + items = &dict->items; - dict = malloc(sizeof(*dict)); - if (!dict) { - log_emerg("radius: out of memory\n"); - fclose(f); - free(buf); - return -1; - } - - INIT_LIST_HEAD(&dict->items); - while (fgets(buf, BUF_SIZE, f)) { n++; if (buf[0] == '#' || buf[0] == '\n' || buf[0] == 0) continue; - if (split(buf, ptr)) { - log_error("radius:%s:%i: syntaxis error\n", fname, n); - goto out_err; - } - if (!strcmp(buf, "ATTRIBUTE")) { - attr = malloc(sizeof(*attr)); - if (!attr) { - log_emerg("radius: out of memory\n"); - goto out_err; - } - memset(attr, 0, sizeof(*attr)); - INIT_LIST_HEAD(&attr->values); - list_add_tail(&attr->entry, &dict->items); - attr->name = strdup(ptr[0]); - attr->id = strtol(ptr[1], &endptr, 10); - if (*endptr != 0) { - log_error("radius:%s:%i: syntaxis error\n", fname, n); - goto out_err; - } - if (!strcmp(ptr[2], "integer")) - attr->type = ATTR_TYPE_INTEGER; - else if (!strcmp(ptr[2], "string")) - attr->type = ATTR_TYPE_STRING; - else if (!strcmp(ptr[2], "date")) - attr->type = ATTR_TYPE_DATE; - else if (!strcmp(ptr[2], "ipaddr")) - attr->type = ATTR_TYPE_IPADDR; - else if (!strcmp(ptr[2], "octets")) - attr->type = ATTR_TYPE_OCTETS; - else { - log_error("radius:%s:%i: unknown attribute type\n", fname, n); - goto out_err; - } - } else if (!strcmp(buf, "VALUE")) { - attr = find_attr(dict, ptr[0]); - if (!attr) { - log_error("radius:%s:%i: unknown attribute\n", fname, n); - goto out_err; - } - val = malloc(sizeof(*val)); - if (!val) { - log_emerg("radius: out of memory\n"); - goto out_err; - } - memset(val, 0, sizeof(*val)); - list_add_tail(&val->entry, &attr->values); - val->name = strdup(ptr[1]); - switch (attr->type) { - case ATTR_TYPE_INTEGER: - val->val.integer = strtol(ptr[2], &endptr, 10); - if (*endptr != 0) { - log_error("radius:%s:%i: syntaxis error\n", fname, n); - goto out_err; + r = split(buf, ptr); + if (r == 1) { + if (!strcmp(buf, "BEGIN-VENDOR")) { + vendor = rad_dict_find_vendor_name(ptr[0]); + if (!vendor) { + log_error("radius:%s:%i: vendor not found\n", fname, n); + goto out_err; + } + items = &vendor->items; + } else if (!strcmp(buf, "END-VENDOR")) + items = &dict->items; + else if (!strcmp(buf, "$INCLUDE")) { + for (r = strlen(path) - 1; r; r--) + if (path[r] == '/') { + path[r + 1] = 0; + break; } - break; - case ATTR_TYPE_STRING: - val->val.string = strdup(ptr[2]); - break; - case ATTR_TYPE_DATE: - log_warn("radius:%s:%i: VALUE of type 'date' is not implemented yet\n", fname, n); - break; - case ATTR_TYPE_IPADDR: - log_warn("radius:%s:%i: VALUE of type 'ipaddr' is not implemented yet\n", fname, n); - break; - } - } else { - log_error("radius:%s:%i: syntaxis error\n"); - goto out_err; - } + strcpy(fname1, path); + strcat(fname1, ptr[0]); + if (dict_load(fname1)) + goto out_err; + } else + goto out_err_syntax; + } else if (r == 2) { + if (!strcmp(buf, "VENDOR")) { + vendor = malloc(sizeof(*vendor)); + if (!vendor) { + log_emerg("radius: out of memory\n"); + goto out_err; + } + vendor->id = strtol(ptr[1], &endptr, 10); + if (*endptr != 0) + goto out_err_syntax; + vendor->name = strdup(ptr[0]); + if (!vendor->name) { + log_emerg("radius: out of memory\n"); + goto out_err; + } + INIT_LIST_HEAD(&vendor->items); + list_add_tail(&vendor->entry, &dict->vendors); + } else + goto out_err_syntax; + } else if (r == 3) { + if (!strcmp(buf, "ATTRIBUTE")) { + attr = malloc(sizeof(*attr)); + if (!attr) { + log_emerg("radius: out of memory\n"); + goto out_err; + } + memset(attr, 0, sizeof(*attr)); + INIT_LIST_HEAD(&attr->values); + list_add_tail(&attr->entry, items); + attr->name = strdup(ptr[0]); + attr->id = strtol(ptr[1], &endptr, 10); + if (*endptr != 0) + goto out_err_syntax; + if (!strcmp(ptr[2], "integer")) + attr->type = ATTR_TYPE_INTEGER; + else if (!strcmp(ptr[2], "string")) + attr->type = ATTR_TYPE_STRING; + else if (!strcmp(ptr[2], "date")) + attr->type = ATTR_TYPE_DATE; + else if (!strcmp(ptr[2], "ipaddr")) + attr->type = ATTR_TYPE_IPADDR; + else if (!strcmp(ptr[2], "octets")) + attr->type = ATTR_TYPE_OCTETS; + else { + log_error("radius:%s:%i: unknown attribute type\n", fname, n); + goto out_err; + } + } else if (!strcmp(buf, "VALUE")) { + attr = find_attr(items, ptr[0]); + if (!attr) { + log_error("radius:%s:%i: unknown attribute\n", fname, n); + goto out_err; + } + val = malloc(sizeof(*val)); + if (!val) { + log_emerg("radius: out of memory\n"); + goto out_err; + } + memset(val, 0, sizeof(*val)); + list_add_tail(&val->entry, &attr->values); + val->name = strdup(ptr[1]); + switch (attr->type) { + case ATTR_TYPE_INTEGER: + val->val.integer = strtol(ptr[2], &endptr, 10); + if (*endptr != 0) + goto out_err_syntax; + break; + case ATTR_TYPE_STRING: + val->val.string = strdup(ptr[2]); + break; + case ATTR_TYPE_DATE: + log_warn("radius:%s:%i: VALUE of type 'date' is not implemented yet\n", fname, n); + break; + case ATTR_TYPE_IPADDR: + log_warn("radius:%s:%i: VALUE of type 'ipaddr' is not implemented yet\n", fname, n); + break; + } + } else + goto out_err_syntax; + } else + goto out_err_syntax; } - free(buf); fclose(f); return 0; +out_err_syntax: + log_error("radius:%s:%i: syntaxis error\n", fname, n); out_err: - rad_dict_free(dict); - free(buf); fclose(f); return -1; } +int rad_dict_load(const char *fname) +{ + int r = -1; + + dict = malloc(sizeof(*dict)); + if (!dict) { + log_emerg("radius: out of memory\n"); + return -1; + } + INIT_LIST_HEAD(&dict->items); + INIT_LIST_HEAD(&dict->vendors); + + path = malloc(PATH_MAX); + if (!path) { + log_emerg("radius: out of memory\n"); + goto out_free_dict; + } + + fname1 = malloc(PATH_MAX); + if (!fname1) { + log_emerg("radius: out of memory\n"); + goto out_free_path; + } + + buf = malloc(BUF_SIZE); + if (!buf) { + log_emerg("radius: out of memory\n"); + goto out_free_fname1; + } + + strcpy(path, fname); + + r = dict_load(fname); + +out_free_fname1: + free(fname1); +out_free_path: + free(path); +out_free_dict: + if (r) + rad_dict_free(dict); + return r; +} + void rad_dict_free(struct rad_dict_t *dict) { struct rad_dict_attr_t *attr; @@ -246,3 +314,15 @@ struct rad_dict_value_t *rad_dict_find_val(struct rad_dict_attr_t *attr, rad_val return NULL; } + +struct rad_dict_vendor_t *rad_dict_find_vendor_name(const char *name) +{ + struct rad_dict_vendor_t *vendor; + + list_for_each_entry(vendor, &dict->vendors, entry) { + if (!strcmp(vendor->name, name)) + return vendor; + } + + return NULL; +} diff --git a/accel-pptpd/radius/dictionary b/accel-pptpd/radius/dictionary deleted file mode 100644 index 223cc26c..00000000 --- a/accel-pptpd/radius/dictionary +++ /dev/null @@ -1,243 +0,0 @@ -# -# Updated 97/06/13 to livingston-radius-2.01 miquels@cistron.nl -# -# This file contains dictionary translations for parsing -# requests and generating responses. All transactions are -# composed of Attribute/Value Pairs. The value of each attribute -# is specified as one of 4 data types. Valid data types are: -# -# string - 0-253 octets -# ipaddr - 4 octets in network byte order -# integer - 32 bit value in big endian order (high byte first) -# date - 32 bit value in big endian order - seconds since -# 00:00:00 GMT, Jan. 1, 1970 -# -# Enumerated values are stored in the user file with dictionary -# VALUE translations for easy administration. -# -# Example: -# -# ATTRIBUTE VALUE -# --------------- ----- -# Framed-Protocol = PPP -# 7 = 1 (integer encoding) -# - -# -# Following are the proper new names. Use these. -# -ATTRIBUTE User-Name 1 string -ATTRIBUTE Password 2 octets -ATTRIBUTE CHAP-Password 3 octets -ATTRIBUTE NAS-IP-Address 4 ipaddr -ATTRIBUTE NAS-Port-Id 5 integer -ATTRIBUTE Service-Type 6 integer -ATTRIBUTE Framed-Protocol 7 integer -ATTRIBUTE Framed-IP-Address 8 ipaddr -ATTRIBUTE Framed-IP-Netmask 9 ipaddr -ATTRIBUTE Framed-Routing 10 integer -ATTRIBUTE Filter-Id 11 string -ATTRIBUTE Framed-MTU 12 integer -ATTRIBUTE Framed-Compression 13 integer -ATTRIBUTE Login-IP-Host 14 ipaddr -ATTRIBUTE Login-Service 15 integer -ATTRIBUTE Login-TCP-Port 16 integer -ATTRIBUTE Reply-Message 18 string -ATTRIBUTE Callback-Number 19 string -ATTRIBUTE Callback-Id 20 string -ATTRIBUTE Framed-Route 22 string -ATTRIBUTE Framed-IPX-Network 23 ipaddr -ATTRIBUTE State 24 string -ATTRIBUTE Class 25 string -ATTRIBUTE Vendor-Specific 26 string -ATTRIBUTE Session-Timeout 27 integer -ATTRIBUTE Idle-Timeout 28 integer -ATTRIBUTE Termination-Action 29 integer -ATTRIBUTE Called-Station-Id 30 string -ATTRIBUTE Calling-Station-Id 31 string -ATTRIBUTE NAS-Identifier 32 string -ATTRIBUTE Proxy-State 33 string -ATTRIBUTE Login-LAT-Service 34 string -ATTRIBUTE Login-LAT-Node 35 string -ATTRIBUTE Login-LAT-Group 36 string -ATTRIBUTE Framed-AppleTalk-Link 37 integer -ATTRIBUTE Framed-AppleTalk-Network 38 integer -ATTRIBUTE Framed-AppleTalk-Zone 39 string -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-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-Terminate-Cause 49 integer -ATTRIBUTE Acct-Multi-Session-Id 50 string -ATTRIBUTE Acct-Link-Count 51 integer -ATTRIBUTE Event-Timestamp 55 integer -ATTRIBUTE CHAP-Challenge 60 string -ATTRIBUTE NAS-Port-Type 61 integer -ATTRIBUTE Port-Limit 62 integer -ATTRIBUTE Login-LAT-Port 63 integer -ATTRIBUTE Connect-Info 77 string - -ATTRIBUTE Acct-Interim-Interval 85 integer -ATTRIBUTE Error-Cause 101 integer - -# -# RFC3162 IPv6 attributes -# -ATTRIBUTE NAS-IPv6-Address 95 string -ATTRIBUTE Framed-Interface-Id 96 string -ATTRIBUTE Framed-IPv6-Prefix 97 string -ATTRIBUTE Login-IPv6-Host 98 string -ATTRIBUTE Framed-IPv6-Route 99 string -ATTRIBUTE Framed-IPv6-Pool 100 string - -# -# Experimental Non Protocol Attributes used by Cistron-Radiusd -# -ATTRIBUTE Huntgroup-Name 221 string -ATTRIBUTE User-Category 1029 string -ATTRIBUTE Group-Name 1030 string -ATTRIBUTE Simultaneous-Use 1034 integer -ATTRIBUTE Strip-User-Name 1035 integer -ATTRIBUTE Fall-Through 1036 integer -ATTRIBUTE Add-Port-To-IP-Address 1037 integer -ATTRIBUTE Exec-Program 1038 string -ATTRIBUTE Exec-Program-Wait 1039 string -ATTRIBUTE Hint 1040 string - -# -# Non-Protocol Attributes -# These attributes are used internally by the server -# -ATTRIBUTE Expiration 21 date -ATTRIBUTE Auth-Type 1000 integer -ATTRIBUTE Menu 1001 string -ATTRIBUTE Termination-Menu 1002 string -ATTRIBUTE Prefix 1003 string -ATTRIBUTE Suffix 1004 string -ATTRIBUTE Group 1005 string -ATTRIBUTE Crypt-Password 1006 string -ATTRIBUTE Connect-Rate 1007 integer - -# -# Integer Translations -# - -# User Types - -VALUE Service-Type Login-User 1 -VALUE Service-Type Framed-User 2 -VALUE Service-Type Callback-Login-User 3 -VALUE Service-Type Callback-Framed-User 4 -VALUE Service-Type Outbound-User 5 -VALUE Service-Type Administrative-User 6 -VALUE Service-Type NAS-Prompt-User 7 - -# Framed Protocols - -VALUE Framed-Protocol PPP 1 -VALUE Framed-Protocol SLIP 2 - -# Framed Routing Values - -VALUE Framed-Routing None 0 -VALUE Framed-Routing Broadcast 1 -VALUE Framed-Routing Listen 2 -VALUE Framed-Routing Broadcast-Listen 3 - -# Framed Compression Types - -VALUE Framed-Compression None 0 -VALUE Framed-Compression Van-Jacobson-TCP-IP 1 - -# Login Services - -VALUE Login-Service Telnet 0 -VALUE Login-Service Rlogin 1 -VALUE Login-Service TCP-Clear 2 -VALUE Login-Service PortMaster 3 - -# Status Types - -VALUE Acct-Status-Type Start 1 -VALUE Acct-Status-Type Stop 2 -VALUE Acct-Status-Type Interim-Update 3 -VALUE Acct-Status-Type Accounting-On 7 -VALUE Acct-Status-Type Accounting-Off 8 - -# Authentication Types - -VALUE Acct-Authentic RADIUS 1 -VALUE Acct-Authentic Local 2 -VALUE Acct-Authentic PowerLink128 100 - -# Termination Options - -VALUE Termination-Action Default 0 -VALUE Termination-Action RADIUS-Request 1 - -# NAS Port Types, available in 3.3.1 and later - -VALUE NAS-Port-Type Async 0 -VALUE NAS-Port-Type Sync 1 -VALUE NAS-Port-Type ISDN 2 -VALUE NAS-Port-Type ISDN-V120 3 -VALUE NAS-Port-Type ISDN-V110 4 -VALUE NAS-Port-Type Virtual 5 - -# Acct Terminate Causes, available in 3.3.2 and later - -VALUE Acct-Terminate-Cause User-Request 1 -VALUE Acct-Terminate-Cause Lost-Carrier 2 -VALUE Acct-Terminate-Cause Lost-Service 3 -VALUE Acct-Terminate-Cause Idle-Timeout 4 -VALUE Acct-Terminate-Cause Session-Timeout 5 -VALUE Acct-Terminate-Cause Admin-Reset 6 -VALUE Acct-Terminate-Cause Admin-Reboot 7 -VALUE Acct-Terminate-Cause Port-Error 8 -VALUE Acct-Terminate-Cause NAS-Error 9 -VALUE Acct-Terminate-Cause NAS-Request 10 -VALUE Acct-Terminate-Cause NAS-Reboot 11 -VALUE Acct-Terminate-Cause Port-Unneeded 12 -VALUE Acct-Terminate-Cause Port-Preempted 13 -VALUE Acct-Terminate-Cause Port-Suspended 14 -VALUE Acct-Terminate-Cause Service-Unavailable 15 -VALUE Acct-Terminate-Cause Callback 16 -VALUE Acct-Terminate-Cause User-Error 17 -VALUE Acct-Terminate-Cause Host-Request 18 - -# -# Non-Protocol Integer Translations -# - -VALUE Auth-Type Local 0 -VALUE Auth-Type System 1 -VALUE Auth-Type SecurID 2 -VALUE Auth-Type Crypt-Local 3 -VALUE Auth-Type Reject 4 - -# -# Cistron extensions -# -VALUE Auth-Type Pam 253 -VALUE Auth-Type Accept 254 - -# -# Experimental Non-Protocol Integer Translations for Cistron-Radiusd -# -VALUE Fall-Through No 0 -VALUE Fall-Through Yes 1 -VALUE Add-Port-To-IP-Address No 0 -VALUE Add-Port-To-IP-Address Yes 1 - -# -# Configuration Values -# uncomment these two lines to turn account expiration on -# - -#VALUE Server-Config Password-Expiration 30 -#VALUE Server-Config Password-Warning 5 diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c index 0e9d4b1b..133ed29c 100644 --- a/accel-pptpd/radius/radius.c +++ b/accel-pptpd/radius/radius.c @@ -196,7 +196,7 @@ struct radius_pd_t *rad_find_session_pack(struct rad_packet_t *pack) sessionid = attr->val.string; else if (!strcmp(attr->attr->name, "User-Name")) username = attr->val.string; - else if (!strcmp(attr->attr->name, "NAS-Port-Id")) + else if (!strcmp(attr->attr->name, "NAS-Port")) port_id = attr->val.integer; else if (!strcmp(attr->attr->name, "Framed-IP-Address")) ipaddr = attr->val.ipaddr; diff --git a/accel-pptpd/radius/radius.h b/accel-pptpd/radius/radius.h index 99cb7e42..f2d2f004 100644 --- a/accel-pptpd/radius/radius.h +++ b/accel-pptpd/radius/radius.h @@ -61,6 +61,15 @@ typedef union struct rad_dict_t { struct list_head items; + struct list_head vendors; +}; + +struct rad_dict_vendor_t +{ + struct list_head entry; + int id; + const char *name; + struct list_head items; }; struct rad_dict_value_t @@ -135,6 +144,7 @@ struct rad_dict_attr_t *rad_dict_find_attr(const char *name); struct rad_dict_attr_t *rad_dict_find_attr_id(int type); struct rad_dict_value_t *rad_dict_find_val_name(struct rad_dict_attr_t *, const char *name); struct rad_dict_value_t *rad_dict_find_val(struct rad_dict_attr_t *, rad_value_t val); +struct rad_dict_vendor_t *rad_dict_find_vendor_name(const char *name); struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *username); int rad_req_acct_fill(struct rad_req_t *); diff --git a/accel-pptpd/radius/req.c b/accel-pptpd/radius/req.c index 4a7ac432..e6f29c53 100644 --- a/accel-pptpd/radius/req.c +++ b/accel-pptpd/radius/req.c @@ -50,7 +50,7 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u if (conf_nas_identifier) if (rad_packet_add_str(req->pack, "NAS-Identifier", conf_nas_identifier, strlen(conf_nas_identifier))) goto out_err; - if (rad_packet_add_int(req->pack, "NAS-Port-Id", rpd->ppp->unit_idx)) + if (rad_packet_add_int(req->pack, "NAS-Port", rpd->ppp->unit_idx)) goto out_err; if (rad_packet_add_val(req->pack, "NAS-Port-Type", "Virtual")) goto out_err; @@ -73,6 +73,8 @@ int rad_req_acct_fill(struct rad_req_t *req) memset(req->RA, 0, sizeof(req->RA)); + if (rad_packet_add_val(req->pack, "Acct-Authentic", "RADIUS")) + return -1; if (rad_packet_add_val(req->pack, "Acct-Status-Type", "Start")) return -1; if (rad_packet_add_str(req->pack, "Acct-Session-Id", req->rpd->ppp->sessionid, PPP_SESSIONID_LEN)) |