summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-26 17:09:58 -0700
committerJeremy Allison <jra@samba.org>2010-03-26 17:09:58 -0700
commitfac8ca52ade6e490eea3cf3d0fc98287da321c13 (patch)
tree879b1e4611f59a26a524162893d7a14604dbd2c4 /source3/utils
parent203a661e01e1a138871aacb1cc329a3e3e79295a (diff)
downloadsamba-fac8ca52ade6e490eea3cf3d0fc98287da321c13.tar.gz
samba-fac8ca52ade6e490eea3cf3d0fc98287da321c13.tar.bz2
samba-fac8ca52ade6e490eea3cf3d0fc98287da321c13.zip
Fix bug #7240 - Net usershare is not case sensitive.
Updates usershare files in a backwards compatible way. I don't intend to back port this fix to 3.5.x as it depends on a version upgrade in the share_info.tdb share security database. Jeremy.
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_usershare.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index 7a688c1330..05b3cbd015 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -37,6 +37,8 @@ struct {
{N_("Path not allowed"), USERSHARE_PATH_NOT_ALLOWED},
{N_("Path is not a directory"), USERSHARE_PATH_NOT_DIRECTORY},
{N_("System error"), USERSHARE_POSIX_ERR},
+ {N_("Malformed sharename definition"), USERSHARE_MALFORMED_SHARENAME_DEF},
+ {N_("Bad sharename (doesn't match filename)"), USERSHARE_BAD_SHARENAME},
{NULL,(enum usershare_err)-1}
};
@@ -332,6 +334,7 @@ static int info_fn(struct file_list *fl, void *priv)
char *basepath;
char *sharepath = NULL;
char *comment = NULL;
+ char *cp_sharename = NULL;
char *acl_str;
int num_aces;
char sep_str[2];
@@ -392,6 +395,7 @@ static int info_fn(struct file_list *fl, void *priv)
us_err = parse_usershare_file(ctx, &sbuf, fl->pathname, -1, lines, numlines,
&sharepath,
&comment,
+ &cp_sharename,
&psd,
&guest_ok);
@@ -473,13 +477,13 @@ static int info_fn(struct file_list *fl, void *priv)
/* NOTE: This is smb.conf-like output. Do not translate. */
if (pi->op == US_INFO_OP) {
- d_printf("[%s]\n", fl->pathname );
+ d_printf("[%s]\n", cp_sharename );
d_printf("path=%s\n", sharepath );
d_printf("comment=%s\n", comment);
d_printf("%s\n", acl_str);
d_printf("guest_ok=%c\n\n", guest_ok ? 'y' : 'n');
} else if (pi->op == US_LIST_OP) {
- d_printf("%s\n", fl->pathname);
+ d_printf("%s\n", cp_sharename);
}
return 0;
@@ -617,6 +621,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
SMB_STRUCT_STAT sbuf;
SMB_STRUCT_STAT lsbuf;
char *sharename;
+ const char *cp_sharename;
char *full_path;
char *full_path_tmp;
const char *us_path;
@@ -645,21 +650,25 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
default:
return net_usershare_add_usage(c, argc, argv);
case 2:
+ cp_sharename = argv[0];
sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
break;
case 3:
+ cp_sharename = argv[0];
sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
break;
case 4:
+ cp_sharename = argv[0];
sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
arg_acl = argv[3];
break;
case 5:
+ cp_sharename = argv[0];
sharename = strlower_talloc(ctx, argv[0]);
us_path = argv[1];
us_comment = argv[2];
@@ -929,8 +938,14 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv)
/* Create the in-memory image of the file. */
file_img = talloc_strdup(ctx, "#VERSION 2\npath=");
- file_img = talloc_asprintf_append(file_img, "%s\ncomment=%s\nusershare_acl=%s\nguest_ok=%c\n",
- us_path, us_comment, us_acl, guest_ok ? 'y' : 'n');
+ file_img = talloc_asprintf_append(file_img,
+ "%s\ncomment=%s\nusershare_acl=%s\n"
+ "guest_ok=%c\nsharename=%s\n",
+ us_path,
+ us_comment,
+ us_acl,
+ guest_ok ? 'y' : 'n',
+ cp_sharename);
to_write = strlen(file_img);