Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
sso
Commits
f4416285
Commit
f4416285
authored
Jan 17, 2016
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configure known groups closure with a global directive
parent
0124ce80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
src/mod_sso/mod_sso.c
src/mod_sso/mod_sso.c
+31
-3
No files found.
src/mod_sso/mod_sso.c
View file @
f4416285
...
...
@@ -46,6 +46,9 @@ typedef struct {
// Note: public_key is a binary buffer (non zero-terminated).
const
unsigned
char
*
public_key
;
// All known groups.
apr_array_header_t
*
groups
;
}
modsso_config
;
typedef
const
char
*
(
*
CMD_HAND_TYPE
)
();
...
...
@@ -70,6 +73,7 @@ static void *create_modsso_config(apr_pool_t *p, char *s)
newcfg
->
service
=
NULL
;
newcfg
->
domain
=
NULL
;
newcfg
->
public_key
=
NULL
;
newcfg
->
groups
=
NULL
;
// Return the created configuration struct.
return
(
void
*
)
newcfg
;
...
...
@@ -85,12 +89,14 @@ static void *merge_modsso_config(apr_pool_t *p, void *base, void *add)
newcfg
->
login_server
=
cadd
->
login_server
?
cadd
->
login_server
:
cbase
->
login_server
;
newcfg
->
service
=
cadd
->
service
?
cadd
->
service
:
cbase
->
service
;
newcfg
->
domain
=
cadd
->
domain
?
cadd
->
domain
:
cbase
->
domain
;
newcfg
->
public_key
=
cbase
->
public_key
;
if
(
cadd
->
public_key
)
{
newcfg
->
public_key
=
cadd
->
public_key
;
}
// Groups are not merged, last takes precedence (if set).
newcfg
->
groups
=
cadd
->
groups
?
cadd
->
groups
:
cbase
->
groups
;
return
(
void
*
)
newcfg
;
}
...
...
@@ -140,6 +146,25 @@ static const char *set_modsso_public_key_file(cmd_parms *parms, void *mconfig, c
return
NULL
;
}
static
apr_array_header_t
*
parse_commasep_groups
(
apr_pool_t
*
pool
,
const
char
*
commaseplist
)
{
apr_array_header_t
*
arr
=
apr_array_make
(
pool
,
1
,
sizeof
(
const
char
*
));
char
*
tokenizerCtx
=
NULL
,
*
group
;
char
*
tmp
=
apr_pstrdup
(
pool
,
commaseplist
);
group
=
apr_strtok
(
tmp
,
","
,
&
tokenizerCtx
);
do
{
*
(
const
char
**
)
apr_array_push
(
arr
)
=
group
;
group
=
apr_strtok
(
NULL
,
","
,
&
tokenizerCtx
);
}
while
(
group
!=
NULL
);
return
arr
;
}
static
const
char
*
set_modsso_groups
(
cmd_parms
*
parms
,
void
*
mconfig
,
const
char
*
arg
)
{
modsso_config
*
s_cfg
=
(
modsso_config
*
)
mconfig
;
s_cfg
->
groups
=
parse_commasep_groups
(
/* global pool?? */
NULL
,
arg
);
return
NULL
;
}
static
const
command_rec
mod_sso_cmds
[]
=
{
AP_INIT_TAKE1
(
"SSOLoginServer"
,
(
CMD_HAND_TYPE
)
set_modsso_login_server
,
...
...
@@ -154,6 +179,9 @@ static const command_rec mod_sso_cmds[] =
AP_INIT_TAKE1
(
"SSOPublicKeyFile"
,
(
CMD_HAND_TYPE
)
set_modsso_public_key_file
,
NULL
,
RSRC_CONF
,
"SSOPublicKeyFile (string) Location of the login server public key"
),
AP_INIT_TAKE1
(
"SSOGroups"
,
(
CMD_HAND_TYPE
)
set_modsso_groups
,
NULL
,
RSRC_CONF
,
"SSOGroups (string) comma-separated list of all the groups that we might want to check membership for"
),
{
NULL
}
};
...
...
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