Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
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
smradius
smradius
Commits
bced168e
Commit
bced168e
authored
13 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
Ignore blank usernames and disable username transform for now
parent
5d6f9ff1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smradiusd
+31
-0
31 additions, 0 deletions
smradiusd
with
31 additions
and
0 deletions
smradiusd
+
31
−
0
View file @
bced168e
...
@@ -547,6 +547,12 @@ sub process_request {
...
@@ -547,6 +547,12 @@ sub process_request {
# Set username
# Set username
$user
->
{'
Username
'}
=
$pkt
->
attr
('
User-Name
');
$user
->
{'
Username
'}
=
$pkt
->
attr
('
User-Name
');
# Username should always be defined?
if
(
!
defined
(
$user
->
{'
Username
'}))
{
$self
->
log
(
LOG_NOTICE
,"
[SMRADIUS] Packet with no username from
"
.
$server
->
{'
peeraddr
'});
return
;
}
# First thing we do is to make sure the NAS behaves if we using abuse prevention
# First thing we do is to make sure the NAS behaves if we using abuse prevention
if
(
$self
->
{'
smradius
'}
->
{'
use_abuse_prevention
'}
&&
defined
(
$user
->
{'
Username
'}))
{
if
(
$self
->
{'
smradius
'}
->
{'
use_abuse_prevention
'}
&&
defined
(
$user
->
{'
Username
'}))
{
my
(
$res
,
$val
)
=
cacheGetKeyPair
('
FloodCheck
',
$server
->
{'
peeraddr
'}
.
"
/
"
.
$user
->
{'
Username
'}
.
"
/
"
.
$pkt
->
code
);
my
(
$res
,
$val
)
=
cacheGetKeyPair
('
FloodCheck
',
$server
->
{'
peeraddr
'}
.
"
/
"
.
$user
->
{'
Username
'}
.
"
/
"
.
$pkt
->
code
);
...
@@ -601,6 +607,31 @@ sub process_request {
...
@@ -601,6 +607,31 @@ sub process_request {
}
}
}
}
# If we have a config attribute to transform username, use it
if
(
defined
(
$user
->
{'
ConfigAttributes
'}
->
{'
SMRadius-Username-Transform
'}))
{
$self
->
log
(
LOG_DEBUG
,"
[SMRADIUS] Attribute 'SMRadius-Username-Transform' exists, transforming username.
");
# NK: Not ready for prime time yet
# # Get clients(NAS) username transform pattern
# my $transform = shift(@{$user->{'ConfigAttributes'}->{'SMRadius-Username-Transform'}});
# if ($transform =~ /^(@\S+)=(@\S+)$/i) {
#
# # Set old and new, prevents warnings
# my ($old,$new) = ($1,$2);
#
# # Use client username transform on temp username
# my $tempUsername = $user->{'Username'};
# $tempUsername =~ s/$old/$new/;
#
# # Override username
# $user->{'Username'} = $tempUsername;
# } else {
# $self->log(LOG_DEBUG,"[SMRADIUS] No string replacement possible on pattern '".
# $transform."', using username '".$user->{'Username'}."'");
# }
}
# Get the user timer
# Get the user timer
my
$timer1
=
[
gettimeofday
];
my
$timer1
=
[
gettimeofday
];
...
...
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