summaryrefslogtreecommitdiff
path: root/source3/lib
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
commite556dfbb932759f7159735cc7559bd6e89ec7d12 (patch)
tree749aa24faeedb165aba39488eb446f3376cc5241 /source3/lib
parente668cb45941b4cbe7dbcb5bb2e4de3fb1d3784de (diff)
downloadsamba-e556dfbb932759f7159735cc7559bd6e89ec7d12.tar.gz
samba-e556dfbb932759f7159735cc7559bd6e89ec7d12.tar.bz2
samba-e556dfbb932759f7159735cc7559bd6e89ec7d12.zip
util: add strip_hostname() to strip of leading '\\'.
Guenther (This used to be commit dbf96120d8b33e592bfd3e9df1777f1670e218be)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index a137d7cd8b..a6b436cc6a 100644
--- a/source3/lib/util.c
+++ b/source3/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;
+}