Changeset 1231

Show
Ignore:
Timestamp:
03/11/10 11:03:59 (5 months ago)
Author:
Hugo
Message:

idnsAdmin: NAPTR validation code starting

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/unxsBind/interfaces/admin/resource.c

    r1225 r1231  
    16791679        else if(!strcmp(cRRType,"NAPTR")) 
    16801680        { 
     1681                unsigned long uResult=0; 
     1682                char cAux1[100]={""}; 
     1683                char cAux2[100]={""}; 
     1684                 
     1685                if(!cName[0]) 
     1686                { 
     1687                        gcMessage="<blink>Error: </blink>Must specify e164.arpa Origin or FQDN"; 
     1688                        cNameStyle="type_fields_req"; 
     1689                        return(16); 
     1690                } 
     1691 
     1692                uResult=strtoul(cParam1,NULL,10); 
     1693                if(errno==EINVAL) 
     1694                { 
     1695                        gcMessage="<blink>Error: </blink>Order must be a numerical value"; 
     1696                        cParam1Style="type_fields_req"; 
     1697                        return(16); 
     1698                } 
     1699                uResult=strtoul(cParam2,NULL,10); 
     1700                if(errno==EINVAL) 
     1701                { 
     1702                        gcMessage="<blink>Error: </blink>Preference must be a numerical value"; 
     1703                        cParam2Style="type_fields_req"; 
     1704                        return(16); 
     1705                } 
     1706 
     1707                sscanf(cParam3,"%s %s",cAux1,cAux2); 
     1708                if(!cAux1[0] || !cAux2[0]) 
     1709                { 
     1710                        gcMessage="<blink>Error: </blink>Must specify Flags+ENUM, e.g: \"U\" \"E2U+sip\""; 
     1711                        cParam3Style="type_fields_req"; 
     1712                        return(16); 
     1713                } 
     1714                if((strstr(cAux1,"S")!=NULL)) 
     1715                { 
     1716                        if((strstr(cAux1,"A")!=NULL)  
     1717                                || (strstr(cAux1,"U")!=NULL) 
     1718                                || (strstr(cAux1,"P")!=NULL)) 
     1719                        { 
     1720                                gcMessage="<blink>Error: </blink>The S, A, U and P flags are all mutually exclusive"; 
     1721                                cParam3Style="type_fields_req"; 
     1722                                return(16); 
     1723                        } 
     1724                } 
     1725                if((strstr(cAux1,"A")!=NULL)) 
     1726                { 
     1727                        if((strstr(cAux1,"S")!=NULL)  
     1728                                || (strstr(cAux1,"U")!=NULL) 
     1729                                || (strstr(cAux1,"P")!=NULL)) 
     1730                        { 
     1731                                gcMessage="<blink>Error: </blink>The S, A, U and P flags are all mutually exclusive"; 
     1732                                cParam3Style="type_fields_req"; 
     1733                                return(16); 
     1734                        } 
     1735                } 
     1736                if((strstr(cAux1,"U")!=NULL)) 
     1737                { 
     1738                        if((strstr(cAux1,"A")!=NULL)  
     1739                                || (strstr(cAux1,"S")!=NULL) 
     1740                                || (strstr(cAux1,"P")!=NULL)) 
     1741                        { 
     1742                                gcMessage="<blink>Error: </blink>The S, A, U and P flags are all mutually exclusive"; 
     1743                                cParam3Style="type_fields_req"; 
     1744                                return(16); 
     1745                        } 
     1746                } 
     1747                if((strstr(cAux1,"P")!=NULL)) 
     1748                { 
     1749                        if((strstr(cAux1,"A")!=NULL)  
     1750                                || (strstr(cAux1,"U")!=NULL) 
     1751                                || (strstr(cAux1,"S")!=NULL)) 
     1752                        { 
     1753                                gcMessage="<blink>Error: </blink>The S, A, U and P flags are all mutually exclusive"; 
     1754                                cParam3Style="type_fields_req"; 
     1755                                return(16); 
     1756                        } 
     1757                } 
    16811758        } 
    16821759        else if(1)