aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJose Bollo <jose.bollo@iot.bzh>2019-11-16 09:25:02 +0100
committerJose Bollo <jose.bollo@iot.bzh>2019-11-25 11:48:31 +0100
commit7c67e966b8292961ca748e47d18ff437214cec1c (patch)
tree769662f089170328697f8d58eba7e68443ea4503 /src
parent0d3dc9722c610857c2f83c4f3bf06299f2426a95 (diff)
Remove returning token
The token is no more generated by the binder Bug-AGL: SPEC-2968 Change-Id: I43f66c7613b42d33058e167b831a93b2112d3b9e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/afb-context.c7
-rw-r--r--src/afb-context.h1
-rw-r--r--src/afb-hook.c2
-rw-r--r--src/afb-monitor.c3
-rw-r--r--src/afb-msg-json.c6
-rw-r--r--src/afb-session.c8
-rw-r--r--src/afb-session.h1
-rw-r--r--src/afb-supervision.c4
-rw-r--r--src/afb-trace.c2
-rw-r--r--src/afb-ws-json1.c2
-rw-r--r--src/tests/session/test-session.c3
11 files changed, 7 insertions, 32 deletions
diff --git a/src/afb-context.c b/src/afb-context.c
index 33cca0e9..4cdaa6f7 100644
--- a/src/afb-context.c
+++ b/src/afb-context.c
@@ -102,13 +102,6 @@ void afb_context_disconnect(struct afb_context *context)
}
}
-const char *afb_context_sent_token(struct afb_context *context)
-{
- if (context->session == NULL || context->closing || context->super)
- return NULL;
- return afb_session_token(context->session);
-}
-
const char *afb_context_uuid(struct afb_context *context)
{
return context->session ? afb_session_uuid(context->session) : "";
diff --git a/src/afb-context.h b/src/afb-context.h
index 2d44611b..83d01218 100644
--- a/src/afb-context.h
+++ b/src/afb-context.h
@@ -44,7 +44,6 @@ extern void afb_context_subinit(struct afb_context *context, struct afb_context
extern int afb_context_connect(struct afb_context *context, const char *uuid, const char *token);
extern int afb_context_connect_validated(struct afb_context *context, const char *uuid);
extern void afb_context_disconnect(struct afb_context *context);
-extern const char *afb_context_sent_token(struct afb_context *context);
extern const char *afb_context_sent_uuid(struct afb_context *context);
extern const char *afb_context_uuid(struct afb_context *context);
diff --git a/src/afb-hook.c b/src/afb-hook.c
index 6b1ab10c..1379caf8 100644
--- a/src/afb-hook.c
+++ b/src/afb-hook.c
@@ -1531,7 +1531,7 @@ static void _hook_session_(struct afb_session *session, const char *format, ...)
static void hook_session_create_cb(void *closure, const struct afb_hookid *hookid, struct afb_session *session)
{
- _hook_session_(session, "create -> token=%s", afb_session_token(session));
+ _hook_session_(session, "create");
}
static void hook_session_close_cb(void *closure, const struct afb_hookid *hookid, struct afb_session *session)
diff --git a/src/afb-monitor.c b/src/afb-monitor.c
index 13687d36..e32c85ac 100644
--- a/src/afb-monitor.c
+++ b/src/afb-monitor.c
@@ -381,9 +381,8 @@ static void f_session(afb_req_t req)
}
/* make the result */
- wrap_json_pack(&r, "{s:s,s:s,s:i,s:i}",
+ wrap_json_pack(&r, "{s:s,s:i,s:i}",
"uuid", afb_session_uuid(xreq->context.session),
- "token", afb_session_token(xreq->context.session),
"timeout", afb_session_timeout(xreq->context.session),
"remain", afb_session_what_remains(xreq->context.session));
afb_req_success(req, r, NULL);
diff --git a/src/afb-msg-json.c b/src/afb-msg-json.c
index b1a83e73..fc736321 100644
--- a/src/afb-msg-json.c
+++ b/src/afb-msg-json.c
@@ -27,7 +27,7 @@ static const char _success_[] = "success";
struct json_object *afb_msg_json_reply(struct json_object *resp, const char *error, const char *info, struct afb_context *context)
{
json_object *msg, *request;
- const char *token, *uuid;
+ const char *uuid;
json_object *type_reply = NULL;
msg = json_object_new_object();
@@ -45,10 +45,6 @@ struct json_object *afb_msg_json_reply(struct json_object *resp, const char *err
json_object_object_add(request, "info", json_object_new_string(info));
if (context != NULL) {
- token = afb_context_sent_token(context);
- if (token != NULL)
- json_object_object_add(request, "token", json_object_new_string(token));
-
uuid = afb_context_sent_uuid(context);
if (uuid != NULL)
json_object_object_add(request, "uuid", json_object_new_string(uuid));
diff --git a/src/afb-session.c b/src/afb-session.c
index 8fa44341..bb10c2cb 100644
--- a/src/afb-session.c
+++ b/src/afb-session.c
@@ -540,7 +540,7 @@ int afb_session_check_token (struct afb_session *session, const char *token)
session_lock(session);
r = !session->closed
&& session->expiration >= NOW
- && !(session->token && strcmp(token, afb_session_token(session)));
+ && !(session->token && strcmp(token, afb_token_string(session->token)));
session_unlock(session);
return r;
}
@@ -551,12 +551,6 @@ const char *afb_session_uuid (struct afb_session *session)
return session->uuid;
}
-/* Returns the token of 'session' */
-const char *afb_session_token (struct afb_session *session)
-{
- return afb_token_string(session->token);
-}
-
/**
* Get the index of the 'key' in the cookies array.
* @param key the key to scan
diff --git a/src/afb-session.h b/src/afb-session.h
index f6e848c8..6d17f87f 100644
--- a/src/afb-session.h
+++ b/src/afb-session.h
@@ -41,7 +41,6 @@ extern void afb_session_close(struct afb_session *session);
extern int afb_session_is_closed (struct afb_session *session);
extern int afb_session_check_token(struct afb_session *session, const char *token);
-extern const char *afb_session_token(struct afb_session *session);
extern int afb_session_timeout(struct afb_session *session);
extern int afb_session_what_remains(struct afb_session *session);
diff --git a/src/afb-supervision.c b/src/afb-supervision.c
index 1575ae29..df045806 100644
--- a/src/afb-supervision.c
+++ b/src/afb-supervision.c
@@ -292,10 +292,8 @@ int afb_supervision_init(struct afb_apiset *apiset, struct json_object *config)
static void slist(void *closure, struct afb_session *session)
{
struct json_object *list = closure;
- struct json_object *item;
- wrap_json_pack(&item, "{ss}", "token", afb_session_token(session));
- json_object_object_add(list, afb_session_uuid(session), item);
+ json_object_object_add(list, afb_session_uuid(session), NULL);
}
/******************************************************************************
diff --git a/src/afb-trace.c b/src/afb-trace.c
index 5e349c7e..5f8ec64c 100644
--- a/src/afb-trace.c
+++ b/src/afb-trace.c
@@ -853,7 +853,7 @@ static void hook_session(void *closure, const struct afb_hookid *hookid, struct
static void hook_session_create(void *closure, const struct afb_hookid *hookid, struct afb_session *session)
{
- hook_session(closure, hookid, session, "create", "{ss}", "token", afb_session_token(session));
+ hook_session(closure, hookid, session, "create", NULL);
}
static void hook_session_close(void *closure, const struct afb_hookid *hookid, struct afb_session *session)
diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c
index d0cca2bd..743f5a52 100644
--- a/src/afb-ws-json1.c
+++ b/src/afb-ws-json1.c
@@ -260,7 +260,7 @@ static void wsreq_reply(struct afb_xreq *xreq, struct json_object *object, const
reply = afb_msg_json_reply(object, error, info, &xreq->context);
rc = (error ? afb_wsj1_reply_error_j : afb_wsj1_reply_ok_j)(
- wsreq->msgj1, reply, afb_context_sent_token(&wsreq->xreq.context));
+ wsreq->msgj1, reply, NULL);
if (rc)
ERROR("Can't send reply: %m");
}
diff --git a/src/tests/session/test-session.c b/src/tests/session/test-session.c
index 444475ef..acdfcef4 100644
--- a/src/tests/session/test-session.c
+++ b/src/tests/session/test-session.c
@@ -53,13 +53,10 @@ START_TEST (check_creation)
/* the session is valid */
ck_assert(afb_session_uuid(s) != NULL);
- ck_assert(afb_session_token(s) != NULL);
ck_assert(!afb_session_is_closed(s));
/* token is the initial one */
- ck_assert_str_eq(afb_session_token(s), GOOD_UUID);
ck_assert(afb_session_check_token(s, GOOD_UUID));
- ck_assert(afb_session_check_token(s, afb_session_token(s)));
/* query the session */
uuid = strdup(afb_session_uuid(s));