summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_lsa_hnd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-07 23:59:13 +0000
committerJeremy Allison <jra@samba.org>2001-03-07 23:59:13 +0000
commit393bede7db6af546431cd5255e465b7b7b0e7c81 (patch)
tree44a95a722eba6f412e50efc34e2233baa31fe987 /source3/rpc_server/srv_lsa_hnd.c
parent2b22019e426c4bb7a5745a326c302a4e19aa5ff2 (diff)
downloadsamba-393bede7db6af546431cd5255e465b7b7b0e7c81.tar.gz
samba-393bede7db6af546431cd5255e465b7b7b0e7c81.tar.bz2
samba-393bede7db6af546431cd5255e465b7b7b0e7c81.zip
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)
Diffstat (limited to 'source3/rpc_server/srv_lsa_hnd.c')
-rw-r--r--source3/rpc_server/srv_lsa_hnd.c42
1 files changed, 22 insertions, 20 deletions
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;
}