diff options
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_usershare.c | 23 |
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); |