1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

smbdotconf: mark "comment" with substitution="1"

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-10-15 16:54:45 +02:00
parent c23e3564fc
commit 8e86ac18e7
5 changed files with 38 additions and 14 deletions

View File

@ -1,6 +1,7 @@
<samba:parameter name="comment"
context="S"
type="string"
substitution="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>This is a text field that is seen next to a share

View File

@ -2805,10 +2805,12 @@ static void spoolss_notify_comment(struct messaging_context *msg_ctx,
struct spoolss_PrinterInfo2 *pinfo2,
TALLOC_CTX *mem_ctx)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
const char *p;
if (*pinfo2->comment == '\0') {
p = lp_comment(talloc_tos(), snum);
p = lp_comment(talloc_tos(), lp_sub, snum);
} else {
p = pinfo2->comment;
}
@ -3970,12 +3972,14 @@ static WERROR construct_printer_info1(TALLOC_CTX *mem_ctx,
struct spoolss_PrinterInfo1 *r,
int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
WERROR result;
r->flags = flags;
if (info2->comment == NULL || info2->comment[0] == '\0') {
r->comment = lp_comment(mem_ctx, snum);
r->comment = lp_comment(mem_ctx, lp_sub, snum);
} else {
r->comment = talloc_strdup(mem_ctx, info2->comment); /* saved comment */
}
@ -4007,6 +4011,8 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
struct spoolss_PrinterInfo2 *r,
int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
int count;
print_status_struct status;
WERROR result;
@ -4033,7 +4039,7 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
W_ERROR_HAVE_NO_MEMORY(r->drivername);
if (info2->comment[0] == '\0') {
r->comment = lp_comment(mem_ctx, snum);
r->comment = lp_comment(mem_ctx, lp_sub, snum);
} else {
r->comment = talloc_strdup(mem_ctx, info2->comment);
}

View File

@ -221,8 +221,10 @@ static void init_srv_share_info_1(struct pipes_struct *p,
struct srvsvc_NetShareInfo1 *r,
int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
char *net_name = lp_servicename(talloc_tos(), snum);
char *remark = lp_comment(p->mem_ctx, snum);
char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
if (remark) {
remark = talloc_sub_full(
@ -245,13 +247,15 @@ static void init_srv_share_info_2(struct pipes_struct *p,
struct srvsvc_NetShareInfo2 *r,
int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
char *remark = NULL;
char *path = NULL;
int max_connections = lp_max_connections(snum);
uint32_t max_uses = max_connections!=0 ? max_connections : (uint32_t)-1;
char *net_name = lp_servicename(talloc_tos(), snum);
remark = lp_comment(p->mem_ctx, snum);
remark = lp_comment(p->mem_ctx, lp_sub, snum);
if (remark) {
remark = talloc_sub_full(
p->mem_ctx, lp_servicename(talloc_tos(), snum),
@ -314,8 +318,10 @@ static void map_generic_share_sd_bits(struct security_descriptor *psd)
static void init_srv_share_info_501(struct pipes_struct *p,
struct srvsvc_NetShareInfo501 *r, int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
const char *net_name = lp_servicename(talloc_tos(), snum);
char *remark = lp_comment(p->mem_ctx, snum);
char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
if (remark) {
remark = talloc_sub_full(
@ -343,13 +349,15 @@ static void init_srv_share_info_501(struct pipes_struct *p,
static void init_srv_share_info_502(struct pipes_struct *p,
struct srvsvc_NetShareInfo502 *r, int snum)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
const char *net_name = lp_servicename(talloc_tos(), snum);
char *path = NULL;
struct security_descriptor *sd = NULL;
struct sec_desc_buf *sd_buf = NULL;
size_t sd_size = 0;
TALLOC_CTX *ctx = p->mem_ctx;
char *remark = lp_comment(ctx, snum);
char *remark = lp_comment(ctx, lp_sub, snum);
if (remark) {
remark = talloc_sub_full(
@ -390,7 +398,9 @@ static void init_srv_share_info_1004(struct pipes_struct *p,
struct srvsvc_NetShareInfo1004 *r,
int snum)
{
char *remark = lp_comment(p->mem_ctx, snum);
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
if (remark) {
remark = talloc_sub_full(
@ -1711,6 +1721,8 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p,
WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
struct srvsvc_NetShareSetInfo *r)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
char *command = NULL;
char *share_name = NULL;
char *comment = NULL;
@ -1831,7 +1843,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
}
pathname = lp_path(ctx, snum);
comment = lp_comment(ctx, snum);
comment = lp_comment(ctx, lp_sub, snum);
type = STYPE_DISKTREE;
break;
case 1006:
@ -1839,7 +1851,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
return WERR_ACCESS_DENIED;
case 1501:
pathname = lp_path(ctx, snum);
comment = lp_comment(ctx, snum);
comment = lp_comment(ctx, lp_sub, snum);
psd = info->info1501->sd;
map_generic_share_sd_bits(psd);
type = STYPE_DISKTREE;
@ -1879,7 +1891,8 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
/* Only call modify function if something changed. */
if (strcmp(path, lp_path(talloc_tos(), snum)) || strcmp(comment, lp_comment(talloc_tos(), snum))
if (strcmp(path, lp_path(talloc_tos(), snum))
|| strcmp(comment, lp_comment(talloc_tos(), lp_sub, snum))
|| (lp_max_connections(snum) != max_connections)
|| csc_policy_changed) {

View File

@ -1888,6 +1888,8 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
char** buf, int* buflen,
char** stringbuf, int* stringspace, char* baseaddr)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
int struct_len;
char* p;
char* p2;
@ -1915,7 +1917,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
len = 0;
if (uLevel > 0) {
len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), snum));
len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), lp_sub, snum));
}
if (uLevel > 1) {
len += strlen(lp_path(talloc_tos(), snum)) + 1;
@ -1962,7 +1964,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
}
SSVAL(p,14,type); /* device type */
SIVAL(p,16,PTR_DIFF(p2,baseaddr));
len += CopyExpanded(conn,snum,&p2,lp_comment(talloc_tos(),snum),&l2);
len += CopyExpanded(conn,snum,&p2,lp_comment(talloc_tos(), lp_sub, snum),&l2);
}
if (uLevel > 1) {

View File

@ -1264,6 +1264,8 @@ bool create_junction(TALLOC_CTX *ctx,
bool allow_broken_path,
struct junction_map *jucn)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
int snum;
bool dummy;
struct dfs_path *pdp = talloc(ctx,struct dfs_path);
@ -1299,7 +1301,7 @@ bool create_junction(TALLOC_CTX *ctx,
jucn->service_name = talloc_strdup(ctx, pdp->servicename);
jucn->volume_name = talloc_strdup(ctx, pdp->reqpath);
jucn->comment = lp_comment(ctx, snum);
jucn->comment = lp_comment(ctx, lp_sub, snum);
TALLOC_FREE(pdp);
if (!jucn->service_name || !jucn->volume_name || ! jucn->comment) {