diff options
author | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2012-11-02 15:47:58 +0100 |
---|---|---|
committer | Jeroen Nijhof <jeroen@jeroennijhof.nl> | 2012-11-02 15:47:58 +0100 |
commit | 468b90c5e0d7f7ce925459a9721f5151c15d27c7 (patch) | |
tree | 957f9030bcbb1f8760907e0cf7aaa98c7b67b82e /support.c | |
parent | 78271681be442cdd06c015dca23b913b809e2e86 (diff) | |
download | pam_tacplus-468b90c5e0d7f7ce925459a9721f5151c15d27c7.tar.gz pam_tacplus-468b90c5e0d7f7ce925459a9721f5151c15d27c7.zip |
Added port option
Diffstat (limited to 'support.c')
-rw-r--r-- | support.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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++; |