From 76f7105e27a28144a1e0bbd806aafd6d0567d828 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Thu, 22 Oct 2020 15:58:19 +0000 Subject: [PATCH] Feature: Added support for usernames and passwords in master's mountlist Closes: #2369 --- src/slave.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/slave.c b/src/slave.c index 4618b7cb..cb4a5f7f 100644 --- a/src/slave.c +++ b/src/slave.c @@ -839,6 +839,16 @@ static int update_from_master(ice_config_t *config) c->upstream_default.server = (char *)xmlCharStrdup(master); c->upstream_default.port = port; } + if (parsed_uri->user && strchr(parsed_uri->user, ':')) { + char *pw; + + c->upstream_default.username = (char *)xmlCharStrdup(parsed_uri->user); + pw = strchr(c->upstream_default.username, ':'); + if (pw) { + *(pw++) = 0; + c->upstream_default.password = (char *)xmlCharStrdup(pw); + } + } c->upstream_default.mount = (char *)xmlCharStrdup(parsed_uri->path); c->localmount = (char *)xmlCharStrdup(parsed_uri->path);