1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-31 21:57:12 +00:00
freebsd-ports/games/crossfire-server/files/patch-ag
Andreas Klemm 680b820157 many changes by Dave:
- Fix the password problem so passwords are actually checked.
- Change some default options like SAVE_HOMEDIR, XPM_PIX (you hade
  the port requiring xpm but CF wasn't configured to link it in),
  ForceCCOPTIONS, EXPLORE_MODE, etc.
- Remove the empty ${CFDIR}/lib/shutdown from the Makefile and the
  PLIST.  This file just causes the program to exit without saying
  why until the user manually removes the file.
- Fix "crossfire -o" to call uname correctly.
- Set logfile to be line buffered (instead of block buffered) since they
  hardly ever call fflush(3).
Submitted by:	Dave Chapeskie <dchapes@golden.net>
1997-09-18 14:21:06 +00:00

48 lines
981 B
Plaintext

--- server/main.c.orig Sun Jan 5 19:59:27 1997
+++ server/main.c Wed Sep 17 15:34:40 1997
@@ -139,6 +139,36 @@
}
}
+#if defined(__FreeBSD__)
+static unsigned char itoa64[] =
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
+
+static void
+to64(char *s, long v, int n)
+{
+ while (--n >= 0) {
+ *s++ = itoa64[v&0x3f];
+ v >>= 6;
+ }
+}
+
+char *
+crypt_string(char *str, char *salt)
+{
+ char s[10];
+ if (salt==NULL) {
+ struct timeval tv;
+ gettimeofday(&tv,0);
+ to64(&s[0], random(), 3);
+ to64(&s[3], tv.tv_usec, 3);
+ to64(&s[6], tv.tv_sec, 2);
+ s[8] = '\0';
+ salt = s;
+ }
+ return (crypt(str, salt));
+}
+#else
+
char *crypt_string(char *str, char *salt) {
static char *c=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
@@ -151,6 +181,7 @@
s[1]= salt[1];
return crypt(str,s);
}
+#endif
int check_password(char *typed,char *crypted) {
return !strcmp(crypt_string(typed,crypted),crypted);