r23792: convert Samba4 to GPLv3
[amitay/samba.git] / source4 / torture / rpc / session_key.c
index b5f8889ded229dd924e5754d56b66f287e46b7b3..d5026741fc44d34d48ef869f3d81a2f114a63146 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
 #include "torture/torture.h"
-#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_lsa_c.h"
 
-#include "torture/rpc/proto.h"
-#include "libcli/auth/proto.h"
+#include "libcli/auth/libcli_auth.h"
+#include "torture/rpc/rpc.h"
 
 static void init_lsa_String(struct lsa_String *name, const char *s)
 {
@@ -139,7 +138,7 @@ static BOOL test_CreateSecret_basic(struct dcerpc_pipe *p,
                        
                        blob2 = data_blob_talloc(mem_ctx, NULL, blob1.length);
                        
-                       secret2 = sess_decrypt_string(&blob1, &session_key);
+                       secret2 = sess_decrypt_string(mem_ctx, &blob1, &session_key);
                        
                        if (strcmp(secret1, secret2) != 0) {
                                printf("Returned secret '%s' doesn't match '%s'\n", 
@@ -161,7 +160,7 @@ static BOOL test_CreateSecret_basic(struct dcerpc_pipe *p,
 
 /* TEST session key correctness by pushing and pulling secrets */
 
-BOOL torture_rpc_lsa_secrets(void
+BOOL torture_rpc_lsa_secrets(struct torture_context *torture
 {
         NTSTATUS status;
         struct dcerpc_pipe *p;
@@ -179,12 +178,15 @@ BOOL torture_rpc_lsa_secrets(void)
                return False;
        }
 
-       if (!test_lsa_OpenPolicy2(p, mem_ctx, &handle)) {
-               ret = False;
-       }
-
-       if (!test_CreateSecret_basic(p, mem_ctx, handle)) {
-               ret = False;
+       if (test_lsa_OpenPolicy2(p, mem_ctx, &handle)) {
+               if (!handle) {
+                       printf("OpenPolicy2 failed.  This test cannot run against this server\n");
+                       ret = False;
+               } else if (!test_CreateSecret_basic(p, mem_ctx, handle)) {
+                       ret = False;
+               }
+       } else {
+               return False;
        }
 
        talloc_free(mem_ctx);