Juha Heinanen wrote:
Klaus Darilion writes:
> Hi Juha - any news on this?
yes, my answer was that if the patch includes support for TXT DNS
records, that part of the code need to go into core resolve.c where all
RRs are implemented, not in modules.
it is already
regards
klaus
Index: resolve.c
===================================================================
RCS file: /cvsroot/openser/sip-server/resolve.c,v
retrieving revision 1.6
diff -u -r1.6 resolve.c
--- resolve.c 14 Feb 2006 21:43:44 -0000 1.6
+++ resolve.c 15 May 2006 14:37:16 -0000
@@ -293,6 +293,91 @@
return 0;
}
+/* RFC1035:
+ *
+ * <character-string> is a single length octet followed by that number
of characters.
+ * TXT-DATA One or more <character-string>s.
+ *
+ * We only take the first string here.
+ */
+/* parses a TXT record into a txt_rdata structure */
+struct txt_rdata* dns_txt_parser( unsigned char* msg, unsigned char* end,
+
unsigned char* rdata)
+{
+ struct txt_rdata* txt;
+ int len;
+
+ txt=0;
+ txt=(struct txt_rdata*)local_malloc(sizeof(struct txt_rdata));
+ if(txt==0){
+ LOG(L_ERR, "ERROR: dns_txt_parser: out of memory\n");
+ goto error;
+ }
+
+ len = *rdata;
+ if (rdata + 1 + len >= end) goto error; /* something fishy in the
record */
+ if (len >= sizeof(txt->txt)) goto error; /* not enough space? */
+ memcpy(txt->txt, rdata+1, len);
+ txt->txt[len] = 0; /* 0-terminate string */
+ return txt;
+
+error:
+ if (txt) local_free(txt);
+ return 0;
+}
+
--
Klaus Darilion
nic.at
_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel