summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-08 14:16:50 +0200
committerGünther Deschner <gd@samba.org>2008-05-09 14:59:19 +0200
commitdbf96120d8b33e592bfd3e9df1777f1670e218be (patch)
tree61ed8fcc26ef58d3ecab284e7e381dc5ce36e683 /source
parenteb7fee6e2a00326c03aa013058247e06279a4930 (diff)
downloadsamba-dbf96120d8b33e592bfd3e9df1777f1670e218be.tar.gz
samba-dbf96120d8b33e592bfd3e9df1777f1670e218be.tar.xz
samba-dbf96120d8b33e592bfd3e9df1777f1670e218be.zip
util: add strip_hostname() to strip of leading '\\'.
Guenther
Diffstat (limited to 'source')
-rw-r--r--source/lib/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index a137d7cd8b7..a6b436cc6a9 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -3453,3 +3453,22 @@ bool is_valid_policy_hnd(const POLICY_HND *hnd)
return (memcmp(&tmp, hnd, sizeof(tmp)) != 0);
}
+/****************************************************************
+ strip off leading '\\' from a hostname
+****************************************************************/
+
+const char *strip_hostname(const char *s)
+{
+ if (!s) {
+ return NULL;
+ }
+
+ if (strlen_m(s) < 3) {
+ return s;
+ }
+
+ if (s[0] == '\\') s++;
+ if (s[0] == '\\') s++;
+
+ return s;
+}