[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5207-gf63751a

Jeremy Allison jra at samba.org
Fri Apr 10 05:46:21 GMT 2009


The branch, v3-3-test has been updated
       via  f63751ad272b9caade7855665b8a3352cefe2ae7 (commit)
       via  4c5853bd52678cc2aac87f14f2366453df5e7e94 (commit)
       via  e3584e529ce0a697222ffdff842c3217464866b8 (commit)
      from  a46f334c73683276984727a7306b18d2d2a8e222 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit f63751ad272b9caade7855665b8a3352cefe2ae7
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Apr 9 22:46:31 2009 -0700

    Fix bug #6254 - PUT/GET produces an error in IPv6 to a smb-server(3.3)
    has parameter "msdfs root = yes"
    This was broken by the refactoring around create_file().
    MSDFS pathname processing must be done FIRST.
    MSDFS pathnames containing IPv6 addresses can
    be confused with NTFS stream names (they contain
    ":" characters.
    Jeremy.

commit 4c5853bd52678cc2aac87f14f2366453df5e7e94
Merge: e3584e529ce0a697222ffdff842c3217464866b8 a46f334c73683276984727a7306b18d2d2a8e222
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Apr 9 21:21:11 2009 -0700

    Merge branch 'v3-3-test' of ssh://jra@git.samba.org/data/git/samba into v3-3-test

commit e3584e529ce0a697222ffdff842c3217464866b8
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Apr 1 20:14:35 2009 -0700

    Allow pdbedit to change a user rid/sid. Based on a fix from Alexander
    Zagrebin <alexz at visp.ru>.
    Jeremy.

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

Summary of changes:
 source/passdb/pdb_tdb.c |   60 ++++++++++++++++++++++++++++++++++++++++++++--
 source/smbd/open.c      |   41 ++++++++++++++++++--------------
 2 files changed, 80 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index 73814ef..b35d209 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/passdb/pdb_tdb.c
@@ -817,12 +817,17 @@ static bool tdb_update_ridrec_only( struct samu* newpwd, int flag )
 static bool tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd,
 			   int flag)
 {
-	if (!pdb_get_user_rid(newpwd)) {
+	uint32_t oldrid;
+	uint32_t newrid;
+
+	if (!(newrid = pdb_get_user_rid(newpwd))) {
 		DEBUG(0,("tdb_update_sam: struct samu (%s) with no RID!\n",
 			 pdb_get_username(newpwd)));
 		return False;
 	}
 
+	oldrid = newrid;
+
 	/* open the database */
 
 	if ( !tdbsam_open( tdbsam_filename ) ) {
@@ -835,11 +840,60 @@ static bool tdb_update_sam(struct pdb_methods *my_methods, struct samu* newpwd,
 		return false;
 	}
 
-	if (!tdb_update_samacct_only(newpwd, flag)
-	    || !tdb_update_ridrec_only(newpwd, flag)) {
+	/* If we are updating, we may be changing this users RID. Retrieve the old RID
+	   so we can check. */
+
+	if (flag == TDB_MODIFY) {
+		struct samu *account = samu_new(talloc_tos());
+		if (account == NULL) {
+			DEBUG(0,("tdb_update_sam: samu_new() failed\n"));
+			goto cancel;
+		}
+		if (!NT_STATUS_IS_OK(tdbsam_getsampwnam(my_methods, account, pdb_get_username(newpwd)))) {
+			DEBUG(0,("tdb_update_sam: tdbsam_getsampwnam() for %s failed\n",
+				pdb_get_username(newpwd)));
+			TALLOC_FREE(account);
+			goto cancel;
+		}
+		if (!(oldrid = pdb_get_user_rid(account))) {
+			DEBUG(0,("tdb_update_sam: pdb_get_user_rid() failed\n"));
+			TALLOC_FREE(account);
+			goto cancel;
+		}
+		TALLOC_FREE(account);
+	}
+
+	/* Update the new samu entry. */
+	if (!tdb_update_samacct_only(newpwd, flag)) {
 		goto cancel;
 	}
 
+	/* Now take care of the case where the RID changed. We need
+	 * to delete the old RID key and add the new. */
+
+	if (flag == TDB_MODIFY && newrid != oldrid) { 
+		fstring keystr;
+
+		/* Delete old RID key */
+		DEBUG(10, ("tdb_update_sam: Deleting key for RID %u\n", oldrid));
+		slprintf(keystr, sizeof(keystr) - 1, "%s%.8x", RIDPREFIX, oldrid);
+		if (!NT_STATUS_IS_OK(dbwrap_delete_bystring(db_sam, keystr))) {
+			DEBUG(0, ("tdb_update_sam: Can't delete %s\n", keystr));
+			goto cancel;
+		}
+		/* Insert new RID key */
+		DEBUG(10, ("tdb_update_sam: Inserting key for RID %u\n", newrid));
+		if (!tdb_update_ridrec_only(newpwd, TDB_INSERT)) {
+			goto cancel;
+		}
+	} else {
+		DEBUG(10, ("tdb_update_sam: %s key for RID %u\n",
+			flag == TDB_MODIFY ? "Updating" : "Inserting", newrid));
+		if (!tdb_update_ridrec_only(newpwd, flag)) {
+			goto cancel;
+		}
+	}
+
 	if (db_sam->transaction_commit(db_sam) != 0) {
 		DEBUG(0, ("Could not commit transaction\n"));
 		return false;
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 064e17c..658cc5a 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -3282,6 +3282,29 @@ NTSTATUS create_file(connection_struct *conn,
 		  (unsigned int)root_dir_fid,
 		  ea_list, sd, fname));
 
+	/* MSDFS pathname processing must be done FIRST.
+	   MSDFS pathnames containing IPv6 addresses can
+	   be confused with NTFS stream names (they contain
+	   ":" characters. JRA. */
+
+	if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) {
+		char *resolved_fname;
+
+		status = resolve_dfspath(talloc_tos(), conn, true, fname,
+					 &resolved_fname);
+
+		if (!NT_STATUS_IS_OK(status)) {
+			/*
+			 * For PATH_NOT_COVERED we had
+			 * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
+			 *		   ERRSRV, ERRbadpath);
+			 * Need to fix in callers
+			 */
+			goto fail;
+		}
+		fname = resolved_fname;
+	}
+
 	/*
 	 * Get the file name.
 	 */
@@ -3409,24 +3432,6 @@ NTSTATUS create_file(connection_struct *conn,
 		}
 	}
 
-	if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) {
-		char *resolved_fname;
-
-		status = resolve_dfspath(talloc_tos(), conn, true, fname,
-					 &resolved_fname);
-
-		if (!NT_STATUS_IS_OK(status)) {
-			/*
-			 * For PATH_NOT_COVERED we had
-			 * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-			 *		   ERRSRV, ERRbadpath);
-			 * Need to fix in callers
-			 */
-			goto fail;
-		}
-		fname = resolved_fname;
-	}
-
 	/*
 	 * Check if POSIX semantics are wanted.
 	 */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list