From 28df78fee985dbde485fb162d24a675688397e5e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 15 Jun 2009 00:35:17 +1200 Subject: [PATCH] SourceFormat enforcement --- helpers/basic_auth/LDAP/squid_ldap_auth.c | 2 +- .../ldap_group/squid_ldap_group.c | 2 +- helpers/external_acl/session/squid_session.c | 2 +- helpers/ntlm_auth/smb_lm/libntlmssp.c | 26 ++-- helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h | 4 +- helpers/ntlm_auth/smb_lm/smbval/smblib-util.c | 26 ++-- helpers/ntlm_auth/smb_lm/smbval/smblib.c | 6 +- lib/hash.c | 2 +- lib/rfc2617.c | 10 +- src/AccessLogEntry.h | 3 +- src/ClientInfo.h | 3 +- src/WinSvc.cc | 30 ++--- src/acl/Tag.cc | 6 +- src/acl/Tag.h | 6 +- src/cache_cf.cc | 10 +- src/client_side.cc | 6 +- src/comm.cc | 8 +- src/debug.cc | 3 +- src/dns_internal.cc | 114 +++++++++--------- src/dnsserver.cc | 2 +- src/enums.h | 0 src/ftp.cc | 7 +- src/helper.cc | 4 +- src/htcp.cc | 22 ++-- src/http.cc | 4 +- src/icp_v2.cc | 16 +-- src/ident/Config.h | 6 +- src/ident/Ident.cc | 13 +- src/ident/Ident.h | 3 +- src/ip/IpAddress.cc | 2 +- src/ipc.cc | 2 +- src/refresh.cc | 4 +- src/snmp_core.cc | 16 +-- src/tunnel.cc | 4 +- src/url.cc | 2 +- src/wccp.cc | 8 +- src/wccp2.cc | 34 +++--- src/win32.cc | 0 38 files changed, 212 insertions(+), 206 deletions(-) mode change 100755 => 100644 src/WinSvc.cc mode change 100755 => 100644 src/dns_internal.cc mode change 100755 => 100644 src/enums.h mode change 100755 => 100644 src/win32.cc diff --git a/helpers/basic_auth/LDAP/squid_ldap_auth.c b/helpers/basic_auth/LDAP/squid_ldap_auth.c index 299e675637..2e36ca66b9 100644 --- a/helpers/basic_auth/LDAP/squid_ldap_auth.c +++ b/helpers/basic_auth/LDAP/squid_ldap_auth.c @@ -544,7 +544,7 @@ main(int argc, char **argv) fprintf(stderr, "\t-v 2|3\t\t\tLDAP version\n"); fprintf(stderr, "\t-Z\t\t\tTLS encrypt the LDAP connection, requires LDAP version 3\n"); #endif - fprintf(stderr, "\t-d\t\t\tenable debug mode\n"); + fprintf(stderr, "\t-d\t\t\tenable debug mode\n"); fprintf(stderr, "\n"); fprintf(stderr, "\tIf no search filter is specified, then the dn =user,basedn\n\twill be used (same as specifying a search filter of '=',\n\tbut quicker as as there is no need to search for the user DN)\n\n"); fprintf(stderr, "\tIf you need to bind as a user to perform searches then use the\n\t-D binddn -w bindpasswd or -D binddn -W secretfile options\n\n"); diff --git a/helpers/external_acl/ldap_group/squid_ldap_group.c b/helpers/external_acl/ldap_group/squid_ldap_group.c index b67dbc8871..215e401d99 100644 --- a/helpers/external_acl/ldap_group/squid_ldap_group.c +++ b/helpers/external_acl/ldap_group/squid_ldap_group.c @@ -431,7 +431,7 @@ main(int argc, char **argv) fprintf(stderr, "\t-g\t\t\tfirst query parameter is base DN extension\n\t\t\t\tfor this query\n"); fprintf(stderr, "\t-S\t\t\tStrip NT domain from usernames\n"); fprintf(stderr, "\t-K\t\t\tStrip Kerberos realm from usernames\n"); - fprintf(stderr, "\t-d\t\t\tenable debug mode\n"); + fprintf(stderr, "\t-d\t\t\tenable debug mode\n"); fprintf(stderr, "\n"); fprintf(stderr, "\tIf you need to bind as a user to perform searches then use the\n\t-D binddn -w bindpasswd or -D binddn -W secretfile options\n\n"); exit(1); diff --git a/helpers/external_acl/session/squid_session.c b/helpers/external_acl/session/squid_session.c index 891ce341db..8b5b80618b 100644 --- a/helpers/external_acl/session/squid_session.c +++ b/helpers/external_acl/session/squid_session.c @@ -36,7 +36,7 @@ #include #endif -/* At this point all Bit Types are already defined, so we must +/* At this point all Bit Types are already defined, so we must protect from multiple type definition on platform where __BIT_TYPES_DEFINED__ is not defined. */ diff --git a/helpers/ntlm_auth/smb_lm/libntlmssp.c b/helpers/ntlm_auth/smb_lm/libntlmssp.c index 6cdc16ed41..d6e58b5449 100644 --- a/helpers/ntlm_auth/smb_lm/libntlmssp.c +++ b/helpers/ntlm_auth/smb_lm/libntlmssp.c @@ -43,19 +43,19 @@ SMB_Handle_Type SMB_Connect_Server(SMB_Handle_Type Con_Handle, char *server, cha /* this one is reallllly haackiish. We really should be using anything from smblib-priv.h */ static char const *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", - "MICROSOFT NETWORKS 1.03", - "MICROSOFT NETWORKS 3.0", - "DOS LANMAN1.0", - "LANMAN1.0", - "DOS LM1.2X002", - "LM1.2X002", - "DOS LANMAN2.1", - "LANMAN2.1", - "Samba", - "NT LM 0.12", - "NT LANMAN 1.0", - NULL - }; + "MICROSOFT NETWORKS 1.03", + "MICROSOFT NETWORKS 3.0", + "DOS LANMAN1.0", + "LANMAN1.0", + "DOS LM1.2X002", + "LM1.2X002", + "DOS LANMAN2.1", + "LANMAN2.1", + "Samba", + "NT LM 0.12", + "NT LANMAN 1.0", + NULL + }; #if 0 int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle); diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h b/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h index 0530de7362..b801e1d780 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h @@ -638,7 +638,7 @@ extern int SMBlib_SMB_Error; /* last Error */ #endif extern SMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type con, SMB_Tree_Handle tree, - char *path, char *password, char const *dev); + char *path, char *password, char const *dev); extern int SMB_Init(void); extern void SMB_Get_My_Name(char *name, int len); @@ -646,7 +646,7 @@ extern int SMB_Negotiate(SMB_Handle_Type Con_Handle, char const *Prots[]); extern int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle); extern int SMB_Logon_Server(SMB_Handle_Type Con_Handle, char *UserName, - char *PassWord, char *UserDomain, int precrypted); + char *PassWord, char *UserDomain, int precrypted); extern int SMB_Get_Error_Msg(int msg, char *msgbuf, int len); diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c b/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c index 07b7b6712b..b25814b1e0 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c @@ -60,19 +60,19 @@ static int SMB_Types[] = {SMB_P_Core, }; static char const *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", - "MICROSOFT NETWORKS 1.03", - "MICROSOFT NETWORKS 3.0", - "DOS LANMAN1.0", - "LANMAN1.0", - "DOS LM1.2X002", - "LM1.2X002", - "DOS LANMAN2.1", - "LANMAN2.1", - "Samba", - "NT LM 0.12", - "NT LANMAN 1.0", - NULL - }; + "MICROSOFT NETWORKS 1.03", + "MICROSOFT NETWORKS 3.0", + "DOS LANMAN1.0", + "LANMAN1.0", + "DOS LM1.2X002", + "LM1.2X002", + "DOS LANMAN2.1", + "LANMAN2.1", + "Samba", + "NT LM 0.12", + "NT LANMAN 1.0", + NULL + }; /* Print out an SMB pkt in all its gory detail ... */ #if 0 // DEAD CODE diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib.c b/helpers/ntlm_auth/smb_lm/smbval/smblib.c index 36edea8603..1e06998c9f 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib.c +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib.c @@ -88,7 +88,7 @@ SMB_Term() } /** - * SMB_Create: Create a connection structure and return for later use + * SMB_Create: Create a connection structure and return for later use * We have other helper routines to set variables */ SMB_Handle_Type @@ -209,8 +209,8 @@ SMB_Connect_Server(SMB_Handle_Type Con_Handle, /* use the handle passed */ char const *SMB_Prots_Restrict[] = {"PC NETWORK PROGRAM 1.0", - NULL - }; + NULL + }; SMB_Handle_Type diff --git a/lib/hash.c b/lib/hash.c index c998a10425..0db0e8476c 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -312,7 +312,7 @@ hashFreeItems(hash_table * hid, HASHFREE * free_func) void hashFreeMemory(hash_table * hid) { - if(hid == NULL) + if (hid == NULL) return; if (hid->buckets) xfree(hid->buckets); diff --git a/lib/rfc2617.c b/lib/rfc2617.c index 324d48078e..5895421e0a 100644 --- a/lib/rfc2617.c +++ b/lib/rfc2617.c @@ -94,11 +94,11 @@ CvtBin(const HASHHEX Hex, HASH Bin) else Bin[i / 2] |= n; } -/* FIXME: Coverity detects the below as dead code. - Why? :: right here i == 32 - which means the first step of the for loop makes i==16 - and cannot be < HASHLEN (which is also 16) -*/ + /* FIXME: Coverity detects the below as dead code. + Why? :: right here i == 32 + which means the first step of the for loop makes i==16 + and cannot be < HASHLEN (which is also 16) + */ for (i = i / 2; i < HASHLEN; i++) { Bin[i] = '\0'; } diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index ef571b758c..dd35279419 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -69,7 +69,8 @@ public: icp_opcode opcode; } icp; - class HtcpDetails { + class HtcpDetails + { public: HtcpDetails() : opcode(NULL) {}; diff --git a/src/ClientInfo.h b/src/ClientInfo.h index c0d728eb7f..52c63d0f12 100644 --- a/src/ClientInfo.h +++ b/src/ClientInfo.h @@ -6,7 +6,8 @@ #include "enums.h" #include "typedefs.h" -class ClientInfo { +class ClientInfo +{ public: hash_link hash; /* must be first */ diff --git a/src/WinSvc.cc b/src/WinSvc.cc old mode 100755 new mode 100644 index 2967de2e79..5bfebdcf2b --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -344,20 +344,20 @@ GetOSVersion() WIN32_OS_string = xstrdup("Windows Server 2008"); return _WIN_OS_WINLON; } - if ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion == 1)) { - if (osvi.wProductType == VER_NT_WORKSTATION) - WIN32_OS_string = xstrdup("Windows 7"); - else - WIN32_OS_string = xstrdup("Windows Server 2008 R2"); - return _WIN_OS_WIN7; - } - if (((osvi.dwMajorVersion > 6)) || ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion > 1))) { - if (osvi.wProductType == VER_NT_WORKSTATION) - WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows 7 capabilities"); - else - WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows Server 2008 R2 capabilities"); - return _WIN_OS_WIN7; - } + if ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion == 1)) { + if (osvi.wProductType == VER_NT_WORKSTATION) + WIN32_OS_string = xstrdup("Windows 7"); + else + WIN32_OS_string = xstrdup("Windows Server 2008 R2"); + return _WIN_OS_WIN7; + } + if (((osvi.dwMajorVersion > 6)) || ((osvi.dwMajorVersion == 6) && (osvi.dwMinorVersion > 1))) { + if (osvi.wProductType == VER_NT_WORKSTATION) + WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows 7 capabilities"); + else + WIN32_OS_string = xstrdup("Unknown Windows version, assuming Windows Server 2008 R2 capabilities"); + return _WIN_OS_WIN7; + } break; case VER_PLATFORM_WIN32_WINDOWS: if ((osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion == 0)) { @@ -537,7 +537,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) safe_free(ConfigFile); /* get config file from Windows Registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; diff --git a/src/acl/Tag.cc b/src/acl/Tag.cc index bc81eb70a4..5641e6e301 100644 --- a/src/acl/Tag.cc +++ b/src/acl/Tag.cc @@ -19,12 +19,12 @@ * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. @@ -44,7 +44,7 @@ int ACLTagStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) { if (checklist->conn() != NULL) - return data->match (checklist->request->tag.termedBuf()); + return data->match (checklist->request->tag.termedBuf()); return 0; } diff --git a/src/acl/Tag.h b/src/acl/Tag.h index 5ff986a4fc..72330f8a03 100644 --- a/src/acl/Tag.h +++ b/src/acl/Tag.h @@ -18,12 +18,12 @@ * 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. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. @@ -52,7 +52,7 @@ public: private: static ACLTagStrategy Instance_; - ACLTagStrategy(){} + ACLTagStrategy() {} ACLTagStrategy&operator=(ACLTagStrategy const &); }; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index a823c3bf5f..f30575d5c5 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -585,10 +585,10 @@ configDoConfigure(void) } for (R = Config.Refresh; R; R = R->next) { - if (!R->flags.ignore_must_revalidate) - continue; - debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP"); - break; + if (!R->flags.ignore_must_revalidate) + continue; + debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP"); + break; } for (R = Config.Refresh; R; R = R->next) { @@ -1524,7 +1524,7 @@ parse_cachedir(SquidConfig::_cacheSwap * swap) } /* new cache_dir */ - if(swap->n_configured > 63) { + if (swap->n_configured > 63) { /* 7 bits, signed */ debugs(3, DBG_CRITICAL, "WARNING: There is a fixed maximum of 63 cache_dir entries Squid can handle."); debugs(3, DBG_CRITICAL, "WARNING: '" << path_str << "' is one to many."); diff --git a/src/client_side.cc b/src/client_side.cc index bfad70968d..6e507fcd6a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3224,9 +3224,9 @@ clientHttpsConnectionsOpen(void) enter_suid(); fd = comm_open_listener(SOCK_STREAM, - IPPROTO_TCP, - s->http.s, - COMM_NONBLOCKING, "HTTPS Socket"); + IPPROTO_TCP, + s->http.s, + COMM_NONBLOCKING, "HTTPS Socket"); leave_suid(); if (fd < 0) diff --git a/src/comm.cc b/src/comm.cc index 949a6d46ae..d3a4294850 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -613,10 +613,10 @@ comm_open(int sock_type, int comm_open_listener(int sock_type, - int proto, - IpAddress &addr, - int flags, - const char *note) + int proto, + IpAddress &addr, + int flags, + const char *note) { int sock = -1; diff --git a/src/debug.cc b/src/debug.cc index b06daca1c1..db9f2478f8 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -74,7 +74,8 @@ typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECT void _db_print(const char *format,...) { - char f[BUFSIZ]; f[0]='\0'; + char f[BUFSIZ]; + f[0]='\0'; va_list args1; va_list args2; va_list args3; diff --git a/src/dns_internal.cc b/src/dns_internal.cc old mode 100755 new mode 100644 index 94ac9cbbd1..58654d5f7b --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -380,7 +380,7 @@ idnsParseWIN32SearchList(const char * Separator) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -389,11 +389,11 @@ idnsParseWIN32SearchList(const char * Separator) idnsAddPathComponent(t); xfree(t); } - Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); token = strtok(t, Separator); while (token) { @@ -425,11 +425,11 @@ idnsParseWIN32Registry(void) case _WIN_OS_WINNT: /* get nameservers from the Windows NT registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -478,62 +478,62 @@ idnsParseWIN32Registry(void) /* get nameservers from the Windows 2000 registry */ /* search all interfaces for DNS server addresses */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA_INTERFACES, 0, KEY_READ, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA_INTERFACES, 0, KEY_READ, &hndKey) == ERROR_SUCCESS) { int i; - DWORD MaxSubkeyLen, InterfacesCount; - char *keyname; - FILETIME ftLastWriteTime; - - if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - keyname = (char *) xmalloc(++MaxSubkeyLen); - for (i = 0; i < (int) InterfacesCount; i++) { - DWORD j; - j = MaxSubkeyLen; - if (RegEnumKeyEx(hndKey, i, keyname, &j, NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) { - char *newkeyname; - newkeyname = (char *) xmalloc(sizeof(REG_TCPIP_PARA_INTERFACES) + j + 2); - strcpy(newkeyname, REG_TCPIP_PARA_INTERFACES); - strcat(newkeyname, "\\"); - strcat(newkeyname, keyname); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, newkeyname, 0, KEY_QUERY_VALUE, &hndKey2) == ERROR_SUCCESS) { - DWORD Type = 0; - DWORD Size = 0; - LONG Result; - Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size); - if (Result == ERROR_SUCCESS && Size) { - t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size); - token = strtok(t, ", "); - while (token) { + DWORD MaxSubkeyLen, InterfacesCount; + char *keyname; + FILETIME ftLastWriteTime; + + if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { + keyname = (char *) xmalloc(++MaxSubkeyLen); + for (i = 0; i < (int) InterfacesCount; i++) { + DWORD j; + j = MaxSubkeyLen; + if (RegEnumKeyEx(hndKey, i, keyname, &j, NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) { + char *newkeyname; + newkeyname = (char *) xmalloc(sizeof(REG_TCPIP_PARA_INTERFACES) + j + 2); + strcpy(newkeyname, REG_TCPIP_PARA_INTERFACES); + strcat(newkeyname, "\\"); + strcat(newkeyname, keyname); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, newkeyname, 0, KEY_QUERY_VALUE, &hndKey2) == ERROR_SUCCESS) { + DWORD Type = 0; + DWORD Size = 0; + LONG Result; + Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size); + if (Result == ERROR_SUCCESS && Size) { + t = (char *) xmalloc(Size); + RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size); + token = strtok(t, ", "); + while (token) { debugs(78, 1, "Adding DHCP nameserver " << token << " from Registry"); - idnsAddNameserver(token); - token = strtok(NULL, ", "); - } - xfree(t); - } - - Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size); - if (Result == ERROR_SUCCESS && Size) { - t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size); - token = strtok(t, ", "); - while (token) { - debugs(78, 1, "Adding nameserver " << token << " from Registry"); - idnsAddNameserver(token); - token = strtok(NULL, ", "); - } - - xfree(t); + idnsAddNameserver(token); + token = strtok(NULL, ", "); + } + xfree(t); + } + + Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size); + if (Result == ERROR_SUCCESS && Size) { + t = (char *) xmalloc(Size); + RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size); + token = strtok(t, ", "); + while (token) { + debugs(78, 1, "Adding nameserver " << token << " from Registry"); + idnsAddNameserver(token); + token = strtok(NULL, ", "); + } + + xfree(t); } RegCloseKey(hndKey2); } - xfree(newkeyname); + xfree(newkeyname); } } - xfree(keyname); + xfree(keyname); } RegCloseKey(hndKey); @@ -550,11 +550,11 @@ idnsParseWIN32Registry(void) case _WIN_OS_WINME: /* get nameservers from the Windows 9X registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_VXD_MSTCP, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_VXD_MSTCP, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -1338,10 +1338,10 @@ idnsInit(void) debugs(78, 2, "idnsInit: attempt open DNS socket to: " << addr); DnsSocket = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "DNS Socket"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "DNS Socket"); if (DnsSocket < 0) fatal("Could not create a DNS socket"); diff --git a/src/dnsserver.cc b/src/dnsserver.cc index eff9b728db..648b07b5c1 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -433,7 +433,7 @@ squid_res_setservers(int reset) ipa.GetInAddr(_SQUID_RES_NSADDR_LIST[_SQUID_RES_NSADDR_COUNT++].sin_addr); } else if ( ipa.IsIPv6() ) { #if USE_IPV6 && defined(_SQUID_RES_NSADDR6_LIST) - /* because things NEVER seem to resolve in tests without _res.nscount being a total. */ + /* because things NEVER seem to resolve in tests without _res.nscount being a total. */ if (_SQUID_RES_NSADDR_COUNT == MAXNS) { fprintf(stderr, "Too many -s options, only %d are allowed\n", MAXNS); return; diff --git a/src/enums.h b/src/enums.h old mode 100755 new mode 100644 diff --git a/src/ftp.cc b/src/ftp.cc index d5504917b5..dc232e50ed 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -534,7 +534,7 @@ FtpStateData::loginParser(const char *login, int escaped) *s = '\0'; /* if there was a username part */ - if(s > login) { + if (s > login) { xstrncpy(user, login, MAX_URL); if (escaped) rfc1738_unescape(user); @@ -548,8 +548,7 @@ FtpStateData::loginParser(const char *login, int escaped) password_url = 1; } } - } - else if (login[0]) { + } else if (login[0]) { /* no password, just username */ xstrncpy(user, login, MAX_URL); if (escaped) @@ -3216,7 +3215,7 @@ ftpReadRest(FtpStateData * ftpState) assert(ftpState->restart_offset > 0); if (code == 350) { - ftpState->setCurrentOffset(ftpState->restart_offset); + ftpState->setCurrentOffset(ftpState->restart_offset); ftpSendRetr(ftpState); } else if (code > 0) { debugs(9, 3, HERE << "REST not supported"); diff --git a/src/helper.cc b/src/helper.cc index a85e065a51..9be0b5d8d6 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -107,7 +107,7 @@ helperOpenServers(helper * hlp) debugs(84, 1, "helperOpenServers: Starting " << need_new << "/" << hlp->n_to_start << " '" << shortname << "' processes"); - if(need_new < 1) { + if (need_new < 1) { debugs(84, 1, "helperOpenServers: No '" << shortname << "' processes needed."); } @@ -213,7 +213,7 @@ helperStatefulOpenServers(statefulhelper * hlp) debugs(84, 1, "helperOpenServers: Starting " << need_new << "/" << hlp->n_to_start << " '" << shortname << "' processes"); - if(need_new < 1) { + if (need_new < 1) { debugs(84, 1, "helperStatefulOpenServers: No '" << shortname << "' processes needed."); } diff --git a/src/htcp.cc b/src/htcp.cc index 737d4afdbc..96a42281b3 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -884,7 +884,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, IpAddr stuff.S.uri = spec->uri; stuff.S.version = spec->version; stuff.S.req_hdrs = spec->req_hdrs; - if(e) + if (e) hdr.putInt(HDR_AGE, (e->timestamp <= squid_curtime ? (squid_curtime - e->timestamp) : 0) ); else hdr.putInt(HDR_AGE, 0); @@ -1488,10 +1488,10 @@ htcpInit(void) enter_suid(); htcpInSocket = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - incomingAddr, - COMM_NONBLOCKING, - "HTCP Socket"); + IPPROTO_UDP, + incomingAddr, + COMM_NONBLOCKING, + "HTCP Socket"); leave_suid(); if (htcpInSocket < 0) @@ -1507,10 +1507,10 @@ htcpInit(void) enter_suid(); htcpOutSocket = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - outgoingAddr, - COMM_NONBLOCKING, - "Outgoing HTCP Socket"); + IPPROTO_UDP, + outgoingAddr, + COMM_NONBLOCKING, + "Outgoing HTCP Socket"); leave_suid(); if (htcpOutSocket < 0) @@ -1708,9 +1708,9 @@ htcpLogHtcp(IpAddress &caddr, int opcode, log_type logcode, const char *url) { AccessLogEntry al; if (LOG_TAG_NONE == logcode) - return; + return; if (!Config.onoff.log_udp) - return; + return; al.htcp.opcode = htcpOpcodeStr[opcode]; al.url = url; al.cache.caddr = caddr; diff --git a/src/http.cc b/src/http.cc index 6bff3c1c89..b4e0151294 100644 --- a/src/http.cc +++ b/src/http.cc @@ -994,14 +994,14 @@ HttpStateData::ReadReplyWrapper(int fd, char *buf, size_t len, comm_err_t flag, assert (fd == httpState->fd); // assert(buf == readBuf->content()); PROF_start(HttpStateData_readReply); - httpState->readReply (len, flag, xerrno); + httpState->readReply(len, flag, xerrno); PROF_stop(HttpStateData_readReply); } */ /* XXX this function is too long! */ void -HttpStateData::readReply (const CommIoCbParams &io) +HttpStateData::readReply(const CommIoCbParams &io) { int bin; int clen; diff --git a/src/icp_v2.cc b/src/icp_v2.cc index e41c78594c..32b2e72f33 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -665,10 +665,10 @@ icpConnectionsOpen(void) addr = Config.Addrs.udp_incoming; addr.SetPort(port); theInIcpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "ICP Socket"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "ICP Socket"); leave_suid(); if (theInIcpConnection < 0) @@ -691,10 +691,10 @@ icpConnectionsOpen(void) enter_suid(); addr.SetPort(port); theOutIcpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "ICP Port"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "ICP Port"); leave_suid(); if (theOutIcpConnection < 0) diff --git a/src/ident/Config.h b/src/ident/Config.h index 2b440223cc..5de6c93643 100644 --- a/src/ident/Config.h +++ b/src/ident/Config.h @@ -7,9 +7,11 @@ #include "acl/Acl.h" -namespace Ident { +namespace Ident +{ -class IdentConfig { +class IdentConfig +{ public: acl_access *identLookup; time_t timeout; diff --git a/src/ident/Ident.cc b/src/ident/Ident.cc index a6c84974ff..90014cc1f6 100644 --- a/src/ident/Ident.cc +++ b/src/ident/Ident.cc @@ -41,7 +41,8 @@ #include "ident/Ident.h" #include "MemBuf.h" -namespace Ident { +namespace Ident +{ #define IDENT_PORT 113 #define IDENT_KEY_SZ 50 @@ -238,10 +239,10 @@ Ident::Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data) addr.SetPort(0); // NP: use random port for secure outbound to IDENT_PORT fd = comm_open_listener(SOCK_STREAM, - IPPROTO_TCP, - addr, - COMM_NONBLOCKING, - "ident"); + IPPROTO_TCP, + addr, + COMM_NONBLOCKING, + "ident"); if (fd == COMM_ERROR) { /* Failed to get a local socket */ @@ -266,7 +267,7 @@ Ident::Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data) void Ident::Init(void) { - if(ident_hash) { + if (ident_hash) { debugs(30, DBG_CRITICAL, "WARNING: Ident already initialized."); return; } diff --git a/src/ident/Ident.h b/src/ident/Ident.h index f632b1022a..fe035f26c9 100644 --- a/src/ident/Ident.h +++ b/src/ident/Ident.h @@ -17,7 +17,8 @@ class IpAddress; -namespace Ident { +namespace Ident +{ /** \ingroup IdentAPI diff --git a/src/ip/IpAddress.cc b/src/ip/IpAddress.cc index 798bf030fb..997e49b4e6 100644 --- a/src/ip/IpAddress.cc +++ b/src/ip/IpAddress.cc @@ -647,7 +647,7 @@ IpAddress::IpAddress(IpAddress *s) { SetEmpty(); if (s) - memcpy(this, s, sizeof(IpAddress)); + memcpy(this, s, sizeof(IpAddress)); } IpAddress::IpAddress(const struct hostent &s) diff --git a/src/ipc.cc b/src/ipc.cc index ca658978a0..e886e95710 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -383,7 +383,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name #if HAVE_SETSID if (opt_no_daemon) - setsid(); + setsid(); #endif execvp(prog, (char *const *) args); diff --git a/src/refresh.cc b/src/refresh.cc index 90de81ef26..ea3199bf90 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -273,9 +273,9 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1 #if HTTP_VIOLATIONS - && !R->flags.ignore_must_revalidate + && !R->flags.ignore_must_revalidate #endif - ) { + ) { debugs(22, 3, "refreshCheck: YES: Must revalidate stale response"); return STALE_MUST_REVALIDATE; } diff --git a/src/snmp_core.cc b/src/snmp_core.cc index ebff872735..8fc7635cc0 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -366,10 +366,10 @@ snmpConnectionOpen(void) Config.Addrs.snmp_incoming.SetPort(Config.Port.snmp); enter_suid(); theInSnmpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Addrs.snmp_incoming, - COMM_NONBLOCKING, - "SNMP Port"); + IPPROTO_UDP, + Config.Addrs.snmp_incoming, + COMM_NONBLOCKING, + "SNMP Port"); leave_suid(); if (theInSnmpConnection < 0) @@ -383,10 +383,10 @@ snmpConnectionOpen(void) Config.Addrs.snmp_outgoing.SetPort(Config.Port.snmp); enter_suid(); theOutSnmpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Addrs.snmp_outgoing, - COMM_NONBLOCKING, - "SNMP Port"); + IPPROTO_UDP, + Config.Addrs.snmp_outgoing, + COMM_NONBLOCKING, + "SNMP Port"); leave_suid(); if (theOutSnmpConnection < 0) diff --git a/src/tunnel.cc b/src/tunnel.cc index a235b9248f..cc6b813edd 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -342,7 +342,7 @@ TunnelStateData::writeServerDone(char *buf, size_t len, comm_err_t flag, int xer { debugs(26, 3, "tunnelWriteServer: FD " << server.fd() << ", " << len << " bytes written"); - if(flag == COMM_ERR_CLOSING) + if (flag == COMM_ERR_CLOSING) return; /* Error? */ @@ -403,7 +403,7 @@ TunnelStateData::writeClientDone(char *buf, size_t len, comm_err_t flag, int xer { debugs(26, 3, "tunnelWriteClient: FD " << client.fd() << ", " << len << " bytes written"); - if(flag == COMM_ERR_CLOSING) + if (flag == COMM_ERR_CLOSING) return; /* Error? */ diff --git a/src/url.cc b/src/url.cc index 2cad9e6fbb..8e105266bc 100644 --- a/src/url.cc +++ b/src/url.cc @@ -548,7 +548,7 @@ urlCanonicalFakeHttps(const HttpRequest * request) LOCAL_ARRAY(char, buf, MAX_URL); // method CONNECT and port HTTPS - if(request->method == METHOD_CONNECT && request->port == 443) { + if (request->method == METHOD_CONNECT && request->port == 443) { snprintf(buf, MAX_URL, "https://%s/*", request->GetHost()); return buf; } diff --git a/src/wccp.cc b/src/wccp.cc index 6b99312640..d164b9e8c9 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -148,10 +148,10 @@ wccpConnectionOpen(void) Config.Wccp.address.SetPort(WCCP_PORT); theWccpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Wccp.address, - COMM_NONBLOCKING, - "WCCP Socket"); + IPPROTO_UDP, + Config.Wccp.address, + COMM_NONBLOCKING, + "WCCP Socket"); if (theWccpConnection < 0) fatal("Cannot open WCCP Port"); diff --git a/src/wccp2.cc b/src/wccp2.cc index 963cb67b99..a3cd000058 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -204,7 +204,7 @@ struct wccp2_cache_identity_info_t { // uint16_t bits; //#define WCCP2_HASH_ASSIGNMENT_DATA 0x0 -/* 5.7.2 Hash Assignment Data Element */ + /* 5.7.2 Hash Assignment Data Element */ char buckets[32]; /* Draft indicates 8x 32-bit buckets but it's just a mask so doesn't matter how we define. */ uint16_t weight; uint16_t status; @@ -243,18 +243,18 @@ struct wccp2_cache_mask_identity_info_t { uint16_t bits; #define WCCP2_MASK_ASSIGNMENT_DATA (0x1 <<14) -/* Sect 5.7.2 Mask Assignment Data Element - * - * NP: draft specifies a variable-length set of keys here. - * the following fields only matche the special case Squid sends outbound (single-cache). - */ - uint32_t mask_element_count; + /* Sect 5.7.2 Mask Assignment Data Element + * + * NP: draft specifies a variable-length set of keys here. + * the following fields only matche the special case Squid sends outbound (single-cache). + */ + uint32_t mask_element_count; -/* Sect 5.7.6 Mask/Value Set Element */ -/* special case: single mask element. no values. */ + /* Sect 5.7.6 Mask/Value Set Element */ + /* special case: single mask element. no values. */ struct wccp2_mask_element_t mask; -/* Sect 5.7.2 Mask Assignment Data Element */ + /* Sect 5.7.2 Mask Assignment Data Element */ uint16_t weight; uint16_t status; }; @@ -333,13 +333,13 @@ static struct wccp2_capability_element_t wccp2_capability_element; /* capability values */ #define WCCP2_METHOD_GRE 0x00000001 #define WCCP2_METHOD_L2 0x00000002 - /* when type=WCCP2_CAPABILITY_FORWARDING_METHOD */ +/* when type=WCCP2_CAPABILITY_FORWARDING_METHOD */ #define WCCP2_FORWARDING_METHOD_GRE WCCP2_METHOD_GRE #define WCCP2_FORWARDING_METHOD_L2 WCCP2_METHOD_L2 - /* when type=WCCP2_CAPABILITY_ASSIGNMENT_METHOD */ +/* when type=WCCP2_CAPABILITY_ASSIGNMENT_METHOD */ #define WCCP2_ASSIGNMENT_METHOD_HASH 0x00000001 #define WCCP2_ASSIGNMENT_METHOD_MASK 0x00000002 - /* when type=WCCP2_CAPABILITY_RETURN_METHOD */ +/* when type=WCCP2_CAPABILITY_RETURN_METHOD */ #define WCCP2_PACKET_RETURN_METHOD_GRE WCCP2_METHOD_GRE #define WCCP2_PACKET_RETURN_METHOD_L2 WCCP2_METHOD_L2 @@ -996,10 +996,10 @@ wccp2ConnectionOpen(void) Config.Wccp2.address.SetPort(WCCP_PORT); theWccp2Connection = comm_open_listener(SOCK_DGRAM, - 0, - Config.Wccp2.address, - COMM_NONBLOCKING, - "WCCPv2 Socket"); + 0, + Config.Wccp2.address, + COMM_NONBLOCKING, + "WCCPv2 Socket"); if (theWccp2Connection < 0) fatal("Cannot open WCCP Port"); diff --git a/src/win32.cc b/src/win32.cc old mode 100755 new mode 100644 -- 2.47.3