Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
R
radsecproxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eduroam
radsecproxy
Commits
6c8491ba
Commit
6c8491ba
authored
Jul 28, 2017
by
Linus Nordberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mutex guarding realm refcount.
parent
9a565fe0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
radsecproxy.c
radsecproxy.c
+11
-3
radsecproxy.h
radsecproxy.h
+1
-0
No files found.
radsecproxy.c
View file @
6c8491ba
...
...
@@ -744,8 +744,11 @@ int msmppdecrypt(uint8_t *text, uint8_t len, uint8_t *shared, uint8_t sharedlen,
}
struct
realm
*
newrealmref
(
struct
realm
*
r
)
{
if
(
r
)
if
(
r
)
{
pthread_mutex_lock
(
&
r
->
refmutex
);
r
->
refcount
++
;
pthread_mutex_unlock
(
&
r
->
refmutex
);
}
return
r
;
}
...
...
@@ -2120,12 +2123,16 @@ void freerealm(struct realm *realm) {
if
(
!
realm
)
return
;
debug
(
DBG_DBG
,
"freerealm: called with refcount %d"
,
realm
->
refcount
);
if
(
--
realm
->
refcount
)
pthread_mutex_lock
(
&
realm
->
refmutex
);
--
realm
->
refcount
;
pthread_mutex_unlock
(
&
realm
->
refmutex
);
if
(
realm
->
refcount
)
return
;
free
(
realm
->
name
);
free
(
realm
->
message
);
regfree
(
&
realm
->
regex
);
pthread_mutex_destroy
(
&
realm
->
refmutex
);
pthread_mutex_destroy
(
&
realm
->
mutex
);
/* if refcount == 0, all subrealms gone */
list_destroy
(
realm
->
subrealms
);
...
...
@@ -2181,7 +2188,8 @@ struct realm *addrealm(struct list *realmlist, char *value, char **servers, char
}
memset
(
realm
,
0
,
sizeof
(
struct
realm
));
if
(
pthread_mutex_init
(
&
realm
->
mutex
,
NULL
))
{
if
(
pthread_mutex_init
(
&
realm
->
mutex
,
NULL
)
||
pthread_mutex_init
(
&
realm
->
refmutex
,
NULL
))
{
debugerrno
(
errno
,
DBG_ERR
,
"mutex init failed"
);
free
(
realm
);
realm
=
NULL
;
...
...
radsecproxy.h
View file @
6c8491ba
...
...
@@ -184,6 +184,7 @@ struct realm {
uint8_t
accresp
;
regex_t
regex
;
uint32_t
refcount
;
pthread_mutex_t
refmutex
;
pthread_mutex_t
mutex
;
struct
realm
*
parent
;
struct
list
*
subrealms
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment