]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bugzilla #81: basic scheme authentication helpers dont' allow the space character...
authorhno <>
Mon, 12 Aug 2002 07:11:47 +0000 (07:11 +0000)
committerhno <>
Mon, 12 Aug 2002 07:11:47 +0000 (07:11 +0000)
This patch URL escapes Basic auth login and password information when sent to
the helpers, to allow for spaces and other odd characters

21 files changed:
ChangeLog
helpers/basic_auth/LDAP/Makefile.am
helpers/basic_auth/LDAP/squid_ldap_auth.c
helpers/basic_auth/MSNT/Makefile.am
helpers/basic_auth/MSNT/msntauth.c
helpers/basic_auth/NCSA/Makefile.am
helpers/basic_auth/NCSA/ncsa_auth.c
helpers/basic_auth/PAM/Makefile.am
helpers/basic_auth/PAM/pam_auth.c
helpers/basic_auth/SASL/Makefile.am
helpers/basic_auth/SASL/sasl_auth.c
helpers/basic_auth/SMB/Makefile.am
helpers/basic_auth/SMB/smb_auth.c
helpers/basic_auth/YP/Makefile.am
helpers/basic_auth/YP/yp_auth.c
helpers/basic_auth/getpwnam/Makefile.am
helpers/basic_auth/getpwnam/getpwnam_auth.c
helpers/basic_auth/multi-domain-NTLM/smb_auth.pl
helpers/basic_auth/winbind/Makefile.am
helpers/basic_auth/winbind/wb_basic_auth.c
src/auth/basic/auth_basic.cc

index 04bceea75b2a6d2cf0e9e0ef992bf21406e77dd2..db208f754dc9f9bb155b6b395a403dc50c2e9be4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,9 @@ Changes to squid-2.5 ():
          In addition to that they have a new look (background-color, font)
          and are valid according to the HTML standards at www.w3.org.
          (Clemens Löser)
+       - Login and password send to Basic auth helpers is now URL escaped
+         to allow for spaces and other "odd" characters in logins and
+         passwords
 
 Changes to Squid-2.4.STABLE7 (July 2, 2002):
 
index bc5de010d3c1df24aea92d1b3ddafe13db587998..180960d87c907660acc6079d38331a260aeeb06c 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid LDAP authentication helper
 #
-#  $Id: Makefile.am,v 1.3 2002/01/08 16:24:15 hno Exp $
+#  $Id: Makefile.am,v 1.4 2002/08/12 01:11:48 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -11,4 +11,5 @@ man_MANS              = squid_ldap_auth.8
 EXTRA_DIST             = squid_ldap_auth.8
 squid_ldap_auth_SOURCES        = squid_ldap_auth.c
 
-LDADD = -lldap -llber
+LDADD = -L$(top_builddir)/lib -lmiscutil -lldap -llber $(XTRA_LIBS)
+INCLUDES      = -I$(top_srcdir)/include
index 2958c994037daadc6f79eeb6cc28f1558cdc36b0..609fcf57a47de3cebbc466cab21125c99c9428d0 100644 (file)
@@ -58,6 +58,8 @@
 #include <lber.h>
 #include <ldap.h>
 
+#include "util.h"
+
 /* Change this to your search base */
 static char *basedn;
 static char *searchfilter = NULL;
@@ -294,6 +296,8 @@ main(int argc, char **argv)
            printf("ERR\n");
            continue;
        }
+       rfc1738_unescape(user);
+       rfc1738_unescape(passwd);
        tryagain = 1;
       recover:
        if (ld == NULL) {
index 8d2034dd3ae94e7e9e22a4c38e33ecabeb1ea0e9..9ffb626a1df1954ab7edf78b70ad0e35b1666d0b 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.8 2002/06/26 18:44:27 hno Exp $
+#  $Id: Makefile.am,v 1.9 2002/08/12 01:11:48 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -27,10 +27,9 @@ EXTRA_DIST = \
 sysconf_DATA = \
        msntauth.conf.default
 
-LDADD  = @XTRA_LIBS@
+LDADD = -L$(top_builddir)/lib -lmiscutil $(XTRA_LIBS)
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
+INCLUDES      = -I$(top_srcdir)/include
 
 confload.o: confload.c
        $(COMPILE) -DSYSCONFDIR=\"$(sysconfdir)\" -c $(srcdir)/confload.c -o $@
index 8f9a94e3946709ba210da87b45c0942199023a5f..02af0794d26339e81bd2f8c4032f6757c70f80eb 100644 (file)
@@ -117,6 +117,9 @@ main(int argc, char **argv)
        }
        Checktimer();           /* Check if the user lists have changed */
 
