updates.
authorPekka Riikonen <priikone@silcnet.org>
Thu, 10 May 2001 19:08:45 +0000 (19:08 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 10 May 2001 19:08:45 +0000 (19:08 +0000)
CHANGES
lib/silccrypt/silcrng.c
lib/silcutil/silcutil.c

diff --git a/CHANGES b/CHANGES
index b738985de3c99bb7dd8928474c575bed12341e2f..8d9bc9a6b21441b8a785c3e0dd65f62e2c8e4e6b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,14 @@
+Thu May 10 22:49:51 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+       * Compiled the SILC under cygwin.  Compiled and tested briefly
+         without problems.  More tests needed.  The SIMs didn't compile
+         though.
+
+       * Added various #ifdef HAVE_* stuff to lib/silccrypt/silrng.c.
+
+       * Fixed possible crash in silc_get_username in the
+         lib/silcutil/silcutil.c.
+
 Tue May  8 09:04:03 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Fixed a va_arg in silc/client_ops.c.
index f671952c2dd1e9293e73455fce38a72a61046418..7b01e552acdc989cc47eb7bdcab9cab01f6c5e71 100644 (file)
@@ -190,12 +190,20 @@ static void silc_rng_get_soft_noise(SilcRng rng)
   pos = silc_rng_get_position(rng);
 
   silc_rng_xor(rng, clock(), 0);
+#ifdef HAVE_GETPID
   silc_rng_xor(rng, getpid(), 1);
+#ifdef HAVE_GETPGID
   silc_rng_xor(rng, getpgid(getpid() << 8), 2);
   silc_rng_xor(rng, getpgid(getpid() << 8), 3);
+#endif
   silc_rng_xor(rng, getgid(), 4);
+#endif
+#ifdef HAVE_GETPGRP
   silc_rng_xor(rng, getpgrp(), 5);
+#endif
+#ifdef HAVE_GETSID
   silc_rng_xor(rng, getsid(getpid() << 16), 6);
+#endif
   silc_rng_xor(rng, times(&ptime), 7);
   silc_rng_xor(rng, ptime.tms_utime, 8);
   silc_rng_xor(rng, (ptime.tms_utime + ptime.tms_stime), pos++);
@@ -208,12 +216,20 @@ static void silc_rng_get_soft_noise(SilcRng rng)
   silc_rng_xor(rng, (ptime.tms_cutime + ptime.tms_stime), pos++);
   silc_rng_xor(rng, (ptime.tms_stime << 8), pos++);
   silc_rng_xor(rng, clock() << 4, pos++);
+#ifdef HAVE_GETPGID
   silc_rng_xor(rng, getpgid(getpid() << 8), pos++);
+#endif
+#ifdef HAVE_GETPGRP
   silc_rng_xor(rng, getpgrp(), pos++);
+#endif
+#ifdef HAVE_SETSID
   silc_rng_xor(rng, getsid(getpid() << 16), pos++);
+#endif
   silc_rng_xor(rng, times(&ptime), pos++);
   silc_rng_xor(rng, ptime.tms_utime, pos++);
+#ifdef HAVE_GETPGRP
   silc_rng_xor(rng, getpgrp(), pos++);
+#endif
 
 #ifdef SILC_RNG_DEBUG
   SILC_LOG_HEXDUMP(("pool"), rng->pool, sizeof(rng->pool));
index 6b118ee8a07a0bf2e6dbfd5d723880ba340520d1..2907f2cccdff8c3f2b08cdbe9952ad920d3b831e 100644 (file)
@@ -724,6 +724,11 @@ char *silc_get_username()
 {
   char *logname = NULL;
   
+  if (!getenv("LOGNAME")) {
+    fprintf(stderr, "Error: environment variable $LOGNAME not set\n");
+    return NULL;
+  }
+
   logname = strdup(getenv("LOGNAME"));
   if (!logname) {
     logname = getlogin();