[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Nov 29 15:44:03 MST 2009


The branch, master has been updated
       via  99ba74b... s3: Fix a "not handled in switch" warning
       via  42f8325... s3: Fix an uninitialized variable reference
       via  4e9d95c... s3: Fix some nonempty blank lines
      from  7bbee8d... s3: Add a regression test for bug 6898

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


- Log -----------------------------------------------------------------
commit 99ba74b75ead69019e2982a6d8f94b625e4ba7c1
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 29 23:42:44 2009 +0100

    s3: Fix a "not handled in switch" warning

commit 42f832548d66245a16d7ec369494afb0bfc45425
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 29 22:57:19 2009 +0100

    s3: Fix an uninitialized variable reference

commit 4e9d95c1e761e0331f1edcd25a64171ce9b60cc7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Nov 29 22:23:22 2009 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/lib/ldb/ldb_tdb/ldb_tdb.c |    1 +
 source3/web/cgi.c                 |   43 +++++++++++++++++++------------------
 source3/web/swat.c                |   33 +++++++++++++--------------
 3 files changed, 39 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/ldb/ldb_tdb/ldb_tdb.c b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
index 27cc0c6..6bebb6d 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -59,6 +59,7 @@ static int ltdb_err_map(enum TDB_ERROR tdb_code)
 	case TDB_ERR_CORRUPT:
 	case TDB_ERR_OOM:
 	case TDB_ERR_EINVAL:
+	case TDB_ERR_NESTING:
 		return LDB_ERR_OPERATIONS_ERROR;
 	case TDB_ERR_IO:
 		return LDB_ERR_PROTOCOL_ERROR;
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 39108cf..c81ef87 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -1,17 +1,17 @@
 /* 
    some simple CGI helper routines
    Copyright (C) Andrew Tridgell 1997-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/>.
 */
@@ -53,7 +53,7 @@ static char *grab_line(FILE *f, int *cl)
 
 	while ((*cl)) {
 		int c;
-	
+
 		if (i == len) {
 			char *ret2;
 			if (len == 0) len = 1024;
@@ -62,7 +62,7 @@ static char *grab_line(FILE *f, int *cl)
 			if (!ret2) return ret;
 			ret = ret2;
 		}
-	
+
 		c = fgetc(f);
 		(*cl)--;
 
@@ -70,7 +70,7 @@ static char *grab_line(FILE *f, int *cl)
 			(*cl) = 0;
 			break;
 		}
-		
+
 		if (c == '\r') continue;
 
 		if (strchr_m("\n&", c)) break;
@@ -78,7 +78,7 @@ static char *grab_line(FILE *f, int *cl)
 		ret[i++] = c;
 
 	}
-	
+
 	if (ret) {
 		ret[i] = 0;
 	}
@@ -132,14 +132,14 @@ void cgi_load_variables(void)
 		while (len && (line=grab_line(f, &len))) {
 			p = strchr_m(line,'=');
 			if (!p) continue;
-			
+
 			*p = 0;
-			
+
 			variables[num_variables].name = SMB_STRDUP(line);
 			variables[num_variables].value = SMB_STRDUP(p+1);
 
 			SAFE_FREE(line);
-			
+
 			if (!variables[num_variables].name || 
 			    !variables[num_variables].value)
 				continue;
@@ -154,7 +154,7 @@ void cgi_load_variables(void)
 			       variables[num_variables].name,
 			       variables[num_variables].value);
 #endif
-			
+
 			num_variables++;
 			if (num_variables == MAX_VARIABLES) break;
 		}
@@ -169,9 +169,9 @@ void cgi_load_variables(void)
 		     tok=strtok_r(NULL, "&;", &saveptr)) {
 			p = strchr_m(tok,'=');
 			if (!p) continue;
-			
+
 			*p = 0;
-			
+
 			variables[num_variables].name = SMB_STRDUP(tok);
 			variables[num_variables].value = SMB_STRDUP(p+1);
 
@@ -366,33 +366,33 @@ static bool cgi_handle_authorization(char *line)
 	/*
 	 * Try and get the user from the UNIX password file.
 	 */
-	
+
 	pass = getpwnam_alloc(talloc_autofree_context(), user);
-	
+
 	/*
 	 * Validate the password they have given.
 	 */
-	
+
 	if NT_STATUS_IS_OK(pass_check(pass, user, user_pass, 
 		      strlen(user_pass), NULL, False)) {
-		
+
 		if (pass) {
 			/*
 			 * Password was ok.
 			 */
-			
+
 			if ( initgroups(pass->pw_name, pass->pw_gid) != 0 )
 				goto err;
 
 			become_user_permanently(pass->pw_uid, pass->pw_gid);
-			
+
 			/* Save the users name */
 			C_user = SMB_STRDUP(user);
 			TALLOC_FREE(pass);
 			return True;
 		}
 	}
-	
+
 err:
 	cgi_setup_error("401 Bad Authorization", 
 			"WWW-Authenticate: Basic realm=\"SWAT\"\r\n",
@@ -657,7 +657,8 @@ const char *cgi_remote_addr(void)
 {
 	if (inetd_server) {
 		char addr[INET6_ADDRSTRLEN];
-		return get_peer_addr(1,addr,sizeof(addr));
+		get_peer_addr(1,addr,sizeof(addr));
+		return talloc_strdup(talloc_tos(), addr);
 	}
 	return getenv("REMOTE_ADDR");
 }
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 1d843a0..8db175c 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -4,17 +4,17 @@
    Version 3.0.0
    Copyright (C) Andrew Tridgell 1997-2002
    Copyright (C) John H Terpstra 2002
-   
+
    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/>.
 */
@@ -417,9 +417,9 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
 		}
 
 		if ((parm_filter & FLAG_WIZARD) && !(parm->flags & FLAG_WIZARD)) continue;
-		
+
 		if ((parm_filter & FLAG_ADVANCED) && !(parm->flags & FLAG_ADVANCED)) continue;
-		
+
 		if (heading && heading != last_heading) {
 			printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading));
 			last_heading = heading;
