diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-10-09 17:58:33 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-10-09 17:58:33 +0300 |
commit | f88aa8437de7e756aa5b8eb052ae4649bb3891cb (patch) | |
tree | 3030799fa8f8e6690bd71964c8de2c840dfa9d56 /lib | |
parent | ba2c9a15f42437c051738ca93d7129245791d660 (diff) | |
download | eclat-f88aa8437de7e756aa5b8eb052ae4649bb3891cb.tar.gz eclat-f88aa8437de7e756aa5b8eb052ae4649bb3891cb.tar.bz2 |
Improve the docs.
* doc/eclat.conf.5: New file.
* doc/Makefile.am: Add new file.
* doc/eclat.1: Update.
* lib/expand.c (eclat_expand_kw): New macro: login.
* lib/filemap.c: Add the "key" statement.
* lib/gdbmmap.c: Likewise.
* lib/ldapmap.c: Likewise.
(ldap_map_open): Always expand binddn.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/expand.c | 11 | ||||
-rw-r--r-- | lib/filemap.c | 4 | ||||
-rw-r--r-- | lib/gdbmmap.c | 2 | ||||
-rw-r--r-- | lib/ldapmap.c | 20 |
4 files changed, 22 insertions, 15 deletions
diff --git a/lib/expand.c b/lib/expand.c index 2db35e0..8a26816 100644 --- a/lib/expand.c +++ b/lib/expand.c @@ -27,7 +27,7 @@ eclat_expand_kw(const char *input, const char **ukw) struct wordsplit ws; char *ret; static char **defkw; - static size_t defkwsize = 4; + static size_t defkwsize = 6; const char **kw; size_t kwsize; int i; @@ -40,10 +40,12 @@ eclat_expand_kw(const char *input, const char **ukw) "cannot determine user name (uid=%lu)", (unsigned long) uid); defkw = grecs_calloc(defkwsize, sizeof(defkw[0])); - defkw[0] = "user"; + defkw[0] = "login"; defkw[1] = grecs_strdup(pw->pw_name); - defkw[2] = "home"; - defkw[3] = grecs_strdup(pw->pw_dir); + defkw[2] = "user"; + defkw[3] = grecs_strdup(pw->pw_name); + defkw[4] = "home"; + defkw[5] = grecs_strdup(pw->pw_dir); } if (ukw) { @@ -67,6 +69,7 @@ eclat_expand_kw(const char *input, const char **ukw) WRDSF_ENV | WRDSF_ENV_KV | WRDSF_WARNUNDEF | WRDSF_ERROR)) die(EX_SOFTWARE, "error expanding pattern %s: %s", input, wordsplit_strerror(&ws)); + free(kw); ret = ws.ws_wordv[0]; ws.ws_wordv[0] = NULL; diff --git a/lib/filemap.c b/lib/filemap.c index aa2fa6d..f1d726b 100644 --- a/lib/filemap.c +++ b/lib/filemap.c @@ -24,8 +24,8 @@ struct filemap { }; static struct grecs_keyword filemap_kw[] = { - { "type", "'file", "Set map type", - grecs_type_null }, + { "type", "'file", "Set map type", grecs_type_null }, + { "key", "<arg: string>", "key expression", grecs_type_null }, { "file", NULL, "File name", grecs_type_string, GRECS_DFLT, NULL, offsetof(struct filemap, name) }, diff --git a/lib/gdbmmap.c b/lib/gdbmmap.c index 7ecb88c..1abebe6 100644 --- a/lib/gdbmmap.c +++ b/lib/gdbmmap.c @@ -30,6 +30,8 @@ struct gdbm_map { static struct grecs_keyword gdbm_map_kw[] = { { "type", "'gdbm", "Set map type", grecs_type_null }, + { "key", "<arg: string>", "key expression", + grecs_type_null }, { "file", NULL, "Database file name", grecs_type_string, GRECS_DFLT, NULL, offsetof(struct gdbm_map, name) }, diff --git a/lib/ldapmap.c b/lib/ldapmap.c index 590a111..1f08179 100644 --- a/lib/ldapmap.c +++ b/lib/ldapmap.c @@ -73,6 +73,7 @@ static char *typestr; static struct grecs_keyword ldapmap_kw[] = { { "type", "'ldap", "Set map type", grecs_type_null }, + { "key", "<arg: string>", "key expression", grecs_type_null }, { "uri", "arg", "Set LDAP URI", grecs_type_string, GRECS_DFLT, @@ -463,17 +464,18 @@ ldap_map_open(int dbg, void *data) p = eclat_getans("User name", user, 0); free(user); user = p; - if (map->binddn) { - kw[0] = "user"; - kw[1] = user; - kw[2] = NULL; - p = eclat_expand_kw(map->binddn, kw); - } else - p = grecs_strdup(user); - free(map->binddn); - map->binddn = p; } + if (map->binddn) { + kw[0] = "user"; + kw[1] = user; + kw[2] = NULL; + p = eclat_expand_kw(map->binddn, kw); + free(map->binddn); + map->binddn = p; + } else + map->binddn = grecs_strdup(user); + if (map->passfile) { char *filename = eclat_expand_kw(map->passfile, kw); FILE *fp = fopen(filename, "r"); |