Skip to content

Commit

Permalink
Add IPv6 Support in TACACS (sonic-net#3395)
Browse files Browse the repository at this point in the history
* Add patch to support IPv6

* Add support for IPv6

* Remove in-correct changes by IPv6 support patch
  • Loading branch information
SuvarnaMeenakshi authored and sridhar-ravindran committed Sep 6, 2019
1 parent 2c3d3de commit 8772ef4
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From aa8af2b2400b7bbcbe7af0cb50047a98e93660ca Mon Sep 17 00:00:00 2001
From: SuvarnaMeenakshi <sumeenak@microsoft.com>
Date: Thu, 29 Aug 2019 09:44:24 -0700
Subject: [PATCH] libnss: Modify parsing of IP addr and port number string to
support IPv6

---
nss_tacplus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nss_tacplus.c b/nss_tacplus.c
index f2a86e1..3ff3c35 100644
--- a/nss_tacplus.c
+++ b/nss_tacplus.c
@@ -98,7 +98,7 @@ static int parse_tac_server(char *srv_buf)
hints.ai_socktype = SOCK_STREAM;

srv = token + 7;
- port = strchr(srv, ':');
+ port = strrchr(srv, ':');
if(port) {
*port = '\0';
port++;
--
2.17.1

1 change: 1 addition & 0 deletions src/tacacs/nss/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
git $(GIT_APPLY) ../0002-Enable-modifying-local-user-permission.patch
git $(GIT_APPLY) ../0003-management-vrf-support.patch
git $(GIT_APPLY) ../0004-Skip-accessing-tacacs-servers-for-local-non-tacacs-u.patch
git $(GIT_APPLY) ../0005-libnss-Modify-parsing-of-IP-addr-and-port-number-str.patch

dpkg-buildpackage -rfakeroot -b -us -uc
popd
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 264de96e8a1c411371f9fc20b0b5b00c10e7052d Mon Sep 17 00:00:00 2001
From: SuvarnaMeenakshi <sumeenak@microsoft.com>
Date: Thu, 29 Aug 2019 09:51:43 -0700
Subject: [PATCH] pam: Modify parsing of IP address and port number to support
IPv6

---
support.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/support.c b/support.c
index 44efee3..7c00618 100644
--- a/support.c
+++ b/support.c
@@ -225,11 +226,11 @@ int _pam_parse (int argc, const char **argv) {

if (*server_buf == '[' && (close_bracket = strchr(server_buf, ']')) != NULL) { /* Check for URI syntax */
server_name = server_buf + 1;
- port = strchr(close_bracket, ':');
+ port = strrchr(close_bracket, ':');
*close_bracket = '\0';
} else { /* Fall back to traditional syntax */
server_name = server_buf;
- port = strchr(server_buf, ':');
+ port = strrchr(server_buf, ':');
}
if (port != NULL) {
*port = '\0';
--
2.17.1

1 change: 1 addition & 0 deletions src/tacacs/pam/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
git apply ../0002-Fix-libtac2-bin-install-directory-error.patch
git apply ../0003-Obfuscate-key-before-printing-to-syslog.patch
git apply ../0004-management-vrf-support.patch
git apply ../0005-pam-Modify-parsing-of-IP-address-and-port-number-to-.patch

dpkg-buildpackage -rfakeroot -b -us -uc
popd
Expand Down

0 comments on commit 8772ef4

Please sign in to comment.