summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 2edf9cd875..d0bbf78bf3 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5847,3 +5847,17 @@ bool id128_is_valid(const char *s) {
return true;
}
+
+void parse_user_at_host(char *arg, char **user, char **host) {
+ assert(arg);
+ assert(user);
+ assert(host);
+
+ *host = strchr(arg, '@');
+ if (*host == NULL)
+ *host = arg;
+ else {
+ *host[0]++ = '\0';
+ *user = arg;
+ }
+}