+       rfc1738_unescape(username);
+       rfc1738_unescape(password);
+
        /*
         * Check if user is explicitly denied or allowed.
         * If user passes both checks, they can be authenticated.
index 83f1a13f6cf62136ee6308c22c224f451692df80..4a55e42c9bbe892b12d2bb8b39e5ba704462e453 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.1 2001/08/31 11:19:16 robertc Exp $
+#  $Id: Makefile.am,v 1.2 2002/08/12 01:11:49 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -9,5 +9,4 @@
 libexec_PROGRAMS       = ncsa_auth
 ncsa_auth_SOURCES      = ncsa_auth.c
 LDADD                  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-               -I$(top_srcdir)/src/
+INCLUDES      = -I$(top_srcdir)/include
index ceb81572c04a4d2b364c45714405ae210607e2d7..5706837f6802ce1796de689ae33d17d633cc7276 100644 (file)
@@ -130,6 +130,8 @@ main(int argc, char **argv)
            printf("ERR\n");
            continue;
        }
+       rfc1738_unescape(user);
+       rfc1738_unescape(passwd);
        u = hash_lookup(hash, user);
        if (u == NULL) {
            printf("ERR\n");
index 73be7b9f9cad0b1713f2489c72151119f377ccf5..be4d46a5d438308f20c7e8fb4375bfa8567afe90 100644 (file)
@@ -1,15 +1,14 @@
 #
 #  Makefile for the Squid PAM authentication helper
 #
-#  $Id: Makefile.am,v 1.3 2002/01/08 16:24:21 hno Exp $
+#  $Id: Makefile.am,v 1.4 2002/08/12 01:11:50 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
 
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-                 -I$(top_srcdir)/src/
+INCLUDES       = -I$(top_srcdir)/include
 
 man_MANS               = pam_auth.8
 EXTRA_DIST             = pam_auth.8
 libexec_PROGRAMS       = pam_auth
-LDADD                  = -lpam $(XTRA_LIBS)
+LDADD                  = -L$(top_builddir)/lib -lmiscutil -lpam $(XTRA_LIBS)
index 921d08ba48ac69252dee22cc63209017f66a247b..04bd33ebb92a2746dd74d788052bb2c3d97b638e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: pam_auth.c,v 1.7 2002/01/07 03:29:10 hno Exp $
+ * $Id: pam_auth.c,v 1.8 2002/08/12 01:11:50 hno Exp $
  *
  * PAM authenticator module for Squid.
  * Copyright (C) 1999,2002 Henrik Nordstrom <hno@squid-cache.org>
@@ -191,6 +191,8 @@ start:
            goto error;
        }
        *password++ = '\0';
+       rfc1738_unescape(user);
+       rfc1738_unescape(password);
        conv.appdata_ptr = (char *) password;   /* from buf above. not allocated */
 
        if (ttl == 0) {
index 08feb8fa0f9357bca45d7b2d863dd8a01ee4c7ea..9735bdaf3e115ae619e224db337140da47b0bfb6 100644 (file)
@@ -1,14 +1,13 @@
 #
 #  Makefile for the Squid SASL authentication helper
 #
-#  $Id: Makefile.am,v 1.2 2002/04/14 22:24:03 hno Exp $
+#  $Id: Makefile.am,v 1.3 2002/08/12 01:11:51 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
 
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-                 -I$(top_srcdir)/src/
+INCLUDES       = -I$(top_srcdir)/include
 
 libexec_PROGRAMS       = sasl_auth
-LDADD                  = -lsasl $(XTRA_LIBS)
+LDADD                  = -L$(top_builddir)/lib -lmiscutil -lsasl $(XTRA_LIBS)
 EXTRA_DIST             = squid_sasl_auth squid_sasl_auth.conf
index 4bdd43b7bc3bbd36d7c87fad79fca1ec9a2e65ed..0878d3e0c02b4b2ce87973bdef9d093c18b77f1d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: sasl_auth.c,v 1.2 2002/04/01 09:08:38 hno Exp $
+ * $Id: sasl_auth.c,v 1.3 2002/08/12 01:11:51 hno Exp $
  *
  * SASL authenticator module for Squid.
  * Copyright (C) 2002 Ian Castle <ian.castle@coldcomfortfarm.net>
@@ -79,6 +79,9 @@ main()
                }
                *password++ = '\0';
 
