summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-03 01:17:26 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-03 01:17:26 +0200
commit7f0d207d2c816e0a8cb2742b0a789911f7c99356 (patch)
tree148eea6477a079339c5ecfa1a03d7debe50fed17 /src/shared
parent8f6e22a1cafafb4e78e23c1998f23a997c1b294f (diff)
sd-bus: support connecting to remote hosts, directly into containers
systemctl -H root@foobar:waldi will now show a list of services running on container "waldi" on host "foobar", using "root" for authenticating at "foobar". Since entereing a container requires priviliges, this will only work correctly for root logins.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c15
-rw-r--r--src/shared/util.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 4ad3f203d7..3d875c72b3 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3975,6 +3975,21 @@ char* hostname_cleanup(char *s, bool lowercase) {
return s;
}
+bool machine_name_is_valid(const char *s) {
+
+ if (!hostname_is_valid(s))
+ return false;
+
+ /* Machine names should be useful hostnames, but also be
+ * useful in unit names, hence we enforce a stricter length
+ * limitation. */
+
+ if (strlen(s) > 64)
+ return false;
+
+ return true;
+}
+
int pipe_eof(int fd) {
struct pollfd pollfd = {
.fd = fd,
diff --git a/src/shared/util.h b/src/shared/util.h
index 6d3791be7f..e23069c016 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -515,6 +515,8 @@ bool plymouth_running(void);
bool hostname_is_valid(const char *s) _pure_;
char* hostname_cleanup(char *s, bool lowercase);
+bool machine_name_is_valid(const char *s) _pure_;
+
char* strshorten(char *s, size_t l);
int terminal_vhangup_fd(int fd);