This is a simple example of a Liberator Auth Module. This module permits access to any user, and permits them access to any object.
#include <string.h>
#ifndef WIN32
#include <unistd.h>
#else
#include <stdio.h>
#include <windows.h>
#endif
#ifndef WIN32
#define DLLEXPORT
#else
#define DLLEXPORT _declspec(dllexport)
#endif
int DLLEXPORT example_auth_new_user(
session_t *session,
char *user,
char *pass);
int DLLEXPORT example_auth_free_user(
session_t *session);
int DLLEXPORT example_auth_free_object(
object_t *obj);
int DLLEXPORT example_auth_check_read(
session_t *session,
object_t *obj,
char *requested_name);
int DLLEXPORT example_auth_check_write(
session_t *session,
object_t *obj,
char *requested_name);
int DLLEXPORT example_auth_map_object(
session_t *session,
char *requested_name,
char *name,
char *mapped,
int *len);
int DLLEXPORT example_auth_http_request(char *user, char *pass, http_method_t method, char *path);
int DLLEXPORT example_auth_check_update(
session_t *session,
object_t *obj,
char *data);
void DLLEXPORT example_auth_exit();
void DLLEXPORT
{
eventcallback = callback;
}
void DLLEXPORT
example_auth_exit()
{
return;
}
int DLLEXPORT
example_auth_new_user(
session_t *session,
char *user,
char *pass)
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
example_auth_map_object(
session_t *session,
char *requested_name,
char *name,
char *mapped,
int *len)
{
return AUTH_FALSE;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
int DLLEXPORT
example_auth_http_request(char *user, char *pass, http_method_t method, char *path)
{
return AUTH_OK;
}
int DLLEXPORT
{
return AUTH_OK;
}
#ifdef WIN32
int __stdcall
DllMain()
{
return 1;
}
#endif