+               rfc1738_unescape(username);
+               rfc1738_unescape(password);
+
                rc = sasl_checkpass(conn, username, strlen(username), password, strlen(password), &errstr);
 
                if ( rc != SASL_OK ) {
index 7a2ecd427479397e71e0a3c2f9be8fe2f8181a0a..aedd63d1d18fe796f593fc8646d2353941d379a0 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.3 2002/05/20 02:03:56 hno Exp $
+#  $Id: Makefile.am,v 1.4 2002/08/12 01:11:55 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -22,7 +22,6 @@ libexec_PROGRAMS = smb_auth
 smb_auth_CFLAGS = -DSAMBAPREFIX=\"$(SAMBAPREFIX)\" -DHELPERSCRIPT=\"$(SMB_AUTH_HELPER_PATH)\"
 EXTRA_DIST = smb_auth.sh COPYING-2.0
 
-LDADD  = $(XTRA_LIBS)
+LDADD  = -L$(top_builddir)/lib -lmiscutil $(XTRA_LIBS)
 
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-                 -I$(top_srcdir)/src/
+INCLUDES       = -I$(top_srcdir)/include
index 3f6f245c76675ebdbf79a9e051c24dd619ff21d7..bc9a1cdc4c4ecbe46109f333d2ca669953d774b9 100644 (file)
@@ -45,6 +45,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "util.h"
+
 #define BUFSIZE                        256
 #define NMB_UNICAST            1
 #define NMB_BROADCAST  2
@@ -234,6 +236,8 @@ main(int argc, char *argv[])
            (void) printf("ERR\n");
            continue;
        }
+       rfc1738_unescape(user);
+       rfc1738_unescape(pass);
        (void) fprintf(p, "%s\n", dom->name);
        (void) fprintf(p, "%s\n", dom->passthrough);
        (void) fprintf(p, "%s\n", dom->nmbaddr);
index 88caf93904c93ba9ed32e1ec20a269b8e816a1aa..1f2ba03864dbc053d388bf0640a14fe7d2b31bd3 100644 (file)
@@ -1,12 +1,11 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.3 2001/12/27 00:23:33 hno Exp $
+#  $Id: Makefile.am,v 1.4 2002/08/12 01:11:55 hno Exp $
 #
 #
 
 libexec_PROGRAMS = yp_auth
 yp_auth_SOURCES        = yp_auth.c nis_support.h nis_support.c
 LDADD  = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
-INCLUDES       = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-                 -I$(top_srcdir)/src/
+INCLUDES       = -I$(top_srcdir)/include
index bb2ce8fc4f62e1a39b607d065f874a2df18d4f02..3c0fd2cc2c714af72cd2a41a25c2c8d97a0fcaae 100644 (file)
@@ -63,6 +63,10 @@ main(int argc, char **argv)
            printf("ERR\n");
            continue;
        }
+
+       rfc1738_unescape(user);
+       rfc1738_unescape(passwd);
+
        nispasswd = get_nis_password(user, nisdomain, nismap);
 
        if (!nispasswd) {
index e92de4d3ceb961fd55300861213ac1cddd491c3e..46f3b32d67cb50f589d3e330db625bd75c09cc0b 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.1 2001/08/31 11:19:20 robertc Exp $
+#  $Id: Makefile.am,v 1.2 2002/08/12 01:11:56 hno Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -11,7 +11,5 @@ libexec_PROGRAMS = getpwname_auth
 
 getpwname_auth_SOURCES = getpwnam_auth.c 
 
-INCLUDES      = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-       -I$(top_srcdir)/src/
-
+INCLUDES      = -I$(top_srcdir)/include
 LDADD = -L$(top_builddir)/lib -lmiscutil $(CRYPTLIB) $(XTRA_LIBS)
index e71c3656fb3df5bf6834ae68d423289b1b23ec7f..ebd7cc38dbb64e897e49f5764c012ffcbafac42e 100644 (file)
@@ -40,6 +40,7 @@
 #include <pwd.h>
 #endif
 
+#include "util.h"
 
 #define ERR    "ERR\n"
 #define OK     "OK\n"
@@ -65,6 +66,8 @@ main()
            printf(ERR);
            continue;
        }
