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
ac1dee39
Commit
ac1dee39
authored
15 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
* Added setting vattribute reply
parent
02512944
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
smradius/attributes.pm
+99
-6
99 additions, 6 deletions
smradius/attributes.pm
with
99 additions
and
6 deletions
smradius/attributes.pm
+
99
−
6
View file @
ac1dee39
...
...
@@ -30,7 +30,8 @@ our (@ISA,@EXPORT);
@EXPORT
=
qw(
addAttribute
checkAuthAttribute
getReplyAttribute
setReplyAttribute
setReplyVAttribute
processConfigAttribute
getAttributeValue
...
...
@@ -310,13 +311,13 @@ sub checkAuthAttribute
## @fn
g
etReplyAttribute($server,$attributes,$attribute)
## @fn
s
etReplyAttribute($server,$attributes,$attribute)
# Function which sees if we must reply with this attribute
#
# @param server Server instance
# @param attributes Hashref of reply attributes
# @param attribute Attribute to check
sub
g
etReplyAttribute
sub
s
etReplyAttribute
{
my
(
$server
,
$attributes
,
$attribute
)
=
@_
;
...
...
@@ -327,9 +328,6 @@ sub getReplyAttribute
return
2
if
(
$attribute
->
{'
Name
'}
eq
$ignoredAttr
);
}
# Did we find a match
my
$matched
=
0
;
# Figure out our attr values
my
@attrValues
;
if
(
ref
(
$attribute
->
{'
Value
'})
eq
"
ARRAY
")
{
...
...
@@ -405,6 +403,101 @@ sub getReplyAttribute
## @fn setReplyVAttribute($server,$attributes,$attribute)
# Function which sees if we must reply with this attribute
#
# @param server Server instance
# @param attributes Hashref of reply attributes
# @param attribute Attribute to check
sub
setReplyVAttribute
{
my
(
$server
,
$attributes
,
$attribute
)
=
@_
;
# Check ignore list
foreach
my
$ignoredAttr
(
@attributeIgnoreList
)
{
# 2 = IGNORE, so return IGNORE for all ignored items
return
2
if
(
$attribute
->
{'
Name
'}
eq
$ignoredAttr
);
}
# Did we find a match
my
$matched
=
0
;
# Figure out our attr values
my
@attrValues
;
if
(
ref
(
$attribute
->
{'
Value
'})
eq
"
ARRAY
")
{
@attrValues
=
@
{
$attribute
->
{'
Value
'}};
}
else
{
@attrValues
=
(
$attribute
->
{'
Value
'}
);
}
$server
->
log
(
LOG_DEBUG
,"
[VATTRIBUTES] Processing REPLY attribute: '
"
.
$attribute
->
{'
Name
'}
.
"
'
"
.
$attribute
->
{'
Operator
'}
.
"
'
"
.
join
("
','
",
@attrValues
)
.
"
'
");
# Operator: =
#
# Use: Attribute = Value
# Not allowed as a check item for RADIUS protocol attributes. It is allowed for server
# configuration attributes (Auth-Type, etc), and sets the value of on attribute,
# only if there is no other item of the same attribute.
#
# As a reply item, it means "add the item to the reply list, but only if there is
# no other item of the same attribute.
if
(
$attribute
->
{'
Operator
'}
eq
'
=
')
{
# If item does not exist
if
(
!
defined
(
$attributes
->
{
$attribute
->
{'
Vendor
'}}
->
{
$attribute
->
{'
Name
'}}))
{
# Then add
$server
->
log
(
LOG_DEBUG
,"
[VATTRIBUTES] - Attribute '
"
.
$attribute
->
{'
Name
'}
.
"
' no value exists, setting value to '
"
.
join
("
','
",
@attrValues
)
.
"
'
");
@
{
$attributes
->
{
$attribute
->
{'
Vendor
'}}
->
{
$attribute
->
{'
Name
'}}}
=
@attrValues
;
}
# Operator: :=
#
# Use: Attribute := Value
# Always matches as a check item, and replaces in the configuration items any attribute of the same name.
# If no attribute of that name appears in the request, then this attribute is added.
#
# As a reply item, it has an itendtical meaning, but for the reply items, instead of the request items.
}
elsif
(
$attribute
->
{'
Operator
'}
eq
'
:=
')
{
# Overwrite
$server
->
log
(
LOG_DEBUG
,"
[VATTRIBUTES] - Attribute '
"
.
$attribute
->
{'
Name
'}
.
"
' setting attribute value to '
"
.
join
("
','
",
@attrValues
)
.
"
'
");
@
{
$attributes
->
{
$attribute
->
{'
Vendor
'}}
->
{
$attribute
->
{'
Name
'}}}
=
@attrValues
;
# Operator: +=
#
# Use: Attribute += Value
# Always matches as a check item, and adds the current
# attribute with value to the list of configuration items.
#
# As a reply item, it has an itendtical meaning, but the
# attribute is added to the reply items.
}
elsif
(
$attribute
->
{'
Operator
'}
eq
'
+=
')
{
# Then add
$server
->
log
(
LOG_DEBUG
,"
[VATTRIBUTES] - Attribute '
"
.
$attribute
->
{'
Name
'}
.
"
' appending values '
"
.
join
("
','
",
@attrValues
)
.
"
'
");
push
(
@
{
$attributes
->
{
$attribute
->
{'
Vendor
'}}
->
{
$attribute
->
{'
Name
'}}},
@attrValues
);
# Attributes that are not defined
}
else
{
# Ignore and b0rk out
$server
->
log
(
LOG_NOTICE
,"
[VATTRIBUTES] - Attribute '
"
.
$attribute
->
{'
Name
'}
.
"
' ignored, invalid operator?
");
last
;
}
return
;
}
## @fn processConfigAttribute($server,$packetAttributes,$attribute)
# Function to process a configuration attribute
#
...
...
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