svn commit: samba r9752 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

2005-08-29 Thread jerry
Author: jerry
Date: 2005-08-29 17:48:01 + (Mon, 29 Aug 2005)
New Revision: 9752

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=9752

Log:
figured out why talloc_steal() is a bad idea for SEC_DESC*
Add a comment so someone else doesn't get bitten by this as well.


Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
   trunk/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2005-08-29 
17:31:19 UTC (rev 9751)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c   2005-08-29 
17:48:01 UTC (rev 9752)
@@ -4171,7 +4171,11 @@
if ( ntprinter-info_2-secdesc_buf 
 ntprinter-info_2-secdesc_buf-len != 0 ) 
{
-   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
ntprinter-info_2-secdesc_buf-sec );
+   /* don't use talloc_steal() here unless you do a deep steal of 
all 
+  the SEC_DESC members */
+
+   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
+   ntprinter-info_2-secdesc_buf-sec );
}
 
free_a_printer(ntprinter, 2);
@@ -4205,7 +4209,11 @@
printer-flags = 0x4; 
 
if (ntprinter-info_2-secdesc_buf  
ntprinter-info_2-secdesc_buf-len != 0) {
-   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
ntprinter-info_2-secdesc_buf-sec );
+   /* don't use talloc_steal() here unless you do a deep steal of 
all 
+  the SEC_DESC members */
+
+   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
+   ntprinter-info_2-secdesc_buf-sec );
}
 
free_a_printer(ntprinter, 2);

Modified: trunk/source/rpc_server/srv_spoolss_nt.c
===
--- trunk/source/rpc_server/srv_spoolss_nt.c2005-08-29 17:31:19 UTC (rev 
9751)
+++ trunk/source/rpc_server/srv_spoolss_nt.c2005-08-29 17:48:01 UTC (rev 
9752)
@@ -4171,7 +4171,11 @@
if ( ntprinter-info_2-secdesc_buf 
 ntprinter-info_2-secdesc_buf-len != 0 ) 
{
-   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
ntprinter-info_2-secdesc_buf-sec );
+   /* don't use talloc_steal() here unless you do a deep steal of 
all 
+  the SEC_DESC members */
+
+   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
+   ntprinter-info_2-secdesc_buf-sec );
}
 
free_a_printer(ntprinter, 2);
@@ -4205,7 +4209,11 @@
printer-flags = 0x4; 
 
if (ntprinter-info_2-secdesc_buf  
ntprinter-info_2-secdesc_buf-len != 0) {
-   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
ntprinter-info_2-secdesc_buf-sec );
+   /* don't use talloc_steal() here unless you do a deep steal of 
all 
+  the SEC_DESC members */
+
+   printer-secdesc = dup_sec_desc( get_talloc_ctx(), 
+   ntprinter-info_2-secdesc_buf-sec );
}
 
free_a_printer(ntprinter, 2);



Re: svn commit: samba r9752 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

2005-08-29 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] schrieb:

 figured out why talloc_steal() is a bad idea for SEC_DESC*
 Add a comment so someone else doesn't get bitten by this as well.

we hit the same problem in samba4 a few week ago,
the solution is to correctly create the SEC_DESC buffers,
and mad the sub elements childs of the main structure.

- --
metze

Stefan Metzmacher metze at samba.org www.samba.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDE2vEm70gjA5TCD8RArEIAJwMj0QuaNGiqb0SIO75B22J7dcJowCfcshD
eXaJgwU1SDOt/t2EifIecW0=
=T/Yg
-END PGP SIGNATURE-


Re: svn commit: samba r9752 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

2005-08-29 Thread Gerald (Jerry) Carter

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Stefan (metze) Metzmacher wrote:
| [EMAIL PROTECTED] schrieb:
|
|figured out why talloc_steal() is a bad idea for SEC_DESC*
|Add a comment so someone else doesn't get bitten by this as well.
|
| we hit the same problem in samba4 a few week ago,
| the solution is to correctly create the SEC_DESC buffers,
| and mad the sub elements childs of the main structure.

so then is talloc_steal supposed to move a pointer and
all its children from one context to another?  Or just
the pointer itself.  If I ensure that the members of
SEC_DESC are create from the top level SEC_DESC pointer,
talloc_steal() would work?







cheers, jerry
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDE4ENIR7qMdg1EfYRAgmxAJ4y1LNH/bYP/wrgvqH4xyMLqShVfgCfRHG6
9/A6kzepTaG3rB8EhEcJqVM=
=5i1t
-END PGP SIGNATURE-


Re: svn commit: samba r9752 - branches/SAMBA_3_0/source/rpc_server trunk/source/rpc_server

2005-08-29 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 so then is talloc_steal supposed to move a pointer and
 all its children from one context to another?  Or just
 the pointer itself.  If I ensure that the members of
 SEC_DESC are create from the top level SEC_DESC pointer,
 talloc_steal() would work?

yes, it moves the pointer and the childs

- --
metze

Stefan Metzmacher metze at samba.org www.samba.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDE/H0m70gjA5TCD8RAre1AJ9DwiOcRVYGDoivDsG4vHmldQUAhwCeMCri
wKULzyLEioTZDKjReRNSaiM=
=ioOb
-END PGP SIGNATURE-