@@ -446,7 +446,7 @@ static void write_config(FILE *f, bool show_defaults)
 	fprintf(f, "# Samba config file created using SWAT\n");
 	fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
 	fprintf(f, "# Date: %s\n\n", current_timestring(ctx, False));
-	
+
 	lp_dump(f, show_defaults, iNumNonAutoPrintServices);
 
 	TALLOC_FREE(ctx);
@@ -556,7 +556,7 @@ static void image_link(const char *name, const char *hlink, const char *src)
 static void show_main_buttons(void)
 {
 	char *p;
-	
+
 	if ((p = cgi_user_name()) && strcmp(p, "root")) {
 		printf(_("Logged in as <b>%s</b>"), p);
 		printf("<p>\n");
@@ -656,7 +656,7 @@ static void wizard_params_page(void)
 
 	printf("<input type=reset name=\"Reset Values\" value=\"Reset\">\n");
 	printf("<p>\n");
-	
+
 	printf("<table>\n");
 	show_parameters(GLOBAL_SECTION_SNUM, 1, parm_filter, 0);
 	printf("</table>\n");
@@ -703,7 +703,7 @@ static void wizard_page(void)
 
 		/* Plain text passwords are too badly broken - use encrypted passwords only */
 		lp_do_parameter( GLOBAL_SECTION_SNUM, "encrypt passwords", "Yes");
-		
+
 		switch ( SerType ){
 			case 0:
 				/* Stand-alone Server */
@@ -774,7 +774,7 @@ static void wizard_page(void)
 		winstype = 3;
 
 	role = lp_server_role();
-	
+
 	/* Here we go ... */
 	printf("<H2>%s</H2>\n", _("Samba Configuration Wizard"));
 	printf("<form method=post action=wizard>\n");
@@ -813,7 +813,7 @@ static void wizard_page(void)
 		const char **wins_servers = lp_wins_server_list();
 		for(i = 0; wins_servers[i]; i++) printf("%s ", wins_servers[i]);
 	}
-	
+
 	printf("\"></td></tr>\n");
 	if (winstype == 3) {
 		printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Error: WINS Server Mode and WINS Support both set in smb.conf"));
@@ -823,14 +823,14 @@ static void wizard_page(void)
 	printf("<td><input type=radio name=\"HomeExpo\" value=\"1\" %s> Yes</td>", (have_home == -1) ? "" : "checked ");
 	printf("<td><input type=radio name=\"HomeExpo\" value=\"0\" %s> No</td>", (have_home == -1 ) ? "checked" : "");
 	printf("<td></td></tr>\n");
-	
+
 	/* Enable this when we are ready ....
 	 * printf("<tr><td><b>%s:&nbsp;</b></td>\n", _("Is Print Server"));
 	 * printf("<td><input type=radio name=\"PtrSvr\" value=\"1\" %s> Yes</td>");
 	 * printf("<td><input type=radio name=\"PtrSvr\" value=\"0\" %s> No</td>");
 	 * printf("<td></td></tr>\n");
 	 */
-	
+
 	printf("</table></center>");
 	printf("<hr>");
 
@@ -1014,7 +1014,7 @@ static bool change_password(const char *remote_machine, const char *user_name,
 		printf("%s\n<p>", _("password change in demo mode rejected"));
 		return False;
 	}
-	
+
 	if (remote_machine != NULL) {
 		ret = remote_password_change(remote_machine, user_name,
 					     old_passwd, new_passwd, &err_str);
@@ -1028,7 +1028,7 @@ static bool change_password(const char *remote_machine, const char *user_name,
 		printf("%s\n<p>", _("Can't setup password database vectors."));
 		return False;
 	}
-	
+
 	ret = local_password_change(user_name, local_flags, new_passwd,
 					&err_str, &msg_str);
 
@@ -1111,7 +1111,6 @@ static void chg_passwd(void)
 	local_flags |= (cgi_variable(DELETE_USER_FLAG) ? LOCAL_DELETE_USER : 0);
 	local_flags |= (cgi_variable(ENABLE_USER_FLAG) ? LOCAL_ENABLE_USER : 0);
 	local_flags |= (cgi_variable(DISABLE_USER_FLAG) ? LOCAL_DISABLE_USER : 0);
-	
 
 	rslt = change_password(host,
 			       cgi_variable_nonull(SWAT_USER),
@@ -1128,7 +1127,7 @@ static void chg_passwd(void)
 			printf("\n");
 		}
 	}
-	
+
 	return;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list