s3: More cleanup in winbindd_ads.c:query_user
[Samba.git] / source3 / rpc_parse / parse_misc.c
blobc000923b9e13f1aa3b89944e152bee695674bd37
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997.
7 * Copyright (C) Gerald (Jerry) Carter 2005
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include "includes.h"
25 #undef DBGC_CLASS
26 #define DBGC_CLASS DBGC_RPC_PARSE
28 /*******************************************************************
29 Reads or writes an NTTIME structure.
30 ********************************************************************/
32 bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
34 uint32 low, high;
35 if (nttime == NULL)
36 return False;
38 prs_debug(ps, depth, desc, "smb_io_time");
39 depth++;
41 if(!prs_align(ps))
42 return False;
44 if (MARSHALLING(ps)) {
45 low = *nttime & 0xFFFFFFFF;
46 high = *nttime >> 32;
49 if(!prs_uint32("low ", ps, depth, &low)) /* low part */
50 return False;
51 if(!prs_uint32("high", ps, depth, &high)) /* high part */
52 return False;
54 if (UNMARSHALLING(ps)) {
55 *nttime = (((uint64_t)high << 32) + low);
58 return True;
61 /*******************************************************************
62 Reads or writes a struct GUID
63 ********************************************************************/
65 bool smb_io_uuid(const char *desc, struct GUID *uuid,
66 prs_struct *ps, int depth)
68 if (uuid == NULL)
69 return False;
71 prs_debug(ps, depth, desc, "smb_io_uuid");
72 depth++;
74 if(!prs_uint32 ("data ", ps, depth, &uuid->time_low))
75 return False;
76 if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid))
77 return False;
78 if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version))
79 return False;
81 if(!prs_uint8s (False, "data ", ps, depth, uuid->clock_seq, sizeof(uuid->clock_seq)))
82 return False;
83 if(!prs_uint8s (False, "data ", ps, depth, uuid->node, sizeof(uuid->node)))
84 return False;
86 return True;