Sun Oct 1 20:39:34 CEST 2006 Jochen Eisinger <coffee@silcnet.org>
authorJochen Eisinger <coffee@silcnet.org>
Sun, 1 Oct 2006 18:41:08 +0000 (18:41 +0000)
committerJochen Eisinger <coffee@silcnet.org>
Sun, 1 Oct 2006 18:41:08 +0000 (18:41 +0000)
* Always return a valid username.  Affected file
  lib/silcutil/unix/silcunixutil.c

CHANGES
lib/silcutil/unix/silcunixutil.c

diff --git a/CHANGES b/CHANGES
index 408b8b5e617f3389309dd7d74e10db38c29efc12..a9ade5d1cfbd1fdb9b28f398762901d3fa4eb4df 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+Sun Oct  1 20:39:34 CEST 2006  Jochen Eisinger <coffee@silcnet.org>
+
+       * Always return a valid username.  Affected file
+         lib/silcutil/unix/silcunixutil.c
+
 Sun Jul  2 19:12:36 CEST 2006  Jochen Eisinger <coffee@silcnet.org>
 
        * Make gmake the default for autodist, so I can properly work
index 92bfaded55911cd5944a027db0df3d26407badc0..24c93a1c5c4fdfa8e6386d5463d6695efd6bab85 100644 (file)
@@ -135,13 +135,13 @@ char *silc_get_username()
   char *logname = NULL;
   
   logname = getenv("LOGNAME");
-  if (!logname) {
+  if (!logname || !strlen(logname)) {
     logname = getlogin();
-    if (!logname) {
+    if (!logname || !strlen(logname)) {
       struct passwd *pw;
 
       pw = getpwuid(getuid());
-      if (!pw)
+      if (!pw || !strlen(pw->pw_name))
        return strdup("foo");
 
       logname = pw->pw_name;