Changeset 1209
- Timestamp:
- 03/05/10 08:25:06 (2 years ago)
- Location:
- trunk/unxsBind
- Files:
-
- 4 modified
-
data/tRRType.txt (modified) (1 diff)
-
language.h (modified) (3 diffs)
-
tresource.c (modified) (18 diffs)
-
tresourcefunc.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/unxsBind/data/tRRType.txt
r1208 r1209 1 1 A 1 1 1164326458 1 1164372645 1 0 None IpNumber IP Number Not Used IPv4 dotted quad IP number Not used Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 2 2 NS 1 1 1164327003 1 1164372655 1 0 None FQNameServer Name Server Not Used Fully qualified name server. Ex. ns1.isp.net. Not used Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 3 3 MX 1 1 1164327172 1 1164373529 1 1 MxPreference FQDomainName Preference Number Mail Server A number. Lower is higher priority. Ex. 10 Fully qualified mail server. Ex. mail.isp.net. Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 4 4 HINFO 1 1 1164327316 1 1164372682 1 1 HardwareType OperatingSystem Operating System Hardware Type Ex1. Solaris Ex2. Linux CentOS Ex1. Quad Xeon Ex2. Sun Blade 2000 Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 5 5 CNAME 1 1 1164327455 1 1164372694 1 0 None FQCanonicalName Canonical Name Not Used Usually the zone name or another zone domain Not used Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 6 6 TXT 1 1 1164327557 1 1170167809 1 0 None TextRecord Text in double quotes Not Used Ex. "v=spf1 mx ~all" Not used Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 7 7 PTR 1 1 1164327757 1 1164328917 1 0 None FQDomainName Domain Name Not Used Ex. bart.isp.net. Not used PTR Name Usually the last octet of an IP number of a class C arpa zone ValidPTRName 1 0 0 0 0 8 8 SRV 1 1 1195137855 1 1218569944 1 1 None None Priority Weight The priority of the target host, lower value means more preferred. A relative weight for records with the same priority. Service The symbolic name of the desired service. (E.g.: _sip._tcp.example.com.) None 1 Port Target TCP or UDP port on which the ser The hostname of the machine prov 1 1 0 0 9 9 AAAA 1 1 1267715002 0 0 1 0 None IpNumberv6 IPv6 Number Not Used IPv6 colon hex IP number. Must have 7 colons. Not used Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. 0 0 0 0 0 1 1 A 1 1 1164326458 1 1267802432 1 0 IpNumber IP Number IPv4 dotted quad IP number, e.g. 200.32.12.109 Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 2 2 NS 1 1 1164327003 1 1267802536 1 0 FQNameServer Name Server Fully qualified name server. E.g. ns1.isp.net. Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 3 3 MX 1 1 1164327172 1 1267802617 1 1 MxPreference FQDomainName Preference Number Mail Server A number. Lower is higher priority. Ex. 10 Fully qualified mail server. Ex. mail.isp.net. Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 4 4 HINFO 1 1 1164327316 1 1267802660 1 1 HardwareType OperatingSystem Operating System Hardware Type Ex1. Solaris Ex2. Linux CentOS Ex1. Quad Xeon Ex2. Sun Blade 2000 Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 5 5 CNAME 1 1 1164327455 1 1267802720 1 0 FQCanonicalName Canonical Name Usually the FQDN zone name or another FQDN zone domain. Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 6 6 TXT 1 1 1164327557 1 1267802765 1 0 TextRecord Text in double quotes Ex. "v=spf1 mx ~all" Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 7 7 PTR 1 1 1164327757 1 1267802853 1 0 FQDomainName Domain Name A FQDN. Ex. bart.isp.net. PTR Name Usually the last octet of an IP number of a class C arpa zone. ValidPTRName 1 0 0 8 8 SRV 1 1 1195137855 1 1267802262 1 1 Number Number Priority Weight The priority of the target host, lower value means more preferred. A relative weight for records with the same priority. Service The symbolic name of the desired service. (E.g.: _sip._tcp.example.com.) Service 1 Port Target Port Target Port number of service. The FQDN canonical hostname of the server providing the service. 1 1 9 9 AAAA 1 1 1267715002 1 1267802902 1 0 IpNumberv6 IPv6 Number IPv6 colon hex IP number. Must have 7 colons. Resource Name If empty is the zone, if partial the zone is appended, if fully qualified must end in zone name. RRName1 1 0 0 10 10 NAPTR 1 1 1267801662 1 1267803686 1 1 Number Number Order Preference Order number. Ex. 100 Preference number for same order if exists. Ex. 10 e164.arpa Origin or FQDN Ex1: 4.3.2.1.5.5.5.0.0.8.1.e164.arpa. for tel:+1-800-555-1234. Ex2: example.com. RRNameNAPTR 1 Enum NAPTRRegex Flags+ENUM Regex (+optional SRV) Ex1: "S" "SIP+D2U" Ex2: "U" "E2U+sip" E.g. "!^.*$!sip:customer-service@example.com!" _sip._udp.example.com 1 1 -
trunk/unxsBind/language.h
r166 r1209 451 451 #define LANG_FT_tResource_uZone "Belongs to this tZone" 452 452 #define LANG_FL_tResource_cName "cName" 453 #define LANG_FT_tResource_cName " Host name"453 #define LANG_FT_tResource_cName "Resource name or @" 454 454 #define LANG_FL_tResource_uTTL "uTTL" 455 455 #define LANG_FT_tResource_uTTL "Resource record TTL in seconds" … … 824 824 #define LANG_FT_tResourceImport_uResource "Primary Key" 825 825 #define LANG_FL_tResourceImport_cName "cName" 826 #define LANG_FT_tResourceImport_cName " Host name"826 #define LANG_FT_tResourceImport_cName "Resource name or @" 827 827 #define LANG_FL_tResourceImport_uTTL "uTTL" 828 828 #define LANG_FT_tResourceImport_uTTL "Resource record TTL in seconds" … … 978 978 #define LANG_FT_tDeletedResource_uZone "Belongs to this tZone" 979 979 #define LANG_FL_tDeletedResource_cName "cName" 980 #define LANG_FT_tDeletedResource_cName " Host name"980 #define LANG_FT_tDeletedResource_cName "Resource name or @" 981 981 #define LANG_FL_tDeletedResource_uTTL "uTTL" 982 982 #define LANG_FT_tDeletedResource_uTTL "Resource record TTL in seconds" -
trunk/unxsBind/tresource.c
r166 r1209 40 40 //uCreatedBy: uClient for last insert 41 41 static unsigned uCreatedBy=0; 42 #define ISM3FIELDS43 42 //uCreatedDate: Unix seconds date last insert 44 43 static long uCreatedDate=0; … … 290 289 OpenRow(LANG_FL_tResource_uResource,"black"); 291 290 printf("<input title='%s' type=text name=uResource value=%u size=16 maxlength=10 " 292 ,LANG_FT_tResource_uResource,uResource);291 ,LANG_FT_tResource_uResource,uResource); 293 292 if(guPermLevel>=20 && uMode) 294 293 { … … 312 311 //cName 313 312 OpenRow(LANG_FL_tResource_cName,"black"); 314 printf("<input title='%s' type=text name=cName value=\"%s\" size=40 maxlength=100 " 315 ,LANG_FT_tResource_cName,EncodeDoubleQuotes(cName));313 printf("<input title='%s' type=text name=cName value=\"%s\" size=40 maxlength=100 ", 314 LANG_FT_tResource_cName,EncodeDoubleQuotes(cName)); 316 315 if(guPermLevel>=0 && uMode) 317 316 { … … 326 325 OpenRow(LANG_FL_tResource_uTTL,"black"); 327 326 printf("<input title='%s' type=text name=uTTL value=%u size=16 maxlength=10 " 328 ,LANG_FT_tResource_uTTL,uTTL);327 ,LANG_FT_tResource_uTTL,uTTL); 329 328 if(guPermLevel>=0 && uMode) 330 329 { … … 345 344 OpenRow(LANG_FL_tResource_cParam1,EmptyString(cParam1)); 346 345 printf("<input title='%s' type=text name=cParam1 value=\"%s\" size=80 maxlength=255 " 347 ,LANG_FT_tResource_cParam1,EncodeDoubleQuotes(cParam1));346 ,LANG_FT_tResource_cParam1,EncodeDoubleQuotes(cParam1)); 348 347 if(guPermLevel>=0 && uMode) 349 348 { … … 358 357 OpenRow(LANG_FL_tResource_cParam2,"black"); 359 358 printf("<input title='%s' type=text name=cParam2 value=\"%s\" size=80 maxlength=255 " 360 ,LANG_FT_tResource_cParam2,EncodeDoubleQuotes(cParam2));359 ,LANG_FT_tResource_cParam2,EncodeDoubleQuotes(cParam2)); 361 360 if(guPermLevel>=0 && uMode) 362 361 { … … 371 370 OpenRow(LANG_FL_tResource_cParam3,"black"); 372 371 printf("<input title='%s' type=text name=cParam3 value=\"%s\" size=80 maxlength=255 " 373 ,LANG_FT_tResource_cParam3,EncodeDoubleQuotes(cParam3));372 ,LANG_FT_tResource_cParam3,EncodeDoubleQuotes(cParam3)); 374 373 if(guPermLevel>=0 && uMode) 375 374 { … … 384 383 OpenRow(LANG_FL_tResource_cParam4,"black"); 385 384 printf("<input title='%s' type=text name=cParam4 value=\"%s\" size=80 maxlength=255 " 386 ,LANG_FT_tResource_cParam4,EncodeDoubleQuotes(cParam4));385 ,LANG_FT_tResource_cParam4,EncodeDoubleQuotes(cParam4)); 387 386 if(guPermLevel>=0 && uMode) 388 387 { … … 397 396 OpenRow(LANG_FL_tResource_cComment,"black"); 398 397 printf("<textarea title='%s' cols=40 wrap=hard rows=3 name=cComment " 399 ,LANG_FT_tResource_cComment);398 ,LANG_FT_tResource_cComment); 400 399 if(guPermLevel>=0 && uMode) 401 400 { … … 410 409 OpenRow(LANG_FL_tResource_uOwner,"black"); 411 410 if(guPermLevel>=20 && uMode) 412 { 413 printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); 414 } 415 else 416 { 417 printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); 418 } 411 printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); 412 else 413 printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner); 419 414 //uCreatedBy 420 415 OpenRow(LANG_FL_tResource_uCreatedBy,"black"); 421 416 if(guPermLevel>=20 && uMode) 422 { 423 printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); 424 } 425 else 426 { 427 printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); 428 } 417 printf("%s<input type=hidden name=uCreatedBy value=%u >\n", 418 ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); 419 else 420 printf("%s<input type=hidden name=uCreatedBy value=%u >\n", 421 ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy); 429 422 //uCreatedDate 430 423 OpenRow(LANG_FL_tResource_uCreatedDate,"black"); … … 437 430 OpenRow(LANG_FL_tResource_uModBy,"black"); 438 431 if(guPermLevel>=20 && uMode) 439 { 440 printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); 441 } 442 else 443 { 444 printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); 445 } 432 printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); 433 else 434 printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy); 446 435 //uModDate 447 436 OpenRow(LANG_FL_tResource_uModDate,"black"); … … 463 452 MYSQL_RES *res; 464 453 465 sprintf(gcQuery,"SELECT uResource FROM tResource\ 466 WHERE uResource=%u" 467 ,uResource); 454 sprintf(gcQuery,"SELECT uResource FROM tResource WHERE uResource=%u",uResource); 468 455 mysql_query(&gMysql,gcQuery); 469 456 if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); … … 480 467 //sprintf(gcQuery,"New record %u added"); 481 468 uResource=mysql_insert_id(&gMysql); 482 #ifdef ISM3FIELDS483 469 uCreatedDate=luGetCreatedDate("tResource",uResource); 484 470 iDNSLog(uResource,"tResource","New"); 485 #endif486 471 487 472 if(!uMode) 488 473 { 489 sprintf(gcQuery,LANG_NBR_NEWRECADDED,uResource);490 tResource(gcQuery);474 sprintf(gcQuery,LANG_NBR_NEWRECADDED,uResource); 475 tResource(gcQuery); 491 476 } 492 477 … … 496 481 void DeletetResource(void) 497 482 { 498 #ifdef ISM3FIELDS499 483 sprintf(gcQuery,"DELETE FROM tResource WHERE uResource=%u AND ( uOwner=%u OR %u>9 )" 500 484 ,uResource,guLoginClient,guPermLevel); 501 #else502 sprintf(gcQuery,"DELETE FROM tResource WHERE uResource=%u"503 ,uResource);504 #endif505 485 mysql_query(&gMysql,gcQuery); 506 486 if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); … … 509 489 if(mysql_affected_rows(&gMysql)>0) 510 490 { 511 #ifdef ISM3FIELDS512 491 iDNSLog(uResource,"tResource","Del"); 513 #endif514 492 tResource(LANG_NBR_RECDELETED); 515 493 } 516 494 else 517 495 { 518 #ifdef ISM3FIELDS519 496 iDNSLog(uResource,"tResource","DelError"); 520 #endif521 497 tResource(LANG_NBR_RECNOTDELETED); 522 498 } … … 577 553 MYSQL_RES *res; 578 554 MYSQL_ROW field; 579 #ifdef ISM3FIELDS580 555 unsigned uPreModDate=0; 581 556 582 sprintf(gcQuery,"SELECT uResource,uModDate FROM tResource WHERE uResource=%u" 583 ,uResource); 584 #else 585 sprintf(gcQuery,"SELECT uResource FROM tResource WHERE uResource=%u" 586 ,uResource); 587 #endif 588 557 sprintf(gcQuery,"SELECT uResource,uModDate FROM tResource WHERE uResource=%u",uResource); 589 558 mysql_query(&gMysql,gcQuery); 590 559 if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); … … 598 567 599 568 field=mysql_fetch_row(res); 600 #ifdef ISM3FIELDS601 569 sscanf(field[1],"%u",&uPreModDate); 602 570 if(uPreModDate!=uModDate) tResource(LANG_NBR_EXTMOD); 603 #endif604 605 571 Update_tResource(field[0]); 606 572 if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql)); 607 573 //sprintf(query,"record %s modified",field[0]); 608 574 sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]); 609 #ifdef ISM3FIELDS610 575 uModDate=luGetModDate("tResource",uResource); 611 576 iDNSLog(uResource,"tResource","Mod"); 612 #endif613 577 tResource(gcQuery); 614 578 … … 668 632 else 669 633 sprintf(cBuf14,"---"); 670 printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td><textarea disabled>%s</textarea><td>%s<td>%s<td>%s<td>%s<td>%s</tr>" 634 printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>%s<td>" 635 "<textarea disabled>%s</textarea><td>%s<td>%s<td>%s<td>%s<td>%s</tr>" 671 636 ,field[0] 672 637 ,field[0] -
trunk/unxsBind/tresourcefunc.h
r1207 r1209 589 589 590 590 } 591 //Very initial NAPTR validation. Needs much more work to follow RFC2915 and RFC3403. 592 else if(!strcmp(cRRType,"NAPTR")) 593 { 594 register int i; 595 unsigned uI=0; 596 597 if(!cName[0]) 598 { 599 guMode=uMode; 600 tResource("cName: Resource name required"); 601 } 602 else 603 { 604 register int x=0; 605 606 //All lowercase 607 for(x=0;x<strlen(cName);x++) 608 cName[x]=tolower(cName[x]); 609 } 610 if(!cParam1[0]) 611 { 612 guMode=uMode; 613 tResource("cParam1: Order value required"); 614 } 615 if(!cParam2[0]) 616 { 617 guMode=uMode; 618 tResource("cParam2: Preference value required"); 619 } 620 if(!cParam3[0]) 621 { 622 guMode=uMode; 623 tResource("cParam3: Flags and ENUM double quoted strings required"); 624 } 625 if(!cParam4[0]) 626 { 627 guMode=uMode; 628 tResource("cParam4: Double quoted regex string and optional SRV target required."); 629 } 630 631 sscanf(cParam1,"%u",&uI); 632 if(!uI && !(isdigit(cParam1[0]))) 633 { 634 guMode=uMode; 635 tResource("cParam1: Must specify numerical order"); 636 } 637 638 uI=0; 639 sscanf(cParam2,"%u",&uI); 640 if(!uI && (!isdigit(cParam2[0]))) 641 { 642 guMode=uMode; 643 tResource("cParam2: Must specify numerical preference"); 644 } 645 646 //Check for double quotes 647 uI=0; 648 for(i=0;cParam3[i];i++) 649 if(cParam3[i]=='\"') uI++; 650 if(uI!=4 || cParam3[0]!='\"' || cParam3[strlen(cParam3)-1]!='\"') 651 { 652 guMode=uMode; 653 tResource("cParam3: Must double quote both flags and ENUM string." 654 " First and last char must be \". Ex: \"U\" \"E2U+sip\""); 655 } 656 657 uI=0; 658 for(i=0;cParam4[i];i++) 659 if(cParam4[i]=='\"') uI++; 660 if(uI<2 || cParam4[0]!='\"') 661 { 662 guMode=uMode; 663 tResource("Must double quote REGEX. First char must be \"." 664 " Ex: \"!^.*$!sip:customer-service@example.com!\" _sip._udp.example.com"); 665 } 666 667 } 591 668 else if(1) 592 669 {
