summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-08 14:16:50 +0200
committerKarolin Seeger <kseeger@samba.org>2008-05-22 20:01:07 +0200
commitf2532ddb49a6efec1b2adff6dc93d6da039139e9 (patch)
tree1987025b46430ee133d73da746c0f251a25c1fc5 /source
parent83a8025d4d1ad431acdd37cc9d41df3072d82ad7 (diff)
downloadsamba-f2532ddb49a6efec1b2adff6dc93d6da039139e9.tar.gz
samba-f2532ddb49a6efec1b2adff6dc93d6da039139e9.tar.xz
samba-f2532ddb49a6efec1b2adff6dc93d6da039139e9.zip
util: add strip_hostname() to strip of leading '\\'.
Guenther (cherry picked from commit dbf96120d8b33e592bfd3e9df1777f1670e218be)
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 5f95bcc558f..0a32f0faa93 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;
+}