Fossil SCM
Populate the ipaddr column of the rcvfrom table when a file is received from a remote source (push/pull/sync).
Commit
36edf3fd5c8ed8ea20da2c723b956e1fc489ac06
Parent
5ebcedc33eea137…
2 files changed
+8
-1
+6
+8
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1001,11 +1001,18 @@ | ||
| 1001 | 1001 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1002 | 1002 | if( zToken[i] ) zToken[i++] = 0; |
| 1003 | 1003 | cgi_setenv("PATH_INFO", zToken); |
| 1004 | 1004 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1005 | 1005 | if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){ |
| 1006 | - cgi_setenv("REMOTE_ADDR", inet_ntoa(remoteName.sin_addr)); | |
| 1006 | + char *zIpAddr = inet_ntoa(remoteName.sin_addr); | |
| 1007 | + cgi_setenv("REMOTE_ADDR", zIpAddr); | |
| 1008 | + | |
| 1009 | + /* Set the Global.zIpAddr variable to the server we are talking to. | |
| 1010 | + ** This is used to populate the ipaddr column of the rcvfrom table, | |
| 1011 | + ** if any files are received from the connected client. | |
| 1012 | + */ | |
| 1013 | + g.zIpAddr = mprintf("%s", zIpAddr); | |
| 1007 | 1014 | } |
| 1008 | 1015 | |
| 1009 | 1016 | /* Get all the optional fields that follow the first line. |
| 1010 | 1017 | */ |
| 1011 | 1018 | while( fgets(zLine,sizeof(zLine),stdin) ){ |
| 1012 | 1019 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1001,11 +1001,18 @@ | |
| 1001 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1002 | if( zToken[i] ) zToken[i++] = 0; |
| 1003 | cgi_setenv("PATH_INFO", zToken); |
| 1004 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1005 | if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){ |
| 1006 | cgi_setenv("REMOTE_ADDR", inet_ntoa(remoteName.sin_addr)); |
| 1007 | } |
| 1008 | |
| 1009 | /* Get all the optional fields that follow the first line. |
| 1010 | */ |
| 1011 | while( fgets(zLine,sizeof(zLine),stdin) ){ |
| 1012 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1001,11 +1001,18 @@ | |
| 1001 | for(i=0; zToken[i] && zToken[i]!='?'; i++){} |
| 1002 | if( zToken[i] ) zToken[i++] = 0; |
| 1003 | cgi_setenv("PATH_INFO", zToken); |
| 1004 | cgi_setenv("QUERY_STRING", &zToken[i]); |
| 1005 | if( getpeername(fileno(stdin), (struct sockaddr*)&remoteName, &size)>=0 ){ |
| 1006 | char *zIpAddr = inet_ntoa(remoteName.sin_addr); |
| 1007 | cgi_setenv("REMOTE_ADDR", zIpAddr); |
| 1008 | |
| 1009 | /* Set the Global.zIpAddr variable to the server we are talking to. |
| 1010 | ** This is used to populate the ipaddr column of the rcvfrom table, |
| 1011 | ** if any files are received from the connected client. |
| 1012 | */ |
| 1013 | g.zIpAddr = mprintf("%s", zIpAddr); |
| 1014 | } |
| 1015 | |
| 1016 | /* Get all the optional fields that follow the first line. |
| 1017 | */ |
| 1018 | while( fgets(zLine,sizeof(zLine),stdin) ){ |
| 1019 |
+6
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -61,10 +61,16 @@ | ||
| 61 | 61 | { |
| 62 | 62 | fossil_panic("can't resolve host name: %s\n", g.urlName); |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | addrIsInit = 1; |
| 66 | + | |
| 67 | + /* Set the Global.zIpAddr variable to the server we are talking to. | |
| 68 | + ** This is used to populate the ipaddr column of the rcvfrom table, | |
| 69 | + ** if any files are received from the server. | |
| 70 | + */ | |
| 71 | + g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr)); | |
| 66 | 72 | } |
| 67 | 73 | s = socket(AF_INET,SOCK_STREAM,0); |
| 68 | 74 | if( s<0 ){ |
| 69 | 75 | fossil_panic("cannot create a socket"); |
| 70 | 76 | } |
| 71 | 77 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -61,10 +61,16 @@ | |
| 61 | { |
| 62 | fossil_panic("can't resolve host name: %s\n", g.urlName); |
| 63 | } |
| 64 | } |
| 65 | addrIsInit = 1; |
| 66 | } |
| 67 | s = socket(AF_INET,SOCK_STREAM,0); |
| 68 | if( s<0 ){ |
| 69 | fossil_panic("cannot create a socket"); |
| 70 | } |
| 71 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -61,10 +61,16 @@ | |
| 61 | { |
| 62 | fossil_panic("can't resolve host name: %s\n", g.urlName); |
| 63 | } |
| 64 | } |
| 65 | addrIsInit = 1; |
| 66 | |
| 67 | /* Set the Global.zIpAddr variable to the server we are talking to. |
| 68 | ** This is used to populate the ipaddr column of the rcvfrom table, |
| 69 | ** if any files are received from the server. |
| 70 | */ |
| 71 | g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr)); |
| 72 | } |
| 73 | s = socket(AF_INET,SOCK_STREAM,0); |
| 74 | if( s<0 ){ |
| 75 | fossil_panic("cannot create a socket"); |
| 76 | } |
| 77 |