summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1997-10-29 19:05:34 +0000
committerLuke Leighton <lkcl@samba.org>1997-10-29 19:05:34 +0000
commit520878fd1f440a7313cedb4827bdc81454d94d20 (patch)
treec189025afdeb3d7d4bd3d20eabfbb2b36dbb5cc2 /source3/lib
parent26f5e4f25cdfe41d77662224ec942cfffbb5a6fe (diff)
downloadsamba-520878fd1f440a7313cedb4827bdc81454d94d20.tar.gz
samba-520878fd1f440a7313cedb4827bdc81454d94d20.tar.bz2
samba-520878fd1f440a7313cedb4827bdc81454d94d20.zip
ipc.c ntclientpipe.c:
response to Bind Acknowledgment needs a lookup table for the PIPE string (secondary address in RPC_HDR_BA structure). smbparse.c util.c : interesting problem, i think caused by us typecasting a uint16* buffer to char*. found on a SPARC. (This used to be commit 420408ee83902faa6cf871f26e93ad5efb483727)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 7f47cdbdb4..4d098013f2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4284,11 +4284,19 @@ char *unistrn2(uint16 *buf, int len)
static int nexti;
char *lbuf = lbufs[nexti];
char *p;
+
nexti = (nexti+1)%8;
+
+ DEBUG(10, ("unistrn2: "));
+
for (p = lbuf; *buf && p-lbuf < MAXUNI-2 && len > 0; len--, p++, buf++)
{
+ DEBUG(10, ("%4x ", *buf));
*p = *buf;
}
+
+ DEBUG(10,("\n"));
+
*p = 0;
return lbuf;
}
@@ -4304,16 +4312,55 @@ char *unistr2(uint16 *buf)
static int nexti;
char *lbuf = lbufs[nexti];
char *p;
+
nexti = (nexti+1)%8;
+
+ DEBUG(10, ("unistr2: "));
+
for (p = lbuf; *buf && p-lbuf < MAXUNI-2; p++, buf++)
{
+ DEBUG(10, ("%4x ", *buf));
*p = *buf;
}
+
+ DEBUG(10,("\n"));
+
*p = 0;
return lbuf;
}
/*******************************************************************
+create a null-terminated unicode string from a null-terminated ascii string.
+return number of unicode chars copied, excluding the null character.
+
+only handles ascii strings
+********************************************************************/
+#define MAXUNI 1024
+int struni2(uint16 *p, char *buf)
+{
+ int len = 0;
+
+ if (p == NULL) return 0;
+
+ DEBUG(10, ("struni2: "));
+
+ if (buf != NULL)
+ {
+ for (; *buf && len < MAXUNI-2; len++, p++, buf++)
+ {
+ DEBUG(10, ("%2x ", *buf));
+ *p = *buf;
+ }
+
+ DEBUG(10,("\n"));
+ }
+
+ *p = 0;
+
+ return len;
+}
+
+/*******************************************************************
Return a ascii version of a unicode string
Hack alert: uses fixed buffer(s) and only handles ascii strings
********************************************************************/