Add 'net rpc group add'. For this parse_samr.c had to be changed: The
[samba.git] / source / include / rpc_samr.h
index c769cf43817675b9bc0cd9407916543a67ebcc05..111e62c3553315899438394a71626d123b6cac89 100644 (file)
@@ -1,10 +1,12 @@
 /* 
-   Unix SMB/Netbios implementation.
-   Version 1.9.
+   Unix SMB/CIFS implementation.
    SMB parameters and setup
    Copyright (C) Andrew Tridgell              1992-2000
    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
    Copyright (C) Paul Ashton                  1997-2000
+   Copyright (C) Jean François Micouleau      1998-2001
+   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
+   
    
    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
 #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
 #define _RPC_SAMR_H 
 
-
 #include "rpc_misc.h"
 
-
 /*******************************************************************
  the following information comes from a QuickView on samsrv.dll,
  and gives an idea of exactly what is needed:
@@ -79,7 +79,7 @@ SamrTestPrivateFunctionsUser
 
 #define SAMR_CONNECT_ANON      0x00
 #define SAMR_CLOSE_HND         0x01
-#define SAMR_UNKNOWN_2         0x02 /* set sec object? */
+#define SAMR_SET_SEC_OBJECT    0x02
 #define SAMR_QUERY_SEC_OBJECT  0x03
 
 #define SAMR_UNKNOWN_4         0x04 /* profile info? */
@@ -87,6 +87,7 @@ SamrTestPrivateFunctionsUser
 #define SAMR_ENUM_DOMAINS      0x06
 #define SAMR_OPEN_DOMAIN       0x07
 #define SAMR_QUERY_DOMAIN_INFO 0x08
+#define SAMR_SET_DOMAIN_INFO   0x09
 
 #define SAMR_CREATE_DOM_GROUP  0x0a
 #define SAMR_ENUM_DOM_GROUPS   0x0b
@@ -126,8 +127,8 @@ SamrTestPrivateFunctionsUser
 #define SAMR_UNKNOWN_2a        0x2a
 #define SAMR_UNKNOWN_2b        0x2b
 #define SAMR_GET_USRDOM_PWINFO 0x2c
-#define SAMR_UNKNOWN_2D        0x2d
-#define SAMR_UNKNOWN_2e        0x2e
+#define SAMR_REMOVE_SID_FOREIGN_DOMAIN        0x2d
+#define SAMR_UNKNOWN_2E        0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */
 #define SAMR_UNKNOWN_2f        0x2f
 #define SAMR_QUERY_DISPINFO3   0x30 /* Alias for SAMR_QUERY_DISPINFO
                                       with info level 3 */
@@ -143,8 +144,7 @@ SamrTestPrivateFunctionsUser
 #define SAMR_GET_DOM_PWINFO    0x38
 #define SAMR_CONNECT           0x39
 #define SAMR_SET_USERINFO      0x3A
