svn commit: samba r14367 - branches/SAMBA_3_0/source/libmsrpc trunk/source/libmsrpc

vlendec at samba.org vlendec at samba.org
Tue Mar 14 08:27:45 GMT 2006


Author: vlendec
Date: 2006-03-14 08:27:44 +0000 (Tue, 14 Mar 2006)
New Revision: 14367

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

Log:
Not that I fully understand what's going on here, but the code as it was here
was clearly buggy as Coverity showed with bug id #36.

According to samba4 idl the sec_desc_buf is [in,out,ref], so we _have_ to ship
it in the request.

Volker

Modified:
   branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c
   trunk/source/libmsrpc/cac_winreg.c


Changeset:
Modified: branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c
===================================================================
--- branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c	2006-03-14 06:22:39 UTC (rev 14366)
+++ branches/SAMBA_3_0/source/libmsrpc/cac_winreg.c	2006-03-14 08:27:44 UTC (rev 14367)
@@ -823,7 +823,7 @@
    WERROR err;
 
    uint32 buf_size;
-   SEC_DESC_BUF *buf = NULL;
+   SEC_DESC_BUF buf;
 
    if(!hnd) 
       return CAC_FAILURE;
@@ -844,7 +844,7 @@
       return CAC_FAILURE;
    }
 
-   err = rpccli_reg_get_key_sec(pipe_hnd, mem_ctx, op->in.key, op->in.info_type, &buf_size, buf);
+   err = rpccli_reg_get_key_sec(pipe_hnd, mem_ctx, op->in.key, op->in.info_type, &buf_size, &buf);
    hnd->status = werror_to_ntstatus(err);
 
 
@@ -852,9 +852,13 @@
       return CAC_FAILURE;
    }
 
-   op->out.size = buf->len;
-   op->out.descriptor = buf->sec;
+   op->out.size = buf.len;
+   op->out.descriptor = dup_sec_desc(mem_ctx, buf.sec);
 
+   if (op->out.descriptor == NULL) {
+	   return CAC_FAILURE;
+   }
+
    return CAC_SUCCESS;
 }
 

Modified: trunk/source/libmsrpc/cac_winreg.c
===================================================================
--- trunk/source/libmsrpc/cac_winreg.c	2006-03-14 06:22:39 UTC (rev 14366)
+++ trunk/source/libmsrpc/cac_winreg.c	2006-03-14 08:27:44 UTC (rev 14367)
@@ -823,7 +823,7 @@
    WERROR err;
 
    uint32 buf_size;
-   SEC_DESC_BUF *buf = NULL;
+   SEC_DESC_BUF buf;
 
    if(!hnd) 
       return CAC_FAILURE;
@@ -844,7 +844,7 @@
       return CAC_FAILURE;
    }
 
-   err = rpccli_reg_get_key_sec(pipe_hnd, mem_ctx, op->in.key, op->in.info_type, &buf_size, buf);
+   err = rpccli_reg_get_key_sec(pipe_hnd, mem_ctx, op->in.key, op->in.info_type, &buf_size, &buf);
    hnd->status = werror_to_ntstatus(err);
 
 
@@ -852,9 +852,13 @@
       return CAC_FAILURE;
    }
 
-   op->out.size = buf->len;
-   op->out.descriptor = buf->sec;
+   op->out.size = buf.len;
+   op->out.descriptor = dup_sec_desc(mem_ctx, buf.sec);
 
+   if (op->out.descriptor == NULL) {
+	   return CAC_FAILURE;
+   }
+
    return CAC_SUCCESS;
 }
 



More information about the samba-cvs mailing list