aboutsummaryrefslogtreecommitdiff
path: root/modules/ldap/ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ldap/ldap.c')
-rw-r--r--modules/ldap/ldap.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/modules/ldap/ldap.c b/modules/ldap/ldap.c
index d686f6b..b34c560 100644
--- a/modules/ldap/ldap.c
+++ b/modules/ldap/ldap.c
@@ -108,7 +108,7 @@ argz_copy(char ***dst, char **a)
for (n = 0; a[n]; n++)
;
- b = calloc(i + 1, sizeof(b[0]));
+ b = calloc(n + 1, sizeof(b[0]));
if (!b)
return -1;
for (i = 0; i < n; i++) {
@@ -200,7 +200,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt)
}
line = 0;
- while (p = fgets(buf, sizeof(buf), fp)) {
+ while ((p = fgets(buf, sizeof(buf), fp))) {
size_t len;
char *errmsg;
@@ -254,6 +254,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt)
return rc;
}
+#if 0
static int
readconf(struct smap_option const *opt, const char *val, char **errmsg)
{
@@ -262,6 +263,7 @@ readconf(struct smap_option const *opt, const char *val, char **errmsg)
*errmsg = "parse error";
return rc;
}
+#endif
#define MKOPT_DEFAULT 0
#define MKOPT_REUSE 0x01
@@ -502,8 +504,6 @@ ldap_connect(struct ldap_conf *conf)
int rc;
char *ldapuri = NULL;
LDAP *ld = NULL;
- char *val;
- unsigned long lval;
if (ldap_debug_level) {
if (ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL,
@@ -605,22 +605,20 @@ full_read(int fd, char *file, char *buf, size_t size)
static int
get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc)
{
- char *file;
-
if (conf->bindpwfile) {
struct stat st;
int fd, rc;
char *mem, *p;
- fd = open(file, O_RDONLY);
+ fd = open(conf->bindpwfile, O_RDONLY);
if (fd == -1) {
smap_error("can't open password file %s: %s",
- file, strerror(errno));
+ conf->bindpwfile, strerror(errno));
return -1;
}
if (fstat(fd, &st)) {
smap_error("can't stat password file %s: %s",
- file, strerror(errno));
+ conf->bindpwfile, strerror(errno));
close(fd);
return -1;
}
@@ -631,7 +629,7 @@ get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc)
close(fd);
return -1;
}
- rc = full_read(fd, file, mem, st.st_size);
+ rc = full_read(fd, conf->bindpwfile, mem, st.st_size);
close(fd);
if (rc)
return rc;
@@ -731,7 +729,6 @@ ldap_bind(LDAP *ld, struct ldap_conf *conf)
static smap_database_t
mod_ldap_init_db(const char *dbid, int argc, char **argv)
{
- LDAP *ldap;
struct ldap_db *db;
struct ldap_conf conf;
size_t i, j;
@@ -880,7 +877,6 @@ getvar(const char *var, size_t len, void *data)
}
if (gd->ld) {
- struct berval bv;
char *p;
struct berval **values;
char *attr = malloc(len+1);
@@ -989,12 +985,9 @@ mod_ldap_query(smap_database_t dbp,
{
struct ldap_db *db = (struct ldap_db *) dbp;
char const *inenv[5];
- char **env;
- char **attrs;
struct wordsplit ws;
ber_int_t msgid;
int rc;
- char *reply = NULL;
LDAPMessage *res, *msg;
# define __smap_s_cat2__(a,b) a ## b

Return to:

Send suggestions and report system problems to the System administrator.