-
-
+#define SAMR_CONNECT4          0x3E
 
 typedef struct logon_hours_info
 {
@@ -183,15 +183,21 @@ typedef struct sam_user_info_23
 
        uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
 
-       uint32 unknown_3; /* 0x09f8 27fa */
+       uint32 fields_present; /* 0x09f8 27fa */
 
        uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
        /* uint8 pad[2] */
        uint32 ptr_logon_hrs; /* pointer to logon hours */
 
-       uint8 padding1[8];
+       /* Was unknown_5. */
+       uint16 bad_password_count;
+       uint16 logon_count;
+
+       uint8 padding1[6];
+               
+       uint8 passmustchange; /* 0x00 must change = 0x01 */
 
-       uint32 unknown_5;     /* 0x0001 0000 */
+       uint8 padding2;
 
        uint8 pass[516];
 
@@ -217,10 +223,61 @@ typedef struct sam_user_info_23
 typedef struct sam_user_info_24
 {
        uint8 pass[516];
-       uint16 unk_0;
-
+       uint16 pw_len;
 } SAM_USER_INFO_24;
 
+/*
+ * NB. This structure is *definately* incorrect. It's my best guess
+ * currently for W2K SP2. The password field is encrypted in a different
+ * way than normal... And there are definately other problems. JRA.
+ */
+
+/* SAM_USER_INFO_25 */
+typedef struct sam_user_info_25
+{
+       /* TIMES MAY NOT IN RIGHT ORDER!!!! */
+       NTTIME logon_time;            /* logon time */
+       NTTIME logoff_time;           /* logoff time */
+       NTTIME kickoff_time;          /* kickoff time */
+       NTTIME pass_last_set_time;    /* password last set time */
+       NTTIME pass_can_change_time;  /* password can change time */
+       NTTIME pass_must_change_time; /* password must change time */
+
+       UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
+       UNIHDR hdr_full_name;    /* user's full name unicode string header */
+       UNIHDR hdr_home_dir;     /* home directory unicode string header */
+       UNIHDR hdr_dir_drive;    /* home drive unicode string header */
+       UNIHDR hdr_logon_script; /* logon script unicode string header */
+       UNIHDR hdr_profile_path; /* profile path unicode string header */
+       UNIHDR hdr_acct_desc  ;  /* user description */
+       UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
+       UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
+       UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
+
+       uint8 lm_pwd[16];    /* lm user passwords */
+       uint8 nt_pwd[16];    /* nt user passwords */
+
+       uint32 user_rid;      /* Primary User ID */
+       uint32 group_rid;     /* Primary Group ID */
+
+       uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
+
+       uint32 unknown_6[6];
+
+       uint8 pass[532];
+
+       UNISTR2 uni_user_name;    /* NULL - username unicode string */
+       UNISTR2 uni_full_name;    /* user's full name unicode string */
+       UNISTR2 uni_home_dir;     /* home directory unicode string */
+       UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
+       UNISTR2 uni_logon_script; /* logon script unicode string */
+       UNISTR2 uni_profile_path; /* profile path unicode string */
+       UNISTR2 uni_acct_desc  ;  /* user description unicode string */
+       UNISTR2 uni_workstations; /* login from workstations unicode string */
+       UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
+       UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
+} SAM_USER_INFO_25;
+
 
 /* SAM_USER_INFO_21 */
 typedef struct sam_user_info_21
@@ -251,15 +308,22 @@ typedef struct sam_user_info_21
 
        uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
 
-       uint32 unknown_3; /* 0x00ff ffff */
+       /* Was unknown_3 */
+       uint32 fields_present; /* 0x00ff ffff */
 
        uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
        /* uint8 pad[2] */
        uint32 ptr_logon_hrs; /* unknown pointer */
 
-       uint32 unknown_5;     /* 0x0002 0000 */
+       /* Was unknown_5. */
+       uint16 bad_password_count;
+       uint16 logon_count;
 
-       uint8 padding1[8];
+       uint8 padding1[6];
+               
+       uint8 passmustchange; /* 0x00 must change = 0x01 */
+
+       uint8 padding2;
 
        UNISTR2 uni_user_name;    /* username unicode string */
        UNISTR2 uni_full_name;    /* user's full name unicode string */
@@ -279,6 +343,17 @@ typedef struct sam_user_info_21
 
 } SAM_USER_INFO_21;
 
+#define PASS_MUST_CHANGE_AT_NEXT_LOGON 0x01
+#define PASS_DONT_CHANGE_AT_NEXT_LOGON 0x00
+
+/* SAM_USER_INFO_20 */
+typedef struct sam_user_info_20
+{
+       UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
+
+       UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
+
+} SAM_USER_INFO_20;
 
 /* SAM_USER_INFO_12 */
 typedef struct sam_user_info_12
@@ -351,7 +426,7 @@ typedef struct q_samr_close_hnd_info
 typedef struct r_samr_close_hnd_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_CLOSE_HND;
 
