The Samba-Bugzilla – Attachment 4381 Details for
Bug 6525
Don't display non-existent shared resources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Shared resources detection
git.diff (text/plain), 1.84 KB, created by
Zhou Weikuan
on 2009-06-30 22:45:43 UTC
(
hide
)
Description:
Shared resources detection
Filename:
MIME Type:
Creator:
Zhou Weikuan
Created:
2009-06-30 22:45:43 UTC
Size:
1.84 KB
patch
obsolete
>diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c >index 070f7fd..70caf97 100644 >--- a/source3/rpc_server/srv_srvsvc_nt.c >+++ b/source3/rpc_server/srv_srvsvc_nt.c >@@ -537,7 +537,32 @@ static WERROR init_srv_share_info_ctr(pipes_struct *p, > > /* Count the number of entries. */ > for (snum = 0; snum < num_services; snum++) { >- if (lp_browseable(snum) && lp_snum_ok(snum) && >+ allowed[snum] = true; >+ if (lp_pathname(snum) != NULL) >+ { >+ /*check if the path exists.if it does not exist, then set to non-browseable*/ >+ /* expand the path first, for it may contain some variable such as %u %m */ >+ SMB_STRUCT_STAT sbuf; >+ char *path = talloc_asprintf(ctx, "%s", lp_pathname(snum)); >+ path = talloc_sub_advanced( >+ ctx, lp_servicename(snum), >+ get_current_username(), lp_pathname(snum), >+ p->server_info->utok.uid, get_current_username(), >+ "", path); >+ >+ if (sys_stat(path, &sbuf) != 0) >+ { >+ DEBUG(3, ("init_srv_share_info_ctr: stat of %s failed. %s\n", path, strerror(errno))); >+ allowed[snum] = false; >+ } >+ >+ if (!S_ISDIR(sbuf.st_ex_mode)) >+ { >+ DEBUG(3,("init_srv_share_info_ctr: %s is not a directory.\n", path)); >+ allowed[snum] = false; >+ } >+ } >+ if (allowed[snum] && lp_browseable(snum) && lp_snum_ok(snum) && > is_enumeration_allowed(p, snum) && > (all_shares || !is_hidden_share(snum)) ) { > DEBUG(10, ("counting service %s\n", lp_servicename(snum))); >@@ -545,6 +570,7 @@ static WERROR init_srv_share_info_ctr(pipes_struct *p, > num_entries++; > } else { > DEBUG(10, ("NOT counting service %s\n", lp_servicename(snum))); >+ allowed[snum] = false; > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6525
: 4381