[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
[samba.git] / source / rpc_parse / parse_samr.c
index 1a4048e54b3784d66dafeec2546d4c8c04b481ba..407aae66e373076d0f3b6a5c126f434d04276c4f 100644 (file)
@@ -11,7 +11,7 @@
  *  
  *  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
+ *  the Free Software Foundation; either version 3 of the License, or
  *  (at your option) any later version.
  *  
  *  This program is distributed in the hope that it will be useful,
@@ -20,8 +20,7 @@
  *  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 02139, USA.
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "includes.h"
@@ -557,7 +556,7 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2,
 
        u_2->seq_num = seq_num;
 
-
+       
        u_2->unknown_4 = 0x00000001;
        u_2->server_role = server_role;
        u_2->unknown_6 = 0x00000001;
@@ -2172,76 +2171,6 @@ BOOL samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u,
        return True;
 }
 
-/*******************************************************************
-inits a SAMR_Q_GET_DISPENUM_INDEX structure.
-********************************************************************/
-
-void init_samr_q_get_dispenum_index(SAMR_Q_GET_DISPENUM_INDEX * q_e, POLICY_HND *pol,
-                                   uint16 switch_level, const char *name)
-{
-       DEBUG(5, ("init_samr_q_get_dispenum_index\n"));
-
-       q_e->domain_pol = *pol;
-
-       q_e->switch_level = switch_level;
-
-       init_lsa_string(&q_e->name, name);
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-BOOL samr_io_q_get_dispenum_index(const char *desc, SAMR_Q_GET_DISPENUM_INDEX * q_e,
-                                 prs_struct *ps, int depth)
-{
-       if (q_e == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_q_get_dispenum_index");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth))
-               return False;
-
-       if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level))
-               return False;
-
-       if (!smb_io_lsa_string("name", &q_e->name, ps, depth))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-
-BOOL samr_io_r_get_dispenum_index(const char *desc, SAMR_R_GET_DISPENUM_INDEX * r_u,
-                                 prs_struct *ps, int depth)
-{
-       if (r_u == NULL)
-               return False;
-
-       prs_debug(ps, depth, desc, "samr_io_r_get_dispenum_index");
-       depth++;
-
-       if(!prs_align(ps))
-               return False;
-
-       if(!prs_uint32("idx", ps, depth, &r_u->idx))
-               return False;
-       
-       if(!prs_ntstatus("status", ps, depth, &r_u->status))
-               return False;
-
-       return True;
-}
-
-
 /*******************************************************************
 inits a SAMR_Q_OPEN_GROUP structure.
 ********************************************************************/
@@ -4994,18 +4923,10 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
                r_u->ptr_rids = 1;
                r_u->num_rids2 = num_rids;
 
-               if (num_rids) {
-                       if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
-                               return NT_STATUS_NO_MEMORY;
-                       if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
-                               return NT_STATUS_NO_MEMORY;
-               } else {
-                       r_u->rids = NULL;
-                       r_u->types = NULL;
-               }
-
-               if (!r_u->rids || !r_u->types)
-                       goto empty;
+               if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
+                       return NT_STATUS_NO_MEMORY;
+               if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids)))
+                       return NT_STATUS_NO_MEMORY;
 
                for (i = 0; i < num_rids; i++) {
                        r_u->rids[i] = rid[i];
@@ -5013,7 +4934,6 @@ NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u,
                }
        } else {
 
-  empty:
                r_u->num_types1 = 0;
                r_u->ptr_types = 0;
                r_u->num_types2 = 0;
@@ -5940,6 +5860,25 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time,  /* all z
        }
 }
 
+
+/*************************************************************************
+ init_samr_user_info25P
+ fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS
+*************************************************************************/
+
+void init_sam_user_info25P(SAM_USER_INFO_25 * usr,
+                          uint32 fields_present, uint32 acb_info,
+                          char newpass[532])
+{
+       usr->fields_present = fields_present;
+       ZERO_STRUCT(usr->padding1);
+       ZERO_STRUCT(usr->padding2);
+
+       usr->acb_info = acb_info;
+       memcpy(usr->pass, newpass, sizeof(usr->pass));
+}
+
+
 /*******************************************************************
 reads or writes a structure.
 ********************************************************************/
@@ -7831,7 +7770,7 @@ BOOL samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u,
        if ( NT_STATUS_EQUAL( NT_STATUS_NOT_SUPPORTED, NT_STATUS(r_u->ptr_info)) ) {
                r_u->status = NT_STATUS_NOT_SUPPORTED;
                return True;
-       }       
+       }
 
        if (r_u->ptr_info && r_u->info != NULL) {
                /* SAM_UNK_INFO_1 */