summaryrefslogtreecommitdiff
path: root/source3/lib/util_unistr.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-11-10 19:05:00 +0000
committerLuke Leighton <lkcl@samba.org>1998-11-10 19:05:00 +0000
commit1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c (patch)
tree1bf71664960c671d6447a085a5087ce13bb14fea /source3/lib/util_unistr.c
parent313d8ef27df81118b57f3d214db75be25e38b612 (diff)
downloadsamba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.tar.gz
samba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.tar.bz2
samba-1e1c2ec93c204e6fd3ebba6dfb11e4fbc136e10c.zip
rpcclient registry commands.
(This used to be commit 36fcb4a6e643a05d06a2a273d74318fee7f2c647)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r--source3/lib/util_unistr.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 2365090f24..49fb729267 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -119,6 +119,70 @@ char *unistr2_to_str(UNISTR2 *str)
}
/*******************************************************************
+Return a number stored in a buffer
+********************************************************************/
+uint32 buffer2_to_uint32(BUFFER2 *str)
+{
+ if (str->buf_len == 4)
+ {
+ return IVAL(str->buffer, 0);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+/*******************************************************************
+Return a ascii version of a NOTunicode string
+********************************************************************/
+char *buffer2_to_str(BUFFER2 *str)
+{
+ char *lbuf = lbufs[nexti];
+ char *p;
+ uint16 *buf = str->buffer;
+ int max_size = MIN(sizeof(str->buffer)-2, str->buf_len/2);
+
+ nexti = (nexti+1)%8;
+
+ for (p = lbuf; *buf && p-lbuf < max_size; p++, buf++)
+ {
+ *p = *buf;
+ }
+
+ *p = 0;
+ return lbuf;
+}
+
+/*******************************************************************
+Return a ascii version of a NOTunicode string
+********************************************************************/
+char *buffer2_to_multistr(BUFFER2 *str)
+{
+ char *lbuf = lbufs[nexti];
+ char *p;
+ uint16 *buf = str->buffer;
+ int max_size = MIN(sizeof(str->buffer)-2, str->buf_len/2);
+
+ nexti = (nexti+1)%8;
+
+ for (p = lbuf; p-lbuf < max_size; p++, buf++)
+ {
+ if (*buf == 0)
+ {
+ *p = ' ';
+ }
+ else
+ {
+ *p = *buf;
+ }
+ }
+
+ *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.