You can subscribe to this list here.
2005 |
Jan
|
Feb
(32) |
Mar
(56) |
Apr
(92) |
May
(39) |
Jun
(226) |
Jul
(98) |
Aug
(66) |
Sep
|
Oct
(153) |
Nov
(43) |
Dec
(42) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(97) |
Feb
(141) |
Mar
(147) |
Apr
(80) |
May
(51) |
Jun
(93) |
Jul
(88) |
Aug
(50) |
Sep
(179) |
Oct
(48) |
Nov
(82) |
Dec
(71) |
2007 |
Jan
(42) |
Feb
(46) |
Mar
(123) |
Apr
(21) |
May
(139) |
Jun
(59) |
Jul
(34) |
Aug
(57) |
Sep
(47) |
Oct
(137) |
Nov
(49) |
Dec
(12) |
2008 |
Jan
(10) |
Feb
(8) |
Mar
(63) |
Apr
(17) |
May
(34) |
Jun
(38) |
Jul
(16) |
Aug
(62) |
Sep
(9) |
Oct
(121) |
Nov
(38) |
Dec
(4) |
2009 |
Jan
|
Feb
(11) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(4) |
Apr
(10) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(12) |
2012 |
Jan
(26) |
Feb
(1) |
Mar
(15) |
Apr
(1) |
May
(1) |
Jun
(7) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
(52) |
Nov
(8) |
Dec
(25) |
2013 |
Jan
(35) |
Feb
(14) |
Mar
(10) |
Apr
(10) |
May
(29) |
Jun
(16) |
Jul
(5) |
Aug
(8) |
Sep
(8) |
Oct
(6) |
Nov
(1) |
Dec
(3) |
2014 |
Jan
(16) |
Feb
(13) |
Mar
(5) |
Apr
(9) |
May
(21) |
Jun
(6) |
Jul
(5) |
Aug
(2) |
Sep
(59) |
Oct
(115) |
Nov
(122) |
Dec
(45) |
2015 |
Jan
(31) |
Feb
(32) |
Mar
(19) |
Apr
(25) |
May
(3) |
Jun
(4) |
Jul
(18) |
Aug
(3) |
Sep
(23) |
Oct
(11) |
Nov
(17) |
Dec
(12) |
2016 |
Jan
(20) |
Feb
(27) |
Mar
(20) |
Apr
(40) |
May
(35) |
Jun
(48) |
Jul
(44) |
Aug
(51) |
Sep
(18) |
Oct
(42) |
Nov
(39) |
Dec
(29) |
2017 |
Jan
(37) |
Feb
(34) |
Mar
(20) |
Apr
(37) |
May
(10) |
Jun
(2) |
Jul
(14) |
Aug
(15) |
Sep
(25) |
Oct
(29) |
Nov
(15) |
Dec
(29) |
2018 |
Jan
(5) |
Feb
(15) |
Mar
(6) |
Apr
(20) |
May
(39) |
Jun
(39) |
Jul
(17) |
Aug
(20) |
Sep
(10) |
Oct
(17) |
Nov
(20) |
Dec
(8) |
2019 |
Jan
(28) |
Feb
(21) |
Mar
(13) |
Apr
(44) |
May
(44) |
Jun
(28) |
Jul
(51) |
Aug
(30) |
Sep
(7) |
Oct
(20) |
Nov
(8) |
Dec
(21) |
2020 |
Jan
(27) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Stephen D. <sd...@us...> - 2005-06-18 01:03:27
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15865/tests Modified Files: ns_urlencode.test Removed Files: harness.tcl Log Message: Use Tcl style tests and remove old harness. --- harness.tcl DELETED --- Index: ns_urlencode.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_urlencode.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_urlencode.test 12 Apr 2005 03:53:02 -0000 1.1 --- ns_urlencode.test 18 Jun 2005 01:03:17 -0000 1.2 *************** *** 4,130 **** - source harness.tcl - load libnsd.so package require tcltest 2.2 namespace import -force ::tcltest::* ! test ns_urlencode-1.1 {Basic sanity checks} { - # rfc2396 unreserved URI characters, except for + which receives - # special treatment by the HTTP URL scheme. - set unreserved "-.!~*'()0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ! assertEquals "" [ns_urlencode ""] ! assertEquals "" [ns_urlencode -part path ""] ! assertEquals "" [ns_urlencode -part query ""] ! assertEquals "" [ns_urldecode ""] ! assertEquals "" [ns_urldecode -part path ""] ! assertEquals "" [ns_urldecode -part query ""] ! assertEquals $unreserved [ns_urlencode $unreserved] ! assertEquals $unreserved [ns_urldecode $unreserved] ! assertEquals "1/2/3" [ns_urlencode -part path 1 2 3] ! assertEquals "1&2&3" [ns_urlencode -part query 1 2 3] ! assertEquals "1&2&3" [ns_urlencode 1 2 3] - assertEquals "1" [ns_urldecode "1"] - assertEquals "1" [ns_urldecode -part path "1"] - assertEquals "1" [ns_urldecode -part query "1"] ! } {} ! test ns_urlencode-2.1 {Spaces and plus signs} { ! assertEquals "+" [ns_urlencode -part path +] ! assertEquals "%2b" [string tolower [ns_urlencode -part query +]] ! assertEquals "%2b" [string tolower [ns_urlencode +]] ! assertEquals "%20" [ns_urlencode -part path " "] ! assertEquals "+" [ns_urlencode -part query " "] ! assertEquals "+" [ns_urlencode " "] ! assertEquals "+" [ns_urldecode -part path +] ! assertEquals " " [ns_urldecode -part query +] ! assertEquals " " [ns_urldecode +] ! assertEquals " " [ns_urldecode -part path " "] ! assertEquals " " [ns_urldecode -part query " "] ! assertEquals " " [ns_urldecode " "] ! assertEquals " " [ns_urldecode -part path "%20"] ! assertEquals " " [ns_urldecode -part query "%20"] ! assertEquals " " [ns_urldecode "%20"] - assertEquals "+" [ns_urldecode -part path "%2b"] - assertEquals "+" [ns_urldecode -part query "%2b"] - assertEquals "+" [ns_urldecode "%2b"] - assertEquals "+" [ns_urldecode "%2B"] ! } {} - test ns_urlencode-3.1 {rfc2396 section 2.4.3 URI 'delim' characters} { ! assertEquals "%3c" [string tolower [ns_urlencode -part path "<"]] ! assertEquals "%3e" [string tolower [ns_urlencode -part path ">"]] ! assertEquals "%23" [string tolower [ns_urlencode -part path "\#"]] ! assertEquals "%25" [string tolower [ns_urlencode -part path "%"]] ! assertEquals "%22" [string tolower [ns_urlencode -part path "\""]] ! } {} - test ns_urlencode-4.1 {rfc2396 section 2.4.3 URI 'unwise' characters} { ! assertEquals "%7b" [string tolower [ns_urlencode -part path "{"]] ! assertEquals "%7d" [string tolower [ns_urlencode -part path "}"]] ! assertEquals "%7c" [string tolower [ns_urlencode -part path "|"]] ! assertEquals "%5c" [string tolower [ns_urlencode -part path "\\"]] ! assertEquals "%5e" [string tolower [ns_urlencode -part path "^"]] ! assertEquals "%5b" [string tolower [ns_urlencode -part path "\["]] ! assertEquals "%5d" [string tolower [ns_urlencode -part path "\]"]] ! assertEquals "%60" [string tolower [ns_urlencode -part path "`"]] ! } {} ! test ns_urlencode-5.1 {rfc2396 section 3.3 URI path component reserved characters} { ! assertEquals "%2f" [string tolower [ns_urlencode -part path "/"]] ! assertEquals "%3f" [string tolower [ns_urlencode -part path "?"]] ! assertEquals "%3b" [string tolower [ns_urlencode -part path ";"]] ! assertEquals "%3d" [string tolower [ns_urlencode -part path "="]] ! assertEquals ":" [ns_urlencode -part path ":"] ! assertEquals "@" [ns_urlencode -part path "@"] ! assertEquals "&" [ns_urlencode -part path "&"] ! assertEquals "+" [ns_urlencode -part path "+"] ! assertEquals "$" [ns_urlencode -part path "$"] ! assertEquals "," [ns_urlencode -part path ","] ! } {} ! test ns_urlencode-6.1 {rfc2396 section 3.4 URI query component reserved characters} { ! assertEquals "%3b" [string tolower [ns_urlencode -part query ";"]] ! assertEquals "%2f" [string tolower [ns_urlencode -part query "/"]] ! assertEquals "%3f" [string tolower [ns_urlencode -part query "?"]] ! assertEquals "%3a" [string tolower [ns_urlencode -part query ":"]] ! assertEquals "%40" [string tolower [ns_urlencode -part query "@"]] ! assertEquals "%26" [string tolower [ns_urlencode -part query "&"]] ! assertEquals "%3d" [string tolower [ns_urlencode -part query "="]] ! assertEquals "%2b" [string tolower [ns_urlencode -part query "+"]] ! assertEquals "%2c" [string tolower [ns_urlencode -part query ","]] ! assertEquals "%24" [string tolower [ns_urlencode -part query "$"]] - } {} --- 4,199 ---- package require tcltest 2.2 namespace import -force ::tcltest::* + eval ::tcltest::configure $argv ! # rfc2396 unreserved URI characters, except for + which receives ! # special treatment by the HTTP URL scheme. ! set unreservedChars "-.!~*'()0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ! test ns_urlencode-1.1.1 {basic syntax} -body { ! ns_urlencode ! } -returnCodes error -result {wrong # args: should be "ns_urlencode ?-part part? ?--? component"} ! test ns_urlencode-1.1.2 {basic syntax} -body { ! ns_urlencode -part x y ! } -returnCodes error -result {bad option "x": must be query or path} ! test ns_urlencode-1.2.1 {basic syntax} -body { ! ns_urldecode ! } -returnCodes error -result {wrong # args: should be "ns_urldecode ?-part part? ?--? component"} ! test ns_urlencode-1.2.2 {basic syntax} -body { ! ns_urldecode -part x y ! } -returnCodes error -result {bad option "x": must be query or path} ! test ns_urlencode-2.1.1 {basic operation} -body { ! ns_urlencode "" ! } -result {} + test ns_urlencode-2.1.2 {basic operation} -body { + ns_urlencode -part path "" + } -result {} ! test ns_urlencode-2.1.3 {basic operation} -body { ! ns_urlencode -part query "" ! } -result {} ! test ns_urlencode-2.2.1 {basic operation} -body { ! ns_urldecode "" ! } -result {} ! test ns_urlencode-2.2.2 {basic operation} -body { ! ns_urldecode -part path "" ! } -result {} + test ns_urlencode-2.2.3 {basic operation} -body { + ns_urldecode -part query "" + } -result {} ! test ns_urlencode-2.2.4 {basic operation} -body { ! ns_urldecode "1" ! } -result {1} ! test ns_urlencode-2.2.5 {basic operation} -body { ! ns_urldecode -part path "1" ! } -result {1} ! test ns_urlencode-2.2.6 {basic operation} -body { ! ns_urldecode -part query "1" ! } -result {1} ! test ns_urlencode-2.3.1 {unreserved characters} -body { ! ns_urlencode $unreservedChars ! } -result $unreservedChars + test ns_urlencode-2.3.2 {unreserved characters} -body { + ns_urldecode $unreservedChars + } -result $unreservedChars ! test ns_urlencode-2.4.1 {multiple args} -body { ! ns_urlencode -part path 1 2 3 ! } -result {1/2/3} ! test ns_urlencode-2.4.2 {multiple args} -body { ! ns_urlencode -part query 1 2 3 ! } -result {1&2&3} + test ns_urlencode-2.4.3 {multiple args} -body { + ns_urlencode 1 2 3 + } -result {1&2&3} ! test ns_urlencode-2.5.1 {spaces and plus signs} -body { ! ns_urlencode -part path + ! } -result {+} ! test ns_urlencode-2.5.2 {spaces and plus signs} -body { ! ns_urlencode -part query + ! } -result {%2b} + test ns_urlencode-2.5.3 {spaces and plus signs} -body { + ns_urlencode + + } -result {%2b} ! test ns_urlencode-2.5.4 {spaces and plus signs} -body { ! ns_urlencode -part path " " ! } -result {%20} ! test ns_urlencode-2.5.5 {spaces and plus signs} -body { ! ns_urlencode -part query " " ! } -result {+} ! test ns_urlencode-2.5.6 {spaces and plus signs} -body { ! ns_urlencode " " ! } -result {+} ! test ns_urlencode-2.5.7 {spaces and plus signs} -body { ! ns_urldecode -part path + ! } -result {+} + test ns_urlencode-2.5.8 {spaces and plus signs} -body { + ns_urldecode -part query + + } -result { } ! test ns_urlencode-2.5.9 {spaces and plus signs} -body { ! ns_urldecode + ! } -result { } ! test ns_urlencode-2.5.10 {spaces and plus signs} -body { ! ns_urldecode -part path " " ! } -result { } ! ! test ns_urlencode-2.5.11 {spaces and plus signs} -body { ! ns_urldecode -part query " " ! } -result { } ! ! test ns_urlencode-2.5.12 {spaces and plus signs} -body { ! ns_urldecode " " ! } -result { } ! ! test ns_urlencode-2.5.10 {spaces and plus signs} -body { ! ns_urldecode -part path "%20" ! } -result { } ! ! test ns_urlencode-2.5.11 {spaces and plus signs} -body { ! ns_urldecode -part query "%20" ! } -result { } ! ! test ns_urlencode-2.5.12 {spaces and plus signs} -body { ! ns_urldecode "%20" ! } -result { } ! ! test ns_urlencode-2.5.13 {spaces and plus signs} -body { ! ns_urldecode -part path "%2b" ! } -result {+} ! ! test ns_urlencode-2.5.14 {spaces and plus signs} -body { ! ns_urldecode -part query "%2b" ! } -result {+} ! ! test ns_urlencode-2.5.15 {spaces and plus signs} -body { ! ns_urldecode "%2b" ! } -result {+} ! ! test ns_urlencode-2.5.16 {spaces and plus signs} -body { ! ns_urldecode "%2B" ! } -result {+} ! ! ! test ns_urlencode-2.6.1 {rfc2396 section 2.4.3 URI 'delim' characters} -body { ! ns_urlencode -part path "<>\#%\"" ! } -result {%3c%3e%23%25%22} ! ! ! test ns_urlencode-2.7.1 {rfc2396 section 2.4.3 URI 'unwise' characters} -body { ! ns_urlencode -part path {{}|\^[]`} ! } -result {%7b%7d%7c%5c%5e%5b%5d%60} ! ! ! test ns_urlencode-2.8.1 {rfc2396 section 3.3 URI path component reserved characters} -body { ! ns_urlencode -part path {/?;=} ! } -result {%2f%3f%3b%3d} ! ! test ns_urlencode-2.8.2 {path component unreserved characters} -body { ! ns_urlencode -part path {:@&+$,} ! } -result {:@&+$,} ! ! ! test ns_urlencode-2.9.1 {rfc2396 section 3.4 URI query component reserved characters} -body { ! ns_urlencode -part query {;/?:@&=+,$} ! } -result {%3b%2f%3f%3a%40%26%3d%2b%2c%24} ! ! ! ! unset unreservedChars |
From: Stephen D. <sd...@us...> - 2005-06-18 01:03:27
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15865 Modified Files: ChangeLog Log Message: Use Tcl style tests and remove old harness. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** ChangeLog 17 Jun 2005 19:56:34 -0000 1.123 --- ChangeLog 18 Jun 2005 01:03:16 -0000 1.124 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-17 Stephen Deasey <sd...@us...> + + * tests/harness.tcl: + * tests/ns_urlencode.test: Use Tcl style tests and remove old harness. + 2005-06-17 Vlad Seryakov <ser...@us...> |
From: Vlad S. <ser...@us...> - 2005-06-17 19:56:43
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8567 Modified Files: ChangeLog sample-config.tcl Log Message: added maxinput and bufsize parameters for nsssock section Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** ChangeLog 16 Jun 2005 18:33:24 -0000 1.122 --- ChangeLog 17 Jun 2005 19:56:34 -0000 1.123 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-17 Vlad Seryakov <ser...@us...> + + * sample-config.tcl: added maxinput and bufsize parameters + for nssock section + 2005-06-16 Zoran Vasiljevic <vas...@us...> Index: sample-config.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/sample-config.tcl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sample-config.tcl 9 Jun 2005 00:01:22 -0000 1.3 --- sample-config.tcl 17 Jun 2005 19:56:34 -0000 1.4 *************** *** 207,211 **** ns_param hostname $hostname ns_param address $address ! # --- 207,212 ---- ns_param hostname $hostname ns_param address $address ! #ns_param maxinput 1024000 ;# Max upload size ! #ns_param bufsize 16000 ;# Read-ahead buffer size # |
From: Vlad S. <ser...@us...> - 2005-06-17 15:00:49
|
Update of /cvsroot/naviserver/modules/nsdns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14829 Modified Files: dns.c dns.h Log Message: NAPTR bugfixes Index: dns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dns.c 17 Jun 2005 04:44:58 -0000 1.6 --- dns.c 17 Jun 2005 15:00:23 -0000 1.7 *************** *** 469,474 **** y->data.naptr->flags = ns_strcopy(flags); y->data.naptr->service = ns_strcopy(service); ! y->data.naptr->regexp = ns_strcopy(regexp ? regexp : ""); ! y->data.naptr->replace = ns_strcopy(replace ? replace : ""); y->len = 2; if(y->data.name) y->len += strlen(y->data.name); --- 469,474 ---- y->data.naptr->flags = ns_strcopy(flags); y->data.naptr->service = ns_strcopy(service); ! y->data.naptr->regexp = ns_strcopy(regexp && *regexp ? regexp : 0); ! y->data.naptr->replace = ns_strcopy(replace && *replace ? replace : 0); y->len = 2; if(y->data.name) y->len += strlen(y->data.name); *************** *** 651,654 **** --- 651,668 ---- int + dnsParseString(dnsPacket *pkt,char **buf) + { + int len; + + if(!(len = *pkt->buf.ptr++)) return 0; + if(pkt->buf.ptr+len > pkt->buf.data+pkt->buf.allocated) return -1; + *buf = ns_malloc(len+1); + strncpy(*buf,pkt->buf.ptr,len); + (*buf)[len] = 0; + pkt->buf.ptr += len; + return 0; + } + + int dnsParseName(dnsPacket *pkt,char **ptr,char *buf,int buflen,int pos,int level) { *************** *** 790,801 **** pkt->buf.ptr += 2; /* flags */ ! if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; ! y->data.naptr->flags = ns_strdup(name); /* service */ ! if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; ! y->data.naptr->service = ns_strdup(name); /* regexp */ ! if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; ! y->data.naptr->regexp = ns_strdup(name); /* replace */ if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; --- 804,821 ---- pkt->buf.ptr += 2; /* flags */ ! if(dnsParseString(pkt,&y->data.naptr->flags) < 0) { ! strcpy(name,"invalid NAPTR flags len"); ! goto err; ! } /* service */ ! if(dnsParseString(pkt,&y->data.naptr->service) < 0) { ! strcpy(name,"invalid NAPTR service len"); ! goto err; ! } /* regexp */ ! if(dnsParseString(pkt,&y->data.naptr->regexp) < 0) { ! strcpy(name,"invalid NAPTR regexp len"); ! goto err; ! } /* replace */ if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; Index: dns.h =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dns.h 17 Jun 2005 04:44:58 -0000 1.5 --- dns.h 17 Jun 2005 15:00:39 -0000 1.6 *************** *** 184,187 **** --- 184,188 ---- dnsPacket *dnsParsePacket(unsigned char *packet,int size); int dnsParseName(dnsPacket *pkt,char **ptr,char *buf,int len,int pos,int level); + int dnsParseString(dnsPacket *pkt,char **buf); void dnsEncodeName(dnsPacket *pkt,char *name,int compress); void dnsEncodeGrow(dnsPacket *pkt,unsigned int size,char *proc); |
From: Vlad S. <ser...@us...> - 2005-06-17 04:45:07
|
Update of /cvsroot/naviserver/modules/nsdns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2287 Modified Files: dns.c dns.h Log Message: naptr support Index: dns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dns.c 17 Jun 2005 02:35:53 -0000 1.5 --- dns.c 17 Jun 2005 04:44:58 -0000 1.6 *************** *** 469,474 **** y->data.naptr->flags = ns_strcopy(flags); y->data.naptr->service = ns_strcopy(service); ! y->data.naptr->regexp = ns_strcopy(regexp); ! y->data.naptr->replace = ns_strcopy(replace); y->len = 2; if(y->data.name) y->len += strlen(y->data.name); --- 469,474 ---- y->data.naptr->flags = ns_strcopy(flags); y->data.naptr->service = ns_strcopy(service); ! y->data.naptr->regexp = ns_strcopy(regexp ? regexp : ""); ! y->data.naptr->replace = ns_strcopy(replace ? replace : ""); y->len = 2; if(y->data.name) y->len += strlen(y->data.name); *************** *** 871,875 **** void ! dnsEncodeName(dnsPacket *pkt,char *name) { dnsName *nm; --- 871,875 ---- void ! dnsEncodeName(dnsPacket *pkt,char *name,int compress) { dnsName *nm; *************** *** 883,887 **** if(!len || len > 63) break; // Find already saved domain name ! for(nm = pkt->nmlist;nm;nm = nm->next) { if(!strcasecmp(nm->name,&name[k])) { dnsEncodePtr(pkt,nm->offset); --- 883,887 ---- if(!len || len > 63) break; // Find already saved domain name ! for(nm = pkt->nmlist;compress && nm;nm = nm->next) { if(!strcasecmp(nm->name,&name[k])) { dnsEncodePtr(pkt,nm->offset); *************** *** 948,951 **** --- 948,963 ---- void + dnsEncodeString(dnsPacket *pkt,char *str) + { + int len = str ? strlen(str) : 0; + *((unsigned short*)pkt->buf.ptr) = len; + pkt->buf.ptr++; + if(len) { + memcpy(pkt->buf.ptr,str,(unsigned)len); + pkt->buf.ptr += len; + } + } + + void dnsEncodeBegin(dnsPacket *pkt) { *************** *** 967,971 **** dnsEncodeGrow(pkt,12,"pkt:hdr"); for(;list;list = list->next) { ! dnsEncodeName(pkt,list->name); dnsEncodeGrow(pkt,16,"pkt:data"); dnsEncodeShort(pkt,list->type); --- 979,983 ---- dnsEncodeGrow(pkt,12,"pkt:hdr"); for(;list;list = list->next) { ! dnsEncodeName(pkt,list->name,1); dnsEncodeGrow(pkt,16,"pkt:data"); dnsEncodeShort(pkt,list->type); *************** *** 979,987 **** case DNS_TYPE_MX: dnsEncodeShort(pkt,list->data.mx->preference); ! dnsEncodeName(pkt,list->data.mx->name); break; case DNS_TYPE_SOA: ! dnsEncodeName(pkt,list->data.soa->mname); ! dnsEncodeName(pkt,list->data.soa->rname); dnsEncodeGrow(pkt,20,"pkt:soa"); dnsEncodeLong(pkt,list->data.soa->serial); --- 991,999 ---- case DNS_TYPE_MX: dnsEncodeShort(pkt,list->data.mx->preference); ! dnsEncodeName(pkt,list->data.mx->name,1); break; case DNS_TYPE_SOA: ! dnsEncodeName(pkt,list->data.soa->mname,1); ! dnsEncodeName(pkt,list->data.soa->rname,1); dnsEncodeGrow(pkt,20,"pkt:soa"); dnsEncodeLong(pkt,list->data.soa->serial); *************** *** 994,1010 **** case DNS_TYPE_CNAME: case DNS_TYPE_PTR: ! dnsEncodeName(pkt,list->data.name); break; case DNS_TYPE_NAPTR: dnsEncodeShort(pkt,list->data.naptr->order); dnsEncodeShort(pkt,list->data.naptr->preference); ! dnsEncodeGrow(pkt,64,"pkt:naptr"); ! dnsEncodeName(pkt,list->data.naptr->flags); ! dnsEncodeGrow(pkt,64,"pkt:naptr"); ! dnsEncodeName(pkt,list->data.naptr->service); ! dnsEncodeGrow(pkt,64,"pkt:naptr"); ! dnsEncodeName(pkt,list->data.naptr->regexp); ! dnsEncodeGrow(pkt,64,"pkt:naptr"); ! dnsEncodeName(pkt,list->data.naptr->replace); break; } --- 1006,1018 ---- case DNS_TYPE_CNAME: case DNS_TYPE_PTR: ! dnsEncodeName(pkt,list->data.name,1); break; case DNS_TYPE_NAPTR: dnsEncodeShort(pkt,list->data.naptr->order); dnsEncodeShort(pkt,list->data.naptr->preference); ! dnsEncodeString(pkt,list->data.naptr->flags); ! dnsEncodeString(pkt,list->data.naptr->service); ! dnsEncodeString(pkt,list->data.naptr->regexp); ! dnsEncodeName(pkt,list->data.naptr->replace,0); break; } *************** *** 1018,1022 **** pkt->buf.ptr = &pkt->buf.data[DNS_HEADER_LEN+2]; /* Encode query part */ ! dnsEncodeName(pkt,pkt->qdlist->name); dnsEncodeShort(pkt,pkt->qdlist->type); dnsEncodeShort(pkt,pkt->qdlist->class); --- 1026,1030 ---- pkt->buf.ptr = &pkt->buf.data[DNS_HEADER_LEN+2]; /* Encode query part */ ! dnsEncodeName(pkt,pkt->qdlist->name,1); dnsEncodeShort(pkt,pkt->qdlist->type); dnsEncodeShort(pkt,pkt->qdlist->class); Index: dns.h =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dns.h 14 Jun 2005 03:20:38 -0000 1.4 --- dns.h 17 Jun 2005 04:44:58 -0000 1.5 *************** *** 108,112 **** typedef struct _dnsNAPTR { ! struct _dnsNA *next; short order; short preference; --- 108,112 ---- typedef struct _dnsNAPTR { ! struct _dnsNAPTR *next; short order; short preference; *************** *** 184,188 **** dnsPacket *dnsParsePacket(unsigned char *packet,int size); int dnsParseName(dnsPacket *pkt,char **ptr,char *buf,int len,int pos,int level); ! void dnsEncodeName(dnsPacket *pkt,char *name); void dnsEncodeGrow(dnsPacket *pkt,unsigned int size,char *proc); void dnsEncodeHeader(dnsPacket *pkt); --- 184,188 ---- dnsPacket *dnsParsePacket(unsigned char *packet,int size); int dnsParseName(dnsPacket *pkt,char **ptr,char *buf,int len,int pos,int level); ! void dnsEncodeName(dnsPacket *pkt,char *name,int compress); void dnsEncodeGrow(dnsPacket *pkt,unsigned int size,char *proc); void dnsEncodeHeader(dnsPacket *pkt); *************** *** 191,194 **** --- 191,195 ---- void dnsEncodeLong(dnsPacket *pkt,unsigned long num); void dnsEncodeData(dnsPacket *pkt,void *ptr,int len); + void dnsEncodeString(dnsPacket *pkt,char *str); void dnsEncodeObj(dnsPacket *pkt); void dnsEncodeBegin(dnsPacket *pkt); |
From: Vlad S. <ser...@us...> - 2005-06-17 02:51:19
|
Update of /cvsroot/naviserver/modules/nsdbpg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11885 Modified Files: dbpg.h nsdbpg.c Log Message: changed Ns_PgServerInit and re-added into nsdb driver struct Index: nsdbpg.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/nsdbpg.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nsdbpg.c 17 Jun 2005 02:39:53 -0000 1.4 --- nsdbpg.c 17 Jun 2005 02:51:10 -0000 1.5 *************** *** 75,78 **** --- 75,79 ---- {DbFn_Cancel, Flush}, {DbFn_ResetHandle, ResetHandle}, + {DbFn_ServerInit, Ns_PgServerInit}, {0, NULL} }; Index: dbpg.h =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/dbpg.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dbpg.h 15 Jun 2005 23:20:39 -0000 1.2 --- dbpg.h 17 Jun 2005 02:51:10 -0000 1.3 *************** *** 60,64 **** extern char *pgDbName; ! extern int PgDbServerInit(char *server, char *module, char *driver); --- 60,64 ---- extern char *pgDbName; ! extern int Ns_PgServerInit(char *server, char *module, char *driver); |
From: Vlad S. <ser...@us...> - 2005-06-17 02:44:53
|
Update of /cvsroot/naviserver/modules/nsdbbdb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9182 Added Files: ChangeLog nsdbbdb.c Removed Files: nsberkeleydb.c Log Message: initial upload with new nsdb names --- NEW FILE: ChangeLog --- 2005-06-16 Vlad Seryakov <ser...@us...> * nsdbbdb: initial upload --- NEW FILE: nsdbbdb.c --- /* * The contents of this file are subject to the Mozilla Public License * Version 1.1(the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" * basis,WITHOUT WARRANTY OF ANY KIND,either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * Alternatively,the contents of this file may be used under the terms * of the GNU General Public License(the "GPL"),in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License,indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above,a recipient may use your * version of this file under either the License or the GPL. * */ /* * nsberkeleydb.c -- * * AOLserver driver for the Sleepycat Database from * http://www.sleepycat.com/. * * Author * Vlad Seryakov vl...@cr... */ #include "ns.h" #include "nsdb.h" #include "db.h" #include <sys/stat.h> #define DB_SELECT 1 #define DB_GET 2 #define DB_UPDATE 3 #define DB_DELETE 4 static char *DbName(void); static char *DbDbType(void); static int DbServerInit(char *hServer, char *hModule, char *hDriver); static int DbOpenDb(Ns_DbHandle *handle); static int DbCloseDb(Ns_DbHandle *handle); static int DbDML(Ns_DbHandle *handle, char *sql); static int DbGetRow(Ns_DbHandle *handle, Ns_Set *row); static int DbFlush(Ns_DbHandle *handle); static int DbCancel(Ns_DbHandle *handle); static int DbExec(Ns_DbHandle *handle, char *sql); static int DbResetHandle(Ns_DbHandle *handle); static int DbFree(Ns_DbHandle *handle); static int DbShutdown(void *arg); static void DbError(const DB_ENV *env,const char *errpfx, const char *msg); static Ns_Set *DbBindRow(Ns_DbHandle *handle); static Ns_DbProc dbProcs[] = { {DbFn_ServerInit, DbServerInit}, {DbFn_Name, DbName}, {DbFn_DbType, DbDbType}, {DbFn_OpenDb, DbOpenDb}, {DbFn_CloseDb, DbCloseDb}, {DbFn_DML, DbDML}, {DbFn_GetRow, DbGetRow}, {DbFn_Flush, DbFlush}, {DbFn_Cancel, DbCancel}, {DbFn_Exec, DbExec}, {DbFn_BindRow, DbBindRow}, {DbFn_ResetHandle,DbResetHandle}, {0, NULL} }; typedef struct _dbConn { struct _dbConn *next; int cmd; int status; DB *db; DB_TXN *txn; DBC *cursor; DBT key; DBT data; } dbConn; static char *dbHome = 0; static DB_ENV *dbEnv = 0; static char *dbDelimiter = "\n"; static char *dbName = "BerkeleyDB"; static unsigned int dbHFactor = 0; static unsigned int dbDbFlags = 0; static unsigned int dbBtMinKey = 0; static unsigned int dbPageSize = 0; static unsigned int dbCacheSize = 0; static unsigned int dbEnvFlags = DB_CREATE|DB_RECOVER|DB_THREAD|DB_INIT_MPOOL; NS_EXPORT int Ns_ModuleVersion = 1; NS_EXPORT int Ns_DbDriverInit(char *hModule, char *configPath) { int rc; char *str; Ns_DString ds; if(dbEnv) { Ns_Log(Error,"nsberkeleydb: db_env has already been initialized"); return NS_ERROR; } if(Ns_DbRegisterDriver(hModule,dbProcs) != NS_OK) { Ns_Log(Error,"nsberkeleydb: could not register the %s/%s driver",dbName,hModule); return NS_ERROR; } if((rc = db_env_create(&dbEnv,0)) != 0) { Ns_Log(Error,"nsberkeleydb: db_env_create: %s",db_strerror(rc)); return NS_ERROR; } Ns_DStringInit(&ds); configPath = Ns_ConfigGetPath(0,0,"db","pool",hModule); if(!(dbDelimiter = Ns_ConfigGet(configPath,"delimiter"))) dbDelimiter = "\n"; if((dbHome = Ns_ConfigGet(configPath,"home"))) Ns_DStringAppend(&ds,dbHome); if(!ds.length) Ns_DStringPrintf(&ds,"%s/db",Ns_InfoHome()); dbHome = ns_strdup(ds.string); Ns_ConfigGetInt(configPath,"pagesize",&dbPageSize); Ns_ConfigGetInt(configPath,"cachesize",&dbCacheSize); Ns_ConfigGetInt(configPath,"hfactor",&dbHFactor); Ns_ConfigGetInt(configPath,"btminkey",&dbBtMinKey); // Db flags if(!(str = Ns_ConfigGet(configPath,"dbflags"))) str = ""; if(strstr(str,"dup")) dbDbFlags |= DB_DUP; // Environment flags if(!(str = Ns_ConfigGet(configPath,"envflags"))) str = ""; if(!strstr(str,"nolock")) dbEnvFlags |= DB_INIT_LOCK; if(!strstr(str,"nolog")) dbEnvFlags |= DB_INIT_LOG; if(!strstr(str,"notxn")) dbEnvFlags |= DB_INIT_TXN; if(!strstr(str,"noprivate")) dbEnvFlags |= DB_PRIVATE; if(dbCacheSize) dbEnv->set_cachesize(dbEnv,0,dbCacheSize,0); dbEnv->set_lk_detect(dbEnv,DB_LOCK_DEFAULT); dbEnv->set_errpfx(dbEnv,"nsberkeleydb"); dbEnv->set_errcall(dbEnv,DbError); dbEnv->set_alloc(dbEnv,ns_malloc,ns_realloc,ns_free); mkdir(dbHome,0777); if((rc = dbEnv->open(dbEnv,dbHome,dbEnvFlags,0)) != 0) { dbEnv->err(dbEnv,rc,NULL); dbEnv->close(dbEnv,0); Ns_DStringFree(&ds); dbEnv = 0; return NS_ERROR; } Ns_RegisterShutdown((Ns_Callback *)DbShutdown,0); Ns_Log(Notice,"%s/%s: Home=%s, Cache=%ud, Flags=%x",dbName,hModule,dbHome,dbCacheSize,dbEnvFlags); Ns_DStringFree(&ds); return NS_OK; } static int DbShutdown(void *arg) { if(dbEnv) dbEnv->close(dbEnv,0); dbEnv = 0; return NS_OK; } static char* DbName(void) { return dbName; } static char* DbDbType(void) { return dbName; } /* * Does both the SQLAllocConnect AND the SQLConnect * */ static int DbOpenDb(Ns_DbHandle *handle) { DB *db; dbConn *conn; char *dbpath; int rc,dbtype = DB_BTREE; if((rc = db_create(&db,dbEnv,0)) != 0) { dbEnv->err(dbEnv,rc,"db_create"); return NS_ERROR; } dbpath = handle->datasource; if(!strncmp(dbpath,"btree:",6)) { dbpath += 6; dbtype = DB_BTREE; if(dbBtMinKey) db->set_bt_minkey(db,dbBtMinKey); } else if(!strncmp(dbpath,"hash:",5)) { dbpath += 5; dbtype = DB_HASH; if(dbHFactor) db->set_h_ffactor(db,dbHFactor); } if(dbDbFlags) db->set_flags(db,dbDbFlags); if(dbPageSize) db->set_pagesize(db,dbPageSize); if((rc = db->open(db,0,dbpath,0,dbtype,DB_CREATE|DB_THREAD|DB_DIRTY_READ,0664)) != 0) { db->err(db,rc,"%s: open",handle->datasource); db->close(db,0); return NS_ERROR; } conn = ns_calloc(1,sizeof(dbConn)); conn->db = db; handle->connection = conn; handle->connected = NS_TRUE; return NS_OK; } static int DbCloseDb(Ns_DbHandle *handle) { dbConn *conn = handle->connection; DbCancel(handle); conn->db->close(conn->db,0); ns_free(conn); handle->connection = 0; handle->connected = NS_FALSE; return NS_OK; } static int DbDML(Ns_DbHandle *handle, char *query) { return NS_OK; } static int DbExec(Ns_DbHandle *handle, char *query) { dbConn *conn = handle->connection; DbCancel(handle); if(!strncasecmp(query,"BEGIN",5)) { if(!conn->txn) conn->status = dbEnv->txn_begin(dbEnv,NULL,&conn->txn,0); if(!conn->status) return NS_DML; dbEnv->err(dbEnv,conn->status,"DB_ENV->txn_begin"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } if(!strncasecmp(query,"COMMIT",6)) { if(conn->txn) conn->status = conn->txn->commit(conn->txn,0); conn->txn = 0; if(!conn->status) return NS_DML; dbEnv->err(dbEnv,conn->status,"DB_ENV->txn_commit"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } if(!strncasecmp(query,"ABORT",5)) { if(conn->txn) conn->status = conn->txn->abort(conn->txn); conn->txn = 0; if(!conn->status) return NS_DML; dbEnv->err(dbEnv,conn->status,"DB_ENV->txn_commit"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } if(!strncasecmp(query,"PUT ",4)) { conn->cmd = DB_UPDATE; conn->key.data = query+4; if((conn->data.data = strstr(conn->key.data,dbDelimiter))) { *((char*)conn->data.data++) = 0; conn->data.size = strlen(conn->data.data)+1; } conn->key.size = strlen(conn->key.data)+1; conn->status = conn->db->put(conn->db,0,&conn->key,&conn->data,0); // Avoid freeing static memory in DbFree conn->key.data = conn->data.data = 0; if(!conn->status) return NS_DML; // Report error situation conn->db->err(conn->db,conn->status,"DB->put"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } if(!strncasecmp(query,"DEL ",4)) { conn->cmd = DB_DELETE; conn->key.data = query+4; conn->key.size = strlen(conn->key.data)+1; conn->status = conn->db->del(conn->db,0,&conn->key,0); // Avoid freeing static memory in DbFree conn->key.data = conn->data.data = 0; if(!conn->status) return NS_DML; // Report error situation conn->db->err(conn->db,conn->status,"DB->del"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } /* Open cursor and retrieve all matching records */ if(!strncasecmp(query,"CURSOR",6)) { conn->cmd = DB_SELECT; if((conn->status = conn->db->cursor(conn->db,NULL,&conn->cursor,DB_DIRTY_READ)) != 0) { conn->db->err(conn->db,conn->status,"DB->cursor"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } if(*(query+6)) { /* Range request, try to position cursor to the closest key */ conn->key.data = query+7; conn->key.size = strlen(conn->key.data)+1; conn->status = conn->cursor->c_get(conn->cursor,&conn->key,&conn->data,DB_SET_RANGE); } else { /* Full table scan */ conn->status = conn->cursor->c_get(conn->cursor,&conn->key,&conn->data,DB_FIRST); } switch(conn->status) { case 0: case DB_NOTFOUND: handle->fetchingRows = 1; return NS_ROWS; default: conn->db->err(conn->db,conn->status,"DB->c_get"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } } /* Retrieve one matching record */ if(!strncasecmp(query,"GET ",4)) { conn->cmd = DB_GET; conn->key.data = query+4; conn->key.size = strlen(conn->key.data)+1; conn->status = conn->db->get(conn->db,NULL,&conn->key,&conn->data,0); // Avoid freeing static memory in DbFree conn->key.data = 0; switch(conn->status) { case 0: case DB_NOTFOUND: handle->fetchingRows = 1; return NS_ROWS; default: conn->db->err(conn->db,conn->status,"DB->get"); Ns_DbSetException(handle,"ERROR",db_strerror(conn->status)); return NS_ERROR; } } return NS_ERROR; } static int DbGetRow(Ns_DbHandle *handle,Ns_Set *row) { int rc = 0; dbConn *conn = handle->connection; if(handle->verbose) Ns_Log(Debug,"nsberkeleydb: getrow: %d: %d: %s %s",conn->cmd,conn->status,conn->key.data,conn->data.data); if(!handle->fetchingRows) { Ns_Log(Error,"Ns_FreeTDS_GetRow(%s): No rows waiting to fetch.",handle->datasource); Ns_DbSetException(handle,"NSDB","no rows waiting to fetch."); return NS_ERROR; } if(conn->status == DB_NOTFOUND) { handle->statement = 0; handle->fetchingRows = 0; return NS_END_DATA; } switch(conn->cmd) { case DB_GET: // Only one record should be returned conn->status = DB_NOTFOUND; Ns_SetPutValue(row,0,conn->data.data); return NS_OK; case DB_SELECT: // For the first time we have already called c_get if(!conn->data.data) { conn->status = conn->cursor->c_get(conn->cursor,&conn->key,&conn->data,DB_NEXT); } switch(conn->status) { case 0: Ns_SetPutValue(row,0,conn->key.data); Ns_SetPutValue(row,1,conn->data.data); DbFree(handle); return NS_OK; case DB_NOTFOUND: handle->fetchingRows = 0; return NS_END_DATA; default: conn->db->err(conn->db,rc,"DB->c_get"); Ns_DbSetException(handle,"ERROR",db_strerror(rc)); handle->fetchingRows = 0; return NS_ERROR; } break; } return NS_ERROR; } static int DbFlush(Ns_DbHandle *handle) { dbConn *conn = handle->connection; conn->db->sync(conn->db,0); return NS_OK; } static void DbError(const DB_ENV *env,const char *errpfx, const char *msg) { Ns_Log(Error,"nsberkeleydb: %s: %s",errpfx,msg); } static int DbFree(Ns_DbHandle *handle) { dbConn *conn = handle->connection; ns_free(conn->key.data); ns_free(conn->data.data); memset(&conn->key,0,sizeof(DBT)); memset(&conn->data,0,sizeof(DBT)); conn->key.flags = conn->data.flags = DB_DBT_MALLOC; return NS_OK; } static int DbCancel(Ns_DbHandle *handle) { dbConn *conn = handle->connection; if(conn->cursor) { conn->cursor->c_close(conn->cursor); conn->cursor = 0; } if(conn->txn) conn->txn->abort(conn->txn); conn->txn = 0; DbFree(handle); handle->statement = 0; handle->fetchingRows = 0; return NS_OK; } static int DbResetHandle(Ns_DbHandle *handle) { return DbCancel(handle); } static Ns_Set* DbBindRow(Ns_DbHandle *handle) { dbConn *conn = handle->connection; switch(conn->cmd) { case DB_GET: Ns_SetPut(handle->row,"data",NULL); break; default: Ns_SetPut(handle->row,"key",NULL); Ns_SetPut(handle->row,"data",NULL); } return handle->row; } /* * DbCmd - This function implements the "ns_berkeleydb" Tcl command installed * into each interpreter of each virtual server. It provides access to * features specific to the Db driver. */ static int DbCmd(ClientData dummy, Tcl_Interp *interp, int argc, CONST char **argv) { Ns_DbHandle *handle; if(argc != 3) { Tcl_AppendResult(interp,"wrong # args: should be ",argv[0]," cmd handle",0); return TCL_ERROR; } if(Ns_TclDbGetHandle(interp,(char*)argv[2],&handle) != TCL_OK) return TCL_ERROR; /* Make sure this is an Db handle before accessing handle->connection. */ if(Ns_DbDriverName(handle) != dbName) { Tcl_AppendResult(interp,argv[1]," is not of type ",dbName,0); return TCL_ERROR; } // Deadlock detection if(!strcmp(argv[1],"deadlock")) { if(dbEnv) dbEnv->lock_detect(dbEnv,0,DB_LOCK_DEFAULT,0); } return TCL_OK; } static int DbInterpInit(Tcl_Interp *interp, void *arg) { Tcl_CreateCommand(interp,"ns_berkeleydb",DbCmd,arg,NULL); return NS_OK; } static int DbServerInit(char *hServer, char *hModule, char *hDriver) { return Ns_TclInitInterps(hServer,DbInterpInit,NULL); } --- nsberkeleydb.c DELETED --- |
From: Vlad S. <ser...@us...> - 2005-06-17 02:43:01
|
Update of /cvsroot/naviserver/modules/nsdbtds In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8150 Modified Files: Makefile Added Files: ChangeLog nsdbtds.c Removed Files: nsfreetds.c Log Message: renamed according to new nsdb convention --- nsfreetds.c DELETED --- Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbtds/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 24 May 2005 17:52:01 -0000 1.1.1.1 --- Makefile 17 Jun 2005 02:42:52 -0000 1.2 *************** *** 7,16 **** # Module name # ! MOD = nsfreetds.so # # Objects to build. # ! OBJS = nsfreetds.o # --- 7,16 ---- # Module name # ! MOD = nsdbtds.so # # Objects to build. # ! OBJS = nsdbtds.o # --- NEW FILE: nsdbtds.c --- /* * The contents of this file are subject to the Mozilla Public License * Version 1.1(the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" * basis,WITHOUT WARRANTY OF ANY KIND,either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * Alternatively,the contents of this file may be used under the terms * of the GNU General Public License(the "GPL"),in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License,indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above,a recipient may use your * version of this file under either the License or the GPL. * * Author Vlad Seryakov vl...@cr... * * FreeTDS internal driver for NaviServer 4.x * * Requires FreeTDS version 0.64+ * * Derived from FreeTDS driver by Dossy <do...@pa...> */ #include "ns.h" #include "nsdb.h" #include "tds.h" #include "tdsconvert.h" typedef struct { TDSSOCKET *tds; TDSLOGIN *login; TDSCONTEXT *context; } Db_Handle; /* Common system headers */ #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> #include <time.h> #include <assert.h> #define MAX_IDENTIFIER 256 #define GET_TDS(handle) ((Db_Handle*)handle->connection)->tds #define GET_TDS_LOGIN(handle) ((Db_Handle*)handle->connection)->login #define GET_TDS_CONTEXT(handle) ((Db_Handle*)handle->connection)->context #define GET_TDS_RESULTS(handle) ((TDSRESULTINFO *)handle->statement) static char *freetds_driver_name = "nsfreetds"; static char *freetds_driver_version = "FreeTDS Driver v0.5"; static char *Db_Name(void); static char *Db_DbType(Ns_DbHandle *handle); static int Db_ServerInit(char *hServer,char *hModule,char *hDriver); static int Db_OpenDb(Ns_DbHandle *handle); static int Db_CloseDb(Ns_DbHandle *handle); static int Db_GetRow(Ns_DbHandle *handle,Ns_Set *row); static int Db_Flush(Ns_DbHandle *handle); static int Db_Cancel(Ns_DbHandle *handle); static int Db_Exec(Ns_DbHandle *handle,char *sql); static Ns_Set *Db_BindRow(Ns_DbHandle *handle); static int Db_SpStart(Ns_DbHandle *handle,char *procname); static int Db_SpExec(Ns_DbHandle *handle); static int Db_Msg_Handler(const TDSCONTEXT *,TDSSOCKET *,TDSMESSAGE *); static int Db_Err_Handler(const TDSCONTEXT *,TDSSOCKET *tds,TDSMESSAGE *); static Ns_DbProc freetdsProcs[] = { { DbFn_Name, Db_Name }, { DbFn_DbType, Db_DbType }, { DbFn_ServerInit, (void *) Db_ServerInit }, { DbFn_OpenDb, Db_OpenDb }, { DbFn_CloseDb, Db_CloseDb }, { DbFn_GetRow, Db_GetRow }, { DbFn_Flush, Db_Flush }, { DbFn_Cancel, Db_Cancel }, { DbFn_Exec, (void *) Db_Exec }, { DbFn_BindRow, (void *) Db_BindRow }, { DbFn_SpStart, Db_SpStart }, { DbFn_SpExec, Db_SpExec }, { 0, NULL } }; DllExport int Ns_ModuleVersion = 1; DllExport int Ns_ModuleFlags = 0; DllExport int Ns_DbDriverInit(char *hDriver, char *configPath) { if(hDriver == NULL) { Ns_Log(Bug, "Db_DriverInit(): NULL driver name."); return NS_ERROR; } if(Ns_DbRegisterDriver(hDriver, &(freetdsProcs[0])) != NS_OK) { Ns_Log(Error,"Db_DriverInit(%s): Could not register the %s driver.", hDriver, freetds_driver_name); return NS_ERROR; } Ns_Log(Notice, "Db_DriverInit(%s): Loaded %s, %s, built on %s at %s.", hDriver, freetds_driver_version, TDS_VERSION_NO, __DATE__, __TIME__); return NS_OK; } static char * Db_Name(void) { return freetds_driver_name; } static char * Db_DbType(Ns_DbHandle *handle) { return TDS_VERSION_NO; } static int Db_OpenDb(Ns_DbHandle *handle) { TDSSOCKET *tds; TDSLOGIN *login; TDSCONTEXT *context; TDSCONNECTION *connect; Db_Handle *nsdb; login = tds_alloc_login(); context = tds_alloc_context(0); tds = tds_alloc_socket(context,512); if(context->locale && !context->locale->date_fmt) { context->locale->date_fmt = strdup("%Y-%m-%d %T"); } context->msg_handler = Db_Msg_Handler; context->err_handler = Db_Err_Handler; tds_set_app(login,Db_Name()); tds_set_server(login,handle->datasource); tds_set_user(login,handle->user); tds_set_passwd(login,handle->password); tds_set_host(login,Ns_InfoServerName()); tds_set_library(login,"TDS-Library"); tds_set_language(login,"us_english"); tds_set_packet(login,2048); tds_set_parent(tds,handle); connect = tds_read_config_info(NULL,login,context->locale); if(!connect || tds_connect(tds,connect) == TDS_FAIL) {; Ns_Log(Notice, "Db_OpenDb(%s): tds_connect() failed.",handle->datasource); if(connect) tds_free_connection(connect); tds_free_socket(tds); tds_free_login(login); tds_free_context(context); return NS_ERROR; } tds_free_connection(connect); nsdb = (Db_Handle*)ns_malloc(sizeof(Db_Handle)); nsdb->tds = tds; nsdb->login = login; nsdb->context = context; handle->connection = nsdb; handle->connected = NS_TRUE; return NS_OK; } static int Db_CloseDb(Ns_DbHandle *handle) { Db_Cancel(handle); tds_free_login(GET_TDS_LOGIN(handle)); tds_free_context(GET_TDS_CONTEXT(handle)); tds_free_socket(GET_TDS(handle)); ns_free(handle->connection); handle->connection = 0; handle->connected = NS_FALSE; return NS_OK; } static int Db_Exec(Ns_DbHandle *handle, char *sql) { int status = TDS_SUCCEED, rc = NS_DML, done = 0; TDS_INT resulttype; if(Db_Cancel(handle) == NS_ERROR) { return NS_ERROR; } if(tds_submit_query(GET_TDS(handle),sql) != TDS_SUCCEED) { Ns_Log(Error, "Db_Exec(%s): tds_submit_query failed.", handle->datasource); return NS_ERROR; } while(status == TDS_SUCCEED) { status = tds_process_tokens(GET_TDS(handle),&resulttype,&done,TDS_TOKEN_RESULTS); switch(resulttype) { case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if(done & TDS_DONE_ERROR) status = TDS_FAIL; break; case TDS_ROW_RESULT: case TDS_ROWFMT_RESULT: case TDS_COMPUTE_RESULT: handle->statement = (void *)GET_TDS(handle)->res_info; if(rc != NS_ERROR && handle->statement) { handle->fetchingRows = 1; rc = NS_ROWS; status = TDS_NO_MORE_RESULTS; } break; } } if((status != TDS_SUCCEED && status != TDS_NO_MORE_RESULTS) || handle->dsExceptionMsg.length) { handle->statement = NULL; handle->fetchingRows = 1; return NS_ERROR; } return rc; } static int Db_GetRow(Ns_DbHandle *handle, Ns_Set *row) { int i,rc,ctype; TDSCOLUMN *col; CONV_RESULT dres; unsigned char *src; TDS_INT srclen,resulttype,computeid; if(!handle->fetchingRows || !handle->row->size) { Ns_DbSetException(handle,"NSDB","no rows waiting to fetch"); return NS_ERROR; } rc = tds_process_tokens(GET_TDS(handle),&resulttype,&computeid,TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); if(rc != TDS_SUCCEED && rc != TDS_NO_MORE_RESULTS) { Ns_Log(Error,"Db_GetRow(%s): tds_process_row_tokens: %d",handle->datasource,rc); Db_Cancel(handle); return NS_ERROR; } if(rc == TDS_NO_MORE_RESULTS || !GET_TDS(handle)->res_info || !GET_TDS(handle)->current_results || (resulttype != TDS_ROW_RESULT && resulttype != TDS_COMPUTE_RESULT)) { handle->statement = NULL; handle->fetchingRows = 0; return NS_END_DATA; } for(i = 0; i < GET_TDS(handle)->res_info->num_cols; i++) { col = GET_TDS(handle)->res_info->columns[i]; if(col->column_cur_size < 0) { Ns_SetPutValue(row,i,""); continue; } ctype = tds_get_conversion_type(col->column_type,col->column_size); src = &(GET_TDS(handle)->res_info->current_row[col->column_offset]); if(is_blob_type(col->column_type)) src = (unsigned char *)((TDSBLOB *)src)->textvalue; srclen = col->column_cur_size; if(tds_convert(GET_TDS(handle)->tds_ctx,ctype,(TDS_CHAR *)src,srclen,SYBVARCHAR,&dres) < 0) { Ns_SetPutValue(row,i,""); continue; } Ns_SetPutValue(row,i,dres.c); free(dres.c); } return NS_OK; } static int Db_Flush(Ns_DbHandle *handle) { return Db_Cancel(handle); } static int Db_Cancel(Ns_DbHandle *handle) { if(IS_TDSDEAD(GET_TDS(handle))) { Ns_Log(Error, "Db_Cancel(%s): dead connection detected.", handle->datasource); tds_free_all_results(GET_TDS(handle)); handle->statement = NULL; handle->fetchingRows = 0; handle->connected = NS_FALSE; return NS_ERROR; } if(tds_process_simple_query(GET_TDS(handle)) == TDS_FAIL) { Ns_Log(Error,"Db_Cancel(%s): tds_process_simple_query failed",handle->datasource); } tds_free_all_results(GET_TDS(handle)); tds_send_cancel(GET_TDS(handle)); tds_process_cancel(GET_TDS(handle)); handle->statement = NULL; handle->fetchingRows = 0; return NS_OK; } static Ns_Set * Db_BindRow(Ns_DbHandle *handle) { int i; if(GET_TDS_RESULTS(handle)) { for(i = 0; i < GET_TDS_RESULTS(handle)->num_cols; i++) { Ns_SetPut((Ns_Set *)handle->row,GET_TDS_RESULTS(handle)->columns[i]->column_name,NULL); } } return (Ns_Set *)handle->row; } static int Db_SpStart(Ns_DbHandle *handle, char *procname) { if(Db_Exec(handle, procname) != NS_ERROR) { return NS_OK; } return NS_ERROR; } static int Db_SpExec(Ns_DbHandle *handle) { if(GET_TDS(handle)->res_info == NULL) { return NS_DML; } return NS_ROWS; } int Db_Err_Handler(const TDSCONTEXT *ctx,TDSSOCKET *tds,TDSMESSAGE *msg) { Ns_DbHandle *handle = (Ns_DbHandle *)tds->parent; Ns_Log(Error,"Db_Err_Handler(%s): ERR(%u:%u) %s", handle->datasource,msg->msg_number,msg->line_number,msg->message); Ns_DbSetException(handle, "NSDB", msg->message); return 0; } int Db_Msg_Handler(const TDSCONTEXT *ctx,TDSSOCKET *tds,TDSMESSAGE *msg) { Ns_DbHandle *handle = (Ns_DbHandle *)tds->parent; if(handle->verbose) { Ns_Log(Notice, "Db_Msg_Handler(%s:%d,%d,%s): %s", handle->datasource,msg->msg_level,msg->msg_state, msg->sql_state ? msg->sql_state : "0",msg->message); } if(msg->msg_level > 10) { Ns_DbSetException(handle, "NSDB", msg->message); } return 0; } static void Db_Rows_Affected(Tcl_Interp *interp, Ns_DbHandle *handle) { Tcl_SetObjResult(interp, Tcl_NewLongObj(GET_TDS(handle)->rows_affected)); } /* * Db_Cmd - This function implements the "ns_freetds" Tcl command * installed into each interpreter of each virtual server. It provides * access to features specific to the FreeTDS driver. */ static int Db_Cmd(ClientData arg,Tcl_Interp *interp,int objc,Tcl_Obj * CONST objv[]) { int cmd; Ns_DbHandle *handle; enum commands { cmdRowsAffected, cmdVersion }; static const char *sCmd[] = { "rows_affected", "version", 0 }; if(objc < 3) { Tcl_AppendResult(interp,"wrong # args: should be: ",Tcl_GetString(objv[0])," cmd handle ?args?",0); return TCL_ERROR; } if(Tcl_GetIndexFromObj(interp,objv[1],sCmd,"command",TCL_EXACT,(int *)&cmd) != TCL_OK) return TCL_ERROR; if(Ns_TclDbGetHandle(interp,Tcl_GetString(objv[2]),&handle) != TCL_OK) return TCL_ERROR; /* Make sure this is a FreeTDS handle before accessing handle->connection. */ if(Ns_DbDriverName(handle) != freetds_driver_name) { Tcl_AppendResult(interp,"handle \"",Tcl_GetString(objv[2]),"\" is not of type \"",freetds_driver_name,"\"",NULL); return TCL_ERROR; } switch(cmd) { case cmdRowsAffected: Db_Rows_Affected(interp,handle); break; case cmdVersion: Tcl_SetResult(interp,freetds_driver_version,TCL_STATIC); break; } return TCL_OK; } static int Db_InterpInit(Tcl_Interp *interp, void *ignored) { Tcl_CreateObjCommand(interp, "ns_freetds", Db_Cmd, NULL, NULL); return NS_OK; } static int Db_ServerInit(char *hServer, char *hModule, char *hDriver) { return Ns_TclInitInterps(hServer, Db_InterpInit, NULL); } --- NEW FILE: ChangeLog --- 2005-06-16 Vlad Seryakov <ser...@us...> * nsdbtds.c: initial commit with new name |
From: Vlad S. <ser...@us...> - 2005-06-17 02:40:02
|
Update of /cvsroot/naviserver/modules/nsdbpg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7284 Modified Files: ChangeLog nsdbpg.c Log Message: removed undefined PgDbServerInit Index: nsdbpg.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/nsdbpg.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nsdbpg.c 15 Jun 2005 23:20:39 -0000 1.3 --- nsdbpg.c 17 Jun 2005 02:39:53 -0000 1.4 *************** *** 75,79 **** {DbFn_Cancel, Flush}, {DbFn_ResetHandle, ResetHandle}, - {DbFn_ServerInit, PgDbServerInit}, {0, NULL} }; --- 75,78 ---- Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/ChangeLog,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ChangeLog 15 Jun 2005 23:20:38 -0000 1.3 --- ChangeLog 17 Jun 2005 02:39:53 -0000 1.4 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-16 Vlad Seryakov <ser...@us...> + + * nsdbpg.c: removed undefined PgDbServerInit function + which prevented module to be loaded + 2005-06-15 Stephen Deasey <sd...@us...> |
From: Vlad S. <ser...@us...> - 2005-06-17 02:36:02
|
Update of /cvsroot/naviserver/modules/nsdns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5183 Modified Files: ChangeLog dns.c Log Message: NAPTR record support Index: dns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dns.c 14 Jun 2005 03:20:38 -0000 1.4 --- dns.c 17 Jun 2005 02:35:53 -0000 1.5 *************** *** 269,272 **** --- 269,278 ---- y->data.soa->ttl); break; + case DNS_TYPE_NAPTR: + if(!y->data.naptr) break; + Ns_DStringPrintf(ds,"ORDER=%d, PREFS=%d, FLAGS=%s, SERVICE=%s, REGEXP=%s, REPLACE=%s, TTL=%lu ", + y->data.naptr->order,y->data.naptr->preference,y->data.naptr->flags,y->data.naptr->service, + y->data.naptr->regexp,y->data.naptr->replace,y->data.soa->ttl); + break; } if(y->timestamp) Ns_DStringPrintf(ds,", TIMESTAMP=%lu",y->timestamp); *************** *** 304,307 **** --- 310,320 ---- ns_free(pkt->data.name); break; + case DNS_TYPE_NAPTR: + if(!pkt->data.naptr) break; + ns_free(pkt->data.naptr->flags); + ns_free(pkt->data.naptr->service); + ns_free(pkt->data.naptr->regexp); + ns_free(pkt->data.naptr->replace); + break; case DNS_TYPE_SOA: if(!pkt->data.soa) break; *************** *** 350,353 **** --- 363,376 ---- rec->data.name = ns_strcopy(from->data.name); break; + case DNS_TYPE_NAPTR: + rec->data.naptr = ns_calloc(1,sizeof(dnsNAPTR)); + if(!from->data.naptr) break; + rec->data.naptr->order = from->data.naptr->order; + rec->data.naptr->preference = from->data.naptr->preference; + rec->data.naptr->flags = ns_strcopy(from->data.naptr->flags); + rec->data.naptr->service = ns_strcopy(from->data.naptr->service); + rec->data.naptr->regexp = ns_strcopy(from->data.naptr->regexp); + rec->data.naptr->replace = ns_strcopy(from->data.naptr->replace); + break; case DNS_TYPE_SOA: rec->data.soa = ns_calloc(1,sizeof(dnsSOA)); Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChangeLog 14 Jun 2005 03:20:38 -0000 1.2 --- ChangeLog 17 Jun 2005 02:35:53 -0000 1.3 *************** *** 1,2 **** --- 1,6 ---- + 2005-06-16 Vlad Seryakov vl...@cr... + + * NAPTR record support + 2005-06-13 Vlad Seryakov vl...@cr... |
From: Zoran V. <vas...@us...> - 2005-06-16 19:42:57
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30550 Modified Files: driver.c server.c Log Message: Reformatted, untabified and adjusted to match style code Index: driver.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/driver.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** driver.c 16 Jun 2005 18:31:10 -0000 1.12 --- driver.c 16 Jun 2005 19:42:48 -0000 1.13 *************** *** 31,36 **** * driver.c -- * ! * Connection I/O for loadable socket drivers. ! * */ --- 31,35 ---- * driver.c -- * ! * Connection I/O for loadable socket drivers. [...1947 lines suppressed...] * Check if all content has arrived. *************** *** 1535,1542 **** * This happens from some browsers on POST requests. */ if (reqPtr->length > 0) { reqPtr->content[reqPtr->length] = '\0'; } - return (reqPtr->request ? SOCK_READY : SOCK_ERROR); } --- 1547,1554 ---- * This happens from some browsers on POST requests. */ + if (reqPtr->length > 0) { reqPtr->content[reqPtr->length] = '\0'; } return (reqPtr->request ? SOCK_READY : SOCK_ERROR); } Index: server.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/server.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** server.c 16 Jun 2005 18:31:11 -0000 1.7 --- server.c 16 Jun 2005 19:42:48 -0000 1.8 *************** *** 31,35 **** * server.c -- * ! * Routines for managing NsServer structures. */ --- 31,35 ---- * server.c -- * ! * Routines for managing NsServer structures. */ [...1014 lines suppressed...] ! poolPtr->threads.min = poolPtr->threads.max; } } --- 693,708 ---- * current number of threads is above the minimum. */ ! if (poolPtr->threads.max > maxconns) { ! Ns_Log(Warning, "serv: cannot have more maxthreads than maxconns: " ! "%d max threads adjusted down to %d max connections", ! poolPtr->threads.max, maxconns); ! poolPtr->threads.max = maxconns; } if (poolPtr->threads.min > poolPtr->threads.max) { ! Ns_Log(Warning, "serv: cannot have more minthreads than maxthreads: " ! "%d min threads adjusted down to %d max threads", ! poolPtr->threads.min, poolPtr->threads.max); ! poolPtr->threads.min = poolPtr->threads.max; } } |
From: Zoran V. <vas...@us...> - 2005-06-16 18:33:35
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23611 Modified Files: ChangeLog Log Message: See file. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** ChangeLog 15 Jun 2005 04:14:03 -0000 1.121 --- ChangeLog 16 Jun 2005 18:33:24 -0000 1.122 *************** *** 1,2 **** --- 1,8 ---- + 2005-06-16 Zoran Vasiljevic <vas...@us...> + + * nsd/driver.c + * nsd/server.c + * nsd/nsd.h: Removed maxpost config option (RFE #1222107) + 2005-06-14 Vlad Seryakov <ser...@us...> |
From: Zoran V. <vas...@us...> - 2005-06-16 18:31:52
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21640 Modified Files: driver.c nsd.h server.c Log Message: Remove the "maxpost" configuration option as per RFE #1222107 Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** nsd.h 13 Jun 2005 01:55:14 -0000 1.17 --- nsd.h 16 Jun 2005 18:31:11 -0000 1.18 *************** *** 594,598 **** int maxheaders; int maxline; - int maxpost; int sendfdmin; int errorminsize; --- 594,597 ---- Index: driver.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/driver.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** driver.c 13 Jun 2005 01:55:14 -0000 1.11 --- driver.c 16 Jun 2005 18:31:10 -0000 1.12 *************** *** 1,8 **** - /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 1367,1394 **** char *s, *e, save; int cnt, len, nread, n; ! reqPtr = sockPtr->reqPtr; if (reqPtr == NULL) { ! Ns_MutexLock(&reqLock); ! reqPtr = firstReqPtr; ! if (reqPtr != NULL) { ! firstReqPtr = reqPtr->nextPtr; ! } ! Ns_MutexUnlock(&reqLock); ! if (reqPtr == NULL) { ! reqPtr = ns_malloc(sizeof(Request)); ! Tcl_DStringInit(&reqPtr->buffer); ! reqPtr->headers = Ns_SetCreate(NULL); ! reqPtr->request = NULL; ! reqPtr->next = reqPtr->content = NULL; ! reqPtr->length = reqPtr->avail = 0; ! reqPtr->coff = reqPtr->woff = reqPtr->roff = 0; ! reqPtr->leadblanks = 0; ! } ! sockPtr->reqPtr = reqPtr; reqPtr->port = ntohs(sockPtr->sa.sin_port); ! strcpy(reqPtr->peer, ns_inet_ntoa(sockPtr->sa.sin_addr)); } ! /* * On the first read, attempt to read-ahead bufsize bytes. --- 1366,1393 ---- char *s, *e, save; int cnt, len, nread, n; ! reqPtr = sockPtr->reqPtr; if (reqPtr == NULL) { ! Ns_MutexLock(&reqLock); ! reqPtr = firstReqPtr; ! if (reqPtr != NULL) { ! firstReqPtr = reqPtr->nextPtr; ! } ! Ns_MutexUnlock(&reqLock); ! if (reqPtr == NULL) { ! reqPtr = ns_malloc(sizeof(Request)); ! Tcl_DStringInit(&reqPtr->buffer); ! reqPtr->headers = Ns_SetCreate(NULL); ! reqPtr->request = NULL; ! reqPtr->next = reqPtr->content = NULL; ! reqPtr->length = reqPtr->avail = 0; ! reqPtr->coff = reqPtr->woff = reqPtr->roff = 0; ! reqPtr->leadblanks = 0; ! } ! sockPtr->reqPtr = reqPtr; reqPtr->port = ntohs(sockPtr->sa.sin_port); ! strcpy(reqPtr->peer, ns_inet_ntoa(sockPtr->sa.sin_addr)); } ! /* * On the first read, attempt to read-ahead bufsize bytes. *************** *** 1396,1405 **** * content. */ ! bufPtr = &reqPtr->buffer; if (reqPtr->length == 0) { ! nread = sockPtr->drvPtr->bufsize; } else { ! nread = reqPtr->length - reqPtr->avail; } --- 1395,1404 ---- * content. */ ! bufPtr = &reqPtr->buffer; if (reqPtr->length == 0) { ! nread = sockPtr->drvPtr->bufsize; } else { ! nread = reqPtr->length - reqPtr->avail; } *************** *** 1407,1411 **** * Grow the buffer to include space for the next bytes. */ ! len = bufPtr->length; n = len + nread; --- 1406,1410 ---- * Grow the buffer to include space for the next bytes. */ ! len = bufPtr->length; n = len + nread; *************** *** 1422,1466 **** n = (*sockPtr->drvPtr->proc)(DriverRecv, sock, &buf, 1); if (n <= 0) { ! return SOCK_ERROR; } Tcl_DStringSetLength(bufPtr, len + n); reqPtr->woff += n; reqPtr->avail += n; ! /* * Scan lines until start of content. */ ! while (reqPtr->coff == 0) { ! /* ! * Find the next line. ! */ ! ! s = bufPtr->string + reqPtr->roff; ! e = strchr(s, '\n'); ! if (e == NULL) { ! /* ! * Input not yet null terminated - request more. ! */ ! ! return SOCK_MORE; ! } ! ! /* ! * Update next read pointer to end of this line. ! */ ! ! cnt = e - s + 1; ! reqPtr->roff += cnt; ! reqPtr->avail -= cnt; ! if (e > s && e[-1] == '\r') { ! --e; ! } ! ! /* ! * Check for end of headers. ! */ ! ! if (e == s) { /* * Look for a blank line on its own prior to any "real" --- 1421,1465 ---- n = (*sockPtr->drvPtr->proc)(DriverRecv, sock, &buf, 1); if (n <= 0) { ! return SOCK_ERROR; } Tcl_DStringSetLength(bufPtr, len + n); reqPtr->woff += n; reqPtr->avail += n; ! /* * Scan lines until start of content. */ ! while (reqPtr->coff == 0) { ! /* ! * Find the next line. ! */ ! ! s = bufPtr->string + reqPtr->roff; ! e = strchr(s, '\n'); ! if (e == NULL) { ! /* ! * Input not yet null terminated - request more. ! */ ! ! return SOCK_MORE; ! } ! ! /* ! * Update next read pointer to end of this line. ! */ ! ! cnt = e - s + 1; ! reqPtr->roff += cnt; ! reqPtr->avail -= cnt; ! if (e > s && e[-1] == '\r') { ! --e; ! } ! ! /* ! * Check for end of headers. ! */ ! ! if (e == s) { /* * Look for a blank line on its own prior to any "real" *************** *** 1468,1517 **** * connection. */ ! if (bufPtr->length == 0) { ! if (++reqPtr->leadblanks > 2) { ! return SOCK_ERROR; ! } ! reqPtr->woff = reqPtr->roff = 0; ! Tcl_DStringSetLength(bufPtr, 0); ! return SOCK_MORE; ! } ! reqPtr->coff = reqPtr->roff; ! s = Ns_SetIGet(reqPtr->headers, "content-length"); ! if (s != NULL) { ! reqPtr->length = atoi(s); ! if (reqPtr->length < 0 ! && reqPtr->length > sockPtr->drvPtr->servPtr->limits.maxpost) { return SOCK_ERROR; } ! } ! } else { ! save = *e; ! *e = '\0'; ! if (reqPtr->request == NULL) { ! reqPtr->request = Ns_ParseRequest(s); ! if (reqPtr->request == NULL) { ! /* ! * Invalid request. ! */ ! ! return SOCK_ERROR; ! } ! } else if (Ns_ParseHeader(reqPtr->headers, s, Preserve) != NS_OK) { ! /* ! * Invalid header. ! */ ! return SOCK_ERROR; ! } ! *e = save; ! if (reqPtr->request->version <= 0.0) { ! /* ! * Pre-HTTP/1.0 request. ! */ ! reqPtr->coff = reqPtr->roff; ! } ! } } --- 1467,1522 ---- * connection. */ ! if (bufPtr->length == 0) { ! if (++reqPtr->leadblanks > 2) { return SOCK_ERROR; } ! reqPtr->woff = reqPtr->roff = 0; ! Tcl_DStringSetLength(bufPtr, 0); ! return SOCK_MORE; ! } ! reqPtr->coff = reqPtr->roff; ! s = Ns_SetIGet(reqPtr->headers, "content-length"); ! if (s != NULL) { ! int length; ! /* ! * Honour meaningfull remote ! * content-length hints only. ! */ ! length = atoi(s); ! if (length >= 0) { ! reqPtr->length = length; ! } ! } ! } else { ! save = *e; ! *e = '\0'; ! if (reqPtr->request == NULL) { ! reqPtr->request = Ns_ParseRequest(s); ! if (reqPtr->request == NULL) { ! /* ! * Invalid request. ! */ ! ! return SOCK_ERROR; ! } ! } else if (Ns_ParseHeader(reqPtr->headers, s, Preserve) != NS_OK) { ! /* ! * Invalid header. ! */ ! ! return SOCK_ERROR; ! } ! *e = save; ! if (reqPtr->request->version <= 0.0) { ! /* ! * Pre-HTTP/1.0 request. ! */ ! ! reqPtr->coff = reqPtr->roff; ! } ! } } *************** *** 1519,1528 **** * Check if all content has arrived. */ ! if (reqPtr->coff > 0 && reqPtr->length <= reqPtr->avail) { ! reqPtr->content = bufPtr->string + reqPtr->coff; ! reqPtr->next = reqPtr->content; ! reqPtr->avail = reqPtr->length; ! /* * Ensure that there are no 'bonus' crlf chars left visible --- 1524,1533 ---- * Check if all content has arrived. */ ! if (reqPtr->coff > 0 && reqPtr->length <= reqPtr->avail) { ! reqPtr->content = bufPtr->string + reqPtr->coff; ! reqPtr->next = reqPtr->content; ! reqPtr->avail = reqPtr->length; ! /* * Ensure that there are no 'bonus' crlf chars left visible *************** *** 1533,1544 **** reqPtr->content[reqPtr->length] = '\0'; } ! ! return (reqPtr->request ? SOCK_READY : SOCK_ERROR); } ! /* * Wait for more input. */ ! return SOCK_MORE; } --- 1538,1549 ---- reqPtr->content[reqPtr->length] = '\0'; } ! ! return (reqPtr->request ? SOCK_READY : SOCK_ERROR); } ! /* * Wait for more input. */ ! return SOCK_MORE; } Index: server.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/server.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** server.c 13 Jun 2005 01:55:14 -0000 1.6 --- server.c 16 Jun 2005 18:31:11 -0000 1.7 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 300,306 **** servPtr->limits.maxheaders = 64 * 1024; /* 64k */ } - if (!Ns_ConfigGetInt(path, "maxpost", &servPtr->limits.maxpost)) { - servPtr->limits.maxpost = 256 * 1024; /* 256k */ - } /* --- 300,303 ---- *************** *** 348,357 **** if (!Ns_ConfigGetBool(path, "cache", &i) || i) { if (!Ns_ConfigGetInt(path, "cachemaxsize", &n)) { ! n = 5 * 1024 * 1000; ! } ! if (!Ns_ConfigGetInt(path, "cachemaxentry", &i) || i < 0) { ! i = n / 10; ! } ! servPtr->fastpath.cachemaxentry = i; servPtr->fastpath.cache = NsFastpathCache(server, n); } --- 345,354 ---- if (!Ns_ConfigGetBool(path, "cache", &i) || i) { if (!Ns_ConfigGetInt(path, "cachemaxsize", &n)) { ! n = 5 * 1024 * 1000; ! } ! if (!Ns_ConfigGetInt(path, "cachemaxentry", &i) || i < 0) { ! i = n / 10; ! } ! servPtr->fastpath.cachemaxentry = i; servPtr->fastpath.cache = NsFastpathCache(server, n); } *************** *** 365,384 **** if (dirf != NULL) { dirf = ns_strdup(dirf); ! p = dirf; ! n = 1; while ((p = (strchr(p, ','))) != NULL) { ! ++n; ! ++p; ! } ! servPtr->fastpath.dirc = n; ! servPtr->fastpath.dirv = ns_malloc(sizeof(char *) * n); ! for (i = 0; i < n; ++i) { p = strchr(dirf, ','); ! if (p != NULL) { ! *p++ = '\0'; ! } ! servPtr->fastpath.dirv[i] = dirf; ! dirf = p; ! } } servPtr->fastpath.serverdir = Ns_ConfigGetValue(path, "serverdir"); --- 362,381 ---- if (dirf != NULL) { dirf = ns_strdup(dirf); ! p = dirf; ! n = 1; while ((p = (strchr(p, ','))) != NULL) { ! ++n; ! ++p; ! } ! servPtr->fastpath.dirc = n; ! servPtr->fastpath.dirv = ns_malloc(sizeof(char *) * n); ! for (i = 0; i < n; ++i) { p = strchr(dirf, ','); ! if (p != NULL) { ! *p++ = '\0'; ! } ! servPtr->fastpath.dirv[i] = dirf; ! dirf = p; ! } } servPtr->fastpath.serverdir = Ns_ConfigGetValue(path, "serverdir"); *************** *** 403,407 **** p = Ns_ConfigGetValue(path, "directorylisting"); if (p != NULL && (STREQ(p, "simple") || STREQ(p, "fancy"))) { ! p = "_ns_dirlist"; } servPtr->fastpath.dirproc = Ns_ConfigGetValue(path, "directoryproc"); --- 400,404 ---- p = Ns_ConfigGetValue(path, "directorylisting"); if (p != NULL && (STREQ(p, "simple") || STREQ(p, "fancy"))) { ! p = "_ns_dirlist"; } servPtr->fastpath.dirproc = Ns_ConfigGetValue(path, "directoryproc"); |
From: Stephen D. <sd...@us...> - 2005-06-15 23:21:28
|
Update of /cvsroot/naviserver/modules/nsdbpg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5468 Modified Files: ChangeLog dbpg.h nsdbpg.c tclcmds.c Log Message: Use a regular naming scheme for functions and variables. Index: nsdbpg.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/nsdbpg.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nsdbpg.c 15 Jun 2005 20:22:11 -0000 1.2 --- nsdbpg.c 15 Jun 2005 23:20:39 -0000 1.3 *************** *** 40,49 **** - #define OID_QUOTED_STRING " oid = '" - #define STRING_BUF_LEN 256 - - NS_EXPORT int Ns_ModuleVersion = 1; ! char *PgDbName = "PostgreSQL"; [...1136 lines suppressed...] + sql++; + } if (!strncasecmp(sql, "begin", 5)) { + pconn->in_transaction = NS_TRUE; if (handle->verbose) { ! Ns_Log(Notice, "nsdbpg: Entering transaction."); } ! } else if (!strncasecmp(sql, "end", 3) ! || !strncasecmp(sql, "commit", 6)) { ! pconn->in_transaction = NS_FALSE; if (handle->verbose) { ! Ns_Log(Notice, "nsdbpg: Committing transaction."); } ! } else if (!strncasecmp(sql, "abort", 5) ! || !strncasecmp(sql, "rollback", 8)) { ! pconn->in_transaction = NS_FALSE; if (handle->verbose) { ! Ns_Log(Notice, "nsdbpg: Rolling back transaction."); } } Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/tclcmds.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tclcmds.c 15 Jun 2005 20:22:11 -0000 1.1 --- tclcmds.c 15 Jun 2005 23:20:39 -0000 1.2 *************** *** 136,140 **** { Ns_DbHandle *handle; ! NsPgConn *pgconn; if (Ns_TclDbGetHandle(interp, argv[2], &handle) != TCL_OK) { --- 136,140 ---- { Ns_DbHandle *handle; ! Connection *pconn; if (Ns_TclDbGetHandle(interp, argv[2], &handle) != TCL_OK) { *************** *** 142,155 **** } ! pgconn = (NsPgConn *) handle->connection; /* * Make sure this is a PostgreSQL handle before accessing ! * handle->connection as an NsPgConn. */ ! if (Ns_DbDriverName(handle) != PgDbName) { Tcl_AppendResult(interp, "handle \"", argv[1], "\" is not of type \"", ! PgDbName, "\"", NULL); return TCL_ERROR; } --- 142,155 ---- } ! pconn = handle->connection; /* * Make sure this is a PostgreSQL handle before accessing ! * handle->connection as an Connection. */ ! if (Ns_DbDriverName(handle) != pgDbName) { Tcl_AppendResult(interp, "handle \"", argv[1], "\" is not of type \"", ! pgDbName, "\"", NULL); return TCL_ERROR; } *************** *** 177,181 **** return TCL_ERROR; } ! if (!pgconn->in_transaction) { Tcl_AppendResult(interp, "blob_put only allowed in transaction", NULL); --- 177,181 ---- return TCL_ERROR; } ! if (!pconn->in_transaction) { Tcl_AppendResult(interp, "blob_put only allowed in transaction", NULL); *************** *** 190,194 **** return TCL_ERROR; } ! if (!pgconn->in_transaction) { Tcl_AppendResult(interp, "blob_dml_file only allowed in transaction", NULL); --- 190,194 ---- return TCL_ERROR; } ! if (!pconn->in_transaction) { Tcl_AppendResult(interp, "blob_dml_file only allowed in transaction", NULL); *************** *** 213,229 **** if (!strcmp(argv[1], "db")) { ! Tcl_SetResult(interp, (char *) PQdb(pgconn->conn), TCL_STATIC); } else if (!strcmp(argv[1], "host")) { ! Tcl_SetResult(interp, (char *) PQhost(pgconn->conn), TCL_STATIC); } else if (!strcmp(argv[1], "options")) { ! Tcl_SetResult(interp, (char *) PQoptions(pgconn->conn), TCL_STATIC); } else if (!strcmp(argv[1], "port")) { ! Tcl_SetResult(interp, (char *) PQport(pgconn->conn), TCL_STATIC); } else if (!strcmp(argv[1], "number")) { ! sprintf(interp->result, "%u", pgconn->cNum); } else if (!strcmp(argv[1], "error")) { ! Tcl_SetResult(interp, (char *) PQerrorMessage(pgconn->conn), TCL_STATIC); } else if (!strcmp(argv[1], "status")) { ! if (PQstatus(pgconn->conn) == CONNECTION_OK) { interp->result = "ok"; } else { --- 213,229 ---- if (!strcmp(argv[1], "db")) { ! Tcl_SetResult(interp, (char *) PQdb(pconn->pgconn), TCL_STATIC); } else if (!strcmp(argv[1], "host")) { ! Tcl_SetResult(interp, (char *) PQhost(pconn->pgconn), TCL_STATIC); } else if (!strcmp(argv[1], "options")) { ! Tcl_SetResult(interp, (char *) PQoptions(pconn->pgconn), TCL_STATIC); } else if (!strcmp(argv[1], "port")) { ! Tcl_SetResult(interp, (char *) PQport(pconn->pgconn), TCL_STATIC); } else if (!strcmp(argv[1], "number")) { ! sprintf(interp->result, "%u", pconn->id); } else if (!strcmp(argv[1], "error")) { ! Tcl_SetResult(interp, (char *) PQerrorMessage(pconn->pgconn), TCL_STATIC); } else if (!strcmp(argv[1], "status")) { ! if (PQstatus(pconn->pgconn) == CONNECTION_OK) { interp->result = "ok"; } else { *************** *** 232,236 **** } else if (!strcmp(argv[1], "ntuples")) { char string[16]; ! sprintf(string, "%d", pgconn->nTuples); Tcl_SetResult(interp, string, TCL_VOLATILE); } else { --- 232,236 ---- } else if (!strcmp(argv[1], "ntuples")) { char string[16]; ! sprintf(string, "%d", pconn->nTuples); Tcl_SetResult(interp, string, TCL_VOLATILE); } else { *************** *** 293,302 **** /* * Make sure this is a PostgreSQL handle before accessing ! * handle->connection as an NsPgConn. */ ! if (Ns_DbDriverName(handle) != PgDbName) { Tcl_AppendResult(interp, "handle \"", argv[1], "\" is not of type \"", ! PgDbName, "\"", NULL); return TCL_ERROR; } --- 293,302 ---- /* * Make sure this is a PostgreSQL handle before accessing ! * handle->connection as an Connection. */ ! if (Ns_DbDriverName(handle) != pgDbName) { Tcl_AppendResult(interp, "handle \"", argv[1], "\" is not of type \"", ! pgDbName, "\"", NULL); return TCL_ERROR; } *************** *** 484,489 **** DbFail(Tcl_Interp *interp, Ns_DbHandle *handle, char *cmd, char* sql) { ! NsPgConn *pgconn = handle->connection; ! char *pqerror; Tcl_AppendResult(interp, "Database operation \"", cmd, "\" failed", NULL); --- 484,489 ---- DbFail(Tcl_Interp *interp, Ns_DbHandle *handle, char *cmd, char* sql) { ! Connection *pconn = handle->connection; ! char *pqerror; Tcl_AppendResult(interp, "Database operation \"", cmd, "\" failed", NULL); *************** *** 498,502 **** } ! pqerror = PQerrorMessage(pgconn->conn); if (pqerror[0] != '\0') { Tcl_AppendResult(interp, "\n\n", pqerror, NULL); --- 498,502 ---- } ! pqerror = PQerrorMessage(pconn->pgconn); if (pqerror[0] != '\0') { Tcl_AppendResult(interp, "\n\n", pqerror, NULL); *************** *** 668,672 **** blob_get(Tcl_Interp *interp, Ns_DbHandle *handle, char* lob_id) { ! NsPgConn *nsConn = (NsPgConn *) handle->connection; int segment; char query[100]; --- 668,672 ---- blob_get(Tcl_Interp *interp, Ns_DbHandle *handle, char* lob_id) { ! Connection *pconn = handle->connection; int segment; char query[100]; *************** *** 694,703 **** } ! if (PQntuples(nsConn->res) == 0) { break; } ! byte_len_column = PQgetvalue(nsConn->res, 0, 0); ! data_column = PQgetvalue(nsConn->res, 0, 1); sscanf(byte_len_column, "%d", &byte_len); nbytes += byte_len; --- 694,703 ---- } ! if (PQntuples(pconn->res) == 0) { break; } ! byte_len_column = PQgetvalue(pconn->res, 0, 0); ! data_column = PQgetvalue(pconn->res, 0, 1); sscanf(byte_len_column, "%d", &byte_len); nbytes += byte_len; *************** *** 711,716 **** } ! PQclear(nsConn->res); ! nsConn->res = NULL; return TCL_OK; --- 711,716 ---- } ! PQclear(pconn->res); ! pconn->res = NULL; return TCL_OK; *************** *** 735,744 **** int to_conn_p, char* filename) { ! NsPgConn *nsConn = (NsPgConn *) handle->connection; ! int segment; ! char query[100]; ! int fd; ! char *segment_pos; ! Ns_Conn *conn; if (to_conn_p) { --- 735,744 ---- int to_conn_p, char* filename) { ! Connection *pconn = handle->connection; ! Ns_Conn *conn; ! int segment; ! char query[100]; ! int fd; ! char *segment_pos; if (to_conn_p) { *************** *** 790,799 **** return TCL_ERROR; } ! if (PQntuples(nsConn->res) == 0) { break; } ! byte_len_column = PQgetvalue(nsConn->res, 0, 0); ! data_column = PQgetvalue(nsConn->res, 0, 1); sscanf(byte_len_column, "%d", &byte_len); n = byte_len; --- 790,799 ---- return TCL_ERROR; } ! if (PQntuples(pconn->res) == 0) { break; } ! byte_len_column = PQgetvalue(pconn->res, 0, 0); ! data_column = PQgetvalue(pconn->res, 0, 1); sscanf(byte_len_column, "%d", &byte_len); n = byte_len; *************** *** 811,816 **** } ! PQclear(nsConn->res); ! nsConn->res = NULL; return TCL_OK; --- 811,816 ---- } ! PQclear(pconn->res); ! pconn->res = NULL; return TCL_OK; Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChangeLog 15 Jun 2005 20:22:11 -0000 1.2 --- ChangeLog 15 Jun 2005 23:20:38 -0000 1.3 *************** *** 1,4 **** --- 1,9 ---- 2005-06-15 Stephen Deasey <sd...@us...> + * dbpg.h: + * nsdbpg.c: + * tclcmds.c: Use a regular naming scheme for functions and + variables. + * nsdbpg.c: Untabify, reindent and reorganize. Drop emulation code for AOLserver 2.x ns_table etc. commands. Index: dbpg.h =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/dbpg.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dbpg.h 15 Jun 2005 20:22:11 -0000 1.1 --- dbpg.h 15 Jun 2005 23:20:39 -0000 1.2 *************** *** 49,64 **** */ ! typedef struct NsPgConn { ! PGconn *conn; ! unsigned int cNum; PGresult *res; int nCols; int nTuples; int curTuple; int in_transaction; ! } NsPgConn; ! extern char *PgDbName; ! extern int Ns_PgServerInit(char *hServer, char *hModule, char *hDriver); --- 49,64 ---- */ ! typedef struct Connection { ! PGconn *pgconn; PGresult *res; + unsigned int id; int nCols; int nTuples; int curTuple; int in_transaction; ! } Connection; ! extern char *pgDbName; ! extern int PgDbServerInit(char *server, char *module, char *driver); |
From: Stephen D. <sd...@us...> - 2005-06-15 20:22:23
|
Update of /cvsroot/naviserver/modules/nsdbpg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6452 Modified Files: ChangeLog Makefile nsdbpg.c Added Files: dbpg.h tclcmds.c Removed Files: nsdbpg.h Log Message: * nsdbpg.c: Untabify, reindent and reorganize. Drop emulation code for AOLserver 2.x ns_table etc. commands. * tclcmds.c: Split extra Tcl commands and bind vaiable emulation code into new file. * nsdbpg.h: * dbpg.h: Rename header to reflect it's private status. Move all private declarations into c files, leaving just the handle structure shared module wide. * Makefile: Remove all the crud. Index: nsdbpg.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/nsdbpg.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** nsdbpg.c 15 Jun 2005 02:38:27 -0000 1.1.1.1 --- nsdbpg.c 15 Jun 2005 20:22:11 -0000 1.2 *************** *** 27,40 **** * version of this file under either the License or the GPL. * - * $Header$ */ ! #include "nsdbpg.h" ! DllExport int Ns_ModuleVersion = 1; ! static char datestyle[STRING_BUF_LEN]; [...2579 lines suppressed...] - for (i = 0; i < tinfo->ncolumns; i++) - { - char *cname = tinfo->columns[i]->name; - if ( (cname == name) - || ((cname == NULL) && (name == NULL)) - || (strcmp(cname, name) == 0)) - { - result = i; - break; - } - } - - return (result); - - } /* Ns_DbColumnIndex */ - - - #endif /* FOR_ACS_USE */ - #endif /* NS_AOLSERVER_3_PLUS */ --- 796,797 ---- --- NEW FILE: dbpg.h --- /* * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is AOLserver Code and related documentation * distributed by AOL. * * The Initial Developer of the Original Code is America Online, * Inc. Portions created by AOL are Copyright (C) 1999 America Online, * Inc. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License (the "GPL"), in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the License or the GPL. * */ /* * dbpg.h -- * * Private types and declarations for the nsdbpg module. * * $Header: /cvsroot/naviserver/modules/nsdbpg/dbpg.h,v 1.1 2005/06/15 20:22:11 sdeasey Exp $ */ #ifndef DBPG_H #define DBPG_H #include "nsdb.h" #include "libpq-fe.h" /* * The following structure maintains per handle data * specific to postgres. */ typedef struct NsPgConn { PGconn *conn; unsigned int cNum; PGresult *res; int nCols; int nTuples; int curTuple; int in_transaction; } NsPgConn; extern char *PgDbName; extern int Ns_PgServerInit(char *hServer, char *hModule, char *hDriver); #endif /* DBPG_H */ Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ChangeLog 15 Jun 2005 02:38:27 -0000 1.1.1.1 --- ChangeLog 15 Jun 2005 20:22:11 -0000 1.2 *************** *** 1,2 **** --- 1,14 ---- + 2005-06-15 Stephen Deasey <sd...@us...> + + * nsdbpg.c: Untabify, reindent and reorganize. Drop emulation code + for AOLserver 2.x ns_table etc. commands. + * tclcmds.c: Split extra Tcl commands and bind vaiable emulation + code into new file. + * nsdbpg.h: + * dbpg.h: Rename header to reflect it's private status. Move all + private declarations into c files, leaving just the handle + structure shared module wide. + * Makefile: Remove all the crud. + 2005-06-14 Stephen Deasey <sd...@us...> --- NEW FILE: tclcmds.c --- /* * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is AOLserver Code and related documentation * distributed by AOL. * * The Initial Developer of the Original Code is America Online, * Inc. Portions created by AOL are Copyright (C) 1999 America Online, * Inc. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms [...1044 lines suppressed...] return c; } static void decode3(unsigned char *p, char *buf, int n) { char c1, c2, c3, c4; c1 = get_one(p[0]); c2 = get_one(p[1]); c3 = get_one(p[2]); c4 = get_one(p[3]); if (n >= 1) *buf++ = DEC(c1) << 2 | DEC(c2) >> 4; if (n >= 2) *buf++ = DEC(c2) << 4 | DEC(c3) >> 2; if (n >= 3) *buf++ = DEC(c3) << 6 | DEC(c4); } Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/modules/nsdbpg/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 15 Jun 2005 02:38:27 -0000 1.1.1.1 --- Makefile 15 Jun 2005 20:22:11 -0000 1.2 *************** *** 34,38 **** MODNAME = nsdbpg MOD = nsdbpg.so ! MODOBJS = nsdbpg.o MODLIBS = -lnsdb -lpq --- 34,39 ---- MODNAME = nsdbpg MOD = nsdbpg.so ! MODOBJS = nsdbpg.o tclcmds.o ! HDRS = dbpg.h MODLIBS = -lnsdb -lpq --- nsdbpg.h DELETED --- |
From: Zoran V. <vas...@us...> - 2005-06-15 20:02:46
|
Update of /cvsroot/naviserver/modules/nsexample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25967 Modified Files: ChangeLog Log Message: Ooops... cut/paste error... Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsexample/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChangeLog 15 Jun 2005 19:59:59 -0000 1.2 --- ChangeLog 15 Jun 2005 20:02:33 -0000 1.3 *************** *** 1,3 **** ! 2005-06-15 Stephen Deasey <sd...@us...> * Makefile: --- 1,3 ---- ! 2005-06-15 Zoran Vasiljevic <vas...@us...> * Makefile: |
From: Zoran V. <vas...@us...> - 2005-06-15 20:00:10
|
Update of /cvsroot/naviserver/modules/nsexample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24592 Modified Files: ChangeLog Log Message: See file Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsexample/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ChangeLog 15 Jun 2005 00:43:41 -0000 1.1.1.1 --- ChangeLog 15 Jun 2005 19:59:59 -0000 1.2 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-15 Stephen Deasey <sd...@us...> + + * Makefile: + * nsexample.c: changed license wording to Mozilla + 2005-06-14 Stephen Deasey <sd...@us...> |
From: Zoran V. <vas...@us...> - 2005-06-15 19:58:37
|
Update of /cvsroot/naviserver/modules/nsexample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23661 Modified Files: Makefile Log Message: Changed license working to Mozilla Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/modules/nsexample/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 15 Jun 2005 00:43:41 -0000 1.1.1.1 --- Makefile 15 Jun 2005 19:58:27 -0000 1.2 *************** *** 1,7 **** # ! # The contents of this file are subject to the AOLserver Public License # Version 1.1 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at ! # http://aolserver.com/ # # Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- # ! # The contents of this file are subject to the Mozilla Public License # Version 1.1 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at ! # http://mozilla.org/ # # Software distributed under the License is distributed on an "AS IS" |
From: Zoran V. <vas...@us...> - 2005-06-15 19:57:58
|
Update of /cvsroot/naviserver/modules/nsexample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23383 Modified Files: nsexample.c Log Message: Changed license wording to Mozilla Index: nsexample.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsexample/nsexample.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** nsexample.c 15 Jun 2005 00:43:41 -0000 1.1.1.1 --- nsexample.c 15 Jun 2005 19:57:33 -0000 1.2 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/ * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/ * * Software distributed under the License is distributed on an "AS IS" |
From: Vlad S. <ser...@us...> - 2005-06-15 04:14:14
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2162/nsd Modified Files: binder.c Log Message: added missing listen call to Ns_SockListenUnix function Index: binder.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/binder.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** binder.c 10 Jun 2005 17:58:38 -0000 1.8 --- binder.c 15 Jun 2005 04:14:04 -0000 1.9 *************** *** 227,231 **** sock = Ns_SockBindUnix(path); } ! return (SOCKET)sock; } --- 227,238 ---- sock = Ns_SockBindUnix(path); } ! if (sock >= 0 && listen(sock, nsconf.backlog) == -1) { ! /* Can't listen; close the opened socket */ ! int err = errno; ! close(sock); ! errno = err; ! sock = -1; ! Ns_SetSockErrno(err); ! } return (SOCKET)sock; } |
From: Vlad S. <ser...@us...> - 2005-06-15 04:14:12
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2162 Modified Files: ChangeLog Log Message: added missing listen call to Ns_SockListenUnix function Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** ChangeLog 14 Jun 2005 18:15:00 -0000 1.120 --- ChangeLog 15 Jun 2005 04:14:03 -0000 1.121 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-14 Vlad Seryakov <ser...@us...> + + nsd/binder.c: added missing listen call to Ns_SockListenUnix + function. + 2005-06-14 Zoran Vasiljevic <vas...@us...> |
From: Zoran V. <vas...@us...> - 2005-06-14 18:15:10
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19843 Modified Files: ChangeLog Log Message: See file. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** ChangeLog 13 Jun 2005 10:18:55 -0000 1.119 --- ChangeLog 14 Jun 2005 18:15:00 -0000 1.120 *************** *** 1,2 **** --- 1,7 ---- + 2005-06-14 Zoran Vasiljevic <vas...@us...> + + * nsd/adpeval.c: Reformat to NaviServer coding style + (no functional changes) + 2005-06-13 Zoran Vasiljevic <vas...@us...> *************** *** 5,9 **** (first arg was lacking the "const" qualifier). ! * nsd/nswin32: Added (untested) implementatio of NsMemMap() and NsMemUmap() calls. --- 10,14 ---- (first arg was lacking the "const" qualifier). ! * nsd/nswin32: Added (untested) implementation of NsMemMap() and NsMemUmap() calls. |
From: Zoran V. <vas...@us...> - 2005-06-14 18:13:49
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18823 Modified Files: adpeval.c Log Message: Reformat to NaviServer coding style (no functional changes) Index: adpeval.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/adpeval.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** adpeval.c 10 Jun 2005 17:58:38 -0000 1.3 --- adpeval.c 14 Jun 2005 18:13:37 -0000 1.4 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License [...1694 lines suppressed...] * * Results: ! * None. * * Side Effects: ! * None. * *---------------------------------------------------------------------- --- 1042,1052 ---- * ParseFree -- * ! * Free buffers in an AdpParse structure. * * Results: ! * None. * * Side Effects: ! * None. * *---------------------------------------------------------------------- |
From: Vlad S. <ser...@us...> - 2005-06-14 03:20:47
|
Update of /cvsroot/naviserver/modules/nsdns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26182 Modified Files: ChangeLog dns.c dns.h nsdns.c Log Message: better performance for udp requests Index: nsdns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/nsdns.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nsdns.c 13 Jun 2005 16:04:32 -0000 1.4 --- nsdns.c 14 Jun 2005 03:20:38 -0000 1.5 *************** *** 39,48 **** --- 39,64 ---- unsigned short proxy_count; unsigned long proxy_time; + char buffer[DNS_BUF_SIZE]; + int size; } dnsRequest; + typedef struct _dnsQueue { + int id; + Ns_Cond cond; + Ns_Mutex lock; + unsigned long size; + unsigned long maxsize; + unsigned long requests; + unsigned long time; + struct _dnsRequest *head; + struct _dnsRequest *tail; + struct _dnsRequest *freelist; + } dnsQueue; + static void *dnsRequestCreate(int sock,char *buf,int len); static void dnsRequestFree(dnsRequest *req); static int dnsRequestSend(dnsRequest *req); static int dnsRequestHandle(dnsRequest *req); + static void dnsRecordCache(dnsRecord **list); static int dnsWrite(int sock, void *vbuf, int len); static int dnsRead(int sock, void *vbuf, int len); *************** *** 51,60 **** static int DnsCmd(ClientData arg,Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[]); static int DnsInterpInit(Tcl_Interp *interp, void *context); - static int DnsUdpListen(SOCKET sock,void *si,int when); static int DnsTcpListen(SOCKET sock,void *si,int when); static void DnsTcpThread(void *arg); static void DnsProxyThread(void *arg); ! ! static void dnsRecordCache(dnsRecord **list); static unsigned short dnsID = 0; --- 67,75 ---- static int DnsCmd(ClientData arg,Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[]); static int DnsInterpInit(Tcl_Interp *interp, void *context); static int DnsTcpListen(SOCKET sock,void *si,int when); static void DnsTcpThread(void *arg); static void DnsProxyThread(void *arg); ! static void DnsQueueListenThread(void *arg); ! static void DnsQueueRequestThread(void *arg); static unsigned short dnsID = 0; *************** *** 68,80 **** static int dnsProxyPort; static int dnsProxySock; static int dnsProxyRetries; static char *dnsProxyHost; static char *dnsDefaultHost; - static struct sockaddr_in dnsProxyAddr; static Tcl_HashTable dnsCache; ! static Ns_Mutex dnsMutex; ! static dnsRequest *dnsProxyQueue = 0; ! static Ns_Mutex dnsProxyMutex; static Ns_Cond dnsProxyCond; NS_EXPORT int Ns_ModuleVersion = 1; --- 83,98 ---- static int dnsProxyPort; static int dnsProxySock; + static int dnsThreads; + static int dnsRcvBuf; static int dnsProxyRetries; static char *dnsProxyHost; static char *dnsDefaultHost; static Tcl_HashTable dnsCache; ! static Ns_RWLock dnsMutex; static Ns_Cond dnsProxyCond; + static Ns_Mutex dnsProxyMutex; + static dnsRequest *dnsProxyQueue = 0; + static struct sockaddr_in dnsProxyAddr; + static dnsQueue dnsQueues[DNS_QUEUE_SIZE]; NS_EXPORT int Ns_ModuleVersion = 1; *************** *** 83,86 **** --- 101,105 ---- Ns_ModuleInit(char *server, char *module) { + int n,i; char *path, *address; *************** *** 96,120 **** if(!Ns_ConfigGetInt(path,"ttl",&dnsTTL)) dnsTTL = 86400; if(!Ns_ConfigGetInt(path,"negativettl",&dnsNegativeTTL)) dnsNegativeTTL = 3600; if(!Ns_ConfigGetInt(path,"readtimeout",&dnsReadTimeout)) dnsReadTimeout = 30; if(!Ns_ConfigGetInt(path,"writetimeout",&dnsWriteTimeout)) dnsWriteTimeout = 30; if(!Ns_ConfigGetInt(path,"proxytimeout",&dnsProxyTimeout)) dnsProxyTimeout = 3; if(!Ns_ConfigGetInt(path,"proxyretries",&dnsProxyRetries)) dnsProxyRetries = 2; dnsDefaultHost = Ns_ConfigGet(path,"defaulthost"); ! /* Resolving dns servers */ dnsInit("nameserver",Ns_ConfigGet(path,"nameserver"),0); /* If no port specified it will be just client dns resolver module */ if(dnsPort > 0) { ! /* UDP socket */ if((dnsUdpSock = Ns_SockListenUdp(address,dnsPort)) == -1) { Ns_Log(Error,"nsdns: udp: %s:%d: couldn't create socket: %s",address,dnsPort,strerror(errno)); return NS_ERROR; } ! Ns_SockCallback(dnsUdpSock,DnsUdpListen,0,NS_SOCK_READ|NS_SOCK_EXIT|NS_SOCK_EXCEPTION); ! /* TCP socket */ if((dnsTcpSock = Ns_SockListen(address,dnsPort)) == -1) { Ns_Log(Error,"nsdns: tcp: %s:%d: couldn't create socket: %s",address,dnsPort,strerror(errno)); return NS_ERROR; } Ns_SockCallback(dnsTcpSock,DnsTcpListen,0,NS_SOCK_READ|NS_SOCK_EXIT|NS_SOCK_EXCEPTION); if(!Ns_ConfigGetInt(path,"proxyport",&dnsProxyPort)) dnsProxyPort = 53; if((dnsProxyHost = Ns_ConfigGet(path,"proxyhost")) && --- 115,142 ---- if(!Ns_ConfigGetInt(path,"ttl",&dnsTTL)) dnsTTL = 86400; if(!Ns_ConfigGetInt(path,"negativettl",&dnsNegativeTTL)) dnsNegativeTTL = 3600; + if(!Ns_ConfigGetInt(path,"rcvbuf",&dnsRcvBuf)) dnsRcvBuf = 0; if(!Ns_ConfigGetInt(path,"readtimeout",&dnsReadTimeout)) dnsReadTimeout = 30; if(!Ns_ConfigGetInt(path,"writetimeout",&dnsWriteTimeout)) dnsWriteTimeout = 30; if(!Ns_ConfigGetInt(path,"proxytimeout",&dnsProxyTimeout)) dnsProxyTimeout = 3; if(!Ns_ConfigGetInt(path,"proxyretries",&dnsProxyRetries)) dnsProxyRetries = 2; + if (!Ns_ConfigGetInt(path,"threads",&dnsThreads)) dnsThreads = 1; dnsDefaultHost = Ns_ConfigGet(path,"defaulthost"); ! // Resolving dns servers dnsInit("nameserver",Ns_ConfigGet(path,"nameserver"),0); /* If no port specified it will be just client dns resolver module */ if(dnsPort > 0) { ! // UDP socket if((dnsUdpSock = Ns_SockListenUdp(address,dnsPort)) == -1) { Ns_Log(Error,"nsdns: udp: %s:%d: couldn't create socket: %s",address,dnsPort,strerror(errno)); return NS_ERROR; } ! // TCP socket if((dnsTcpSock = Ns_SockListen(address,dnsPort)) == -1) { Ns_Log(Error,"nsdns: tcp: %s:%d: couldn't create socket: %s",address,dnsPort,strerror(errno)); return NS_ERROR; } + // Use NS callback facility because TCP is not going to be very busy Ns_SockCallback(dnsTcpSock,DnsTcpListen,0,NS_SOCK_READ|NS_SOCK_EXIT|NS_SOCK_EXCEPTION); + // DNS proxy thread if(!Ns_ConfigGetInt(path,"proxyport",&dnsProxyPort)) dnsProxyPort = 53; if((dnsProxyHost = Ns_ConfigGet(path,"proxyhost")) && *************** *** 127,130 **** --- 149,175 ---- return NS_ERROR; } + if(dnsRcvBuf) { + setsockopt(dnsUdpSock,SOL_SOCKET,SO_RCVBUF,&dnsRcvBuf,sizeof(dnsRcvBuf)); + setsockopt(dnsUdpSock,SOL_SOCKET,SO_SNDBUF,&dnsRcvBuf,sizeof(dnsRcvBuf)); + } + // Start queue threads + for(n = 0;n < dnsThreads;n++) { + dnsQueues[n].id = n; + // Preallocate SIP tickets + for(i = 0;i <= dnsThreads*10;i++) { + dnsRequest *req = ns_calloc(1,sizeof(dnsRequest)); + req->next = dnsQueues[n].freelist; + dnsQueues[n].freelist = req; + } + if(Ns_BeginDetachedThread(DnsQueueRequestThread,&dnsQueues[n]) != NS_OK) { + Ns_Log(Error,"nsdns: queue thread failed: %s",strerror(errno)); + return NS_ERROR; + } + } + // Start listen thread + if(Ns_BeginDetachedThread(DnsQueueListenThread,0) != NS_OK) { + Ns_Log(Error,"nsdns: main thread failed: %s",strerror(errno)); + return NS_ERROR; + } } if(dnsDebug) { *************** *** 133,137 **** Ns_Log(Notice,"nsdns: SEGV and Panic trapping is activated"); } - Ns_MutexSetName2(&dnsMutex,"nsdns","dns"); Ns_MutexSetName2(&dnsProxyMutex,"nsdns","proxy"); Ns_Log(Notice,"nsdns: version %s listening on %s:%d, FD %d:%d",VERSION,address?address:"0.0.0.0",dnsPort,dnsUdpSock,dnsTcpSock); --- 178,181 ---- *************** *** 174,188 **** DnsCmd(ClientData arg,Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[]) { - int cmd; enum commands { ! cmdAdd, cmdRemove, cmdFlush, cmdList, cmdResolve, cmdQueue, cmdLookup }; static const char *sCmd[] = { ! "add", "del", "flush", "list", "resolve", "queue", "lookup", 0 }; dnsRecord *drec; Tcl_HashEntry *hrec; Tcl_HashSearch search; if(objc < 2) { --- 218,234 ---- DnsCmd(ClientData arg,Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[]) { enum commands { ! cmdAdd, cmdRemove, cmdFlush, cmdList, cmdResolve, cmdQueue, cmdLookup, cmdStat }; static const char *sCmd[] = { ! "add", "del", "flush", "list", "resolve", "queue", "lookup", "stat", 0 }; + int i,cmd; + char tmp[128]; dnsRecord *drec; Tcl_HashEntry *hrec; Tcl_HashSearch search; + unsigned long n,r; if(objc < 2) { *************** *** 194,197 **** --- 240,254 ---- switch(cmd) { + case cmdStat: + for(n = 0,r = 0,i = 0;i < dnsThreads;i++) { + n += dnsQueues[i].size; + r += dnsQueues[i].requests; + sprintf(tmp,"size%d %lu maxsize%d %lu time%d %lu requests%d %lu ",i,dnsQueues[i].size,i,dnsQueues[i].maxsize,i,dnsQueues[i].time,i,dnsQueues[i].requests); + Tcl_AppendResult(interp, tmp, 0); + } + sprintf(tmp,"total %lu requests %lu",n,r); + Tcl_AppendResult(interp, tmp, 0); + break; + case cmdAdd: if(objc < 5) { *************** *** 212,215 **** --- 269,281 ---- if(objc > 6) drec->ttl = atoi(Tcl_GetString(objv[6])); break; + case DNS_TYPE_NAPTR: + if(objc < 10) { + Tcl_WrongNumArgs(interp,2,objv,"name type order preference flags service regexp replace ?ttl?"); + return TCL_ERROR; + } + drec = dnsRecordCreateNAPTR(Tcl_GetString(objv[2]),atoi(Tcl_GetString(objv[4])),atoi(Tcl_GetString(objv[5])), + Tcl_GetString(objv[6]),Tcl_GetString(objv[7]),Tcl_GetString(objv[8]),Tcl_GetString(objv[9])); + if(objc > 10) drec->ttl = atoi(Tcl_GetString(objv[10])); + break; case DNS_TYPE_NS: drec = dnsRecordCreateNS(Tcl_GetString(objv[2]),Tcl_GetString(objv[4])); *************** *** 235,239 **** return TCL_ERROR; } ! Ns_MutexLock(&dnsMutex); if((hrec = Tcl_FindHashEntry(&dnsCache,Tcl_GetString(objv[2])))) { int type = dnsType(Tcl_GetString(objv[3])); --- 301,305 ---- return TCL_ERROR; } ! Ns_RWLockWrLock(&dnsMutex); if((hrec = Tcl_FindHashEntry(&dnsCache,Tcl_GetString(objv[2])))) { int type = dnsType(Tcl_GetString(objv[3])); *************** *** 252,259 **** } } ! Ns_MutexUnlock(&dnsMutex); break; case cmdFlush: ! Ns_MutexLock(&dnsMutex); hrec = Tcl_FirstHashEntry(&dnsCache,&search); while(hrec) { --- 318,325 ---- } } ! Ns_RWLockUnlock(&dnsMutex); break; case cmdFlush: ! Ns_RWLockWrLock(&dnsMutex); hrec = Tcl_FirstHashEntry(&dnsCache,&search); while(hrec) { *************** *** 263,272 **** hrec = Tcl_NextHashEntry(&search); } ! Ns_MutexUnlock(&dnsMutex); break; case cmdList: { Tcl_Obj *list = Tcl_NewListObj(0,0); ! Ns_MutexLock(&dnsMutex); hrec = Tcl_FirstHashEntry(&dnsCache,&search); while(hrec) { --- 329,338 ---- hrec = Tcl_NextHashEntry(&search); } ! Ns_RWLockUnlock(&dnsMutex); break; case cmdList: { Tcl_Obj *list = Tcl_NewListObj(0,0); ! Ns_RWLockRdLock(&dnsMutex); hrec = Tcl_FirstHashEntry(&dnsCache,&search); while(hrec) { *************** *** 275,279 **** hrec = Tcl_NextHashEntry(&search); } ! Ns_MutexUnlock(&dnsMutex); Tcl_SetObjResult(interp,list); break; --- 341,345 ---- hrec = Tcl_NextHashEntry(&search); } ! Ns_RWLockUnlock(&dnsMutex); Tcl_SetObjResult(interp,list); break; *************** *** 342,428 **** } - static int - DnsUdpListen(SOCKET sock,void *si,int when) - { - int len, saddr_len; - char buf[DNS_BUF_SIZE+1]; - dnsRequest *req; - struct sockaddr_in saddr; - - switch(when) { - case NS_SOCK_READ: - saddr_len = sizeof(struct sockaddr_in); - if((len = recvfrom(sock,buf,DNS_BUF_SIZE,0,(struct sockaddr*)&saddr,&saddr_len)) <= 0) { - Ns_Log(Error,"nsdns: recvfrom error: %s",strerror(errno)); - return NS_TRUE; - } - if(dnsDebug > 3) Ns_Log(Error,"DnsUdpListen: received %d bytes from %s",len,ns_inet_ntoa(saddr.sin_addr)); - if(!(req = dnsRequestCreate(sock,buf,len))) return NS_TRUE; - memcpy(&req->addr,&saddr,sizeof(struct sockaddr_in)); - switch(dnsRequestHandle(req)) { - case 1: - /* Request will handled by proxy queue manager */ - break; - case 0: - dnsRequestSend(req); - default: - dnsRequestFree(req); - } - return NS_TRUE; - } - close(sock); - return NS_FALSE; - } - - static int - DnsTcpListen(SOCKET sock,void *si,int when) - { - SOCKET new; - struct sockaddr_in saddr; - int saddr_len = sizeof(struct sockaddr_in); - - switch(when) { - case NS_SOCK_READ: - if((new = Ns_SockAccept(sock,(struct sockaddr*)&saddr,&saddr_len)) == INVALID_SOCKET) break; - if(dnsDebug > 3) Ns_Log(Error,"DnsTcpListen: connection from %s",ns_inet_ntoa(saddr.sin_addr)); - if(Ns_BeginDetachedThread(DnsTcpThread,(void *)new) != NS_OK) { - Ns_Log(Error,"nsdns: Ns_BeginThread() failed with %s.",strerror(errno)); - close(new); - } - return NS_TRUE; - } - close(sock); - return NS_FALSE; - } - - static void - DnsTcpThread(void *arg) - { - int sock = (int)arg; - short len; - dnsRequest *req; - char buf[DNS_BUF_SIZE]; - - Ns_SockSetNonBlocking(sock); - if(dnsRead(sock,&len,2) != 2 || - (len = ntohs(len)) > DNS_BUF_SIZE || - dnsRead(sock,buf,len) != len || - !(req = dnsRequestCreate(sock,buf,len))) { - close(sock); - return; - } - req->flags |= DNS_TCP; - switch(dnsRequestHandle(req)) { - case 1: - /* Request will handled by proxy queue manager */ - break; - case 0: - dnsRequestSend(req); - default: - dnsRequestFree(req); - } - close(sock); - } - static void DnsProxyThread(void *arg) --- 408,411 ---- *************** *** 520,523 **** --- 503,653 ---- } + static void + DnsQueueListenThread(void *arg) + { + int len = sizeof(struct sockaddr_in); + dnsRequest *req, buf; + int id = 0; + + Ns_ThreadSetName("nsdns:thread"); + + while(1) { + if ((buf.size = recvfrom(dnsUdpSock,buf.buffer,DNS_BUF_SIZE-1,0,(struct sockaddr*)&buf.addr,&len)) <= 0) { + Ns_Log(Error,"nsdns: recvfrom error: %s",strerror(errno)); + continue; + } + buf.buffer[buf.size] = 0; + if(dnsDebug > 0) { + Ns_Log(Debug,"nsdns: received %d bytes from %s",buf.size,ns_inet_ntoa(buf.addr.sin_addr)); + } + /* + * Link new job into the queue + */ + Ns_MutexLock(&dnsQueues[id].lock); + if((req = dnsQueues[id].freelist)) dnsQueues[id].freelist = req->next; + if(!req) req = ns_calloc(1,sizeof(dnsRequest)); + memcpy(req,&buf,sizeof(buf)); + if(dnsQueues[id].tail) dnsQueues[id].tail->next = req; + dnsQueues[id].tail = req; + if(!dnsQueues[id].head) dnsQueues[id].head = req; + dnsQueues[id].size++; + dnsQueues[id].requests++; + Ns_CondBroadcast(&dnsQueues[id].cond); + Ns_MutexUnlock(&dnsQueues[id].lock); + if(++id >= dnsThreads) id = 0; + } + } + + static void + DnsQueueRequestThread(void *arg) + { + char buf[32]; + dnsQueue *queue; + dnsRequest *req; + unsigned long t0; + struct timeval t1,t2; + + queue = (dnsQueue*)arg; + sprintf(buf, "nsdns:queue:%d", queue->id); + Ns_Log(Notice, "Starting thread: %s", buf); + Ns_ThreadSetName(buf); + + Ns_MutexInit(&queue->lock); + Ns_MutexSetName(&queue->lock,buf); + Ns_MutexLock(&queue->lock); + while (1) { + while (!queue->head) { + Ns_CondWait(&queue->cond, &queue->lock); + } + gettimeofday(&t1,0); + /* + * Unlink first job from the queue + */ + req = queue->head; + queue->head = req->next; + if(queue->tail == req) queue->tail = 0; + if(queue->size > queue->maxsize) queue->maxsize = queue->size; + queue->size--; + Ns_MutexUnlock(&queue->lock); + req->sock = dnsUdpSock; + // Allocate request structure + if((req->req = dnsParsePacket(req->buffer,req->size))) { + // Prepare reply header + req->reply = dnsPacketCreateReply(req->req); + switch(dnsRequestHandle(req)) { + case 1: + // Proxy will handle request + req = 0; + break; + case 0: + dnsRequestSend(req); + dnsPacketFree(req->req,3); + dnsPacketFree(req->reply,4); + break; + } + } + // Put request structure back if not handled by proxy + if(req) { + req->next = queue->freelist; + queue->freelist = req; + } + Ns_MutexLock(&queue->lock); + Ns_CondBroadcast(&queue->cond); + gettimeofday(&t2,0); + t0 = ((t2.tv_sec - t1.tv_sec)*1000000 + (t2.tv_usec - t1.tv_usec))/1000; + if(t0 > queue->time) queue->time = t0; + } + } + + static int + DnsTcpListen(SOCKET sock,void *si,int when) + { + SOCKET new; + struct sockaddr_in saddr; + int saddr_len = sizeof(struct sockaddr_in); + + switch(when) { + case NS_SOCK_READ: + if((new = Ns_SockAccept(sock,(struct sockaddr*)&saddr,&saddr_len)) == INVALID_SOCKET) break; + if(dnsDebug > 3) Ns_Log(Error,"DnsTcpListen: connection from %s",ns_inet_ntoa(saddr.sin_addr)); + if(Ns_BeginDetachedThread(DnsTcpThread,(void *)new) != NS_OK) { + Ns_Log(Error,"nsdns: Ns_BeginThread() failed with %s.",strerror(errno)); + close(new); + } + return NS_TRUE; + } + close(sock); + return NS_FALSE; + } + + static void + DnsTcpThread(void *arg) + { + int sock = (int)arg; + short len; + dnsRequest *req; + char buf[DNS_BUF_SIZE]; + + Ns_SockSetNonBlocking(sock); + if(dnsRead(sock,&len,2) != 2 || + (len = ntohs(len)) > DNS_BUF_SIZE || + dnsRead(sock,buf,len) != len || + !(req = dnsRequestCreate(sock,buf,len))) { + close(sock); + return; + } + req->flags |= DNS_TCP; + switch(dnsRequestHandle(req)) { + case 1: + /* Request will handled by proxy queue manager */ + break; + case 0: + dnsRequestSend(req); + default: + dnsRequestFree(req); + } + close(sock); + } + static int dnsRead(int sock, void *vbuf, int len) *************** *** 593,597 **** switch(DNS_GET_OPCODE(req->req->u)) { case OPCODE_QUERY: ! Ns_MutexLock(&dnsMutex); for(qrec = req->req->qdlist;qrec;qrec = qrec->next) { if(!qrec->name) continue; --- 723,727 ---- switch(DNS_GET_OPCODE(req->req->u)) { case OPCODE_QUERY: ! Ns_RWLockRdLock(&dnsMutex); for(qrec = req->req->qdlist;qrec;qrec = qrec->next) { if(!qrec->name) continue; *************** *** 667,671 **** } } ! Ns_MutexUnlock(&dnsMutex); // No records found if(!req->reply->ancount && !req->reply->nscount) { --- 797,801 ---- } } ! Ns_RWLockUnlock(&dnsMutex); // No records found if(!req->reply->ancount && !req->reply->nscount) { *************** *** 733,737 **** drec->timestamp = now; drec->next = drec->prev = 0; ! Ns_MutexLock(&dnsMutex); hrec = Tcl_CreateHashEntry(&dnsCache,drec->name,&new); if(new) { --- 863,867 ---- drec->timestamp = now; drec->next = drec->prev = 0; ! Ns_RWLockWrLock(&dnsMutex); hrec = Tcl_CreateHashEntry(&dnsCache,drec->name,&new); if(new) { *************** *** 746,750 **** } } ! Ns_MutexUnlock(&dnsMutex); } } --- 876,880 ---- } } ! Ns_RWLockUnlock(&dnsMutex); } } Index: dns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dns.c 12 Jun 2005 22:34:22 -0000 1.3 --- dns.c 14 Jun 2005 03:20:38 -0000 1.4 *************** *** 435,438 **** --- 435,458 ---- dnsRecord * + dnsRecordCreateNAPTR(char *name,int order,int preference,char *flags,char *service,char *regexp,char *replace) + { + dnsRecord *y = ns_calloc(1,sizeof(dnsRecord)); + y->name = ns_strcopy(name); + y->type = DNS_TYPE_NAPTR; + y->class = DNS_CLASS_INET; + y->data.naptr = ns_calloc(1,sizeof(dnsMX)); + y->data.naptr->order = order; + y->data.naptr->preference = preference; + y->data.naptr->flags = ns_strcopy(flags); + y->data.naptr->service = ns_strcopy(service); + y->data.naptr->regexp = ns_strcopy(regexp); + y->data.naptr->replace = ns_strcopy(replace); + y->len = 2; + if(y->data.name) y->len += strlen(y->data.name); + y->ttl = dnsTTL; + return y; + } + + dnsRecord * dnsRecordCreateSOA(char *name,char *mname,char *rname, unsigned long serial,unsigned long refresh, *************** *** 476,479 **** --- 496,508 ---- Tcl_ListObjAppendElement(interp,obj,Tcl_NewIntObj(drec->data.mx->preference)); break; + case DNS_TYPE_NAPTR: + if(!drec->data.naptr) break; + Tcl_ListObjAppendElement(interp,obj,Tcl_NewIntObj(drec->data.naptr->order)); + Tcl_ListObjAppendElement(interp,obj,Tcl_NewIntObj(drec->data.naptr->preference)); + Tcl_ListObjAppendElement(interp,obj,Tcl_NewStringObj(drec->data.naptr->flags,-1)); + Tcl_ListObjAppendElement(interp,obj,Tcl_NewStringObj(drec->data.naptr->service,-1)); + Tcl_ListObjAppendElement(interp,obj,Tcl_NewStringObj(drec->data.naptr->regexp,-1)); + Tcl_ListObjAppendElement(interp,obj,Tcl_NewStringObj(drec->data.naptr->replace,-1)); + break; case DNS_TYPE_SOA: if(!drec->data.soa) break; *************** *** 558,561 **** --- 587,605 ---- } break; + case DNS_TYPE_NAPTR: + if(!rec->data.naptr || !drec->data.naptr || + (!rec->data.naptr->regexp && !rec->data.naptr->replace) || + (!drec->data.naptr->regexp && !drec->data.naptr->replace)) return -1; + if((rec->data.naptr->regexp && drec->data.naptr->regexp && + !strcmp(rec->data.naptr->regexp,drec->data.naptr->regexp)) || + (rec->data.naptr->replace && drec->data.naptr->replace && + !strcmp(rec->data.naptr->replace,drec->data.naptr->replace))) { + if(replace) { + rec->ttl = drec->ttl; + rec->data.mx->preference = drec->data.mx->preference; + } + return 1; + } + break; case DNS_TYPE_SOA: if(!rec->data.soa || !drec->data.soa) return -1; *************** *** 716,719 **** --- 760,782 ---- y->data.name = ns_strdup(name); break; + case DNS_TYPE_NAPTR: + y->data.naptr = ns_calloc(1,sizeof(dnsNAPTR)); + y->data.naptr->order = ntohs(*((unsigned short*)pkt->buf.ptr)); + pkt->buf.ptr += 2; + y->data.mx->preference = ntohs(*((unsigned short*)pkt->buf.ptr)); + pkt->buf.ptr += 2; + /* flags */ + if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; + y->data.naptr->flags = ns_strdup(name); + /* service */ + if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; + y->data.naptr->service = ns_strdup(name); + /* regexp */ + if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; + y->data.naptr->regexp = ns_strdup(name); + /* replace */ + if(dnsParseName(pkt,&pkt->buf.ptr,name,255,0,0) < 0) goto err; + y->data.naptr->replace = ns_strdup(name); + break; case DNS_TYPE_SOA: y->data.soa = ns_calloc(1,sizeof(dnsSOA)); *************** *** 910,913 **** --- 973,988 ---- dnsEncodeName(pkt,list->data.name); break; + case DNS_TYPE_NAPTR: + dnsEncodeShort(pkt,list->data.naptr->order); + dnsEncodeShort(pkt,list->data.naptr->preference); + dnsEncodeGrow(pkt,64,"pkt:naptr"); + dnsEncodeName(pkt,list->data.naptr->flags); + dnsEncodeGrow(pkt,64,"pkt:naptr"); + dnsEncodeName(pkt,list->data.naptr->service); + dnsEncodeGrow(pkt,64,"pkt:naptr"); + dnsEncodeName(pkt,list->data.naptr->regexp); + dnsEncodeGrow(pkt,64,"pkt:naptr"); + dnsEncodeName(pkt,list->data.naptr->replace); + break; } dnsEncodeEnd(pkt); *************** *** 1062,1065 **** --- 1137,1141 ---- type == DNS_TYPE_PTR ? "PTR" : type == DNS_TYPE_MX ? "MX" : + type == DNS_TYPE_NAPTR ? "NAPTR" : type == DNS_TYPE_ANY ? "ANY" : "unknown"; } *************** *** 1074,1077 **** --- 1150,1154 ---- if(!strcasecmp(type,"SOA")) return DNS_TYPE_SOA; if(!strcasecmp(type,"PTR")) return DNS_TYPE_PTR; + if(!strcasecmp(type,"NAPTR")) return DNS_TYPE_NAPTR; if(!strcasecmp(type,"MX")) return DNS_TYPE_MX; return -1; Index: dns.h =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/dns.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dns.h 12 Jun 2005 22:34:22 -0000 1.3 --- dns.h 14 Jun 2005 03:20:38 -0000 1.4 *************** *** 84,87 **** --- 84,88 ---- #define DNS_BUF_SIZE 1524 #define DNS_REPLY_SIZE 514 + #define DNS_QUEUE_SIZE 16 typedef struct _dnsSOA { *************** *** 106,118 **** } dnsName; ! typedef struct _dnsNA { struct _dnsNA *next; short order; ! short prefs; char *flags; char *service; char *regexp; char *replace; ! } dnsNA; typedef struct _dnsRecord { --- 107,119 ---- } dnsName; ! typedef struct _dnsNAPTR { struct _dnsNA *next; short order; ! short preference; char *flags; char *service; char *regexp; char *replace; ! } dnsNAPTR; typedef struct _dnsRecord { *************** *** 127,131 **** struct in_addr ipaddr; dnsMX *mx; ! dnsNA *na; dnsSOA *soa; } data; --- 128,132 ---- struct in_addr ipaddr; dnsMX *mx; ! dnsNAPTR *naptr; dnsSOA *soa; } data; *************** *** 174,177 **** --- 175,180 ---- unsigned long serial,unsigned long refresh, unsigned long retry,unsigned long expire,unsigned long ttl); + dnsRecord *dnsRecordCreateNAPTR(char *name,int order,int preference,char *flags, + char *service,char *regexp,char *replace); Tcl_Obj *dnsRecordCreateTclObj(Tcl_Interp *interp,dnsRecord *drec); dnsRecord *dnsRecordAppend(dnsRecord **list,dnsRecord *pkt); Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ChangeLog 20 May 2005 20:40:08 -0000 1.1.1.1 --- ChangeLog 14 Jun 2005 03:20:38 -0000 1.2 *************** *** 1,2 **** --- 1,6 ---- + 2005-06-13 Vlad Seryakov vl...@cr... + + * restructured for more performance of udp requests + 2004-03-23 Vlad Seryakov vl...@cr... |
From: Vlad S. <ser...@us...> - 2005-06-13 16:05:11
|
Update of /cvsroot/naviserver/modules/nschartdir In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2950/nschartdir Modified Files: nschartdir.c Log Message: silenced more compiler warnings Index: nschartdir.c =================================================================== RCS file: /cvsroot/naviserver/modules/nschartdir/nschartdir.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nschartdir.c 12 Jun 2005 22:34:22 -0000 1.3 --- nschartdir.c 13 Jun 2005 16:04:31 -0000 1.4 *************** *** 416,420 **** { char *name; ! int *palette; int argc = 0; Tcl_Obj **argv; --- 416,420 ---- { char *name; ! int *palette = 0; int argc = 0; Tcl_Obj **argv; *************** *** 1250,1254 **** { int *array,argc; ! char *name; Tcl_Obj **argv; double angle = 90; --- 1250,1254 ---- { int *array,argc; ! char *name = 0; Tcl_Obj **argv; double angle = 90; *************** *** 1289,1293 **** const char *text; const char *font = 0; ! const char *align; int fontsize = 8; int fontcolor = TextColor; --- 1289,1293 ---- const char *text; const char *font = 0; ! const char *align = 0; int fontsize = 8; int fontcolor = TextColor; *************** *** 1387,1391 **** { int i,cmd; ! Chart *chart; enum commands { --- 1387,1391 ---- { int i,cmd; ! Chart *chart = 0; enum commands { |