summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-09-25 21:01:52 +0000
committerLuke Leighton <lkcl@samba.org>1998-09-25 21:01:52 +0000
commit66d5d73a5d75e88a77970f7b27687b8354ab2e80 (patch)
treeda1b7278847138fc219398238f7a895a1c7f7a82 /source3/lib/util.c
parent1631d3fba7b887a5de23241b39430ffb5e036803 (diff)
downloadsamba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.tar.gz
samba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.tar.bz2
samba-66d5d73a5d75e88a77970f7b27687b8354ab2e80.zip
added rpcclient program
(This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 0142c25052..8569881b3f 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -404,6 +404,46 @@ void putip(void *dest,void *src)
}
+#define TRUNCATE_NETBIOS_NAME 1
+
+/*******************************************************************
+ convert, possibly using a stupid microsoft-ism which has destroyed
+ the transport independence of netbios (for CIFS vendors that usually
+ use the Win95-type methods, not for NT to NT communication, which uses
+ DCE/RPC and therefore full-length unicode strings...) a dns name into
+ a netbios name.
+
+ the netbios name (NOT necessarily null-terminated) is truncated to 15
+ characters.
+
+ ******************************************************************/
+char *dns_to_netbios_name(char *dns_name)
+{
+ static char netbios_name[16];
+ int i;
+ StrnCpy(netbios_name, dns_name, 15);
+ netbios_name[15] = 0;
+
+#ifdef TRUNCATE_NETBIOS_NAME
+ /* ok. this is because of a stupid microsoft-ism. if the called host
+ name contains a '.', microsoft clients expect you to truncate the
+ netbios name up to and including the '.' this even applies, by
+ mistake, to workgroup (domain) names, which is _really_ daft.
+ */
+ for (i = 15; i >= 0; i--)
+ {
+ if (netbios_name[i] == '.')
+ {
+ netbios_name[i] = 0;
+ break;
+ }
+ }
+#endif /* TRUNCATE_NETBIOS_NAME */
+
+ return netbios_name;
+}
+
+
/****************************************************************************
interpret the weird netbios "name". Return the name type
****************************************************************************/