diff mbox

[2/3] libsi: Handle multiple records in an SRV reply

Message ID 20131007163614.3621.93135.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Oct. 7, 2013, 4:36 p.m. UTC
getservinfo() incorrectly returns ESI_PARSE when a domain has
multiple SRV records.  After each record in the buffer is parsed,
"comp_dn" was not being incremented correctly.  Only the first
record was parsed correctly.

Introduced by commit 0520ee72, "Initial commit," Mar 29 15:37:40
2011.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 src/libsi/getsrvinfo.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/src/libsi/getsrvinfo.c b/src/libsi/getsrvinfo.c
index 931847e..c0f433f 100644
--- a/src/libsi/getsrvinfo.c
+++ b/src/libsi/getsrvinfo.c
@@ -265,16 +265,17 @@  getsrvinfo(const char *srvname, const char *domainname, struct srvinfo **si)
 			status = ESI_PARSE;
 			goto out_free;
 		}
-
 		comp_dn += l;
 
 		record = (struct srv *)&comp_dn[10];
+		comp_dn += 16;
 
-		l = dn_expand(msg, msg + len, comp_dn + 16, exp_dn, NS_MAXDNAME);
+		l = dn_expand(msg, msg + len, comp_dn, exp_dn, NS_MAXDNAME);
 		if (l == -1) {
 			status = ESI_PARSE;
 			goto out_free;
 		}
+		comp_dn += l;
 
 		if (count == 1 && strcmp(exp_dn, ".") == 0) {
 			status = ESI_SERVICE;