]> git.pld-linux.org Git - packages/cyrus-sasl.git/blob - cyrus-sasl-mysql-ldap.patch
- db4 fixes
[packages/cyrus-sasl.git] / cyrus-sasl-mysql-ldap.patch
1 --- ./include/Makefile.in.orig  Sat Mar 24 01:48:13 2001
2 +++ ./include/Makefile.in       Thu Mar 28 12:56:53 2002
3 @@ -119,6 +119,8 @@
4  LIBTOOL = @LIBTOOL@
5  LIB_CRYPT = @LIB_CRYPT@
6  LIB_DES = @LIB_DES@
7 +LIB_LDAP = @LIB_LDAP@
8 +LIB_MYSQL = @LIB_MYSQL@
9  LIB_PAM = @LIB_PAM@
10  LIB_SIA = @LIB_SIA@
11  LIB_SOCKET = @LIB_SOCKET@
12 @@ -175,7 +177,7 @@
13  
14  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
15  
16 -TAR = gtar
17 +TAR = tar
18  GZIP_ENV = --best
19  SOURCES = $(makemd5_SOURCES)
20  OBJECTS = $(makemd5_OBJECTS)
21 --- ./lib/Makefile.am.orig      Sat Mar 10 05:56:41 2001
22 +++ ./lib/Makefile.am   Thu Mar 28 12:40:16 2002
23 @@ -53,5 +53,5 @@
24  EXTRA_libsasl_la_SOURCES = db_none.c db_ndbm.c db_gdbm.c db_berkeley.c db_testw32.c
25  libsasl_la_LDFLAGS = -version-info $(sasl_version)
26  libsasl_la_DEPENDENCIES = $(SASL_DB_BACKEND) @LTLIBOBJS@
27 -libsasl_la_LIBADD = @LTLIBOBJS@ $(SASL_DB_BACKEND) $(SASL_DB_LIB) $(SASL_DL_LIB) $(PLAIN_LIBS) $(GSSAPIBASE_LIBS) $(GSSAPI_LIBS) $(LIB_SOCKET)
28 +libsasl_la_LIBADD = @LTLIBOBJS@ $(SASL_DB_BACKEND) $(SASL_DB_LIB) $(SASL_DL_LIB) $(PLAIN_LIBS)  ${LIB_LDAP} ${LIB_MYSQL}
29  # PLAIN_LIBS are linked in for sasl_checkpass
30 --- ./lib/Makefile.in.orig      Sat Mar 24 01:48:13 2001
31 +++ ./lib/Makefile.in   Thu Mar 28 12:57:25 2002
32 @@ -119,6 +119,8 @@
33  LIBTOOL = @LIBTOOL@
34  LIB_CRYPT = @LIB_CRYPT@
35  LIB_DES = @LIB_DES@
36 +LIB_LDAP = @LIB_LDAP@
37 +LIB_MYSQL = @LIB_MYSQL@
38  LIB_PAM = @LIB_PAM@
39  LIB_SIA = @LIB_SIA@
40  LIB_SOCKET = @LIB_SOCKET@
41 @@ -156,7 +158,7 @@
42  EXTRA_libsasl_la_SOURCES = db_none.c db_ndbm.c db_gdbm.c db_berkeley.c db_testw32.c
43  libsasl_la_LDFLAGS = -version-info $(sasl_version)
44  libsasl_la_DEPENDENCIES = $(SASL_DB_BACKEND) @LTLIBOBJS@
45 -libsasl_la_LIBADD = @LTLIBOBJS@ $(SASL_DB_BACKEND) $(SASL_DB_LIB) $(SASL_DL_LIB) $(PLAIN_LIBS) $(GSSAPIBASE_LIBS) $(GSSAPI_LIBS) $(LIB_SOCKET)
46 +libsasl_la_LIBADD = @LTLIBOBJS@ $(SASL_DB_BACKEND) $(SASL_DB_LIB) $(SASL_DL_LIB) $(PLAIN_LIBS)  ${LIB_LDAP} ${LIB_MYSQL}
47  mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
48  CONFIG_HEADER = ../config.h
49  CONFIG_CLEAN_FILES = 
50 @@ -179,7 +181,7 @@
51  
52  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
53  
54 -TAR = gtar
55 +TAR = tar
56  GZIP_ENV = --best
57  SOURCES = $(libsasl_la_SOURCES) $(EXTRA_libsasl_la_SOURCES)
58  OBJECTS = $(libsasl_la_OBJECTS)
59 --- ./lib/checkpw.c.orig        Sat Feb 17 05:06:48 2001
60 +++ ./lib/checkpw.c     Thu Mar 28 12:47:18 2002
61 @@ -53,6 +53,18 @@
62  #include <unistd.h>
63  #endif
64  
65 +#ifdef HAVE_MYSQL
66 +#include <mysql.h>
67 +#include <ctype.h>
68 +#endif /* HAVE_MYSQL */
69
70 +#ifdef HAVE_LDAP
71 +#include <lber.h>
72 +#include <ldap.h>
73 +#include <ctype.h>
74 +#endif /* HAVE_LDAP */
75 +
76 +
77  #ifdef HAVE_KRB
78  #include <krb.h>
79  #endif
80 @@ -171,12 +183,20 @@
81      memcpy (&temp_key, "kerberos", 8);
82      des_fixup_key_parity (&temp_key);
83      des_key_sched (&temp_key, schedule);
84 +#ifdef __FreeBSD__
85 +    des_cbc_cksum ((const unsigned char *)password, &ivec, passlen, schedule, &ivec);
86 +#else
87      des_cbc_cksum ((des_cblock *)password, &ivec, passlen, schedule, &ivec);
88 +#endif
89  
90      memcpy (&temp_key, &ivec, sizeof temp_key);
91      des_fixup_key_parity (&temp_key);
92      des_key_sched (&temp_key, schedule);
93 -    des_cbc_cksum ((des_cblock *)password, key, passlen, schedule, &ivec);
94 +#ifdef __FreeBSD__
95 +    des_cbc_cksum ((const unsigned char*)password, key, passlen, schedule, &ivec);
96 +#else
97 +    des_cbc_cksum ((des_cblock char*)password, key, passlen, schedule, &ivec);
98 +#endif
99  
100      des_fixup_key_parity (key);
101  
102 @@ -211,10 +231,17 @@
103      return (str);
104  }
105  
106 +#ifdef __FreeBSD__
107 +static int use_key(const char *user __attribute__((unused)),
108 +                  char *instance __attribute__((unused)),
109 +                  const char *realm __attribute__((unused)),
110 +                  const void *key, des_cblock *returned_key)
111 +#else
112  static int use_key(char *user __attribute__((unused)), 
113                    char *instance __attribute__((unused)), 
114                    char *realm __attribute__((unused)), 
115                    void *key, des_cblock *returned_key)
116 +#endif
117  {
118      memcpy (returned_key, key, sizeof(des_cblock));
119      return 0;
120 @@ -1015,7 +1042,7 @@
121  
122  
123  /* pwcheck daemon-authenticated login */
124 -static int pwcheck_verify_password(sasl_conn_t *conn,
125 +static int pwcheck_verify_password(sasl_conn_t *conn __attribute__((unused)),
126                                    const char *userid, 
127                                    const char *passwd,
128                                    const char *service __attribute__((unused)),
129 @@ -1030,8 +1057,10 @@
130      static char response[1024];
131      int start, n;
132      char pwpath[1024];
133 +#if 0 /* Not used */
134      sasl_getopt_t *getopt;
135      void *context;
136 +#endif
137  
138      if (reply) { *reply = NULL; }
139  
140 @@ -1183,6 +1212,447 @@
141  
142  #endif
143  
144 +#ifdef HAVE_MYSQL
145 +/* DMZ mysql auth 12/29/1999
146 + * Updated to 1.5.24 by SWH 09/12/2000
147 + * changed to malloc qbuf Simon Loader 10/21/2000
148 + * Oh look the changelog for it all 
149 + */
150 +#ifdef USE_CRYPT_PASSWORD
151 +#define QUERY_STRING    "select %s from %s where %s = '%s' and %s = password('%s')"
152 +#else
153 +#define QUERY_STRING    "select %s from %s where %s = '%s' and %s = '%s'"
154 +#endif
155 +
156 +static int mysql_verify_password(sasl_conn_t *conn,
157 +                               const char *userid,
158 +                               const char *password,
159 +                               const char *service __attribute__((unused)),
160 +                               const char *user_realm __attribute__((unused)),
161 +                               const char **reply)
162 +{
163 +   unsigned int numrows;
164 +   MYSQL mysql,*sock = NULL;
165 +   MYSQL_RES *result;
166 +   char *qbuf;
167 +   char *cur_host;
168 +   char *db_user="",
169 +        *db_passwd="",
170 +        *db_host="",
171 +        *db_uidcol="",
172 +        *db_pwcol="",
173 +        *db_database="",
174 +        *escap_userid="",
175 +        *escap_password="",
176 +        *db_table="";
177 +   sasl_getopt_t *getopt;
178 +   void *context;
179
180 +   if (!userid || !password) {
181 +       return SASL_BADPARAM;
182 +   }
183 +   if (reply) { *reply = NULL; }
184
185 +   /* check to see if the user configured a mysqluser/passwd/host/etc */
186 +   if (_sasl_getcallback(conn, SASL_CB_GETOPT, &getopt, &context) == SASL_OK) {
187 +       getopt(context, NULL, "mysql_user", (const char **) &db_user, NULL);
188 +       if (!db_user) db_user = "";
189 +       getopt(context, NULL, "mysql_passwd", (const char **) &db_passwd, NULL);
190 +       if (!db_passwd) db_passwd = "";
191 +       getopt(context, NULL, "mysql_host", (const char **) &db_host, NULL);
192 +       if (!db_host) db_host = "";
193 +       getopt(context, NULL, "mysql_database", (const char **) &db_database, NULL);
194 +       if (!db_database) db_database = "";
195 +       getopt(context, NULL, "mysql_table", (const char **) &db_table, NULL);
196 +       if (!db_table) db_table = "";
197 +       getopt(context, NULL, "mysql_uidcol", (const char **) &db_uidcol, NULL);
198 +       if (!db_uidcol) db_uidcol = "";
199 +       getopt(context, NULL, "mysql_pwdcol", (const char **) &db_pwcol, NULL);
200 +       if (!db_pwcol) db_pwcol = "";
201 +    }
202 +
203 +    /* db_host is a list of servers like this
204 +    **  server1 , sever2    , server3 etc.
205 +    */
206 +   cur_host = db_host;
207 +   while ( cur_host != NULL || sock == NULL) {
208 +     db_host = strchr(db_host,',');
209 +     if ( db_host != NULL ) {  
210 +       db_host[0] = 0x00;
211 +       /* loop till we find some text */
212 +       while (!isalnum(db_host[0]) )
213 +           db_host++;
214 +     }
215 +     sock = mysql_connect(&mysql,db_host,db_user,db_passwd);
216 +     cur_host = db_host;
217 +         }
218 +    if ( sock == NULL ) {
219 +      if (reply) { *reply = "cannot connect to MySQL server"; }
220 +      return SASL_FAIL;
221 +    }
222 +
223 +    if (mysql_select_db(sock,db_database) < 0) {
224 +      mysql_close(sock);
225 +      if (reply) { *reply = "cannot select MySQL database"; }
226 +      return SASL_FAIL;
227 +    }
228 +               
229 +    /* select DB_UIDCOL from DB_TABLE where DB_UIDCOL = 'userid' AND DB_PWCOL = password('password') */
230 +    /* first we must escape any strange characters to be inserted into the query string
231 +    ** that is userid and password 
232 +    */
233 +    /* first allocate some memory */
234 +    if ( (escap_userid = (char *)malloc(strlen(userid)*2+1))== NULL ||
235 +        (escap_password = (char *)malloc(strlen(password)*2+1)) == NULL ) {
236 +       if (reply) {
237 +         *reply = "Cannot malloc memory for escaped chars";
238 +       }
239 +       return SASL_FAIL;
240 +     }
241 +     /* these should just work */
242 +     mysql_real_escape_string(&mysql,escap_userid,userid,strlen(userid));
243 +     mysql_real_escape_string(&mysql,escap_password,password,strlen(password));
244 +
245 +    if ( (qbuf = (char *)malloc(strlen(QUERY_STRING)+strlen(db_uidcol)
246 +                               +strlen(db_table)+strlen(db_uidcol)
247 +                               +strlen(userid)+strlen(db_pwcol)
248 +                               +strlen(password)+1)) == NULL ) {
249 +      if (reply) {
250 +       *reply = "cannot malloc memory for sql query";
251 +      }
252 +      return SASL_FAIL;
253 +    }
254 +    sprintf(qbuf,QUERY_STRING,db_uidcol,db_table,db_uidcol,escap_userid,db_pwcol,escap_password);
255 +    if (mysql_query(sock,qbuf) < 0 || !(result=mysql_store_result(sock)))
256 +    {
257 +      free(qbuf);
258 +      mysql_close(sock);
259 +      return SASL_FAIL;
260 +    }
261 +
262 +    if (result) //There were some rows found
263 +    {
264 +           if ((numrows = mysql_affected_rows(&mysql)) != 1)
265 +           {
266 +                   mysql_free_result(result);
267 +                   mysql_close(sock);
268 +                  if ((numrows > 1) && (reply)) { *reply = "Detected duplicate entries for user"; }
269 +                  free(qbuf);
270 +                   return SASL_BADAUTH;
271 +           } else {
272 +            free(qbuf);
273 +            mysql_free_result(result);
274 +            mysql_close(sock);
275 +            return SASL_OK;
276 +          }
277 +    }
278 +    free(qbuf);
279 +    mysql_free_result(result);
280 +    mysql_close(sock);
281 +    return SASL_BADAUTH;
282 +}
283 +#endif /* HAVE_MYSQL */
284 +
285 +#ifdef HAVE_LDAP
286 +/* simon@surf.org.uk LDAP auth 07/11/2000
287 + * Updated to 1.5.24 by SWH 09/12/2000
288 + * changed to use malloc and simplify the auth by Simon@surf.org.uk 10/21/2000
289 + * Added LDAP_FILTER, LDAP_DN, and LDAP_PASSWD -- 07/18/2001
290 + * Changed LDAP_DN to LDAP_BIND_DN and LDAP_PASSWD to LDAP_BIND_PW -- 08/08/2001
291 + * Kevin J. Menard, Jr. <kmenard@wpi.edu>
292 + * Added SSL mode and filter mode - simon@surf.org.uk 08/22/2001
293 +    (are these USA dates or English ?)
294 +*/
295 +
296 +
297 +#define LDAP_SERVER    "localhost"
298 +#define LDAP_BASEDN    "o=JOFA, c=UK"
299 +#define LDAP_UIDATTR   "uid"
300 +#define LDAP_FILTER     ""
301 +#define LDAP_BIND_DN    NULL
302 +#define LDAP_BIND_PW    NULL
303 +
304 +
305 +#ifndef TRUE
306 +# define TRUE          1
307 +# define FALSE         0
308 +#endif
309 +
310 +#ifndef LDAP_NO_ATTRS
311 +#define LDAP_NO_ATTRS  "1.1"
312 +#endif
313 +static int ldap_isdigits(char *value)
314 +{
315 +  char *ptr;
316 +  int num = TRUE;
317 +  
318 +  for (ptr = value; *ptr != '\0' && num != FALSE; ptr++) {
319 +    if (!isdigit(*ptr))
320 +      num = FALSE;
321 +  }
322 +  
323 +  return num;
324 +}
325 +
326 +#ifdef LDAP_VENDOR_VERSION
327 +#define SASL_ldap_search_ext_s(ld, base, scope, filter, attrs, attrsonly, serverctrls, clientctrls, timeout, sizelimit, res) \
328 +       ldap_search_ext_s(ld, base, scope, filter, attrs, attrsonly, serverctrls, clientctrls, timeout, sizelimit, res)
329 +#define SASL_ldap_memfree(dn) ldap_memfree(dn)
330 +#else
331 +#define SASL_ldap_search_ext_s(ld, base, scope, filter, attrs, attrsonly, serverctrls, clientctrls, timeout, sizelimit, res) \
332 +        ldap_search_st(ld, base, scope, filter, attrs, attrsonly, timeout, res)
333 +#define SASL_ldap_memfree(dn) free(dn)
334 +#endif
335 +
336 +static int ldap_verify_password(sasl_conn_t *conn,
337 +                               const char *userid,
338 +                               const char *password,
339 +                               const char *service __attribute__((unused)),
340 +                               const char *user_realm __attribute__((unused)),
341 +                               const char **reply)
342 +{
343 +  
344 +  LDAP *ld = NULL;
345 +  char *cur_server = NULL;
346 +  char *dn,
347 +    *filter="",
348 +    *ldap_server="",
349 +    *ldap_basedn="",
350 +    *ldap_uidattr="",
351 +    *ldap_filter="",
352 +    *ldap_bind_dn="",
353 +    *ldap_bind_pw="",
354 +    *ldap_filter_mode="",
355 +    *port_num="",
356 +    *alias_deref="";
357 +  int ldap_deref=LDAP_DEREF_NEVER;
358 +  int malloc_size; /* safety net */
359 +  int ldap_filter_flag = 0;
360 +  int ldap_port = LDAP_PORT;
361 +  sasl_getopt_t *getopt;
362 +  void *context;
363 +  LDAPMessage  *result, *e;
364 +  char *attrs[]={LDAP_NO_ATTRS, NULL};
365 +#ifdef LDAP_OPT_X_TLS
366 +  char *ldap_ssl="";
367 +  int ldap_ssl_flag = 0;
368 +  int tls_option;
369 +#endif
370 +  
371 +  
372 +  /* If the password is NULL, reject the login...
373 +   * Otherwise the bind will succed as a reference bind. Not good...
374 +   */
375 +  if (strcmp(password,"") == 0 || strcmp(userid,"") == 0) {
376 +    return SASL_BADPARAM;
377 +  }
378 +  
379 +  if (reply) { *reply = NULL; }
380 +  
381 +  /* check to see if the user configured a ldap stuff */
382 +  if ( _sasl_getcallback(conn, SASL_CB_GETOPT, &getopt, &context) != SASL_OK) {
383 +    *reply = "SASL LDAP Method couldnt find getopt callback";
384 +    return(SASL_BADPARAM);
385 +  }
386 +
387 +  /* basic server infomation */
388 +  getopt(context, NULL, "ldap_server", (const char **) &ldap_server, NULL);
389 +  if (!ldap_server) ldap_server = LDAP_SERVER;
390 +  getopt(context, NULL, "ldap_basedn", (const char **) &ldap_basedn, NULL);
391 +  if (!ldap_basedn) {
392 +    if (reply) { *reply = "ldap_basedn not defined"; }
393 +    return SASL_BADPARAM;
394 +  }
395 +  getopt(context, NULL, "ldap_uidattr", (const char **) &ldap_uidattr, NULL);
396 +  if (!ldap_uidattr) { ldap_uidattr = LDAP_UIDATTR; }
397 +
398 +  /* should probabaly do something if in SSL Mode */
399 +  getopt(context, NULL, "ldap_port", (const char **) &port_num, NULL);
400 +  if (!port_num) {
401 +    ldap_port = LDAP_PORT;
402 +  } else if (!ldap_isdigits(port_num)) {
403 +    if (reply) { *reply = "ldap_port - invalid value"; }
404 +    return SASL_BADPARAM;
405 +  } else {
406 +    ldap_port = atoi(port_num);
407 +  }
408 +  /* get filter information (if present) */
409 +  getopt(context, NULL, "ldap_filter", (const char **) &ldap_filter, NULL);
410 +  if (!ldap_filter) { ldap_filter = LDAP_FILTER; }
411 +  getopt(context, NULL, "ldap_bind_dn", (const char **) &ldap_bind_dn, NULL);
412 +  if (!ldap_bind_dn) { ldap_bind_dn = LDAP_BIND_DN; }
413 +  getopt(context, NULL, "ldap_bind_pw", (const char **) &ldap_bind_pw, NULL);
414 +  if (!ldap_bind_pw) { ldap_bind_pw = LDAP_BIND_PW; }
415 +  getopt(context, NULL, "ldap_alias_deref", (const char **) &alias_deref, NULL);
416 +  
417 +  if (*alias_deref == 'n' || *alias_deref =='N') 
418 +     { ldap_deref=LDAP_DEREF_NEVER; }
419 +  if (*alias_deref == 's' || *alias_deref =='S') 
420 +     { ldap_deref=LDAP_DEREF_SEARCHING; }
421 +  if (*alias_deref == 'f' || *alias_deref =='F') 
422 +     { ldap_deref=LDAP_DEREF_FINDING; }
423 +  if (*alias_deref == 'a' || *alias_deref =='A') 
424 +     { ldap_deref=LDAP_DEREF_ALWAYS; }
425 +  /* test for ssl mode */
426 +  /* this will only work with openldap > v2
427 +  **  (the other ldap stuff I dont know) 
428 +  */
429 +#ifdef LDAP_OPT_X_TLS
430 +  getopt(context, NULL, "ldap_ssl", (const char **) &ldap_ssl, NULL);
431 +  /* this is taken from the auto transition section */
432 +  if (ldap_ssl == NULL ) { ldap_ssl = "n"; }
433 +  if (*ldap_ssl == '1' || *ldap_ssl == 'y' ||
434 +      (*ldap_ssl == 'o' && ldap_ssl[1] == 'n') || *ldap_ssl == 't') {
435 +    /* ok switch on ldap ssl mode */
436 +    ldap_ssl_flag = 1;
437 +  }
438 +#endif
439 +  /* test for filter mode */
440 +  getopt(context, NULL, "ldap_filter_mode", (const char **) &ldap_filter_mode, NULL);
441 +  /* this is taken from the auto transition section */
442 +  if (ldap_filter_mode == NULL ) { ldap_filter_mode = "n"; }
443 +  if (*ldap_filter_mode == '1' || *ldap_filter_mode == 'y' ||
444 +      (*ldap_filter_mode == 'o' && ldap_filter_mode[1] == 'n')
445 +      || *ldap_filter_mode == 't') {
446 +    /* ok switch on ldap ssl mode */
447 +    ldap_filter_flag = 1;
448 +  }
449 +  
450 +  /* Open the LDAP connection. */
451 +  cur_server = ldap_server;
452 +  while ( cur_server != NULL && ld == NULL) {
453 +    ldap_server = strchr(ldap_server,',');
454 +    if ( ldap_server != NULL ) {       
455 +      ldap_server[0] = 0x00;
456 +      /* loop till we find some text */
457 +      while (!isalnum(ldap_server[0]) )
458 +          ldap_server++;
459 +    }
460 +    ld = ldap_init(cur_server,ldap_port);
461 +    cur_server = ldap_server;
462 +  }
463 +  if (ld == NULL) {
464 +    if (reply) { *reply = "cannot connect to LDAP server"; }
465 +    return SASL_FAIL;
466 +  }
467 +  /* setting dereferensing aliases mode */
468 +  if (ldap_set_option(ld, LDAP_OPT_DEREF, (void *) &ldap_deref) != LDAP_OPT_SUCCESS) {
469 +    if (reply) {
470 +      *reply = "cannot set deref options";
471 +    }
472 +    return SASL_FAIL;
473 +  }
474 +  /* set ssl mode if needed */
475 +#ifdef LDAP_OPT_X_TLS
476 +  if ( ldap_ssl_flag ) {
477 +    ldap_set_option(ld, LDAP_OPT_X_TLS, (void *)&tls_option);  
478 +  }
479 +#endif
480 +  
481 +  /* either run the filter or just bind as them ? */
482 +  
483 +  /*
484 +   * Kevin J. Menard, Jr. <kmenard@wpi.edu>. -- 07/18/2001
485 +   * Added search code.  First search for the UID and filter, then
486 +   * attempt to bind with the search result.
487 +   */
488 +   if ( ldap_filter_flag ) {
489 +    /* Bind as the user given (or anonymous) */
490 +    if (ldap_simple_bind_s(ld,ldap_bind_dn,ldap_bind_pw) != LDAP_SUCCESS) {
491 +      ldap_unbind(ld);
492 +      return SASL_BADAUTH;
493 +    }
494 +    
495 +    malloc_size = strlen(ldap_uidattr)+strlen(userid)+strlen(ldap_filter)+8;
496 +    /* allocate memory to filter */
497 +    if ( (filter = (char *)malloc(malloc_size)) == NULL ) {
498 +      if (reply) {
499 +       *reply = "cannot allocate memory for ldap search filter";
500 +      }
501 +      ldap_unbind(ld);
502 +      return SASL_FAIL;
503 +    }
504 +    
505 +    /* Create the search filter */
506 +    snprintf(filter,malloc_size-1,"(&(%s=%s)%s)", ldap_uidattr, userid, ldap_filter);
507 +    
508 +    /* Now do the search */
509 +    if (SASL_ldap_search_ext_s(ld, ldap_basedn, LDAP_SCOPE_SUBTREE, filter,
510 +                          attrs, 0, NULL, NULL, LDAP_NO_LIMIT, 1, &result) !=
511 +       LDAP_SUCCESS) {
512 +      free(filter);
513 +      ldap_unbind(ld);
514 +      return SASL_BADAUTH;
515 +    }
516 +    
517 +    /* Now get the entry from the search results */
518 +    if ( (e = ldap_first_entry(ld, result)) ==NULL) {
519 +      free(filter);
520 +      ldap_msgfree(result);
521 +      if (reply) {
522 +               *reply = "entry not found";
523 +      }
524 +      ldap_unbind(ld);
525 +      return SASL_FAIL;
526 +//      return SASL_BADAUTH;
527 +    }
528 +    
529 +    /* Now extract the dn */
530 +    if ( (dn = ldap_get_dn(ld, e)) == NULL) {
531 +      free(filter);
532 +      ldap_msgfree(result);
533 +      if (reply) {
534 +               *reply = "Cannot get DN";
535 +      }
536 +      ldap_unbind(ld);
537 +      return SASL_FAIL;
538 +//      return SASL_BADAUTH;
539 +    }
540 +    if (ldap_simple_bind_s(ld,dn,(char *)password) != LDAP_SUCCESS) {
541 +      e = NULL;
542 +      free(filter);
543 +      SASL_ldap_memfree(dn);
544 +      ldap_msgfree(result);
545 +      ldap_unbind(ld);
546 +      return SASL_BADAUTH;
547 +    }
548 +    e = NULL;
549 +    free(filter);
550 +    SASL_ldap_memfree(dn);
551 +    ldap_msgfree(result);
552 +    
553 +  } else {
554 +    malloc_size = strlen(ldap_uidattr)+strlen(userid)+strlen(ldap_basedn)+3;
555 +    if ( (dn = (char *)malloc(malloc_size)) == NULL ) {
556 +      if (reply) { 
557 +       *reply = "cannnot allocate memory for ldap dn";
558 +      }
559 +      return SASL_FAIL;
560 +    }
561 +    /* Generate a dn that we will try and login with */
562 +    snprintf(dn,malloc_size,"%s=%s,%s", ldap_uidattr,userid,ldap_basedn);
563 +    
564 +    /* 
565 +   * Just try and bind with the dn we have been given
566 +   * In most cases the basedn is correct. 
567 +   * If this is not so I have a version or that too
568 +   * Simon@surf.org.uk
569 +   */
570 +    if (ldap_simple_bind_s(ld,dn,(char *)password) != LDAP_SUCCESS) {
571 +      free(dn);
572 +      ldap_unbind(ld);
573 +      return SASL_BADAUTH;
574 +    }
575 +    free(dn);
576 +  }
577 +  
578 +    
579 +  ldap_unbind(ld);
580 +  return SASL_OK;
581 +}
582 +
583 +#endif /* HAVE_LDAP */
584 +
585  struct sasl_verify_password_s _sasl_verify_password[] = {
586      { "sasldb", &sasldb_verify_password },
587  #ifdef HAVE_KRB
588 @@ -1205,6 +1675,12 @@
589  #endif
590  #ifdef HAVE_PWCHECK
591      { "pwcheck", &pwcheck_verify_password },
592 +#endif
593 +#ifdef HAVE_MYSQL
594 +    { "mysql", &mysql_verify_password },
595 +#endif
596 +#ifdef HAVE_LDAP
597 +    { "ldap", &ldap_verify_password },
598  #endif
599  #ifdef HAVE_SASLAUTHD
600      { "saslauthd", &saslauthd_verify_password },
601 --- ./plugins/Makefile.in.orig  Sat Mar 24 01:48:13 2001
602 +++ ./plugins/Makefile.in       Thu Mar 28 13:01:27 2002
603 @@ -123,6 +123,8 @@
604  LIBTOOL = @LIBTOOL@
605  LIB_CRYPT = @LIB_CRYPT@
606  LIB_DES = @LIB_DES@
607 +LIB_LDAP = @LIB_LDAP@
608 +LIB_MYSQL = @LIB_MYSQL@
609  LIB_PAM = @LIB_PAM@
610  LIB_SIA = @LIB_SIA@
611  LIB_SOCKET = @LIB_SOCKET@
612 @@ -237,7 +239,7 @@
613  
614  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
615  
616 -TAR = gtar
617 +TAR = tar
618  GZIP_ENV = --best
619  SOURCES = $(libplain_la_SOURCES) $(libanonymous_la_SOURCES) $(libkerberos4_la_SOURCES) $(libcrammd5_la_SOURCES) $(libscrammd5_la_SOURCES) $(libgssapiv2_la_SOURCES) $(libdigestmd5_la_SOURCES) $(liblogin_la_SOURCES) $(libsrp_la_SOURCES)
620  OBJECTS = $(libplain_la_OBJECTS) $(libanonymous_la_OBJECTS) $(libkerberos4_la_OBJECTS) $(libcrammd5_la_OBJECTS) $(libscrammd5_la_OBJECTS) $(libgssapiv2_la_OBJECTS) $(libdigestmd5_la_OBJECTS) $(liblogin_la_OBJECTS) $(libsrp_la_OBJECTS)
621 --- ./plugins/kerberos4.c.orig  Sat Mar 10 05:56:46 2001
622 +++ ./plugins/kerberos4.c       Thu Mar 28 12:40:17 2002
623 @@ -698,8 +698,13 @@
624  
625      /* decrypt; verify checksum */
626  
627 +#ifdef __FreeBSD__
628 +    des_pcbc_encrypt((const unsigned char *)in,
629 +                    (unsigned char *)in,
630 +#else
631      des_pcbc_encrypt((des_cblock *)in,
632                      (des_cblock *)in,
633 +#endif
634                      clientinlen,
635                      text->init_keysched,
636                      &text->session,
637 @@ -1220,9 +1225,14 @@
638             len++;
639         }
640         sout[len]=0;
641 +#ifdef __FreeBSD__
642 +       des_pcbc_encrypt((const unsigned char *)sout,
643 +                    (unsigned char *)sout,
644 +#else
645      
646         des_pcbc_encrypt((des_cblock *)sout,
647                          (des_cblock *)sout,
648 +#endif
649                          len,
650                          text->init_keysched,
651                          (des_cblock *)text->session,
652 --- ./utils/Makefile.in.orig    Sat Mar 24 01:48:13 2001
653 +++ ./utils/Makefile.in Thu Mar 28 13:03:28 2002
654 @@ -119,6 +119,8 @@
655  LIBTOOL = @LIBTOOL@
656  LIB_CRYPT = @LIB_CRYPT@
657  LIB_DES = @LIB_DES@
658 +LIB_LDAP = @LIB_LDAP@
659 +LIB_MYSQL = @LIB_MYSQL@
660  LIB_PAM = @LIB_PAM@
661  LIB_SIA = @LIB_SIA@
662  LIB_SOCKET = @LIB_SOCKET@
663 @@ -211,7 +213,7 @@
664  
665  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
666  
667 -TAR = gtar
668 +TAR = tar
669  GZIP_ENV = --best
670  SOURCES = $(libsfsasl_la_SOURCES) testsuite.c dbconverter-1.5.9.c saslpasswd.c sasldblistusers.c
671  OBJECTS = $(libsfsasl_la_OBJECTS) testsuite.o dbconverter-1.5.9.o saslpasswd.o sasldblistusers.o
672 --- ./doc/Makefile.in.orig      Sat Mar 24 01:48:13 2001
673 +++ ./doc/Makefile.in   Thu Mar 28 13:03:42 2002
674 @@ -120,6 +120,8 @@
675  LIBTOOL = @LIBTOOL@
676  LIB_CRYPT = @LIB_CRYPT@
677  LIB_DES = @LIB_DES@
678 +LIB_LDAP = @LIB_LDAP@
679 +LIB_MYSQL = @LIB_MYSQL@
680  LIB_PAM = @LIB_PAM@
681  LIB_SIA = @LIB_SIA@
682  LIB_SOCKET = @LIB_SOCKET@
683 @@ -155,7 +157,7 @@
684  
685  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
686  
687 -TAR = gtar
688 +TAR = tar
689  GZIP_ENV = --best
690  all: all-redirect
691  .SUFFIXES:
692 --- ./doc/sysadmin.html.orig    Sat Feb 17 05:06:33 2001
693 +++ ./doc/sysadmin.html Thu Mar 28 12:40:18 2002
694 @@ -171,6 +171,66 @@
695  <dt><i>pwcheck</i><dd> checks passwords with the use of a seperate,
696    helper daemon. <b>needs to be documented.</b><p>
697  
698 +<dt><i>mysql</i><dd> A MySQL database can be used for plaintext
699 +  password checking by setting "pwcheck_method" to "mysql".<p>
700 +
701 +  <p>The following SASL options are used for MySQL Authentication:<p>
702 +
703 +  <dl>
704 +    <dd>mysql_user: &lt;user&gt;</dd>
705 +    <dd>mysql_passwd: &lt;cleartext pw&gt;</dd>
706 +    <dd>mysql_host: &lt;hosts separated by ,&gt;</dd>
707 +    <dd>mysql_database: &lt;database&gt;</dd>
708 +    <dd>mysql_table: &lt;table&gt;</dd>
709 +    <dd>mysql_uidcol: &lt;username col&gt;</dd>
710 +    <dd>mysql_pwdcol: &lt;password col&gt;</dd>
711 +  </dl>
712 +
713 +  <p>MySQL pwcheck_method created by <a href="mailto:dmz@dmzs.com">David Matthew Zendzian</a>
714 +  the original patch may be found at <a href="http://www.dmzs.com/~dmz/projects/cyrus/">http://www.dmzs.com/~dmz/projects/cyrus/</a>.<p>
715 +
716 +<dt><i>ldap</i><dd> A LDAP server can be used for plaintext password
717 +  checking by setting "pwcheck_method" to "ldap".<p>
718 +
719 +  <p>The following SASL options are used for LDAP Authentication:<p>
720 +
721 +  <dl>
722 +    <dd>ldap_server: &lt;LDAP Servers separated by , [localhost]&gt;
723 +    <dd>ldap_basedn: &lt;LDAP base dn&gt;
724 +    <dd>ldap_uidattr: &lt;LDAP uid attribute [uid]&gt;
725 +    <dd>ldap_port: &lt;LDAP port [389]&gt;
726 +    <dd>ldap_ssl: &lt;yes/no/true/fasle&gt; Use ssl (untested)
727 +    <dd>ldap_filter_mode:  &lt;yes/no/true/fasle&gt; Use the filter below
728 +    <dd>ldap_filter: &lt;Additional search filter
729 +[(objectClass=posixAccount)]&gt;
730 +    <dd>ldap_bind_dn: &lt;DN to bind with [NULL]&gt;
731 +    <dd>ldap_bind_pw: &lt;Password for DN to bind with [NULL]&gt;
732 +    <dd>ldap_alias_deref: &lt;n|s|f|a&gt; n is default
733 +  </dl>
734 +
735 +  <p>It is a requirement that "ldap_basedn" be set to the appropriate
736 +  value for your site<br>
737 +  (ex. ldap_basedn: o=surf, c=UK)<p>
738 +
739 +  <p>ldap_alias_deref: n = LDAP_DEREF_NEVER<br>
740 +                       s = LDAP_DEREF_SEARCHING<br>
741 +                       f = LDAP_DEREF_FINDING<br>
742 +                       a = LDAP_DEREF_ALWAYS<br>
743 +   If you dont know what ldap alias is just leave this alone.<br>
744 +
745 +  <p>NULL values for ldap_dn and ldap_passwd mean do an anonymous bind
746 +and search.<p>
747 +
748 +  <p>LDAP pwcheck_method created by <a href="mailto:simon@surf.org.uk">Simon@su
749 +rf.org.uk</a>
750 +  the original patch may be found at <a href="http://www.surf.org.uk/">http://w
751 +ww.surf.org.uk/</a>.<p>
752 +
753 +  <p>Search and filter ability for LDAP was added by <a href="mailto:kmenard@wp.edu">Kevin J. Menard, Jr.</a>.<p>
754 +       <p>Ldap alias support by mailer@cbsd.donetsk.ua<br>
755 +
756 +
757 +
758  <dt><i>write your own</i><dd> Last, but not least, the most flexible
759    method of authentication for PLAIN is to write your own.  If you do
760    so, any application that calls the "<tt>sasl_checkpass()</tt>"
761 --- ./man/Makefile.in.orig      Sat Mar 24 01:48:14 2001
762 +++ ./man/Makefile.in   Thu Mar 28 13:03:47 2002
763 @@ -119,6 +119,8 @@
764  LIBTOOL = @LIBTOOL@
765  LIB_CRYPT = @LIB_CRYPT@
766  LIB_DES = @LIB_DES@
767 +LIB_LDAP = @LIB_LDAP@
768 +LIB_MYSQL = @LIB_MYSQL@
769  LIB_PAM = @LIB_PAM@
770  LIB_SIA = @LIB_SIA@
771  LIB_SOCKET = @LIB_SOCKET@
772 @@ -160,7 +162,7 @@
773  
774  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
775  
776 -TAR = gtar
777 +TAR = tar
778  GZIP_ENV = --best
779  all: all-redirect
780  .SUFFIXES:
781 --- ./pwcheck/Makefile.in.orig  Sat Mar 24 01:48:14 2001
782 +++ ./pwcheck/Makefile.in       Thu Mar 28 12:40:19 2002
783 @@ -99,6 +99,8 @@
784  LIBTOOL = @LIBTOOL@
785  LIB_CRYPT = @LIB_CRYPT@
786  LIB_DES = @LIB_DES@
787 +LIB_LDAP = @LIB_LDAP@
788 +LIB_MYSQL = @LIB_MYSQL@
789  LIB_PAM = @LIB_PAM@
790  LIB_SIA = @LIB_SIA@
791  LIB_SOCKET = @LIB_SOCKET@
792 @@ -153,7 +155,7 @@
793  
794  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
795  
796 -TAR = gtar
797 +TAR = tar
798  GZIP_ENV = --best
799  SOURCES = $(pwcheck_SOURCES) $(EXTRA_pwcheck_SOURCES)
800  OBJECTS = $(pwcheck_OBJECTS)
801 --- ./sample/Makefile.in.orig   Sat Mar 24 01:48:13 2001
802 +++ ./sample/Makefile.in        Thu Mar 28 13:03:53 2002
803 @@ -119,6 +119,8 @@
804  LIBTOOL = @LIBTOOL@
805  LIB_CRYPT = @LIB_CRYPT@
806  LIB_DES = @LIB_DES@
807 +LIB_LDAP = @LIB_LDAP@
808 +LIB_MYSQL = @LIB_MYSQL@
809  LIB_PAM = @LIB_PAM@
810  LIB_SIA = @LIB_SIA@
811  LIB_SOCKET = @LIB_SOCKET@
812 @@ -192,7 +194,7 @@
813  
814  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
815  
816 -TAR = gtar
817 +TAR = tar
818  GZIP_ENV = --best
819  SOURCES = $(sample_client_SOURCES) $(sample_server_SOURCES) $(client_SOURCES) $(server_SOURCES)
820  OBJECTS = $(sample_client_OBJECTS) $(sample_server_OBJECTS) $(client_OBJECTS) $(server_OBJECTS)
821 --- ./java/CyrusSasl/Makefile.in.orig   Sat Mar 24 01:48:14 2001
822 +++ ./java/CyrusSasl/Makefile.in        Thu Mar 28 12:40:20 2002
823 @@ -100,6 +100,8 @@
824  LIBTOOL = @LIBTOOL@
825  LIB_CRYPT = @LIB_CRYPT@
826  LIB_DES = @LIB_DES@
827 +LIB_LDAP = @LIB_LDAP@
828 +LIB_MYSQL = @LIB_MYSQL@
829  LIB_PAM = @LIB_PAM@
830  LIB_SIA = @LIB_SIA@
831  LIB_SOCKET = @LIB_SOCKET@
832 @@ -165,7 +167,7 @@
833  
834  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
835  
836 -TAR = gtar
837 +TAR = tar
838  GZIP_ENV = --best
839  SOURCES = $(libjavasasl_la_SOURCES)
840  OBJECTS = $(libjavasasl_la_OBJECTS)
841 --- ./java/javax/security/auth/callback/Makefile.in.orig        Sat Mar 24 01:48:14 2001
842 +++ ./java/javax/security/auth/callback/Makefile.in     Thu Mar 28 12:40:20 2002
843 @@ -116,6 +116,8 @@
844  LIBTOOL = @LIBTOOL@
845  LIB_CRYPT = @LIB_CRYPT@
846  LIB_DES = @LIB_DES@
847 +LIB_LDAP = @LIB_LDAP@
848 +LIB_MYSQL = @LIB_MYSQL@
849  LIB_PAM = @LIB_PAM@
850  LIB_SIA = @LIB_SIA@
851  LIB_SOCKET = @LIB_SOCKET@
852 @@ -158,7 +160,7 @@
853  
854  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
855  
856 -TAR = gtar
857 +TAR = tar
858  GZIP_ENV = --best
859  all: all-redirect
860  .SUFFIXES:
861 --- ./java/javax/security/auth/Makefile.in.orig Sat Mar 24 01:48:14 2001
862 +++ ./java/javax/security/auth/Makefile.in      Thu Mar 28 12:40:20 2002
863 @@ -116,6 +116,8 @@
864  LIBTOOL = @LIBTOOL@
865  LIB_CRYPT = @LIB_CRYPT@
866  LIB_DES = @LIB_DES@
867 +LIB_LDAP = @LIB_LDAP@
868 +LIB_MYSQL = @LIB_MYSQL@
869  LIB_PAM = @LIB_PAM@
870  LIB_SIA = @LIB_SIA@
871  LIB_SOCKET = @LIB_SOCKET@
872 @@ -150,7 +152,7 @@
873  
874  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
875  
876 -TAR = gtar
877 +TAR = tar
878  GZIP_ENV = --best
879  all: all-redirect
880  .SUFFIXES:
881 --- ./java/javax/security/Makefile.in.orig      Sat Mar 24 01:48:14 2001
882 +++ ./java/javax/security/Makefile.in   Thu Mar 28 12:40:21 2002
883 @@ -116,6 +116,8 @@
884  LIBTOOL = @LIBTOOL@
885  LIB_CRYPT = @LIB_CRYPT@
886  LIB_DES = @LIB_DES@
887 +LIB_LDAP = @LIB_LDAP@
888 +LIB_MYSQL = @LIB_MYSQL@
889  LIB_PAM = @LIB_PAM@
890  LIB_SIA = @LIB_SIA@
891  LIB_SOCKET = @LIB_SOCKET@
892 @@ -150,7 +152,7 @@
893  
894  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
895  
896 -TAR = gtar
897 +TAR = tar
898  GZIP_ENV = --best
899  all: all-redirect
900  .SUFFIXES:
901 --- ./java/javax/Makefile.in.orig       Sat Mar 24 01:48:14 2001
902 +++ ./java/javax/Makefile.in    Thu Mar 28 12:40:21 2002
903 @@ -116,6 +116,8 @@
904  LIBTOOL = @LIBTOOL@
905  LIB_CRYPT = @LIB_CRYPT@
906  LIB_DES = @LIB_DES@
907 +LIB_LDAP = @LIB_LDAP@
908 +LIB_MYSQL = @LIB_MYSQL@
909  LIB_PAM = @LIB_PAM@
910  LIB_SIA = @LIB_SIA@
911  LIB_SOCKET = @LIB_SOCKET@
912 @@ -150,7 +152,7 @@
913  
914  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
915  
916 -TAR = gtar
917 +TAR = tar
918  GZIP_ENV = --best
919  all: all-redirect
920  .SUFFIXES:
921 --- ./java/Makefile.in.orig     Sat Mar 24 01:48:14 2001
922 +++ ./java/Makefile.in  Thu Mar 28 12:40:21 2002
923 @@ -100,6 +100,8 @@
924  LIBTOOL = @LIBTOOL@
925  LIB_CRYPT = @LIB_CRYPT@
926  LIB_DES = @LIB_DES@
927 +LIB_LDAP = @LIB_LDAP@
928 +LIB_MYSQL = @LIB_MYSQL@
929  LIB_PAM = @LIB_PAM@
930  LIB_SIA = @LIB_SIA@
931  LIB_SOCKET = @LIB_SOCKET@
932 @@ -135,7 +137,7 @@
933  
934  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
935  
936 -TAR = gtar
937 +TAR = tar
938  GZIP_ENV = --best
939  all: all-redirect
940  .SUFFIXES:
941 --- ./saslauthd/Makefile.in.orig        Sat Mar 24 01:48:14 2001
942 +++ ./saslauthd/Makefile.in     Thu Mar 28 12:40:22 2002
943 @@ -75,6 +75,8 @@
944  LIBTOOL = @LIBTOOL@
945  LIB_CRYPT = @LIB_CRYPT@
946  LIB_DES = @LIB_DES@
947 +LIB_LDAP = @LIB_LDAP@
948 +LIB_MYSQL = @LIB_MYSQL@
949  LIB_PAM = @LIB_PAM@
950  LIB_SIA = @LIB_SIA@
951  LIB_SOCKET = @LIB_SOCKET@
952 @@ -136,7 +138,7 @@
953  
954  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
955  
956 -TAR = gtar
957 +TAR = tar
958  GZIP_ENV = --best
959  SOURCES = $(saslauthd_SOURCES)
960  OBJECTS = $(saslauthd_OBJECTS)
961 --- ./Makefile.in.orig  Sat Mar 24 01:48:13 2001
962 +++ ./Makefile.in       Thu Mar 28 13:04:13 2002
963 @@ -119,6 +119,8 @@
964  LIBTOOL = @LIBTOOL@
965  LIB_CRYPT = @LIB_CRYPT@
966  LIB_DES = @LIB_DES@
967 +LIB_LDAP = @LIB_LDAP@
968 +LIB_MYSQL = @LIB_MYSQL@
969  LIB_PAM = @LIB_PAM@
970  LIB_SIA = @LIB_SIA@
971  LIB_SOCKET = @LIB_SOCKET@
972 @@ -165,7 +167,7 @@
973  
974  DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
975  
976 -TAR = gtar
977 +TAR = tar
978  GZIP_ENV = --best
979  DIST_SUBDIRS =  include lib plugins utils doc man pwcheck sample java \
980  saslauthd
981 --- ./acconfig.h.orig   Sat Feb 17 05:06:28 2001
982 +++ ./acconfig.h        Thu Mar 28 12:40:22 2002
983 @@ -83,6 +83,12 @@
984  /* do we have PAM for plaintext password checking? */
985  #undef HAVE_PAM
986  
987 +/* do we have MySQL for plaintext password checking? */
988 +#undef HAVE_MYSQL
989 +
990 +/* do we have LDAP for plaintext password checking? */
991 +#undef HAVE_LDAP
992 +
993  /* what flavor of GSSAPI are we using? */
994  #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
995  
996 --- ./aclocal.m4.orig   Sat Mar 24 01:48:12 2001
997 +++ ./aclocal.m4        Thu Mar 28 12:56:14 2002
998 @@ -262,12 +262,7 @@
999  esac
1000  
1001  # Check for any special flags to pass to ltconfig.
1002 -#
1003 -# the following will cause an existing older ltconfig to fail, so
1004 -# we ignore this at the expense of the cache file... Checking this 
1005 -# will just take longer ... bummer!
1006 -#libtool_flags="--cache-file=$cache_file"
1007 -#
1008 +libtool_flags="--cache-file=$cache_file"
1009  test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
1010  test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
1011  test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
1012 @@ -566,35 +561,31 @@
1013  ])
1014  
1015  # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1016 -# the libltdl convenience library and INCLTDL to the include flags for
1017 -# the libltdl header and adds --enable-ltdl-convenience to the
1018 -# configure arguments.  Note that LIBLTDL and INCLTDL are not
1019 -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
1020 -# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
1021 -# with '${top_builddir}/' and INCLTDL will be prefixed with
1022 -# '${top_srcdir}/' (note the single quotes!).  If your package is not
1023 -# flat and you're not using automake, define top_builddir and
1024 -# top_srcdir appropriately in the Makefiles.
1025 +# the libltdl convenience library, adds --enable-ltdl-convenience to
1026 +# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1027 +# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1028 +# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1029 +# '${top_builddir}/' (note the single quotes!) if your package is not
1030 +# flat, and, if you're not using automake, define top_builddir as
1031 +# appropriate in the Makefiles.
1032  AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1033    case "$enable_ltdl_convenience" in
1034    no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1035    "") enable_ltdl_convenience=yes
1036        ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1037    esac
1038 -  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
1039 -  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1040 +  LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
1041 +  INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1042  ])
1043  
1044  # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1045 -# the libltdl installable library and INCLTDL to the include flags for
1046 -# the libltdl header and adds --enable-ltdl-install to the configure
1047 -# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
1048 -# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
1049 -# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
1050 -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
1051 -# with '${top_srcdir}/' (note the single quotes!).  If your package is
1052 -# not flat and you're not using automake, define top_builddir and
1053 -# top_srcdir appropriately in the Makefiles.
1054 +# the libltdl installable library, and adds --enable-ltdl-install to
1055 +# the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1056 +# is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1057 +# to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1058 +# '${top_builddir}/' (note the single quotes!) if your package is not
1059 +# flat, and, if you're not using automake, define top_builddir as
1060 +# appropriate in the Makefiles.
1061  # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1062  AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1063    AC_CHECK_LIB(ltdl, main,
1064 @@ -607,8 +598,8 @@
1065    ])
1066    if test x"$enable_ltdl_install" = x"yes"; then
1067      ac_configure_args="$ac_configure_args --enable-ltdl-install"
1068 -    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
1069 -    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
1070 +    LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
1071 +    INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
1072    else
1073      ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1074      LIBLTDL="-lltdl"
1075 --- ./config.h.in.orig  Wed Mar 14 04:49:33 2001
1076 +++ ./config.h.in       Thu Mar 28 12:40:23 2002
1077 @@ -86,6 +86,12 @@
1078  /* do we have PAM for plaintext password checking? */
1079  #undef HAVE_PAM
1080  
1081 +/* do we have MySQL for plaintext password checking? */
1082 +#undef HAVE_MYSQL
1083 +
1084 +/* do we have LDAP for plaintext password checking? */
1085 +#undef HAVE_LDAP
1086 +
1087  /* what flavor of GSSAPI are we using? */
1088  #undef HAVE_GSS_C_NT_HOSTBASED_SERVICE
1089  
1090 --- ./configure.in.orig Sat Mar 24 01:47:27 2001
1091 +++ ./configure.in      Thu Mar 28 12:40:23 2002
1092 @@ -322,6 +322,94 @@
1093  fi
1094  AM_CONDITIONAL(PWCHECK, test "$with_pwcheck" != no)
1095  
1096 +
1097 +############################################################################
1098 +# Simon Loader tries to do auto conf
1099 +dnl MySQL
1100 +AC_ARG_WITH(mysql,  [ --with-mysql=PATH        enable authentication from MySQL database [no] ],
1101 +  with_mysql=$withval,
1102 +  with_mysql=no)
1103 +
1104 +# fine location of library 
1105 +# prsumesing if one given then correct
1106 +if test "${with_mysql}" = "yes"; then
1107 +  for mysqlloc in lib/mysql lib
1108 +  do
1109 +    if test -f ${prefix}/${mysqlloc}/libmysqlclient.a; then
1110 +      with_mysql="${prefix}"
1111 +      break
1112 +    elif test -f /usr/local/${mysqlloc}/libmysqlclient.a; then
1113 +      with_mysql="/usr/local"
1114 +      break
1115 +    elif test -f /usr/${mysqlloc}/libmysqlclient.a; then
1116 +      with_mysql="/usr"
1117 +      break
1118 +    fi
1119 +  done
1120 +fi
1121 +
1122 +case "$with_mysql" in
1123 +    no) true;;
1124 +    *)
1125 +     if test -d ${with_mysql}/include/mysql; then
1126 +         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include/mysql"
1127 +         LDFLAGS="$LDFLAGS -L${with_mysql}/lib/mysql"
1128 +     else
1129 +         CPPFLAGS="${CPPFLAGS} -I${with_mysql}/include"
1130 +         LDFLAGS="$LDFLAGS -L${with_mysql}/lib"
1131 +     fi
1132 +       AC_CHECK_LIB(mysqlclient, mysql_select_db,[
1133 +                                       LIB_MYSQL="-lmysqlclient"
1134 +         AC_DEFINE(HAVE_MYSQL)],
1135 +         [AC_ERROR([MYSQL libarary mysqlclient not found])]);;
1136 +        
1137 +esac
1138 +AC_SUBST(LIB_MYSQL)
1139 +
1140 +dnl LDAP
1141 +AC_ARG_WITH(ldap, [  --with-ldap=PATH         enable authentication from LDAP [no] ],
1142 +  with_ldap=$withval,
1143 +  with_ldap=no)
1144 +
1145 +if test "$with_ldap" =  "yes"; then
1146 +  for ldaploc in lib/ldap lib
1147 +  do
1148 +    if test -f ${prefix}/${ldaploc}/libldap.a; then
1149 +      with_ldap="${prefix}"
1150 +      break   
1151 +    elif test -f /usr/local/${ldaploc}/libldap.a; then
1152 +      with_ldap="/usr/local"
1153 +      break
1154 +    elif test -f /usr/${ldaploc}/libldap.a; then
1155 +      with_ldap="/usr"
1156 +      break
1157 +    fi
1158 +  done
1159 +fi
1160 +
1161 +case "$with_ldap" in
1162 +    no) true;;
1163 +    *)
1164 +     if test -d ${with_ldap}/include/ldap; then
1165 +         CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include/ldap"
1166 +         LDFLAGS="$LDFLAGS -L${with_ldap}/lib/ldap"
1167 +     else
1168 +         CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
1169 +         LDFLAGS="$LDFLAGS -L${with_ldap}/lib"
1170 +     fi
1171 +     AC_CHECK_LIB(ldap, ldap_open,[
1172 +                                               LIB_LDAP="-lldap -llber"
1173 +           AC_DEFINE(HAVE_LDAP)],
1174 +           [AC_ERROR([LDAP libarary ldap and lber not found])],
1175 +            [-llber]);;
1176 +esac
1177 +AC_SUBST(LIB_LDAP)
1178 +
1179 +
1180 +# end of addition
1181 +#######################################################################
1182 +
1183 +
1184  dnl CRAM-MD5
1185  AC_ARG_ENABLE(cram, [  --enable-cram           enable CRAM-MD5 authentication [yes] ],
1186    cram=$enableval,
This page took 0.111313 seconds and 3 git commands to generate.