svn commit: samba r9810 - in branches/SOC/SAMBA_3_0/source: include
libmsrpc
skel at samba.org
skel at samba.org
Tue Aug 30 20:12:12 GMT 2005
Author: skel
Date: 2005-08-30 20:12:11 +0000 (Tue, 30 Aug 2005)
New Revision: 9810
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9810
Log:
cac_SamGetNamesFromRids() and cac_SamGetRidsFromNames() now return success if num_rids or num_names is 0
added cac_SamFlush()
Modified:
branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
Changeset:
Modified: branches/SOC/SAMBA_3_0/source/include/libmsrpc.h
===================================================================
--- branches/SOC/SAMBA_3_0/source/include/libmsrpc.h 2005-08-30 19:44:33 UTC (rev 9809)
+++ branches/SOC/SAMBA_3_0/source/include/libmsrpc.h 2005-08-30 20:12:11 UTC (rev 9810)
@@ -1782,7 +1782,7 @@
} in;
struct {
- /**the number of names returned*/
+ /**the number of names returned - if this is 0, the map is NULL*/
uint32 num_names;
/**array contiaing the Names and RIDs*/
@@ -1813,7 +1813,7 @@
} in;
struct {
- /**the number of names returned*/
+ /**the number of names returned - if this is 0, then map is NULL*/
uint32 num_rids;
/**array contiaing the Names and RIDs*/
@@ -2673,6 +2673,30 @@
*/
int cac_SamGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetSecurityObject *op);
+struct SamFlush {
+ struct {
+ /**Open handle to the domain SAM*/
+ POLICY_HND *dom_hnd;
+
+ /**(Optional)Domain SID. If NULL, the domain in hnd->domain will be opened*/
+ DOM_SID *sid;
+
+ /**(Optional)Desired access to re-open the domain with. If 0, MAXIMUM_ALLOWED_ACCESS is used.*/
+ uint32 access;
+ } in;
+};
+
+/**
+ * Closes the domain handle, then re-opens it - effectively flushing any changes made.
+ * WARNING: if this fails you will no longer have an open handle to the domain SAM.
+ * @param hnd Initialized and connected server handle
+ * @param mem_ctx Context for memory allocation
+ * @param op Initialized Parameters
+ * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
+ * CAC_SUCCESS - the operation was successful
+ */
+int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush *op);
+
/**@}*/ /*SAM_Functions*/
/**@defgroup SCM_Functions Service Control Manager Functions
Modified: branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c 2005-08-30 19:44:33 UTC (rev 9809)
+++ branches/SOC/SAMBA_3_0/source/libmsrpc/cac_samr.c 2005-08-30 20:12:11 UTC (rev 9810)
@@ -479,11 +479,22 @@
return CAC_FAILURE;
}
- if(!op || !op->in.dom_hnd || !op->in.rids || op->in.num_rids == 0 || !mem_ctx) {
+ if(!op || !op->in.dom_hnd || !mem_ctx) {
hnd->status = NT_STATUS_INVALID_PARAMETER;
return CAC_FAILURE;
}
+ if(!op->in.rids && op->in.num_rids != 0) {
+ hnd->status = NT_STATUS_INVALID_PARAMETER;
+ return CAC_FAILURE;
+ }
+
+ if(op->in.num_rids == 0) {
+ /*nothing to do*/
+ op->out.num_names = 0;
+ return CAC_SUCCESS;
+ }
+
srv = cac_GetServer(hnd);
if(!srv) {
hnd->status = NT_STATUS_INVALID_CONNECTION;
@@ -548,11 +559,22 @@
return CAC_FAILURE;
}
- if(!op || !op->in.dom_hnd || !op->in.names || op->in.num_names == 0 || !mem_ctx) {
+ if(!op || !op->in.dom_hnd || !mem_ctx) {
hnd->status = NT_STATUS_INVALID_PARAMETER;
return CAC_FAILURE;
}
+ if(!op->in.names && op->in.num_names != 0) {
+ hnd->status = NT_STATUS_INVALID_PARAMETER;
+ return CAC_FAILURE;
+ }
+
+ if(op->in.num_names == 0) {
+ /*then we don't have to do anything*/
+ op->out.num_rids = 0;
+ return CAC_SUCCESS;
+ }
+
srv = cac_GetServer(hnd);
if(!srv) {
hnd->status = NT_STATUS_INVALID_CONNECTION;
@@ -850,7 +872,6 @@
srv->cli.pipe_idx = PI_SAMR;
- printf("addgroupmember: adding rid 0x%x\n", op->in.rid);
hnd->status = cli_samr_add_groupmem( &(srv->cli), mem_ctx, op->in.group_hnd, op->in.rid);
if(!NT_STATUS_IS_OK(hnd->status))
@@ -2395,3 +2416,47 @@
return CAC_SUCCESS;
}
+
+int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush *op) {
+ SMBCSRV *srv = NULL;
+
+ struct SamOpenDomain od;
+
+ if(!hnd)
+ return CAC_FAILURE;
+
+ if(!hnd->_internal.ctx || !hnd->_internal.pipes[PI_SAMR]) {
+ hnd->status = NT_STATUS_INVALID_HANDLE;
+ return CAC_FAILURE;
+ }
+
+ if(!op || !op->in.dom_hnd || !mem_ctx) {
+ hnd->status = NT_STATUS_INVALID_PARAMETER;
+ return CAC_FAILURE;
+ }
+
+ srv = cac_GetServer(hnd);
+ if(!srv) {
+ hnd->status = NT_STATUS_INVALID_CONNECTION;
+ return CAC_FAILURE;
+ }
+
+ srv->cli.pipe_idx = PI_SAMR;
+
+ if(!cac_SamClose(hnd, mem_ctx, op->in.dom_hnd))
+ return CAC_FAILURE;
+
+ ZERO_STRUCT(od);
+ od.in.access = (op->in.access) ? op->in.access : MAXIMUM_ALLOWED_ACCESS;
+ od.in.sid = op->in.sid;
+
+ if(!cac_SamOpenDomain(hnd, mem_ctx, &od))
+ return CAC_FAILURE;
+
+ /*this function does not use an output parameter to make it as convenient as possible to use*/
+ *op->in.dom_hnd = *od.out.dom_hnd;
+
+ talloc_free(od.out.dom_hnd);
+
+ return CAC_SUCCESS;
+}
More information about the samba-cvs
mailing list