[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Mar 14 10:43:20 MDT 2010


The branch, master has been updated
       via  727fb85... s3: Remove some unused #defines
       via  2111fe5... s3: Use a switch to implement map_nt_error_from_tdb
       via  6c00a3d... s3: Remove some unused code
       via  e003273... s3: Fix some nonempty blank lines
      from  5e06110... Reintroduce "s4:provision Improve the handling of provision errors""

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


- Log -----------------------------------------------------------------
commit 727fb8578261de8eed335ce5210d86ea556ce6d3
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 14 14:21:18 2010 +0100

    s3: Remove some unused #defines

commit 2111fe5255c1a76c267bbd0986a9f4566e6a68f9
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 14 13:49:58 2010 +0100

    s3: Use a switch to implement map_nt_error_from_tdb
    
    First, this immediately gave me the warning that TDB_ERR_NESTING was not
    covered and second, this saved 48 bytes in the .o :-)

commit 6c00a3db24808333df734dde15064d01b32dbf45
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 14 14:13:30 2010 +0100

    s3: Remove some unused code

commit e00327323ddec6074141a4c5638a12565b6345bd
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Mar 14 14:06:45 2010 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/groupdb/mapping.c   |   32 ++++++++---------
 source3/include/authdata.h  |    7 ++--
 source3/include/dbwrap.h    |    6 ++--
 source3/include/debug.h     |    6 ++--
 source3/include/dynconfig.h |    6 ++--
 source3/include/event.h     |    4 --
 source3/include/module.h    |    8 ----
 source3/lib/events.c        |   20 -----------
 source3/lib/util_tdb.c      |   77 ++++++++++++++++++++++++++-----------------
 9 files changed, 74 insertions(+), 92 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index b648c58..7add05e 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -51,13 +51,13 @@ NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name
 		DEBUG(0,("failed to initialize group mapping\n"));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
+
 	map.gid=gid;
 	if (!string_to_sid(&map.sid, sid)) {
 		DEBUG(0, ("string_to_sid failed: %s", sid));
 		return NT_STATUS_UNSUCCESSFUL;
 	}
-	
+
 	map.sid_name_use=sid_name_use;
 	fstrcpy(map.nt_name, nt_name);
 	fstrcpy(map.comment, comment);
@@ -105,7 +105,7 @@ bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map)
 {
 	struct group *grp;
 	bool ret;
-	
+
 	if(!init_group_mapping()) {
 		DEBUG(0,("failed to initialize group mapping\n"));
 		return(False);
@@ -114,28 +114,26 @@ bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map)
 	DEBUG(10, ("get_domain_group_from_sid\n"));
 
 	/* if the group is NOT in the database, it CAN NOT be a domain group */
-	
+
 	become_root();
 	ret = pdb_getgrsid(map, sid);
 	unbecome_root();
-	
+
 	/* special case check for rid 513 */
-	
+
 	if ( !ret ) {
 		uint32 rid;
-		
+
 		sid_peek_rid( &sid, &rid );
-		
+
 		if ( rid == DOMAIN_GROUP_RID_USERS ) {
 			fstrcpy( map->nt_name, "None" );
 			fstrcpy( map->comment, "Ordinary Users" );
 			sid_copy( &map->sid, &sid );
 			map->sid_name_use = SID_NAME_DOM_GRP;
 			map->gid = (gid_t)-1;
-			
 			return True;
 		}
-		
 		return False;
 	}
 
@@ -147,13 +145,13 @@ bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map)
 	}
 
 	DEBUG(10, ("get_domain_group_from_sid: SID is a domain group\n"));
- 	
+
 	if (map->gid==-1) {
 		return False;
 	}
 
 	DEBUG(10, ("get_domain_group_from_sid: SID is mapped to gid:%lu\n",(unsigned long)map->gid));
