From 8c42b8a147fa2967a8dced8bb487a76de9d5ce89 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 4 Jun 2020 19:27:34 +0200 Subject: [PATCH] REORG: include: split common/uri_auth.h into haproxy/uri_auth{,-t}.h Initially it looked like this could have been placed into auth.h or stats.h but it's not the case as it's what makes the link between them and the HTTP layer. However the file needed to be split in two. Quite a number of call places were dropped because these were mostly leftovers from the early days where the stats and cli were packed together. --- .../uri_auth.h => haproxy/uri_auth-t.h} | 33 ++++---------- include/haproxy/uri_auth.h | 44 +++++++++++++++++++ src/acl.c | 1 - src/cfgparse-listen.c | 2 +- src/cfgparse.c | 2 +- src/cli.c | 1 - src/haproxy.c | 2 +- src/hlua_fcn.c | 1 - src/http_act.c | 2 +- src/http_ana.c | 2 +- src/sample.c | 2 +- src/stats.c | 2 +- src/uri_auth.c | 2 +- 13 files changed, 60 insertions(+), 36 deletions(-) rename include/{common/uri_auth.h => haproxy/uri_auth-t.h} (58%) create mode 100644 include/haproxy/uri_auth.h diff --git a/include/common/uri_auth.h b/include/haproxy/uri_auth-t.h similarity index 58% rename from include/common/uri_auth.h rename to include/haproxy/uri_auth-t.h index 9250f54f9..250979155 100644 --- a/include/common/uri_auth.h +++ b/include/haproxy/uri_auth-t.h @@ -1,7 +1,8 @@ /* - * URI-based user authentication using the HTTP basic method. + * include/haproxy/uri_auth-t.h + * Definitions for URI-based user authentication using the HTTP basic method. * - * Copyright 2006-2011 Willy Tarreau + * Copyright 2006-2020 Willy Tarreau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -10,12 +11,12 @@ * */ -#ifndef _COMMON_URI_AUTH_H -#define _COMMON_URI_AUTH_H - +#ifndef _HAPROXY_URI_AUTH_T_H +#define _HAPROXY_URI_AUTH_T_H +#include #include -#include +#include /* This is a list of proxies we are allowed to see. Later, it should go in the * user list, but before this we need to support de/re-authentication. @@ -46,25 +47,7 @@ struct stats_admin_rule { struct acl_cond *cond; /* acl condition to meet */ }; - -/* Various functions used to set the fields during the configuration parsing. - * Please that all those function can initialize the root entry in order not to - * force the user to respect a certain order in the configuration file. - * - * Default values are used during initialization. Check STATS_DEFAULT_* for - * more information. - */ -struct uri_auth *stats_check_init_uri_auth(struct uri_auth **root); -struct uri_auth *stats_set_uri(struct uri_auth **root, char *uri); -struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm); -struct uri_auth *stats_set_refresh(struct uri_auth **root, int interval); -struct uri_auth *stats_set_flag(struct uri_auth **root, int flag); -struct uri_auth *stats_add_auth(struct uri_auth **root, char *user); -struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope); -struct uri_auth *stats_set_node(struct uri_auth **root, char *name); -struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc); - -#endif /* _COMMON_URI_AUTH_H */ +#endif /* _HAPROXY_URI_AUTH_T_H */ /* * Local variables: diff --git a/include/haproxy/uri_auth.h b/include/haproxy/uri_auth.h new file mode 100644 index 000000000..27dca02c7 --- /dev/null +++ b/include/haproxy/uri_auth.h @@ -0,0 +1,44 @@ +/* + * include/haproxy/uri_auth.h + * Functions for URI-based user authentication using the HTTP basic method. + * + * Copyright 2006-2020 Willy Tarreau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _HAPROXY_URI_AUTH_H +#define _HAPROXY_URI_AUTH_H + +#include +#include + +/* Various functions used to set the fields during the configuration parsing. + * Please that all those function can initialize the root entry in order not to + * force the user to respect a certain order in the configuration file. + * + * Default values are used during initialization. Check STATS_DEFAULT_* for + * more information. + */ +struct uri_auth *stats_check_init_uri_auth(struct uri_auth **root); +struct uri_auth *stats_set_uri(struct uri_auth **root, char *uri); +struct uri_auth *stats_set_realm(struct uri_auth **root, char *realm); +struct uri_auth *stats_set_refresh(struct uri_auth **root, int interval); +struct uri_auth *stats_set_flag(struct uri_auth **root, int flag); +struct uri_auth *stats_add_auth(struct uri_auth **root, char *user); +struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope); +struct uri_auth *stats_set_node(struct uri_auth **root, char *name); +struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc); + +#endif /* _HAPROXY_URI_AUTH_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/src/acl.c b/src/acl.c index ea0a54dc1..259b79a7b 100644 --- a/src/acl.c +++ b/src/acl.c @@ -20,7 +20,6 @@ #include #include #include -#include #include diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index 0c6fa35b7..44474fde2 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/src/cfgparse.c b/src/cfgparse.c index 376430f26..5f2787792 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/cli.c b/src/cli.c index a52078791..186aad424 100644 --- a/src/cli.c +++ b/src/cli.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/src/haproxy.c b/src/haproxy.c index b420df938..26702a906 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -107,7 +107,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 48a0514f4..f4ac3d5d2 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/src/http_act.c b/src/http_act.c index 844eeafbf..37966f399 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/http_ana.c b/src/http_ana.c index 855529378..37ae6481c 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -21,8 +21,8 @@ #include #include #include +#include #include -#include #include diff --git a/src/sample.c b/src/sample.c index 8fd043b8e..23f7bf267 100644 --- a/src/sample.c +++ b/src/sample.c @@ -29,8 +29,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/src/stats.c b/src/stats.c index bc9aaee8b..0bb748182 100644 --- a/src/stats.c +++ b/src/stats.c @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/uri_auth.c b/src/uri_auth.c index a2c142615..236f57872 100644 --- a/src/uri_auth.c +++ b/src/uri_auth.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include