Restconf: http cookie sent as attribute in rpc restconf_post operations to backend.
This commit is contained in:
parent
178a09cf3b
commit
e8a8d6e871
6 changed files with 59 additions and 4 deletions
|
|
@ -330,7 +330,7 @@ restconf_plugin_load(clicon_handle h)
|
|||
(int)strlen(filename), filename);
|
||||
if ((handle = plugin_load(h, filename, RTLD_NOW)) == NULL)
|
||||
goto quit;
|
||||
p_credentials = dlsym(handle, "restconf_credentials");
|
||||
p_credentials = dlsym(handle, PLUGIN_CREDENTIALS);
|
||||
if ((plugins = realloc(plugins, (nplugins+1) * sizeof (*plugins))) == NULL) {
|
||||
clicon_err(OE_UNIX, errno, "realloc");
|
||||
goto quit;
|
||||
|
|
@ -406,3 +406,30 @@ plugin_credentials(clicon_handle h,
|
|||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Parse a cookie string and return value of cookie attribute
|
||||
* @param[in] cookiestr cookie string according to rfc6265 (modified)
|
||||
* @param[in] attribute cookie attribute
|
||||
* @param[out] val malloced cookie value, free with free()
|
||||
*/
|
||||
int
|
||||
get_user_cookie(char *cookiestr,
|
||||
char *attribute,
|
||||
char **val)
|
||||
{
|
||||
int retval = -1;
|
||||
cvec *cvv = NULL;
|
||||
char *c;
|
||||
|
||||
if (str2cvec(cookiestr, ';', '=', &cvv) < 0)
|
||||
goto done;
|
||||
if ((c = cvec_find_str(cvv, attribute)) != NULL){
|
||||
if ((*val = strdup(c)) == NULL)
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
if (cvv)
|
||||
cvec_free(cvv);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue