comparison main.c @ 629:005d7a0351b6

More API changes in th_network.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 21 Jun 2014 06:38:54 +0300
parents fd0e1589e268
children ce605ac8167a
comparison
equal deleted inserted replaced
628:fd0e1589e268 629:005d7a0351b6
197 optProxyType = TH_PROXY_SOCKS4; 197 optProxyType = TH_PROXY_SOCKS4;
198 else 198 else
199 if (strcasecmp(proto, "socks4a") == 0) 199 if (strcasecmp(proto, "socks4a") == 0)
200 optProxyType = TH_PROXY_SOCKS4A; 200 optProxyType = TH_PROXY_SOCKS4A;
201 else 201 else
202 /*
203 if (strcasecmp(proto, "socks5") == 0) 202 if (strcasecmp(proto, "socks5") == 0)
204 optProxyType = TH_PROXY_SOCKS5; 203 optProxyType = TH_PROXY_SOCKS5;
205 else 204 else
206 */
207 { 205 {
208 THERR("Invalid proxy type specified: '%s'\n", proto); 206 THERR("Invalid proxy type specified: '%s'\n", proto);
209 goto out; 207 goto out;
210 } 208 }
211 209
259 th_free(auth); 257 th_free(auth);
260 th_free(port); 258 th_free(port);
261 259
262 return ret; 260 return ret;
263 } 261 }
262
264 263
265 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) 264 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
266 { 265 {
267 switch (optN) 266 switch (optN)
268 { 267 {
362 361
363 msg = th_strdup_printf("<USER>%s</USER><MESSAGE>%s</MESSAGE>", user, str); 362 msg = th_strdup_printf("<USER>%s</USER><MESSAGE>%s</MESSAGE>", user, str);
364 363
365 if (msg != NULL) 364 if (msg != NULL)
366 { 365 {
367 BOOL ret = th_conn_send_buf(conn, msg, strlen(msg) + 1); 366 int ret = th_conn_send_buf(conn, msg, strlen(msg) + 1);
368 th_free(msg); 367 th_free(msg);
369 return ret; 368 return ret == THERR_OK;
370 } 369 }
371 else 370 else
372 return FALSE; 371 return FALSE;
373 } 372 }
374 373
2249 errorMsg("Policy file request connection setup failed!\n"); 2248 errorMsg("Policy file request connection setup failed!\n");
2250 goto err_exit; 2249 goto err_exit;
2251 } 2250 }
2252 2251
2253 tmpStr = "<policy-file-request/>"; 2252 tmpStr = "<policy-file-request/>";
2254 if (th_conn_send_buf(conn, tmpStr, strlen(tmpStr) + 1) == FALSE) 2253 if (th_conn_send_buf(conn, tmpStr, strlen(tmpStr) + 1) != THERR_OK)
2255 { 2254 {
2256 errorMsg("Failed to send policy file request.\n"); 2255 errorMsg("Failed to send policy file request.\n");
2257 goto err_exit; 2256 goto err_exit;
2258 } 2257 }
2259 else 2258 else