- Timestamp:
- Apr 6, 2006, 8:55:51 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_database.c
r22 r27 1192 1192 } 1193 1193 } 1194 #if 0 1195 /* apparently slower, see gyule.7 */ 1196 len = (long) strlen(val); 1197 1198 if ((val[0] != '\0') && (*size > 2)) 1199 { 1200 if (flag == 1) 1201 { 1202 *end = ','; ++end; 1203 *end = '\''; ++end; (*size) -= 2; 1204 *end = '\0'; 1205 1206 if ((long) *size > (len+2)) 1207 { 1208 (void) sl_strlcat(end, val, (size_t) *size); 1209 end += len; (*size) -= len; 1210 *end = '\''; ++end; (*size) -= 1; 1211 } 1212 *end = '\0'; 1213 } 1214 else 1215 { 1216 *end = ','; ++end; (*size) -= 1; 1217 *end = '\0'; 1218 1219 if ((long) *size > (len+1)) 1220 { 1221 (void) sl_strlcat(end, val, (size_t) *size); 1222 end += len; (*size) -= len; 1223 } 1224 *end = '\0'; 1225 } 1226 } 1227 #endif 1194 1228 1195 return end; 1229 1196 } … … 1695 1662 } 1696 1663 1664 /* recursively enter linked list of messages into database, last first 1665 */ 1666 int sh_database_insert_rec (dbins * curr, unsigned int depth) 1667 { 1668 long id = 0; 1669 dbins * prev; 1670 1671 SL_ENTER(_("sh_database_insert_rec")); 1672 1673 if (curr->next) 1674 { 1675 prev = curr->next; 1676 sl_strlcpy(prev->host, curr->host, 64); 1677 id = sh_database_insert_rec (curr->next, (depth + 1)); 1678 } 1679 1680 if (id != 0) /* this is a server wrapper */ 1681 { 1682 if (enter_wrapper != 0) 1683 { 1684 id = sh_database_entry (curr, id); 1685 } 1686 } 1687 else 1688 { 1689 /* 1690 * id = -1 is the client message; log_ref will be NULL 1691 */ 1692 if (depth > 0) /* this is a client message */ 1693 id = sh_database_entry (curr, -1); 1694 else /* this is a generic server message */ 1695 id = sh_database_entry (curr, 0); 1696 } 1697 1698 SH_FREE(curr); 1699 1700 SL_RETURN(id, _("sh_database_insert")); 1701 } 1702 1697 1703 int sh_database_insert (char * message) 1698 1704 { 1699 1705 dbins * db_entry; 1700 dbins * prev;1701 dbins * curr;1702 long id = 0;1703 #ifdef HOST_SWITCH1704 char * temp[64];1705 #endif1706 1706 1707 1707 SL_ENTER(_("sh_database_insert")); … … 1714 1714 (void) sh_database_parse (message, db_entry); 1715 1715 1716 /* Enter the list into the database. Actually, the list can only have 1717 * two entries at most. 1718 */ 1719 curr = db_entry; 1720 if (curr->next) 1721 { 1722 prev = curr->next; 1723 #ifdef HOST_SWITCH 1724 strncpy(temp, prev->host, 64); 1716 /* recursively enter the linked list into the database 1717 */ 1718 (void) sh_database_insert_rec (db_entry, 0); 1719 1720 SL_RETURN(0, _("sh_database_insert")); 1721 } 1722 1725 1723 #endif 1726 strncpy(prev->host, curr->host, 64);1727 #ifdef HOST_SWITCH1728 strncpy(curr->host, temp, 64);1729 #endif1730 id = sh_database_entry (prev, -1);1731 SH_FREE(prev);1732 }1733 1734 if (id != 0) /* this is a server wrapper */1735 {1736 if (enter_wrapper != 0)1737 (void) sh_database_entry (curr, id);1738 }1739 else /* this is a generic server message */1740 {1741 (void) sh_database_entry (curr, 0);1742 }1743 SH_FREE(curr);1744 1745 SL_RETURN(0, _("sh_database_insert"));1746 }1747 1748 #endif -
trunk/src/sh_error.c
r22 r27 639 639 } 640 640 641 #if def SH_WITH_CLIENT641 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 642 642 /* set severity for TCP export 643 643 */ … … 843 843 #endif 844 844 845 #if def SH_WITH_CLIENT845 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 846 846 char * ex_msg; 847 847 #endif … … 862 862 static int syslog_block = 0; 863 863 static int log_block = 0; 864 #if defined(SH_WITH_CLIENT) 864 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 865 865 static int export_block = 0; 866 866 #endif … … 926 926 severity = sev; 927 927 928 /* these are messages from remote sources 929 */ 928 930 if ((severity & SH_ERR_INET) != 0) 929 931 { … … 939 941 ( (errFlags.sysloglevel & severity ) == 0 || 940 942 (errFlags.syslog_class & (1 << class)) == 0 ) && 941 #if def SH_WITH_CLIENT943 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_CLIENT) 942 944 ( (errFlags.exportlevel & severity ) == 0 || 943 945 (errFlags.export_class & (1 << class)) == 0 ) && … … 958 960 (errFlags.mail_class & (1 << class)) == 0 ) 959 961 #ifdef SH_WITH_SERVER 960 && (flag_inet == S_FALSE)962 && (flag_inet == S_FALSE) /* still log messages from remote sources */ 961 963 #endif 962 964 ) … … 1119 1121 * to log server 1120 1122 ****************************************************/ 1121 #if def SH_WITH_CLIENT1123 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 1122 1124 /* Export by TCP. 1123 1125 */ 1124 if ((errFlags.exportlevel & severity ) != 0 && 1125 (errFlags.export_class & (1 << class)) != 0 && 1126 (errFlags.exportlevel & SH_ERR_NOT) == 0 && 1127 class != AUD && 1128 sh.flag.isserver != GOOD && 1129 (flag_inet == S_FALSE) ) /* don't log inet to export */ 1126 1127 if ( ((errFlags.exportlevel & severity ) != 0 && 1128 (errFlags.export_class & (1 << class)) != 0 && 1129 (errFlags.exportlevel & SH_ERR_NOT) == 0 && 1130 class != AUD ) 1131 #ifdef SH_WITH_SERVER 1132 || (flag_inet == S_TRUE) /* always log inet to export */ 1133 #endif 1134 /* sh.flag.isserver != GOOD && */ 1135 /* (flag_inet == S_FALSE) */ /* don't log inet to export */ 1136 ) 1130 1137 { 1131 1138 if (export_block == 0) … … 1142 1149 sl_snprintf(ex_msg, ex_len, _("%d?%u?%s"), 1143 1150 severity, class, lmsg->msg); 1144 1145 1151 retval = sh_forward (ex_msg); 1146 1152 SH_FREE(ex_msg); -
trunk/src/sh_files.c
r22 r27 454 454 } 455 455 456 457 456 int sh_files_pushfile_user1 (const char * str_s) 458 457 { 459 458 return (sh_files_pushfile (SH_LEVEL_USER1, str_s)); 459 } 460 461 int sh_files_pushfile_user2 (const char * str_s) 462 { 463 return (sh_files_pushfile (SH_LEVEL_USER2, str_s)); 464 } 465 466 int sh_files_pushfile_user3 (const char * str_s) 467 { 468 return (sh_files_pushfile (SH_LEVEL_USER3, str_s)); 469 } 470 471 int sh_files_pushfile_user4 (const char * str_s) 472 { 473 return (sh_files_pushfile (SH_LEVEL_USER4, str_s)); 460 474 } 461 475 … … 612 626 return (sh_files_parse_mask(&mask_USER1, str)); 613 627 } 628 int sh_files_redef_user2(const char * str) 629 { 630 return (sh_files_parse_mask(&mask_USER2, str)); 631 } 632 int sh_files_redef_user3(const char * str) 633 { 634 return (sh_files_parse_mask(&mask_USER3, str)); 635 } 636 int sh_files_redef_user4(const char * str) 637 { 638 return (sh_files_parse_mask(&mask_USER4, str)); 639 } 614 640 int sh_files_redef_readonly(const char * str) 615 641 { … … 657 683 case SH_LEVEL_USER1: 658 684 return (unsigned long) mask_USER1; 685 case SH_LEVEL_USER2: 686 return (unsigned long) mask_USER2; 687 case SH_LEVEL_USER3: 688 return (unsigned long) mask_USER3; 689 case SH_LEVEL_USER4: 690 return (unsigned long) mask_USER4; 659 691 case SH_LEVEL_PRELINK: 660 692 return (unsigned long) mask_PRELINK; … … 1042 1074 { 1043 1075 return (sh_files_pushdir (SH_LEVEL_USER1, str_s)); 1076 } 1077 1078 int sh_files_pushdir_user2 (const char * str_s) 1079 { 1080 return (sh_files_pushdir (SH_LEVEL_USER2, str_s)); 1081 } 1082 1083 int sh_files_pushdir_user3 (const char * str_s) 1084 { 1085 return (sh_files_pushdir (SH_LEVEL_USER3, str_s)); 1086 } 1087 1088 int sh_files_pushdir_user4 (const char * str_s) 1089 { 1090 return (sh_files_pushdir (SH_LEVEL_USER4, str_s)); 1044 1091 } 1045 1092 -
trunk/src/sh_forward.c
r22 r27 335 335 #endif 336 336 337 #if def SH_WITH_CLIENT337 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 338 338 339 339 static int count_dev_server = 0; … … 708 708 static long sh_forward_try (char * errmsg); 709 709 710 static unsigned int ServerPort = SH_DEFAULT_PORT; 711 712 int sh_forward_server_port (const char * str) 713 { 714 unsigned long l; 715 char * endptr; 716 717 SL_ENTER(_("sh_forward_server_port")); 718 719 l = strtoul (str, &endptr, 0); 720 if (l > 65535 || endptr == str) 721 { 722 SL_RETURN (-1, _("sh_forward_server_port")); 723 } 724 ServerPort = (unsigned int) l; 725 SL_RETURN (0, _("sh_forward_server_port")); 726 } 710 727 711 728 long sh_forward (char * errmsg) … … 880 897 881 898 sockfd = connect_port_2 (sh.srvexport.name, sh.srvexport.alt, 882 S H_DEFAULT_PORT,899 ServerPort, 883 900 error_call, &error_num, error_msg, 256); 884 901 … … 1441 1458 flag_err, 1442 1459 MSG_TCP_NOCONF); 1443 } else { 1460 } 1461 #ifdef SH_WITH_CLIENT 1462 else { 1444 1463 sh_socket_server_cmd(buffer); 1445 1464 } 1465 #endif 1446 1466 flag_err = 0; 1447 1467 -
trunk/src/sh_getopt.c
r22 r27 80 80 sh_util_set_interactive }, 81 81 #endif 82 #if defined(SH_WITH_SERVER) || defined(SH_WITH_CLIENT) 83 { N_("server-port"), 84 '-', 85 N_("Set the server port to connect to"), 86 HAS_ARG_YES, 87 sh_forward_server_port }, 88 #endif 82 89 #ifdef SH_WITH_SERVER 83 90 { N_("server"), … … 112 119 HAS_ARG_YES, 113 120 sh_calls_set_bind_addr }, 114 #if def SH_WITH_CLIENT121 #if defined(SH_WITH_SERVER) || defined(SH_WITH_CLIENT) 115 122 { N_("set-export-severity"), 116 123 'e', … … 554 561 for (i = 0; op_table[i].longopt != NULL; ++i) 555 562 { 556 563 557 564 if (sl_strncmp(_(op_table[i].longopt), 558 565 &argv[1][2], … … 562 569 if ( op_table[i].hasArg == HAS_ARG_YES ) 563 570 { 564 if ( (theequal = strchr(argv[1], '=')) == NULL) 571 theequal = strchr(argv[1], '='); 572 if (theequal == NULL) 565 573 { 566 574 if (argc < 3) -
trunk/src/sh_hash.c
r22 r27 297 297 N_("[User0]"), 298 298 N_("[User1]"), 299 N_("[User2]"), 300 N_("[User3]"), 301 N_("[User4]"), 299 302 N_("[Prelink]"), 300 303 NULL -
trunk/src/sh_readconf.c
r22 r27 69 69 SH_SECTION_USER0, 70 70 SH_SECTION_USER1, 71 SH_SECTION_USER2, 72 SH_SECTION_USER3, 73 SH_SECTION_USER4, 71 74 SH_SECTION_PRELINK, 72 75 #if defined (SH_WITH_MAIL) … … 108 111 { N_("[User0]"), SH_SECTION_USER0}, 109 112 { N_("[User1]"), SH_SECTION_USER1}, 113 { N_("[User2]"), SH_SECTION_USER2}, 114 { N_("[User3]"), SH_SECTION_USER3}, 115 { N_("[User4]"), SH_SECTION_USER4}, 110 116 { N_("[Prelink]"), SH_SECTION_PRELINK}, 111 117 #ifdef WITH_EXTERNAL … … 820 826 { N_("file"), SH_SECTION_USER1, SH_SECTION_NONE, 821 827 sh_files_pushfile_user1 }, 828 { N_("dir"), SH_SECTION_USER2, SH_SECTION_NONE, 829 sh_files_pushdir_user2 }, 830 { N_("file"), SH_SECTION_USER2, SH_SECTION_NONE, 831 sh_files_pushfile_user2 }, 832 { N_("dir"), SH_SECTION_USER3, SH_SECTION_NONE, 833 sh_files_pushdir_user3 }, 834 { N_("file"), SH_SECTION_USER3, SH_SECTION_NONE, 835 sh_files_pushfile_user3 }, 836 { N_("dir"), SH_SECTION_USER4, SH_SECTION_NONE, 837 sh_files_pushdir_user4 }, 838 { N_("file"), SH_SECTION_USER4, SH_SECTION_NONE, 839 sh_files_pushfile_user4 }, 822 840 { N_("dir"), SH_SECTION_PRELINK, SH_SECTION_NONE, 823 841 sh_files_pushdir_prelink }, … … 892 910 { N_("redefuser1"), SH_SECTION_MISC, SH_SECTION_NONE, 893 911 sh_files_redef_user1 }, 912 913 { N_("redefuser2"), SH_SECTION_MISC, SH_SECTION_NONE, 914 sh_files_redef_user2 }, 915 916 { N_("redefuser3"), SH_SECTION_MISC, SH_SECTION_NONE, 917 sh_files_redef_user3 }, 918 919 { N_("redefuser4"), SH_SECTION_MISC, SH_SECTION_NONE, 920 sh_files_redef_user4 }, 894 921 895 922 { N_("redefprelink"), SH_SECTION_MISC, SH_SECTION_NONE, … … 941 968 #endif 942 969 943 #if def SH_WITH_CLIENT970 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 944 971 { N_("exportseverity"), SH_SECTION_LOG, SH_SECTION_NONE, 945 972 sh_error_setexport }, 946 973 { N_("exportclass"), SH_SECTION_LOG, SH_SECTION_NONE, 947 974 sh_error_export_mask }, 975 #if defined(SH_WITH_SERVER) 976 { N_("setlogserver"), SH_SECTION_SRV, SH_SECTION_MISC, 977 sh_forward_setlogserver }, 978 #else 948 979 { N_("setlogserver"), SH_SECTION_CLT, SH_SECTION_MISC, 949 980 sh_forward_setlogserver }, 981 #endif 950 982 #endif 951 983 { N_("setfilechecktime"), SH_SECTION_MISC, SH_SECTION_NONE, … … 1088 1120 N_("severityuser0"), 1089 1121 N_("severityuser1"), 1122 N_("severityuser2"), 1123 N_("severityuser3"), 1124 N_("severityuser4"), 1090 1125 N_("severityprelink"), 1091 1126 NULL … … 1104 1139 SH_ERR_T_USER0, 1105 1140 SH_ERR_T_USER1, 1141 SH_ERR_T_USER2, 1142 SH_ERR_T_USER3, 1143 SH_ERR_T_USER4, 1106 1144 SH_ERR_T_PRELINK, 1107 1145 }; -
trunk/src/sh_srp.c
r22 r27 384 384 } 385 385 386 #if def SH_WITH_CLIENT386 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 387 387 388 388 … … 489 489 490 490 491 #if def SH_WITH_CLIENT491 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 492 492 493 493 char * sh_srp_S_c (char * u_str, char * B_str) -
trunk/src/sh_tools.c
r22 r27 695 695 } 696 696 697 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) 697 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 698 698 static 699 699 int sh_write_select(int type, int sockfd, … … 842 842 #endif 843 843 844 #if defined (SH_WITH_CLIENT) 844 #if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 845 845 unsigned long write_port (int sockfd, char *buf, unsigned long nbytes, 846 846 int * w_error, int timeout) … … 862 862 #endif 863 863 864 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) 864 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 865 865 866 866 unsigned long read_port (int sockfd, char *buf, unsigned long nbytes, … … 898 898 #endif 899 899 900 #if defined (SH_WITH_CLIENT) 900 #if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 901 901 902 902 int check_request (char * have, char * need) … … 952 952 #endif 953 953 954 #if defined (SH_WITH_CLIENT) 954 #if defined (SH_WITH_CLIENT) || defined (SH_WITH_SERVER) 955 955 956 956 void get_header (unsigned char * head, unsigned long * bytes, char * u) … … 1032 1032 * (msg_size = payload_size - key_len = payload_size - 48) 1033 1033 */ 1034 1035 /* 1036 * only SH_V2_FULLSIZE is used, and only once 1037 */ 1038 #if 0 1034 1039 #ifdef SH_WITH_SERVER 1035 1040 #define SH_V2_FULLSIZE 240 … … 1041 1046 #define SH_V2_MESSAGE 960 1042 1047 #endif 1048 #endif 1049 #define SH_V2_FULLSIZE 1024 1043 1050 1044 1051 #ifdef SH_ENCRYPT … … 1383 1390 #endif 1384 1391 1385 #if defined (SH_WITH_CLIENT)1392 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) 1386 1393 1387 1394 /* verify the checksum of a buffer; checksum comes first … … 1535 1542 #endif 1536 1543 1537 #if defined(SH_WITH_CLIENT) || defined(SH_ STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)1544 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP) 1538 1545 1539 1546 /* --------- secure temporary file ------------ */ -
trunk/src/sh_unix.c
r25 r27 127 127 unsigned long mask_USER0 = MASK_USER_; 128 128 unsigned long mask_USER1 = MASK_USER_; 129 unsigned long mask_USER2 = MASK_USER_; 130 unsigned long mask_USER3 = MASK_USER_; 131 unsigned long mask_USER4 = MASK_USER_; 129 132 unsigned long mask_ALLIGNORE = MASK_ALLIGNORE_; 130 133 unsigned long mask_ATTRIBUTES = MASK_ATTRIBUTES_; … … 142 145 mask_USER0 = MASK_USER_; 143 146 mask_USER1 = MASK_USER_; 147 mask_USER2 = MASK_USER_; 148 mask_USER3 = MASK_USER_; 149 mask_USER4 = MASK_USER_; 144 150 mask_ALLIGNORE = MASK_ALLIGNORE_; 145 151 mask_ATTRIBUTES = MASK_ATTRIBUTES_; -
trunk/src/sh_userfiles.c
r1 r27 221 221 else if ( strstr(s, "user0") != NULL ) new->level = SH_LEVEL_USER0; 222 222 else if ( strstr(s, "user1") != NULL ) new->level = SH_LEVEL_USER1; 223 else if ( strstr(s, "user2") != NULL ) new->level = SH_LEVEL_USER2; 224 else if ( strstr(s, "user3") != NULL ) new->level = SH_LEVEL_USER3; 225 else if ( strstr(s, "user4") != NULL ) new->level = SH_LEVEL_USER4; 223 226 else if ( strstr(s, "prelink") != NULL ) new->level = SH_LEVEL_PRELINK; 224 227 else /* The default */ new->level = default_level; … … 332 335 (void) sh_files_pushfile_user1(filepath); 333 336 break; 337 case SH_LEVEL_USER2: 338 (void) sh_files_pushfile_user2(filepath); 339 break; 340 case SH_LEVEL_USER3: 341 (void) sh_files_pushfile_user3(filepath); 342 break; 343 case SH_LEVEL_USER4: 344 (void) sh_files_pushfile_user4(filepath); 345 break; 334 346 case SH_LEVEL_PRELINK: 335 347 (void) sh_files_pushfile_prelink(filepath);
Note:
See TracChangeset
for help on using the changeset viewer.