Author: abartlet
Date: 2005-08-03 23:14:38 +0000 (Wed, 03 Aug 2005)
New Revision: 9022

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9022

Log:
One more step in the game of whack-a-mole with the PAC.

This makes the PAC we generate match (closely) the PAC generated by my
test win2k3 DC.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/auth/auth_sam_reply.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/auth_sam_reply.c
===================================================================
--- branches/SAMBA_4_0/source/auth/auth_sam_reply.c     2005-08-03 22:07:57 UTC 
(rev 9021)
+++ branches/SAMBA_4_0/source/auth/auth_sam_reply.c     2005-08-03 23:14:38 UTC 
(rev 9022)
@@ -117,6 +117,10 @@
 
        sam = &sam3->base;
 
+       sam->domain_sid = dom_sid_dup(mem_ctx, server_info->account_sid);
+       NT_STATUS_HAVE_NO_MEMORY(sam->domain_sid);
+       sam->domain_sid->num_auths--;
+
        sam->last_logon = server_info->last_logon;
        sam->last_logoff = server_info->last_logoff;
        sam->acct_expiry = server_info->acct_expiry;
@@ -139,6 +143,26 @@
        sam->groups.count = 0;
        sam->groups.rids = NULL;
 
+       if (server_info->n_domain_groups > 0) {
+               int i;
+               sam->groups.rids = talloc_array(sam, struct 
samr_RidWithAttribute,
+                                               server_info->n_domain_groups);
+               NT_STATUS_HAVE_NO_MEMORY(sam->groups.rids);
+
+               for (i=0; i<server_info->n_domain_groups; i++) {
+                       struct dom_sid *group_sid = 
server_info->domain_groups[i];
+
+                       if (!dom_sid_in_domain(sam->domain_sid, group_sid)) {
+                               continue;
+                       }
+
+                       sam->groups.rids[sam->groups.count].rid = 
group_sid->sub_auths[group_sid->num_auths-1];
+                       sam->groups.rids[sam->groups.count].attributes = 
+                               SE_GROUP_MANDATORY | 
SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED;
+                       sam->groups.count += 1;
+               }
+       }
+
        sam->user_flags = 0x20; /* TODO: w2k3 uses 0x120.  We know 0x20
                              * as extra sids (PAC doc) but what is
                              * 0x100? */
@@ -146,10 +170,6 @@
        sam->logon_server.string = lp_netbios_name();
        sam->domain.string = server_info->domain_name;
 
-       sam->domain_sid = dom_sid_dup(mem_ctx, server_info->account_sid);
-       NT_STATUS_HAVE_NO_MEMORY(sam->domain_sid);
-       sam->domain_sid->num_auths--;
-
        ZERO_STRUCT(sam->unknown);
 
        ZERO_STRUCT(sam->key);
@@ -165,7 +185,7 @@
 
        sam3->sidcount  = 0;
        sam3->sids      = NULL;
-
+#if 0
        if (server_info->n_domain_groups > 0) {
                int i;
                sam3->sids = talloc_array(sam, struct netr_SidAttr,
@@ -173,7 +193,7 @@
                NT_STATUS_HAVE_NO_MEMORY(sam3->sids);
 
                for (i=0; i<server_info->n_domain_groups; i++) {
-                       if (!dom_sid_in_domain(sam->domain_sid, 
server_info->domain_groups[i])) {
+                       if (dom_sid_in_domain(sam->domain_sid, 
server_info->domain_groups[i])) {
                                continue;
                        }
                        sam3->sids[sam3->sidcount].sid = 
talloc_reference(sam3->sids,server_info->domain_groups[i]);
@@ -182,7 +202,7 @@
                        sam3->sidcount += 1;
                }
        }
-
+#endif
        *_sam3 = sam3;
 
        return NT_STATUS_OK;

Reply via email to