Fossil SCM

Fix indentation and remove all strcpy() and strcat() calls (as OpenBSD hates those).

drh 2015-04-09 23:16 UTC ipv6-server
Commit b1cb81ebe7c114f3c41e23f39a3854fe84f7576f
1 file changed +12 -13
+12 -13
--- src/cgi.c
+++ src/cgi.c
@@ -1718,32 +1718,31 @@
17181718
fd_set readfds; /* Set of file descriptors for select() */
17191719
socklen_t lenaddr; /* Length of the inaddr structure */
17201720
int child; /* PID of the child process */
17211721
int nchildren = 0; /* Number of child processes */
17221722
struct timeval delay; /* How long to wait inside select() */
1723
- struct sockaddr_in6 inaddr; /* The socket address */
1724
- int optyes = 1; /* setsockopt flag */
1725
- int optno = 0; /* setsockopt flag */
1723
+ struct sockaddr_in6 inaddr; /* The socket address */
1724
+ int optyes = 1; /* setsockopt flag */
1725
+ int optno = 0; /* setsockopt flag */
17261726
int iPort = mnPort;
17271727
char ip[INET6_ADDRSTRLEN];
17281728
17291729
17301730
while( iPort<=mxPort ){
17311731
memset(&inaddr, 0, sizeof(inaddr));
17321732
inaddr.sin6_family = AF_INET6;
17331733
if( zIpAddr ){
1734
- printf("zIpAddr: %s", zIpAddr);
1735
- printf("iPort: %d", iPort);
1736
- /* check valid ipv6 address */
1734
+ printf("zIpAddr: %s", zIpAddr);
1735
+ printf("iPort: %d", iPort);
1736
+ /* check valid ipv6 address */
17371737
if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) {
1738
- /* maybe ipv4 string so try mixed ipv4 notation*/
1739
- strcpy(ip, "::FFFF:");
1740
- strcat(ip, zIpAddr);
1741
- printf("zIpAddr: %s", ip);
1742
- if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
1743
- fossil_fatal("not a valid IP address: %s", zIpAddr);
1744
- }
1738
+ /* maybe ipv4 string so try mixed ipv4 notation*/
1739
+ sqlite3_snprintf(sizeof(ip), ip, "::FFFF:%s", zIpAddr);
1740
+ printf("zIpAddr: %s", ip);
1741
+ if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
1742
+ fossil_fatal("not a valid IP address: %s", zIpAddr);
1743
+ }
17451744
}
17461745
}else if( flags & HTTP_SERVER_LOCALHOST ){
17471746
inaddr.sin6_addr = in6addr_loopback;
17481747
}else{
17491748
inaddr.sin6_addr = in6addr_any;
17501749
--- src/cgi.c
+++ src/cgi.c
@@ -1718,32 +1718,31 @@
1718 fd_set readfds; /* Set of file descriptors for select() */
1719 socklen_t lenaddr; /* Length of the inaddr structure */
1720 int child; /* PID of the child process */
1721 int nchildren = 0; /* Number of child processes */
1722 struct timeval delay; /* How long to wait inside select() */
1723 struct sockaddr_in6 inaddr; /* The socket address */
1724 int optyes = 1; /* setsockopt flag */
1725 int optno = 0; /* setsockopt flag */
1726 int iPort = mnPort;
1727 char ip[INET6_ADDRSTRLEN];
1728
1729
1730 while( iPort<=mxPort ){
1731 memset(&inaddr, 0, sizeof(inaddr));
1732 inaddr.sin6_family = AF_INET6;
1733 if( zIpAddr ){
1734 printf("zIpAddr: %s", zIpAddr);
1735 printf("iPort: %d", iPort);
1736 /* check valid ipv6 address */
1737 if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) {
1738 /* maybe ipv4 string so try mixed ipv4 notation*/
1739 strcpy(ip, "::FFFF:");
1740 strcat(ip, zIpAddr);
1741 printf("zIpAddr: %s", ip);
1742 if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
1743 fossil_fatal("not a valid IP address: %s", zIpAddr);
1744 }
1745 }
1746 }else if( flags & HTTP_SERVER_LOCALHOST ){
1747 inaddr.sin6_addr = in6addr_loopback;
1748 }else{
1749 inaddr.sin6_addr = in6addr_any;
1750
--- src/cgi.c
+++ src/cgi.c
@@ -1718,32 +1718,31 @@
1718 fd_set readfds; /* Set of file descriptors for select() */
1719 socklen_t lenaddr; /* Length of the inaddr structure */
1720 int child; /* PID of the child process */
1721 int nchildren = 0; /* Number of child processes */
1722 struct timeval delay; /* How long to wait inside select() */
1723 struct sockaddr_in6 inaddr; /* The socket address */
1724 int optyes = 1; /* setsockopt flag */
1725 int optno = 0; /* setsockopt flag */
1726 int iPort = mnPort;
1727 char ip[INET6_ADDRSTRLEN];
1728
1729
1730 while( iPort<=mxPort ){
1731 memset(&inaddr, 0, sizeof(inaddr));
1732 inaddr.sin6_family = AF_INET6;
1733 if( zIpAddr ){
1734 printf("zIpAddr: %s", zIpAddr);
1735 printf("iPort: %d", iPort);
1736 /* check valid ipv6 address */
1737 if (inet_pton(AF_INET6, zIpAddr, &(inaddr.sin6_addr)) < 1) {
1738 /* maybe ipv4 string so try mixed ipv4 notation*/
1739 sqlite3_snprintf(sizeof(ip), ip, "::FFFF:%s", zIpAddr);
1740 printf("zIpAddr: %s", ip);
1741 if (inet_pton(AF_INET6, ip, &(inaddr.sin6_addr)) == -1){
1742 fossil_fatal("not a valid IP address: %s", zIpAddr);
1743 }
 
1744 }
1745 }else if( flags & HTTP_SERVER_LOCALHOST ){
1746 inaddr.sin6_addr = in6addr_loopback;
1747 }else{
1748 inaddr.sin6_addr = in6addr_any;
1749

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button