Greenbone Vulnerability Management Libraries: base/credentials.c Source File

Greenbone Vulnerability Management Libraries 23.1.2

credentials.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2010-2023 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
10
11#include "credentials.h"
12
13#include "strings.h" /* for gvm_append_text */
14
15#include <string.h>
16
17#undef G_LOG_DOMAIN
21#define G_LOG_DOMAIN "libgvm base"
22
30void
31free_credentials (credentials_t *credentials)
32{
33 g_free (credentials->username);
34 g_free (credentials->password);
35 g_free (credentials->uuid);
36 g_free (credentials->timezone);
37 g_free (credentials->role);
38 g_free (credentials->severity_class);
39 g_free (credentials->jwt);
40 memset (credentials, '\0', sizeof (*credentials));
41}
42
50void
51append_to_credentials_username (credentials_t *credentials, const char *text,
52 gsize length)
53{
54 gvm_append_text (&credentials->username, text, length);
55}
56
64void
65append_to_credentials_password (credentials_t *credentials, const char *text,
66 gsize length)
67{
68 gvm_append_text (&credentials->password, text, length);
69}
append_to_credentials_username
void append_to_credentials_username(credentials_t *credentials, const char *text, gsize length)
Append text to the username of a credential pair.
Definition credentials.c:51
append_to_credentials_password
void append_to_credentials_password(credentials_t *credentials, const char *text, gsize length)
Append text to the password of a credential pair.
Definition credentials.c:65
free_credentials
void free_credentials(credentials_t *credentials)
Free credentials.
Definition credentials.c:31
credentials.h
Credential pairs and triples.
gvm_append_text
void gvm_append_text(gchar **var, const gchar *string, gsize length)
Append a string of a known length to a string variable.
Definition strings.c:66
strings.h
String utilities.
credentials_t
A username password pair.
Definition credentials.h:20
credentials_t::role
gchar * role
Role of user.
Definition credentials.h:35
credentials_t::password
gchar * password
Password of user.
Definition credentials.h:23
credentials_t::jwt
gchar * jwt
Current JSON web token of user.
Definition credentials.h:41
credentials_t::timezone
gchar * timezone
Timezone of user.
Definition credentials.h:27
credentials_t::username
gchar * username
Login name of user.
Definition credentials.h:21
credentials_t::uuid
gchar * uuid
UUID of user.
Definition credentials.h:25
credentials_t::severity_class
gchar * severity_class
Severity Class setting of user.
Definition credentials.h:31