]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - helpers/external_acl/kerberos_ldap_group/support_resolv.cc
SourceFormat Enforcement
[thirdparty/squid.git] / helpers / external_acl / kerberos_ldap_group / support_resolv.cc
index 93e1d499813cc664d9192ba2207abda25b1104b4..b8259a132368c97c5b8453d6c62142664e6f6d71 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 /*
  * -----------------------------------------------------------------------------
  *
 #include "squid.h"
 #include "util.h"
 
-#ifdef HAVE_LDAP
+#if HAVE_LDAP
 
 #include "support.h"
 #include <cerrno>
-#ifdef HAVE_NETDB_H
+#if HAVE_NETDB_H
 #include <netdb.h>
 #endif
-#ifdef HAVE_NETINET_IN_H
+#if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
-#ifdef HAVE_RESOLV_H
+#if HAVE_RESOLV_H
 #include <resolv.h>
 #endif
-#ifdef HAVE_ARPA_NAMESER_H
+#if HAVE_ARPA_NAMESER_H
 #include <arpa/nameser.h>
 #endif
 
@@ -308,7 +316,7 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t n
         }
     }
     p = buffer;
-    p += 6 * NS_INT16SZ;       /* Header(6*16bit) = id + flags + 4*section count */
+    p += 6 * NS_INT16SZ;    /* Header(6*16bit) = id + flags + 4*section count */
     if (p > buffer + len) {
         error((char *) "%s| %s: ERROR: Message to small: %d < header size\n", LogTime(), PROGRAM, len);
         goto finalise;
@@ -317,8 +325,8 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t n
         error((char *) "%s| %s: ERROR: Error while expanding query name with dn_expand:  %s\n", LogTime(), PROGRAM, strerror(errno));
         goto finalise;
     }
-    p += size;                 /* Query name */
-    p += 2 * NS_INT16SZ;       /* Query type + class (2*16bit) */
+    p += size;          /* Query name */
+    p += 2 * NS_INT16SZ;    /* Query type + class (2*16bit) */
     if (p > buffer + len) {
         error((char *) "%s| %s: ERROR: Message to small: %d < header + query name,type,class \n", LogTime(), PROGRAM, len);
         goto finalise;
@@ -329,37 +337,37 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t n
             error((char *) "%s| %s: ERROR: Error while expanding answer name with dn_expand:  %s\n", LogTime(), PROGRAM, strerror(errno));
             goto finalise;
         }
-        p += size;             /* Resource Record name */
+        p += size;      /* Resource Record name */
         if (p > buffer + len) {
             error((char *) "%s| %s: ERROR: Message to small: %d < header + query name,type,class + answer name\n", LogTime(), PROGRAM, len);
             goto finalise;
         }
-        NS_GET16(type, p);     /* RR type (16bit) */
-        p += NS_INT16SZ + NS_INT32SZ;  /* RR class + ttl (16bit+32bit) */
+        NS_GET16(type, p);  /* RR type (16bit) */
+        p += NS_INT16SZ + NS_INT32SZ;   /* RR class + ttl (16bit+32bit) */
         if (p > buffer + len) {
             error((char *) "%s| %s: ERROR: Message to small: %d < header + query name,type,class + answer name + RR type,class,ttl\n", LogTime(), PROGRAM, len);
             goto finalise;
         }
-        NS_GET16(rdlength, p); /* RR data length (16bit) */
+        NS_GET16(rdlength, p);  /* RR data length (16bit) */
 
-        if (type == ns_t_srv) {        /* SRV record */
+        if (type == ns_t_srv) { /* SRV record */
             int priority, weight, port;
             char host[NS_MAXDNAME];
             if (p > buffer + len) {
                 error((char *) "%s| %s: ERROR: Message to small: %d < header + query name,type,class + answer name + RR type,class,ttl + RR data length\n", LogTime(), PROGRAM, len);
                 goto finalise;
             }
-            NS_GET16(priority, p);     /* Priority (16bit) */
+            NS_GET16(priority, p);  /* Priority (16bit) */
             if (p > buffer + len) {
                 error((char *) "%s| %s: ERROR: Message to small: %d <  SRV RR + priority\n", LogTime(), PROGRAM, len);
                 goto finalise;
             }
-            NS_GET16(weight, p);       /* Weight (16bit) */
+            NS_GET16(weight, p);    /* Weight (16bit) */
             if (p > buffer + len) {
                 error((char *) "%s| %s: ERROR: Message to small: %d <  SRV RR + priority + weight\n", LogTime(), PROGRAM, len);
                 goto finalise;
             }
-            NS_GET16(port, p); /* Port (16bit) */
+            NS_GET16(port, p);  /* Port (16bit) */
             if (p > buffer + len) {
                 error((char *) "%s| %s: ERROR: Message to small: %d <  SRV RR + priority + weight + port\n", LogTime(), PROGRAM, len);
                 goto finalise;
@@ -443,3 +451,4 @@ cleanup:
     return (nhosts);
 }
 #endif
+