[Openvas-commits] r11649 - in trunk/openvas-libraries: . misc

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 21 16:32:40 CEST 2011


Author: mattm
Date: 2011-09-21 16:32:38 +0200 (Wed, 21 Sep 2011)
New Revision: 11649

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/misc/openvas_auth.c
   trunk/openvas-libraries/misc/openvas_auth.h
Log:
	* misc/openvas_auth.c (openvas_user_exists): New function.

	* misc/openvas_auth.h: Add header accordingly.

	* ChangeLog: Cleanup some entries.

Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2011-09-21 13:46:10 UTC (rev 11648)
+++ trunk/openvas-libraries/ChangeLog	2011-09-21 14:32:38 UTC (rev 11649)
@@ -1,3 +1,11 @@
+2011-09-21  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* misc/openvas_auth.c (openvas_user_exists): New function.
+
+	* misc/openvas_auth.h: Add header accordingly.
+
+	* ChangeLog: Cleanup some entries.
+
 2011-09-13  Michael Wiegand <michael.wiegand at greenbone.net>
 
 	* nasl/nasl_ssh.c (nasl_ssh_exec): Remove superfluous log messages for
@@ -6136,12 +6144,12 @@
 
 	* libopenvas/store.c (str2arglist): Apply strchr
 	only if the string is non-empty.
-	(store_load_plugin, store_plugin, store_fetch_path,
-	store_fetch_version, store_fetch_summary, store_fetch_description,
-	store_fetch_copyright, store_fetch_family, store_fetch_oid,
-	store_fetch_cve_id, store_fetch_bugtraq_id, store_fetch_xref,
-	store_fetch_tag, store_fetch_required_keys, store_fetch_excluded_keys,
-	store_fetch_required_ports, store_fetch_required_udp_ports):
+	(store_load_plugin, store_plugin, store_fetch_path)
+	(store_fetch_version, store_fetch_summary, store_fetch_description)
+	(store_fetch_copyright, store_fetch_family, store_fetch_oid)
+	(store_fetch_cve_id, store_fetch_bugtraq_id, store_fetch_xref)
+	(store_fetch_tag, store_fetch_required_keys, store_fetch_excluded_keys)
+	(store_fetch_required_ports, store_fetch_required_udp_ports):
 	Replace handling from "desc" files to "nvti" files.
 
 2009-06-11  Michael Wiegand <michael.wiegand at intevation.de>
@@ -8866,4 +8874,4 @@
 2007-03-28  Jan-Oliver Wagner <jan-oliver.wagner at intevation.de>
 
 	* VERSION: Changed version number to 0.9.0 to not confuse with nessus
-		versioning and to make clear that for OpenVAS this is not yet stable.
+	versioning and to make clear that for OpenVAS this is not yet stable.

Modified: trunk/openvas-libraries/misc/openvas_auth.c
===================================================================
--- trunk/openvas-libraries/misc/openvas_auth.c	2011-09-21 13:46:10 UTC (rev 11648)
+++ trunk/openvas-libraries/misc/openvas_auth.c	2011-09-21 14:32:38 UTC (rev 11649)
@@ -934,6 +934,34 @@
 }
 
 /**
+ * @brief Check whether a user exists.
+ *
+ * @param[in]  name   User name.
+ *
+ * @return 1 yes, 0 no, -1 error.
+ */
+int
+openvas_user_exists (const char *name)
+{
+  gchar *user_dir;
+  struct stat state;
+  int err;
+
+  user_dir = g_build_filename (OPENVAS_USERS_DIR, name, NULL);
+  err = stat (user_dir, &state);
+  g_free (user_dir);
+  if (err)
+    switch (errno)
+      {
+        case ENOENT:
+          return 0;
+        default:
+          return -1;
+      }
+  return 1;
+}
+
+/**
  * @brief Return the UUID of a user from the OpenVAS user UUID file.
  *
  * If the user exists, ensure that the user has a UUID (create that file).

Modified: trunk/openvas-libraries/misc/openvas_auth.h
===================================================================
--- trunk/openvas-libraries/misc/openvas_auth.h	2011-09-21 13:46:10 UTC (rev 11648)
+++ trunk/openvas-libraries/misc/openvas_auth.h	2011-09-21 14:32:38 UTC (rev 11649)
@@ -45,6 +45,8 @@
 
 int openvas_authenticate_uuid (const gchar *, const gchar *, gchar ** uuid);
 
+int openvas_user_exists (const char *);
+
 gchar *openvas_user_uuid (const char *name);
 
 int openvas_is_user_admin (const gchar *);



More information about the Openvas-commits mailing list