1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/lib/webfuse/core/status.c
Falk Werner 87f34fa768 feat(authentication): provide an authentication mechanism (#19)
* moves server into session

* renames jsonrpc server to jsonrpc proxy

* moves server into session

* renames jsonrpc server to jsonrpc proxy

* adds json rpc server

* removes obsolete proxy from protocol

* changes interface of jsonrpc_proxy_onresult to accept previously parsed messages

* adds infrastructure to process incoming requests; fixes invalid read of ill formatted responses

* adds description of authentication request

* adds authentication request

* adds userdb for authentication purposes

* removes debug code: console.log()

* fixes cmake build error (missing openssl symbols)

* fixes typo

* replaces ASCII art by UML diagram

* renames BAD_NOACCESS to BAD_ACCESS_DENIED

* fixes style

* adds docu of authentication

* ignored false positives of flawfinder

* fixes style issues

* fixes javascript style issues
2019-04-01 22:15:12 +02:00

35 lines
899 B
C

#include "webfuse/core/status_intern.h"
#include <errno.h>
int wf_status_to_rc(wf_status status)
{
switch(status)
{
case WF_GOOD: return 0;
case WF_BAD_NOTIMPLEMENTED: return -ENOSYS;
case WF_BAD_TIMEOUT: return -ETIMEDOUT;
case WF_BAD_BUSY: return -ENOENT;
case WF_BAD_FORMAT: return -ENOENT;
case WF_BAD_NOENTRY: return -ENOENT;
case WF_BAD_ACCESS_DENIED: return -EACCES;
default: return -ENOENT;
}
}
char const * wf_status_tostring(wf_status status)
{
switch(status)
{
case WF_GOOD: return "Good";
case WF_BAD: return "Bad";
case WF_BAD_NOTIMPLEMENTED: return "Bad (not implelemted)";
case WF_BAD_TIMEOUT: return "Bad (timeout)";
case WF_BAD_BUSY: return "Bad (busy)";
case WF_BAD_FORMAT: return "Bad (format)";
case WF_BAD_NOENTRY: return "Bad (no entry)";
case WF_BAD_ACCESS_DENIED: return "Bad (access denied)";
default: return "Bad (unknown)";
}
}