summaryrefslogtreecommitdiff
path: root/source3/smbd/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/service.c')
-rw-r--r--source3/smbd/service.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index eb464c29b2..1b8e2e1d30 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -402,6 +402,13 @@ int find_service(fstring service)
if (iService < 0) {
}
+ /* Is it a usershare service ? */
+ if (iService < 0 && *lp_usershare_path()) {
+ /* Ensure the name is canonicalized. */
+ strlower_m(service);
+ iService = load_usershare_service(service);
+ }
+
/* just possibly it's a default service? */
if (iService < 0) {
char *pdefservice = lp_defaultservice();
@@ -414,6 +421,14 @@ int find_service(fstring service)
*/
pstring defservice;
pstrcpy(defservice, pdefservice);
+
+ /* Disallow anything except explicit share names. */
+ if (strequal(defservice,HOMES_NAME) ||
+ strequal(defservice, PRINTERS_NAME) ||
+ strequal(defservice, "ipc$")) {
+ goto fail;
+ }
+
iService = find_service(defservice);
if (iService >= 0) {
all_string_sub(service, "_","/",0);
@@ -426,13 +441,6 @@ int find_service(fstring service)
iService = load_registry_service(service);
}
- /* Is it a usershare service ? */
- if (iService < 0 && *lp_usershare_path()) {
- /* Ensure the name is canonicalized. */
- strlower_m(service);
- iService = load_usershare_service(service);
- }
-
if (iService >= 0) {
if (!VALID_SNUM(iService)) {
DEBUG(0,("Invalid snum %d for %s\n",iService, service));
@@ -440,6 +448,8 @@ int find_service(fstring service)
}
}
+ fail:
+
if (iService < 0)
DEBUG(3,("find_service() failed to find service %s\n", service));