summaryrefslogtreecommitdiff
path: root/nslcd/cfg.c
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2009-12-28 12:18:12 +0000
committerArthur de Jong <arthur@arthurdejong.org>2009-12-28 12:18:12 +0000
commit9c0cf90c858dd020756d7cd51661beedacdf9924 (patch)
tree215b28b4e0f754819590185e02e290df814c5b74 /nslcd/cfg.c
parent93182ac6939bece7e538bc06e5f09f47bcaddf8a (diff)
implement attribute mapping using shell-like expressions
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1041 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nslcd/cfg.c')
-rw-r--r--nslcd/cfg.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index e8a5408..060b566 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -623,7 +623,7 @@ static void parse_map_statement(const char *filename,int lnr,
{
enum ldap_map_selector map;
const char **var;
- char oldatt[32], newatt[32];
+ char oldatt[32], newatt[1024];
/* get the map */
if ((map=get_map(&line))==LM_NONE)
{
@@ -636,19 +636,17 @@ static void parse_map_statement(const char *filename,int lnr,
(get_token(&line,newatt,sizeof(newatt))!=NULL));
/* check that there are no more tokens left on the line */
get_eol(filename,lnr,keyword,&line);
- /* get the attribute variable to set */
+ /* change attribute mapping */
var=attmap_get_var(map,oldatt);
if (var==NULL)
{
log_log(LOG_ERR,"%s:%d: unknown attribute to map: '%s'",filename,lnr,oldatt);
exit(EXIT_FAILURE);
}
- /* check if the value will be changed */
- if ( (*var==NULL) || (strcmp(*var,newatt)!=0) )
+ if (attmap_set_mapping(var,newatt)==NULL)
{
- /* Note: we have a memory leak here if a single mapping is changed
- multiple times in one config (deemed not a problem) */
- *var=xstrdup(newatt);
+ log_log(LOG_ERR,"%s:%d: attribute %s cannot be an expression",filename,lnr,oldatt);
+ exit(EXIT_FAILURE);
}
}