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
27d68e03
Commit
27d68e03
authored
15 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
* Various config attribute handling fixes and cosmetic changes
parent
fb0da590
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
+17
-88
17 additions, 88 deletions
smradiusd
with
17 additions
and
88 deletions
smradiusd
+
17
−
88
View file @
27d68e03
...
...
@@ -481,74 +481,16 @@ sub process_request {
#NAS-IP-Address: 10.254.254.239
#
# User Authentication
#
# Authentication
#a. SELECT ID, Password FROM Users WHERE Username = %u
# Optional Items:
# 'Disabled' - Indicates the user is disabled
#
# Save the query result, so we can use it as macros.... ${user.<column name>} below...
#
# Authorization: Attribute checks
#
# User attributes
#b. SELECT Attribute, OP, Value FROM UserAttributes WHERE UserID = ${user.id}
# Attribute groups
#c. SELECT Group FROM UsersToGroups WHERE UserID = ${user.id}
# Save the query result, so we can use it as macros... ${group.<column name>} below...
# Group attributes
#d. SELECT Attribute, OP, Value FROM GroupAttributes WHERE GroupID = ${group.id}
# Loop with groups and do the query ...
#
# Authentication procedure
#
# On user AUTH ....
#1. Execute query (a), set query result in 'user' hash
# - Check 'disabled' parameter
#2. Run past plugins - check if we authenticate
# - if not reject
#3. Pull in query (c), loop with groups for query (d)
#4. Merge in query (b)
#5. Check attributes that need checking
# - reject if fail
#6. Return attributes that need to be returned
# find user
# get user
# - User
# - Password
# {mech}data
# - Data
# (additional columns from table)
# - Attributes (array)
# Attribute,OP,Value
# - Group (array)
# - Data
# (additional columns from table)
# - Attributes
# Attribute,OP,Value
# try authenticate
# check attribs
# Main user hash with everything in
my
$user
;
#
# GRAB CONFIG
FIXME
# GRAB
& PROCESS
CONFIG
#
# Build a list of our attributes in the packet
my
$configAttributes
=
{};
foreach
my
$module
(
@
{
$self
->
{'
plugins
'}})
{
# Try find config attribute
if
(
$module
->
{'
Config_get
'})
{
...
...
@@ -556,40 +498,27 @@ sub process_request {
# Get result from config module
$self
->
log
(
LOG_INFO
,"
[SMRADIUS] FIND: Trying plugin '
"
.
$module
->
{'
Name
'}
.
"
' for incoming connection
");
my
(
$configData
)
=
$module
->
{'
Config_get
'}(
$self
,
$user
,
$pkt
);
# If we got some config back, process it
if
(
$configData
)
{
# Add what we have received to the user hash
$user
->
{'
ConfigData
'}
=
$configData
;
last
;
# Loop with attributes we got from the user
foreach
my
$attrName
(
keys
%
{
$configData
})
{
# Loop with operators
foreach
my
$attrOp
(
keys
%
{
$configData
->
{
$attrName
}})
{
# Grab attribute
my
$attr
=
$configData
->
{
$attrName
}
->
{
$attrOp
};
# Process attribute
my
$res
=
checkAttributeConfig
(
$self
,
$user
->
{'
ConfigAttributes
'},
$attr
);
}
}
}
}
}
#
#
FIXME USER
#
START PROCESSING
#
# Build a list of our attributes in the packet
my
$configAttributes
;
foreach
my
$attr
(
$pkt
->
attributes
)
{
$configAttributes
->
{
$attr
}
=
$pkt
->
rawattr
(
$attr
);
}
# Loop with attributes we got from the user
foreach
my
$attribute
(
@
{
$user
->
{'
ConfigData
'}
->
{'
ConfigAttributes
'}})
{
# Check attribute against authorization attributes
my
$res
=
checkAttributeConfig
(
$self
,
$configAttributes
,
$attribute
);
if
(
$res
==
0
)
{
$self
->
log
(
LOG_DEBUG
,"
[SMRADIUS] Failed checkAttributeConfig(): Do something here
");
last
;
}
}
# We don't want to process everyting if something doesn't match
# last if (!$authorized);
#}
# UserDB module if we using/need it
my
$userdb
;
...
...
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