2000-05-09 17:28:19 +04:00
# define OLD_NTDOMAIN 1
1998-03-12 00:11:04 +03:00
/*
* Unix SMB / Netbios implementation .
* Version 1.9 .
* RPC Pipe client / server routines
1999-12-13 16:27:58 +03:00
* Copyright ( C ) Andrew Tridgell 1992 - 1997 ,
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997 ,
* Copyright ( C ) Paul Ashton 1997.
1998-03-12 00:11:04 +03:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# include "includes.h"
extern int DEBUGLEVEL ;
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_CLOSE_HND structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_close_hnd ( SAMR_Q_CLOSE_HND * q_c , POLICY_HND * hnd )
{
DEBUG ( 5 , ( " init_samr_q_close_hnd \n " ) ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_c - > pol , hnd , sizeof ( q_c - > pol ) ) ;
1998-09-26 02:20:05 +04:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_close_hnd ( char * desc , SAMR_Q_CLOSE_HND * q_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_close_hnd " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_close_hnd ( char * desc , SAMR_R_CLOSE_HND * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_close_hnd " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & r_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1999-02-24 04:52:30 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_open_domain ( SAMR_Q_OPEN_DOMAIN * q_u ,
POLICY_HND * connect_pol , uint32 rid ,
DOM_SID * sid )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " samr_init_q_open_domain \n " ) ) ;
1998-09-26 02:20:05 +04:00
memcpy ( & q_u - > connect_pol , connect_pol , sizeof ( q_u - > connect_pol ) ) ;
1999-12-13 16:27:58 +03:00
q_u - > rid = rid ;
init_dom_sid2 ( & q_u - > dom_sid , sid ) ;
1998-09-26 02:20:05 +04:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_open_domain ( char * desc , SAMR_Q_OPEN_DOMAIN * q_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_open_domain " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " connect_pol " , & q_u - > connect_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " rid " , ps , depth , & q_u - > rid ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_dom_sid2 ( " sid " , & q_u - > dom_sid , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_open_domain ( char * desc , SAMR_R_OPEN_DOMAIN * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_open_domain " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " domain_pol " , & r_u - > domain_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-10-22 01:11:16 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_2c ( SAMR_Q_UNKNOWN_2C * q_u , POLICY_HND * user_pol )
{
DEBUG ( 5 , ( " samr_init_q_unknown_2c \n " ) ) ;
1998-10-22 01:11:16 +04:00
memcpy ( & q_u - > user_pol , user_pol , sizeof ( q_u - > user_pol ) ) ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_unknown_2c ( char * desc , SAMR_Q_UNKNOWN_2C * q_u , prs_struct * ps , int depth )
1998-10-22 01:11:16 +04:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-10-22 01:11:16 +04:00
prs_debug ( ps , depth , desc , " samr_io_q_unknown_2c " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " user_pol " , & q_u - > user_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-10-22 01:11:16 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_unknown_2c ( SAMR_R_UNKNOWN_2C * q_u , uint32 status )
{
DEBUG ( 5 , ( " samr_init_r_unknown_2c \n " ) ) ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
q_u - > unknown_0 = 0x00160000 ;
1998-10-22 01:11:16 +04:00
q_u - > unknown_1 = 0x00000000 ;
q_u - > status = status ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_unknown_2c ( char * desc , SAMR_R_UNKNOWN_2C * r_u , prs_struct * ps , int depth )
1998-10-22 01:11:16 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-10-22 01:11:16 +04:00
prs_debug ( ps , depth , desc , " samr_io_r_unknown_2c " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & r_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " unknown_1 " , ps , depth , & r_u - > unknown_1 ) )
return False ;
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-10-22 01:11:16 +04:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_UNKNOWN_3 structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_3 ( SAMR_Q_UNKNOWN_3 * q_u ,
1998-09-26 02:20:05 +04:00
POLICY_HND * user_pol , uint16 switch_value )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " samr_init_q_unknown_3 \n " ) ) ;
1998-09-26 02:20:05 +04:00
memcpy ( & q_u - > user_pol , user_pol , sizeof ( q_u - > user_pol ) ) ;
q_u - > switch_value = switch_value ;
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_unknown_3 ( char * desc , SAMR_Q_UNKNOWN_3 * q_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_unknown_3 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " user_pol " , & q_u - > user_pol , ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint16 ( " switch_value " , ps , depth , & q_u - > switch_value ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_QUERY_DOMAIN_INFO structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_query_dom_info ( SAMR_Q_QUERY_DOMAIN_INFO * q_u ,
1998-09-26 02:20:05 +04:00
POLICY_HND * domain_pol , uint16 switch_value )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_q_query_dom_info \n " ) ) ;
1998-09-26 02:20:05 +04:00
memcpy ( & q_u - > domain_pol , domain_pol , sizeof ( q_u - > domain_pol ) ) ;
q_u - > switch_value = switch_value ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_query_dom_info ( char * desc , SAMR_Q_QUERY_DOMAIN_INFO * q_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
1998-10-22 02:36:26 +04:00
prs_debug ( ps , depth , desc , " samr_io_q_query_dom_info " ) ;
1998-09-26 02:20:05 +04:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " domain_pol " , & q_u - > domain_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-08 03:25:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " switch_value " , ps , depth , & q_u - > switch_value ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-08 03:25:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a structure .
1998-12-08 03:25:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_unk_info2 ( SAM_UNK_INFO_2 * u_2 , char * domain , char * server )
1998-10-22 01:11:16 +04:00
{
int len_domain = strlen ( domain ) ;
int len_server = strlen ( server ) ;
u_2 - > unknown_0 = 0x00000000 ;
u_2 - > unknown_1 = 0x80000000 ;
u_2 - > unknown_2 = 0x00000000 ;
u_2 - > ptr_0 = 1 ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & u_2 - > hdr_domain , len_domain ) ;
init_uni_hdr ( & u_2 - > hdr_server , len_server ) ;
1998-10-22 01:11:16 +04:00
1998-10-22 02:36:26 +04:00
u_2 - > seq_num = 0x10000000 ;
u_2 - > unknown_3 = 0x00000000 ;
1998-10-22 01:11:16 +04:00
1998-10-22 02:36:26 +04:00
u_2 - > unknown_4 = 0x00000001 ;
u_2 - > unknown_5 = 0x00000003 ;
1998-10-22 01:11:16 +04:00
u_2 - > unknown_6 = 0x00000001 ;
1999-12-13 16:27:58 +03:00
u_2 - > num_domain_usrs = 0x00000008 ;
u_2 - > num_domain_grps = 0x00000003 ;
u_2 - > num_local_grps = 0x00000003 ;
1998-10-22 01:11:16 +04:00
1998-10-22 02:36:26 +04:00
memset ( u_2 - > padding , 0 , sizeof ( u_2 - > padding ) ) ; /* 12 bytes zeros */
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
init_unistr2 ( & u_2 - > uni_domain , domain , len_domain ) ;
init_unistr2 ( & u_2 - > uni_server , server , len_server ) ;
1998-10-22 01:11:16 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL sam_io_unk_info2 ( char * desc , SAM_UNK_INFO_2 * u_2 , prs_struct * ps , int depth )
1998-10-22 01:11:16 +04:00
{
1999-12-13 16:27:58 +03:00
if ( u_2 = = NULL )
return False ;
1998-10-22 01:11:16 +04:00
prs_debug ( ps , depth , desc , " sam_io_unk_info2 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & u_2 - > unknown_0 ) ) /* 0x0000 0000 */
return False ;
if ( ! prs_uint32 ( " unknown_1 " , ps , depth , & u_2 - > unknown_1 ) ) /* 0x8000 0000 */
return False ;
if ( ! prs_uint32 ( " unknown_2 " , ps , depth , & u_2 - > unknown_2 ) ) /* 0x0000 0000 */
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_0 " , ps , depth , & u_2 - > ptr_0 ) ) /* pointer to unknown structure */
return False ;
if ( ! smb_io_unihdr ( " hdr_domain " , & u_2 - > hdr_domain , ps , depth ) ) /* domain name unicode header */
return False ;
if ( ! smb_io_unihdr ( " hdr_server " , & u_2 - > hdr_server , ps , depth ) ) /* server name unicode header */
return False ;
1998-10-22 01:11:16 +04:00
/* put all the data in here, at the moment, including what the above
pointer is referring to
*/
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " seq_num " , ps , depth , & u_2 - > seq_num ) ) /* 0x0000 0099 or 0x1000 0000 */
return False ;
if ( ! prs_uint32 ( " unknown_3 " , ps , depth , & u_2 - > unknown_3 ) ) /* 0x0000 0000 */
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_4 " , ps , depth , & u_2 - > unknown_4 ) ) /* 0x0000 0001 */
return False ;
if ( ! prs_uint32 ( " unknown_5 " , ps , depth , & u_2 - > unknown_5 ) ) /* 0x0000 0003 */
return False ;
if ( ! prs_uint32 ( " unknown_6 " , ps , depth , & u_2 - > unknown_6 ) ) /* 0x0000 0001 */
return False ;
if ( ! prs_uint32 ( " num_domain_usrs " , ps , depth , & u_2 - > num_domain_usrs ) ) /* 0x0000 0008 */
return False ;
if ( ! prs_uint32 ( " num_domain_grps " , ps , depth , & u_2 - > num_domain_grps ) ) /* 0x0000 0003 */
return False ;
if ( ! prs_uint32 ( " num_local_grps " , ps , depth , & u_2 - > num_local_grps ) ) /* 0x0000 0003 */
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint8s ( False , " padding " , ps , depth , u_2 - > padding , sizeof ( u_2 - > padding ) ) ) /* 12 bytes zeros */
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unistr2 ( " uni_domain " , & u_2 - > uni_domain , u_2 - > hdr_domain . buffer , ps , depth ) ) /* domain name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_server " , & u_2 - > uni_server , u_2 - > hdr_server . buffer , ps , depth ) ) /* server name unicode string */
return False ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1999-03-25 16:54:31 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_QUERY_DOMAIN_INFO structure .
1999-03-25 16:54:31 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_query_dom_info ( SAMR_R_QUERY_DOMAIN_INFO * r_u ,
1998-10-22 01:11:16 +04:00
uint16 switch_value , SAM_UNK_CTR * ctr ,
uint32 status )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_query_dom_info \n " ) ) ;
1998-10-22 01:11:16 +04:00
r_u - > ptr_0 = 0 ;
r_u - > switch_value = 0 ;
r_u - > status = status ; /* return status */
1999-12-13 16:27:58 +03:00
if ( status = = 0 ) {
1998-10-22 01:11:16 +04:00
r_u - > switch_value = switch_value ;
r_u - > ptr_0 = 1 ;
r_u - > ctr = ctr ;
}
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-22 01:11:16 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_query_dom_info ( char * desc , SAMR_R_QUERY_DOMAIN_INFO * r_u , prs_struct * ps , int depth )
1998-10-22 01:11:16 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-10-22 01:11:16 +04:00
1998-10-22 02:36:26 +04:00
prs_debug ( ps , depth , desc , " samr_io_r_query_dom_info " ) ;
1998-10-22 01:11:16 +04:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-10-22 01:11:16 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_0 " , ps , depth , & r_u - > ptr_0 ) )
return False ;
if ( ! prs_uint16 ( " switch_value " , ps , depth , & r_u - > switch_value ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-01 22:44:33 +04:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_0 ! = 0 & & r_u - > ctr ! = NULL ) {
switch ( r_u - > switch_value ) {
case 0x02 :
if ( ! sam_io_unk_info2 ( " unk_inf2 " , & r_u - > ctr - > info . inf2 , ps , depth ) )
1999-10-15 22:46:22 +04:00
return False ;
1999-12-13 16:27:58 +03:00
break ;
default :
DEBUG ( 3 , ( " samr_io_r_query_dom_info: unknown switch level 0x%x \n " ,
r_u - > switch_value ) ) ;
return False ;
1998-10-22 01:11:16 +04:00
}
}
1999-03-29 21:24:46 +04:00
1999-10-15 22:46:22 +04:00
return True ;
1998-10-22 01:11:16 +04:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a DOM_SID3 structure .
Calculate length by adding up the size of the components .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_dom_sid3 ( DOM_SID3 * sid3 , uint16 unk_0 , uint16 unk_1 , DOM_SID * sid )
{
sid3 - > sid = * sid ;
1998-03-12 00:11:04 +03:00
sid3 - > len = 2 + 8 + sid3 - > sid . num_auths * 4 ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_SID3 structure .
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
this one ' s odd , because the length ( in bytes ) is specified at the beginning .
the length _includes_ the length of the length , too : - )
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_dom_sid3 ( char * desc , DOM_SID3 * sid3 , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sid3 = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_dom_sid3 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " len " , ps , depth , & sid3 - > len ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_dom_sid ( " " , & sid3 - > sid , ps , depth ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_UNKNOWN3 structure .
1998-03-12 00:11:04 +03:00
unknown_2 : 0x0001
unknown_3 : 0x8004
unknown_4 , 5 : 0x0000 0014
unknown_6 : 0x0002
unknown_7 : 0x5800 or 0x0070
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static void init_sam_sid_stuff ( SAM_SID_STUFF * stf ,
1998-03-12 00:11:04 +03:00
uint16 unknown_2 , uint16 unknown_3 ,
uint32 unknown_4 , uint16 unknown_6 , uint16 unknown_7 ,
int num_sid3s , DOM_SID3 sid3 [ MAX_SAM_SIDS ] )
{
stf - > unknown_2 = unknown_2 ;
stf - > unknown_3 = unknown_3 ;
1999-12-13 16:27:58 +03:00
memset ( ( char * ) stf - > padding1 , ' \0 ' , sizeof ( stf - > padding1 ) ) ;
1998-03-12 00:11:04 +03:00
stf - > unknown_4 = unknown_4 ;
stf - > unknown_5 = unknown_4 ;
stf - > unknown_6 = unknown_6 ;
stf - > unknown_7 = unknown_7 ;
stf - > num_sids = num_sid3s ;
stf - > padding2 = 0x0000 ;
memcpy ( stf - > sid , sid3 , sizeof ( DOM_SID3 ) * num_sid3s ) ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_SID_STUFF structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sid_stuff ( char * desc , SAM_SID_STUFF * stf , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( stf = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_sid_stuff \n " ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " unknown_2 " , ps , depth , & stf - > unknown_2 ) )
return False ;
if ( ! prs_uint16 ( " unknown_3 " , ps , depth , & stf - > unknown_3 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint8s ( False , " padding1 " , ps , depth , stf - > padding1 , sizeof ( stf - > padding1 ) ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_4 " , ps , depth , & stf - > unknown_4 ) )
return False ;
if ( ! prs_uint32 ( " unknown_5 " , ps , depth , & stf - > unknown_5 ) )
return False ;
if ( ! prs_uint16 ( " unknown_6 " , ps , depth , & stf - > unknown_6 ) )
return False ;
if ( ! prs_uint16 ( " unknown_7 " , ps , depth , & stf - > unknown_7 ) )
return False ;
if ( ! prs_uint32 ( " num_sids " , ps , depth , & stf - > num_sids ) )
return False ;
if ( ! prs_uint16 ( " padding2 " , ps , depth , & stf - > padding2 ) )
return False ;
1998-03-12 00:11:04 +03:00
1998-08-25 01:49:10 +04:00
SMB_ASSERT_ARRAY ( stf - > sid , stf - > num_sids ) ;
1998-08-22 06:54:21 +04:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < stf - > num_sids ; i + + ) {
if ( ! sam_io_dom_sid3 ( " " , & ( stf - > sid [ i ] ) , ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits or writes a SAMR_R_UNKNOWN3 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_unknown_3 ( SAMR_R_UNKNOWN_3 * r_u ,
1998-03-12 00:11:04 +03:00
uint16 unknown_2 , uint16 unknown_3 ,
uint32 unknown_4 , uint16 unknown_6 , uint16 unknown_7 ,
int num_sid3s , DOM_SID3 sid3 [ MAX_SAM_SIDS ] ,
uint32 status )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " samr_init_r_unknown_3 \n " ) ) ;
1998-03-12 00:11:04 +03:00
r_u - > ptr_0 = 0 ;
r_u - > ptr_1 = 0 ;
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
1998-03-12 00:11:04 +03:00
r_u - > ptr_0 = 1 ;
r_u - > ptr_1 = 1 ;
1999-12-13 16:27:58 +03:00
init_sam_sid_stuff ( & ( r_u - > sid_stuff ) , unknown_2 , unknown_3 ,
1998-03-12 00:11:04 +03:00
unknown_4 , unknown_6 , unknown_7 ,
num_sid3s , sid3 ) ;
}
r_u - > status = status ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAMR_R_UNKNOWN_3 structure .
1998-03-12 00:11:04 +03:00
this one ' s odd , because the daft buggers use a different mechanism
for writing out the array of sids . they put the number of sids in
only one place : they ' ve calculated the length of each sid and jumped
by that amount . then , retrospectively , the length of the whole buffer
is put at the beginning of the data stream .
wierd .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_unknown_3 ( char * desc , SAMR_R_UNKNOWN_3 * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1998-05-13 09:07:55 +04:00
int ptr_len0 = 0 ;
int ptr_len1 = 0 ;
1998-03-12 00:11:04 +03:00
int ptr_sid_stuff = 0 ;
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_unknown_3 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_0 " , ps , depth , & r_u - > ptr_0 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ps - > io ) {
1998-03-12 00:11:04 +03:00
/* reading. do the length later */
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " sid_stuff_len0 " , ps , depth , & r_u - > sid_stuff_len0 ) )
return False ;
} else {
1998-03-12 00:11:04 +03:00
/* storing */
1999-12-13 16:27:58 +03:00
ptr_len0 = prs_offset ( ps ) ;
if ( ! prs_set_offset ( ps , ptr_len0 + 4 ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_0 ! = 0 ) {
if ( ! prs_uint32 ( " ptr_1 " , ps , depth , & r_u - > ptr_1 ) )
return False ;
if ( ps - > io ) {
1998-03-12 00:11:04 +03:00
/* reading. do the length later */
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " sid_stuff_len1 " , ps , depth , & r_u - > sid_stuff_len1 ) )
return False ;
} else {
1998-03-12 00:11:04 +03:00
/* storing */
1999-12-13 16:27:58 +03:00
ptr_len1 = prs_offset ( ps ) ;
if ( ! prs_set_offset ( ps , ptr_len1 + 4 ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_1 ! = 0 ) {
ptr_sid_stuff = prs_offset ( ps ) ;
if ( ! sam_io_sid_stuff ( " " , & r_u - > sid_stuff , ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
}
}
1999-12-13 16:27:58 +03:00
if ( ! ( ps - > io ) ) {
/* storing not reading. do the length, now. */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ptr_sid_stuff ! = 0 ) {
int old_len = prs_offset ( ps ) ;
uint32 sid_stuff_len = old_len - ptr_sid_stuff ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_set_offset ( ps , ptr_len0 ) )
return False ;
if ( ! prs_uint32 ( " sid_stuff_len0 " , ps , depth , & sid_stuff_len ) )
return False ;
if ( ! prs_set_offset ( ps , ptr_len1 ) )
return False ;
if ( ! prs_uint32 ( " sid_stuff_len1 " , ps , depth , & sid_stuff_len ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_set_offset ( ps , old_len ) )
return False ;
1998-03-12 00:11:04 +03:00
}
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_STR1 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL sam_io_sam_str1 ( char * desc , SAM_STR1 * sam , uint32 acct_buf ,
uint32 name_buf , uint32 desc_buf , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_str1 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_acct_name , acct_buf , ps , depth ) ) /* account name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_full_name , name_buf , ps , depth ) ) /* full name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_acct_desc , desc_buf , ps , depth ) ) /* account description unicode string */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_ENTRY1 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static void init_sam_entry1 ( SAM_ENTRY1 * sam , uint32 user_idx ,
1998-03-12 00:11:04 +03:00
uint32 len_sam_name , uint32 len_sam_full , uint32 len_sam_desc ,
uint32 rid_user , uint16 acb_info )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_entry1 \n " ) ) ;
1998-03-12 00:11:04 +03:00
sam - > user_idx = user_idx ;
sam - > rid_user = rid_user ;
sam - > acb_info = acb_info ;
sam - > pad = 0 ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & sam - > hdr_acct_name , len_sam_name ) ;
init_uni_hdr ( & sam - > hdr_user_name , len_sam_full ) ;
init_uni_hdr ( & sam - > hdr_user_desc , len_sam_desc ) ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_ENTRY1 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_entry1 ( char * desc , SAM_ENTRY1 * sam , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1998-05-12 20:43:52 +04:00
prs_debug ( ps , depth , desc , " sam_io_sam_entry1 " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " user_idx " , ps , depth , & sam - > user_idx ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " rid_user " , ps , depth , & sam - > rid_user ) )
return False ;
if ( ! prs_uint16 ( " acb_info " , ps , depth , & sam - > acb_info ) )
return False ;
if ( ! prs_uint16 ( " pad " , ps , depth , & sam - > pad ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_acct_name , ps , depth ) ) /* account name unicode string header */
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_user_name , ps , depth ) ) /* account name unicode string header */
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_user_desc , ps , depth ) ) /* account name unicode string header */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_STR2 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_str2 ( char * desc , SAM_STR2 * sam , uint32 acct_buf , uint32 desc_buf , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_str2 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_srv_name , acct_buf , ps , depth ) ) /* account name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_srv_desc , desc_buf , ps , depth ) ) /* account description unicode string */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_ENTRY2 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static void init_sam_entry2 ( SAM_ENTRY2 * sam , uint32 user_idx ,
1998-03-12 00:11:04 +03:00
uint32 len_sam_name , uint32 len_sam_desc ,
uint32 rid_user , uint16 acb_info )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_entry2 \n " ) ) ;
1998-03-12 00:11:04 +03:00
sam - > user_idx = user_idx ;
sam - > rid_user = rid_user ;
sam - > acb_info = acb_info ;
sam - > pad = 0 ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & sam - > hdr_srv_name , len_sam_name ) ;
init_uni_hdr ( & sam - > hdr_srv_desc , len_sam_desc ) ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_ENTRY2 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_entry2 ( char * desc , SAM_ENTRY2 * sam , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_entry2 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " user_idx " , ps , depth , & sam - > user_idx ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " rid_user " , ps , depth , & sam - > rid_user ) )
return False ;
if ( ! prs_uint16 ( " acb_info " , ps , depth , & sam - > acb_info ) )
return False ;
if ( ! prs_uint16 ( " pad " , ps , depth , & sam - > pad ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_srv_name , ps , depth ) ) /* account name unicode string header */
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_srv_desc , ps , depth ) ) /* account name unicode string header */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_STR3 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_str3 ( char * desc , SAM_STR3 * sam , uint32 acct_buf , uint32 desc_buf , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_str3 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_grp_name , acct_buf , ps , depth ) ) /* account name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " unistr2 " , & sam - > uni_grp_desc , desc_buf , ps , depth ) ) /* account description unicode string */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_ENTRY3 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static void init_sam_entry3 ( SAM_ENTRY3 * sam , uint32 grp_idx ,
1998-03-12 00:11:04 +03:00
uint32 len_grp_name , uint32 len_grp_desc , uint32 rid_grp )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_entry3 \n " ) ) ;
1998-03-12 00:11:04 +03:00
2000-06-01 21:01:34 +04:00
ZERO_STRUCTP ( sam ) ;
1998-03-12 00:11:04 +03:00
sam - > grp_idx = grp_idx ;
sam - > rid_grp = rid_grp ;
sam - > attr = 0x07 ; /* group rid attributes - gets ignored by nt 4.0 */
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & sam - > hdr_grp_name , len_grp_name ) ;
init_uni_hdr ( & sam - > hdr_grp_desc , len_grp_desc ) ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_ENTRY3 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_entry3 ( char * desc , SAM_ENTRY3 * sam , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_entry3 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " grp_idx " , ps , depth , & sam - > grp_idx ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " rid_grp " , ps , depth , & sam - > rid_grp ) )
return False ;
if ( ! prs_uint32 ( " attr " , ps , depth , & sam - > attr ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_grp_name , ps , depth ) ) /* account name unicode string header */
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_grp_desc , ps , depth ) ) /* account name unicode string header */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1999-02-24 04:52:30 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_ENTRY structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static void init_sam_entry ( SAM_ENTRY * sam , uint32 len_sam_name , uint32 rid )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_entry \n " ) ) ;
1998-03-12 00:11:04 +03:00
sam - > rid = rid ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & sam - > hdr_name , len_sam_name ) ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAM_ENTRY structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
static BOOL sam_io_sam_entry ( char * desc , SAM_ENTRY * sam , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_entry " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " rid " , ps , depth , & sam - > rid ) )
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & sam - > hdr_name , ps , depth ) ) /* account name unicode string header */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_ENUM_DOM_USERS structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_enum_dom_users ( SAMR_Q_ENUM_DOM_USERS * q_e , POLICY_HND * pol ,
uint16 req_num_entries , uint16 unk_0 ,
1998-09-26 02:20:05 +04:00
uint16 acb_mask , uint16 unk_1 , uint32 size )
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_q_enum_dom_users \n " ) ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_e - > pol , pol , sizeof ( * pol ) ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
q_e - > req_num_entries = req_num_entries ; /* zero indicates lots */
q_e - > unknown_0 = unk_0 ; /* this gets returned in the response */
1998-09-26 02:20:05 +04:00
q_e - > acb_mask = acb_mask ;
q_e - > unknown_1 = unk_1 ;
q_e - > max_size = size ;
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_enum_dom_users ( char * desc , SAMR_Q_ENUM_DOM_USERS * q_e , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_e = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_enum_dom_users " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_e - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " req_num_entries " , ps , depth , & q_e - > req_num_entries ) )
return False ;
if ( ! prs_uint16 ( " unknown_0 " , ps , depth , & q_e - > unknown_0 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " acb_mask " , ps , depth , & q_e - > acb_mask ) )
return False ;
if ( ! prs_uint16 ( " unknown_1 " , ps , depth , & q_e - > unknown_1 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " max_size " , ps , depth , & q_e - > max_size ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_ENUM_DOM_USERS structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_enum_dom_users ( SAMR_R_ENUM_DOM_USERS * r_u ,
uint16 total_num_entries , uint16 unk_0 ,
1998-03-12 00:11:04 +03:00
uint32 num_sam_entries , SAM_USER_INFO_21 pass [ MAX_SAM_ENTRIES ] , uint32 status )
{
1999-12-13 16:27:58 +03:00
int i ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_enum_dom_users \n " ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > = MAX_SAM_ENTRIES ) {
num_sam_entries = MAX_SAM_ENTRIES ;
DEBUG ( 5 , ( " limiting number of entries to %d \n " ,
num_sam_entries ) ) ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
r_u - > total_num_entries = total_num_entries ;
r_u - > unknown_0 = unk_0 ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( total_num_entries > 0 ) {
1998-03-12 00:11:04 +03:00
r_u - > ptr_entries1 = 1 ;
r_u - > ptr_entries2 = 1 ;
r_u - > num_entries2 = num_sam_entries ;
r_u - > num_entries3 = num_sam_entries ;
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > sam , num_sam_entries ) ;
SMB_ASSERT_ARRAY ( r_u - > uni_acct_name , num_sam_entries ) ;
1999-03-23 23:43:44 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < num_sam_entries ; i + + ) {
init_sam_entry ( & ( r_u - > sam [ i ] ) ,
1998-03-12 00:11:04 +03:00
pass [ i ] . uni_user_name . uni_str_len ,
pass [ i ] . user_rid ) ;
1999-12-13 16:27:58 +03:00
copy_unistr2 ( & r_u - > uni_acct_name [ i ] , & ( pass [ i ] . uni_user_name ) ) ;
1998-03-12 00:11:04 +03:00
}
r_u - > num_entries4 = num_sam_entries ;
1999-12-13 16:27:58 +03:00
} else {
1998-03-12 00:11:04 +03:00
r_u - > ptr_entries1 = 0 ;
r_u - > num_entries2 = num_sam_entries ;
r_u - > ptr_entries2 = 1 ;
}
r_u - > status = status ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_enum_dom_users ( char * desc , SAMR_R_ENUM_DOM_USERS * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_enum_dom_users " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " total_num_entries " , ps , depth , & r_u - > total_num_entries ) )
return False ;
if ( ! prs_uint16 ( " unknown_0 " , ps , depth , & r_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries1 " , ps , depth , & r_u - > ptr_entries1 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > total_num_entries ! = 0 & & r_u - > ptr_entries1 ! = 0 ) {
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & r_u - > num_entries2 ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries2 " , ps , depth , & r_u - > ptr_entries2 ) )
return False ;
if ( ! prs_uint32 ( " num_entries3 " , ps , depth , & r_u - > num_entries3 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > sam , r_u - > num_entries2 ) ;
1999-03-23 23:43:44 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries2 ; i + + ) {
if ( ! sam_io_sam_entry ( " " , & r_u - > sam [ i ] , ps , depth ) )
return False ;
1999-03-23 23:43:44 +03:00
}
1998-08-22 06:54:21 +04:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > uni_acct_name , r_u - > num_entries2 ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries2 ; i + + ) {
if ( ! smb_io_unistr2 ( " " , & r_u - > uni_acct_name [ i ] ,
r_u - > sam [ i ] . hdr_name . buffer , ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries4 " , ps , depth , & r_u - > num_entries4 ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_ENUM_DOM_ALIASES structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_enum_dom_aliases ( SAMR_Q_ENUM_DOM_ALIASES * q_e , POLICY_HND * pol , uint32 size )
{
DEBUG ( 5 , ( " init_q_enum_dom_aliases \n " ) ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_e - > pol , pol , sizeof ( * pol ) ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
q_e - > unknown_0 = 0 ;
q_e - > max_size = size ;
1998-09-26 02:20:05 +04:00
}
1999-12-13 16:27:58 +03:00
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_enum_dom_aliases ( char * desc , SAMR_Q_ENUM_DOM_ALIASES * q_e , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_e = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_enum_dom_aliases " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_e - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & q_e - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " max_size " , ps , depth , & q_e - > max_size ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_ENUM_DOM_ALIASES structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
void init_samr_r_enum_dom_aliases ( SAMR_R_ENUM_DOM_ALIASES * r_u ,
uint32 num_sam_entries , SAM_USER_INFO_21 grps [ MAX_SAM_ENTRIES ] ,
uint32 status )
{
int i ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_enum_dom_aliases \n " ) ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > = MAX_SAM_ENTRIES ) {
num_sam_entries = MAX_SAM_ENTRIES ;
DEBUG ( 5 , ( " limiting number of entries to %d \n " ,
num_sam_entries ) ) ;
1999-02-24 04:52:30 +03:00
}
1999-12-13 16:27:58 +03:00
r_u - > num_entries = num_sam_entries ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > 0 ) {
r_u - > ptr_entries = 1 ;
r_u - > num_entries2 = num_sam_entries ;
r_u - > ptr_entries2 = 1 ;
r_u - > num_entries3 = num_sam_entries ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > sam , num_sam_entries ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < num_sam_entries ; i + + ) {
init_sam_entry ( & r_u - > sam [ i ] ,
grps [ i ] . uni_user_name . uni_str_len ,
grps [ i ] . user_rid ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
copy_unistr2 ( & r_u - > uni_grp_name [ i ] , & ( grps [ i ] . uni_user_name ) ) ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
r_u - > num_entries4 = num_sam_entries ;
} else {
r_u - > ptr_entries = 0 ;
1999-02-24 04:52:30 +03:00
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ;
1999-02-24 04:52:30 +03:00
}
1998-03-12 00:11:04 +03:00
1999-02-24 04:52:30 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_enum_dom_aliases ( char * desc , SAMR_R_ENUM_DOM_ALIASES * r_u , prs_struct * ps , int depth )
{
int i ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_enum_dom_aliases " ) ;
depth + + ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries " , ps , depth , & r_u - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries " , ps , depth , & r_u - > ptr_entries ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > num_entries ! = 0 & & r_u - > ptr_entries ! = 0 ) {
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & r_u - > num_entries2 ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries2 " , ps , depth , & r_u - > ptr_entries2 ) )
return False ;
if ( ! prs_uint32 ( " num_entries3 " , ps , depth , & r_u - > num_entries3 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > sam , r_u - > num_entries ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries ; i + + ) {
if ( ! sam_io_sam_entry ( " " , & r_u - > sam [ i ] , ps , depth ) )
return False ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries ; i + + ) {
if ( ! smb_io_unistr2 ( " " , & r_u - > uni_grp_name [ i ] , r_u - > sam [ i ] . hdr_name . buffer , ps , depth ) )
return False ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries4 " , ps , depth , & r_u - > num_entries4 ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_QUERY_DISPINFO structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_query_dispinfo ( SAMR_Q_QUERY_DISPINFO * q_e , POLICY_HND * pol ,
uint16 switch_level , uint32 start_idx , uint32 size )
{
DEBUG ( 5 , ( " init_q_query_dispinfo \n " ) ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_e - > pol , pol , sizeof ( * pol ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
q_e - > switch_level = switch_level ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
q_e - > start_idx = start_idx ;
2000-05-16 23:45:26 +04:00
q_e - > max_entries = 0 ;
1999-12-13 16:27:58 +03:00
q_e - > max_size = size ;
1999-02-24 04:52:30 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_query_dispinfo ( char * desc , SAMR_Q_QUERY_DISPINFO * q_e , prs_struct * ps , int depth )
{
if ( q_e = = NULL )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_query_dispinfo " ) ;
1999-02-24 04:52:30 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_e - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " switch_level " , ps , depth , & q_e - > switch_level ) )
return False ;
2000-05-16 23:45:26 +04:00
#if 0
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " unknown_0 " , ps , depth , & q_e - > unknown_0 ) )
return False ;
2000-05-16 23:45:26 +04:00
# else
prs_align ( ps ) ;
# endif
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " start_idx " , ps , depth , & q_e - > start_idx ) )
return False ;
2000-05-16 23:45:26 +04:00
if ( ! prs_uint32 ( " max_entries " , ps , depth , & q_e - > max_entries ) )
1999-12-13 16:27:58 +03:00
return False ;
if ( ! prs_uint32 ( " max_size " , ps , depth , & q_e - > max_size ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1999-02-24 04:52:30 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_INFO_2 structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_sam_info_2 ( SAM_INFO_2 * sam , uint32 acb_mask ,
uint32 start_idx , uint32 num_sam_entries ,
SAM_USER_INFO_21 pass [ MAX_SAM_ENTRIES ] )
{
int i ;
int entries_added ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_info_2 \n " ) ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > = MAX_SAM_ENTRIES ) {
num_sam_entries = MAX_SAM_ENTRIES ;
DEBUG ( 5 , ( " limiting number of entries to %d \n " ,
num_sam_entries ) ) ;
}
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
for ( i = start_idx , entries_added = 0 ; i < num_sam_entries ; i + + ) {
2000-08-01 22:32:34 +04:00
if ( ( pass [ i ] . acb_info & acb_mask ) = = acb_mask ) {
1999-12-13 16:27:58 +03:00
init_sam_entry2 ( & sam - > sam [ entries_added ] ,
start_idx + entries_added + 1 ,
pass [ i ] . uni_user_name . uni_str_len ,
pass [ i ] . uni_acct_desc . uni_str_len ,
pass [ i ] . user_rid ,
pass [ i ] . acb_info ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
copy_unistr2 ( & sam - > str [ entries_added ] . uni_srv_name , & pass [ i ] . uni_user_name ) ;
copy_unistr2 ( & sam - > str [ entries_added ] . uni_srv_desc , & pass [ i ] . uni_acct_desc ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
entries_added + + ;
}
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
sam - > num_entries = entries_added ;
sam - > ptr_entries = 1 ;
sam - > num_entries2 = entries_added ;
1999-02-24 04:52:30 +03:00
}
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL sam_io_sam_info_2 ( char * desc , SAM_INFO_2 * sam , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_info_2 " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " num_entries " , ps , depth , & sam - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries " , ps , depth , & sam - > ptr_entries ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & sam - > num_entries2 ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( sam - > sam , sam - > num_entries ) ;
for ( i = 0 ; i < sam - > num_entries ; i + + ) {
if ( ! sam_io_sam_entry2 ( " " , & sam - > sam [ i ] , ps , depth ) )
return False ;
1999-02-24 04:52:30 +03:00
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < sam - > num_entries ; i + + ) {
if ( ! sam_io_sam_str2 ( " " , & sam - > str [ i ] ,
sam - > sam [ i ] . hdr_srv_name . buffer ,
sam - > sam [ i ] . hdr_srv_desc . buffer ,
ps , depth ) )
return False ;
1999-02-24 04:52:30 +03:00
}
1999-10-15 22:46:22 +04:00
return True ;
1999-02-24 04:52:30 +03:00
}
1998-03-12 00:11:04 +03:00
1999-02-24 04:52:30 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_INFO_1 structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_sam_info_1 ( SAM_INFO_1 * sam , uint32 acb_mask ,
uint32 start_idx , uint32 num_sam_entries ,
SAM_USER_INFO_21 pass [ MAX_SAM_ENTRIES ] )
{
int i ;
int entries_added ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_info_1 \n " ) ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > = MAX_SAM_ENTRIES ) {
num_sam_entries = MAX_SAM_ENTRIES ;
DEBUG ( 5 , ( " limiting number of entries to %d \n " ,
num_sam_entries ) ) ;
}
2000-05-16 23:45:26 +04:00
DEBUG ( 5 , ( " num_sam_entries: %u, start_idx: %u \n " , num_sam_entries ,
num_sam_entries ) ) ;
1999-02-24 04:52:30 +03:00
2000-05-16 23:45:26 +04:00
for ( i = 0 , entries_added = 0 ;
i < num_sam_entries ; i + + ) {
2000-08-01 22:32:34 +04:00
if ( ( pass [ i ] . acb_info & acb_mask ) = = acb_mask ) {
1999-12-13 16:27:58 +03:00
init_sam_entry1 ( & sam - > sam [ entries_added ] ,
start_idx + entries_added + 1 ,
pass [ i ] . uni_user_name . uni_str_len ,
pass [ i ] . uni_full_name . uni_str_len ,
pass [ i ] . uni_acct_desc . uni_str_len ,
pass [ i ] . user_rid ,
pass [ i ] . acb_info ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
copy_unistr2 ( & sam - > str [ entries_added ] . uni_acct_name , & pass [ i ] . uni_user_name ) ;
copy_unistr2 ( & sam - > str [ entries_added ] . uni_full_name , & pass [ i ] . uni_full_name ) ;
copy_unistr2 ( & sam - > str [ entries_added ] . uni_acct_desc , & pass [ i ] . uni_acct_desc ) ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
entries_added + + ;
2000-05-16 23:45:26 +04:00
}
1999-02-24 04:52:30 +03:00
}
1999-12-13 16:27:58 +03:00
sam - > num_entries = entries_added ;
sam - > ptr_entries = 1 ;
sam - > num_entries2 = entries_added ;
1999-02-24 04:52:30 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-02-24 04:52:30 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL sam_io_sam_info_1 ( char * desc , SAM_INFO_1 * sam , prs_struct * ps , int depth )
1999-02-24 04:52:30 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( sam = = NULL )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " sam_io_sam_info_1 " ) ;
1999-02-24 04:52:30 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " num_entries " , ps , depth , & sam - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries " , ps , depth , & sam - > ptr_entries ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & sam - > num_entries2 ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( sam - > sam , sam - > num_entries ) ;
for ( i = 0 ; i < sam - > num_entries ; i + + ) {
if ( ! sam_io_sam_entry1 ( " " , & sam - > sam [ i ] , ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < sam - > num_entries ; i + + ) {
if ( ! sam_io_sam_str1 ( " " , & sam - > str [ i ] ,
sam - > sam [ i ] . hdr_acct_name . buffer ,
sam - > sam [ i ] . hdr_user_name . buffer ,
sam - > sam [ i ] . hdr_user_desc . buffer ,
ps , depth ) )
return False ;
1998-03-12 00:11:04 +03:00
}
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_QUERY_DISPINFO structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_query_dispinfo ( SAMR_R_QUERY_DISPINFO * r_u ,
uint16 switch_level , SAM_INFO_CTR * ctr , uint32 status )
{
DEBUG ( 5 , ( " init_samr_r_query_dispinfo \n " ) ) ;
1998-03-12 00:11:04 +03:00
2000-05-16 23:45:26 +04:00
if ( status = = 0x0 | | status = = 0x105 ) {
1999-12-13 16:27:58 +03:00
r_u - > unknown_0 = 0x0000001 ;
r_u - > unknown_1 = 0x0000001 ;
} else {
r_u - > unknown_0 = 0x0 ;
r_u - > unknown_1 = 0x0 ;
}
1998-03-12 00:11:04 +03:00
r_u - > switch_level = switch_level ;
r_u - > ctr = ctr ;
r_u - > status = status ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_query_dispinfo ( char * desc , SAMR_R_QUERY_DISPINFO * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_query_dispinfo " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & r_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " unknown_1 " , ps , depth , & r_u - > unknown_1 ) )
return False ;
if ( ! prs_uint16 ( " switch_level " , ps , depth , & r_u - > switch_level ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-02-24 04:52:30 +03:00
1999-12-13 16:27:58 +03:00
switch ( r_u - > switch_level ) {
case 0x1 :
if ( ! sam_io_sam_info_1 ( " users " , r_u - > ctr - > sam . info1 , ps , depth ) )
return False ;
break ;
case 0x2 :
if ( ! sam_io_sam_info_2 ( " servers " , r_u - > ctr - > sam . info2 , ps , depth ) )
return False ;
break ;
default :
DEBUG ( 5 , ( " samr_io_r_query_dispinfo: unknown switch value \n " ) ) ;
break ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-12-01 19:04:24 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_ENUM_DOM_GROUPS structure .
1998-12-01 19:04:24 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_enum_dom_groups ( SAMR_Q_ENUM_DOM_GROUPS * q_e , POLICY_HND * pol ,
uint16 switch_level , uint32 start_idx , uint32 size )
1998-12-01 19:04:24 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_q_enum_dom_groups \n " ) ) ;
1998-12-01 19:04:24 +03:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_e - > pol , pol , sizeof ( * pol ) ) ;
1998-12-01 19:04:24 +03:00
1999-12-13 16:27:58 +03:00
q_e - > switch_level = switch_level ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
q_e - > unknown_0 = 0 ;
q_e - > start_idx = start_idx ;
q_e - > unknown_1 = 0x000007d0 ;
q_e - > max_size = size ;
1998-12-01 19:04:24 +03:00
}
1998-12-02 04:13:02 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_enum_dom_groups ( char * desc , SAMR_Q_ENUM_DOM_GROUPS * q_e , prs_struct * ps , int depth )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_e = = NULL )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_enum_dom_groups " ) ;
1998-12-02 04:13:02 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_pol_hnd ( " pol " , & q_e - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " switch_level " , ps , depth , & q_e - > switch_level ) )
return False ;
if ( ! prs_uint16 ( " unknown_0 " , ps , depth , & q_e - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " start_idx " , ps , depth , & q_e - > start_idx ) )
return False ;
if ( ! prs_uint32 ( " unknown_1 " , ps , depth , & q_e - > unknown_1 ) )
return False ;
if ( ! prs_uint32 ( " max_size " , ps , depth , & q_e - > max_size ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
1999-12-13 16:27:58 +03:00
1998-12-02 04:13:02 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_ENUM_DOM_GROUPS structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_enum_dom_groups ( SAMR_R_ENUM_DOM_GROUPS * r_u ,
uint32 start_idx , uint32 num_sam_entries ,
SAM_USER_INFO_21 pass [ MAX_SAM_ENTRIES ] ,
uint32 status )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
int entries_added ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_enum_dom_groups \n " ) ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( num_sam_entries > = MAX_SAM_ENTRIES ) {
num_sam_entries = MAX_SAM_ENTRIES ;
DEBUG ( 5 , ( " limiting number of entries to %d \n " ,
num_sam_entries ) ) ;
}
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
for ( i = start_idx , entries_added = 0 ; i < num_sam_entries ; i + + ) {
init_sam_entry3 ( & r_u - > sam [ entries_added ] ,
start_idx + entries_added + 1 ,
pass [ i ] . uni_user_name . uni_str_len ,
pass [ i ] . uni_acct_desc . uni_str_len ,
pass [ i ] . user_rid ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
copy_unistr2 ( & r_u - > str [ entries_added ] . uni_grp_name ,
& pass [ i ] . uni_user_name ) ;
copy_unistr2 ( & r_u - > str [ entries_added ] . uni_grp_desc ,
& pass [ i ] . uni_acct_desc ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
entries_added + + ;
}
1998-12-03 01:13:48 +03:00
1999-12-13 16:27:58 +03:00
if ( entries_added > 0 ) {
r_u - > unknown_0 = 0x0000492 ;
r_u - > unknown_1 = 0x000049a ;
} else {
r_u - > unknown_0 = 0x0 ;
r_u - > unknown_1 = 0x0 ;
}
r_u - > switch_level = 3 ;
r_u - > num_entries = entries_added ;
r_u - > ptr_entries = 1 ;
r_u - > num_entries2 = entries_added ;
} else {
r_u - > switch_level = 0 ;
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_enum_dom_groups ( char * desc , SAMR_R_ENUM_DOM_GROUPS * r_u , prs_struct * ps , int depth )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
if ( r_u = = NULL )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_enum_dom_groups " ) ;
1998-12-02 04:13:02 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & r_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " unknown_1 " , ps , depth , & r_u - > unknown_1 ) )
return False ;
if ( ! prs_uint32 ( " switch_level " , ps , depth , & r_u - > switch_level ) )
return False ;
if ( r_u - > switch_level ! = 0 ) {
if ( ! prs_uint32 ( " num_entries " , ps , depth , & r_u - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr_entries " , ps , depth , & r_u - > ptr_entries ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & r_u - > num_entries2 ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > sam , r_u - > num_entries ) ;
1998-12-03 01:13:48 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries ; i + + ) {
if ( ! sam_io_sam_entry3 ( " " , & r_u - > sam [ i ] , ps , depth ) )
return False ;
}
1998-12-03 01:05:56 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries ; i + + ) {
if ( ! sam_io_sam_str3 ( " " , & r_u - > str [ i ] ,
r_u - > sam [ i ] . hdr_grp_name . buffer ,
r_u - > sam [ i ] . hdr_grp_desc . buffer ,
ps , depth ) )
return False ;
}
}
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_QUERY_ALIASINFO structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_query_aliasinfo ( SAMR_Q_QUERY_ALIASINFO * q_e ,
POLICY_HND * pol ,
uint16 switch_level )
{
DEBUG ( 5 , ( " init_q_query_aliasinfo \n " ) ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_e - > pol , pol , sizeof ( * pol ) ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
q_e - > switch_level = switch_level ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_query_aliasinfo ( char * desc , SAMR_Q_QUERY_ALIASINFO * q_e , prs_struct * ps , int depth )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_e = = NULL )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_query_aliasinfo " ) ;
1998-12-02 04:13:02 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_e - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint16 ( " switch_level " , ps , depth , & q_e - > switch_level ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_QUERY_ALIASINFO structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2000-05-16 23:45:26 +04:00
void init_samr_r_query_aliasinfo ( SAMR_R_QUERY_ALIASINFO * r_u , uint32 switch_level ,
char * alias , char * alias_desc )
{
int alias_desc_len , alias_len ;
if ( r_u = = NULL )
return ;
alias_len = alias ? strlen ( alias ) : 0 ;
alias_desc_len = alias_desc ? strlen ( alias_desc ) : 0 ;
DEBUG ( 5 , ( " init_samr_r_query_aliasinfo \n " ) ) ;
r_u - > switch_value = switch_level ;
if ( r_u - > status = = 0 )
{
switch ( switch_level )
{
case 1 :
{
r_u - > ptr = 1 ;
init_uni_hdr ( & r_u - > alias . info1 . hdr_alias_name , alias_len ) ;
init_unistr2 ( & r_u - > alias . info1 . uni_alias_name , alias , alias_len ) ;
r_u - > alias . info1 . switch_value_1 = switch_level ;
init_uni_hdr ( & r_u - > alias . info1 . hdr_alias_desc , alias_desc_len ) ;
init_unistr2 ( & r_u - > alias . info1 . uni_alias_desc , alias_desc , alias_desc_len ) ;
break ;
}
case 3 :
{
r_u - > ptr = 1 ;
init_uni_hdr ( & r_u - > alias . info3 . hdr_acct_desc , alias_desc_len ) ;
init_unistr2 ( & r_u - > alias . info3 . uni_acct_desc , alias_desc , alias_desc_len ) ;
break ;
}
default :
{
r_u - > status = 0xC0000000 | NT_STATUS_INVALID_INFO_CLASS ;
}
1998-12-02 04:13:02 +03:00
}
2000-05-16 23:45:26 +04:00
}
1998-12-02 04:13:02 +03:00
}
2000-05-16 23:45:26 +04:00
1998-12-03 20:29:03 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_query_aliasinfo ( char * desc , SAMR_R_QUERY_ALIASINFO * r_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
2000-05-16 23:45:26 +04:00
if ( r_u = = NULL )
return False ;
1999-12-13 16:27:58 +03:00
2000-05-16 23:45:26 +04:00
prs_debug ( ps , depth , desc , " samr_io_r_query_aliasinfo " ) ;
depth + + ;
1998-12-03 20:29:03 +03:00
2000-05-16 23:45:26 +04:00
if ( ! prs_align ( ps ) )
return False ;
1999-12-13 16:27:58 +03:00
2000-05-16 23:45:26 +04:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & r_u - > ptr ) )
return False ;
1999-12-13 16:27:58 +03:00
2000-05-16 23:45:26 +04:00
if ( r_u - > ptr ! = 0 ) {
if ( ! prs_uint16 ( " switch_value " , ps , depth , & r_u - > switch_value ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( r_u - > switch_value ! = 0 ) {
switch ( r_u - > switch_value ) {
case 1 :
smb_io_unihdr ( " " , & r_u - > alias . info1 . hdr_alias_name , ps , depth ) ;
prs_uint32 ( " switch_value_1 " , ps , depth , & r_u - > alias . info1 . switch_value_1 ) ;
smb_io_unihdr ( " " , & r_u - > alias . info1 . hdr_alias_desc , ps , depth ) ;
smb_io_unistr2 ( " " , & r_u - > alias . info1 . uni_alias_name ,
r_u - > alias . info1 . hdr_alias_name . buffer , ps , depth ) ;
smb_io_unistr2 ( " " , & r_u - > alias . info1 . uni_alias_desc ,
r_u - > alias . info1 . hdr_alias_desc . buffer , ps , depth ) ;
break ;
case 3 :
if ( ! smb_io_unihdr ( " " , & r_u - > alias . info3 . hdr_acct_desc , ps , depth ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & r_u - > alias . info3 . uni_acct_desc ,
r_u - > alias . info3 . hdr_acct_desc . buffer , ps , depth ) )
return False ;
break ;
default :
DEBUG ( 4 , ( " samr_io_r_query_aliasinfo: unsupported switch level \n " ) ) ;
break ;
}
}
}
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
return True ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAMR_Q_LOOKUP_IDS structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_lookup_ids ( char * desc , SAMR_Q_LOOKUP_IDS * q_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
fstring tmp ;
int i ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_q_lookup_ids " ) ;
1998-12-03 20:29:03 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & ( q_u - > pol ) , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_sids1 " , ps , depth , & q_u - > num_sids1 ) )
return False ;
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
return False ;
if ( ! prs_uint32 ( " num_sids2 " , ps , depth , & q_u - > num_sids2 ) )
return False ;
SMB_ASSERT_ARRAY ( q_u - > ptr_sid , q_u - > num_sids2 ) ;
for ( i = 0 ; i < q_u - > num_sids2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " ptr[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & q_u - > ptr_sid [ i ] ) )
return False ;
}
for ( i = 0 ; i < q_u - > num_sids2 ; i + + ) {
if ( q_u - > ptr_sid [ i ] ! = 0 ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " sid[%02d] " , i ) ;
if ( ! smb_io_dom_sid2 ( tmp , & q_u - > sid [ i ] , ps , depth ) )
return False ;
}
}
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_LOOKUP_IDS structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_lookup_ids ( SAMR_R_LOOKUP_IDS * r_u ,
uint32 num_rids , uint32 * rid , uint32 status )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_lookup_ids \n " ) ) ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
r_u - > num_entries = num_rids ;
r_u - > ptr = 1 ;
r_u - > num_entries2 = num_rids ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > rid , num_rids ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < num_rids ; i + + ) {
r_u - > rid [ i ] = rid [ i ] ;
}
} else {
r_u - > num_entries = 0 ;
r_u - > ptr = 0 ;
r_u - > num_entries2 = 0 ;
}
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ;
}
1998-12-03 20:29:03 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_lookup_ids ( char * desc , SAMR_R_LOOKUP_IDS * r_u , prs_struct * ps , int depth )
{
fstring tmp ;
int i ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_lookup_ids " ) ;
depth + + ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_entries " , ps , depth , & r_u - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr " , ps , depth , & r_u - > ptr ) )
return False ;
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & r_u - > num_entries2 ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > num_entries ! = 0 ) {
SMB_ASSERT_ARRAY ( r_u - > rid , r_u - > num_entries2 ) ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " rid[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & r_u - > rid [ i ] ) )
return False ;
}
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-05 02:06:27 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-05 02:06:27 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_lookup_names ( char * desc , SAMR_Q_LOOKUP_NAMES * q_u , prs_struct * ps , int depth )
1998-12-05 02:06:27 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
if ( q_u = = NULL )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_lookup_names " ) ;
1998-12-05 02:06:27 +03:00
depth + + ;
prs_align ( ps ) ;
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " num_names1 " , ps , depth , & q_u - > num_names1 ) )
return False ;
if ( ! prs_uint32 ( " flags " , ps , depth , & q_u - > flags ) )
return False ;
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
return False ;
if ( ! prs_uint32 ( " num_names2 " , ps , depth , & q_u - > num_names2 ) )
return False ;
SMB_ASSERT_ARRAY ( q_u - > hdr_name , q_u - > num_names2 ) ;
for ( i = 0 ; i < q_u - > num_names2 ; i + + ) {
if ( ! smb_io_unihdr ( " " , & q_u - > hdr_name [ i ] , ps , depth ) )
return False ;
}
for ( i = 0 ; i < q_u - > num_names2 ; i + + ) {
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_name [ i ] , q_u - > hdr_name [ i ] . buffer , ps , depth ) )
return False ;
}
1999-10-15 22:46:22 +04:00
return True ;
1998-12-05 02:06:27 +03:00
}
1999-12-13 16:27:58 +03:00
1998-12-05 02:06:27 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_LOOKUP_NAMES structure .
1998-12-05 02:06:27 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_lookup_names ( SAMR_R_LOOKUP_NAMES * r_u ,
2000-10-04 05:03:23 +04:00
uint32 num_rids , uint32 * rid , enum SID_NAME_USE * type , uint32 status )
1998-12-05 02:06:27 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_lookup_names \n " ) ) ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
r_u - > num_types1 = num_rids ;
r_u - > ptr_types = 1 ;
r_u - > num_types2 = num_rids ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > num_rids1 = num_rids ;
r_u - > ptr_rids = 1 ;
r_u - > num_rids2 = num_rids ;
SMB_ASSERT_ARRAY ( r_u - > rid , num_rids ) ;
for ( i = 0 ; i < num_rids ; i + + ) {
r_u - > rid [ i ] = rid [ i ] ;
r_u - > type [ i ] = type [ i ] ;
}
} else {
r_u - > num_types1 = 0 ;
r_u - > ptr_types = 0 ;
r_u - > num_types2 = 0 ;
r_u - > num_rids1 = 0 ;
r_u - > ptr_rids = 0 ;
r_u - > num_rids2 = 0 ;
}
r_u - > status = status ;
1998-12-05 02:06:27 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-05 02:06:27 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_lookup_names ( char * desc , SAMR_R_LOOKUP_NAMES * r_u , prs_struct * ps , int depth )
1998-12-05 02:06:27 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
fstring tmp ;
if ( r_u = = NULL )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_lookup_names " ) ;
1998-12-05 02:06:27 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_rids1 " , ps , depth , & r_u - > num_rids1 ) )
return False ;
if ( ! prs_uint32 ( " ptr_rids " , ps , depth , & r_u - > ptr_rids ) )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_rids ! = 0 ) {
if ( ! prs_uint32 ( " num_rids2 " , ps , depth , & r_u - > num_rids2 ) )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > num_rids2 ! = r_u - > num_rids1 ) {
/* RPC fault */
return False ;
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_rids2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " rid[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & r_u - > rid [ i ] ) )
return False ;
}
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_types1 " , ps , depth , & r_u - > num_types1 ) )
return False ;
if ( ! prs_uint32 ( " ptr_types " , ps , depth , & r_u - > ptr_types ) )
return False ;
if ( r_u - > ptr_types ! = 0 ) {
if ( ! prs_uint32 ( " num_types2 " , ps , depth , & r_u - > num_types2 ) )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > num_types2 ! = r_u - > num_types1 ) {
/* RPC fault */
return False ;
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_types2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " type[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & r_u - > type [ i ] ) )
return False ;
}
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-05 02:06:27 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-05 02:06:27 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_unknown_12 ( char * desc , SAMR_Q_UNKNOWN_12 * q_u , prs_struct * ps , int depth )
1998-12-05 02:06:27 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
fstring tmp ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_q_unknown_12 " ) ;
1998-12-05 02:06:27 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " num_gids1 " , ps , depth , & q_u - > num_gids1 ) )
return False ;
if ( ! prs_uint32 ( " rid " , ps , depth , & q_u - > rid ) )
return False ;
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
return False ;
if ( ! prs_uint32 ( " num_gids2 " , ps , depth , & q_u - > num_gids2 ) )
return False ;
SMB_ASSERT_ARRAY ( q_u - > gid , q_u - > num_gids2 ) ;
for ( i = 0 ; i < q_u - > num_gids2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " gid[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & q_u - > gid [ i ] ) )
return False ;
}
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-05 02:06:27 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_UNKNOWN_12 structure .
1998-12-05 02:06:27 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_unknown_12 ( SAMR_R_UNKNOWN_12 * r_u ,
uint32 num_aliases , fstring * als_name , uint32 * num_als_usrs ,
1998-12-05 02:06:27 +03:00
uint32 status )
{
1999-12-13 16:27:58 +03:00
int i ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_unknown_12 \n " ) ) ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
r_u - > num_aliases1 = num_aliases ;
r_u - > ptr_aliases = 1 ;
r_u - > num_aliases2 = num_aliases ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
r_u - > num_als_usrs1 = num_aliases ;
r_u - > ptr_als_usrs = 1 ;
r_u - > num_als_usrs2 = num_aliases ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
SMB_ASSERT_ARRAY ( r_u - > hdr_als_name , num_aliases ) ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < num_aliases ; i + + ) {
int als_len = als_name [ i ] ! = NULL ? strlen ( als_name [ i ] ) : 0 ;
init_uni_hdr ( & r_u - > hdr_als_name [ i ] , als_len ) ;
init_unistr2 ( & r_u - > uni_als_name [ i ] , als_name [ i ] , als_len ) ;
r_u - > num_als_usrs [ i ] = num_als_usrs [ i ] ;
}
} else {
r_u - > num_aliases1 = num_aliases ;
r_u - > ptr_aliases = 0 ;
r_u - > num_aliases2 = num_aliases ;
1998-12-05 02:06:27 +03:00
1999-12-13 16:27:58 +03:00
r_u - > num_als_usrs1 = num_aliases ;
r_u - > ptr_als_usrs = 0 ;
r_u - > num_als_usrs2 = num_aliases ;
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ;
1998-12-05 02:06:27 +03:00
}
1998-12-03 20:29:03 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_unknown_12 ( char * desc , SAMR_R_UNKNOWN_12 * r_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
int i ;
fstring tmp ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_unknown_12 " ) ;
depth + + ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_aliases1 " , ps , depth , & r_u - > num_aliases1 ) )
return False ;
if ( ! prs_uint32 ( " ptr_aliases " , ps , depth , & r_u - > ptr_aliases ) )
return False ;
if ( ! prs_uint32 ( " num_aliases2 " , ps , depth , & r_u - > num_aliases2 ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_aliases ! = 0 & & r_u - > num_aliases1 ! = 0 ) {
SMB_ASSERT_ARRAY ( r_u - > hdr_als_name , r_u - > num_aliases2 ) ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_aliases2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " als_hdr[%02d] " , i ) ;
if ( ! smb_io_unihdr ( " " , & r_u - > hdr_als_name [ i ] , ps , depth ) )
return False ;
}
for ( i = 0 ; i < r_u - > num_aliases2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " als_str[%02d] " , i ) ;
if ( ! smb_io_unistr2 ( " " , & r_u - > uni_als_name [ i ] , r_u - > hdr_als_name [ i ] . buffer , ps , depth ) )
return False ;
}
}
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " num_als_usrs1 " , ps , depth , & r_u - > num_als_usrs1 ) )
return False ;
if ( ! prs_uint32 ( " ptr_als_usrs " , ps , depth , & r_u - > ptr_als_usrs ) )
return False ;
if ( ! prs_uint32 ( " num_als_usrs2 " , ps , depth , & r_u - > num_als_usrs2 ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_als_usrs ! = 0 & & r_u - > num_als_usrs1 ! = 0 ) {
SMB_ASSERT_ARRAY ( r_u - > num_als_usrs , r_u - > num_als_usrs2 ) ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_als_usrs2 ; i + + ) {
slprintf ( tmp , sizeof ( tmp ) - 1 , " als_usrs[%02d] " , i ) ;
if ( ! prs_uint32 ( tmp , ps , depth , & r_u - > num_als_usrs [ i ] ) )
return False ;
}
}
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_OPEN_USER struct .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_open_user ( SAMR_Q_OPEN_USER * q_u ,
POLICY_HND * pol ,
uint32 unk_0 , uint32 rid )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " samr_init_q_open_user \n " ) ) ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_u - > domain_pol , pol , sizeof ( q_u - > domain_pol ) ) ;
q_u - > unknown_0 = unk_0 ;
q_u - > user_rid = rid ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_open_user ( char * desc , SAMR_Q_OPEN_USER * q_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_open_user " ) ;
1998-12-03 20:29:03 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " domain_pol " , & q_u - > domain_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & q_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " user_rid " , ps , depth , & q_u - > user_rid ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_open_user ( char * desc , SAMR_R_OPEN_USER * r_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_open_user " ) ;
1998-12-03 20:29:03 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " user_pol " , & r_u - > user_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_QUERY_USERGROUPS structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_query_usergroups ( SAMR_Q_QUERY_USERGROUPS * q_u ,
POLICY_HND * hnd )
{
DEBUG ( 5 , ( " init_samr_q_query_usergroups \n " ) ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_u - > pol , hnd , sizeof ( q_u - > pol ) ) ;
1998-12-03 20:29:03 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-03 20:29:03 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_query_usergroups ( char * desc , SAMR_Q_QUERY_USERGROUPS * q_u , prs_struct * ps , int depth )
1998-12-03 20:29:03 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_query_usergroups " ) ;
1998-12-03 20:29:03 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-03 20:29:03 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-03 20:29:03 +03:00
}
1998-12-02 04:13:02 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_QUERY_USERGROUPS structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_query_usergroups ( SAMR_R_QUERY_USERGROUPS * r_u ,
uint32 num_gids , DOM_GID * gid , uint32 status )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_query_usergroups \n " ) ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0x0 ) {
r_u - > ptr_0 = 1 ;
r_u - > num_entries = num_gids ;
r_u - > ptr_1 = 1 ;
r_u - > num_entries2 = num_gids ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
r_u - > gid = gid ;
} else {
r_u - > ptr_0 = 0 ;
r_u - > num_entries = 0 ;
r_u - > ptr_1 = 0 ;
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_query_usergroups ( char * desc , SAMR_R_QUERY_USERGROUPS * r_u , prs_struct * ps , int depth )
{
int i ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_query_usergroups " ) ;
depth + + ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_0 " , ps , depth , & r_u - > ptr_0 ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr_0 ! = 0 ) {
if ( ! prs_uint32 ( " num_entries " , ps , depth , & r_u - > num_entries ) )
return False ;
if ( ! prs_uint32 ( " ptr_1 " , ps , depth , & r_u - > ptr_1 ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > num_entries ! = 0 ) {
if ( ! prs_uint32 ( " num_entries2 " , ps , depth , & r_u - > num_entries2 ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < r_u - > num_entries2 ; i + + ) {
if ( ! smb_io_gid ( " " , & r_u - > gid [ i ] , ps , depth ) )
return False ;
}
}
1998-12-02 04:13:02 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_QUERY_USERINFO structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
void init_samr_q_query_userinfo ( SAMR_Q_QUERY_USERINFO * q_u ,
POLICY_HND * hnd , uint16 switch_value )
1998-12-02 04:13:02 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_q_query_userinfo \n " ) ) ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_u - > pol , hnd , sizeof ( q_u - > pol ) ) ;
q_u - > switch_value = switch_value ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_query_userinfo ( char * desc , SAMR_Q_QUERY_USERINFO * q_u , prs_struct * ps , int depth )
{
if ( q_u = = NULL )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_query_userinfo " ) ;
depth + + ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " switch_value " , ps , depth , & q_u - > switch_value ) ) /* 0x0015 or 0x0011 */
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a LOGON_HRS structure .
1998-12-02 04:13:02 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL sam_io_logon_hrs ( char * desc , LOGON_HRS * hrs , prs_struct * ps , int depth )
{
if ( hrs = = NULL )
return False ;
1998-12-02 04:13:02 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " sam_io_logon_hrs " ) ;
1998-12-02 04:13:02 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " len " , ps , depth , & hrs - > len ) )
return False ;
1999-10-21 23:02:57 +04:00
1999-12-13 16:27:58 +03:00
if ( hrs - > len > 64 ) {
DEBUG ( 5 , ( " sam_io_logon_hrs: truncating length \n " ) ) ;
hrs - > len = 64 ;
1998-12-02 04:13:02 +03:00
}
1999-12-13 16:27:58 +03:00
if ( ! prs_uint8s ( False , " hours " , ps , depth , hrs - > hours , hrs - > len ) )
return False ;
1999-10-21 23:02:57 +04:00
1999-10-15 22:46:22 +04:00
return True ;
1998-12-02 04:13:02 +03:00
}
1999-10-21 23:02:57 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_USER_INFO_10 structure .
1999-10-21 23:02:57 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_sam_user_info10 ( SAM_USER_INFO_10 * usr ,
uint32 acb_info )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_user_info10 \n " ) ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
usr - > acb_info = acb_info ;
1998-09-26 02:20:05 +04:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL sam_io_user_info10 ( char * desc , SAM_USER_INFO_10 * usr , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( usr = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_user_info10 " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " acb_info " , ps , depth , & usr - > acb_info ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAM_USER_INFO_11 structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_sam_user_info11 ( SAM_USER_INFO_11 * usr ,
NTTIME * expiry ,
char * mach_acct ,
uint32 rid_user ,
uint32 rid_group ,
uint16 acct_ctrl )
{
int len_mach_acct ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_sam_user_info11 \n " ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
len_mach_acct = strlen ( mach_acct ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & usr - > expiry , expiry , sizeof ( usr - > expiry ) ) ; /* expiry time or something? */
memset ( ( char * ) usr - > padding_1 , ' \0 ' , sizeof ( usr - > padding_1 ) ) ; /* 0 - padding 24 bytes */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & usr - > hdr_mach_acct , len_mach_acct ) ; /* unicode header for machine account */
usr - > padding_2 = 0 ; /* 0 - padding 4 bytes */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
usr - > ptr_1 = 1 ; /* pointer */
memset ( ( char * ) usr - > padding_3 , ' \0 ' , sizeof ( usr - > padding_3 ) ) ; /* 0 - padding 32 bytes */
usr - > padding_4 = 0 ; /* 0 - padding 4 bytes */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
usr - > ptr_2 = 1 ; /* pointer */
usr - > padding_5 = 0 ; /* 0 - padding 4 bytes */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
usr - > ptr_3 = 1 ; /* pointer */
memset ( ( char * ) usr - > padding_6 , ' \0 ' , sizeof ( usr - > padding_6 ) ) ; /* 0 - padding 32 bytes */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
usr - > rid_user = rid_user ;
usr - > rid_group = rid_group ;
1998-08-22 06:54:21 +04:00
1999-12-13 16:27:58 +03:00
usr - > acct_ctrl = acct_ctrl ;
usr - > unknown_3 = 0x0000 ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
usr - > unknown_4 = 0x003f ; /* 0x003f - 16 bit unknown */
usr - > unknown_5 = 0x003c ; /* 0x003c - 16 bit unknown */
1999-10-21 22:25:12 +04:00
1999-12-13 16:27:58 +03:00
memset ( ( char * ) usr - > padding_7 , ' \0 ' , sizeof ( usr - > padding_7 ) ) ; /* 0 - padding 16 bytes */
usr - > padding_8 = 0 ; /* 0 - padding 4 bytes */
init_unistr2 ( & usr - > uni_mach_acct , mach_acct , len_mach_acct ) ; /* unicode string for machine account */
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
memset ( ( char * ) usr - > padding_9 , ' \0 ' , sizeof ( usr - > padding_9 ) ) ; /* 0 - padding 48 bytes */
1998-03-12 00:11:04 +03:00
}
1999-11-16 01:43:08 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-11-16 01:43:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL sam_io_user_info11 ( char * desc , SAM_USER_INFO_11 * usr , prs_struct * ps , int depth )
{
if ( usr = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_r_unknown_24 " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint8s ( False , " padding_0 " , ps , depth , usr - > padding_0 , sizeof ( usr - > padding_0 ) ) )
return False ;
if ( ! smb_io_time ( " time " , & ( usr - > expiry ) , ps , depth ) )
return False ;
if ( ! prs_uint8s ( False , " padding_1 " , ps , depth , usr - > padding_1 , sizeof ( usr - > padding_1 ) ) )
return False ;
if ( ! smb_io_unihdr ( " unihdr " , & usr - > hdr_mach_acct , ps , depth ) )
return False ;
if ( ! prs_uint32 ( " padding_2 " , ps , depth , & usr - > padding_2 ) )
return False ;
if ( ! prs_uint32 ( " ptr_1 " , ps , depth , & usr - > ptr_1 ) )
return False ;
if ( ! prs_uint8s ( False , " padding_3 " , ps , depth , usr - > padding_3 , sizeof ( usr - > padding_3 ) ) )
return False ;
if ( ! prs_uint32 ( " padding_4 " , ps , depth , & usr - > padding_4 ) )
return False ;
if ( ! prs_uint32 ( " ptr_2 " , ps , depth , & usr - > ptr_2 ) )
return False ;
if ( ! prs_uint32 ( " padding_5 " , ps , depth , & usr - > padding_5 ) )
return False ;
if ( ! prs_uint32 ( " ptr_3 " , ps , depth , & usr - > ptr_3 ) )
return False ;
if ( ! prs_uint8s ( False , " padding_6 " , ps , depth , usr - > padding_6 , sizeof ( usr - > padding_6 ) ) )
return False ;
if ( ! prs_uint32 ( " rid_user " , ps , depth , & usr - > rid_user ) )
return False ;
if ( ! prs_uint32 ( " rid_group " , ps , depth , & usr - > rid_group ) )
return False ;
if ( ! prs_uint16 ( " acct_ctrl " , ps , depth , & usr - > acct_ctrl ) )
return False ;
if ( ! prs_uint16 ( " unknown_3 " , ps , depth , & usr - > unknown_3 ) )
return False ;
if ( ! prs_uint16 ( " unknown_4 " , ps , depth , & usr - > unknown_4 ) )
return False ;
if ( ! prs_uint16 ( " unknown_5 " , ps , depth , & usr - > unknown_5 ) )
return False ;
if ( ! prs_uint8s ( False , " padding_7 " , ps , depth , usr - > padding_7 , sizeof ( usr - > padding_7 ) ) )
return False ;
if ( ! prs_uint32 ( " padding_8 " , ps , depth , & usr - > padding_8 ) )
return False ;
if ( ! smb_io_unistr2 ( " unistr2 " , & usr - > uni_mach_acct , True , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint8s ( False , " padding_9 " , ps , depth , usr - > padding_9 , sizeof ( usr - > padding_9 ) ) )
return False ;
1999-11-16 01:43:08 +03:00
return True ;
}
1999-12-13 16:27:58 +03:00
/*************************************************************************
init_sam_user_info21
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
unknown_3 = 0x00ff ffff
unknown_5 = 0x0002 0000
unknown_6 = 0x0000 04 ec
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
void init_sam_user_info21 ( SAM_USER_INFO_21 * usr ,
NTTIME * logon_time ,
NTTIME * logoff_time ,
NTTIME * kickoff_time ,
NTTIME * pass_last_set_time ,
NTTIME * pass_can_change_time ,
NTTIME * pass_must_change_time ,
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
char * user_name ,
char * full_name ,
char * home_dir ,
char * dir_drive ,
char * logon_script ,
char * profile_path ,
char * description ,
char * workstations ,
char * unknown_str ,
char * munged_dial ,
1999-11-16 01:43:08 +03:00
1999-12-13 16:27:58 +03:00
uint32 user_rid ,
uint32 group_rid ,
uint16 acb_info ,
1998-03-12 00:11:04 +03:00
uint32 unknown_3 ,
uint16 logon_divs ,
LOGON_HRS * hrs ,
uint32 unknown_5 ,
uint32 unknown_6 )
{
1999-12-13 16:27:58 +03:00
int len_user_name = user_name ! = NULL ? strlen ( user_name ) : 0 ;
int len_full_name = full_name ! = NULL ? strlen ( full_name ) : 0 ;
int len_home_dir = home_dir ! = NULL ? strlen ( home_dir ) : 0 ;
int len_dir_drive = dir_drive ! = NULL ? strlen ( dir_drive ) : 0 ;
int len_logon_script = logon_script ! = NULL ? strlen ( logon_script ) : 0 ;
int len_profile_path = profile_path ! = NULL ? strlen ( profile_path ) : 0 ;
int len_description = description ! = NULL ? strlen ( description ) : 0 ;
int len_workstations = workstations ! = NULL ? strlen ( workstations ) : 0 ;
int len_unknown_str = unknown_str ! = NULL ? strlen ( unknown_str ) : 0 ;
int len_munged_dial = munged_dial ! = NULL ? strlen ( munged_dial ) : 0 ;
1998-03-12 00:11:04 +03:00
usr - > logon_time = * logon_time ;
usr - > logoff_time = * logoff_time ;
usr - > kickoff_time = * kickoff_time ;
usr - > pass_last_set_time = * pass_last_set_time ;
usr - > pass_can_change_time = * pass_can_change_time ;
usr - > pass_must_change_time = * pass_must_change_time ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & usr - > hdr_user_name , len_user_name ) ;
init_uni_hdr ( & usr - > hdr_full_name , len_full_name ) ;
init_uni_hdr ( & usr - > hdr_home_dir , len_home_dir ) ;
init_uni_hdr ( & usr - > hdr_dir_drive , len_dir_drive ) ;
init_uni_hdr ( & usr - > hdr_logon_script , len_logon_script ) ;
init_uni_hdr ( & usr - > hdr_profile_path , len_profile_path ) ;
init_uni_hdr ( & usr - > hdr_acct_desc , len_description ) ;
init_uni_hdr ( & usr - > hdr_workstations , len_workstations ) ;
init_uni_hdr ( & usr - > hdr_unknown_str , len_unknown_str ) ;
init_uni_hdr ( & usr - > hdr_munged_dial , len_munged_dial ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
memset ( ( char * ) usr - > nt_pwd , ' \0 ' , sizeof ( usr - > nt_pwd ) ) ;
memset ( ( char * ) usr - > lm_pwd , ' \0 ' , sizeof ( usr - > lm_pwd ) ) ;
1998-03-12 00:11:04 +03:00
usr - > user_rid = user_rid ;
usr - > group_rid = group_rid ;
usr - > acb_info = acb_info ;
usr - > unknown_3 = unknown_3 ; /* 0x00ff ffff */
usr - > logon_divs = logon_divs ; /* should be 168 (hours/week) */
usr - > ptr_logon_hrs = hrs ? 1 : 0 ;
usr - > unknown_5 = unknown_5 ; /* 0x0002 0000 */
1999-12-13 16:27:58 +03:00
memset ( ( char * ) usr - > padding1 , ' \0 ' , sizeof ( usr - > padding1 ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
init_unistr2 ( & usr - > uni_user_name , user_name , len_user_name ) ;
init_unistr2 ( & usr - > uni_full_name , full_name , len_full_name ) ;
init_unistr2 ( & usr - > uni_home_dir , home_dir , len_home_dir ) ;
init_unistr2 ( & usr - > uni_dir_drive , dir_drive , len_dir_drive ) ;
init_unistr2 ( & usr - > uni_logon_script , logon_script , len_logon_script ) ;
init_unistr2 ( & usr - > uni_profile_path , profile_path , len_profile_path ) ;
init_unistr2 ( & usr - > uni_acct_desc , description , len_description ) ;
init_unistr2 ( & usr - > uni_workstations , workstations , len_workstations ) ;
init_unistr2 ( & usr - > uni_unknown_str , unknown_str , len_unknown_str ) ;
init_unistr2 ( & usr - > uni_munged_dial , munged_dial , len_munged_dial ) ;
1998-03-12 00:11:04 +03:00
usr - > unknown_6 = unknown_6 ; /* 0x0000 04ec */
usr - > padding4 = 0 ;
if ( hrs )
memcpy ( & ( usr - > logon_hrs ) , hrs , sizeof ( usr - > logon_hrs ) ) ;
else
memset ( & ( usr - > logon_hrs ) , 0xff , sizeof ( usr - > logon_hrs ) ) ;
1999-12-13 16:27:58 +03:00
}
/*******************************************************************
Reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL sam_io_user_info21 ( char * desc , SAM_USER_INFO_21 * usr , prs_struct * ps , int depth )
{
if ( usr = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " lsa_io_user_info " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_time ( " logon_time " , & usr - > logon_time , ps , depth ) )
return False ;
if ( ! smb_io_time ( " logoff_time " , & usr - > logoff_time , ps , depth ) )
return False ;
if ( ! smb_io_time ( " kickoff_time " , & usr - > kickoff_time , ps , depth ) )
return False ;
if ( ! smb_io_time ( " pass_last_set_time " , & usr - > pass_last_set_time , ps , depth ) )
return False ;
if ( ! smb_io_time ( " pass_can_change_time " , & usr - > pass_can_change_time , ps , depth ) )
return False ;
if ( ! smb_io_time ( " pass_must_change_time " , & usr - > pass_must_change_time , ps , depth ) )
return False ;
if ( ! smb_io_unihdr ( " hdr_user_name " , & usr - > hdr_user_name , ps , depth ) ) /* username unicode string header */
return False ;
if ( ! smb_io_unihdr ( " hdr_full_name " , & usr - > hdr_full_name , ps , depth ) ) /* user's full name unicode string header */
return False ;
if ( ! smb_io_unihdr ( " hdr_home_dir " , & usr - > hdr_home_dir , ps , depth ) ) /* home directory unicode string header */
return False ;
if ( ! smb_io_unihdr ( " hdr_dir_drive " , & usr - > hdr_dir_drive , ps , depth ) ) /* home directory drive */
return False ;
if ( ! smb_io_unihdr ( " hdr_logon_script " , & usr - > hdr_logon_script , ps , depth ) ) /* logon script unicode string header */
return False ;
if ( ! smb_io_unihdr ( " hdr_profile_path " , & usr - > hdr_profile_path , ps , depth ) ) /* profile path unicode string header */
return False ;
if ( ! smb_io_unihdr ( " hdr_acct_desc " , & usr - > hdr_acct_desc , ps , depth ) ) /* account description */
return False ;
if ( ! smb_io_unihdr ( " hdr_workstations " , & usr - > hdr_workstations , ps , depth ) ) /* workstations user can log on from */
return False ;
if ( ! smb_io_unihdr ( " hdr_unknown_str " , & usr - > hdr_unknown_str , ps , depth ) ) /* unknown string */
return False ;
if ( ! smb_io_unihdr ( " hdr_munged_dial " , & usr - > hdr_munged_dial , ps , depth ) ) /* workstations user can log on from */
return False ;
if ( ! prs_uint8s ( False , " lm_pwd " , ps , depth , usr - > lm_pwd , sizeof ( usr - > lm_pwd ) ) )
return False ;
if ( ! prs_uint8s ( False , " nt_pwd " , ps , depth , usr - > nt_pwd , sizeof ( usr - > nt_pwd ) ) )
return False ;
if ( ! prs_uint32 ( " user_rid " , ps , depth , & usr - > user_rid ) ) /* User ID */
return False ;
if ( ! prs_uint32 ( " group_rid " , ps , depth , & usr - > group_rid ) ) /* Group ID */
return False ;
if ( ! prs_uint16 ( " acb_info " , ps , depth , & usr - > acb_info ) ) /* Group ID */
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " unknown_3 " , ps , depth , & usr - > unknown_3 ) )
return False ;
if ( ! prs_uint16 ( " logon_divs " , ps , depth , & usr - > logon_divs ) ) /* logon divisions per week */
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " ptr_logon_hrs " , ps , depth , & usr - > ptr_logon_hrs ) )
return False ;
if ( ! prs_uint32 ( " unknown_5 " , ps , depth , & usr - > unknown_5 ) )
return False ;
if ( ! prs_uint8s ( False , " padding1 " , ps , depth , usr - > padding1 , sizeof ( usr - > padding1 ) ) )
return False ;
/* here begins pointed-to data */
if ( ! smb_io_unistr2 ( " uni_user_name " , & usr - > uni_user_name , usr - > hdr_user_name . buffer , ps , depth ) ) /* username unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_full_name " , & usr - > uni_full_name , usr - > hdr_full_name . buffer , ps , depth ) ) /* user's full name unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_home_dir " , & usr - > uni_home_dir , usr - > hdr_home_dir . buffer , ps , depth ) ) /* home directory unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_dir_drive " , & usr - > uni_dir_drive , usr - > hdr_dir_drive . buffer , ps , depth ) ) /* home directory drive unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_logon_script " , & usr - > uni_logon_script , usr - > hdr_logon_script . buffer , ps , depth ) ) /* logon script unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_profile_path " , & usr - > uni_profile_path , usr - > hdr_profile_path . buffer , ps , depth ) ) /* profile path unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_acct_desc " , & usr - > uni_acct_desc , usr - > hdr_acct_desc . buffer , ps , depth ) ) /* user description unicode string */
return False ;
if ( ! smb_io_unistr2 ( " uni_workstations " , & usr - > uni_workstations , usr - > hdr_workstations . buffer , ps , depth ) ) /* worksations user can log on from */
return False ;
if ( ! smb_io_unistr2 ( " uni_unknown_str " , & usr - > uni_unknown_str , usr - > hdr_unknown_str . buffer , ps , depth ) ) /* unknown string */
return False ;
if ( ! smb_io_unistr2 ( " uni_munged_dial " , & usr - > uni_munged_dial , usr - > hdr_munged_dial . buffer , ps , depth ) ) /* worksations user can log on from */
return False ;
if ( ! prs_uint32 ( " unknown_6 " , ps , depth , & usr - > unknown_6 ) )
return False ;
if ( ! prs_uint32 ( " padding4 " , ps , depth , & usr - > padding4 ) )
return False ;
if ( usr - > ptr_logon_hrs ) {
if ( ! sam_io_logon_hrs ( " logon_hrs " , & usr - > logon_hrs , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
}
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1999-03-25 16:54:31 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_QUERY_USERINFO structure .
1999-03-25 16:54:31 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_query_userinfo ( SAMR_R_QUERY_USERINFO * r_u ,
uint16 switch_value , void * info , uint32 status )
1999-03-25 16:54:31 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_query_userinfo \n " ) ) ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
r_u - > ptr = 0 ;
r_u - > switch_value = 0 ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
if ( status = = 0 ) {
r_u - > switch_value = switch_value ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
switch ( switch_value ) {
case 0x10 :
r_u - > ptr = 1 ;
r_u - > info . id10 = ( SAM_USER_INFO_10 * ) info ;
1999-12-01 21:47:29 +03:00
break ;
1999-12-13 16:27:58 +03:00
case 0x11 :
r_u - > ptr = 1 ;
r_u - > info . id11 = ( SAM_USER_INFO_11 * ) info ;
1999-03-25 16:54:31 +03:00
break ;
1999-12-13 16:27:58 +03:00
case 21 :
r_u - > ptr = 1 ;
r_u - > info . id21 = ( SAM_USER_INFO_21 * ) info ;
break ;
1999-03-25 16:54:31 +03:00
default :
1999-12-13 16:27:58 +03:00
DEBUG ( 4 , ( " init_samr_r_query_aliasinfo: unsupported switch level \n " ) ) ;
break ;
1999-03-25 16:54:31 +03:00
}
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
r_u - > status = status ; /* return status */
1999-03-25 16:54:31 +03:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_query_userinfo ( char * desc , SAMR_R_QUERY_USERINFO * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_query_userinfo " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & r_u - > ptr ) )
return False ;
if ( ! prs_uint16 ( " switch_value " , ps , depth , & r_u - > switch_value ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( r_u - > ptr ! = 0 & & r_u - > switch_value ! = 0 ) {
switch ( r_u - > switch_value ) {
case 0x10 :
if ( r_u - > info . id10 ! = NULL ) {
if ( ! sam_io_user_info10 ( " " , r_u - > info . id10 , ps , depth ) )
return False ;
} else {
DEBUG ( 2 , ( " samr_io_r_query_userinfo: info pointer not initialised \n " ) ) ;
1999-10-15 22:46:22 +04:00
return False ;
1999-03-25 18:14:30 +03:00
}
break ;
1999-12-13 16:27:58 +03:00
/*
case 0x11 :
if ( r_u - > info . id11 ! = NULL ) {
if ( ! sam_io_user_info11 ( " " , r_u - > info . id11 , ps , depth ) )
return False ;
} else {
DEBUG ( 2 , ( " samr_io_r_query_userinfo: info pointer not initialised \n " ) ) ;
return False ;
1999-11-04 03:09:15 +03:00
}
1999-12-13 16:27:58 +03:00
break ;
*/
case 21 :
if ( r_u - > info . id21 ! = NULL ) {
if ( ! sam_io_user_info21 ( " " , r_u - > info . id21 , ps , depth ) )
return False ;
} else {
DEBUG ( 2 , ( " samr_io_r_query_userinfo: info pointer not initialised \n " ) ) ;
1999-10-15 22:46:22 +04:00
return False ;
1999-03-25 16:54:31 +03:00
}
break ;
default :
1999-12-13 16:27:58 +03:00
DEBUG ( 2 , ( " samr_io_r_query_userinfo: unknown switch level \n " ) ) ;
1999-03-25 16:54:31 +03:00
break ;
}
}
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-11-04 03:09:15 +03:00
1999-10-15 22:46:22 +04:00
return True ;
1999-03-25 16:54:31 +03:00
}
1999-11-04 03:09:15 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-11-04 03:09:15 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2000-09-27 17:02:57 +04:00
BOOL samr_io_q_create_user ( char * desc , SAMR_Q_CREATE_USER * q_u , prs_struct * ps , int depth )
1999-03-25 16:54:31 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
2000-09-27 17:02:57 +04:00
prs_debug ( ps , depth , desc , " samr_io_q_create_user " ) ;
1999-12-13 16:27:58 +03:00
depth + + ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-03-25 16:54:31 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " pol " , & q_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_unihdr ( " " , & q_u - > hdr_mach_acct , ps , depth ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_mach_acct , q_u - > hdr_mach_acct . buffer , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
2000-09-28 21:35:03 +04:00
if ( ! prs_uint32 ( " acb_info " , ps , depth , & q_u - > acb_info ) )
1999-12-13 16:27:58 +03:00
return False ;
2000-09-28 21:35:03 +04:00
if ( ! prs_uint32 ( " access_mask " , ps , depth , & q_u - > access_mask ) )
1999-12-13 16:27:58 +03:00
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2000-09-27 17:02:57 +04:00
BOOL samr_io_r_create_user ( char * desc , SAMR_R_CREATE_USER * r_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_unknown_32 " ) ;
1999-11-18 22:29:08 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_pol_hnd ( " pol " , & r_u - > pol , ps , depth ) )
return False ;
2000-09-28 21:35:03 +04:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & r_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " user_rid " , ps , depth , & r_u - > user_rid ) )
1999-12-13 16:27:58 +03:00
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-11-18 22:29:08 +03:00
return True ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_CONNECT structure .
1999-11-18 22:29:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_connect ( SAMR_Q_CONNECT * q_u ,
char * srv_name , uint32 unknown_0 )
{
int len_srv_name = strlen ( srv_name ) ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_q_connect \n " ) ) ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
/* make PDC server name \\server */
q_u - > ptr_srv_name = len_srv_name > 0 ? 1 : 0 ;
init_unistr2 ( & q_u - > uni_srv_name , srv_name , len_srv_name + 1 ) ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
/* example values: 0x0000 0002 */
q_u - > unknown_0 = unknown_0 ;
1999-11-18 22:29:08 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-11-18 22:29:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_connect ( char * desc , SAMR_Q_CONNECT * q_u , prs_struct * ps , int depth )
1999-11-18 22:29:08 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_connect " ) ;
1999-11-18 22:29:08 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_srv_name " , ps , depth , & q_u - > ptr_srv_name ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_srv_name , q_u - > ptr_srv_name , ps , depth ) )
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & q_u - > unknown_0 ) )
return False ;
1999-11-18 22:29:08 +03:00
return True ;
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-11-18 22:29:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_connect ( char * desc , SAMR_R_CONNECT * r_u , prs_struct * ps , int depth )
1999-11-18 22:29:08 +03:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_r_connect " ) ;
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_pol_hnd ( " connect_pol " , & r_u - > connect_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
return True ;
1999-11-18 22:29:08 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_CONNECT_ANON structure .
1999-11-18 22:29:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_connect_anon ( SAMR_Q_CONNECT_ANON * q_u )
{
DEBUG ( 5 , ( " init_q_connect_anon \n " ) ) ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
q_u - > ptr = 1 ;
q_u - > unknown_0 = 0x5c ; /* server name (?!!) */
q_u - > unknown_1 = 0x01 ;
q_u - > unknown_2 = 0x20 ;
1999-11-18 22:29:08 +03:00
}
1999-12-13 16:27:58 +03:00
1999-11-18 22:29:08 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1999-11-18 22:29:08 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_connect_anon ( char * desc , SAMR_Q_CONNECT_ANON * q_u , prs_struct * ps , int depth )
1999-11-18 22:29:08 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1999-11-18 22:29:08 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_connect_anon " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
return False ;
if ( ! prs_uint16 ( " unknown_0 " , ps , depth , & q_u - > unknown_0 ) )
return False ;
if ( ! prs_uint16 ( " unknown_1 " , ps , depth , & q_u - > unknown_1 ) )
return False ;
if ( ! prs_uint32 ( " unknown_2 " , ps , depth , & q_u - > unknown_2 ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_connect_anon ( char * desc , SAMR_R_CONNECT_ANON * r_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_connect_anon " ) ;
depth + + ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_pol_hnd ( " connect_pol " , & r_u - > connect_pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_OPEN_ALIAS structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_open_alias ( SAMR_Q_OPEN_ALIAS * q_u ,
uint32 unknown_0 , uint32 rid )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_q_open_alias \n " ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/* example values: 0x0000 0008 */
q_u - > unknown_0 = unknown_0 ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
q_u - > rid_alias = rid ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_q_open_alias ( char * desc , SAMR_Q_OPEN_ALIAS * q_u , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_q_open_alias " ) ;
1998-03-12 00:11:04 +03:00
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown_0 " , ps , depth , & q_u - > unknown_0 ) )
return False ;
if ( ! prs_uint32 ( " rid_alias " , ps , depth , & q_u - > rid_alias ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
1998-10-15 09:47:29 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-10-15 09:47:29 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL samr_io_r_open_alias ( char * desc , SAMR_R_OPEN_ALIAS * r_u , prs_struct * ps , int depth )
1998-10-15 09:47:29 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
prs_debug ( ps , depth , desc , " samr_io_r_open_alias " ) ;
depth + + ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_pol_hnd ( " pol " , & r_u - > pol , ps , depth ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-10-15 09:47:29 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_UNKNOWN_12 structure .
1998-10-15 09:47:29 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_12 ( SAMR_Q_UNKNOWN_12 * q_u ,
POLICY_HND * pol , uint32 rid ,
uint32 num_gids , uint32 * gid )
1998-10-15 09:47:29 +04:00
{
1999-12-13 16:27:58 +03:00
int i ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_r_unknwon_12 \n " ) ) ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_u - > pol , pol , sizeof ( * pol ) ) ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
q_u - > num_gids1 = num_gids ;
q_u - > rid = rid ;
q_u - > ptr = 0 ;
q_u - > num_gids2 = num_gids ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
for ( i = 0 ; i < num_gids ; i + + ) {
q_u - > gid [ i ] = gid [ i ] ;
}
1998-10-15 09:47:29 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_UNKNOWN_21 structure .
1998-10-15 09:47:29 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_21 ( SAMR_Q_UNKNOWN_21 * q_c ,
POLICY_HND * hnd , uint16 unk_1 , uint16 unk_2 )
1998-10-15 09:47:29 +04:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_q_unknown_21 \n " ) ) ;
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_c - > group_pol , hnd , sizeof ( q_c - > group_pol ) ) ;
q_c - > unknown_1 = unk_1 ;
q_c - > unknown_2 = unk_2 ;
}
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
/*******************************************************************
Inits a SAMR_Q_UNKNOWN_13 structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_13 ( SAMR_Q_UNKNOWN_13 * q_c ,
POLICY_HND * hnd , uint16 unk_1 , uint16 unk_2 )
{
DEBUG ( 5 , ( " init_samr_q_unknown_13 \n " ) ) ;
1999-10-15 22:46:22 +04:00
1999-12-13 16:27:58 +03:00
memcpy ( & q_c - > alias_pol , hnd , sizeof ( q_c - > alias_pol ) ) ;
q_c - > unknown_1 = unk_1 ;
q_c - > unknown_2 = unk_2 ;
1998-10-15 09:47:29 +04:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_Q_UNKNOWN_38 structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_unknown_38 ( SAMR_Q_UNKNOWN_38 * q_u , char * srv_name )
1998-09-26 02:20:05 +04:00
{
int len_srv_name = strlen ( srv_name ) ;
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_q_unknown_38 \n " ) ) ;
1998-09-26 02:20:05 +04:00
q_u - > ptr = 1 ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & q_u - > hdr_srv_name , len_srv_name ) ;
init_unistr2 ( & q_u - > uni_srv_name , srv_name , len_srv_name ) ;
1998-09-26 02:20:05 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_unknown_38 ( char * desc , SAMR_Q_UNKNOWN_38 * q_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
prs_debug ( ps , depth , desc , " samr_io_q_unknown_38 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & q_u - > ptr ) )
return False ;
if ( q_u - > ptr ! = 0 ) {
if ( ! smb_io_unihdr ( " " , & q_u - > hdr_srv_name , ps , depth ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_srv_name , q_u - > hdr_srv_name . buffer , ps , depth ) )
return False ;
1998-09-26 02:20:05 +04:00
}
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_UNKNOWN_38 structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_unknown_38 ( SAMR_R_UNKNOWN_38 * r_u )
{
DEBUG ( 5 , ( " init_r_unknown_38 \n " ) ) ;
1998-09-26 02:20:05 +04:00
1998-10-15 09:47:29 +04:00
r_u - > unk_0 = 0 ;
r_u - > unk_1 = 0 ;
r_u - > unk_2 = 0 ;
2000-05-16 23:45:26 +04:00
r_u - > unk_3 = 0 ;
1998-09-26 02:20:05 +04:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_unknown_38 ( char * desc , SAMR_R_UNKNOWN_38 * r_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
prs_debug ( ps , depth , desc , " samr_io_r_unknown_38 " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint16 ( " unk_0 " , ps , depth , & r_u - > unk_0 ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint16 ( " unk_1 " , ps , depth , & r_u - > unk_1 ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint16 ( " unk_2 " , ps , depth , & r_u - > unk_2 ) )
return False ;
if ( ! prs_align ( ps ) )
return False ;
2000-05-16 23:45:26 +04:00
if ( ! prs_uint16 ( " unk_3 " , ps , depth , & r_u - > unk_3 ) )
return False ;
if ( ! prs_align ( ps ) )
1999-12-13 16:27:58 +03:00
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
1998-10-10 03:31:50 +04:00
/*******************************************************************
make a SAMR_ENC_PASSWD structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_enc_passwd ( SAMR_ENC_PASSWD * pwd , char pass [ 512 ] )
{
1998-10-10 03:31:50 +04:00
pwd - > ptr = 1 ;
1998-11-20 23:44:21 +03:00
memcpy ( pwd - > pass , pass , sizeof ( pwd - > pass ) ) ;
1998-10-10 03:31:50 +04:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAMR_ENC_PASSWD structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_enc_passwd ( char * desc , SAMR_ENC_PASSWD * pwd , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( pwd = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
prs_debug ( ps , depth , desc , " samr_io_enc_passwd " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & pwd - > ptr ) )
return False ;
if ( ! prs_uint8s ( False , " pwd " , ps , depth , pwd - > pass , sizeof ( pwd - > pass ) ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
1998-10-10 03:31:50 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_ENC_HASH structure .
1998-10-10 03:31:50 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_enc_hash ( SAMR_ENC_HASH * hsh , uchar hash [ 16 ] )
{
1998-10-10 03:31:50 +04:00
hsh - > ptr = 1 ;
1998-11-20 23:44:21 +03:00
memcpy ( hsh - > hash , hash , sizeof ( hsh - > hash ) ) ;
1998-10-10 03:31:50 +04:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SAMR_ENC_HASH structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_enc_hash ( char * desc , SAMR_ENC_HASH * hsh , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( hsh = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
prs_debug ( ps , depth , desc , " samr_io_enc_hash " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr " , ps , depth , & hsh - > ptr ) )
return False ;
if ( ! prs_uint8s ( False , " hash " , ps , depth , hsh - > hash , sizeof ( hsh - > hash ) ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
1998-10-10 03:31:50 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_UNKNOWN_38 structure .
1998-10-10 03:31:50 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_q_chgpasswd_user ( SAMR_Q_CHGPASSWD_USER * q_u ,
1998-10-10 03:31:50 +04:00
char * dest_host , char * user_name ,
1998-10-21 20:58:34 +04:00
char nt_newpass [ 516 ] , uchar nt_oldhash [ 16 ] ,
char lm_newpass [ 516 ] , uchar lm_oldhash [ 16 ] )
1998-09-26 02:20:05 +04:00
{
1998-10-10 03:31:50 +04:00
int len_dest_host = strlen ( dest_host ) ;
int len_user_name = strlen ( user_name ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " init_samr_q_chgpasswd_user \n " ) ) ;
1998-09-26 02:20:05 +04:00
1998-10-10 03:31:50 +04:00
q_u - > ptr_0 = 1 ;
1999-12-13 16:27:58 +03:00
init_uni_hdr ( & q_u - > hdr_dest_host , len_dest_host ) ;
init_unistr2 ( & q_u - > uni_dest_host , dest_host , len_dest_host ) ;
init_uni_hdr ( & q_u - > hdr_user_name , len_user_name ) ;
init_unistr2 ( & q_u - > uni_user_name , user_name , len_user_name ) ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
init_enc_passwd ( & q_u - > nt_newpass , nt_newpass ) ;
init_enc_hash ( & q_u - > nt_oldhash , nt_oldhash ) ;
1998-09-26 02:20:05 +04:00
1998-10-10 03:31:50 +04:00
q_u - > unknown = 0x01 ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
init_enc_passwd ( & q_u - > lm_newpass , lm_newpass ) ;
init_enc_hash ( & q_u - > lm_oldhash , lm_oldhash ) ;
1998-10-21 20:28:44 +04:00
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_q_chgpasswd_user ( char * desc , SAMR_Q_CHGPASSWD_USER * q_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( q_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
1998-10-10 03:31:50 +04:00
prs_debug ( ps , depth , desc , " samr_io_q_chgpasswd_user " ) ;
depth + + ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " ptr_0 " , ps , depth , & q_u - > ptr_0 ) )
return False ;
1999-05-06 22:02:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_unihdr ( " " , & q_u - > hdr_dest_host , ps , depth ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_dest_host , q_u - > hdr_dest_host . buffer , ps , depth ) )
return False ;
if ( ! smb_io_unihdr ( " " , & q_u - > hdr_user_name , ps , depth ) )
return False ;
if ( ! smb_io_unistr2 ( " " , & q_u - > uni_user_name , q_u - > hdr_user_name . buffer , ps , depth ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! samr_io_enc_passwd ( " nt_newpass " , & q_u - > nt_newpass , ps , depth ) )
return False ;
if ( ! samr_io_enc_hash ( " nt_oldhash " , & q_u - > nt_oldhash , ps , depth ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " unknown " , ps , depth , & q_u - > unknown ) )
return False ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! samr_io_enc_passwd ( " lm_newpass " , & q_u - > lm_newpass , ps , depth ) )
return False ;
if ( ! samr_io_enc_hash ( " lm_oldhash " , & q_u - > lm_oldhash , ps , depth ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
1998-10-17 03:40:59 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Inits a SAMR_R_CHGPASSWD_USER structure .
1998-10-17 03:40:59 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
void init_samr_r_chgpasswd_user ( SAMR_R_CHGPASSWD_USER * r_u , uint32 status )
{
DEBUG ( 5 , ( " init_r_chgpasswd_user \n " ) ) ;
1998-10-17 03:40:59 +04:00
r_u - > status = status ;
}
1998-09-26 02:20:05 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a structure .
1998-09-26 02:20:05 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1999-10-15 22:46:22 +04:00
BOOL samr_io_r_chgpasswd_user ( char * desc , SAMR_R_CHGPASSWD_USER * r_u , prs_struct * ps , int depth )
1998-09-26 02:20:05 +04:00
{
1999-12-13 16:27:58 +03:00
if ( r_u = = NULL )
return False ;
1998-09-26 02:20:05 +04:00
1998-10-10 03:31:50 +04:00
prs_debug ( ps , depth , desc , " samr_io_r_chgpasswd_user " ) ;
depth + + ;
1998-09-26 02:20:05 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
1998-10-10 03:31:50 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_uint32 ( " status " , ps , depth , & r_u - > status ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-09-26 02:20:05 +04:00
}
2000-05-09 17:28:19 +04:00
2000-05-16 23:45:26 +04:00
/**********************************************************************
Reads or writes a structure
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL samr_io_q_lookup_domain ( char * desc , SAMR_Q_LOOKUP_DOMAIN * q_u , prs_struct * ps , int depth )
{
if ( q_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_q_lookup_domain " ) ;
depth + + ;
prs_align ( ps ) ;
smb_io_pol_hnd ( " connect_pol " , & ( q_u - > connect_pol ) , ps , depth ) ;
smb_io_unihdr ( " hdr_domain " , & ( q_u - > hdr_domain ) , ps , depth ) ;
smb_io_unistr2 ( " uni_domain " , & ( q_u - > uni_domain ) ,
q_u - > hdr_domain . buffer , ps , depth ) ;
prs_align ( ps ) ;
return True ;
}
/*******************************************************************
makes a SAMR_R_LOOKUP_DOMAIN structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL init_samr_r_lookup_domain ( SAMR_R_LOOKUP_DOMAIN * r_u ,
DOM_SID * dom_sid , uint32 status )
{
if ( r_u = = NULL )
return False ;
DEBUG ( 5 , ( " make_samr_r_lookup_domain \n " ) ) ;
r_u - > status = status ;
r_u - > ptr_sid = 0 ;
if ( status = = 0x0 )
{
r_u - > ptr_sid = 1 ;
init_dom_sid2 ( & r_u - > dom_sid , dom_sid ) ;
}
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL samr_io_r_lookup_domain ( char * desc , SAMR_R_LOOKUP_DOMAIN * r_u ,
prs_struct * ps , int depth )
{
if ( r_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_r_lookup_domain " ) ;
depth + + ;
prs_align ( ps ) ;
prs_uint32 ( " ptr " , ps , depth , & ( r_u - > ptr_sid ) ) ;
if ( r_u - > ptr_sid ! = 0 )
{
smb_io_dom_sid2 ( " sid " , & ( r_u - > dom_sid ) , ps , depth ) ;
prs_align ( ps ) ;
}
prs_uint32 ( " status " , ps , depth , & ( r_u - > status ) ) ;
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL samr_io_q_enum_domains ( char * desc , SAMR_Q_ENUM_DOMAINS * q_e ,
prs_struct * ps , int depth )
{
if ( q_e = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_q_enum_domains " ) ;
depth + + ;
prs_align ( ps ) ;
smb_io_pol_hnd ( " pol " , & ( q_e - > pol ) , ps , depth ) ;
prs_uint32 ( " start_idx " , ps , depth , & ( q_e - > start_idx ) ) ;
prs_uint32 ( " max_size " , ps , depth , & ( q_e - > max_size ) ) ;
prs_align ( ps ) ;
return True ;
}
/*******************************************************************
makes a SAMR_R_ENUM_DOMAINS structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL init_samr_r_enum_domains ( SAMR_R_ENUM_DOMAINS * r_u ,
uint32 next_idx , fstring * domains , uint32 num_sam_entries )
{
int i = 0 ;
if ( r_u = = NULL )
return False ;
DEBUG ( 5 , ( " init_samr_r_enum_domains \n " ) ) ;
r_u - > next_idx = next_idx ;
r_u - > uni_dom_name = ( UNISTR2 * ) malloc ( sizeof ( UNISTR2 ) * num_sam_entries ) ;
r_u - > sam = ( SAM_ENTRY * ) malloc ( sizeof ( SAM_ENTRY ) * num_sam_entries ) ;
if ( r_u - > uni_dom_name = = NULL | | r_u - > sam = = NULL )
{
free ( r_u - > uni_dom_name ) ;
free ( r_u - > sam ) ;
r_u - > status = NT_STATUS_MEMORY_NOT_ALLOCATED ;
}
if ( r_u - > status = = 0 )
for ( i = 0 ; i < num_sam_entries ; i + + ) /* only two domains to send */
{
init_unistr2 ( & r_u - > uni_dom_name [ i ] , domains [ i ] , strlen ( domains [ i ] ) ) ;
init_sam_entry ( & ( r_u - > sam [ i ] ) , strlen ( domains [ i ] ) , 0 ) ;
}
else
{
num_sam_entries = 0 ;
}
if ( num_sam_entries ! = 0 )
{
r_u - > ptr_entries1 = 1 ;
r_u - > ptr_entries2 = 1 ;
r_u - > num_entries2 = num_sam_entries ;
r_u - > num_entries3 = num_sam_entries ;
r_u - > num_entries4 = num_sam_entries ;
}
else
{
r_u - > ptr_entries1 = 0 ;
r_u - > num_entries2 = num_sam_entries ;
r_u - > ptr_entries2 = 1 ;
}
return True ;
}
/*******************************************************************
reads or writes a structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL samr_io_r_enum_domains ( char * desc , SAMR_R_ENUM_DOMAINS * r_u ,
prs_struct * ps , int depth )
{
uint32 i ;
if ( r_u = = NULL )
return False ;
prs_debug ( ps , depth , desc , " samr_io_r_enum_domains " ) ;
depth + + ;
prs_align ( ps ) ;
prs_uint32 ( " next_idx " , ps , depth , & ( r_u - > next_idx ) ) ;
prs_uint32 ( " ptr_entries1 " , ps , depth , & ( r_u - > ptr_entries1 ) ) ;
if ( r_u - > ptr_entries1 ! = 0 )
{
prs_uint32 ( " num_entries2 " , ps , depth , & ( r_u - > num_entries2 ) ) ;
prs_uint32 ( " ptr_entries2 " , ps , depth , & ( r_u - > ptr_entries2 ) ) ;
prs_uint32 ( " num_entries3 " , ps , depth , & ( r_u - > num_entries3 ) ) ;
2000-05-09 17:28:19 +04:00
2000-05-16 23:45:26 +04:00
if ( UNMARSHALLING ( ps ) )
{
r_u - > sam = ( SAM_ENTRY * ) malloc ( sizeof ( SAM_ENTRY ) *
r_u - > num_entries2 ) ;
r_u - > uni_dom_name = ( UNISTR2 * ) malloc ( sizeof ( UNISTR2 ) *
r_u - > num_entries2 ) ;
}
2000-05-09 17:28:19 +04:00
2000-05-16 23:45:26 +04:00
if ( ( r_u - > sam = = NULL | | r_u - > uni_dom_name = = NULL )
& & r_u - > num_entries2 ! = 0 )
{
DEBUG ( 0 , ( " NULL pointers in SAMR_R_ENUM_DOMAINS \n " ) ) ;
r_u - > num_entries4 = 0 ;
r_u - > status = NT_STATUS_MEMORY_NOT_ALLOCATED ;
return False ;
}
for ( i = 0 ; i < r_u - > num_entries2 ; i + + )
{
fstring tmp ;
slprintf ( tmp , sizeof ( tmp ) - 1 , " domains[%d] " , i ) ;
sam_io_sam_entry ( tmp , & ( r_u - > sam [ i ] ) , ps , depth ) ;
}
for ( i = 0 ; i < r_u - > num_entries2 ; i + + )
{
fstring tmp ;
slprintf ( tmp , sizeof ( tmp ) - 1 , " domains[%d] " , i ) ;
smb_io_unistr2 ( tmp , & ( r_u - > uni_dom_name [ i ] ) ,
r_u - > sam [ i ] . hdr_name . buffer , ps ,
depth ) ;
prs_align ( ps ) ;
}
prs_align ( ps ) ;
}
prs_uint32 ( " num_entries4 " , ps , depth , & ( r_u - > num_entries4 ) ) ;
prs_uint32 ( " status " , ps , depth , & ( r_u - > status ) ) ;
return True ;
}
# undef OLD_NTDOMAIN