+       rfc1738_unescape(user);
+       rfc1738_unescape(passwd);
        pwd = getpwnam(user);
        if (pwd == NULL) {
            printf(ERR);
index e52116f9f54d6896188b72999c7230a8c4fd68b3..c28fe642a28d2aaa10def13850822d0aaaea1d30 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: smb_auth.pl,v 1.2 2001/05/21 04:50:58 hno Exp $
+# $Id: smb_auth.pl,v 1.3 2002/08/12 01:11:57 hno Exp $
 
 #if you define this, debugging output will be printed to STDERR.
 #$debug=1;
@@ -38,13 +38,16 @@ use Authen::Smb;
 
 $|=1;
 while (<>) {
-       if (! m;([^\\]+)(\\|/)(\S+)\s(.*); ) { #parse the line
+       if (! m;([^\\]+)(\\|/|%2f|%5c)(\S+)\s(.*); ) { #parse the line
                print "ERR\n";
                next;
        }
-       $domain=$1;
+        $domain=$1;
        $user=$3;
        $pass=$4;
+       $domain =~ s/%([0-9a-f][0-9a-f])/pack("H2",$1)/gie;
+        $user =~ s/%([0-9a-f][0-9a-f])/pack("H2",$1)/gie;
+        $pass =~ s/%([0-9a-f][0-9a-f])/pack("H2",$1)/gie;
        print STDERR "domain: $domain, user: $user, pass=$pass\n" 
                if (defined ($debug));
        # check out that we know the PDC address
index 49745ef686b78948ba9e04da7ecf66d88c79aac5..1aeb18d557d4907388c58ae91f4132255c9bdd0f 100644 (file)
@@ -1,11 +1,10 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.am,v 1.4 2002/05/23 14:01:19 hno Exp $
+#  $Id: Makefile.am,v 1.5 2002/08/12 01:11:57 hno Exp $
 #
 
 libexec_PROGRAMS = wb_auth
 wb_auth_SOURCES = wb_basic_auth.c wb_common.c samba_nss.h winbindd_nss.h wbntlm.h winbind_nss_config.h
-INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \
-    -I$(top_srcdir)/src
+INCLUDES = -I$(top_srcdir)/include
 LDADD = -L$(top_builddir)/lib -lmiscutil -lntlmauth $(XTRA_LIBS)
index 1c7f94a8021cc20d3e9ef4bd8ac6ce2da2df5038..9e959dc2cb8cb26d331d038e580be69c0a134339 100644 (file)
@@ -145,6 +145,9 @@ void manage_request(void)
     *pass='\0';
     pass++;
 
+    rfc1738_unescape(user);
+    rfc1738_unescape(pass);
+
     do_authenticate(user,pass);
 }
 
index d78c870cbd1cf784681f0eff51b1914061f13df7..f391839b3ea88f5d3c685b5da3bc05feeba62bd5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth_basic.cc,v 1.17 2002/04/13 23:07:53 hno Exp $
+ * $Id: auth_basic.cc,v 1.18 2002/08/12 01:11:58 hno Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -558,6 +558,7 @@ authenticateBasicStart(auth_user_request_t * auth_user_request, RH * handler, vo
 {
     authenticateStateData *r = NULL;
     char buf[8192];
+    char user[1024], pass[1024];
     basic_data *basic_auth;
     assert(auth_user_request);
     assert(handler);
@@ -590,7 +591,9 @@ authenticateBasicStart(auth_user_request_t * auth_user_request, RH * handler, vo
        r->auth_user_request = auth_user_request;
        /* mark the user as haveing verification in progress */
        basic_auth->flags.credentials_ok = 2;
-       snprintf(buf, 8192, "%s %s\n", basic_auth->username, basic_auth->passwd);
+       xstrncpy(user, rfc1738_escape(basic_auth->username), sizeof(user));
+       xstrncpy(pass, rfc1738_escape(basic_auth->passwd), sizeof(pass));
+       snprintf(buf, sizeof(buf), "%s %s\n", user, pass);
        helperSubmit(basicauthenticators, buf, authenticateBasicHandleReply, r);
     }
 }