quota-4.03-fix_build_without_ldap.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. commit 39fd30ce57e3c34c3649866bf9345a71f0b78667
  2. Author: Jan Kara <jack@suse.cz>
  3. Date: Mon Jan 4 15:10:53 2016 +0100
  4. Fix build with disabled ldap
  5. Reported-by: Tomas Chvatal <tchvatal@suse.com>
  6. Signed-off-by: Jan Kara <jack@suse.cz>
  7. diff --git a/warnquota.c b/warnquota.c
  8. index 3734f0e..e9868c1 100644
  9. --- a/warnquota.c
  10. +++ b/warnquota.c
  11. @@ -109,13 +109,13 @@ struct configparams {
  12. char *user_signature;
  13. char *group_message;
  14. char *group_signature;
  15. + time_t cc_before;
  16. +#ifdef USE_LDAP_MAIL_LOOKUP
  17. int use_ldap_mail; /* 0 */
  18. + int ldap_is_setup; /* 0 */
  19. int ldap_starttls; /* 0 */
  20. int ldap_tls; /* LDAP_OPT_X_TLS_NEVER */
  21. int ldap_vers; /* LDAP_VERSION3 */
  22. - time_t cc_before;
  23. -#ifdef USE_LDAP_MAIL_LOOKUP
  24. - int ldap_is_setup; /* 0 */
  25. char ldap_host[CNF_BUFFER];
  26. int ldap_port;
  27. char ldap_uri[CNF_BUFFER];
  28. @@ -729,13 +729,13 @@ static int readconfigfile(const char *filename, struct configparams *config)
  29. }
  30. maildev[0] = 0;
  31. config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
  32. + config->cc_before = -1;
  33. +
  34. +#ifdef USE_LDAP_MAIL_LOOKUP
  35. config->use_ldap_mail = 0;
  36. config->ldap_starttls = 0;
  37. config->ldap_tls = LDAP_OPT_X_TLS_NEVER;
  38. config->ldap_vers = LDAP_VERSION3;
  39. - config->cc_before = -1;
  40. -
  41. -#ifdef USE_LDAP_MAIL_LOOKUP
  42. config->ldap_port = config->ldap_is_setup = 0;
  43. config->ldap_host[0] = 0;
  44. config->ldap_uri[0] = 0;
  45. @@ -820,6 +820,18 @@ static int readconfigfile(const char *filename, struct configparams *config)
  46. create_eoln(config->group_signature);
  47. verify_format(config->group_signature, "GROUP_SIGNATURE");
  48. }
  49. + else if (!strcmp(var, "CC_BEFORE")) {
  50. + int num;
  51. + char unit[10];
  52. +
  53. + if (sscanf(value, "%d%s", &num, unit) != 2)
  54. + goto cc_parse_err;
  55. + if (str2timeunits(num, unit, &config->cc_before) < 0) {
  56. +cc_parse_err:
  57. + die(1, _("Cannot parse time at CC_BEFORE variable (line %d).\n"), line);
  58. + }
  59. + }
  60. +#ifdef USE_LDAP_MAIL_LOOKUP
  61. else if (!strcmp(var, "LDAP_MAIL")) {
  62. if(strcasecmp(value, "true") == 0)
  63. config->use_ldap_mail = 1;
  64. @@ -846,18 +858,6 @@ static int readconfigfile(const char *filename, struct configparams *config)
  65. else
  66. config->ldap_starttls = 0;
  67. }
  68. - else if (!strcmp(var, "CC_BEFORE")) {
  69. - int num;
  70. - char unit[10];
  71. -
  72. - if (sscanf(value, "%d%s", &num, unit) != 2)
  73. - goto cc_parse_err;
  74. - if (str2timeunits(num, unit, &config->cc_before) < 0) {
  75. -cc_parse_err:
  76. - die(1, _("Cannot parse time at CC_BEFORE variable (line %d).\n"), line);
  77. - }
  78. - }
  79. -#ifdef USE_LDAP_MAIL_LOOKUP
  80. else if (!strcmp(var, "LDAP_HOST"))
  81. sstrncpy(config->ldap_host, value, CNF_BUFFER);
  82. else if (!strcmp(var, "LDAP_PORT"))