Bug 7782 - Samba transforms ShareName to lowercase (sharename) when adding new share via MMC
Summary: Samba transforms ShareName to lowercase (sharename) when adding new share via...
Status: RESOLVED DUPLICATE of bug 7781
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: DCE-RPCs and pipes (show other bugs)
Version: 3.5.4
Hardware: x86 Linux
: P3 normal
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2010-11-08 06:28 UTC by Volodymyr Khomenko (dead mail address)
Modified: 2010-11-08 06:29 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr Khomenko (dead mail address) 2010-11-08 06:28:49 UTC
Due a hidden side-effect of find_service() function when adding a new share via MMC (Microsoft Console: rclick on My Computer-> Manage -> Action -> Connect to another computer-> Enter samba server name -> System tools -> rclick on Shares -> New share...) entered share name is distorted (converted to lowercase).
In such view mixed-case share names are impossible (they are always lowercased).

For example, when adding new share 'MyShareWithCapitalLetters' via MMC, the following command-line is running:

[2010/11/08 13:05:12.022746, 10, pid=13966] rpc_server/srv_srvsvc_nt.c:2019(_srvsvc_NetShareAdd)
  _srvsvc_NetShareAdd: Running [./tools/add_share "smb.conf" "mysharewithcapitalletters" "/my_share" "Test share with capitals in the name" "0"]

Attached patch can fix this problem:

--- source3/rpc_server/srv_srvsvc_nt.c
+++ source3/rpc_server/srv_srvsvc_nt.c
@@ -1737,7 +1737,7 @@ WERROR _srvsvc_NetShareAdd(pipes_struct 
 			   struct srvsvc_NetShareAdd *r)
 	char *command = NULL;
-	char *share_name = NULL;
+	char *share_name = NULL, *share_name_copy = NULL;
 	char *comment = NULL;
 	char *pathname = NULL;
 	int type;
@@ -1827,7 +1827,17 @@ WERROR _srvsvc_NetShareAdd(pipes_struct 
-	snum = find_service(share_name);
+	/* Dell 2010 / Samba upgrade project / MMC-related small fixes:
+		Before call to find_service make a copy of share_name
+		because find_service() modifies its parameter -
+		it converts share_name to to canonical form (all lowercase letters).
+		NB: find_service() converts share_name as a size-effect only if the service was not found;
+		so this fix is not applicable for _srvsvc_NetShareSetInfo because no translation there. */
+	if ((share_name_copy = talloc_strdup(ctx, share_name)) == NULL) {
+		return WERR_NOMEM;
+	}
+	snum = find_service(share_name_copy);
 	/* Share already exists. */
 	if (snum >= 0) {
Comment 1 Volodymyr Khomenko (dead mail address) 2010-11-08 06:29:19 UTC

*** This bug has been marked as a duplicate of bug 7781 ***