Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
smradius
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shail
smradius
Commits
f831267d
Commit
f831267d
authored
15 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
* Fixed up handling of vattributes
* Few cosmetic changes
parent
b5318455
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smradiusd
+22
-11
22 additions, 11 deletions
smradiusd
with
22 additions
and
11 deletions
smradiusd
+
22
−
11
View file @
f831267d
...
...
@@ -51,8 +51,6 @@ use Radius::Packet;
use
Socket
;
use
Data::
Dumper
;
# Override configuration
...
...
@@ -483,11 +481,13 @@ sub process_request {
# Main user hash with everything in
my
$user
;
$user
->
{'
ConfigAttributes
'}
=
{};
$user
->
{'
ReplyAttributes
'}
=
{};
$user
->
{'
ReplyVAttributes
'}
=
{};
#
# GRAB & PROCESS CONFIG
#
$user
->
{'
ConfigAttributes
'}
=
{};
foreach
my
$module
(
@
{
$self
->
{'
plugins
'}})
{
# Try find config attribute
...
...
@@ -514,7 +514,6 @@ sub process_request {
# FIXME - need secret
# FIXME - need acl list
use
Data::
Dumper
;
print
(
STDERR
Dumper
(
getAttributeValue
(
$user
->
{'
ConfigAttributes
'},"
SMRadius-Config-Secret
")));
#
# START PROCESSING
...
...
@@ -536,7 +535,8 @@ use Data::Dumper; print (STDERR Dumper(getAttributeValue($user->{'ConfigAttribut
foreach
my
$module
(
@
{
$self
->
{'
plugins
'}})
{
# Try find user
if
(
$module
->
{'
User_find
'})
{
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] FIND: Trying plugin '
"
.
$module
->
{'
Name
'}
.
"
' for username '
"
.
$user
->
{'
Username
'}
.
"
'
");
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] FIND: Trying plugin '
"
.
$module
->
{'
Name
'}
.
"
' for username '
"
.
$user
->
{'
Username
'}
.
"
'
");
my
(
$res
,
$userdb_data
)
=
$module
->
{'
User_find
'}(
$self
,
$user
,
$pkt
);
# Check result
...
...
@@ -624,7 +624,8 @@ use Data::Dumper; print (STDERR Dumper(getAttributeValue($user->{'ConfigAttribut
foreach
my
$module
(
@
{
$self
->
{'
plugins
'}})
{
# Try authenticate
if
(
$module
->
{'
Feature_Post-Accounting_hook
'})
{
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] POST-ACCT: Trying plugin '
"
.
$module
->
{'
Name
'}
.
"
' for '
"
.
$user
->
{'
Username
'}
.
"
'
");
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] POST-ACCT: Trying plugin '
"
.
$module
->
{'
Name
'}
.
"
' for '
"
.
$user
->
{'
Username
'}
.
"
'
");
my
$res
=
$module
->
{'
Feature_Post-Accounting_hook
'}(
$self
,
$user
,
$pkt
);
# Check result
...
...
@@ -687,9 +688,8 @@ use Data::Dumper; print (STDERR Dumper(getAttributeValue($user->{'ConfigAttribut
my
$data
;
$podSock
->
recv
(
$data
,
65536
)
or
return
$self
->
log
(
LOG_ERR
,"
[SMRADIUS] POST-ACCT: Receive data failed: $!
");
my
@stuff
=
unpack
('
C C n a16 a*
',
$data
);
$self
->
log
(
LOG_DEBUG
,"
STUFF:
"
.
Dumper
(
\
@stuff
));
# my @stuff = unpack('C C n a16 a*', $data);
# $self->log(LOG_DEBUG,"STUFF: ".Dumper(\@stuff));
}
# Or maybe a access request
...
...
@@ -836,14 +836,14 @@ use Data::Dumper; print (STDERR Dumper(getAttributeValue($user->{'ConfigAttribut
$resp
->
set_authenticator
(
$pkt
->
authenticator
);
# Loop with attributes we got from the getReplyAttributes function, its a hash of arrays which are the values
my
%replyAttributes
=
()
;
my
%replyAttributes
=
%
{
$user
->
{'
ReplyAttributes
'}
}
;
foreach
my
$attrName
(
keys
%
{
$user
->
{'
Attributes
'}})
{
# Loop with operators
foreach
my
$attrOp
(
keys
%
{
$user
->
{'
Attributes
'}
->
{
$attrName
}})
{
# Grab attribute
my
$attr
=
$user
->
{'
Attributes
'}
->
{
$attrName
}
->
{
$attrOp
};
# Add this to the reply attribute?
g
etReplyAttribute
(
$self
,
\
%replyAttributes
,
$attr
);
s
etReplyAttribute
(
$self
,
\
%replyAttributes
,
$attr
);
}
}
# Loop with reply attributes
...
...
@@ -855,6 +855,17 @@ use Data::Dumper; print (STDERR Dumper(getAttributeValue($user->{'ConfigAttribut
}
}
# Loop with vendor reply attributes
my
%replyVAttributes
=
%
{
$user
->
{'
ReplyVAttributes
'}
};
foreach
my
$vendor
(
keys
%replyVAttributes
)
{
# Loop with operators
foreach
my
$attrName
(
keys
%
{
$replyVAttributes
{
$vendor
}})
{
# Add each value
foreach
my
$value
(
@
{
$replyVAttributes
{
$vendor
}
->
{
$attrName
}})
{
$resp
->
set_vsattr
(
$vendor
,
$attrName
,
$value
);
}
}
}
$udp_packet
=
auth_resp
(
$resp
->
pack
,
getAttributeValue
(
$user
->
{'
ConfigAttributes
'},"
SMRadius-Config-Secret
"));
$server
->
{'
client
'}
->
send
(
$udp_packet
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment