Changeset 283 for trunk/src/sh_error.c
- Timestamp:
- May 4, 2010, 10:28:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_error.c
r272 r283 841 841 #ifdef SH_WITH_SERVER 842 842 static char inet_peer[SH_MINIBUF] = { '\0' }; 843 #ifdef HAVE_LIBPRELUDE 844 static char inet_peer_ip[SH_IP_BUF] = { '\0' }; 845 846 void sh_error_set_peer_ip(const char * str) 847 { 848 if (str == NULL) 849 inet_peer_ip[0] = '\0'; 850 else 851 sl_strlcpy(inet_peer_ip, str, sizeof(inet_peer_ip)); 852 } 853 #endif 843 854 844 855 void sh_error_set_peer(const char * str) … … 847 858 inet_peer[0] = '\0'; 848 859 else 849 sl_strlcpy(inet_peer, str, SH_MINIBUF);860 sl_strlcpy(inet_peer, str, sizeof(inet_peer)); 850 861 } 851 862 #endif … … 880 891 int class_inet = clt_class; /* initialize from global */ 881 892 char local_inet_peer[SH_MINIBUF]; 893 #ifdef HAVE_LIBPRELUDE 894 char local_inet_peer_ip[SH_IP_BUF]; 895 #endif 882 896 #endif 883 897 … … 924 938 if ((msg_id == MSG_TCP_MSG) && (inet_peer[0] != '\0')) 925 939 { 926 sl_strlcpy(local_inet_peer, inet_peer, SH_MINIBUF);940 sl_strlcpy(local_inet_peer, inet_peer, sizeof(local_inet_peer)); 927 941 sh_error_set_peer(NULL); 928 942 } 929 943 else 930 944 local_inet_peer[0] = '\0'; 945 946 #ifdef HAVE_LIBPRELUDE 947 if ((msg_id == MSG_TCP_MSG) && (inet_peer_ip[0] != '\0')) 948 { 949 sl_strlcpy(local_inet_peer_ip, inet_peer_ip, sizeof(local_inet_peer_ip)); 950 sh_error_set_peer_ip(NULL); 951 } 952 else 953 local_inet_peer_ip[0] = '\0'; 954 #endif 931 955 932 956 clt_class = (-1); /* reset global */ … … 1263 1287 * Reports first error after failure. Always tries. 1264 1288 */ 1265 (void) sh_prelude_alert (severity, (int) class, lmsg->msg, 1266 lmsg->status, msg_id); 1267 1289 #if defined(HAVE_LIBPRELUDE) && defined(SH_WITH_SERVER) 1290 (void) sh_prelude_alert (severity, (int) class, 1291 lmsg->msg, lmsg->status, msg_id, 1292 local_inet_peer_ip); 1293 #else 1294 (void) sh_prelude_alert (severity, (int) class, 1295 lmsg->msg, lmsg->status, msg_id, 1296 NULL); 1297 #endif 1268 1298 prelude_block = 0; 1269 1299 } … … 1301 1331 (void) sh_log_file (lmsg->msg, NULL); 1302 1332 else 1303 1333 (void) sh_log_file (lmsg->msg, local_inet_peer); 1304 1334 } 1305 1335 #else
Note:
See TracChangeset
for help on using the changeset viewer.