summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Olson <olson@cumulusnetworks.com>2017-05-25 12:58:38 -0700
committerDave Olson <olson@cumulusnetworks.com>2017-05-25 13:52:34 -0700
commit86f2c6782d0e59e633ec7ae44132fc4f46a32aaa (patch)
treef186977c6fef41d3e63f661009615bdd5002bf46
parent42330b84d2c146abb1b3118670d25f24f9a2b23d (diff)
downloadlibnss-tacplus-86f2c6782d0e59e633ec7ae44132fc4f46a32aaa.tar.gz
libnss-tacplus-86f2c6782d0e59e633ec7ae44132fc4f46a32aaa.zip
When re-using a secret key for multiple servers, strdup, don't copy
Otherwise when reconfiguring when we detect a changed config file, we'll double free the strdup'ed memory.
-rw-r--r--nss_tacplus.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nss_tacplus.c b/nss_tacplus.c
index 82d5902..7a632cd 100644
--- a/nss_tacplus.c
+++ b/nss_tacplus.c
@@ -260,7 +260,8 @@ static int nss_tacplus_config(int *errnop, const char *cfile, int top)
tac_srv[tac_srv_no].addr = server;
/* use current key, if our index not yet set */
if(tac_key_no && !tac_srv[tac_srv_no].key)
- tac_srv[tac_srv_no].key = tac_srv[tac_key_no-1].key;
+ tac_srv[tac_srv_no].key =
+ strdup(tac_srv[tac_key_no-1].key);
tac_srv_no++;
}
}