summaryrefslogtreecommitdiff
path: root/src/spfdnsip.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 19:03:11 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 19:03:11 +0200
commit20b85c03e751b4876fa3c92040464e483172b746 (patch)
tree734fadbfdbc143ec4465093857f4c239448715e0 /src/spfdnsip.c
parenta6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (diff)
manual format adjustment
Diffstat (limited to 'src/spfdnsip.c')
-rw-r--r--src/spfdnsip.c103
1 files changed, 47 insertions, 56 deletions
diff --git a/src/spfdnsip.c b/src/spfdnsip.c
index 9012f69..f2a802e 100644
--- a/src/spfdnsip.c
+++ b/src/spfdnsip.c
@@ -23,12 +23,11 @@ extern char ip6remote[16];
extern int flagip6;
/**
- @brief match_ip
- compares IPv4/IPv6 addreses up to prefix length
- @param input: ip_address1,prefix length, ip_address2
- @return 1 ok; 0 failure
- */
-
+ @brief match_ip
+ compares IPv4/IPv6 addreses up to prefix length
+ @param input: ip_address1,prefix length, ip_address2
+ @return 1 ok; 0 failure
+*/
int match_ip4(unsigned char ip1[4], int prefix, char ip2[4])
{
stralloc iptest1 = {0};
@@ -58,12 +57,11 @@ int match_ip6(unsigned char ip1[16], int prefix, char ip2[16])
}
/**
- @brief get_prefix
- return integer value of prefix length
- @param input: pointer to prefix
- @return (int) length of prefix
- */
-
+ @brief get_prefix
+ return integer value of prefix length
+ @param input: pointer to prefix
+ @return (int) length of prefix
+*/
int get_prefix(char *prefix)
{
unsigned long r;
@@ -85,13 +83,12 @@ int get_prefix(char *prefix)
/* DNS Record: -------------------------------------- Fetch multiple SPF TXT RRs */
/**
- @brief spf_records
- get TXT records for domain and extract SPF information
- @param input: pointer stralloc domain
- output: pointer to stralloc spf records
- @return SPF_OK, SPF_NONE; SPF_MULTIRR, SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_records
+ get TXT records for domain and extract SPF information
+ @param input: pointer stralloc domain
+ output: pointer to stralloc spf records
+ @return SPF_OK, SPF_NONE; SPF_MULTIRR, SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_records(stralloc *spfrec, stralloc *domain)
{
static stralloc out = {0};
@@ -138,12 +135,11 @@ int spf_records(stralloc *spfrec, stralloc *domain)
/* Mechanisms: -------------------------------------- Lookup functions */
/**
- @brief spf_a (a; a:fqdns; a:fqdns/56)
- compares A + AAAA records for SPF info and client host
- @param input: pointer to spfspecification, pointer to prefix
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_a (a; a:fqdns; a:fqdns/56)
+ compares A + AAAA records for SPF info and client host
+ @param input: pointer to spfspecification, pointer to prefix
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_a(char *spfspec, char *prefix)
{
stralloc sa = {0};
@@ -183,12 +179,11 @@ int spf_a(char *spfspec, char *prefix)
}
/**
- @brief spf_mx (mx; mx:domain; mx:domain/24)
- compares MX records for SPF info and client host
- @param input: pointer to spfspecification, pointer to prefix
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_mx (mx; mx:domain; mx:domain/24)
+ compares MX records for SPF info and client host
+ @param input: pointer to spfspecification, pointer to prefix
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_mx(char *spfspec, char *prefix)
{
stralloc sa = {0};
@@ -224,12 +219,11 @@ int spf_mx(char *spfspec, char *prefix)
}
/**
- @brief spf_ptr (ptr; ptr:fqdn)
- compares PTR records from SPF info and client host
- @param input: pointer to spfspecification; prefix not used
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_ptr (ptr; ptr:fqdn)
+ compares PTR records from SPF info and client host
+ @param input: pointer to spfspecification; prefix not used
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_ptr(char *spfspec, char *prefix)
{
stralloc fqdn = {0};
@@ -255,7 +249,7 @@ int spf_ptr(char *spfspec, char *prefix)
return SPF_OK;
}
- /* ok, either it's the first test or it's a very weired setup
+ /* ok, either it's the first test or it's a very weired setup
Assumptions:
ip -> inverse DNS name (only one!)
inverse DNS name -> (same) ip (only one!)
@@ -351,12 +345,11 @@ int spf_ptr(char *spfspec, char *prefix)
}
/**
- @brief spf_ip4 (ip4; ip4:fqdn; ip4:fqdn/24)
- compares A records for SPF info and client host
- @param input: pointer to spfspecification, pointer to prefix
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_ip4 (ip4; ip4:fqdn; ip4:fqdn/24)
+ compares A records for SPF info and client host
+ @param input: pointer to spfspecification, pointer to prefix
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_ip4(char *spfspec, char *prefix)
{
char spfip[4];
@@ -374,12 +367,11 @@ int spf_ip4(char *spfspec, char *prefix)
}
/**
- @brief spf_ip6 (ip6; ip6:fqdn; ip6:fqdn/56)
- compares AAAA records for SPF info and client host
- @param input: pointer to spfspecification, pointer to prefix
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_ip6 (ip6; ip6:fqdn; ip6:fqdn/56)
+ compares AAAA records for SPF info and client host
+ @param input: pointer to spfspecification, pointer to prefix
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_ip6(char *spfspec, char *prefix)
{
char spfip[16];
@@ -397,12 +389,11 @@ int spf_ip6(char *spfspec, char *prefix)
}
/**
- @brief spf_exists (exists; exists:fqdn)
- simply looks for a A records only for SPF info and client host
- @param input: pointer to spfspecification, prefix not used
- @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
- */
-
+ @brief spf_exists (exists; exists:fqdn)
+ simply looks for a A records only for SPF info and client host
+ @param input: pointer to spfspecification, prefix not used
+ @return SPF_OK, SPF_NONE; SPF_DNSSOFT, SPF_NOMEM
+*/
int spf_exists(char *spfspec, char *prefix)
{
stralloc sa = {0};