[Openvas-commits] r5360 - in trunk/openvas-libraries: . omp
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Oct 3 12:36:55 CEST 2009
Author: mattm
Date: 2009-10-03 12:36:51 +0200 (Sat, 03 Oct 2009)
New Revision: 5360
Modified:
trunk/openvas-libraries/ChangeLog
trunk/openvas-libraries/omp/omp.c
trunk/openvas-libraries/omp/omp.h
Log:
* omp.c (omp_get_preferences_503): New function.
* omp.h (omp_get_preferences_503): New header.
Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog 2009-10-03 10:15:27 UTC (rev 5359)
+++ trunk/openvas-libraries/ChangeLog 2009-10-03 10:36:51 UTC (rev 5360)
@@ -1,3 +1,8 @@
+2009-10-03 Matthew Mundell <matthew.mundell at intevation.de>
+
+ * omp.c (omp_get_preferences_503): New function.
+ * omp.h (omp_get_preferences_503): New header.
+
2009-09-30 Matthew Mundell <matthew.mundell at intevation.de>
* nasl/openvas_logging.c (openvas_log_func): Pass the correct variable to
Modified: trunk/openvas-libraries/omp/omp.c
===================================================================
--- trunk/openvas-libraries/omp/omp.c 2009-10-03 10:15:27 UTC (rev 5359)
+++ trunk/openvas-libraries/omp/omp.c 2009-10-03 10:36:51 UTC (rev 5360)
@@ -989,6 +989,50 @@
}
/**
+ * @brief Get the manager preferences, waiting for them to appear.
+ *
+ * @param[in] session Pointer to GNUTLS session.
+ * @param[out] response On success contains GET_PREFERENCES response.
+ *
+ * @return 0 on success, -1 or OMP response code on error.
+ */
+int
+omp_get_preferences_503 (gnutls_session_t* session, entity_t* response)
+{
+ while (1)
+ {
+ const char* status;
+
+ if (openvas_server_send (session, "<get_preferences/>"))
+ return -1;
+
+ *response = NULL;
+ if (read_entity (session, response)) return -1;
+
+ status = entity_attribute (*response, "status");
+ if (status == NULL)
+ {
+ free_entity (*response);
+ return -1;
+ }
+ if (strlen (status) == 0)
+ {
+ free_entity (*response);
+ return -1;
+ }
+ char first = status[0];
+ if (first == '2') return 0;
+ if (strlen (status) == 3 && strcmp (status, "503") == 0)
+ {
+ sleep (0.5);
+ continue;
+ }
+ free_entity (*response);
+ return -1;
+ }
+}
+
+/**
* @brief Get the manager certificates.
*
* @param[in] session Pointer to GNUTLS session.
Modified: trunk/openvas-libraries/omp/omp.h
===================================================================
--- trunk/openvas-libraries/omp/omp.h 2009-10-03 10:15:27 UTC (rev 5359)
+++ trunk/openvas-libraries/omp/omp.h 2009-10-03 10:36:51 UTC (rev 5360)
@@ -86,6 +86,9 @@
omp_get_preferences (gnutls_session_t*, entity_t*);
int
+omp_get_preferences_503 (gnutls_session_t*, entity_t*);
+
+int
omp_get_certificates (gnutls_session_t*, entity_t*);
int
More information about the Openvas-commits
mailing list