summaryrefslogtreecommitdiff
path: root/support.c
diff options
context:
space:
mode:
authorJeroen Nijhof <jeroen@jeroennijhof.nl>2012-11-02 15:47:58 +0100
committerJeroen Nijhof <jeroen@jeroennijhof.nl>2012-11-02 15:47:58 +0100
commit468b90c5e0d7f7ce925459a9721f5151c15d27c7 (patch)
tree957f9030bcbb1f8760907e0cf7aaa98c7b67b82e /support.c
parent78271681be442cdd06c015dca23b913b809e2e86 (diff)
downloadpam_tacplus-468b90c5e0d7f7ce925459a9721f5151c15d27c7.tar.gz
pam_tacplus-468b90c5e0d7f7ce925459a9721f5151c15d27c7.zip
Added port option
Diffstat (limited to 'support.c')
-rw-r--r--support.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/support.c b/support.c
index c26e4e4..e28dc71 100644
--- a/support.c
+++ b/support.c
@@ -228,11 +228,15 @@ int _pam_parse (int argc, const char **argv) {
if(tac_srv_no < TAC_PLUS_MAXSERVERS) {
struct addrinfo hints, *servers, *server;
int rv;
+ char *port;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // use IPv4 or IPv6, whichever
hints.ai_socktype = SOCK_STREAM;
- if ((rv = getaddrinfo(*argv + 7, "49", &hints, &servers)) == 0) {
+ port = strchr(*argv + 7, ':');
+ if(port)
+ *port = '\0';
+ if ((rv = getaddrinfo(*argv + 7, (port == NULL ? "49" : port+1), &hints, &servers)) == 0) {
for(server = servers; server != NULL; server = server->ai_next) {
tac_srv[tac_srv_no] = server;
tac_srv_no++;