aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2014-09-01 08:26:59 +0300
committerSergey Poznyakoff <gray@gnu.org>2014-09-01 08:31:57 +0300
commit59ea25e3fe207aaf0e8134b44601a763780109cb (patch)
tree499b320aec38a9621200a616a45e31d10c14b0ac
parentf4894990bd98521e09d418f703111dd393de9b05 (diff)
downloadsmap-59ea25e3fe207aaf0e8134b44601a763780109cb.tar.gz
smap-59ea25e3fe207aaf0e8134b44601a763780109cb.tar.bz2
Bugfixes.
* configure.ac: Fix copy-paste error * lib/wordsplit.c (wordsplit_varnames): Initialize count * modules/ldap/ldap.c (ldap_conf)<protocol>: Change type to long (parse_ldap_conf,mod_ldap_init_db): Fix arguments to smap_error (make_options): Handle ldap_version (parse_ldap_uri): Use wordsplit_ instead of mu_wordsplit_ (ldap_connect): Handle ldap_version setting. Use ldap_unbind_ext instead of the deprecated ldap_unbind. (mod_ldap_free_db,mod_ldap_close): Add missing return statements. (mod_ldap_query): Additional debug output. * src/cmdline.opt: Update copyright years. * src/smapccmd.opt: Likewise.
-rw-r--r--configure.ac2
-rw-r--r--lib/wordsplit.c2
-rw-r--r--modules/ldap/ldap.c39
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/smapccmd.opt2
5 files changed, 28 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 66c9a92..b39e917 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,3 +177,3 @@ if test $status_ldap != no; then
fi
-AM_CONDITIONAL([LDAP_COND],[test $status_postgres = yes])
+AM_CONDITIONAL([LDAP_COND],[test $status_ldap = yes])
diff --git a/lib/wordsplit.c b/lib/wordsplit.c
index 3788c08..c4abc30 100644
--- a/lib/wordsplit.c
+++ b/lib/wordsplit.c
@@ -1394,3 +1394,3 @@ wordsplit_varnames(const char *input, char ***ret_names, int af)
const char *p;
- size_t count;
+ size_t count = 0;
char **names;
diff --git a/modules/ldap/ldap.c b/modules/ldap/ldap.c
index 7935236..2cbde6f 100644
--- a/modules/ldap/ldap.c
+++ b/modules/ldap/ldap.c
@@ -22,3 +22,5 @@
#include <errno.h>
+#include <unistd.h>
#include <ldap.h>
+#include <ctype.h>
#include <smap/stream.h>
@@ -55,3 +57,3 @@ struct ldap_conf {
char *base;
- int protocol;
+ long protocol;
char *cacert;
@@ -211,3 +213,3 @@ parse_ldap_conf(const char *name, struct smap_option const *opt)
else if (!feof(fp)) {
- smap_error("%s:%u: line too long, skipping");
+ smap_error("%s:%u: line too long, skipping", name, line);
while (!feof(fp) && fgetc(fp) != '\n')
@@ -287,3 +289,6 @@ make_options(struct ldap_conf *conf, int flags,
(void*)offsetof(struct ldap_conf, bindpwfile) },
-
+
+ { SMAP_OPTSTR(ldap_version), smap_opt_long,
+ (void*)offsetof(struct ldap_conf, protocol) },
+
{ SMAP_OPTSTR(positive-reply), smap_opt_string,
@@ -406,6 +411,6 @@ parse_ldap_uri(const char *uri)
- if (mu_wordsplit(hostlist, &ws, WRDSF_DEFFLAGS)) {
+ if (wordsplit(hostlist, &ws, WRDSF_DEFFLAGS)) {
smap_error("DNS SRV: could not parse hostlist=\"%s\": %s",
hostlist,
- mu_wordsplit_strerror(&ws));
+ wordsplit_strerror(&ws));
goto dnssrv_free;
@@ -444,3 +449,3 @@ parse_ldap_uri(const char *uri)
dnssrv_free:
- mu_wordsplit_free (&ws);
+ wordsplit_free (&ws);
ber_memfree(hostlist);
@@ -525,5 +530,6 @@ ldap_connect(struct ldap_conf *conf)
- if (conf->protocol)
- ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION,
- &conf->protocol);
+ if (conf->protocol) {
+ int pn = (int) conf->protocol;
+ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &pn);
+ }
@@ -542,3 +548,3 @@ ldap_connect(struct ldap_conf *conf)
if (conf->tls == tls_only) {
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
return NULL;
@@ -553,3 +559,3 @@ ldap_connect(struct ldap_conf *conf)
if (conf->tls == tls_only) {
- ldap_unbind(ld);
+ ldap_unbind_ext(ld, NULL, NULL);
return NULL;
@@ -762,3 +768,3 @@ mod_ldap_init_db(const char *dbid, int argc, char **argv)
wordsplit_varnames(conf.positive_reply, &conf.attrs, 0)) {
- smap_error("%s: can't get attribute names: %s",
+ smap_error("can't get attribute names: %s",
strerror(errno));
@@ -769,3 +775,3 @@ mod_ldap_init_db(const char *dbid, int argc, char **argv)
wordsplit_varnames(conf.negative_reply, &conf.attrs, 1)) {
- smap_error("%s: can't get attribute names: %s",
+ smap_error("can't get attribute names: %s",
strerror(errno));
@@ -776,3 +782,3 @@ mod_ldap_init_db(const char *dbid, int argc, char **argv)
wordsplit_varnames(conf.onerror_reply, &conf.attrs, 1)) {
- smap_error("%s: can't get attribute names: %s",
+ smap_error("can't get attribute names: %s",
strerror(errno));
@@ -811,2 +817,3 @@ mod_ldap_free_db(smap_database_t dbp)
free(db);
+ return 0;
}
@@ -837,2 +844,3 @@ mod_ldap_close(smap_database_t dbp)
db->ldap = NULL;
+ return 0;
}
@@ -882,3 +890,3 @@ getvar(const char *var, size_t len, void *data)
p[values[0]->bv_len] = 0;
- smap_debug(dbgid, 1, ("attr %*.*s=%s", len, len, var, p));
+ smap_debug(dbgid, 1, ("attr %*.*s=%s", (int)len, (int)len, var, p));
ldap_value_free_len(values);
@@ -966,2 +974,3 @@ mod_ldap_query(smap_database_t dbp,
+ smap_debug(dbgid, 2, ("using filter %s", ws.ws_wordv[0]));
rc = ldap_search_ext(db->ldap, db->conf.base, LDAP_SCOPE_SUBTREE,
diff --git a/src/cmdline.opt b/src/cmdline.opt
index 15dffdb..fc0b3ee 100644
--- a/src/cmdline.opt
+++ b/src/cmdline.opt
@@ -19,3 +19,3 @@ OPTIONS_BEGIN("smapd",
[<gnu>],
- [<copyright_year=2009, 2010>],
+ [<copyright_year=2009, 2010, 2014>],
[<copyright_holder=Sergey Poznyakoff>])
diff --git a/src/smapccmd.opt b/src/smapccmd.opt
index ebab1ff..1649147 100644
--- a/src/smapccmd.opt
+++ b/src/smapccmd.opt
@@ -20,3 +20,3 @@ OPTIONS_BEGIN("smapc",
[<gnu>],
- [<copyright_year=2009, 2010>],
+ [<copyright_year=2009, 2010, 2014>],
[<copyright_holder=Sergey Poznyakoff>])

Return to:

Send suggestions and report system problems to the System administrator.