-
Notifications
You must be signed in to change notification settings - Fork 41
Add GssapiRequiredNameAttributes option #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, code with tests! I promise all the stuff I've marked is minor.
Makefile.am
Outdated
cd $(srcdir) && ./tests/magtests.py --path $(TESTSDIR) --so-dir=$(abs_builddir)/src/.libs | ||
|
||
check-na: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just fold this into the main check
target, rather than putting it on its own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, that was just for me to be able to run the shell tests separately.
@@ -83,14 +86,14 @@ AC_CHECK_FUNCS(gss_krb5_ccache_name) | |||
AC_SUBST([GSSAPI_CFLAGS]) | |||
AC_SUBST([GSSAPI_LIBS]) | |||
|
|||
MAG_CFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CPPFLAGS` `${APR} --cflags` ${GSSAPI_CFLAGS} ${OPENSSL_CFLAGS} -I`${APXS} -q INCLUDEDIR` `${APR} --includes`" | |||
MAG_CFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CPPFLAGS` `${APR} --cflags` ${GSSAPI_CFLAGS} ${OPENSSL_CFLAGS} -I`${APXS} -q INCLUDEDIR` `${APR} --includes` -fPIC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding PIE/PIC support is a fine thing to do, but not in scope for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to comment that building fails without adding -fPIC here;
/usr/bin/ld: lex/libparser.a(libparser_a-lex.o): relocation R_X86_64_PC32 against undefined symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
I can add it to a separate commit before the main one (and submit a separate PR if you want)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense. Maybe just drop a comment above it.
src/lex/parser.y
Outdated
continue; | ||
} | ||
if (($3[0] == '[') && ($3[strlen($3) - 1] == ']')) { | ||
if (hex2bincmp($3 + 1, strlen($3) - 2, (unsigned char *)vals[i], strlen(vals[i]))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap at <80 characters, please.
src/lex/parser.y
Outdated
|
||
/* Convert hex_len of hex characters into binary and memcmp against bin. Return | ||
* 1 if the hex string is valid and matches, else 0. */ | ||
int hex2bincmp(const char *hex, size_t hex_len, unsigned char *bin, size_t bin_len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<80 here too.
src/lex/parser.y
Outdated
r = memcmp(b, bin, b_len); | ||
free(b); | ||
|
||
return r == 0 ? 1 : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified to just return r == 0
.
src/mod_auth_gssapi.c
Outdated
* expected_name_attr_verify(). */ | ||
names = apr_pcalloc(req->pool, (mc->na_count + 1) * sizeof(*names)); | ||
vals = apr_pcalloc(req->pool, (mc->na_count + 1) * sizeof(*names)); | ||
for (i = 0; i < mc->na_count; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use C99 for
-loop syntax.
src/mod_auth_gssapi.h
Outdated
@@ -138,3 +139,6 @@ struct mag_conn { | |||
struct mag_conn *mag_new_conn_ctx(apr_pool_t *pool); | |||
const char *mag_str_auth_type(int auth_type); | |||
char *mag_error(apr_pool_t *pool, const char *msg, uint32_t maj, uint32_t min); | |||
extern int expected_name_attr_verify(const char *expr, const char **attrs, | |||
const char **vals); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const char **vals
should line up with const char *expr
.
tests/natest.c
Outdated
exit(1); | ||
} | ||
|
||
for (i = 2; i < argc; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C99 for
-loops please.
tests/natest.sh
Outdated
#!/bin/bash -xe | ||
cmd=./natest | ||
|
||
# Single match and wildcard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these be echoed instead of just being comments? Might make the logs easier to read through.
src/environ.c
Outdated
mc_add_name_attribute(mc, apr_pstrndup(req->pool, | ||
attr.name.value, | ||
attr.name.length), | ||
apr_pstrndup(req->pool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of gross looking. Can you pull out the apr_pstrndup
calls into variables?
0833a43
to
09cf378
Compare
src/mod_auth_gssapi.c
Outdated
@@ -1795,6 +1845,8 @@ static const command_rec mag_commands[] = { | |||
"Don't resend negotiate header on negotiate failure"), | |||
AP_INIT_RAW_ARGS("GssapiNameAttributes", mag_name_attrs, NULL, OR_AUTHCFG, | |||
"Name Attributes to be exported as environ variables"), | |||
AP_INIT_RAW_ARGS("GssapiExpectedNameAttributes", expect_name_attrs, NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: if they are Required ... then the name should be GssapiRequiredNameAttributes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that might actually be the better name now that you mention it.
README
Outdated
#### Example | ||
GssapiExpectedNameAttributes "auth-indicators=high" | ||
GssapiExpectedNameAttributes "auth-indicators=high or other-attr=foo" | ||
GssapiExpectedNameAttributes "((auth-indicators=low and auth-indicators=med) or auth-indicators=high)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can auth-indicators be both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you can have multiple authentication indicators (although that may not be clear with the given example), and the parser will use the list of them when checking for the match on each attribute in the statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how are we handling multiple values? from the code it looks like we add _N to the name, is that right? does it parse ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I now see that you added a copy of each value.
src/mod_auth_gssapi.c
Outdated
if (!expected_name_attr_expr_check(w)) { | ||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, parms->server, | ||
"Invalid Name Attribute filter [%s].", w); | ||
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should return no null here, so it won get silently ignored.
09cf378
to
8be6da1
Compare
I've turned "Expected" to "Required", revised the README text, and now return an error string from expect_name_attrs() (now required_name_attrs()) on a syntax error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed a couple places the first time.
src/lex/parser.y
Outdated
extern int yyparse(const char **keys, const char **vals, int *status); | ||
extern YY_BUFFER_STATE yy_scan_string(char * str); | ||
extern void yy_delete_buffer(YY_BUFFER_STATE buffer); | ||
int hex2bincmp(const char *hex, size_t hex_len, unsigned char *bin, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bin
and bin_len
on their own line; line up with hex
src/lex/parser.y
Outdated
requiredkv: STRING EQUAL STRING { | ||
int i, ret = 0; | ||
if (keys != NULL && vals != NULL) { | ||
for (i = 0; keys[i] != NULL && vals[i] != NULL; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C99
src/lex/parser.y
Outdated
| STRING EQUAL AST { | ||
int i, ret = 0; | ||
if (keys != NULL && vals != NULL) { | ||
for (i = 0; keys[i] != NULL && vals[i] != NULL; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C99
src/lex/parser.y
Outdated
|
||
static int hexchar(unsigned int c) | ||
{ | ||
if ((c >= '0') && (c <= '9')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parens not needed; also applies to rest of function
Do attributes specified in GssapiRequiredNameAttributes need to be specified in GssapiNameAttributes too? from the code it looks like yes, so maybe we need to clarify it, or address it in code. |
Uhmm good point @Frenche I wonder if we should error out if the required is not a subset or if we should automaticaly add the ones in the required parser (do we have a simple way to get a list of them) to the set of items we retrieve, or if we should "shadow" retrieve them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need some changes, but the core is ok.
Any chance we have a way to expose some name attributes in the functional testsuite so we can have a (smoke) test that the whole thing works correctly ?
src/environ.c
Outdated
struct mag_conn *mc) | ||
{ | ||
apr_table_set(mc->env, "GSS_NAME", mc->gss_name); | ||
apr_table_set(mc->env, "GSS_NAME_ATTR_ERROR", "name attribute mismatch"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe: "required name attributes check unsatisfied"
src/environ.c
Outdated
v = apr_pstrndup(req->pool, attr.value.value, attr.value.length); | ||
|
||
mc_add_name_attribute(mc, n, v); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I have been thinking about this.
- Why are you forcibly re-adding the name attribute here ? This will break the semantics of the Name Attribute interface I think.
- do not use 1 letter vars
- in a case like this I think it makes more sense to declare these var in the do{} block, not across the whole function
- I think we need separate lists for required_name_attributes
This last point is the main one, I think we should have a separate list for required attributes because some people may want to use specific name attribute (say auth indicators) without being forced to expose them as env vars to the application.
So I guess we need a required_nameattr variable on mc where we set attributes use to check required attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I see how this is problematic. I'll separate the required attributes from the env exposed ones. As for the smoke test, against a 1.16 krb5 KDC we could enable the encrypted challenge indicator (does not require as much config as PKINIT/OTP) and test against that, otherwise I'm not sure what other name attribute we could enable in the test suite and test against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any name attribute will work, pick the simplest to expose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the above.
One way to go about it could be to store raw attributes on the MC struct (if we need it for either env or authz), and defer the parsing to a later point.
src/mod_auth_gssapi.c
Outdated
@@ -1151,6 +1151,30 @@ static int mag_auth(request_rec *req) | |||
return ret; | |||
} | |||
|
|||
/* Return 1 if the received name attributes are allowed by the | |||
* GssapiRequiredNameAttributes option, or else 0. */ | |||
static int verify_name_attributes(struct mag_config *cfg, request_rec *req, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> verify_required_name_attributes()
src/lex/parser.y
Outdated
|
||
void yyerror(const char **keys, const char **vals, int *status, const char *s) | ||
{ | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please prepend functions that are not static with a mag_ prefix
src/mod_auth_gssapi.c
Outdated
/* Use NULL terminated string arrays to pass name attributes and values to | ||
* required_name_attr_verify(). */ | ||
names = apr_pcalloc(req->pool, (mc->na_count + 1) * sizeof(*names)); | ||
vals = apr_pcalloc(req->pool, (mc->na_count + 1) * sizeof(*names)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you change this code to store attributes into a separate required_nameattr structure, store them there already zero terminated. Please also check that the values do not contain embedded zeros by verifying with strlen() that the length match what you expect and fire a debug log if they don't. (Or perhaps auto-base64 the value in this case ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if you do the above this function can go away entirely ...
@@ -1795,6 +1845,8 @@ static const command_rec mag_commands[] = { | |||
"Don't resend negotiate header on negotiate failure"), | |||
AP_INIT_RAW_ARGS("GssapiNameAttributes", mag_name_attrs, NULL, OR_AUTHCFG, | |||
"Name Attributes to be exported as environ variables"), | |||
AP_INIT_RAW_ARGS("GssapiRequiredNameAttributes", required_name_attrs, NULL, | |||
OR_AUTHCFG, "Name Attributes required to be present"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we support != expressions then this description is not correct.
We should say something like: Required checks for Name Attributes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and perhaps the option should actually be called GssapiCheckNameAttributes ? Or GssapiVerifyNameAttributes now that I think of it ? Sorry for not realizing this sooner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we do not support !=, is this a conscious decision to avoid "deny" accerss control cases ?
If not what is the reasoning ?
I am perfectly fine not supporting !=, but I think we should add to the README explicitly that we match only on '=' and we do not support '!='
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason, though we certainly can support deny rules if you think there will be demand for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess someone will ask, but in general I tend to be against the concept of "deny ACL" because they do not fail safe.
src/mod_auth_gssapi.h
Outdated
@@ -138,3 +139,6 @@ struct mag_conn { | |||
struct mag_conn *mag_new_conn_ctx(apr_pool_t *pool); | |||
const char *mag_str_auth_type(int auth_type); | |||
char *mag_error(apr_pool_t *pool, const char *msg, uint32_t maj, uint32_t min); | |||
extern int required_name_attr_verify(const char *expr, const char **attrs, | |||
const char **vals); | |||
extern int required_name_attr_expr_check(const char *expr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why these are not being pulled in with a dedicated include file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make a dedicated include for these.
d007451
to
cb823ab
Compare
I've pushed my current changes, that should be mostly everything except for the smoke test which I am working on, and will push later. |
src/environ.c
Outdated
if (!mag_get_name_attr(req, name, &attr)) { | ||
break; | ||
} | ||
mc_add_req_name_attribute(req, mc, attr.name, attr.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the oriignal name attribute code we pull in display_value and fall back to value only if that is not available.
src/environ.c
Outdated
name.length); | ||
mc->required_name_attrs[count + 1] = NULL; | ||
|
||
mc->required_name_vals[count] = apr_pstrndup(mc->pool, value.value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no check that value is in fact a string, this code will not handle binary values with embedded zeros well if such are passed in.
Or are we sure name attributes are always guaranteed to be printable strings ?
src/environ.c
Outdated
|
||
ap_set_module_config(req->request_config, &auth_gssapi_module, mc->env); | ||
mag_export_req_env(req, mc->env); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just set the error env var here and then call mag_set_req_data() to complete ?
It seem like maiing env vars and ccaches available to the error handler may be valuable given yiou are calling mag_export_req_env() here but not mag_set_name_attributes() which is somewhat required to fill the proper tables.
src/environ.c
Outdated
struct mag_conn *mc) | ||
{ | ||
apr_table_set(mc->env, "GSS_NAME", mc->gss_name); | ||
apr_table_set(mc->env, "GSS_NAME_ATTR_ERROR", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be GSS_REQUIRED_NAME_ATTR_ERROR ?
src/mod_auth_gssapi.c
Outdated
@@ -1176,6 +1177,20 @@ static int mag_complete(struct mag_req_cfg *req_cfg, struct mag_conn *mc, | |||
mc->expiration = time(NULL) + vtime; | |||
|
|||
mag_get_name_attributes(req, cfg, client, mc); | |||
mag_get_required_name_attributes(req, cfg, client, mc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you spoon this out in a new function, however, this means we call gss_get_name_attribute twice for each attribute, and it may be an expensive call.
Can we rather restructure mag_get_name_attributes() so it calls gss_get_name_attribute() *once but then internally calls two subfunctions to fill the two arrays ?
EDIT: added *once
@@ -1795,6 +1845,8 @@ static const command_rec mag_commands[] = { | |||
"Don't resend negotiate header on negotiate failure"), | |||
AP_INIT_RAW_ARGS("GssapiNameAttributes", mag_name_attrs, NULL, OR_AUTHCFG, | |||
"Name Attributes to be exported as environ variables"), | |||
AP_INIT_RAW_ARGS("GssapiRequiredNameAttributes", required_name_attrs, NULL, | |||
OR_AUTHCFG, "Name Attributes required to be present"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess someone will ask, but in general I tend to be against the concept of "deny ACL" because they do not fail safe.
cb823ab
to
c6d3e73
Compare
Sorry about the delay on this update. Here's an overview of the changes:
One issue is that autotools seems to have some problem during libtool linking the standalone parser test program tests/natest.c, where it cannot resolve the apr_base64* functions used by the parser. I've tried quite a few different Makefile.am configurations for it with no luck, so some suggestions would be helpful. For the moment I've left those build statements commented out. |
README
Outdated
This option allows specifying one or more Name Attributes that the client must | ||
possess in order to be authorized to access the location. The required Name | ||
Attributes are specified by name=value pairs (name being the ATTRIBUTE_NAME as | ||
mentioned above, and value being an ASCII string. Alternately, if a Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASCII -> Can we say UTF8? Or do we have no guarntees in which case we should just use a "Null terminated string" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think of it, are spaces allowed in bare strings ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a guarantee for UTF-8 here as I specified just character values in the lex rules (but it might be possible to specify UTF-8 code points instead). And spaces are not allowed in bare strings as that would be considered a token separation, so if there is a space expected in the value then the base64 option should be used. I can update the README with this clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please, it will help nuderstanding when you must use bse64
src/environ.c
Outdated
for (count = 0; mc->required_name_attrs != NULL && | ||
mc->required_name_attrs[count] != NULL && | ||
mc->required_name_vals != NULL && | ||
mc->required_name_vals[count] != NULL; count++); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it legal to have names w/o corresponding value ?
@@ -128,6 +129,8 @@ struct mag_conn { | |||
struct databuf basic_hash; | |||
bool is_preserved; | |||
int na_count; | |||
const char **required_name_attrs; | |||
const char **required_name_vals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code it seem like these two arrays are always allocated and handled in pairs.
Maybe we should have instead a:
struct mag_required_name_attr {
const char *name;
const char *value;
};
And just allocate an array of these ?
Given we often count them, we could also add a size_t req_name_attr_count, and keep their number around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, they are a pair. Turning it into a struct with a counter for clarity is OK with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I opted to store them in this way to make it simple to pass to the parser. Storing them in a mag_attr struct would need a conversion later on (or a change in the parser). So I'd prefer to keep them this way and add in a comment for clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only nits, but I am not requiring them, just wondering if they'd made code more clear.
Otherwise I think we are good to go.
@frozencemetery or @Frenche could you give another quick look ?
c6d3e73
to
b4c0e7d
Compare
I have no non-nit objections |
Great stuff, I plan to review some more over the weekend, (no need to hold the merge however). |
if (!mc->required_name_attrs || !mc->required_name_vals) { | ||
apr_pool_abort_get(mc->pool)(ENOMEM); | ||
} | ||
apr_pool_userdata_setn(mc, GSS_NAME_ATTR_USERDATA, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to be called once at mc constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ignore this comment, I now see it was modeled after the other directive, so let's leave it for now.
src/environ.c
Outdated
val = apr_pstrndup(mc->pool, attr->display_value.value, len); | ||
} else if (attr->value.length != 0) { | ||
len = attr->value.length; | ||
val = apr_pcalloc(mc->pool, len + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If raw value may embed null, then the length must be kept along or it should be encoded here, otherwise it will get cut at the first null occurrence when accessed.
src/environ.c
Outdated
len = attr->value.length; | ||
val = apr_pcalloc(mc->pool, len + 1); | ||
memcpy(val, attr->value.value, len); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe else {error_out}, and perhaps move this block upper.
b4c0e7d
to
5ff54df
Compare
Updated, now we prepend the value length to the saved value. In the parser we read in the length prefix and use it for the value comparison. I moved the value checks in mag_set_required_name_attr() with an else return as suggested, and also stuck in an ap_log_rdata() call to print out the raw value data. |
@mrogers950 github claims there are merge conflicts, can you check ? |
5ff54df
to
5668f9b
Compare
Rebased to latest master. |
@Frenche can you confirm your remarks have been addressed ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I can't build right now but I think I noticed some warnings last time, if there are it would be nice to silence them.
5668f9b
to
c427b0e
Compare
I added in the flex options to silence the remaining warnings. |
make test fails for me: Do we require some specific version of some dependency ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix make test or fix configure to require the right stuff
Allow setting the required name attributes for a session, using a flex and bison based parser to process the attributes specified.
c427b0e
to
802498c
Compare
That happens when krb5-pkinit isn't installed, so I added a dirty check for the pkinit module and skip the name attribute tests with a warning if it's not found, and README.md mentions the krb5-pkinit dependency for the tests. |
Allow setting the required name attributes for a session, using a flex and
bison based parser to process the attributes specified.