1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

feature: added wf_credentials_set_type and wf_credentials_add

This commit is contained in:
Falk Werner
2020-06-10 22:42:26 +02:00
parent f60079dadb
commit 81fd41f46a
8 changed files with 106 additions and 55 deletions

View File

@@ -147,6 +147,21 @@ char const * wf_credentials_get(
return wf_impl_credentials_get(credentials, key);
}
void wf_credentials_set_type(
struct wf_credentials * credentials,
char const * type)
{
wf_impl_credentials_set_type(credentials, type);
}
void wf_credentials_add(
struct wf_credentials * credentials,
char const * key,
char const * value)
{
wf_impl_credentials_add(credentials, key, value);
}
// mountpoint
struct wf_mountpoint *
@@ -255,24 +270,3 @@ wf_client_add_filesystem(
(void) name;
}
// client credentials
void
wf_client_credentials_set_type(
struct wf_client_credentials * credentials,
char const * type)
{
(void) credentials;
(void) type;
}
void
wf_client_credentials_add(
struct wf_client_credentials * credentials,
char const * key,
char const * value)
{
(void) credentials;
(void) key;
(void) value;
}

View File

@@ -1,6 +1,13 @@
#include "webfuse/adapter/impl/credentials.h"
#include <string.h>
void wf_impl_credentials_init_default(
struct wf_credentials * credentials)
{
credentials->type = NULL;
credentials->data = json_object();
}
void wf_impl_credentials_init(
struct wf_credentials * credentials,
char const * type,
@@ -38,3 +45,20 @@ char const * wf_impl_credentials_get(
return result;
}
void wf_impl_credentials_set_type(
struct wf_credentials * credentials,
char const * type)
{
free(credentials->type);
credentials->type = strdup(type);
}
void wf_impl_credentials_add(
struct wf_credentials * credentials,
char const * key,
char const * value)
{
json_object_set_new(credentials->data, key, json_string(value));
}

View File

@@ -19,6 +19,9 @@ extern void wf_impl_credentials_init(
char const * type,
json_t * data);
extern void wf_impl_credentials_init_default(
struct wf_credentials * credentials);
extern void wf_impl_credentials_cleanup(
struct wf_credentials * credentials);
@@ -29,6 +32,15 @@ extern char const * wf_impl_credentials_get(
struct wf_credentials const * credentials,
char const * key);
extern void wf_impl_credentials_set_type(
struct wf_credentials * credentials,
char const * type);
extern void wf_impl_credentials_add(
struct wf_credentials * credentials,
char const * key,
char const * value);
#ifdef __cplusplus
}
#endif