From e800a2b7d2ff74f3d0934fe9d20e4fcb717dd987 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Fri, 14 Jun 2019 09:45:48 +0200 Subject: [PATCH] Add support OpenNebula's USERNAME --- agent/opennebula.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/agent/opennebula.c b/agent/opennebula.c index 74c3fb9..a185f3d 100644 --- a/agent/opennebula.c +++ b/agent/opennebula.c @@ -35,7 +35,7 @@ opennebula(struct system_config *sc) const char *delim = "\\\\\0", *errstr; char *line = NULL, *k, *v, *p, q; char *value = NULL, *next = NULL, *last; - char *hname = NULL; + char *hname = NULL, *uname = NULL; size_t len, lineno = 0, i; int ret = -1; unsigned short unit; @@ -241,6 +241,13 @@ opennebula(struct system_config *sc) /* We will detect and decode base64 later */ if ((sc->sc_userdata = strdup(v)) == NULL) log_warnx("failed to set userdata"); + } else if (strcasecmp("USERNAME", k) == 0) { + if ((uname = strdup(v)) == NULL) + log_warnx("failed to set username"); + else { + free(sc->sc_username); + sc->sc_username = uname; + } } free(line);