@@ -378,10 +453,30 @@ typedef struct r_samr_usrdom_pwinfo_info
        uint16 unknown_0; /* 0000 */
        uint16 unknown_1; /* 0x0016 or 0x0015 */
        uint32 unknown_2; /* 0x0000 0000 */
-       uint32 status; 
+       NTSTATUS status; 
 
 } SAMR_R_GET_USRDOM_PWINFO;
 
+/****************************************************************************
+SAMR_Q_SET_SEC_OBJ - info level 4.
+*****************************************************************************/
+
+/* SAMR_Q_SET_SEC_OBJ - */
+typedef struct q_samr_set_sec_obj_info
+{
+       POLICY_HND pol;          /* policy handle */
+       uint32 sec_info;         /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
+       SEC_DESC_BUF *buf;
+
+} SAMR_Q_SET_SEC_OBJ;
+
+/* SAMR_R_SET_SEC_OBJ - */
+typedef struct r_samr_set_sec_obj_info
+{
+       NTSTATUS status;         /* return status */
+
+} SAMR_R_SET_SEC_OBJ;
+
 
 /****************************************************************************
 SAMR_Q_QUERY_SEC_OBJ - info level 4.  returns SIDs.
@@ -399,9 +494,9 @@ typedef struct q_samr_query_sec_obj_info
 typedef struct r_samr_query_sec_obj_info
 {
        uint32 ptr;
-       SEC_DESC_BUF buf;
+       SEC_DESC_BUF *buf;
 
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_QUERY_SEC_OBJ;
 
@@ -420,8 +515,10 @@ typedef struct q_samr_query_domain_info
 
 typedef struct sam_unknown_info_3_info
 {
-       uint32 unknown_0; /* 0x0000 0000 */
-       uint32 unknown_1; /* 0x8000 0000 */
+       NTTIME logout;  
+       /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
+
+       /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
 
 } SAM_UNK_INFO_3;
 
@@ -442,15 +539,19 @@ typedef struct sam_unknown_info_7_info
 
 typedef struct sam_unknown_info_12_inf
 {
-       uint32 unknown_0; /* 0xcf1d cc00 */
-       uint32 unknown_1; /* 0xffff fffb */
-       uint32 unknown_2; /* 0xcf1d cc00 */
-       uint32 unknown_3; /* 0xffff fffb */
-       
-       uint32 unknown_4; /* 0x8a88 0000 */
+       NTTIME duration;
+       NTTIME reset_count;
+       uint16 bad_attempt_lockout;
 
 } SAM_UNK_INFO_12;
 
