[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Jan 29 03:45:44 MST 2010


The branch, master has been updated
       via  ad6ea7b... lib/util: remove data_blob_talloc_reference()
       via  1c76df6... s4:auth_sam: avoid usage of data_blob_talloc_reference() and copy the session keys
       via  ddd595e... s4:libcli: remove unneeded talloc_reference() usage
      from  14e0067... s4:kdc remove dead code and comments

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ad6ea7b189a467833fcde6a0acdb8ceb7e7198c9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 5 20:14:04 2010 +0100

    lib/util: remove data_blob_talloc_reference()
    
    We want to avoid the usage of talloc_reference() in Samba.
    
    metze

commit 1c76df6219a4859bc0b7be1e57c1844df78237e7
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 5 20:11:29 2010 +0100

    s4:auth_sam: avoid usage of data_blob_talloc_reference() and copy the session keys
    
    metze

commit ddd595e687aa24f78de71ba0f0ea74354f95e3d1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jan 27 11:01:25 2010 +0100

    s4:libcli: remove unneeded talloc_reference() usage
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 lib/util/data_blob.c           |   17 -----------------
 lib/util/data_blob.h           |    6 ------
 source4/auth/sam.c             |   18 ++++++++++++++----
 source4/libcli/raw/rawnotify.c |    5 +----
 4 files changed, 15 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c
index 6e7557f..3448e94 100644
--- a/lib/util/data_blob.c
+++ b/lib/util/data_blob.c
@@ -67,23 +67,6 @@ _PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, si
 	return ret;
 }
 
-
-/**
- reference a data blob, to the supplied TALLOC_CTX.  
- Returns a NULL DATA_BLOB on failure
-**/
-_PUBLIC_ DATA_BLOB data_blob_talloc_reference(TALLOC_CTX *mem_ctx, DATA_BLOB *blob)
-{
-	DATA_BLOB ret = *blob;
-
-	ret.data = talloc_reference(mem_ctx, blob->data);
-
-	if (!ret.data) {
-		return data_blob(NULL, 0);
-	}
-	return ret;
-}
-
 /**
  construct a zero data blob, using supplied TALLOC_CTX. 
  use this sparingly as it initialises data - better to initialise
diff --git a/lib/util/data_blob.h b/lib/util/data_blob.h
index c294533..83e6cd5 100644
--- a/lib/util/data_blob.h
+++ b/lib/util/data_blob.h
@@ -61,12 +61,6 @@ _PUBLIC_ DATA_BLOB data_blob_named(const void *p, size_t length, const char *nam
 _PUBLIC_ DATA_BLOB data_blob_talloc_named(TALLOC_CTX *mem_ctx, const void *p, size_t length, const char *name);
 
 /**
- reference a data blob, to the supplied TALLOC_CTX.  
- Returns a NULL DATA_BLOB on failure
-**/
-_PUBLIC_ DATA_BLOB data_blob_talloc_reference(TALLOC_CTX *mem_ctx, DATA_BLOB *blob);
-
-/**
  construct a zero data blob, using supplied TALLOC_CTX. 
  use this sparingly as it initialises data - better to initialise
  yourself if you want specific data in the blob
diff --git a/source4/auth/sam.c b/source4/auth/sam.c
index 53de414..4c0fafe 100644
--- a/source4/auth/sam.c
+++ b/source4/auth/sam.c
@@ -503,10 +503,20 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx,
 	server_info->acct_flags = samdb_result_acct_flags(sam_ctx, mem_ctx, 
 							  msg, domain_dn);
 
-	server_info->user_session_key = data_blob_talloc_reference(server_info,
-		&user_sess_key);
-	server_info->lm_session_key = data_blob_talloc_reference(server_info,
-		&lm_sess_key);
+	server_info->user_session_key = data_blob_talloc(server_info,
+							 user_sess_key.data,
+							 user_sess_key.length);
+	if (user_sess_key.data) {
+		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->user_session_key.data,
+						  server_info);
+	}
+	server_info->lm_session_key = data_blob_talloc(server_info,
+						       lm_sess_key.data,
+						       lm_sess_key.length);
+	if (lm_sess_key.data) {
+		NT_STATUS_HAVE_NO_MEMORY_AND_FREE(server_info->lm_session_key.data,
+						  server_info);
+	}
 
 	server_info->authenticated = true;
 
diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c
index b277a2c..2155076 100644
--- a/source4/libcli/raw/rawnotify.c
+++ b/source4/libcli/raw/rawnotify.c
@@ -155,11 +155,8 @@ NTSTATUS smb_raw_ntcancel(struct smbcli_request *oldreq)
 	 * smbcli_request_send() free's oneway requests
 	 * but we want to keep it under oldreq->ntcancel
 	 */
-	if (!talloc_reference(oldreq, req)) {
-		talloc_free(req);
-		return NT_STATUS_NO_MEMORY;
-	}
 	req->do_not_free = true;
+	talloc_steal(oldreq, req);
 
 	smbcli_request_send(req);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list