-	
+
 	grp = getgrgid(map->gid);
 	if ( !grp ) {
 		DEBUG(10, ("get_domain_group_from_sid: gid DOESN'T exist in UNIX security\n"));
@@ -745,22 +743,22 @@ NTSTATUS pdb_create_builtin_alias(uint32 rid)
 	fstring groupname;
 
 	DEBUG(10, ("Trying to create builtin alias %d\n", rid));
-	
+
 	if ( !sid_compose( &sid, &global_sid_Builtin, rid ) ) {
 		return NT_STATUS_NO_SUCH_ALIAS;
 	}
-	
+
 	if ( (mem_ctx = talloc_new(NULL)) == NULL ) {
 		return NT_STATUS_NO_MEMORY;
 	}
-	
+
 	if ( !lookup_sid(mem_ctx, &sid, NULL, &name, &type) ) {
 		TALLOC_FREE( mem_ctx );
 		return NT_STATUS_NO_SUCH_ALIAS;
 	}
-	
+
 	/* validate RID so copy the name and move on */
-		
+
 	fstrcpy( groupname, name );
 	TALLOC_FREE( mem_ctx );
 
diff --git a/source3/include/authdata.h b/source3/include/authdata.h
index e1a5155..f9578aa 100644
--- a/source3/include/authdata.h
+++ b/source3/include/authdata.h
@@ -2,18 +2,17 @@
    Unix SMB/CIFS implementation.
    Kerberos authorization data
    Copyright (C) Jim McDonough <jmcd at us.ibm.com> 2003
-   
-   
+
    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 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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, see <http://www.gnu.org/licenses/>.
 */
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index 1803587..846e1c2 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -2,17 +2,17 @@
    Unix SMB/CIFS implementation.
    Database interface wrapper around tdb
    Copyright (C) Volker Lendecke 2005-2007
-   
+
    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 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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, see <http://www.gnu.org/licenses/>.
 */
diff --git a/source3/include/debug.h b/source3/include/debug.h
index 56d0237..2c910da 100644
--- a/source3/include/debug.h
+++ b/source3/include/debug.h
@@ -5,17 +5,17 @@
    Copyright (C) John H Terpstra 1996-1998
    Copyright (C) Luke Kenneth Casson Leighton 1996-1998
    Copyright (C) Paul Ashton 1998
-   
+
    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 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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, see <http://www.gnu.org/licenses/>.
 */
diff --git a/source3/include/dynconfig.h b/source3/include/dynconfig.h
index 86c7713..850ef1e 100644
--- a/source3/include/dynconfig.h
+++ b/source3/include/dynconfig.h
@@ -2,17 +2,17 @@
    Unix SMB/CIFS implementation.
    Copyright (C) 2001 by Martin Pool <mbp at samba.org>
    Copyright (C) 2003 by Jim McDonough <jmcd at us.ibm.com>
-   
+
    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 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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, see <http://www.gnu.org/licenses/>.
 */
diff --git a/source3/include/event.h b/source3/include/event.h
index 93112a8..21c2eb5 100644
--- a/source3/include/event.h
+++ b/source3/include/event.h
@@ -26,10 +26,6 @@
 
 /* The following definitions come from lib/events.c  */
 
-void event_fd_set_writeable(struct fd_event *fde);
-void event_fd_set_not_writeable(struct fd_event *fde);
-void event_fd_set_readable(struct fd_event *fde);
-void event_fd_set_not_readable(struct fd_event *fde);
 bool event_add_to_select_args(struct event_context *event_ctx,
 			      const struct timeval *now,
 			      fd_set *read_fds, fd_set *write_fds,
diff --git a/source3/include/module.h b/source3/include/module.h
index 52245e0..667fac6 100644
--- a/source3/include/module.h
+++ b/source3/include/module.h
@@ -25,12 +25,4 @@ typedef NTSTATUS (init_module_function) (void);
 
 NTSTATUS init_samba_module(void);
 
-typedef int smb_event_id_t;
-#define SMB_EVENT_ID_INVALID	(-1)
-
-#define SMB_IDLE_EVENT_DEFAULT_INTERVAL	180
-#define SMB_IDLE_EVENT_MIN_INTERVAL	30
-
-typedef void (smb_idle_event_fn)(void **data,time_t *interval,time_t now);
-
 #endif /* _MODULE_H */
diff --git a/source3/lib/events.c b/source3/lib/events.c
index 75aa250..651b251 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -21,26 +21,6 @@
 #include "includes.h"
 #include <tevent_internal.h>
 
-void event_fd_set_writeable(struct tevent_fd *fde)
-{
-	TEVENT_FD_WRITEABLE(fde);
-}
-
-void event_fd_set_not_writeable(struct tevent_fd *fde)
-{
-	TEVENT_FD_NOT_WRITEABLE(fde);
-}
-
-void event_fd_set_readable(struct tevent_fd *fde)
-{
-	TEVENT_FD_READABLE(fde);
-}
-
-void event_fd_set_not_readable(struct tevent_fd *fde)
-{
-	TEVENT_FD_NOT_READABLE(fde);
-}
-
 /*
  * Return if there's something in the queue
  */
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index fe2f231..aef4a7d 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -642,39 +642,56 @@ fail:
 
 NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err)
 {
-	struct { enum TDB_ERROR err; NTSTATUS status; }	map[] =
-		{ { TDB_SUCCESS,	NT_STATUS_OK },
-		  { TDB_ERR_CORRUPT,	NT_STATUS_INTERNAL_DB_CORRUPTION },
-		  { TDB_ERR_IO,		NT_STATUS_UNEXPECTED_IO_ERROR },
-		  { TDB_ERR_OOM,	NT_STATUS_NO_MEMORY },
-		  { TDB_ERR_EXISTS,	NT_STATUS_OBJECT_NAME_COLLISION },
-
-		  /*
-		   * TDB_ERR_LOCK is very broad, we could for example
-		   * distinguish between fcntl locks and invalid lock
-		   * sequences. So NT_STATUS_FILE_LOCK_CONFLICT is a
-		   * compromise.
-		   */
-		  { TDB_ERR_LOCK,	NT_STATUS_FILE_LOCK_CONFLICT },
-		  /*
-		   * The next two ones in the enum are not actually used
-		   */
-		  { TDB_ERR_NOLOCK,	NT_STATUS_FILE_LOCK_CONFLICT },
-		  { TDB_ERR_LOCK_TIMEOUT, NT_STATUS_FILE_LOCK_CONFLICT },
-		  { TDB_ERR_NOEXIST,	NT_STATUS_NOT_FOUND },
-		  { TDB_ERR_EINVAL,	NT_STATUS_INVALID_PARAMETER },
-		  { TDB_ERR_RDONLY,	NT_STATUS_ACCESS_DENIED }
-		};
+	NTSTATUS result = NT_STATUS_INTERNAL_ERROR;
 
-	int i;
+	switch (err) {
+	case TDB_SUCCESS:
+		result = NT_STATUS_OK;
+		break;
+	case TDB_ERR_CORRUPT:
+		result = NT_STATUS_INTERNAL_DB_CORRUPTION;
+		break;
+	case TDB_ERR_IO:
+		result = NT_STATUS_UNEXPECTED_IO_ERROR;
+		break;
+	case TDB_ERR_OOM:
+		result = NT_STATUS_NO_MEMORY;
+		break;
+	case TDB_ERR_EXISTS:
+		result = NT_STATUS_OBJECT_NAME_COLLISION;
+		break;
 
-	for (i=0; i < sizeof(map) / sizeof(map[0]); i++) {
-		if (err == map[i].err) {
-			return map[i].status;
-		}
-	}
+	case TDB_ERR_LOCK:
+		/*
+		 * TDB_ERR_LOCK is very broad, we could for example
+		 * distinguish between fcntl locks and invalid lock
+		 * sequences. So NT_STATUS_FILE_LOCK_CONFLICT is a
+		 * compromise.
+		 */
+		result = NT_STATUS_FILE_LOCK_CONFLICT;
+		break;
 
-	return NT_STATUS_INTERNAL_ERROR;
+	case TDB_ERR_NOLOCK:
+	case TDB_ERR_LOCK_TIMEOUT:
+		/*
+		 * These two ones in the enum are not actually used
+		 */
+		result = NT_STATUS_FILE_LOCK_CONFLICT;
+		break;
+	case TDB_ERR_NOEXIST:
+		result = NT_STATUS_NOT_FOUND;
+		break;
+	case TDB_ERR_EINVAL:
+		result = NT_STATUS_INVALID_PARAMETER;
+		break;
+	case TDB_ERR_RDONLY:
+		result = NT_STATUS_ACCESS_DENIED;
+		break;
+	case TDB_ERR_NESTING:
+		result = NT_STATUS_INTERNAL_ERROR;
+		break;
+	};
+	return result;
 }
 
 int tdb_data_cmp(TDB_DATA t1, TDB_DATA t2)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list