+typedef struct sam_unknown_info_5_inf
+{
+       UNIHDR hdr_server; /* server name unicode header */
+       UNISTR2 uni_server; /* server name unicode string */
+
+} SAM_UNK_INFO_5;
+
 typedef struct sam_unknown_info_2_inf
 {
        uint32 unknown_0; /* 0x0000 0000 */
@@ -484,9 +585,11 @@ typedef struct sam_unknown_info_2_inf
 
 typedef struct sam_unknown_info_1_inf
 {
-       uint8 padding[12]; /* 12 bytes zeros */
-       uint32 unknown_1; /* 0x8000 0000 */
-       uint32 unknown_2; /* 0x0000 0000 */
+       uint16 min_length_password;
+       uint16 password_history;
+       uint32 flag;
+       NTTIME expire;
+       NTTIME min_passwordage;
 
 } SAM_UNK_INFO_1;
 
@@ -498,6 +601,7 @@ typedef struct sam_unknown_ctr_info
                SAM_UNK_INFO_1 inf1;
                SAM_UNK_INFO_2 inf2;
                SAM_UNK_INFO_3 inf3;
+               SAM_UNK_INFO_5 inf5;
                SAM_UNK_INFO_6 inf6;
                SAM_UNK_INFO_7 inf7;
                SAM_UNK_INFO_12 inf12;
@@ -515,7 +619,7 @@ typedef struct r_samr_query_domain_info
 
        SAM_UNK_CTR *ctr;
 
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_QUERY_DOMAIN_INFO;
 
@@ -537,7 +641,7 @@ typedef struct r_samr_lookup_domain_info
        uint32   ptr_sid;
        DOM_SID2 dom_sid;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_LOOKUP_DOMAIN;
 
@@ -552,7 +656,7 @@ SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
 /* SAMR_Q_OPEN_DOMAIN */
 typedef struct q_samr_open_domain_info
 {
-       POLICY_HND connect_pol;   /* policy handle */
+       POLICY_HND pol;   /* policy handle */
        uint32 flags;               /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
        DOM_SID2 dom_sid;         /* domain SID */
 
@@ -563,11 +667,14 @@ typedef struct q_samr_open_domain_info
 typedef struct r_samr_open_domain_info
 {
        POLICY_HND domain_pol; /* policy handle associated with the SID */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_OPEN_DOMAIN;
 
-#define MAX_SAM_ENTRIES 250
+#define MAX_SAM_ENTRIES_W2K 0x400
+#define MAX_SAM_ENTRIES_W95 50
+/* The following should be the greater of the preceeding two. */
+#define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K
 
 typedef struct samr_entry_info
 {
@@ -603,7 +710,7 @@ typedef struct r_samr_enum_domains_info
 
        uint32 num_entries4;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_ENUM_DOMAINS;
 
@@ -637,7 +744,7 @@ typedef struct r_samr_enum_dom_users_info
 
        uint32 num_entries4;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_ENUM_DOM_USERS;
 
@@ -671,7 +778,7 @@ typedef struct r_samr_enum_dom_groups_info
 
        uint32 num_entries4;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_ENUM_DOM_GROUPS;
 
@@ -705,7 +812,7 @@ typedef struct r_samr_enum_dom_aliases_info
 
        uint32 num_entries4;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_ENUM_DOM_ALIASES;
 
@@ -718,7 +825,6 @@ typedef struct samr_entry_info1
 
        uint32 rid_user;
        uint16 acb_info;
-       uint16 pad;
 
        UNIHDR hdr_acct_name;
        UNIHDR hdr_user_name;
@@ -736,8 +842,8 @@ typedef struct samr_str_entry_info1
 
 typedef struct sam_entry_info_1
 {
-       SAM_ENTRY1 sam[MAX_SAM_ENTRIES];
-       SAM_STR1   str[MAX_SAM_ENTRIES];
+       SAM_ENTRY1 *sam;
+       SAM_STR1   *str;
 
 } SAM_DISPINFO_1;
 
@@ -750,7 +856,6 @@ typedef struct samr_entry_info2
 
        uint32 rid_user;
        uint16 acb_info;
-       uint16 pad;
 
        UNIHDR hdr_srv_name;
        UNIHDR hdr_srv_desc;
@@ -766,8 +871,8 @@ typedef struct samr_str_entry_info2
 
 typedef struct sam_entry_info_2
 {
-       SAM_ENTRY2 sam[MAX_SAM_ENTRIES];
-       SAM_STR2   str[MAX_SAM_ENTRIES];
+       SAM_ENTRY2 *sam;
+       SAM_STR2   *str;
 
 } SAM_DISPINFO_2;
 
@@ -795,8 +900,8 @@ typedef struct samr_str_entry_info3
 
 typedef struct sam_entry_info_3
 {
-       SAM_ENTRY3 sam[MAX_SAM_ENTRIES];
-       SAM_STR3   str[MAX_SAM_ENTRIES];
+       SAM_ENTRY3 *sam;
+       SAM_STR3   *str;
 
 } SAM_DISPINFO_3;
 
@@ -818,8 +923,8 @@ typedef struct samr_str_entry_info4
 
 typedef struct sam_entry_info_4
 {
-       SAM_ENTRY4 sam[MAX_SAM_ENTRIES];
-       SAM_STR4   str[MAX_SAM_ENTRIES];
+       SAM_ENTRY4 *sam;
+       SAM_STR4   *str;
 
 } SAM_DISPINFO_4;
 
@@ -841,8 +946,8 @@ typedef struct samr_str_entry_info5
 
 typedef struct sam_entry_info_5
 {
-       SAM_ENTRY5 sam[MAX_SAM_ENTRIES];
-       SAM_STR5   str[MAX_SAM_ENTRIES];
+       SAM_ENTRY5 *sam;
+       SAM_STR5   *str;
 
 } SAM_DISPINFO_5;
 
@@ -896,7 +1001,7 @@ typedef struct r_samr_query_dispinfo_info
 
        SAM_DISPINFO_CTR *ctr;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_QUERY_DISPINFO;
 
@@ -913,7 +1018,7 @@ typedef struct q_samr_delete_dom_group_info
 typedef struct r_samr_delete_dom_group_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;        /* return status */
+       NTSTATUS status;        /* return status */
 
 } SAMR_R_DELETE_DOM_GROUP;
 
@@ -936,7 +1041,7 @@ typedef struct r_samr_create_dom_group_info
        POLICY_HND pol;        /* policy handle */
 
        uint32 rid;    
-       uint32 status;    
+       NTSTATUS status;    
 
 } SAMR_R_CREATE_DOM_GROUP;
 
@@ -963,8 +1068,15 @@ typedef struct samr_group_info1
 
 } GROUP_INFO1;
 
+typedef struct samr_group_info3
+{
+       uint32 unknown_1; /* 0x0000 0003 - number of group members? */
+
+} GROUP_INFO3;
+
 typedef struct samr_group_info4
 {
+       uint16 level;
        UNIHDR hdr_acct_desc;
        UNISTR2 uni_acct_desc;
 
@@ -974,12 +1086,12 @@ typedef struct samr_group_info4
 typedef struct group_info_ctr
 {
        uint16 switch_value1;
-       uint16 switch_value2;
 
        union
        {
-               GROUP_INFO4 info4;
                GROUP_INFO1 info1;
+               GROUP_INFO3 info3;
+               GROUP_INFO4 info4;
 
        } group;
 
@@ -991,7 +1103,7 @@ typedef struct r_samr_query_groupinfo_info
        uint32 ptr;        
        GROUP_INFO_CTR *ctr;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_QUERY_GROUPINFO;
 
@@ -1007,7 +1119,7 @@ typedef struct q_samr_set_group_info
 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
 typedef struct r_samr_set_group_info
 {
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_SET_GROUPINFO;
 
@@ -1024,7 +1136,7 @@ typedef struct q_samr_delete_dom_alias_info
 typedef struct r_samr_delete_dom_alias_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;        /* return status */
+       NTSTATUS status;        /* return status */
 
 } SAMR_R_DELETE_DOM_ALIAS;
 
@@ -1047,7 +1159,7 @@ typedef struct r_samr_create_dom_alias_info
        POLICY_HND alias_pol;        /* policy handle */
 
        uint32 rid;    
-       uint32 status;    
+       NTSTATUS status;    
 
 } SAMR_R_CREATE_DOM_ALIAS;
 
@@ -1060,6 +1172,16 @@ typedef struct q_samr_query_alias_info
 
 } SAMR_Q_QUERY_ALIASINFO;
 
+typedef struct samr_alias_info1
+{
+       UNIHDR hdr_acct_name;
+       UNIHDR hdr_acct_desc;
+       uint32 num_member;
+       UNISTR2 uni_acct_name;
+       UNISTR2 uni_acct_desc;
+
+} ALIAS_INFO1;
+
 typedef struct samr_alias_info3
 {
        UNIHDR hdr_acct_desc;
@@ -1075,6 +1197,7 @@ typedef struct alias_info_ctr
 
        union
        {
+               ALIAS_INFO1 info1;
                ALIAS_INFO3 info3;
 
        } alias;
@@ -1085,9 +1208,9 @@ typedef struct alias_info_ctr
 typedef struct r_samr_query_aliasinfo_info
 {
        uint32 ptr;        
-       ALIAS_INFO_CTR *ctr;
+       ALIAS_INFO_CTR ctr;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_QUERY_ALIASINFO;
 
@@ -1096,14 +1219,14 @@ typedef struct r_samr_query_aliasinfo_info
 typedef struct q_samr_set_alias_info
 {
        POLICY_HND alias_pol;        /* policy handle */
-       ALIAS_INFO_CTR *ctr;
+       ALIAS_INFO_CTR ctr;
 
 } SAMR_Q_SET_ALIASINFO;
 
 /* SAMR_R_SET_ALIASINFO - SAM alias info */
 typedef struct r_samr_set_aliasinfo_info
 {
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_SET_ALIASINFO;
 
@@ -1125,7 +1248,7 @@ typedef struct r_samr_query_usergroup_info
 
        DOM_GID *gid; /* group info */
 
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_QUERY_USERGROUPS;
 
@@ -1139,9 +1262,11 @@ typedef struct sam_userinfo_ctr_info
                SAM_USER_INFO_10 *id10; /* auth-level 0x10 */
                SAM_USER_INFO_11 *id11; /* auth-level 0x11 */
                SAM_USER_INFO_12 *id12; /* auth-level 0x12 */
+               SAM_USER_INFO_20 *id20; /* auth-level 20 */
                SAM_USER_INFO_21 *id21; /* auth-level 21 */
                SAM_USER_INFO_23 *id23; /* auth-level 0x17 */
                SAM_USER_INFO_24 *id24; /* auth-level 0x18 */
+               SAM_USER_INFO_25 *id25; /* auth-level 0x19 */
                void* id; /* to make typecasting easy */
 
        } info;
@@ -1162,7 +1287,7 @@ typedef struct q_samr_set_user_info2
 /* SAMR_R_SET_USERINFO2 - set sam info */
 typedef struct r_samr_set_user_info2
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_SET_USERINFO2;
 
@@ -1178,7 +1303,7 @@ typedef struct q_samr_set_user_info
 /* SAMR_R_SET_USERINFO - set sam info */
 typedef struct r_samr_set_user_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_SET_USERINFO;
 
@@ -1197,7 +1322,7 @@ typedef struct r_samr_query_user_info
        uint32 ptr;            /* pointer */
        SAM_USERINFO_CTR *ctr;
 
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_QUERY_USERINFO;
 
@@ -1233,7 +1358,7 @@ typedef struct r_samr_query_useraliases_info
        uint32 num_entries2; 
        uint32 *rid; /* domain RIDs being looked up */
 
-       uint32 status; /* return code */
+       NTSTATUS status; /* return code */
 
 } SAMR_R_QUERY_USERALIASES;
 
@@ -1251,8 +1376,8 @@ typedef struct q_samr_lookup_names_info
        uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
        uint32 num_names2;      /* number of names being looked up */
 
-       UNIHDR  hdr_name[MAX_LOOKUP_SIDS]; /* unicode account name header */
-       UNISTR2 uni_name[MAX_LOOKUP_SIDS]; /* unicode account name string */
+       UNIHDR  *hdr_name; /* unicode account name header */
+       UNISTR2 *uni_name; /* unicode account name string */
 
 } SAMR_Q_LOOKUP_NAMES;
 
@@ -1272,7 +1397,7 @@ typedef struct r_samr_lookup_names_info
 
        uint32 *types; /* SID_ENUM type */
 
-       uint32 status; /* return code */
+       NTSTATUS status; /* return code */
 
 } SAMR_R_LOOKUP_NAMES;
 
