git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95c3721
)
util: add strip_hostname() to strip of leading '\\'.
author
Günther Deschner
<gd@samba.org>
Thu, 8 May 2008 12:16:50 +0000
(14:16 +0200)
committer
Günther Deschner
<gd@samba.org>
Mon, 26 May 2008 09:50:46 +0000
(11:50 +0200)
Guenther
(cherry picked from commit
dbf96120d8b33e592bfd3e9df1777f1670e218be
)
source/lib/util.c
patch
|
blob
|
history
diff --git
a/source/lib/util.c
b/source/lib/util.c
index 5f95bcc558ff38462f8003e5e2b0e25bac96e433..0a32f0faa9356a07372e1c703f302955a1aedca8 100644
(file)
--- 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;
+}