Add 'net rpc group add'. For this parse_samr.c had to be changed: The
[samba.git] / source / include / rpc_samr.h
index 0d0dd7237c16d94db4b613cc1b0bd1368fc9b1f7..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? */
@@ -127,7 +127,7 @@ SamrTestPrivateFunctionsUser
 #define SAMR_UNKNOWN_2a        0x2a
 #define SAMR_UNKNOWN_2b        0x2b
 #define SAMR_GET_USRDOM_PWINFO 0x2c
-#define SAMR_UNKNOWN_2D        0x2d
+#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
@@ -144,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
 {
@@ -184,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];
 
@@ -303,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 */
@@ -331,6 +343,8 @@ 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
@@ -443,6 +457,26 @@ typedef struct r_samr_usrdom_pwinfo_info
 
 } 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.
@@ -637,7 +671,10 @@ typedef struct r_samr_open_domain_info
 
 } SAMR_R_OPEN_DOMAIN;
 
-#define MAX_SAM_ENTRIES 50
+#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
 {
@@ -788,7 +825,6 @@ typedef struct samr_entry_info1
 
        uint32 rid_user;
        uint16 acb_info;
-       uint16 pad;
 
        UNIHDR hdr_acct_name;
        UNIHDR hdr_user_name;
@@ -820,7 +856,6 @@ typedef struct samr_entry_info2
 
        uint32 rid_user;
        uint16 acb_info;
-       uint16 pad;
 
        UNIHDR hdr_srv_name;
        UNIHDR hdr_srv_desc;
@@ -1033,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;
 
@@ -1044,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;
 
@@ -1130,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;
@@ -1145,6 +1197,7 @@ typedef struct alias_info_ctr
 
        union
        {
+               ALIAS_INFO1 info1;
                ALIAS_INFO3 info3;
 
        } alias;
@@ -1432,7 +1485,7 @@ 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 */
        NTSTATUS status;         /* return status */
 
@@ -1488,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;
@@ -1656,6 +1708,19 @@ typedef struct r_samr_connect_info
 
 } 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
 {
@@ -1668,9 +1733,16 @@ 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;
-       uint16 unk_2;
+       /*
+        * 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;
@@ -1720,21 +1792,21 @@ typedef struct r_samr_chgpasswd_user_info
 } 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
 {
        NTSTATUS status;         /* return status */
 
-} SAMR_R_UNKNOWN_2D;
+} SAMR_R_REMOVE_SID_FOREIGN_DOMAIN;
 
 
 
@@ -1787,6 +1859,4 @@ typedef struct r_samr_set_domain_info
 
 } SAMR_R_SET_DOMAIN_INFO;
 
-
 #endif /* _RPC_SAMR_H */
-