@@ -1317,7 +1442,7 @@ typedef struct r_samr_lookup_rids_info
 
        uint32 *type; /* SID_ENUM type */
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_LOOKUP_RIDS;
 
@@ -1336,7 +1461,7 @@ typedef struct q_samr_open_user_info
 typedef struct r_samr_open_user_info
 {
        POLICY_HND user_pol;       /* policy handle associated with unknown id */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_OPEN_USER;
 
@@ -1360,9 +1485,9 @@ typedef struct r_samr_create_user_info
 {
        POLICY_HND user_pol;       /* policy handle associated with user */
 
-       uint32 unknown_0;     /* 0x0007 03ff */
+       uint32 access_granted;
        uint32 user_rid;      /* user RID */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_CREATE_USER;
 
@@ -1379,7 +1504,7 @@ typedef struct q_samr_delete_dom_user_info
 typedef struct r_samr_delete_dom_user_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;        /* return status */
+       NTSTATUS status;        /* return status */
 
 } SAMR_R_DELETE_DOM_USER;
 
@@ -1407,7 +1532,7 @@ typedef struct r_samr_query_groupmem_info
        uint32 num_attrs;
        uint32 *attr;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_QUERY_GROUPMEM;
 
@@ -1416,7 +1541,6 @@ typedef struct r_samr_query_groupmem_info
 typedef struct q_samr_del_group_mem_info
 {
        POLICY_HND pol;       /* policy handle */
-
        uint32 rid;         /* rid */
 
 } SAMR_Q_DEL_GROUPMEM;
@@ -1425,7 +1549,7 @@ typedef struct q_samr_del_group_mem_info
 /* SAMR_R_DEL_GROUPMEM - probably an del group member */
 typedef struct r_samr_del_group_mem_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_DEL_GROUPMEM;
 
@@ -1444,7 +1568,7 @@ typedef struct q_samr_add_group_mem_info
 /* SAMR_R_ADD_GROUPMEM - probably an add group member */
 typedef struct r_samr_add_group_mem_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_ADD_GROUPMEM;
 
@@ -1463,7 +1587,7 @@ typedef struct q_samr_open_group_info
 typedef struct r_samr_open_group_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_OPEN_GROUP;
 
@@ -1485,7 +1609,7 @@ typedef struct r_samr_query_aliasmem_info
 
        DOM_SID2 *sid;
 
-       uint32 status;
+       NTSTATUS status;
 
 } SAMR_R_QUERY_ALIASMEM;
 
