summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-11-09 10:45:19 +0300
committerKozlov Dmitry <dima@server>2010-11-09 10:45:19 +0300
commitea29f31e5b072ea1247a18bbecb9e2f47a36bc72 (patch)
tree6f515df8fb680d2443c2b7efcd9941a1b21e29a8
parent1396b7c22bbd319fc22ee420c14cdb69f8d5203c (diff)
downloadaccel-ppp-ea29f31e5b072ea1247a18bbecb9e2f47a36bc72.tar.gz
accel-ppp-ea29f31e5b072ea1247a18bbecb9e2f47a36bc72.zip
radius: send Acct-Session-Id in Access-Request packet if sid_in_auth option is set (for broken billings)
-rw-r--r--accel-pptpd/radius/auth.c16
-rw-r--r--accel-pptpd/radius/radius.c6
-rw-r--r--accel-pptpd/radius/radius_p.h1
3 files changed, 23 insertions, 0 deletions
diff --git a/accel-pptpd/radius/auth.c b/accel-pptpd/radius/auth.c
index 352da70c..2d17b67a 100644
--- a/accel-pptpd/radius/auth.c
+++ b/accel-pptpd/radius/auth.c
@@ -192,6 +192,10 @@ int rad_auth_pap(struct radius_pd_t *rpd, const char *username, va_list args)
_free(epasswd);
+ if (conf_sid_in_auth)
+ if (rad_packet_add_str(req->pack, "Acct-Session-Id", rpd->ppp->sessionid, PPP_SESSIONID_LEN))
+ return -1;
+
r = rad_auth_send(req);
if (r == PWDB_SUCCESS) {
struct ev_radius_t ev = {
@@ -260,6 +264,10 @@ int rad_auth_chap_md5(struct radius_pd_t *rpd, const char *username, va_list arg
return -1;
}
+ if (conf_sid_in_auth)
+ if (rad_packet_add_str(rpd->auth_req->pack, "Acct-Session-Id", rpd->ppp->sessionid, PPP_SESSIONID_LEN))
+ goto out;
+
r = rad_auth_send(rpd->auth_req);
if (r == PWDB_SUCCESS) {
struct ev_radius_t ev = {
@@ -369,6 +377,10 @@ int rad_auth_mschap_v1(struct radius_pd_t *rpd, const char *username, va_list ar
return -1;
}
+ if (conf_sid_in_auth)
+ if (rad_packet_add_str(rpd->auth_req->pack, "Acct-Session-Id", rpd->ppp->sessionid, PPP_SESSIONID_LEN))
+ goto out;
+
r = rad_auth_send(rpd->auth_req);
if (r == PWDB_SUCCESS) {
struct ev_radius_t ev = {
@@ -440,6 +452,10 @@ int rad_auth_mschap_v2(struct radius_pd_t *rpd, const char *username, va_list ar
return -1;
}
+ if (conf_sid_in_auth)
+ if (rad_packet_add_str(rpd->auth_req->pack, "Acct-Session-Id", rpd->ppp->sessionid, PPP_SESSIONID_LEN))
+ goto out;
+
r = rad_auth_send(rpd->auth_req);
if (r == PWDB_SUCCESS) {
ra = rad_packet_find_vendor_attr(rpd->auth_req->reply, "Microsoft", "MS-CHAP2-Success");
diff --git a/accel-pptpd/radius/radius.c b/accel-pptpd/radius/radius.c
index bb8e2162..edec82a0 100644
--- a/accel-pptpd/radius/radius.c
+++ b/accel-pptpd/radius/radius.c
@@ -39,6 +39,8 @@ int conf_acct_server_port = 1813;
char *conf_acct_secret;
char *conf_dm_coa_secret;
+int conf_sid_in_auth = 0;
+
static LIST_HEAD(sessions);
static pthread_rwlock_t sessions_lock = PTHREAD_RWLOCK_INITIALIZER;
@@ -411,6 +413,10 @@ static void __init radius_init(void)
if (opt)
dict = opt;
+ opt = conf_get_opt("radius", "sid_in_auth");
+ if (opt && atoi(opt) > 0)
+ conf_sid_in_auth = 1;
+
if (rad_dict_load(dict))
_exit(EXIT_FAILURE);
diff --git a/accel-pptpd/radius/radius_p.h b/accel-pptpd/radius/radius_p.h
index c8a06589..99db1455 100644
--- a/accel-pptpd/radius/radius_p.h
+++ b/accel-pptpd/radius/radius_p.h
@@ -68,6 +68,7 @@ extern char *conf_acct_server;
extern char *conf_acct_secret;
extern int conf_acct_server_port;
extern char *conf_dm_coa_secret;
+extern int conf_sid_in_auth;
int rad_check_nas_pack(struct rad_packet_t *pack);
struct radius_pd_t *rad_find_session(const char *sessionid, const char *username, int port_id, in_addr_t ipaddr, const char *csid);