[Openvas-commits] r5446 - in trunk/openvas-client: . openvas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 9 00:26:47 CEST 2009


Author: jan
Date: 2009-10-09 00:26:46 +0200 (Fri, 09 Oct 2009)
New Revision: 5446

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/openvas/preferences.c
Log:
* openvas/preferences.c (prefs_get_default): Use g_get_user_name() instead
of own function to determine username.
(get_username): Removed.



Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-10-08 20:14:43 UTC (rev 5445)
+++ trunk/openvas-client/ChangeLog	2009-10-08 22:26:46 UTC (rev 5446)
@@ -1,3 +1,9 @@
+2009-10-09  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	* openvas/preferences.c (prefs_get_default): Use g_get_user_name() instead
+	of own function to determine username.
+	(get_username): Removed.
+
 2009-10-08  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* openvas/prefs_dialog/prefs_scope_tree.c (): Renamed

Modified: trunk/openvas-client/openvas/preferences.c
===================================================================
--- trunk/openvas-client/openvas/preferences.c	2009-10-08 20:14:43 UTC (rev 5445)
+++ trunk/openvas-client/openvas/preferences.c	2009-10-08 22:26:46 UTC (rev 5446)
@@ -40,7 +40,6 @@
 static int preferences_new(struct context *);
 static int prefs_buffer_parse(char *, struct arglist *, int);
 static int prefs_add_subcategory(struct arglist *, FILE *, int);
-static char *get_username();
 int preferences_process(struct context *);
 char * preferences_get_filename(struct context *);
 
@@ -654,7 +653,7 @@
     return "localhost";
 #endif
   else if (!strcmp(name, "nessusd_user"))
-    return get_username();
+    return (void *)g_get_user_name();
   else if (!strcmp(name, "nessusd_port"))
     return (void *)OPENVAS_IANA_OTP_PORT;
   else if (!strcmp(name, "ssl_version"))
@@ -817,45 +816,7 @@
   return 0;
 }
 
-
-/**
- * @return The name of the current user or empty string if none found.
- */
-static char *
-get_username (void)
-{
 #ifdef _WIN32
-  char *user;
-
-  /* Look up the user's name. */
-  user = getenv("USERNAME");
-  if(user)
-    return user;
-
-  return "";
-#else
-  char *user;
-  struct passwd *pwd;
-
-  /* Look up the user's name. */
-  user = getenv("USER");
-  if(user)
-    return user;
-
-  user = getenv("LOGNAME");
-  if(user)
-    return user;
-
-  pwd = getpwuid(getuid());
-  if(pwd && pwd->pw_name)
-    return pwd->pw_name;
-
-  return "";
-#endif
-}
-
-
-#ifdef _WIN32
 #include <windows.h>
 #include <shlobj.h>
 #include <io.h>



More information about the Openvas-commits mailing list