Browse code

reverted Bogdan's improvements

Jiri Kuthan authored on 27/06/2002 19:14:28
Showing 1 changed files
... ...
@@ -135,8 +135,7 @@ int update_sock_struct_from_via( union sockaddr_union* to,
135 135
 								 struct via_body* via )
136 136
 {
137 137
 	struct hostent* he;
138
-	//char *host_copy;
139
-	char backup;
138
+	char *host_copy;
140 139
 
141 140
 
142 141
 #ifdef DNS_IP_HACK
... ...
@@ -158,27 +157,17 @@ int update_sock_struct_from_via( union sockaddr_union* to,
158 158
            BTW: when is via->host.s non null terminated? tm copy?
159 159
 		   - andrei 
160 160
 			Yes -- it happened on generating a 408 by TM; -jiri
161
-		   if you consider that via is never placed to the end of
162
-		   the msg buffer (so we can happily work with via->host.s[len]),
163
-		   insted of making a copy, we can simply backup the first caracter
164
-		   after via and put a 0 there -> call resolvehost -> restore it
165
-		   - bogdan
166 161
 		*/
167 162
 		if (via->host.s[via->host.len]){
168
-			/*host_copy = pkg_malloc( via->host.len+1 );
163
+			host_copy=pkg_malloc( via->host.len+1 );
169 164
 			if (!host_copy) {
170
-				LOG(L_NOTICE, "ERROR: update_sock_struct_from_via:"
171
-					" not enough memory\n");
165
+				LOG(L_NOTICE, "ERROR: update_sock_struct_from_via: not enough memory\n");
172 166
 				return -1;
173 167
 			}
174 168
 			memcpy(host_copy, via->host.s, via->host.len );
175 169
 			host_copy[via->host.len]=0;
176 170
 			he=resolvehost(host_copy);
177
-			pkg_free( host_copy );*/
178
-			backup = via->host.s[via->host.len];
179
-			via->host.s[via->host.len] = 0;
180
-			he=resolvehost(via->host.s);
181
-			via->host.s[via->host.len] = backup;
171
+			pkg_free( host_copy );
182 172
 		}else{
183 173
 			he=resolvehost(via->host.s);
184 174
 		}