sasl.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --- plugins/mysql.c.dist Fri Mar 7 13:26:42 2003
  2. +++ plugins/mysql.c Fri Apr 4 16:55:38 2003
  3. @@ -254,6 +254,7 @@
  4. MYSQL mysql,*sock = NULL;
  5. MYSQL_RES *result;
  6. MYSQL_ROW row;
  7. + unsigned long *rlen;
  8. /* setup the settings */
  9. settings = (struct mysql_settings *)glob_context;
  10. @@ -325,8 +326,15 @@
  11. sparams->utils->log(NULL, SASL_LOG_WARN,
  12. "mysql plugin try and connect to %s\n",
  13. cur_host);
  14. +#ifdef HAVE_MYSQL_REAL_CONNECT
  15. + mysql_init(&mysql);
  16. + sock = mysql_real_connect(&mysql,cur_host,settings->mysql_user,
  17. + settings->mysql_passwd,
  18. + NULL,0,NULL,CLIENT_COMPRESS);
  19. +#else
  20. sock = mysql_connect(&mysql,cur_host,settings->mysql_user,
  21. settings->mysql_passwd);
  22. +#endif
  23. if (sock) break;
  24. cur_host = db_host;
  25. @@ -405,8 +413,10 @@
  26. /* now get the result set value and value_len */
  27. /* we only fetch one becuse we dont car about the rest */
  28. row = mysql_fetch_row(result);
  29. - strncpy(value,row[0],8190);
  30. - value_len = strlen(value);
  31. + rlen = mysql_fetch_lengths(result);
  32. + value_len = rlen[0] > 8190 ? 8190 : rlen[0];
  33. + memcpy(value, row[0], value_len);
  34. + value[value_len] = '\0';
  35. sparams->utils->prop_set(sparams->propctx, cur->name,
  36. value, value_len);
  37. --- lib/server.c.dist Mon Apr 7 16:48:41 2003
  38. +++ lib/server.c Mon Apr 7 16:52:27 2003
  39. @@ -379,18 +379,9 @@
  40. char *c;
  41. char *config_filename=NULL;
  42. int len;
  43. - const sasl_callback_t *getpath_cb=NULL;
  44. - /* get the path to the plugins; for now the config file will reside there */
  45. - getpath_cb=_sasl_find_getpath_callback( global_callbacks.callbacks );
  46. - if (getpath_cb==NULL) return SASL_BADPARAM;
  47. -
  48. - /* getpath_cb->proc MUST be a sasl_getpath_t; if only c had a type
  49. - system */
  50. - result = ((sasl_getpath_t *)(getpath_cb->proc))(getpath_cb->context,
  51. - &path_to_config);
  52. - if (result!=SASL_OK) goto done;
  53. - if (path_to_config == NULL) path_to_config = "";
  54. + result = SASL_OK;
  55. + path_to_config = "@l_sysconfdir@";
  56. if ((c = strchr(path_to_config, PATHS_DELIMITER))) {
  57. *c = '\0';