@@ -1503,7 +1627,7 @@ typedef struct q_samr_add_alias_mem_info
 /* SAMR_R_ADD_ALIASMEM - add alias member */
 typedef struct r_samr_add_alias_mem_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_ADD_ALIASMEM;
 
@@ -1521,7 +1645,7 @@ typedef struct q_samr_del_alias_mem_info
 /* SAMR_R_DEL_ALIASMEM - delete alias member */
 typedef struct r_samr_del_alias_mem_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_DEL_ALIASMEM;
 
@@ -1532,8 +1656,8 @@ typedef struct q_samr_open_alias_info
 {
        POLICY_HND dom_pol;
 
-       uint32 unknown_0;         /* 0x0000 0008 */
-       uint32 rid_alias;        /* rid */
+       uint32 access_mask;         
+       uint32 rid_alias;
 
 } SAMR_Q_OPEN_ALIAS;
 
@@ -1542,7 +1666,7 @@ typedef struct q_samr_open_alias_info
 typedef struct r_samr_open_alias_info
 {
        POLICY_HND pol;       /* policy handle */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_OPEN_ALIAS;
 
@@ -1561,7 +1685,7 @@ typedef struct q_samr_connect_anon_info
 typedef struct r_samr_connect_anon_info
 {
        POLICY_HND connect_pol;       /* policy handle */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_CONNECT_ANON;
 
@@ -1580,10 +1704,23 @@ typedef struct q_samr_connect_info
 typedef struct r_samr_connect_info
 {
     POLICY_HND connect_pol;       /* policy handle */
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
 } SAMR_R_CONNECT;
 
+/* SAMR_Q_CONNECT4 */
+typedef struct q_samr_connect4_info
+{
+       uint32 ptr_srv_name; /* pointer to server name */
+       UNISTR2 uni_srv_name;
+
+       uint32 unk_0; /* possible server name type, 1 for IP num, 2 for name */
+       uint32 access_mask;
+} SAMR_Q_CONNECT4;
+
+/* SAMR_R_CONNECT4 - same format as connect */
+typedef struct r_samr_connect_info SAMR_R_CONNECT4;       
+
 /* SAMR_Q_GET_DOM_PWINFO */
 typedef struct q_samr_get_dom_pwinfo
 {
@@ -1596,9 +1733,17 @@ typedef struct q_samr_get_dom_pwinfo
 /* SAMR_R_GET_DOM_PWINFO */
 typedef struct r_samr_get_dom_pwinfo
 {
-       uint16 unk_0;
-       uint16 unk_1;
-       uint32 status;
+       /*
+        * Previously this was 3 uint16's.  However, after some tests
+        * it appears that the data len for the signing needs to be 16.
+        * Not sure how 3 unit16's ever worked since the length always
+        * turned out to 12.  3 uint32's + NT_STATUS == 16 bytes.  Tested
+        * using NT and 2k.  --jerry
+        */
+       uint32 unk_0;
+       uint32 unk_1;
+       uint32 unk_2;
+       NTSTATUS status;
 
 } SAMR_R_GET_DOM_PWINFO;
 
@@ -1642,26 +1787,26 @@ typedef struct q_samr_chgpasswd_user_info
 /* SAMR_R_CHGPASSWD_USER */
 typedef struct r_samr_chgpasswd_user_info
 {
-       uint32 status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
+       NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
 
 } SAMR_R_CHGPASSWD_USER;
 
 
-/* SAMR_Q_UNKNOWN_2D */
-typedef struct q_samr_unknown_2d_info
+/* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */
+typedef struct q_samr_remove_sid_foreign_domain_info
 {
        POLICY_HND dom_pol;   /* policy handle */
        DOM_SID2 sid;         /* SID */
 
-} SAMR_Q_UNKNOWN_2D;
+} SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN;
 
 
-/* SAMR_R_UNKNOWN_2D - probably an open */
-typedef struct r_samr_unknown_2d_info
+/* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */
+typedef struct r_samr_remove_sid_foreign_domain_info
 {
-       uint32 status;         /* return status */
+       NTSTATUS status;         /* return status */
 
-} SAMR_R_UNKNOWN_2D;
+} SAMR_R_REMOVE_SID_FOREIGN_DOMAIN;
 
 
 
@@ -1679,5 +1824,39 @@ typedef struct sid_info_3
 
 } DOM_SID3;
 
