Changeset 445
- Timestamp:
- 08/13/06 02:00:00 (2 years ago)
- Files:
-
- 1.7.7/CHANGES.177 (modified) (2 diffs)
- 1.7.7/MANIFEST (modified) (1 diff)
- 1.7.7/Patchlevel (modified) (1 diff)
- 1.7.7/game/mushcnf.dst (modified) (3 diffs)
- 1.7.7/game/txt/hlp/pennfunc.hlp (modified) (6 diffs)
- 1.7.7/game/txt/hlp/pennv177.hlp (modified) (3 diffs)
- 1.7.7/game/txt/hlp/pennvOLD.hlp (modified) (1 diff)
- 1.7.7/hdrs/chunk.h (modified) (1 diff)
- 1.7.7/hdrs/flags.h (modified) (1 diff)
- 1.7.7/hdrs/version.h (modified) (1 diff)
- 1.7.7/src/bsd.c (modified) (3 diffs)
- 1.7.7/src/chunk.c (modified) (10 diffs)
- 1.7.7/src/conf.c (modified) (1 diff)
- 1.7.7/src/extchat.c (modified) (6 diffs)
- 1.7.7/src/flags.c (modified) (1 diff)
- 1.7.7/src/funcrypt.c (modified) (4 diffs)
- 1.7.7/src/function.c (modified) (4 diffs)
- 1.7.7/src/funmath.c (modified) (2 diffs)
- 1.7.7/src/game.c (modified) (6 diffs)
- 1.7.7/src/mycrypt.c (modified) (3 diffs)
- 1.7.7/src/mysocket.c (modified) (1 diff)
- 1.7.7/src/myssl.c (modified) (2 diffs)
- 1.7.7/src/pcre.c (modified) (3 diffs)
- 1.7.7/src/player.c (modified) (4 diffs)
- 1.7.7/src/shs.c (modified) (2 diffs)
- 1.7.7/src/strutil.c (modified) (9 diffs)
- 1.7.7/src/wiz.c (modified) (2 diffs)
- 1.7.7/test/testdigest.pl (added)
- 1.7.7/win32/funs.h (modified) (3 diffs)
- 1.7.7/win32/options.h (modified) (15 diffs)
- 1.7.7/win32/pennmush.dsp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.7.7/CHANGES.177
r443 r445 19 19 ========================================================================== 20 20 21 Version 1.7.7 patchlevel 23 October 10, 2003 22 23 Major Changes: 24 * Forking dumps now work with the chunk memory manager. [TAP] 25 Minor Changes: 26 * Chunk allocator improvements in partial read/writes and for 27 Win32. [TAP] 28 * Use the SHA0 algorithm from OpenSSL instead of our own when possible. [SW] 29 Functions: 30 * New digest() function for generating checksums via a variety of 31 algorithms. [SW] 32 * cowner() returns the dbref of a channel's owner. Suggested by 33 Sholevi@M*U*S*H. [SW] 34 * Added baseconv(), for converting numbers from one base to another. 35 Useful for tweaking things like Myrddin's bboard code. Suggested 36 by many people. [SW] 37 Fixes: 38 * Remove warnings in set.c and pcre.c. Report by Nymeria@M*U*S*H 39 * @power messages now show the canonical name of the power. 40 Suggested by Cheetah@M*U*S*H. 41 * Adding DARK players to channels produced a duplicated message. 42 Reported by Mystery8@ST:AW. 43 * Players set WIZARD and ROYALTY would get double notification 44 of some GAME: messages. Fixed now. [SW] 45 * Chatdb corruption possible when admin add players to channels. 46 Reported by several folks, diagnosed by Mordie@M*U*S*H. 47 48 21 49 Version 1.7.7 patchlevel 22 September 30, 2003 22 50 … … 32 60 * Attempting to unset attribute flags actually set them. 33 61 Report by Ambrosia@M*U*S*H. [SW] 34 * Remove a warning in set.c. Report by Nymeria@M*U*S*H35 62 36 63 1.7.7/MANIFEST
r441 r445 238 238 test/TestHarness.pm 239 239 test/testatree.pl 240 test/testdigest.pl 240 241 test/testhastype.pl 241 242 test/testrand.pl 1.7.7/Patchlevel
r443 r445 1 1 Do not edit this file. It is maintained by the official PennMUSH patches. 2 This is PennMUSH 1.7.7p2 22 This is PennMUSH 1.7.7p23 1.7.7/game/mushcnf.dst
r441 r445 132 132 ### file, and cache often-used attribute text in memory. This 133 133 ### can result in substantial (typically 30-50%) savings 134 ### in process memory use, at the cost of a very small performance hit 135 ### and no longer being able to do forking dumps. 134 ### in process memory use, at the cost of a very small performance hit. 136 135 ### You can control the size of memory cache (or set it so large 137 136 ### that nothing is ever swapped to disk), as well as several less … … 148 147 # If you want to use an 'infinite' cache, try setting this 149 148 # to 2000000000; you'll lose the memory benefits, but you'll still 150 # gain some locality benefits and overhead savings and you'll 151 # be able to do forking dumps. 149 # gain some locality benefits and overhead savings. 152 150 chunk_cache_memory 1000000 153 151 … … 388 386 # If I don't, the MUSH will pause while it dumps. 389 387 # If you're low on memory, don't do this. 390 # If you want to use the chunk-based memory allocator, you may not391 # be able to do forking dumps, and it will ignore this.392 388 # If you're on Win32, don't do this; fork() is not defined. 393 forking_dump no389 forking_dump yes 394 390 395 391 # If you're not forking, you get a bunch of messages that you 1.7.7/game/txt/hlp/pennfunc.hlp
r441 r445 80 80 lists of toggle (Yes/No) options efficiently. 81 81 82 ba nd() bnand() bnot() bor() bxor()83 shl() shr()82 baseconv() band() bnand() bnot() bor() 83 bxor() shl() shr() 84 84 85 85 & Boolean functions … … 99 99 Channel functions work with the channel system. 100 100 101 cflags() channels() clock() ctitle() cwho() 101 cflags() channels() clock() cowner() ctitle() 102 cwho() 102 103 & Communication functions 103 104 Communication functions are side-effect functions that send a message … … 197 198 before() brackets() capstr() case() caseall() 198 199 cat() center() comp() chr() decrypt() 199 delete() edit() encrypt() escape() if()200 if else() lcstr() left() lit() ljust()201 merge() mid() ord() pos() regedit()202 lpos() regmatch() repeat() reverse() right()203 r just() scramble() secure() sha0() space()204 sp ellnum() squish() strcat() strinsert() stripaccents()205 stripa nsi() strlen() strmatch() strreplace() switch()206 trim() ucstr() wrap()200 delete() digest() edit() encrypt() escape() 201 if() ifelse() lcstr() left() lit() 202 ljust() merge() mid() ord() pos() 203 regedit() lpos() regmatch() repeat() reverse() 204 right() rjust() scramble() secure() sha0() 205 space() spellnum() squish() strcat() strinsert() 206 stripaccents()stripansi() strlen() strmatch() strreplace() 207 switch() trim() ucstr() wrap() 207 208 208 209 See also: STRINGS … … 457 458 Does a bitwise AND of all its arguments, returning the result 458 459 (A number with only the bits set in every argument set in it). 460 & BASECONV() 461 baseconv(<integer>, <from base>, <to base>) 462 463 Converts a number from one base to another. The bases can be between 464 2 (Binary) and 36. 459 465 & BEEP() 460 466 beep([<number>]) … … 740 746 741 747 See HELP CTU() for more on the angle type. 748 & COWNER() 749 cowner(<channel>) 750 751 Returns the dbref of the owner of a channel. 742 752 & PCREATE() 743 753 pcreate(<name>,<password>) … … 869 879 870 880 This is a side-effect function and may not be enabled on some MUSHes. 881 & DIGEST() 882 digest(<algorithm>, <string>) 883 884 Returns a checksum (Hash, digest, etc.) of <string> using the given 885 <algorithm>. If the mush is compiled with SSL support (See @config 886 compile), <algorithm> can be one of: 887 888 md2 md4 md5 sha sha1 dss1 mdc2 ripemd160 889 890 Without SSL, only the sha algorithm is enabled. In both cases, sha returns 891 the same thing as the sha0() function. 892 893 See also: sha0() 871 894 & DIST2D() 872 895 dist2d(x1, y1, x2, y2) 1.7.7/game/txt/hlp/pennv177.hlp
r443 r445 1 & 1.7.7p2 21 & 1.7.7p23 2 2 & changes 3 3 This is a list of changes in this patchlevel which are probably of … … 12 12 be read in 'help patchlevels'. 13 13 14 Version 1.7.7 patchlevel 23 October 10, 2003 15 16 Major Changes: 17 * Forking dumps now work with the chunk memory manager. [TAP] 18 Minor Changes: 19 * Chunk allocator improvements in partial read/writes and for 20 Win32. [TAP] 21 * Use the SHA0 algorithm from OpenSSL instead of our own when possible. [SW] 22 Functions: 23 * New digest() function for generating checksums via a variety of 24 algorithms. [SW] 25 * cowner() returns the dbref of a channel's owner. Suggested by 26 Sholevi@M*U*S*H. [SW] 27 * Added baseconv(), for converting numbers from one base to another. 28 Useful for tweaking things like Myrddin's bboard code. Suggested 29 by many people. [SW] 30 Fixes: 31 * Remove warnings in set.c and pcre.c. Report by Nymeria@M*U*S*H 32 * @power messages now show the canonical name of the power. 33 Suggested by Cheetah@M*U*S*H. 34 * Adding DARK players to channels produced a duplicated message. 35 Reported by Mystery8@ST:AW. 36 * Players set WIZARD and ROYALTY would get double notification 37 of some GAME: messages. Fixed now. [SW] 38 * Chatdb corruption possible when admin add players to channels. 39 Reported by several folks, diagnosed by Mordie@M*U*S*H. 40 41 42 & 1.7.7p22 14 43 Version 1.7.7 patchlevel 22 September 30, 2003 15 44 … … 25 54 * Attempting to unset attribute flags actually set them. 26 55 Report by Ambrosia@M*U*S*H. [SW] 27 * Remove a warning in set.c. Report by Nymeria@M*U*S*H28 56 29 57 1.7.7/game/txt/hlp/pennvOLD.hlp
r443 r445 4419 4419 4420 4420 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 4421 19, 20, 21, 22 4421 19, 20, 21, 22, 23 4422 4422 1.7.6: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 4423 4423 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.7/hdrs/chunk.h
r433 r445 26 26 void chunk_new_period(void); 27 27 28 int chunk_fork_file(void); 29 void chunk_fork_parent(void); 30 void chunk_fork_child(void); 31 void chunk_fork_done(void); 32 28 33 #endif /* _CHUNK_H_ */ 1.7.7/hdrs/flags.h
r441 r445 124 124 extern void do_flag_add(dbref player, const char *name, char *args_right[]); 125 125 extern void do_flag_letter(dbref player, const char *name, const char *letter); 126 extern const char *power_to_string(int pwr); 126 127 127 128 #define twiddle_flag_bitmask(bm,b,neg) (neg ? clear_flag_bitmask(bm,b) : \ 1.7.7/hdrs/version.h
r443 r445 1 #define VERSION "PennMUSH version 1.7.7 patchlevel 2 2 [09/30/2003]"2 #define SHORTVN "PennMUSH 1.7.7p2 2"3 #define NUMVERSION 00100700702 21 #define VERSION "PennMUSH version 1.7.7 patchlevel 23 [10/10/2003]" 2 #define SHORTVN "PennMUSH 1.7.7p23" 3 #define NUMVERSION 001007007023 1.7.7/src/bsd.c
r443 r445 3345 3345 do_rawlog(LT_ERR, T("ERROR! forking dump exited with signal %d"), 3346 3346 WTERMSIG(my_stat)); 3347 flag_broadcast("WIZARD", 0, 3348 T("GAME: ERROR! Forking database save failed!")); 3349 flag_broadcast("ROYALTY", 0, 3347 flag_broadcast("ROYALTY WIZARD", 0, 3350 3348 T("GAME: ERROR! Forking database save failed!")); 3351 3349 } else if (WIFEXITED(my_stat) && WEXITSTATUS(my_stat) == 0) { … … 3685 3683 3686 3684 if (Dark(player)) { 3687 flag_broadcast("WIZARD", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3688 flag_broadcast("ROYALTY", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3685 flag_broadcast("ROYALTY WIZARD", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3689 3686 } else 3690 3687 flag_broadcast(0, "MONITOR", "%s %s", T("GAME:"), tbuf1); … … 3846 3843 flag_broadcast("WIZARD", 0, T("GAME: Suspect %s"), tbuf1); 3847 3844 if (Dark(player)) { 3848 flag_broadcast("WIZARD", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3849 flag_broadcast("ROYALTY", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3845 flag_broadcast("ROYALTY WIZARD", "MONITOR", "%s %s", T("GAME:"), tbuf1); 3850 3846 } else 3851 3847 flag_broadcast(0, "MONITOR", "%s %s", T("GAME:"), tbuf1); 1.7.7/src/chunk.c
r439 r445 538 538 539 539 /** Swap File */ 540 #ifdef WIN32 541 typedef HANDLE fd_type; 542 static HANDLE swap_fd; 543 static HANDLE swap_fd_child = INVALID_HANDLE_VALUE; 544 #else 545 typedef int fd_type; 540 546 static int swap_fd; 547 static int swap_fd_child = -1; 548 #endif 549 static char child_filename[300]; 541 550 542 551 /** Deref scale control. … … 1110 1119 */ 1111 1120 1121 /** Read a region from a file. 1122 * \param fd file to read from 1123 * \param rhp region buffer to use 1124 * \param region region to read 1125 */ 1126 static void 1127 read_cache_region(fd_type fd, RegionHeader * rhp, u_int_16 region) 1128 { 1129 off_t file_offset = region * REGION_SIZE; 1130 int j; 1131 char *pos; 1132 size_t remaining; 1133 int done; 1134 1135 /* Try to seek up to 3 times... */ 1136 for (j = 0; j < 3; j++) 1137 #ifdef WIN32 1138 if (SetFilePointer(fd, file_offset, NULL, FILE_BEGIN) == file_offset) 1139 break; 1140 #else 1141 if (lseek(fd, file_offset, SEEK_SET) == file_offset) 1142 break; 1143 #endif 1144 if (j >= 3) 1145 #ifdef WIN32 1146 panic(tprintf("chunk swap file seek, GetLastError %d", GetLastError())); 1147 #else 1148 panic(tprintf("chunk swap file seek, errno %d: %s", 1149 errno, strerror(errno))); 1150 #endif 1151 pos = (char *) rhp; 1152 remaining = REGION_SIZE; 1153 for (j = 0; j < 10; j++) { 1154 #ifdef WIN32 1155 if (!ReadFile(fd, pos, remaining, &done, NULL)) { 1156 /* nothing */ 1157 } 1158 #else 1159 done = read(fd, pos, remaining); 1160 #endif 1161 if (done >= 0) { 1162 remaining -= done; 1163 pos += done; 1164 if (!remaining) 1165 return; 1166 } 1167 #ifndef WIN32 1168 if (done == -1 && errno == EAGAIN) 1169 sleep(0); 1170 #endif 1171 } 1172 #ifdef WIN32 1173 panic(tprintf("chunk swap file read, %d remaining, GetLastError %d", 1174 remaining, GetLastError())); 1175 #else 1176 panic(tprintf("chunk swap file read, %d remaining, errno %d: %s", 1177 remaining, errno, strerror(errno))); 1178 #endif 1179 } 1180 1181 /** Write a region from a file. 1182 * \param fd file to write to 1183 * \param rhp region buffer to use 1184 * \param region region to write 1185 */ 1186 static void 1187 write_cache_region(fd_type fd, RegionHeader * rhp, u_int_16 region) 1188 { 1189 off_t file_offset = region * REGION_SIZE; 1190 int j; 1191 char *pos; 1192 size_t remaining; 1193 int done; 1194 1195 /* Try to seek up to 3 times... */ 1196 for (j = 0; j < 3; j++) 1197 #ifdef WIN32 1198 if (SetFilePointer(fd, file_offset, NULL, FILE_BEGIN) == file_offset) 1199 break; 1200 #else 1201 if (lseek(fd, file_offset, SEEK_SET) == file_offset) 1202 break; 1203 #endif 1204 if (j >= 3) 1205 #ifdef WIN32 1206 panic(tprintf("chunk swap file seek, GetLastError %d", GetLastError())); 1207 #else 1208 panic(tprintf("chunk swap file seek, errno %d: %s", 1209 errno, strerror(errno))); 1210 #endif 1211 pos = (char *) rhp; 1212 remaining = REGION_SIZE; 1213 for (j = 0; j < 10; j++) { 1214 #ifdef WIN32 1215 if (!WriteFile(fd, pos, remaining, &done, NULL)) { 1216 /* nothing */ 1217 } 1218 #else 1219 done = write(fd, pos, remaining); 1220 #endif 1221 if (done >= 0) { 1222 remaining -= done; 1223 pos += done; 1224 if (!remaining) 1225 return; 1226 } 1227 #ifndef WIN32 1228 if (done == -1 && errno == EAGAIN) 1229 sleep(0); 1230 #endif 1231 } 1232 #ifdef WIN32 1233 panic(tprintf("chunk swap file write, %d remaining, GetLastError %d", 1234 remaining, GetLastError())); 1235 #else 1236 panic(tprintf("chunk swap file write, %d remaining, errno %d: %s", 1237 remaining, errno, strerror(errno))); 1238 #endif 1239 } 1240 1112 1241 /** Find space in the cache. 1113 1242 * This is likely to require paging out something. … … 1117 1246 find_available_cache_region(void) 1118 1247 { 1119 off_t file_offset;1120 1248 RegionHeader *rhp; 1121 1249 … … 1140 1268 1141 1269 /* page the current occupant out */ 1142 file_offset = cache_tail->region_id * REGION_SIZE;1143 1270 #ifdef DEBUG_CHUNK_PAGING 1144 1271 do_rawlog(LT_TRACE, "CHUNK: Paging out region %04x (offset %08x)", 1145 1272 cache_tail->region_id, (unsigned) file_offset); 1146 1273 #endif 1147 if (lseek(swap_fd, file_offset, SEEK_SET) != file_offset) { 1148 /* FIXME: what about EINTR? */ 1149 panic("chunk swap file seek"); 1150 } 1151 if (write(swap_fd, (char *) cache_tail, REGION_SIZE) != REGION_SIZE) { 1152 /* FIXME: what about EINTR? */ 1153 panic("chunk swap file write"); 1154 } 1274 write_cache_region(swap_fd, cache_tail, cache_tail->region_id); 1155 1275 /* keep statistics */ 1156 1276 stat_paging_histogram[RegionDerefs(cache_tail->region_id)]++; … … 1198 1318 Region *rp = regions + region; 1199 1319 RegionHeader *rhp, *prev, *next; 1200 off_t file_offset = region * REGION_SIZE;1201 1320 u_int_32 offset; 1202 1321 unsigned int shift; … … 1216 1335 region, (unsigned) file_offset); 1217 1336 #endif 1218 if (lseek(swap_fd, file_offset, SEEK_SET) != file_offset) { 1219 /* FIXME: what about EINTR? */ 1220 panic("chunk swap file seek"); 1221 } 1222 if (read(swap_fd, (char *) rhp, REGION_SIZE) != REGION_SIZE) { 1223 /* FIXME: what about EINTR? */ 1224 panic("chunk swap file read"); 1225 } 1337 read_cache_region(swap_fd, rhp, region); 1226 1338 /* link the region to its cache entry */ 1227 1339 rp->in_memory = rhp; … … 2405 2517 do { 2406 2518 worked = 0; 2407 for (rhp = cache_head; rhp; rhp = rhp->next) 2519 for (rhp = cache_head; rhp; rhp = rhp->next) { 2520 if (rhp->region_id == INVALID_REGION_ID) 2521 continue; 2408 2522 while (m_limit && migrate_hardpack(rhp->region_id)) { 2409 2523 worked = 1; 2410 2524 } 2525 } 2411 2526 } while (worked); 2412 2527 … … 2428 2543 do { 2429 2544 worked = 0; 2430 for (rhp = cache_head; rhp; rhp = rhp->next) 2545 for (rhp = cache_head; rhp; rhp = rhp->next) { 2546 if (rhp->region_id == INVALID_REGION_ID) 2547 continue; 2431 2548 while (m_limit && migrate_softpack(rhp->region_id)) { 2432 2549 worked = 1; 2433 2550 } 2551 } 2434 2552 } while (worked); 2435 2553 #ifdef DEBUG_CHUNK_MIGRATE_LOUD … … 2472 2590 (REGION_CAPACITY - MIN_REMNANT_LEN) / UNHAPPINESS_SPACE_DIVISOR); 2473 2591 2592 #ifdef WIN32 2593 swap_fd = CreateFile(CHUNK_SWAP_FILE, GENERIC_READ | GENERIC_WRITE, 2594 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL); 2595 if (swap_fd == INVALID_HANDLE_VALUE) 2596 panic(tprintf("Cannot open swap file: %d", GetLastError())); 2597 #else 2474 2598 swap_fd = open(CHUNK_SWAP_FILE, O_RDWR | O_TRUNC | O_CREAT, 0600); 2475 2599 if (swap_fd < 0) 2476 2600 panic(tprintf("Cannot open swap file: %s", strerror(errno))); 2601 #endif 2477 2602 curr_period = 0; 2478 2603 … … 2588 2713 } 2589 2714 } 2715 2716 #ifndef WIN32 2717 /** Clone the chunkswap file for forking dumps. 2718 * \retval 0 if unable to clone the swap file 2719 * \retval 1 if swap file clone succeeded 2720 */ 2721 int 2722 chunk_fork_file(void) 2723 { 2724 unsigned int j; 2725 RegionHeader *rhp, *prev, *next; 2726 2727 /* abort if already cloned */ 2728 if (swap_fd_child >= 0) 2729 return 0; 2730 2731 j = 0; 2732 for (;;) { 2733 sprintf(child_filename, "%s.%d", CHUNK_SWAP_FILE, j); 2734 swap_fd_child = open(child_filename, O_RDWR | O_EXCL | O_CREAT, 0600); 2735 if (swap_fd_child >= 0) 2736 break; 2737 if (j >= 10) 2738 return 0; 2739 j++; 2740 } 2741 2742 rhp = find_available_cache_region(); 2743 prev = rhp->prev; 2744 next = rhp->next; 2745 for (j = 0; j < region_count; j++) { 2746 if (regions[j].in_memory) 2747 continue; 2748 2749 read_cache_region(swap_fd, rhp, j); 2750 write_cache_region(swap_fd_child, rhp, j); 2751 } 2752 rhp->region_id = INVALID_REGION_ID; 2753 rhp->prev = prev; 2754 rhp->next = next; 2755 2756 return 1; 2757 } 2758 2759 /** Assert that we're the parent after fork. 2760 */ 2761 void 2762 chunk_fork_parent(void) 2763 { 2764 if (swap_fd_child < 0) 2765 return; 2766 2767 close(swap_fd_child); 2768 swap_fd_child = -1; 2769 } 2770 2771 /** Assert that we're the child after fork. 2772 */ 2773 void 2774 chunk_fork_child(void) 2775 { 2776 if (swap_fd_child < 0) 2777 return; 2778 2779 close(swap_fd); 2780 swap_fd = swap_fd_child; 2781 swap_fd_child = -1; 2782 } 2783 2784 /** Assert that we're done with the cloned chunkswap file. 2785 */ 2786 void 2787 chunk_fork_done(void) 2788 { 2789 if (swap_fd_child < 0) 2790 close(swap_fd); 2791 else 2792 close(swap_fd_child); 2793 2794 unlink(child_filename); 2795 swap_fd_child = -1; 2796 } 2797 #endif /* !WIN32 */ 1.7.7/src/conf.c
r439 r445 1548 1548 #endif 1549 1549 1550 #ifdef HAS_OPENSSL 1551 notify(player, T(" The MUSH was compiled with SSL support.")); 1552 #endif 1553 1550 1554 #ifdef SINGLE_LOGFILE 1551 1555 notify(player, T(" Logging is to a single log file.")); 1.7.7/src/extchat.c
r441 r445 251 251 u = (CHANUSER *) mush_malloc(sizeof(CHANUSER), "CHANUSER"); 252 252 if (!u) 253 return NULL;253 panic("Couldn't allocate memory in new_user in extchat.c"); 254 254 CUdbref(u) = who; 255 255 CUtype(u) = CU_DEFAULT_FLAGS; … … 294 294 load_channel(FILE * fp, CHAN *ch) 295 295 { 296 int ret = 1;297 296 strcpy(ChanName(ch), getstring_noalloc(fp)); 298 297 if (feof(fp)) … … 311 310 ChanMaxUsers(ch) = ChanNumUsers(ch); 312 311 ChanUsers(ch) = NULL; 313 if (ChanNumUsers(ch) > 0) { 314 ret = load_chanusers(fp, ch); 315 if (ret < 0) 316 return 0; 317 ChanNumUsers(ch) = ret; 318 } 312 if (ChanNumUsers(ch) > 0) 313 ChanNumUsers(ch) = load_chanusers(fp, ch); 319 314 return 1; 320 315 } … … 332 327 if (GoodObject(player) && Chan_Ok_Type(ch, player)) { 333 328 user = new_user(player); 334 if (!user)335 return -1;336 329 CUtype(user) = getref(fp); 337 330 strcpy(CUtitle(user), getstring_noalloc(fp)); … … 990 983 format_channel_broadcast(chan, u, victim, CB_CHECKQUIET | CB_PRESENCE, 991 984 T("<%s> %s has joined this channel."), NULL); 992 ChanNumUsers(chan)++;993 } else {994 notify_format(player,995 T("%s is already on channel <%s>."), Name(victim),996 ChanName(chan));997 985 } 998 return; 999 } 986 ChanNumUsers(chan)++; 987 } else { 988 notify_format(player, 989 T("%s is already on channel <%s>."), Name(victim), 990 ChanName(chan)); 991 } 992 return; 1000 993 } else if (!strcasecmp("off", com) || !strcasecmp("leave", com)) { 1001 994 char title[CU_TITLE_LEN]; … … 1978 1971 break; 1979 1972 } 1973 } 1974 1975 FUNCTION(fun_cowner) 1976 { 1977 /* Return the dbref of the owner of a channel. */ 1978 CHAN *c; 1979 1980 if (!args[0] || !*args[0]) { 1981 safe_str(T("#-1 NO CHANNEL GIVEN"), buff, bp); 1982 return; 1983 } 1984 switch (find_channel(args[0], &c, executor)) { 1985 case CMATCH_NONE: 1986 safe_str(T("#-1 NO SUCH CHANNEL"), buff, bp); 1987 break; 1988 case CMATCH_AMBIG: 1989 safe_str(T("#-1 AMBIGUOUS CHANNEL NAME"), buff, bp); 1990 break; 1991 default: 1992 safe_dbref(ChanCreator(c), buff, bp); 1993 } 1994 1980 1995 } 1981 1996 1.7.7/src/flags.c
r441 r445 2286 2286 } 2287 2287 } 2288 2289 /* Not commented because this should go away in power rewrite */ 2290 const char * 2291 power_to_string(int pwr) 2292 { 2293 POWER *p; 2294 for (p = power_table; p->name; p++) { 2295 /* Special case for immortal, which we don't show any more */ 2296 if (!strcasecmp(p->name, "immortal")) 2297 continue; 2298 if (pwr & p->flag) 2299 return p->name; 2300 } 2301 return ""; 2302 } 1.7.7/src/funcrypt.c
r433 r445 27 27 #include "ansi.h" 28 28 #include "match.h" 29 #ifdef HAS_OPENSSL 30 #include <openssl/sha.h> 31 #include <openssl/evp.h> 32 #else 29 33 #include "shs.h" 34 #endif 30 35 #include "confmagic.h" 31 36 … … 33 38 static char *crunch_code _((char *code)); 34 39 static char *crypt_code _((char *code, char *text, int type)); 40 41 #ifdef HAS_OPENSSL 42 static void safe_hexchar(unsigned char c, char *buff, char **bp); 43 #endif 35 44 36 45 /* Copy over only alphanumeric chars */ … … 120 129 FUNCTION(fun_sha0) 121 130 { 131 #ifdef HAS_OPENSSL 132 unsigned char hash[SHA_DIGEST_LENGTH]; 133 int n; 134 135 SHA(args[0], arglens[0], hash); 136 137 for (n = 0; n < SHA_DIGEST_LENGTH; n++) 138 safe_hexchar(hash[n], buff, bp); 139 #else 122 140 SHS_INFO shsInfo; 123 141 shsInfo.reverse_wanted = (BYTE) options.reverse_shs; … … 128 146 shsInfo.digest[1], shsInfo.digest[2], shsInfo.digest[3], 129 147 shsInfo.digest[4]); 130 } 148 #endif 149 } 150 151 FUNCTION(fun_digest) 152 { 153 #ifdef HAS_OPENSSL 154 EVP_MD_CTX ctx; 155 const EVP_MD *mp; 156 unsigned char md[EVP_MAX_MD_SIZE]; 157 size_t n, len = 0; 158 159 if ((mp = EVP_get_digestbyname(args[0])) == NULL) { 160 safe_str(T("#-1 UNSUPPORTED DIGEST TYPE"), buff, bp); 161 return; 162 } 163 164 EVP_DigestInit(&ctx, mp); 165 EVP_DigestUpdate(&ctx, args[1], arglens[1]); 166 EVP_DigestFinal(&ctx, md, &len); 167 168 for (n = 0; n < len; n++) { 169 safe_hexchar(md[n], buff, bp); 170 } 171 172 #else 173 if (strcmp(args[0], "sha") == 0) { 174 SHS_INFO shsInfo; 175 shsInfo.reverse_wanted = (BYTE) options.reverse_shs; 176 shsInit(&shsInfo); 177 shsUpdate(&shsInfo, (const BYTE *) args[0], arglens[0]); 178 shsFinal(&shsInfo); 179 safe_format(buff, bp, "%0lx%0lx%0lx%0lx%0lx", shsInfo.digest[0], 180 shsInfo.digest[1], shsInfo.digest[2], shsInfo.digest[3], 181 shsInfo.digest[4]); 182 } else { 183 safe_str(T("#-1 UNSUPPORTED DIGEST TYPE"), buff, bp); 184 } 185 #endif 186 } 187 188 #ifdef HAS_OPENSSL 189 static void 190 safe_hexchar(unsigned char c, char *buff, char **bp) 191 { 192 const char *digits = "0123456789abcdef"; 193 if (*bp - buff < BUFFER_LEN - 1) { 194 **bp = digits[c >> 4]; 195 (*bp)++; 196 } 197 if (*bp - buff < BUFFER_LEN - 1) { 198 **bp = digits[c & 0x0F]; 199 (*bp)++; 200 } 201 } 202 #endif 1.7.7/src/function.c
r441 r445 192 192 {"ATRLOCK", fun_atrlock, 1, 2, FN_REG}, 193 193 {"BAND", fun_band, 1, INT_MAX, FN_REG}, 194 {"BASECONV", fun_baseconv, 3, 3, FN_REG}, 194 195 {"BEEP", fun_beep, 0, 1, FN_REG}, 195 196 {"BEFORE", fun_before, 2, 2, FN_REG}, … … 207 208 #ifdef CHAT_SYSTEM 208 209 {"CEMIT", fun_cemit, 2, 3, FN_REG}, 210 {"CFLAGS", fun_cflags, 1, 2, FN_REG}, 211 {"CHANNELS", fun_channels, 0, 2, FN_REG}, 212 {"CLOCK", fun_clock, 1, 2, FN_REG}, 213 {"COWNER", fun_cowner, 1, 1, FN_REG}, 214 {"CTITLE", fun_ctitle, 2, 2, FN_REG}, 215 {"CWHO", fun_cwho, 1, 1, FN_REG}, 209 216 #endif 210 217 {"CENTER", fun_center, 2, 3, FN_REG}, 211 218 {"CHILDREN", fun_lsearch, 1, 1, FN_REG}, 212 219 {"CHR", fun_chr, 1, 1, FN_REG}, 213 #ifdef CHAT_SYSTEM214 {"CFLAGS", fun_cflags, 1, 2, FN_REG},215 {"CHANNELS", fun_channels, 0, 2, FN_REG},216 #endif217 220 {"CHECKPASS", fun_checkpass, 2, 2, FN_REG | FN_WIZARD}, 218 #ifdef CHAT_SYSTEM219 {"CLOCK", fun_clock, 1, 2, FN_REG},220 #endif221 221 {"CLONE", fun_clone, 1, 1, FN_REG}, 222 222 {"COMP", fun_comp, 2, 3, FN_REG}, … … 231 231 {"CREATE", fun_create, 1, 2, FN_REG}, 232 232 {"CTIME", fun_ctime, 1, 1, FN_REG}, 233 #ifdef CHAT_SYSTEM234 {"CTITLE", fun_ctitle, 2, 2, FN_REG},235 {"CWHO", fun_cwho, 1, 1, FN_REG},236 #endif237 233 {"DEC", fun_dec, 1, 1, FN_REG}, 238 234 {"DECRYPT", fun_decrypt, 2, 2, FN_REG}, … … 241 237 {"DIE", fun_die, 2, 3, FN_REG}, 242 238 {"DIG", fun_dig, 1, 3, FN_REG}, 239 {"DIGEST", fun_digest, 2, -2, FN_REG}, 243 240 {"DIST2D", fun_dist2d, 4, 4, FN_REG}, 244 241 {"DIST3D", fun_dist3d, 6, 6, FN_REG}, 1.7.7/src/funmath.c
r427 r445 53 53 static double frac(double v, int *RESTRICT n, int *RESTRICT d, double error); 54 54 void init_math_hashtab(void); 55 56 extern int format_long(long n, char *buff, char **bp, int maxlen, int base); 55 57 56 58 MATH_PROTO(math_add); … … 1577 1579 1578 1580 mush_free((Malloc_t) ptr, "string"); 1581 } 1582 1583 FUNCTION(fun_baseconv) 1584 { 1585 long n; 1586 int from, to; 1587 char *end; 1588 1589 if (!(is_integer(args[1]) && is_integer(args[2]))) { 1590 safe_str(T(e_ints), buff, bp); 1591 return; 1592 } 1593 1594 from = parse_integer(args[1]); 1595 to = parse_integer(args[2]); 1596 1597 if (from < 2 || from > 36) { 1598 safe_str(T("#-1 FROM BASE OUT OF RANGE"), buff, bp); 1599 return; 1600 } 1601 1602 if (to < 2 || to > 36) { 1603 safe_str(T("#-1 TO BASE OUT OF RANGE"), buff, bp); 1604 return; 1605 } 1606 1607 n = strtol(trim_space_sep(args[0], ' '), &end, from); 1608 1609 if (*end != '\0') { 1610 safe_str(T("#-1 MALFORMED NUMBER"), buff, bp); 1611 return; 1612 } 1613 1614 format_long(n, buff, bp, BUFFER_LEN, to); 1579 1615 } 1580 1616 1.7.7/src/game.c
r439 r445 537 537 fork_and_dump(int forking) 538 538 { 539 int child, nofork, status ;539 int child, nofork, status, split; 540 540 epoch++; 541 541 … … 549 549 else 550 550 nofork = !forking || (paranoid_dump == 2); /* Don't fork for dump/debug */ 551 if (!nofork && chunk_num_swapped()) {552 /* Ack, can't fork, 'cause we have stuff on disk... */553 do_log(LT_ERR, 0, 0,554 "fork_and_dump: Data are swapped to disk, so nonforking dumps will be used.");555 flag_broadcast("WIZARD", 0,556 "DUMP: Data are swapped to disk, so nonforking dumps will be used.");557 nofork = 1;558 }559 551 #ifdef WIN32 560 552 nofork = 1; … … 563 555 nofork = 1; 564 556 #endif 557 split = 0; 558 if (!nofork && chunk_num_swapped()) { 559 #ifndef WIN32 560 /* Try to clone the chunk swapfile. */ 561 if (chunk_fork_file()) { 562 split = 1; 563 } else { 564 /* Ack, can't fork, 'cause we have stuff on disk... */ 565 do_log(LT_ERR, 0, 0, 566 "fork_and_dump: Data are swapped to disk, so nonforking dumps will be used."); 567 flag_broadcast("WIZARD", 0, 568 "DUMP: Data are swapped to disk, so nonforking dumps will be used."); 569 nofork = 1; 570 } 571 #endif 572 } 565 573 if (!nofork) { 566 574 #ifndef macintosh … … 575 583 child = 0; 576 584 nofork = 1; 577 } else if (child > 0) 585 if (split) { 586 split = 0; 587 chunk_fork_done(); 588 } 589 } else if (child > 0) { 578 590 forked_dump_pid = child; 579 591 chunk_fork_parent(); 592 } else { 593 chunk_fork_child(); 580 594 #ifdef HAS_SETPRIORITY 581 else {582 595 /* Lower the priority of the child to make parent more responsive */ 583 596 #ifdef HAS_GETPRIORITY … … 586 599 setpriority(PRIO_PROCESS, child, 8); 587 600 #endif /* HAS_GETPRIORITY */ 588 }589 601 #endif /* HAS_SETPRIORITY */ 602 } 590 603 #endif /* WIN32 */ 591 604 #endif /* macintosh */ … … 599 612 release_fd(); 600 613 status = dump_database_internal(); 614 #ifndef WIN32 615 if (split) 616 chunk_fork_done(); 617 #endif 601 618 if (!nofork) { 602 619 _exit(status); /* !!! */ 1.7.7/src/mycrypt.c
r423 r445 14 14 #include "conf.h" 15 15 #if (CRYPT_SYSTEM > 0) 16 #ifdef HAS_OPENSSL 17 #include <openssl/sha.h> 18 #else 16 19 #include "shs.h" 20 #endif 17 21 #endif 18 22 #include "confmagic.h" … … 30 34 return (char *) key; 31 35 #else 36 static char crypt_buff[70]; 37 38 #ifdef HAS_OPENSSL 39 char hash[SHA_DIGEST_LENGTH]; 40 unsigned int a, b; 41 42 SHA(key, strlen(key), hash); 43 44 memcpy(&a, hash, sizeof a); 45 memcpy(&b, hash + sizeof a, sizeof b); 46
