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