-#endif /* _RPC_SAMR_H */
+/* SAMR_Q_UNKNOWN_2E */
+typedef struct q_samr_unknown_2e_info
+{
+       POLICY_HND domain_pol;   /* policy handle */
+       uint16 switch_value;
+
+} SAMR_Q_UNKNOWN_2E;
+
+/* SAMR_R_UNKNOWN_2E */
+typedef struct r_samr_unknown_2e_info
+{
+       uint32 ptr_0;
+       uint16 switch_value;
+       SAM_UNK_CTR *ctr;
+       NTSTATUS status;         /* return status */
 
+} SAMR_R_UNKNOWN_2E;
+
+/* SAMR_Q_SET_DOMAIN_INFO */
+typedef struct q_samr_set_domain_info
+{
+       POLICY_HND domain_pol;   /* policy handle */
+       uint16 switch_value0;
+       uint16 switch_value;
+       SAM_UNK_CTR *ctr;
+
+} SAMR_Q_SET_DOMAIN_INFO;
+
+/* SAMR_R_SET_DOMAIN_INFO */
+typedef struct r_samr_set_domain_info
+{
+       NTSTATUS status;         /* return status */
+
+} SAMR_R_SET_DOMAIN_INFO;
+
+#endif /* _RPC_SAMR_H */