]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
util: add strip_hostname() to strip of leading '\\'.
authorGünther Deschner <gd@samba.org>
Thu, 8 May 2008 12:16:50 +0000 (14:16 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 9 May 2008 12:59:19 +0000 (14:59 +0200)
Guenther
(This used to be commit dbf96120d8b33e592bfd3e9df1777f1670e218be)

source3/lib/util.c

index a137d7cd8b739d2f08b111e97b9d6b5166c0f66b..a6b436cc6a9e53af38cec478082c314a6ffd8bdd 100644 (file)
@@ -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;
+}