RPC server fixes for RPC client changes merged from TNG.
authorTim Potter <tpot@samba.org>
Thu, 11 Jan 2001 23:49:51 +0000 (23:49 +0000)
committerTim Potter <tpot@samba.org>
Thu, 11 Jan 2001 23:49:51 +0000 (23:49 +0000)
(This used to be commit 793153ebde08db217a18882c5eec945b7b14de69)

source3/rpc_parse/parse_lsa.c
source3/rpc_server/srv_samr.c

index d304c0231ec80f166bc41e37fd96e5084acbb025..6cef8c9920844fd333282fb13803867f96c7bb4c 100644 (file)
@@ -526,6 +526,46 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e,
        return True;
 }
 
+/*******************************************************************
+ Inits an LSA_R_ENUM_TRUST_DOM structure.
+********************************************************************/
+
+void init_r_enum_trust_dom(LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context, 
+                          char *domain_name, DOM_SID *domain_sid,
+                           uint32 status)
+{
+        DEBUG(5, ("init_r_enum_trust_dom\n"));
+       
+        r_e->enum_context = enum_context;
+       
+        if (status == 0) {
+                int len_domain_name = strlen(domain_name) + 1;
+               
+                r_e->num_domains  = 1;
+                r_e->ptr_enum_domains = 1;
+                r_e->num_domains2 = 1;
+               
+               if (!(r_e->hdr_domain_name = (UNIHDR2 *)
+                     malloc(sizeof(UNIHDR2)))) return;
+
+               if (!(r_e->uni_domain_name = (UNISTR2 *)
+                     malloc(sizeof(UNISTR2)))) return;
+
+               if (!(r_e->domain_sid = (DOM_SID2 *)
+                     malloc(sizeof(DOM_SID2)))) return;
+
+               init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name);
+               init_unistr2 (&r_e->uni_domain_name[0], domain_name, 
+                             len_domain_name);
+               init_dom_sid2(&r_e->domain_sid[0], domain_sid);
+        } else {
+                r_e->num_domains = 0;
+                r_e->ptr_enum_domains = 0;
+        }
+       
+        r_e->status = status;
+}
+
 /*******************************************************************
  Reads or writes an LSA_R_ENUM_TRUST_DOM structure.
 ********************************************************************/
@@ -559,8 +599,8 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e,
                      malloc(sizeof(UNISTR2) * num_domains)))
                        return False;
 
-               if (!(r_e->domain_sid = (DOM_SID *)
-                     malloc(sizeof(DOM_SID) * num_domains)))
+               if (!(r_e->domain_sid = (DOM_SID2 *)
+                     malloc(sizeof(DOM_SID2) * num_domains)))
                        return False;
 
                for (i = 0; i < num_domains; i++) {
index fefa547a379f2ffc8f39062b7fa769c626366bef..30a0350f67c0c819c65b3e1297b7031e9c0c8025 100644 (file)
@@ -413,7 +413,7 @@ static BOOL samr_reply_open_domain(SAMR_Q_OPEN_DOMAIN *q_u,
        r_u.status = 0x0;
 
        /* find the connection policy handle. */
-       if (r_u.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->connect_pol)) == -1))
+       if (r_u.status == 0x0 && (find_lsa_policy_by_hnd(&(q_u->pol)) == -1))
        {
                r_u.status = 0xC0000000 | NT_STATUS_INVALID_HANDLE;
        }
@@ -1995,7 +1995,9 @@ static BOOL samr_reply_connect(SAMR_Q_CONNECT *q_u, prs_struct *rdata)
        }
 
        /* associate the domain SID with the (unique) handle. */
-       if (r_u.status == 0x0 && !set_lsa_policy_samr_pol_status(&(r_u.connect_pol), q_u->unknown_0))
+       if (r_u.status == 0x0 && 
+           !set_lsa_policy_samr_pol_status(&(r_u.connect_pol), 
+                                           q_u->access_mask))
        {
                /* oh, whoops.  don't know what error message to return, here */
                r_u.status = 0xC0000000 | NT_STATUS_OBJECT_NAME_NOT_FOUND;