Use pidl for _samr_SetGroupInfo().
authorGünther Deschner <gd@samba.org>
Wed, 6 Feb 2008 11:57:59 +0000 (12:57 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 7 Feb 2008 10:03:26 +0000 (11:03 +0100)
Guenther

source/rpc_server/srv_samr.c
source/rpc_server/srv_samr_nt.c

index a38e9461c478b89bfdb012f181f6a68be8754320..2fea3c17b085b7b305f09ab8e9eb84efe9877263 100644 (file)
@@ -714,28 +714,7 @@ static bool api_samr_query_groupinfo(pipes_struct *p)
 
 static bool api_samr_set_groupinfo(pipes_struct *p)
 {
-       SAMR_Q_SET_GROUPINFO q_u;
-       SAMR_R_SET_GROUPINFO r_u;
-
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-
-       if (!samr_io_q_set_groupinfo("", &q_u, data, 0)) {
-               DEBUG(0,("api_samr_set_groupinfo: unable to unmarshall SAMR_Q_SET_GROUPINFO.\n"));
-               return False;
-       }
-
-       r_u.status = _samr_set_groupinfo(p, &q_u, &r_u);
-
-       if (!samr_io_r_set_groupinfo("", &r_u, rdata, 0)) {
-               DEBUG(0,("api_samr_set_groupinfo: unable to marshall SAMR_R_SET_GROUPINFO.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_samr_call(p, NDR_SAMR_SETGROUPINFO);
 }
 
 /*******************************************************************
index a06977eed71e978dd789c7b2e38f7cc94bd15c88..092624d29e1c2dca87f8460e93994089f81d0704 100644 (file)
@@ -4720,43 +4720,42 @@ NTSTATUS _samr_query_groupinfo(pipes_struct *p, SAMR_Q_QUERY_GROUPINFO *q_u, SAM
 }
 
 /*********************************************************************
- _samr_set_groupinfo
-
- update a domain group's comment.
+ _samr_SetGroupInfo
 *********************************************************************/
 
-NTSTATUS _samr_set_groupinfo(pipes_struct *p, SAMR_Q_SET_GROUPINFO *q_u, SAMR_R_SET_GROUPINFO *r_u)
+NTSTATUS _samr_SetGroupInfo(pipes_struct *p,
+                           struct samr_SetGroupInfo *r)
 {
        DOM_SID group_sid;
        GROUP_MAP map;
-       GROUP_INFO_CTR *ctr;
        uint32 acc_granted;
-       NTSTATUS ret;
-       bool result;
+       NTSTATUS status;
+       bool ret;
        bool can_mod_accounts;
        DISP_INFO *disp_info = NULL;
 
-       if (!get_lsa_policy_samr_sid(p, &q_u->pol, &group_sid, &acc_granted, &disp_info))
+       if (!get_lsa_policy_samr_sid(p, r->in.group_handle, &group_sid, &acc_granted, &disp_info))
                return NT_STATUS_INVALID_HANDLE;
 
-       if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(acc_granted, SA_RIGHT_GROUP_SET_INFO, "_samr_set_groupinfo"))) {
-               return r_u->status;
+       status = access_check_samr_function(acc_granted,
+                                           SA_RIGHT_GROUP_SET_INFO,
+                                           "_samr_SetGroupInfo");
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
        }
 
        become_root();
-       result = get_domain_group_from_sid(group_sid, &map);
+       ret = get_domain_group_from_sid(group_sid, &map);
        unbecome_root();
-       if (!result)
+       if (!ret)
                return NT_STATUS_NO_SUCH_GROUP;
 
-       ctr=q_u->ctr;
-
-       switch (ctr->switch_value1) {
+       switch (r->in.level) {
                case 1:
-                       unistr2_to_ascii(map.comment, &(ctr->group.info1.uni_acct_desc), sizeof(map.comment));
+                       fstrcpy(map.comment, r->in.info->all.description.string);
                        break;
                case 4:
-                       unistr2_to_ascii(map.comment, &(ctr->group.info4.uni_acct_desc), sizeof(map.comment));
+                       fstrcpy(map.comment, r->in.info->description.string);
                        break;
                default:
                        return NT_STATUS_INVALID_INFO_CLASS;
@@ -4769,18 +4768,18 @@ NTSTATUS _samr_set_groupinfo(pipes_struct *p, SAMR_Q_SET_GROUPINFO *q_u, SAMR_R_
        if ( can_mod_accounts )
                become_root();
 
-       ret = pdb_update_group_mapping_entry(&map);
+       status = pdb_update_group_mapping_entry(&map);
 
        if ( can_mod_accounts )
                unbecome_root();
 
        /******** End SeAddUsers BLOCK *********/
 
-       if (NT_STATUS_IS_OK(ret)) {
+       if (NT_STATUS_IS_OK(status)) {
                force_flush_samr_cache(disp_info);
        }
 
-       return ret;
+       return status;
 }
 
 /*********************************************************************
@@ -5209,16 +5208,6 @@ NTSTATUS _samr_QueryGroupInfo(pipes_struct *p,
 /****************************************************************
 ****************************************************************/
 
-NTSTATUS _samr_SetGroupInfo(pipes_struct *p,
-                           struct samr_SetGroupInfo *r)
-{
-       p->rng_fault_state = true;
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
-/****************************************************************
-****************************************************************/
-
 NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p,
                                          struct samr_SetMemberAttributesOfGroup *r)
 {