[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Wed Jun 6 15:23:03 MDT 2012


The branch, master has been updated
       via  1c01cb4 s3:include: change lock_struct->fnum to uint64_t
       via  fab6607 s3:include: change lock_context->tid to uint32_t
       via  4389097 s3:include: change connection_struct->cnum to uint32_t
       via  86f6214 s3:include: change smb_request->tid to uint32_t
       via  eb70aff s3:smb: change the value of TID_FIELD_INVALID from -1 to 0
       via  ba16994 s3:smb: introduce a name TID_FIELD_INVALID for the invalid value for a cnum/tid
       via  aa3a7de s3:connections: add a CNUM_OFFSET for mapping between cnum and the bitmap index
       via  82a9d23 s3:smb.h: fix a comment typo
       via  abe4798 s4:dns-server: remove an extra blank line from handle_question()
      from  238d24a auth-kerberos: avoid crash with MIT krb5 1.10.0 in gss_get_name_attribute()

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


- Log -----------------------------------------------------------------
commit 1c01cb45101a2f0193921ba967f800bdf6bb83cb
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:42:48 2012 +0200

    s3:include: change lock_struct->fnum to uint64_t
    
    Note: this changes the format of brlock.tdb!
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Wed Jun  6 23:22:00 CEST 2012 on sn-devel-104

commit fab660780ab5f3afda11ae3daee8f50571fc4145
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:33:58 2012 +0200

    s3:include: change lock_context->tid to uint32_t
    
    Note: this changes for format of brlock.tdb!
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 43890972945f19fdf0f009eec03e7d493b2760e9
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:28:14 2012 +0200

    s3:include: change connection_struct->cnum to uint32_t
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 86f621488aae89856a9c6ae5a91ae5bf96302659
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:26:05 2012 +0200

    s3:include: change smb_request->tid to uint32_t
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit eb70aff2f55e255bff569b918ba1bbe56ad46f57
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:23:55 2012 +0200

    s3:smb: change the value of TID_FIELD_INVALID from -1 to 0
    
    This paves the way to change the tid/cnum types to systematic uint32_t.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit ba1699463bee4d622e76f54c1a1c17858545c84f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:22:31 2012 +0200

    s3:smb: introduce a name TID_FIELD_INVALID for the invalid value for a cnum/tid
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit aa3a7de3687ac78ae1ed3fa395d8c4707a24b774
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 15:12:08 2012 +0200

    s3:connections: add a CNUM_OFFSET for mapping between cnum and the bitmap index
    
    This moves the start of the range of valid cnum values up from 0 to CNUM_OFFSET
    (currently 1), so that in a later step we can use 0 as invalid cnum value
    instead of the current -1. This will allow us to change the type of cnum to
    uint32_t from a mix of int and unsigned.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>

commit 82a9d23186d6729f3a3b24900310beb7090b0b2c
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jun 6 14:51:13 2012 +0200

    s3:smb.h: fix a comment typo

commit abe479839887433480d1f4fa223c1204d949953d
Author: Michael Adam <obnox at samba.org>
Date:   Thu May 31 20:51:29 2012 +0200

    s4:dns-server: remove an extra blank line from handle_question()

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

Summary of changes:
 source3/include/locking.h      |    4 ++--
 source3/include/smb.h          |    5 ++++-
 source3/include/vfs.h          |    4 ++--
 source3/locking/brlock.c       |    6 +++---
 source3/locking/locking.c      |    4 ++--
 source3/locking/posix.c        |    3 ++-
 source3/smbd/conn.c            |   16 +++++++++++-----
 source3/smbd/connection.c      |    2 +-
 source3/smbd/msdfs.c           |    2 +-
 source3/smbd/proto.h           |    2 +-
 source3/utils/net_status.c     |    4 ++--
 source3/utils/status.c         |    2 +-
 source3/web/statuspage.c       |    6 +++---
 source4/dns_server/dns_query.c |    1 -
 14 files changed, 35 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/locking.h b/source3/include/locking.h
index 3d12fc2..32593af 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -39,7 +39,7 @@ enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
 
 struct lock_context {
 	uint64_t smblctx;
-	uint16 tid;
+	uint32_t tid;
 	struct server_id pid;
 };
 
@@ -66,7 +66,7 @@ struct lock_struct {
 	struct lock_context context;
 	br_off start;
 	br_off size;
-	uint16 fnum;
+	uint64_t fnum;
 	enum brl_type lock_type;
 	enum brl_flavour lock_flav;
 };
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 832438f..fdaf8c5 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -665,13 +665,16 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
 /* ACL compatibility */
 enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
 /*
- * Global value meaing that the smb_uid field should be
+ * Global value meaning that the smb_uid field should be
  * ingored (in share level security and protocol level == CORE)
  */
 
 #define UID_FIELD_INVALID 0
 #define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
 
+#define TID_FIELD_INVALID 0
+#define CNUM_OFFSET 1 /* shift for bitmap index */
+
 /* 
  * Size of buffer to use when moving files across filesystems. 
  */
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index ec139a7..3062aa1 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -280,7 +280,7 @@ struct share_params {
 typedef struct connection_struct {
 	struct connection_struct *next, *prev;
 	struct smbd_server_connection *sconn; /* can be NULL */
-	unsigned cnum; /* an index passed over the wire */
+	uint32_t cnum; /* an index passed over the wire */
 	struct share_params *params;
 	bool force_user;
 	struct vuid_cache vuid_cache;
@@ -350,7 +350,7 @@ struct smb_request {
 	uint64_t mid; /* For compatibility with SMB2. */
 	uint32_t seqnum;
 	uint64_t vuid; /* For compatibility with SMB2. */
-	uint16 tid;
+	uint32_t tid;
 	uint8  wct;
 	const uint16_t *vwv;
 	uint16_t buflen;
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 289e5d1..b82914a 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -54,10 +54,10 @@ static void print_lock_struct(unsigned int i, struct lock_struct *pls)
 			(unsigned int)pls->context.tid,
 			server_id_str(talloc_tos(), &pls->context.pid) ));
 
-	DEBUG(10,("start = %.0f, size = %.0f, fnum = %d, %s %s\n",
+	DEBUG(10,("start = %.0f, size = %.0f, fnum = %llu, %s %s\n",
 		(double)pls->start,
 		(double)pls->size,
-		pls->fnum,
+		(unsigned long long)pls->fnum,
 		lock_type_name(pls->lock_type),
 		lock_flav_name(pls->lock_flav) ));
 }
@@ -1486,7 +1486,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx,
 		    struct byte_range_lock *br_lck)
 {
 	files_struct *fsp = br_lck->fsp;
-	uint16 tid = fsp->conn->cnum;
+	uint32_t tid = fsp->conn->cnum;
 	int fnum = fsp->fnum;
 	unsigned int i;
 	struct lock_struct *locks = br_lck->lock_data;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 5da7595..5553702 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -154,11 +154,11 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
 	}
 
 	DEBUG(10,("strict_lock_default: flavour = %s brl start=%.0f "
-			"len=%.0f %s for fnum %d file %s\n",
+			"len=%.0f %s for fnum %llu file %s\n",
 			lock_flav_name(plock->lock_flav),
 			(double)plock->start, (double)plock->size,
 			ret ? "unlocked" : "locked",
-			plock->fnum, fsp_str_dbg(fsp)));
+			(unsigned long long)plock->fnum, fsp_str_dbg(fsp)));
 
 	return ret;
 }
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 557099b..2a274f9 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -791,7 +791,8 @@ static struct lock_list *posix_lock_list(TALLOC_CTX *ctx,
 
 		for (l_curr = lhead; l_curr;) {
 
-			DEBUG(10,("posix_lock_list: lock: fnum=%d: start=%.0f,size=%.0f:type=%s", lock->fnum,
+			DEBUG(10,("posix_lock_list: lock: fnum=%llu: start=%.0f,size=%.0f:type=%s",
+				(unsigned long long)lock->fnum,
 				(double)lock->start, (double)lock->size, posix_lock_type_name(lock->lock_type) ));
 
 			if ( (l_curr->start >= (lock->start + lock->size)) ||
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index 1344bac..399935a 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -71,7 +71,7 @@ bool conn_snum_used(struct smbd_server_connection *sconn,
  Find a conn given a cnum.
 ****************************************************************************/
 
-connection_struct *conn_find(struct smbd_server_connection *sconn,unsigned cnum)
+connection_struct *conn_find(struct smbd_server_connection *sconn, uint32_t cnum)
 {
 	size_t count=0;
 	struct connection_struct *conn;
@@ -98,6 +98,7 @@ connection_struct *conn_new(struct smbd_server_connection *sconn)
 {
 	connection_struct *conn;
 	int i;
+	uint32_t cnum;
         int find_offset = 1;
 
 	if (sconn->using_smb2) {
@@ -156,7 +157,8 @@ find_again:
 	 * which is limited to 16 bits (we skip 0xffff which is the
 	 * NULL TID).
 	 */
-	if (i > 65534) {
+	cnum = i + CNUM_OFFSET;
+	if (cnum >= 0xFFFF) {
 		DEBUG(0, ("Maximum connection limit reached\n"));
 		return NULL;
 	}
@@ -168,7 +170,7 @@ find_again:
 		return NULL;
 	}
 	conn->sconn = sconn;
-	conn->cnum = i;
+	conn->cnum = cnum;
 	conn->force_group_gid = (gid_t)-1;
 
 	bitmap_set(sconn->smb1.tcons.bmap, i);
@@ -293,12 +295,16 @@ void conn_free(connection_struct *conn)
 	}
 
 	if (!conn->sconn->using_smb2 &&
-	    conn->sconn->smb1.tcons.bmap != NULL) {
+	    conn->sconn->smb1.tcons.bmap != NULL &&
+	    conn->cnum >= CNUM_OFFSET &&
+	    conn->cnum < 0xFFFF)
+	{
+		int i = conn->cnum - CNUM_OFFSET;
 		/*
 		 * Can be NULL for fake connections created by
 		 * create_conn_struct()
 		 */
-		bitmap_clear(conn->sconn->smb1.tcons.bmap, conn->cnum);
+		bitmap_clear(conn->sconn->smb1.tcons.bmap, i);
 	}
 
 	DLIST_REMOVE(conn->sconn->connections, conn);
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 01eb9d7..846a173 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -71,7 +71,7 @@ static int count_fn(struct db_record *rec,
 {
 	struct count_stat *cs = (struct count_stat *)udp;
 
-	if (crec->cnum == -1) {
+	if (crec->cnum == TID_FIELD_INVALID) {
 		return 0;
 	}
 
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 9da8a8d..6f182b4 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -276,7 +276,7 @@ NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
 	}
 
 	conn->params->service = snum;
-	conn->cnum = (unsigned)-1;
+	conn->cnum = TID_FIELD_INVALID;
 
 	DLIST_ADD(conn->sconn->connections, conn);
 	conn->sconn->num_connections++;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index d581157..b527d20 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -147,7 +147,7 @@ void conn_init(struct smbd_server_connection *sconn);
 int conn_num_open(struct smbd_server_connection *sconn);
 bool conn_snum_used(struct smbd_server_connection *sconn, int snum);
 connection_struct *conn_find(struct smbd_server_connection *sconn,
-			     unsigned cnum);
+			     uint32_t cnum);
 connection_struct *conn_new(struct smbd_server_connection *sconn);
 void conn_close_all(struct smbd_server_connection *sconn);
 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c
index 2bb6391..85d0235 100644
--- a/source3/utils/net_status.c
+++ b/source3/utils/net_status.c
@@ -96,7 +96,7 @@ static int show_share(struct db_record *rec,
 		      const struct connections_data *crec,
 		      void *state)
 {
-	if (crec->cnum == -1)
+	if (crec->cnum == TID_FIELD_INVALID)
 		return 0;
 
 	if (!process_exists(crec->pid)) {
@@ -143,7 +143,7 @@ static int show_share_parseable(const struct connections_key *key,
 	int i;
 	bool guest = true;
 
-	if (crec->cnum == -1)
+	if (crec->cnum == TID_FIELD_INVALID)
 		return 0;
 
 	if (!process_exists(crec->pid)) {
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 1bcb140..a6e8055 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -250,7 +250,7 @@ static int traverse_fn1(const struct connections_key *key,
 			const struct connections_data *crec,
 			void *state)
 {
-	if (crec->cnum == -1)
+	if (crec->cnum == TID_FIELD_INVALID)
 		return 0;
 
 	if (!process_exists(crec->pid) || !Ucrit_checkUid(crec->uid)) {
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index 4b3d3ae..dd83d15 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -190,7 +190,7 @@ static int traverse_fn1(const struct connections_key *key,
 			const struct connections_data *crec,
 			void *private_data)
 {
-	if (crec->cnum == -1 && process_exists(crec->pid)) {
+	if (crec->cnum == TID_FIELD_INVALID && process_exists(crec->pid)) {
 		char buf[30];
 		slprintf(buf,sizeof(buf)-1,"kill_%s", procid_str_static(&crec->pid));
 		if (cgi_variable(buf)) {
@@ -206,7 +206,7 @@ static int traverse_fn2(const struct connections_key *key,
                         const struct connections_data *crec,
                         void *private_data)
 {
-	if (crec->cnum == -1 || !process_exists(crec->pid) ||
+	if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid) ||
 	    procid_equal(&crec->pid, &smbd_pid))
 		return 0;
 
@@ -230,7 +230,7 @@ static int traverse_fn3(const struct connections_key *key,
                         const struct connections_data *crec,
                         void *private_data)
 {
-	if (crec->cnum == -1 || !process_exists(crec->pid))
+	if (crec->cnum == TID_FIELD_INVALID || !process_exists(crec->pid))
 		return 0;
 
 	printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
diff --git a/source4/dns_server/dns_query.c b/source4/dns_server/dns_query.c
index 40df3a1..5978fe9 100644
--- a/source4/dns_server/dns_query.c
+++ b/source4/dns_server/dns_query.c
@@ -315,7 +315,6 @@ static WERROR handle_question(struct dns_server *dns,
 	*answers = ans;
 
 	return WERR_OK;
-
 }
 
 struct dns_server_process_query_state {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list