Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ booth-*.tar*
conf/booth*.service
docs/*.8
docs/*.8.html
docs/*.8.xml
script/service-runnable
src/b_config.h.in
src/b_config.h
Expand Down
47 changes: 29 additions & 18 deletions src/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include "ticket.h"
#include "pacemaker.h"

void print_geostore_usage(void)
void
print_geostore_usage(void)
{
printf(
"Usage:\n"
Expand Down Expand Up @@ -62,7 +63,8 @@ void print_geostore_usage(void)
* ticket, attr name, attr value
*/

int test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd)
int
test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd)
{
int rv = 0;
const char *op_str = NULL;
Expand Down Expand Up @@ -128,9 +130,9 @@ int test_attr_reply(cmd_result_t reply_code, cmd_request_t cmd)
* -1: header received, but message too short
* >=0: success
*/
static int read_server_reply(
struct booth_transport const *tpt, struct booth_site *site,
char *msg)
static int
read_server_reply(struct booth_transport const *tpt, struct booth_site *site,
char *msg)
{
struct boothc_header *header;
int rv;
Expand All @@ -149,7 +151,8 @@ static int read_server_reply(
return rv;
}

int do_attr_command(struct booth_config *conf, cmd_request_t cmd)
int
do_attr_command(struct booth_config *conf, cmd_request_t cmd)
{
struct booth_site *site = NULL;
struct boothc_header *header;
Expand Down Expand Up @@ -234,7 +237,8 @@ int do_attr_command(struct booth_config *conf, cmd_request_t cmd)
*/
#define gbool2rlt(i) (i ? RLT_SUCCESS : RLT_SYNC_FAIL)

static void free_geo_attr(gpointer data)
static void
free_geo_attr(gpointer data)
{
struct geo_attr *a = (struct geo_attr *)data;

Expand All @@ -244,8 +248,9 @@ static void free_geo_attr(gpointer data)
g_free(a);
}

int store_geo_attr(struct ticket_config *tk, const char *name,
const char *val, int notime)
int
store_geo_attr(struct ticket_config *tk, const char *name, const char *val,
int notime)
{
struct geo_attr *a;
GDestroyNotify free_geo_attr_notify = free_geo_attr;
Expand Down Expand Up @@ -289,7 +294,8 @@ int store_geo_attr(struct ticket_config *tk, const char *name,
return 0;
}

static cmd_result_t attr_set(struct ticket_config *tk, struct boothc_attr_msg *msg)
static cmd_result_t
attr_set(struct ticket_config *tk, struct boothc_attr_msg *msg)
{
int rc;

Expand All @@ -301,7 +307,8 @@ static cmd_result_t attr_set(struct ticket_config *tk, struct boothc_attr_msg *m
return RLT_SUCCESS;
}

static cmd_result_t attr_del(struct ticket_config *tk, struct boothc_attr_msg *msg)
static cmd_result_t
attr_del(struct ticket_config *tk, struct boothc_attr_msg *msg)
{
gboolean rv;
gpointer orig_key, value;
Expand Down Expand Up @@ -347,8 +354,9 @@ append_attr(gpointer key, gpointer value, gpointer user_data)
}


static cmd_result_t attr_get(struct booth_config *conf, struct ticket_config *tk,
int fd, struct boothc_attr_msg *msg)
static cmd_result_t
attr_get(struct booth_config *conf, struct ticket_config *tk, int fd,
struct boothc_attr_msg *msg)
{
cmd_result_t rv = RLT_SUCCESS;
struct boothc_hdr_msg hdr;
Expand Down Expand Up @@ -388,8 +396,9 @@ static cmd_result_t attr_get(struct booth_config *conf, struct ticket_config *tk
return rv;
}

static cmd_result_t attr_list(struct booth_config *conf, struct ticket_config *tk,
int fd, struct boothc_attr_msg *msg)
static cmd_result_t
attr_list(struct booth_config *conf, struct ticket_config *tk, int fd,
struct boothc_attr_msg *msg)
{
GString *data;
cmd_result_t rv;
Expand Down Expand Up @@ -419,8 +428,9 @@ static cmd_result_t attr_list(struct booth_config *conf, struct ticket_config *t
return rv;
}

int process_attr_request(struct booth_config *conf, struct client *req_client,
void *buf)
int
process_attr_request(struct booth_config *conf, struct client *req_client,
void *buf)
{
cmd_result_t rv = RLT_SYNC_FAIL;
struct ticket_config *tk;
Expand Down Expand Up @@ -472,7 +482,8 @@ int process_attr_request(struct booth_config *conf, struct client *req_client,
* only clients retrieve/manage attributes and they connect
* directly to the target site
*/
int attr_recv(struct booth_config *conf, void *buf, struct booth_site *source)
int
attr_recv(struct booth_config *conf, void *buf, struct booth_site *source)
{
struct boothc_attr_msg *msg;
struct ticket_config *tk;
Expand Down
30 changes: 18 additions & 12 deletions src/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
* it is up to the caller to make sure that there's enough space
* at result for the MAC
*/
int calc_hmac(const void *data, size_t datalen,
int hid, unsigned char *result, char *key, unsigned int keylen)
int
calc_hmac(const void *data, size_t datalen, int hid, unsigned char *result,
char *key, unsigned int keylen)
{
int rc;

Expand Down Expand Up @@ -56,8 +57,9 @@ int calc_hmac(const void *data, size_t datalen,

/* test HMAC
*/
int verify_hmac(const void *data, size_t datalen,
int hid, unsigned char *hmac, char *key, int keylen)
int
verify_hmac(const void *data, size_t datalen, int hid, unsigned char *hmac,
char *key, int keylen)
{
unsigned char *our_hmac;
int rc;
Expand Down Expand Up @@ -101,8 +103,9 @@ int verify_hmac(const void *data, size_t datalen,
* it is up to the caller to make sure that there's enough space
* at result for the MAC
*/
int calc_hmac(const void *data, size_t datalen,
int hid, unsigned char *result, char *key, unsigned int keylen)
int
calc_hmac(const void *data, size_t datalen, int hid, unsigned char *result,
char *key, unsigned int keylen)
{
static gcry_md_hd_t digest;
gcry_error_t err;
Expand Down Expand Up @@ -132,8 +135,9 @@ int calc_hmac(const void *data, size_t datalen,

/* test HMAC
*/
int verify_hmac(const void *data, size_t datalen,
int hid, unsigned char *hmac, char *key, int keylen)
int
verify_hmac(const void *data, size_t datalen, int hid, unsigned char *hmac,
char *key, int keylen)
{
unsigned char *our_hmac;
int rc;
Expand Down Expand Up @@ -164,8 +168,9 @@ int verify_hmac(const void *data, size_t datalen,
* it is up to the caller to make sure that there's enough space
* at result for the MAC
*/
int calc_hmac(const void *data, size_t datalen,
hashid hid, unsigned char *result, char *key, int keylen)
int
calc_hmac(const void *data, size_t datalen, hashid hid, unsigned char *result,
char *key, int keylen)
{
MHASH td;
size_t block_size;
Expand All @@ -187,8 +192,9 @@ int calc_hmac(const void *data, size_t datalen,

/* test HMAC
*/
int verify_hmac(const void *data, size_t datalen,
hashid hid, unsigned char *hmac, char *key, int keylen)
int
verify_hmac(const void *data, size_t datalen, hashid hid, unsigned char *hmac,
char *key, int keylen)
{
MHASH td;
unsigned char *our_hmac = NULL;
Expand Down
Loading