]> git.pld-linux.org Git - packages/squid.git/blob - squid-2.5.STABLE11-ldap_auth.patch
- added six patches from squids site
[packages/squid.git] / squid-2.5.STABLE11-ldap_auth.patch
1 Index: squid/helpers/basic_auth/LDAP/squid_ldap_auth.8
2 diff -c squid/helpers/basic_auth/LDAP/squid_ldap_auth.8:1.7.2.9 squid/helpers/basic_auth/LDAP/squid_ldap_auth.8:1.7.2.10
3 *** squid/helpers/basic_auth/LDAP/squid_ldap_auth.8:1.7.2.9     Sun Jan 30 12:28:56 2005
4 --- squid/helpers/basic_auth/LDAP/squid_ldap_auth.8     Wed Sep 28 12:33:42 2005
5 ***************
6 *** 199,205 ****
7   a user DN and password to log in as to perform the searches, as in the
8   following complex Active Directory example
9   .IP
10 ! squid_ldap_auth -p -R -b "dc=your,dc=domain" -D "cn=squid,cn=users,dc=your,dc=domain" -w "secretsquidpassword" -f "(&(userPrincipalName=%s)(objectClass=Person))" activedirectoryserver
11   .
12   .SH NOTES
13   .
14 --- 199,205 ----
15   a user DN and password to log in as to perform the searches, as in the
16   following complex Active Directory example
17   .IP
18 ! squid_ldap_auth -P -R -b "dc=your,dc=domain" -D "cn=squid,cn=users,dc=your,dc=domain" -w "secretsquidpassword" -f "(&(userPrincipalName=%s)(objectClass=Person))" activedirectoryserver
19   .
20   .SH NOTES
21   .
22 Index: squid/helpers/basic_auth/LDAP/squid_ldap_auth.c
23 diff -c squid/helpers/basic_auth/LDAP/squid_ldap_auth.c:1.21.2.23 squid/helpers/basic_auth/LDAP/squid_ldap_auth.c:1.21.2.24
24 *** squid/helpers/basic_auth/LDAP/squid_ldap_auth.c:1.21.2.23   Sat Sep 10 18:53:23 2005
25 --- squid/helpers/basic_auth/LDAP/squid_ldap_auth.c     Wed Sep 28 12:33:42 2005
26 ***************
27 *** 187,193 ****
28       else
29         ld->ld_options &= ~LDAP_OPT_REFERRALS;
30   }
31 ! static void 
32   squid_ldap_set_timelimit(LDAP * ld, int timelimit)
33   {
34       ld->ld_timelimit = timelimit;
35 --- 187,193 ----
36       else
37         ld->ld_options &= ~LDAP_OPT_REFERRALS;
38   }
39 ! static void
40   squid_ldap_set_timelimit(LDAP * ld, int timelimit)
41   {
42       ld->ld_timelimit = timelimit;
43 ***************
44 *** 259,265 ****
45       }
46       if (use_tls) {
47   #ifdef LDAP_OPT_X_TLS
48 !         if (version != LDAP_VERSION3) {
49             fprintf(stderr, "TLS requires LDAP version 3\n");
50             exit(1);
51         } else if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS) {
52 --- 259,265 ----
53       }
54       if (use_tls) {
55   #ifdef LDAP_OPT_X_TLS
56 !       if (version != LDAP_VERSION3) {
57             fprintf(stderr, "TLS requires LDAP version 3\n");
58             exit(1);
59         } else if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS) {
60 ***************
61 *** 282,293 ****
62   static int
63   validUsername(const char *user)
64   {
65 !     const unsigned char *p = (const unsigned char *)user;
66   
67       /* Leading whitespace? */
68       if (isspace(p[0]))
69         return 0;
70 !     while(p[0] && p[1]) {
71         if (isspace(p[0])) {
72             /* More than one consequitive space? */
73             if (isspace(p[1]))
74 --- 282,293 ----
75   static int
76   validUsername(const char *user)
77   {
78 !     const unsigned char *p = (const unsigned char *) user;
79   
80       /* Leading whitespace? */
81       if (isspace(p[0]))
82         return 0;
83 !     while (p[0] && p[1]) {
84         if (isspace(p[0])) {
85             /* More than one consequitive space? */
86             if (isspace(p[1]))
87 ***************
88 *** 581,597 ****
89 --- 581,603 ----
90       return n;
91   }
92   
93 + /* Check the userid & password.
94 +  * Return 0 on success, 1 on failure
95 +  */
96   static int
97   checkLDAP(LDAP * persistent_ld, const char *userid, const char *password, const char *ldapServer, int port)
98   {
99       char dn[256];
100       int ret = 0;
101       LDAP *bind_ld = NULL;
102 +     int rc;
103   
104       if (!*password) {
105         /* LDAP can't bind with a blank password. Seen as "anonymous"
106          * and always granted access
107          */
108 +       if (debug)
109 +           fprintf(stderr, "Blank password given\n");
110         return 1;
111       }
112       if (searchfilter) {
113 ***************
114 *** 599,607 ****
115         char escaped_login[256];
116         LDAPMessage *res = NULL;
117         LDAPMessage *entry;
118 !       char *searchattr[] = {LDAP_NO_ATTRS, NULL};
119         char *userdn;
120 -       int rc;
121         LDAP *search_ld = persistent_ld;
122   
123         if (!search_ld)
124 --- 605,613 ----
125         char escaped_login[256];
126         LDAPMessage *res = NULL;
127         LDAPMessage *entry;
128 !       char *searchattr[] =
129 !       {LDAP_NO_ATTRS, NULL};
130         char *userdn;
131         LDAP *search_ld = persistent_ld;
132   
133         if (!search_ld)
134 ***************
135 *** 625,630 ****
136 --- 631,638 ----
137                 /* Everything is fine. This is expected when referrals
138                  * are disabled.
139                  */
140 +               if (debug)
141 +                   fprintf(stderr, "noreferrals && rc == LDAP_PARTIAL_RESULTS\n");
142             } else {
143                 fprintf(stderr, PROGRAM_NAME ": WARNING, LDAP search error '%s'\n", ldap_err2string(rc));
144   #if defined(NETSCAPE_SSL)
145 ***************
146 *** 639,644 ****
147 --- 647,654 ----
148         }
149         entry = ldap_first_entry(search_ld, res);
150         if (!entry) {
151 +           if (debug)
152 +               fprintf(stderr, "Ldap search returned nothing\n");
153             ret = 1;
154             goto search_done;
155         }
156 ***************
157 *** 690,696 ****
158       return ret;
159   }
160   
161 ! int 
162   readSecret(const char *filename)
163   {
164       char buf[BUFSIZ];
165 --- 700,706 ----
166       return ret;
167   }
168   
169 ! int
170   readSecret(const char *filename)
171   {
172       char buf[BUFSIZ];
This page took 0.033214 seconds and 3 git commands to generate.