[Openvas-commits] r11742 - in trunk/openvas-administrator: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Oct 5 21:50:53 CEST 2011


Author: mattm
Date: 2011-10-05 21:50:52 +0200 (Wed, 05 Oct 2011)
New Revision: 11742

Modified:
   trunk/openvas-administrator/ChangeLog
   trunk/openvas-administrator/src/admin.c
Log:
	* src/admin.c (openvas_admin_modify_user): Call through to libraries
	openvas_modify_user.

Modified: trunk/openvas-administrator/ChangeLog
===================================================================
--- trunk/openvas-administrator/ChangeLog	2011-10-05 19:48:01 UTC (rev 11741)
+++ trunk/openvas-administrator/ChangeLog	2011-10-05 19:50:52 UTC (rev 11742)
@@ -1,3 +1,8 @@
+2011-10-05  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* src/admin.c (openvas_admin_modify_user): Call through to libraries
+	openvas_modify_user.
+
 2011-09-22  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	* doc/CMakeLists.txt: Move xsltproc call into Makefile, to workaround dash.

Modified: trunk/openvas-administrator/src/admin.c
===================================================================
--- trunk/openvas-administrator/src/admin.c	2011-10-05 19:48:01 UTC (rev 11741)
+++ trunk/openvas-administrator/src/admin.c	2011-10-05 19:50:52 UTC (rev 11742)
@@ -578,7 +578,6 @@
     }
 }
 
-/** @todo handle remotely authenticated users. */
 /**
  * @brief Modify a user.
  *
@@ -599,64 +598,8 @@
                            const gchar * role, const gchar * hosts,
                            int hosts_allow, const gchar * directory)
 {
-  assert (name != NULL);
-  assert (directory != NULL);
-
-  if (strcmp (name, "om") == 0)
-    {
-      g_warning ("Attempt to modify special \"om\" user!");
-      return -1;
-    }
-
-  if (g_file_test (directory, G_FILE_TEST_IS_DIR))
-    {
-      GError *error = NULL;
-      gchar *user_hash_file_name, *hashes_out;
-
-      /* Put the password hashes in auth/hash. */
-
-      if (password)
-        {
-          hashes_out = get_password_hashes (GCRY_MD_MD5, password);
-          user_hash_file_name =
-            g_build_filename (directory, name, "auth", "hash", NULL);
-          if (!g_file_set_contents
-              (user_hash_file_name, hashes_out, -1, &error))
-            {
-              g_warning ("%s", error->message);
-              g_error_free (error);
-              g_free (hashes_out);
-              g_free (user_hash_file_name);
-              return -1;
-            }
-          g_free (hashes_out);
-          g_free (user_hash_file_name);
-        }
-
-      /* Create rules according to hosts. */
-      if (hosts)
-        {
-          gchar *user_dir_name = g_build_filename (directory, name, NULL);
-          if (openvas_auth_store_user_rules (user_dir_name, hosts, hosts_allow)
-              == -1)
-            {
-              g_free (user_dir_name);
-              return -1;
-            }
-
-          g_free (user_dir_name);
-        }
-
-      /* Set the role of the user. */
-
-      if (role)
-        return openvas_set_user_role (name, role, NULL);
-
-      return 0;
-    }
-
-  g_warning ("Could not access %s!", directory);
-  return -1;
+  return openvas_user_modify (name, password, role, hosts, hosts_allow,
+                              directory);
 }
 
 /**



More information about the Openvas-commits mailing list