Changeset 132 for trunk/src/sh_forward.c
- Timestamp:
- Oct 23, 2007, 11:44:41 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_forward.c
r34 r132 386 386 cipherInstance cipherInst; 387 387 int err_num; 388 char expbuf[SH_ERRBUF_SIZE]; 388 389 #else 389 390 docrypt = SL_FALSE; /* dummy to fix compiler warning */ … … 422 423 if (err_num < 0) 423 424 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 424 errorExplain(err_num ),425 errorExplain(err_num, expbuf, sizeof(expbuf)), 425 426 _("sh_forward_send_intern: cipherInit")); 426 427 … … 433 434 if (err_num < 0) 434 435 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 435 errorExplain(err_num ),436 errorExplain(err_num, expbuf, sizeof(expbuf)), 436 437 _("sh_forward_send_intern: blockEncrypt")); 437 438 memcpy(q, outBlock, B_SIZ); … … 447 448 if (err_num < 0) 448 449 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 449 errorExplain(err_num ),450 errorExplain(err_num, expbuf, sizeof(expbuf)), 450 451 _("sh_forward_send_intern: blockEncrypt")); 451 452 memcpy(q, outBlock, B_SIZ); … … 549 550 cipherInstance cipherInst; 550 551 int err_num; 552 char expbuf[SH_ERRBUF_SIZE]; 551 553 #else 552 554 docrypt = SL_FALSE; /* dummy to fix compiler warning */ … … 655 657 if (err_num < 0) 656 658 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 657 errorExplain(err_num ),659 errorExplain(err_num, expbuf, sizeof(expbuf)), 658 660 _("sh_forward_receive_intern: cipherInit")); 659 661 … … 668 670 if (err_num < 0) 669 671 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 670 errorExplain(err_num ),672 errorExplain(err_num, expbuf, sizeof(expbuf)), 671 673 _("sh_forward_receive_intern: blockDecrypt")); 672 674 memcpy(q, outBlock, B_SIZ); … … 881 883 #ifdef SH_ENCRYPT 882 884 int err_num; 885 char expbuf[SH_ERRBUF_SIZE]; 883 886 #endif 884 887 … … 1053 1056 if (err_num < 0) 1054 1057 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 1055 errorExplain(err_num ),1058 errorExplain(err_num, expbuf, sizeof(expbuf)), 1056 1059 _("sh_forward_try_impl: makeKey")); 1057 1060 … … 1060 1063 if (err_num < 0) 1061 1064 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 1062 errorExplain(err_num ),1065 errorExplain(err_num, expbuf, sizeof(expbuf)), 1063 1066 _("sh_forward_try_impl: make_key")); 1064 1067 #endif … … 1233 1236 sh_error_handle((-1), FIL__, __LINE__, -1, 1234 1237 MSG_E_SUBGEN, 1235 errorExplain(err_num ),1238 errorExplain(err_num, expbuf, sizeof(expbuf)), 1236 1239 _("sh_forward_try_impl: makeKey")); 1237 1240 err_num = makeKey(&(skey->keyInstD), … … 1241 1244 sh_error_handle((-1), FIL__, __LINE__, -1, 1242 1245 MSG_E_SUBGEN, 1243 errorExplain(err_num ),1246 errorExplain(err_num, expbuf, sizeof(expbuf)), 1244 1247 _("sh_forward_try_impl: makeKey")); 1245 1248 #endif … … 1741 1744 if (flag_err != 0) 1742 1745 { 1746 char errbuf[SH_ERRBUF_SIZE]; 1743 1747 conn_state = BAD; 1744 1748 timeout_val *= 2; 1745 if (flag_err < 0 || NULL == sh_error_message(flag_err ))1749 if (flag_err < 0 || NULL == sh_error_message(flag_err, errbuf, sizeof(errbuf))) 1746 1750 flag_err = EIO; 1747 1751 sh_error_handle((-1), FIL__, __LINE__, flag_err, MSG_TCP_ECONN, 1748 sh_error_message(flag_err ));1752 sh_error_message(flag_err, errbuf, sizeof(errbuf))); 1749 1753 SL_RETURN( (-1), _("sh_forward_try_impl")); 1750 1754 } … … 2053 2057 for (i = 0; i < CLT_MAX; ++i) 2054 2058 newclt->status_arr[i] = CLT_INACTIVE; 2055 sl_strlcpy(newclt->timestamp[CLT_INACTIVE], sh_unix_time(0), TIM_MAX);2059 (void) sh_unix_time(0, newclt->timestamp[CLT_INACTIVE], TIM_MAX); 2056 2060 /* truncate */ 2057 2061 sl_strlcpy(newclt->hostname, &str[0], sep[0]+1); … … 2257 2261 cipherInstance cipherInst; 2258 2262 int err_num; 2263 char expbuf[SH_ERRBUF_SIZE]; 2259 2264 #else 2260 2265 (void) docrypt; … … 2329 2334 if (err_num < 0) 2330 2335 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 2331 errorExplain(err_num ),2336 errorExplain(err_num, expbuf, sizeof(expbuf)), 2332 2337 _("sh_forward_prep_send_int: cipherInit")); 2333 2338 … … 2339 2344 if (err_num < 0) 2340 2345 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 2341 errorExplain(err_num ),2346 errorExplain(err_num, expbuf, sizeof(expbuf)), 2342 2347 _("sh_forward_prep_send_int: blockEncrypt")); 2343 2348 memcpy(q, outBlock, B_SIZ); … … 2355 2360 if (err_num < 0) 2356 2361 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 2357 errorExplain(err_num ),2362 errorExplain(err_num, expbuf, sizeof(expbuf)), 2358 2363 _("sh_forward_prep_send_int: blockEncrypt")); 2359 2364 memcpy(q, outBlock, B_SIZ); … … 2438 2443 conn->status_now = status; 2439 2444 conn->status_arr[status] = status; 2440 sl_strlcpy(conn->timestamp[status], 2441 sh_unix_time(0), 2442 TIM_MAX); 2445 (void) sh_unix_time(0, conn->timestamp[status], TIM_MAX); 2443 2446 2444 2447 #if defined(WITH_EXTERNAL) … … 2806 2809 int send_bytes; 2807 2810 int err_num; 2811 char expbuf[SH_ERRBUF_SIZE]; 2808 2812 #endif 2809 2813 … … 3880 3884 if (err_num < 0) 3881 3885 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 3882 errorExplain(err_num ),3886 errorExplain(err_num, expbuf, sizeof(expbuf)), 3883 3887 _("check_protocol: makeKey")); 3884 3888 err_num = makeKey(&(conn->client_entry->keyInstD), … … 3887 3891 if (err_num < 0) 3888 3892 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 3889 errorExplain(err_num ),3893 errorExplain(err_num, expbuf, sizeof(expbuf)), 3890 3894 _("check_protocol: makeKey")); 3891 3895 #endif … … 4211 4215 if (err_num < 0) 4212 4216 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 4213 errorExplain(err_num ),4217 errorExplain(err_num, expbuf, sizeof(expbuf)), 4214 4218 _("sh_forward_prep_send_int: makeKey")); 4215 4219 err_num = makeKey(&(conn->client_entry->keyInstD), … … 4218 4222 if (err_num < 0) 4219 4223 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 4220 errorExplain(err_num ),4224 errorExplain(err_num, expbuf, sizeof(expbuf)), 4221 4225 _("sh_forward_prep_send_int: makeKey")); 4222 4226 #endif … … 4312 4316 cipherInstance cipherInst; 4313 4317 int err_num; 4318 char expbuf[SH_ERRBUF_SIZE]; 4314 4319 #endif 4315 4320 … … 4410 4415 if (err_num < 0) 4411 4416 sh_error_handle((-1), FIL__, __LINE__, -1, MSG_E_SUBGEN, 4412 errorExplain(err_num ),4417 errorExplain(err_num, expbuf, sizeof(expbuf)), 4413 4418 _("sh_forward_do_read: cipherInit")); 4414 4419 … … 4422 4427 sh_error_handle((-1), FIL__, __LINE__, -1, 4423 4428 MSG_E_SUBGEN, 4424 errorExplain(err_num ),4429 errorExplain(err_num, expbuf, sizeof(expbuf)), 4425 4430 _("sh_forward_do_read: blockDecrypt")); 4426 4431 memcpy(q, outBlock, B_SIZ); … … 4650 4655 else 4651 4656 { 4657 char err_buf[SH_ERRBUF_SIZE]; 4652 4658 errflag = errno; 4653 4659 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGEN, 4654 sh_error_message(errflag ), _("accept"));4660 sh_error_message(errflag,err_buf, sizeof(err_buf)), _("accept")); 4655 4661 newconn->fd = -1; 4656 4662 newconn->state = CONN_FREE; … … 4732 4738 int sh_forward_printerr_final(int slot) 4733 4739 { 4740 char errbuf[SH_ERRBUF_SIZE]; 4741 4734 4742 SL_ENTER(_("sh_forward_printerr_final")); 4735 4743 if (sock_err[slot].msg[0] != '\0') … … 4737 4745 dlog(1, FIL__, __LINE__, 4738 4746 _("Could not set up the listening socket for the server because of the\nfollowing error: %s\nPossible reasons include:\n - insufficient privilege for UID %d, or\n - the port %d is already used by another program.\n"), 4739 sh_error_message(sock_err[slot].errnum), sock_err[slot].euid, 4747 sh_error_message(sock_err[slot].errnum, errbuf, sizeof(errbuf)), 4748 sock_err[slot].euid, 4740 4749 sock_err[slot].port); 4741 4750 sh_error_handle((-1), FIL__, sock_err[slot].line, 4742 4751 sock_err[slot].errnum, MSG_EXIT_ABORTS, 4743 sh_error_message(sock_err[slot].errnum ),4752 sh_error_message(sock_err[slot].errnum, errbuf, sizeof(errbuf)), 4744 4753 sh.prg_name, 4745 4754 sock_err[slot].msg); … … 5180 5189 if ( num_sel < 0 ) /* some error */ 5181 5190 { 5191 char errbuf[SH_ERRBUF_SIZE]; 5192 5182 5193 if (sig_raised == 1) 5183 5194 { … … 5207 5218 5208 5219 sh_error_handle((-1), FIL__, __LINE__, errnum, MSG_EXIT_ABORTS, 5209 sh_error_message(errnum ),5220 sh_error_message(errnum, errbuf, sizeof(errbuf)), 5210 5221 sh.prg_name, 5211 5222 _("select")); … … 5535 5546 char buf[1048]; 5536 5547 struct sockaddr_in from; 5548 char errbuf[SH_ERRBUF_SIZE]; 5537 5549 5538 5550 /* The 6th argument in recvfrom is *socklen_t in Linux and *BSD, … … 5575 5587 TPT(( 0, FIL__, __LINE__, _("msg=<UDP error: %d>\n"), res)); 5576 5588 sh_error_handle((-1), FIL__, __LINE__, res, MSG_ERR_SYSLOG, 5577 sh_error_message(res), my_inet_ntoa(from.sin_addr)); 5589 sh_error_message(res, errbuf, sizeof(errbuf)), 5590 my_inet_ntoa(from.sin_addr)); 5578 5591 SL_RETURN( (-1), _("recv_syslog_socket")); 5579 5592 } … … 5634 5647 TPT(( 0, FIL__, __LINE__, _("msg=<UDP error: %d>\n"), res)); 5635 5648 sh_error_handle((-1), FIL__, __LINE__, res, MSG_ERR_SYSLOG, 5636 sh_error_message(res), my_inet_ntoa(from.sin_addr)); 5649 sh_error_message(res, errbuf, sizeof(errbuf)), 5650 my_inet_ntoa(from.sin_addr)); 5637 5651 5638 5652 /* don't accept anything the next 2 seconds
Note:
See TracChangeset
for help on using the changeset viewer.