From c0d579b8423ef278c204b6db60615c88eea9c870 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Mon, 30 May 2022 13:53:24 -0700 Subject: [PATCH] Adding propper include guard to header files, renaming to PPP__H for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- pppd/ccp.h | 5 +++++ pppd/chap-md5.h | 6 ++++++ pppd/chap-new.h | 5 +++++ pppd/chap_ms.h | 8 ++++---- pppd/eap-tls.h | 7 +++---- pppd/eap.h | 4 ++-- pppd/ecp.h | 4 ++-- pppd/eui64.h | 39 +++------------------------------------ pppd/fsm.h | 4 ++++ pppd/ipcp.h | 5 +++++ pppd/ipv6cp.c | 1 + pppd/ipv6cp.h | 6 ++++++ pppd/lcp.h | 5 +++++ pppd/magic.h | 5 +++++ pppd/md4.h | 7 ++++--- pppd/md5.h | 7 ++++--- pppd/mppe.h | 8 ++++---- pppd/pathnames.h | 4 ++++ pppd/peap.h | 2 ++ pppd/pppcrypt.h | 8 ++++---- pppd/pppd.h | 43 ++++++++++++++++++++++++++++++++++--------- pppd/pppdconf.h.in | 5 +++++ pppd/session.h | 8 ++++---- pppd/sha1.h | 8 ++++---- pppd/spinlock.h | 8 ++++---- pppd/sys-linux.c | 1 + pppd/tdb.h | 8 ++++---- pppd/termios_linux.h | 8 +++++--- pppd/tls.h | 8 +++++--- pppd/upap.h | 6 ++++++ 30 files changed, 150 insertions(+), 93 deletions(-) diff --git a/pppd/ccp.h b/pppd/ccp.h index 35961b9..a37695c 100644 --- a/pppd/ccp.h +++ b/pppd/ccp.h @@ -29,6 +29,9 @@ * * $Id: ccp.h,v 1.12 2004/11/04 10:02:26 paulus Exp $ */ +#ifndef PPP_CCP_H +#define PPP_CCP_H + #include "pppdconf.h" typedef struct ccp_options { @@ -51,3 +54,5 @@ extern ccp_options ccp_allowoptions[]; extern ccp_options ccp_hisoptions[]; extern struct protent ccp_protent; + +#endif diff --git a/pppd/chap-md5.h b/pppd/chap-md5.h index 4dbbfd1..55f9ba2 100644 --- a/pppd/chap-md5.h +++ b/pppd/chap-md5.h @@ -27,6 +27,12 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef PPP_CHAP_MD5_H +#define PPP_CHAP_MD5_H + #include "pppdconf.h" extern void chap_md5_init(void); + +#endif diff --git a/pppd/chap-new.h b/pppd/chap-new.h index b4b0ee2..9ebec54 100644 --- a/pppd/chap-new.h +++ b/pppd/chap-new.h @@ -28,6 +28,9 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef PPP_CHAP_NEW_H +#define PPP_CHAP_NEW_H + #include "pppdconf.h" /* @@ -133,3 +136,5 @@ extern void chap_auth_with_peer(int unit, char *our_name, int digest_code); /* Represents the CHAP protocol to the main pppd code */ extern struct protent chap_protent; + +#endif diff --git a/pppd/chap_ms.h b/pppd/chap_ms.h index c1c5ed8..7b08cff 100644 --- a/pppd/chap_ms.h +++ b/pppd/chap_ms.h @@ -30,9 +30,10 @@ * $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $ */ -#include "pppdconf.h" +#ifndef PPP_CHAPMS_H +#define PPP_CHAPMS_H -#ifndef __CHAPMS_INCLUDE__ +#include "pppdconf.h" #define MD4_SIGNATURE_SIZE 16 /* 16 bytes in a MD4 message digest */ #define MAX_NT_PASSWORD 256 /* Max (Unicode) chars in an NT pass */ @@ -87,5 +88,4 @@ void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], void chapms_init(void); -#define __CHAPMS_INCLUDE__ -#endif /* __CHAPMS_INCLUDE__ */ +#endif /* PPP_CHAPMS_H */ diff --git a/pppd/eap-tls.h b/pppd/eap-tls.h index befd203..2777d81 100644 --- a/pppd/eap-tls.h +++ b/pppd/eap-tls.h @@ -30,11 +30,10 @@ * */ -#include "pppdconf.h" - -#ifndef __EAP_TLS_H__ -#define __EAP_TLS_H__ +#ifndef PPP_EAP_TLS_H +#define PPP_EAP_TLS_H +#include "pppdconf.h" #include "eap.h" #include diff --git a/pppd/eap.h b/pppd/eap.h index 96c5f69..01697a8 100644 --- a/pppd/eap.h +++ b/pppd/eap.h @@ -20,11 +20,11 @@ * $Id: eap.h,v 1.2 2003/06/11 23:56:26 paulus Exp $ */ -#include "pppdconf.h" - #ifndef PPP_EAP_H #define PPP_EAP_H +#include "pppdconf.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/pppd/ecp.h b/pppd/ecp.h index 807a100..5a0df4d 100644 --- a/pppd/ecp.h +++ b/pppd/ecp.h @@ -30,11 +30,11 @@ * * $Id: ecp.h,v 1.2 2003/01/10 07:12:36 fcusack Exp $ */ -#include "pppdconf.h" - #ifndef PPP_ECP_H #define PPP_ECP_H +#include "pppdconf.h" + #ifndef PPP_ECP #define PPP_ECP 0x8053 #endif diff --git a/pppd/eui64.h b/pppd/eui64.h index 496814d..f29200b 100644 --- a/pppd/eui64.h +++ b/pppd/eui64.h @@ -33,47 +33,15 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +#ifndef PPP_EUI64_H +#define PPP_EUI64_H #include "pppdconf.h" -#ifndef __EUI64_H__ -#define __EUI64_H__ - #if !defined(PPP_WITH_IPV6CP) #error "this file should only be included when PPP_WITH_IPV6CP is defined" #endif /* not defined(PPP_WITH_IPV6CP) */ -#if defined(SOL2) -#include - -typedef union { - uint8_t e8[8]; /* lower 64-bit IPv6 address */ - uint32_t e32[2]; /* lower 64-bit IPv6 address */ -} eui64_t; - -/* - * Declare the two below, since in.h only defines them when _KERNEL - * is declared - which shouldn't be true when dealing with user-land programs - */ -#define s6_addr8 _S6_un._S6_u8 -#define s6_addr32 _S6_un._S6_u32 - -#else /* else if not defined(SOL2) */ - -/* - * TODO: - * - * Maybe this should be done by processing struct in6_addr directly... - */ -typedef union -{ - u_int8_t e8[8]; - u_int16_t e16[4]; - u_int32_t e32[2]; -} eui64_t; - -#endif /* defined(SOL2) */ - #define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0) #define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \ ((e).e32[1] == (o).e32[1])) @@ -111,5 +79,4 @@ typedef union char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */ -#endif /* __EUI64_H__ */ - +#endif /* PPP_EUI64_H */ diff --git a/pppd/fsm.h b/pppd/fsm.h index d23725c..1cda6cf 100644 --- a/pppd/fsm.h +++ b/pppd/fsm.h @@ -41,6 +41,8 @@ * * $Id: fsm.h,v 1.10 2004/11/13 02:28:15 paulus Exp $ */ +#ifndef PPP_FSM_H +#define PPP_FSM_H #include "pppdconf.h" @@ -160,3 +162,5 @@ void fsm_sdata (fsm *, int, int, u_char *, int); * Variables */ extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */ + +#endif diff --git a/pppd/ipcp.h b/pppd/ipcp.h index 90336c4..0e44931 100644 --- a/pppd/ipcp.h +++ b/pppd/ipcp.h @@ -39,6 +39,9 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef PPP_IPCP_H +#define PPP_IPCP_H + #include "pppdconf.h" /* @@ -96,3 +99,5 @@ extern ipcp_options ipcp_hisoptions[]; char *ip_ntoa(u_int32_t); extern struct protent ipcp_protent; + +#endif /* PPP_IPCP_H */ diff --git a/pppd/ipv6cp.c b/pppd/ipv6cp.c index 130819d..5a99841 100644 --- a/pppd/ipv6cp.c +++ b/pppd/ipv6cp.c @@ -164,6 +164,7 @@ #include "pppd.h" #include "fsm.h" +#include "eui64.h" #include "ipcp.h" #include "ipv6cp.h" #include "magic.h" diff --git a/pppd/ipv6cp.h b/pppd/ipv6cp.h index 3ce9df4..172b6eb 100644 --- a/pppd/ipv6cp.h +++ b/pppd/ipv6cp.h @@ -33,6 +33,10 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ + +#ifndef PPP_IPV6CP_H +#define PPP_IPV6CP_H + #include "pppdconf.h" /* Original version, based on RFC2023 : @@ -169,3 +173,5 @@ extern ipv6cp_options ipv6cp_allowoptions[]; extern ipv6cp_options ipv6cp_hisoptions[]; extern struct protent ipv6cp_protent; + +#endif diff --git a/pppd/lcp.h b/pppd/lcp.h index 768442d..c01313d 100644 --- a/pppd/lcp.h +++ b/pppd/lcp.h @@ -39,6 +39,9 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef PPP_LCP_H +#define PPP_LCP_H + #include "pppdconf.h" /* @@ -132,3 +135,5 @@ extern struct protent lcp_protent; /* Default number of times we receive our magic number from the peer before deciding the link is looped-back. */ #define DEFLOOPBACKFAIL 10 + +#endif diff --git a/pppd/magic.h b/pppd/magic.h index b864b7b..70e4ce5 100644 --- a/pppd/magic.h +++ b/pppd/magic.h @@ -39,6 +39,9 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef PPP_MAGIC_H +#define PPP_MAGIC_H + #include "pppdconf.h" void magic_init (void); /* Initialize the magic number generator */ @@ -46,3 +49,5 @@ u_int32_t magic (void); /* Returns the next magic number */ /* Fill buffer with random bytes */ void random_bytes (unsigned char *buf, int len); + +#endif diff --git a/pppd/md4.h b/pppd/md4.h index d67daeb..546ea02 100644 --- a/pppd/md4.h +++ b/pppd/md4.h @@ -7,10 +7,11 @@ ** (C) 1990 RSA Data Security, Inc. ** ** ******************************************************************** */ +#ifndef PPP_MD4_H +#define PPP_MD4_H + #include "pppdconf.h" -#ifndef __MD4_INCLUDE__ -#define __MD4_INCLUDE__ #ifndef USE_MD4 #include #define MD4Init MD4_Init @@ -64,4 +65,4 @@ extern void MD4Final(unsigned char *, MD4_CTX *); ** End of md4.h ****************************(cut)***********************************/ #endif /* USE_MD4 */ -#endif /* __MD4_INCLUDE__ */ +#endif /* PPP_MD4_H */ diff --git a/pppd/md5.h b/pppd/md5.h index 662eb41..31f410d 100644 --- a/pppd/md5.h +++ b/pppd/md5.h @@ -36,10 +36,11 @@ ** documentation and/or software. ** *********************************************************************** */ +#ifndef PPP_MD5_H +#define PPP_MD5_H + #include "pppdconf.h" -#ifndef __MD5_INCLUDE__ -#define __MD5_INCLUDE__ #ifndef USE_MD5 #include #else @@ -67,4 +68,4 @@ void MD5_Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen); void MD5_Final (unsigned char hash[], MD5_CTX *mdContext); #endif /* USE_MD5 */ -#endif /* __MD5_INCLUDE__ */ +#endif /* PPP_MD5_H */ diff --git a/pppd/mppe.h b/pppd/mppe.h index bf86e19..ade208f 100644 --- a/pppd/mppe.h +++ b/pppd/mppe.h @@ -32,10 +32,10 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "pppdconf.h" +#ifndef PPP_MPPE_H +#define PPP_MPPE_H -#ifndef __MPPE_H__ -#define __MPPE_H__ +#include "pppdconf.h" #define MPPE_PAD 4 /* MPPE growth per frame */ #define MPPE_MAX_KEY_SIZE 32 /* Largest key length */ @@ -188,4 +188,4 @@ void mppe_set_chapv2(u_char PasswordHashHash[MD4_SIGNATURE_SIZE], u_char NTResponse[MS_AUTH_NTRESP_LEN], int IsServer); #endif // #ifdef PPP_WITH_MPPE -#endif // #ifdef __MPPE_H__ +#endif // #ifdef PPP_MPPE_H diff --git a/pppd/pathnames.h b/pppd/pathnames.h index 4d9b80c..57a130e 100644 --- a/pppd/pathnames.h +++ b/pppd/pathnames.h @@ -1,6 +1,9 @@ /* * define path names */ +#ifndef PPP_PATHNAMES_H +#define PPP_PATHNAMES_H + #include "pppdconf.h" #ifdef HAVE_PATHS_H @@ -70,3 +73,4 @@ #define _PATH_PPPDB _PPP_VARRUN "pppd2.tdb" #endif /* __STDC__ */ +#endif /* PPP_PATHNAMES_H */ diff --git a/pppd/peap.h b/pppd/peap.h index 49e28e8..f11312e 100644 --- a/pppd/peap.h +++ b/pppd/peap.h @@ -30,6 +30,8 @@ #ifndef PPP_PEAP_H #define PPP_PEAP_H +#include "pppdconf.h" + #define PEAP_PHASE_1 1 #define PEAP_PHASE_2 2 diff --git a/pppd/pppcrypt.h b/pppd/pppcrypt.h index 79676ca..fff396c 100644 --- a/pppd/pppcrypt.h +++ b/pppd/pppcrypt.h @@ -29,10 +29,10 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "pppdconf.h" +#ifndef PPP_PPPCRYPT_H +#define PPP_PPPCRYPT_H -#ifndef PPPCRYPT_H -#define PPPCRYPT_H +#include "pppdconf.h" #ifdef HAVE_CRYPT_H #include @@ -46,4 +46,4 @@ extern bool DesSetkey(u_char *); extern bool DesEncrypt(u_char *, u_char *); extern bool DesDecrypt(u_char *, u_char *); -#endif /* PPPCRYPT_H */ +#endif /* PPP_PPPCRYPT_H */ diff --git a/pppd/pppd.h b/pppd/pppd.h index c5f9b6d..d7b431d 100644 --- a/pppd/pppd.h +++ b/pppd/pppd.h @@ -42,14 +42,10 @@ * $Id: pppd.h,v 1.96 2008/06/23 11:47:18 paulus Exp $ */ -#include "pppdconf.h" - -/* - * TODO: - */ +#ifndef PPP_PPPD_H +#define PPP_PPPD_H -#ifndef __PPPD_H__ -#define __PPPD_H__ +#include "pppdconf.h" #include /* for FILE */ #include /* for encrypt */ @@ -60,7 +56,36 @@ #include #ifdef PPP_WITH_IPV6CP -#include "eui64.h" +#if defined(SOL2) +#include + +typedef union { + uint8_t e8[8]; /* lower 64-bit IPv6 address */ + uint32_t e32[2]; /* lower 64-bit IPv6 address */ +} eui64_t; + +/* + * Declare the two below, since in.h only defines them when _KERNEL + * is declared - which shouldn't be true when dealing with user-land programs + */ +#define s6_addr8 _S6_un._S6_u8 +#define s6_addr32 _S6_un._S6_u32 + +#else /* else if not defined(SOL2) */ + +/* + * TODO: + * + * Maybe this should be done by processing struct in6_addr directly... + */ +typedef union +{ + u_int8_t e8[8]; + u_int16_t e16[4]; + u_int32_t e32[2]; +} eui64_t; + +#endif /* defined(SOL2) */ #endif /* @@ -962,4 +987,4 @@ extern void (*snoop_send_hook)(unsigned char *p, int len); #define offsetof(type, member) ((size_t) &((type *)0)->member) #endif -#endif /* __PPP_H__ */ +#endif /* PPP_PPPD_H */ diff --git a/pppd/pppdconf.h.in b/pppd/pppdconf.h.in index 5cdcf5b..2ae6255 100644 --- a/pppd/pppdconf.h.in +++ b/pppd/pppdconf.h.in @@ -3,6 +3,9 @@ * in pppd when configured. */ +#ifndef PPP_PPPDCONF_H +#define PPP_PPPDCONF_H + /* Have Microsoft CHAP support */ #undef PPP_WITH_CHAPMS @@ -59,3 +62,5 @@ /* The pppd version */ #undef PPPD_VERSION + +#endif diff --git a/pppd/session.h b/pppd/session.h index 0047db6..0b91a03 100644 --- a/pppd/session.h +++ b/pppd/session.h @@ -27,10 +27,10 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "pppdconf.h" +#ifndef PPP_SESSION_H +#define PPP_SESSION_H -#ifndef __SESSION_H -#define __SESSION_H +#include "pppdconf.h" #define SESS_AUTH 1 /* Check User Authentication */ #define SESS_ACCT 2 /* Check Account Validity */ @@ -89,4 +89,4 @@ session_start(const int flags, const char* user, const char* passwd, const char* void session_end(const char* tty); -#endif +#endif // PPP_SESSION_H diff --git a/pppd/sha1.h b/pppd/sha1.h index e7e5573..2325133 100644 --- a/pppd/sha1.h +++ b/pppd/sha1.h @@ -1,9 +1,9 @@ /* sha1.h */ -#include "pppdconf.h" +#ifndef PPP_SHA1_H +#define PPP_SHA1_H -#ifndef __SHA1_INCLUDE_ -#define __SHA1_INCLUDE_ +#include "pppdconf.h" #ifndef USE_SHA #include @@ -32,4 +32,4 @@ extern void SHA1_Update(SHA1_CTX *, const unsigned char *, unsigned int); extern void SHA1_Final(unsigned char[SHA1_SIGNATURE_SIZE], SHA1_CTX *); #endif /* USE_SHA */ -#endif /* __SHA1_INCLUDE_ */ +#endif /* PPP_SHA1_H */ diff --git a/pppd/spinlock.h b/pppd/spinlock.h index 38e7bcc..b36d2a8 100644 --- a/pppd/spinlock.h +++ b/pppd/spinlock.h @@ -1,7 +1,7 @@ -#include "pppdconf.h" +#ifndef PPP_SPINLOCK_H +#define PPP_SPINLOCK_H -#ifndef __SPINLOCK_H__ -#define __SPINLOCK_H__ +#include "pppdconf.h" #include "tdb.h" @@ -54,4 +54,4 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb); #endif -#endif +#endif // PPP_SPINLOCK_H diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index d16f9bf..dda8772 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -157,6 +157,7 @@ #include "pppd.h" #include "fsm.h" #include "ipcp.h" +#include "eui64.h" #ifdef PPP_WITH_FILTER #include diff --git a/pppd/tdb.h b/pppd/tdb.h index 418bd8d..1d7d765 100644 --- a/pppd/tdb.h +++ b/pppd/tdb.h @@ -1,7 +1,7 @@ -#include "pppdconf.h" +#ifndef PPP_TDB_H +#define PPP_TDB_H -#ifndef __TDB_H__ -#define __TDB_H__ +#include "pppdconf.h" /* Unix SMB/CIFS implementation. @@ -163,4 +163,4 @@ extern TDB_DATA tdb_null; } #endif -#endif /* tdb.h */ +#endif /* PPP_TBD_H */ diff --git a/pppd/termios_linux.h b/pppd/termios_linux.h index 9c79d16..a234d30 100644 --- a/pppd/termios_linux.h +++ b/pppd/termios_linux.h @@ -6,8 +6,10 @@ * Copyright (c) 2021 Marek Behún */ -#ifndef _TERMIOS_LINUX_H_ -#define _TERMIOS_LINUX_H_ +#ifndef PPP_TERMIOS_LINUX_H +#define PPP_TERMIOS_LINUX_H + +#include "pppdconf.h" /* * We need to use raw TCGETS2/TCSETS2 or TCGETS/TCSETS ioctls with the BOTHER @@ -191,4 +193,4 @@ static void cfmakeraw(struct termios *t) t->c_cflag |= CS8; } -#endif /* _TERMIOS_LINUX_H_ */ +#endif /* PPP_TERMIOS_LINUX_H */ diff --git a/pppd/tls.h b/pppd/tls.h index 39fdef7..0796779 100644 --- a/pppd/tls.h +++ b/pppd/tls.h @@ -26,8 +26,10 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef TLS_H -#define TLS_H +#ifndef PPP_TLS_H +#define PPP_TLS_H + +#include "pppdconf.h" /** * Structure used in verifying the peer certificate @@ -85,4 +87,4 @@ int tls_set_ca(SSL_CTX *ctx, const char *ca_dir, const char *ca_file); */ void tls_log_sslerr( void ); -#endif /* TLS_H */ +#endif /* PPP_TLS_H */ diff --git a/pppd/upap.h b/pppd/upap.h index 709cd62..af09cd9 100644 --- a/pppd/upap.h +++ b/pppd/upap.h @@ -41,6 +41,10 @@ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifndef PPP_UPAP_H +#define PPP_UPAP_H + +#include "pppdconf.h" /* * Packet header = Code, id, length. @@ -108,3 +112,5 @@ void upap_authwithpeer(int, char *, char *); void upap_authpeer(int); extern struct protent pap_protent; + +#endif // PPP_UPAP_H -- 2.39.2