]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Various cleanups to make GCC happy
authorhno <>
Thu, 19 Jul 2007 09:36:04 +0000 (09:36 +0000)
committerhno <>
Thu, 19 Jul 2007 09:36:04 +0000 (09:36 +0000)
14 files changed:
helpers/basic_auth/LDAP/squid_ldap_auth.c
helpers/basic_auth/PAM/pam_auth.c
helpers/basic_auth/SASL/sasl_auth.c
helpers/digest_auth/eDirectory/digest_pw_auth.c
helpers/digest_auth/eDirectory/edir_ldapext.c
helpers/digest_auth/eDirectory/ldap_backend.c
helpers/digest_auth/ldap/digest_pw_auth.c
helpers/digest_auth/ldap/ldap_backend.c
helpers/digest_auth/password/digest_pw_auth.c
helpers/external_acl/ip_user/main.c
helpers/external_acl/ip_user/match.c
helpers/external_acl/ldap_group/squid_ldap_group.c
helpers/ntlm_auth/fakeauth/fakeauth_auth.c
test-suite/hash.h

index 910b387ce85d891791681f25a08ae7ccfb2d2d97..cf2727bde00b48bfd6d544dba11a79bf6bec4a45 100644 (file)
@@ -656,7 +656,7 @@ checkLDAP(LDAP * persistent_ld, const char *userid, const char *password, const
        LDAPMessage *res = NULL;
        LDAPMessage *entry;
        char *searchattr[] =
-       {LDAP_NO_ATTRS, NULL};
+       {(char *)LDAP_NO_ATTRS, NULL};
        char *userdn;
        int rc;
        LDAP *search_ld = persistent_ld;
index a794060a40c7605916dd10dbc7d1a853e069ca3f..c098b0f8247e141b18d71688eaf7fed067edbb1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: pam_auth.c,v 1.16 2005/07/02 18:34:03 serassio Exp $
+ * $Id: pam_auth.c,v 1.17 2007/07/19 03:36:05 hno Exp $
  *
  * PAM authenticator module for Squid.
  * Copyright (C) 1999,2002,2003 Henrik Nordstrom <hno@squid-cache.org>
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
     char buf[BUFSIZE];
     time_t pamh_created = 0;
     int ttl = DEFAULT_SQUID_PAM_TTL;
-    char *service = DEFAULT_SQUID_PAM_SERVICE;
+    const char *service = DEFAULT_SQUID_PAM_SERVICE;
     int no_acct_mgmt = 0;
 
     /* make standard output line buffered */
index 817efdec4e461a3ebf4d88ed52d539dcedbe3b8c..294da7454bbe87fad5928780b5812098f7d13b2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: sasl_auth.c,v 1.8 2004/12/20 16:30:16 robertc Exp $
+ * $Id: sasl_auth.c,v 1.9 2007/07/19 03:36:05 hno Exp $
  *
  * SASL authenticator module for Squid.
  * Copyright (C) 2002 Ian Castle <ian.castle@coldcomfortfarm.net>
@@ -42,7 +42,7 @@
 #define APP_NAME_SASL  "squid_sasl_auth"
 
 int
-main()
+main(int argc, char *argv[])
 {
        char line[8192];
        char *username, *password;
index d971df48e8e4bc9bcd2aeeac393c17534d1806b5..b81a84d8d1549c921738e857e394a22d42975ce8 100644 (file)
@@ -35,7 +35,7 @@
 #define PROGRAM_NAME "digest_ldap_auth"
 
 
-void
+static void
 GetHHA1(RequestData * requestData)
 {
     LDAPHHA1(requestData);
@@ -81,7 +81,7 @@ DoOneRequest(char *buf)
     OutputHHA1(&requestData);
 }
 
-void
+static void
 ProcessArguments(int argc, char **argv)
 {
     int i;
index 1e4a128396e192f4654b3d8c6fd89b7e7914887c..256a5e08bde6d75de498673ac2f88d882527a93f 100644 (file)
@@ -23,6 +23,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
+
+#include "edir_ldapext.h"
+
 /* NMAS error codes */
 #define NMAS_E_BASE                       (-1600)
 
index e8c1b3a81d1adb2bf913ed3409658d4a874a2ce7..f3000a91cfe20618d0ee8fd50b94a146441c1840 100644 (file)
@@ -53,14 +53,14 @@ PFldap_start_tls_s Win32_ldap_start_tls_s;
 /* Globals */
 
 static LDAP *ld = NULL;
-static char *passattr = NULL;
+static const char *passattr = NULL;
 static char *ldapServer = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
-static char *delimiter = ":";
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
+static const char *delimiter = ":";
 static int encrpass = 0;
 static int searchscope = LDAP_SCOPE_SUBTREE;
 static int persistent = 0;
@@ -84,7 +84,7 @@ static int version = -1;
 #endif
 
 static void ldapconnect(void);
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
 
 /* Yuck.. we need to glue to different versions of the API */
 
@@ -431,7 +431,7 @@ LDAPArguments(int argc, char **argv)
     setbuf(stdout, NULL);
 
     while (argc > 1 && argv[1][0] == '-') {
-       char *value = "";
+       const char *value = "";
        char option = argv[1][1];
        switch (option) {
        case 'P':
@@ -608,7 +608,7 @@ LDAPArguments(int argc, char **argv)
     }
 
     if (!ldapServer)
-       ldapServer = "localhost";
+       ldapServer = (char *)"localhost";
 
     if (!userbasedn || !((passattr != NULL) || (edir_universal_passwd && usersearchfilter && version == LDAP_VERSION3 && use_tls))) {
        fprintf(stderr, "Usage: " PROGRAM_NAME " -b basedn -f filter [options] ldap_server_name\n\n");
@@ -648,7 +648,7 @@ LDAPArguments(int argc, char **argv)
     return 0;
 }
 static int
-readSecret(char *filename)
+readSecret(const char *filename)
 {
     char buf[BUFSIZ];
     char *e = 0;
@@ -669,10 +669,8 @@ readSecret(char *filename)
     if ((e = strrchr(buf, '\r')))
        *e = 0;
 
-    bindpasswd = (char *) calloc(sizeof(char), strlen(buf) + 1);
-    if (bindpasswd) {
-       strcpy(bindpasswd, buf);
-    } else {
+    bindpasswd = strdup(buf);
+    if (!bindpasswd) {
        fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n");
     }
 
@@ -684,7 +682,7 @@ readSecret(char *filename)
 void
 LDAPHHA1(RequestData * requestData)
 {
-    char *password = "";
+    char *password;
     ldapconnect();
     password = getpassword(requestData->user, requestData->realm);
     if (password != NULL) {
index d971df48e8e4bc9bcd2aeeac393c17534d1806b5..b81a84d8d1549c921738e857e394a22d42975ce8 100644 (file)
@@ -35,7 +35,7 @@
 #define PROGRAM_NAME "digest_ldap_auth"
 
 
-void
+static void
 GetHHA1(RequestData * requestData)
 {
     LDAPHHA1(requestData);
@@ -81,7 +81,7 @@ DoOneRequest(char *buf)
     OutputHHA1(&requestData);
 }
 
-void
+static void
 ProcessArguments(int argc, char **argv)
 {
     int i;
index df55d8af12d2c5d42cd8d1823180b5ba1fc1aaa4..7b0b975c8e61b24f016fe55b3de72020a0b687b0 100644 (file)
@@ -52,14 +52,14 @@ PFldap_start_tls_s Win32_ldap_start_tls_s;
 /* Globals */
 
 static LDAP *ld = NULL;
-static char *passattr = NULL;
+static const char *passattr = NULL;
 static char *ldapServer = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
-static char *delimiter = ":";
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
+static const char *delimiter = ":";
 static int encrpass = 0;
 static int searchscope = LDAP_SCOPE_SUBTREE;
 static int persistent = 0;
@@ -82,7 +82,7 @@ static int version = -1;
 #endif
 
 static void ldapconnect(void);
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
 
 /* Yuck.. we need to glue to different versions of the API */
 
@@ -390,7 +390,7 @@ LDAPArguments(int argc, char **argv)
     setbuf(stdout, NULL);
 
     while (argc > 1 && argv[1][0] == '-') {
-       char *value = "";
+       const char *value = "";
        char option = argv[1][1];
        switch (option) {
        case 'P':
@@ -562,7 +562,7 @@ LDAPArguments(int argc, char **argv)
     }
 
     if (!ldapServer)
-       ldapServer = "localhost";
+       ldapServer = (char *)"localhost";
 
     if (!userbasedn || !passattr) {
        fprintf(stderr, "Usage: " PROGRAM_NAME " -b basedn -f filter [options] ldap_server_name\n\n");
@@ -601,7 +601,7 @@ LDAPArguments(int argc, char **argv)
     return 0;
 }
 static int
-readSecret(char *filename)
+readSecret(const char *filename)
 {
     char buf[BUFSIZ];
     char *e = 0;
@@ -622,10 +622,8 @@ readSecret(char *filename)
     if ((e = strrchr(buf, '\r')))
        *e = 0;
 
-    bindpasswd = (char *) calloc(sizeof(char), strlen(buf) + 1);
-    if (bindpasswd) {
-       strcpy(bindpasswd, buf);
-    } else {
+    bindpasswd = strdup(buf);
+    if (!bindpasswd) {
        fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n");
     }
 
@@ -637,7 +635,7 @@ readSecret(char *filename)
 void
 LDAPHHA1(RequestData * requestData)
 {
-    char *password = "";
+    char *password;
     ldapconnect();
     password = getpassword(requestData->user, requestData->realm);
     if (password != NULL) {
index 432d62321d1f907666162dc5774a3d7fc8bd9440..57e10eb4195655cf25234f3e4a8dd970cb27cd32 100644 (file)
 #include "text_backend.h"
 #define PROGRAM_NAME "digest_pw_auth"
 
-
-void
-usage()
-{
-    fprintf(stderr, "\n\t\tYou need at least to specify the backend database\n");
-    fprintf(stderr, "\t\t%s -D LDAP or file\n", PROGRAM_NAME);
-    exit(1);
-}
-
-void
+static void
 GetHHA1(RequestData * requestData)
 {
     TextHHA1(requestData);
@@ -89,7 +80,7 @@ DoOneRequest(char *buf)
     OutputHHA1(&requestData);
 }
 
-void
+static void
 ProcessArguments(int argc, char **argv)
 {
     TextArguments(argc, argv);
index 4c9ba468839453be546a8e8e4db8af77a0b70cfe..197badd54d985825c47be5edc6a3c12a0bfec3d5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.5 2005/07/02 18:34:03 serassio Exp $ 
+/* $Id: main.c,v 1.6 2007/07/19 03:36:12 hno Exp $ 
 * Copyright (C) 2002 Rodrigo Campos
 *
 * This program is free software; you can redistribute it and/or modify
@@ -28,7 +28,7 @@
 
 #include "ip_user.h"
 
-void
+static void
 usage (char *program_name)
 {
   fprintf (stderr, "Usage:\n%s -f <configuration file>\n",
index 89e451364d60450bdc72d5825bbee6ff968c700f..0171d72fc209000bad7f8274ecbb5baf67ef15a3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: match.c,v 1.2 2003/01/23 00:36:01 robertc Exp $ 
+/* $Id: match.c,v 1.3 2007/07/19 03:36:12 hno Exp $ 
 * Copyright (C) 2002 Rodrigo Campos
 *
 * This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <grp.h>
 
+#include "ip_user.h"
 
 int
 match_user (char *dict_username, char *username)
index cb2ac30ccb5e33aa5164823e0c345aa4ae44a945..f9c20ac6232a8ee62fc659c3cd42407990b55b8d 100644 (file)
@@ -85,13 +85,13 @@ PFldap_start_tls_s Win32_ldap_start_tls_s;
 
 /* Globals */
 
-static char *basedn = NULL;
-static char *searchfilter = NULL;
-static char *userbasedn = NULL;
-static char *userdnattr = NULL;
-static char *usersearchfilter = NULL;
-static char *binddn = NULL;
-static char *bindpasswd = NULL;
+static const char *basedn = NULL;
+static const char *searchfilter = NULL;
+static const char *userbasedn = NULL;
+static const char *userdnattr = NULL;
+static const char *usersearchfilter = NULL;
+static const char *binddn = NULL;
+static const char *bindpasswd = NULL;
 static int searchscope = LDAP_SCOPE_SUBTREE;
 static int persistent = 0;
 static int noreferrals = 0;
@@ -112,7 +112,7 @@ static int version = -1;
 
 static int searchLDAP(LDAP * ld, char *group, char *user, char *extension_dn);
 
-static int readSecret(char *filename);
+static int readSecret(const char *filename);
 
 /* Yuck.. we need to glue to different versions of the API */
 
@@ -220,7 +220,7 @@ main(int argc, char **argv)
     setbuf(stdout, NULL);
 
     while (argc > 1 && argv[1][0] == '-') {
-       char *value = "";
+       const char *value = "";
        char option = argv[1][1];
        switch (option) {
        case 'P':
@@ -392,7 +392,7 @@ main(int argc, char **argv)
     }
 
     if (!ldapServer)
-       ldapServer = "localhost";
+       ldapServer = (char *)"localhost";
 
     if (!basedn || !searchfilter) {
        fprintf(stderr, "\n" PROGRAM_NAME " version " PROGRAM_VERSION "\n\n");
@@ -680,7 +680,7 @@ searchLDAPGroup(LDAP * ld, char *group, char *member, char *extension_dn)
     LDAPMessage *res = NULL;
     LDAPMessage *entry;
     int rc;
-    char *searchattr[] = {LDAP_NO_ATTRS, NULL};
+    char *searchattr[] = {(char *)LDAP_NO_ATTRS, NULL};
 
     if (extension_dn && *extension_dn)
        snprintf(searchbase, sizeof(searchbase), "%s,%s", extension_dn, basedn);
@@ -734,7 +734,7 @@ searchLDAP(LDAP *ld, char *group, char *login, char *extension_dn)
        LDAPMessage *entry;
        int rc;
        char *userdn;
-       char *searchattr[] = {LDAP_NO_ATTRS, NULL};
+       char *searchattr[] = {(char *)LDAP_NO_ATTRS, NULL};
        if (extension_dn && *extension_dn)
            snprintf(searchbase, sizeof(searchbase), "%s,%s", extension_dn, userbasedn ? userbasedn : basedn);
        else
@@ -785,7 +785,7 @@ searchLDAP(LDAP *ld, char *group, char *login, char *extension_dn)
 }
 
 
-int readSecret(char *filename)
+int readSecret(const char *filename)
 {
   char  buf[BUFSIZ];
   char  *e=0;
@@ -806,10 +806,8 @@ int readSecret(char *filename)
   if((e = strrchr(buf, '\n'))) *e = 0;
   if((e = strrchr(buf, '\r'))) *e = 0;
 
-  bindpasswd = (char *) calloc(sizeof(char), strlen(buf)+1);
-  if (bindpasswd) {
-    strcpy(bindpasswd, buf);
-  } else {
+  bindpasswd = strdup(buf);
+  if (!bindpasswd) {
     fprintf(stderr, PROGRAM_NAME " ERROR: can not allocate memory\n"); 
   }
 
index 61a989d8a137b44db42d55e5043c99ce05f1ff22..bd8e7e44ace603b862cc7ee616379114df03efdf 100644 (file)
 
 #define BUFFER_SIZE 10240
 
-char *authenticate_ntlm_domain = "WORKGROUP";
+const char *authenticate_ntlm_domain = "WORKGROUP";
 int debug_enabled = 0;
 int NTLM_packet_debug_enabled = 0;
 
 /* NTLM authentication by ad@interlude.eu.org - 07/1999 */
 /* XXX this is not done cleanly... */
 
-void
+static void
 hex_dump(void *data, int size)
 {
     /* dumps size bytes of *data to stdout. Looks like:
@@ -264,10 +264,11 @@ ntlmGetString(ntlmhdr * hdr, strhdr * str, int flags)
 /*
  * Decode the strings in an NTLM authentication request
  */
-int
+static int
 ntlmDecodeAuth(struct ntlm_authenticate *auth, char *buf, size_t size)
 {
-    char *p, *origbuf;
+    const char *p;
+    char *origbuf;
     int s;
 
     if (!buf) {
@@ -320,8 +321,8 @@ ntlmDecodeAuth(struct ntlm_authenticate *auth, char *buf, size_t size)
  */
 char *my_program_name = NULL;
 
-void
-usage()
+static void
+usage(void)
 {
     fprintf(stderr,
        "Usage: %s [-d] [-v] [-h]\n"
@@ -332,7 +333,7 @@ usage()
 }
 
 
-void
+static void
 process_options(int argc, char *argv[])
 {
     int opt, had_error = 0;
index ad6f34a18350b5b8ce92a1cfda0e7ee3b15f212b..f24588067a7ed828c51991e7961f8fef5c520064 100644 (file)
@@ -1,4 +1,5 @@
 #define  DEFAULT_HASH_SIZE 7951
+extern "C" {
 typedef unsigned int HASHHASH(const void *, unsigned int);
 struct _hash_link {
     char *key;
@@ -38,3 +39,5 @@ void hashFreeMemory(hash_table *);
 HASHHASH hash_string;
 HASHHASH hash_url;
 HASHHASH hash4;
+
+}