|
Greenbone Vulnerability Manager 22.5.2
|
GVM management layer: Ticket SQL. More...
#include "manage_tickets.h"#include "manage_acl.h"#include "manage_sql_tickets.h"#include "manage_sql.h"#include "sql.h"#include <stdlib.h>#include <string.h>Macros | |
| #define | G_LOG_DOMAIN "md manage" |
| GLib log domain. | |
| #define | TICKET_ITERATOR_FILTER_COLUMNS |
| Filter columns for ticket iterator. | |
| #define | TICKET_ITERATOR_COLUMNS |
| Ticket iterator columns. | |
| #define | TICKET_ITERATOR_TRASH_COLUMNS |
| Ticket iterator columns for trash case. | |
Enumerations | |
| enum | ticket_status_t { TICKET_STATUS_OPEN = 0 , TICKET_STATUS_FIXED = 1 , TICKET_STATUS_FIX_VERIFIED = 2 , TICKET_STATUS_CLOSED = 3 , TICKET_STATUS_MAX , TICKET_STATUS_ERROR = 100 } |
| Ticket statuses. | |
Functions | |
| static ticket_status_t | ticket_status_integer (const char *status) |
| Get ticket status DB identifier from string. | |
| int | ticket_count (const get_data_t *get) |
| Count number of tickets. | |
| int | init_ticket_iterator (iterator_t *iterator, const get_data_t *get) |
| Initialise a ticket iterator. | |
| double | ticket_iterator_severity (iterator_t *iterator) |
| Get a column value from a ticket iterator. | |
| int | ticket_iterator_orphan (iterator_t *iterator) |
| Get column value from a ticket iterator. | |
| int | init_ticket_result_iterator (iterator_t *iterator, const gchar *ticket_id, int trash) |
| Initialise a ticket result iterator. | |
| int | init_result_ticket_iterator (iterator_t *iterator, result_t result) |
| Initialise a result ticket iterator. | |
| user_t | ticket_owner (ticket_t ticket) |
| Return owner of ticket. | |
| user_t | ticket_assigned_to (ticket_t ticket) |
| Return user that ticket is assigned to. | |
| gchar * | ticket_nvt_name (ticket_t ticket) |
| Return NVT name of ticket. | |
| static task_t | ticket_task (ticket_t ticket) |
| Return task of ticket. | |
| int | ticket_in_use (ticket_t ticket) |
| Return whether a ticket is in use. | |
| int | trash_ticket_in_use (ticket_t ticket) |
| Return whether a trashcan ticket is in use. | |
| int | ticket_writable (ticket_t ticket) |
| Return whether a ticket is writable. | |
| int | trash_ticket_writable (ticket_t ticket) |
| Return whether a trashcan ticket is writable. | |
| int | delete_ticket (const char *ticket_id, int ultimate) |
| Delete a ticket. | |
| int | restore_ticket (const char *ticket_id) |
| Try restore a ticket. | |
| int | create_ticket (const char *comment, const char *result_id, const char *user_id, const char *open_note, ticket_t *ticket) |
| Create a ticket. | |
| int | copy_ticket (const char *comment, const char *ticket_id, ticket_t *new_ticket) |
| Create a ticket from an existing ticket. | |
| char * | ticket_uuid (ticket_t ticket) |
| Return the UUID of a ticket. | |
| static int | set_note (ticket_t ticket, const gchar *name, const gchar *note) |
| Set a note on a ticket. | |
| int | modify_ticket (const gchar *ticket_id, const gchar *comment, const gchar *status_name, const gchar *open_note, const gchar *fixed_note, const gchar *closed_note, const gchar *user_id) |
| Modify a ticket. | |
| void | empty_trashcan_tickets () |
| Empty ticket trashcans. | |
| void | check_tickets (task_t task) |
| Check if tickets have been resolved. | |
| void | delete_tickets_user (user_t user) |
| Delete all tickets owner by a user. | |
| void | inherit_tickets (user_t user, user_t inheritor) |
| Change ownership of tickets, for user deletion. | |
| void | tickets_remove_task (task_t task) |
| Remove a task from all tickets. | |
| void | tickets_remove_report (report_t report) |
| Remove a report from all tickets. | |
| void | tickets_remove_tasks_user (user_t user) |
| Remove all of a user's tasks from all tickets. | |
| void | tickets_trash_task (task_t task) |
| Adjust tickets for task being moved to trash. | |
| void | tickets_restore_task (task_t task) |
| Adjust tickets for task being restored. | |
GVM management layer: Ticket SQL.
The Ticket SQL for the GVM management layer.
| #define TICKET_ITERATOR_FILTER_COLUMNS |
Filter columns for ticket iterator.
| void check_tickets | ( | task_t | task | ) |
Check if tickets have been resolved.
| [in] | task | Task. |
| int copy_ticket | ( | const char * | comment, |
| const char * | ticket_id, | ||
| ticket_t * | new_ticket | ||
| ) |
Create a ticket from an existing ticket.
| [in] | comment | Comment on new ticket. NULL to copy from existing. |
| [in] | ticket_id | UUID of existing ticket. |
| [out] | new_ticket | New ticket. |
| int create_ticket | ( | const char * | comment, |
| const char * | result_id, | ||
| const char * | user_id, | ||
| const char * | open_note, | ||
| ticket_t * | ticket | ||
| ) |
Create a ticket.
| [in] | comment | Comment on ticket. |
| [in] | result_id | Result that the ticket is on. |
| [in] | user_id | User the ticket is assigned to. |
| [in] | open_note | Note on open status. |
| [out] | ticket | Created ticket. |
| int delete_ticket | ( | const char * | ticket_id, |
| int | ultimate | ||
| ) |
Delete a ticket.
| [in] | ticket_id | UUID of ticket. |
| [in] | ultimate | Whether to remove entirely, or to trashcan. |
| void delete_tickets_user | ( | user_t | user | ) |
Delete all tickets owner by a user.
Also delete trash tickets and assign any tickets that were assigned to the user back to the owner.
| [in] | user | The user. |
| void inherit_tickets | ( | user_t | user, |
| user_t | inheritor | ||
| ) |
Change ownership of tickets, for user deletion.
Also assign tickets that are assigned to the user to the inheritor.
| [in] | user | Current owner. |
| [in] | inheritor | New owner. |
| int init_result_ticket_iterator | ( | iterator_t * | iterator, |
| result_t | result | ||
| ) |
Initialise a result ticket iterator.
Will iterate over all the tickets that apply to the result's NVT.
| [in] | iterator | Iterator. |
| [in] | result | Result. |
| int init_ticket_iterator | ( | iterator_t * | iterator, |
| const get_data_t * | get | ||
| ) |
Initialise a ticket iterator.
| [in] | iterator | Iterator. |
| [in] | get | GET data. |
| int init_ticket_result_iterator | ( | iterator_t * | iterator, |
| const gchar * | ticket_id, | ||
| int | trash | ||
| ) |
Initialise a ticket result iterator.
Will iterate over all the results assigned to the ticket.
| [in] | iterator | Iterator. |
| [in] | ticket_id | UUID of ticket. |
| [in] | trash | Whether ticket is in trash. |
| int modify_ticket | ( | const gchar * | ticket_id, |
| const gchar * | comment, | ||
| const gchar * | status_name, | ||
| const gchar * | open_note, | ||
| const gchar * | fixed_note, | ||
| const gchar * | closed_note, | ||
| const gchar * | user_id | ||
| ) |
Modify a ticket.
| [in] | ticket_id | UUID of ticket. |
| [in] | comment | Comment on ticket. |
| [in] | status_name | Status of ticket. |
| [in] | open_note | Note if status is 'Open'. |
| [in] | fixed_note | Note if status is 'Fixed'. |
| [in] | closed_note | Note if status is 'Closed'. |
| [in] | user_id | UUID of user that ticket is assigned to. |
| int restore_ticket | ( | const char * | ticket_id | ) |
Try restore a ticket.
If success, ends transaction for caller before exiting.
| [in] | ticket_id | UUID of resource. |
|
static |
Set a note on a ticket.
| [in] | ticket | Ticket. |
| [in] | name | Name of note column. |
| [in] | note | Note text. |
| user_t ticket_assigned_to | ( | ticket_t | ticket | ) |
Return user that ticket is assigned to.
| [in] | ticket | Ticket. |
| int ticket_count | ( | const get_data_t * | get | ) |
Count number of tickets.
| [in] | get | GET params. |
| int ticket_in_use | ( | ticket_t | ticket | ) |
Return whether a ticket is in use.
| [in] | ticket | Ticket. |
| int ticket_iterator_orphan | ( | iterator_t * | iterator | ) |
Get column value from a ticket iterator.
| [in] | iterator | Iterator. |
| double ticket_iterator_severity | ( | iterator_t * | iterator | ) |
Get a column value from a ticket iterator.
| [in] | iterator | Iterator. |
| gchar * ticket_nvt_name | ( | ticket_t | ticket | ) |
Return NVT name of ticket.
| [in] | ticket | Ticket. |
| user_t ticket_owner | ( | ticket_t | ticket | ) |
Return owner of ticket.
| [in] | ticket | Ticket. |
|
static |
Get ticket status DB identifier from string.
| [in] | status | Status name. |
|
static |
Return task of ticket.
| [in] | ticket | Ticket. |
| char * ticket_uuid | ( | ticket_t | ticket | ) |
Return the UUID of a ticket.
| [in] | ticket | Ticket. |
| int ticket_writable | ( | ticket_t | ticket | ) |
Return whether a ticket is writable.
| [in] | ticket | Ticket. |
| void tickets_remove_report | ( | report_t | report | ) |
Remove a report from all tickets.
| [in] | report | Report. |
| void tickets_remove_task | ( | task_t | task | ) |
Remove a task from all tickets.
| [in] | task | Task. |
| void tickets_remove_tasks_user | ( | user_t | user | ) |
Remove all of a user's tasks from all tickets.
| [in] | user | User. |
| void tickets_restore_task | ( | task_t | task | ) |
Adjust tickets for task being restored.
This must be called while the old and new results still exist.
| [in] | task | Task. |
| void tickets_trash_task | ( | task_t | task | ) |
Adjust tickets for task being moved to trash.
This must be called while the old and new results still exist.
| [in] | task | Task. |
| int trash_ticket_in_use | ( | ticket_t | ticket | ) |
Return whether a trashcan ticket is in use.
| [in] | ticket | Ticket. |
| int trash_ticket_writable | ( | ticket_t | ticket | ) |
Return whether a trashcan ticket is writable.
| [in] | ticket | Ticket. |