From 393bede7db6af546431cd5255e465b7b7b0e7c81 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Mar 2001 23:59:13 +0000 Subject: Sync up handle creation with 2.2 branch. We can now join AS/U domains and authenticate against them. Big/little endian issues fixed. Jeremy. (This used to be commit 0e6a34510ed598eaec7fe71a9c91fda528a4675c) --- source3/rpc_server/srv_lsa_hnd.c | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'source3/rpc_server/srv_lsa_hnd.c') diff --git a/source3/rpc_server/srv_lsa_hnd.c b/source3/rpc_server/srv_lsa_hnd.c index 93492f671d..10b9bef1be 100644 --- a/source3/rpc_server/srv_lsa_hnd.c +++ b/source3/rpc_server/srv_lsa_hnd.c @@ -58,26 +58,28 @@ static struct policy static struct bitmap *bmap; +static uint32 pol_hnd_low = 0; +static uint32 pol_hnd_high = 0; -/**************************************************************************** - create a unique policy handle -****************************************************************************/ -static void create_pol_hnd(POLICY_HND *hnd) -{ - static uint32 pol_hnd_low = 0; - static uint32 pol_hnd_high = 0; +/******************************************************************* + Creates a POLICY_HND structure. +********************************************************************/ +void create_policy_handle(POLICY_HND *hnd, uint32 *hnd_low, uint32 *hnd_high) +{ if (hnd == NULL) return; - /* i severely doubt that pol_hnd_high will ever be non-zero... */ - pol_hnd_low++; - if (pol_hnd_low == 0) pol_hnd_high++; + (*hnd_low)++; + if (*hnd_low == 0) (*hnd_high)++; + + ZERO_STRUCTP(hnd); - SIVAL(hnd->data, 0 , 0x0); /* first bit must be null */ - SIVAL(hnd->data, 4 , pol_hnd_low ); /* second bit is incrementing */ - SIVAL(hnd->data, 8 , pol_hnd_high); /* second bit is incrementing */ - SIVAL(hnd->data, 12, time(NULL)); /* something random */ - SIVAL(hnd->data, 16, sys_getpid()); /* something more random */ + SIVAL(&hnd->data1, 0 , 0); /* first bit must be null */ + SIVAL(&hnd->data2, 0 , *hnd_low ); /* second bit is incrementing */ + SSVAL(&hnd->data3, 0 , *hnd_high); /* second bit is incrementing */ + SSVAL(&hnd->data4, 0 , (*hnd_high>>16)); /* second bit is incrementing */ + SIVAL(hnd->data5, 0, time(NULL)); /* something random */ + SIVAL(hnd->data5, 4, sys_getpid()); /* something more random */ } /**************************************************************************** @@ -117,15 +119,15 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd) p->open = True; p->pnum = i; - create_pol_hnd(hnd); - memcpy(&p->pol_hnd, hnd, sizeof(*hnd)); + create_policy_handle(hnd, &pol_hnd_low, &pol_hnd_high); + p->pol_hnd = *hnd; bitmap_set(bmap, i); DLIST_ADD(Policy, p); DEBUG(4,("Opened policy hnd[%x] ", i)); - dump_data(4, (char *)hnd->data, sizeof(hnd->data)); + dump_data(4, (char *)hnd, sizeof(hnd)); return True; } @@ -140,13 +142,13 @@ static struct policy *find_lsa_policy(POLICY_HND *hnd) for (p=Policy;p;p=p->next) { if (memcmp(&p->pol_hnd, hnd, sizeof(*hnd)) == 0) { DEBUG(4,("Found policy hnd[%x] ", p->pnum)); - dump_data(4, (char *)hnd->data, sizeof(hnd->data)); + dump_data(4, (char *)hnd, sizeof(hnd)); return p; } } DEBUG(4,("Policy not found: ")); - dump_data(4, (char *)hnd->data, sizeof(hnd->data)); + dump_data(4, (char *)hnd, sizeof(hnd)); return NULL; } -- cgit