svn commit: samba r18404 - in branches/SAMBA_3_0/source: include
rpc_client rpc_parse rpc_server
jerry at samba.org
jerry at samba.org
Mon Sep 11 22:02:34 GMT 2006
Author: jerry
Date: 2006-09-11 22:02:34 +0000 (Mon, 11 Sep 2006)
New Revision: 18404
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18404
Log:
* swap from POLICY_HND to the struct policy_handle from ndr/misc.h
* move OUR_HANDLE macro to include/rpc_misc.h
Modified:
branches/SAMBA_3_0/source/include/rpc_misc.h
branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c
branches/SAMBA_3_0/source/rpc_client/cli_samr.c
branches/SAMBA_3_0/source/rpc_parse/parse_misc.c
branches/SAMBA_3_0/source/rpc_server/srv_lsa_hnd.c
branches/SAMBA_3_0/source/rpc_server/srv_reg_nt.c
branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/rpc_misc.h
===================================================================
--- branches/SAMBA_3_0/source/include/rpc_misc.h 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/include/rpc_misc.h 2006-09-11 22:02:34 UTC (rev 18404)
@@ -97,31 +97,14 @@
uint32 handle; /* enumeration handle */
} ENUM_HND;
+typedef struct policy_handle POLICY_HND;
+#define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\
+ ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \
+ "OTHER")), ((unsigned int)IVAL((hnd)->uuid.node,2)),\
+ ((unsigned int)sys_getpid() )
-/**********************************************************************
- * RPC policy handle used pretty much everywhere
- **********************************************************************/
-typedef struct {
- uint32 data1;
- uint32 data2;
- uint16 data3;
- uint16 data4;
- uint8 data5[8];
-#ifdef __INSURE__
-
- /* To prevent the leakage of policy handles mallocate a bit of
- memory when a policy handle is created and free it when the
- handle is closed. This should cause Insure to flag an error
- when policy handles are overwritten or fall out of scope without
- being freed. */
-
- char *marker;
-#endif
-} POLICY_HND;
-
-
/**********************************************************************
* Buffer Headers -- use by SEC_DESC_BUF in winreg and netlogon code
**********************************************************************/
Modified: branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -78,9 +78,6 @@
if (NT_STATUS_IS_OK(result)) {
*pol = r.pol;
-#ifdef __INSURE__
- pol->marker = MALLOC(1);
-#endif
}
return result;
@@ -125,9 +122,6 @@
if (NT_STATUS_IS_OK(result)) {
*pol = r.pol;
-#ifdef __INSURE__
- pol->marker = (char *)malloc(1);
-#endif
}
return result;
@@ -145,10 +139,6 @@
memcpy( &policy, pol, sizeof(policy) );
-#ifdef __INSURE__
- SAFE_FREE(pol->marker);
-#endif
-
return rpccli_lsa_Close( cli, mem_ctx, &policy );
}
Modified: branches/SAMBA_3_0/source/rpc_client/cli_samr.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_samr.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_client/cli_samr.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -52,9 +52,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*connect_pol = r.connect_pol;
-#ifdef __INSURE__
- connect_pol->marker = malloc(1);
-#endif
}
return result;
@@ -88,9 +85,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*connect_pol = r.connect_pol;
-#ifdef __INSURE__
- connect_pol->marker = malloc(1);
-#endif
}
return result;
@@ -125,9 +119,6 @@
/* Return output parameters */
if (NT_STATUS_IS_OK(result = r.status)) {
-#ifdef __INSURE__
- SAFE_FREE(connect_pol->marker);
-#endif
*connect_pol = r.pol;
}
@@ -166,9 +157,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*domain_pol = r.domain_pol;
-#ifdef __INSURE__
- domain_pol->marker = malloc(1);
-#endif
}
return result;
@@ -204,9 +192,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*user_pol = r.user_pol;
-#ifdef __INSURE__
- user_pol->marker = malloc(1);
-#endif
}
return result;
@@ -244,9 +229,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*group_pol = r.pol;
-#ifdef __INSURE__
- group_pol->marker = malloc(1);
-#endif
}
return result;
@@ -936,9 +918,6 @@
if (NT_STATUS_IS_OK(result = r.status)) {
*alias_pol = r.pol;
-#ifdef __INSURE__
- alias_pol->marker = malloc(1);
-#endif
}
return result;
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_misc.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_parse/parse_misc.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_misc.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -1695,16 +1695,10 @@
if(UNMARSHALLING(ps))
ZERO_STRUCTP(pol);
- if (!prs_uint32("data1", ps, depth, &pol->data1))
+ if (!prs_uint32("handle_type", ps, depth, &pol->handle_type))
return False;
- if (!prs_uint32("data2", ps, depth, &pol->data2))
+ if (!smb_io_uuid("uuid", (struct uuid*)&pol->uuid, ps, depth))
return False;
- if (!prs_uint16("data3", ps, depth, &pol->data3))
- return False;
- if (!prs_uint16("data4", ps, depth, &pol->data4))
- return False;
- if(!prs_uint8s (False, "data5", ps, depth, pol->data5, sizeof(pol->data5)))
- return False;
return True;
}
Modified: branches/SAMBA_3_0/source/rpc_server/srv_lsa_hnd.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_lsa_hnd.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_server/srv_lsa_hnd.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -103,6 +103,7 @@
{
static uint32 pol_hnd_low = 0;
static uint32 pol_hnd_high = 0;
+ time_t t = time(NULL);
struct policy *pol;
@@ -127,13 +128,18 @@
if (pol_hnd_low == 0)
(pol_hnd_high)++;
- SIVAL(&pol->pol_hnd.data1, 0 , 0); /* first bit must be null */
- SIVAL(&pol->pol_hnd.data2, 0 , pol_hnd_low ); /* second bit is incrementing */
- SSVAL(&pol->pol_hnd.data3, 0 , pol_hnd_high); /* second bit is incrementing */
- SSVAL(&pol->pol_hnd.data4, 0 , (pol_hnd_high>>16)); /* second bit is incrementing */
- SIVAL(pol->pol_hnd.data5, 0, time(NULL)); /* something random */
- SIVAL(pol->pol_hnd.data5, 4, sys_getpid()); /* something more random */
+ SIVAL(&pol->pol_hnd.handle_type, 0 , 0); /* first bit must be null */
+ SIVAL(&pol->pol_hnd.uuid.time_low, 0 , pol_hnd_low ); /* second bit is incrementing */
+ SSVAL(&pol->pol_hnd.uuid.time_mid, 0 , pol_hnd_high); /* second bit is incrementing */
+ SSVAL(&pol->pol_hnd.uuid.time_hi_and_version, 0 , (pol_hnd_high>>16)); /* second bit is incrementing */
+ /* split the current time into two 16 bit values */
+
+ SSVAL(pol->pol_hnd.uuid.clock_seq, 0, (t>>16)); /* something random */
+ SSVAL(pol->pol_hnd.uuid.node, 0, t); /* something random */
+
+ SIVAL(pol->pol_hnd.uuid.node, 2, sys_getpid()); /* something more random */
+
DLIST_ADD(p->pipe_handles->Policy, pol);
p->pipe_handles->count++;
Modified: branches/SAMBA_3_0/source/rpc_server/srv_reg_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_reg_nt.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_server/srv_reg_nt.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -30,9 +30,6 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
-#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
-((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
-
static struct generic_mapping reg_generic_map =
{ REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c 2006-09-11 21:48:30 UTC (rev 18403)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c 2006-09-11 22:02:34 UTC (rev 18404)
@@ -66,10 +66,6 @@
extern STANDARD_MAPPING printer_std_mapping, printserver_std_mapping;
-#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
-((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
-
-
/* API table for Xcv Monitor functions */
struct xcv_api_table {
More information about the samba-cvs
mailing list